6 sided part materials, but stud tiling doesnt work

This commit is contained in:
floralrainfall 2023-07-17 03:16:19 -04:00
parent 580399eeec
commit b6f8536d35
12 changed files with 141 additions and 16 deletions

View File

@ -0,0 +1,15 @@
// generated by blender2ogre 0.8.3 on 2023-07-17 02:58:22
material BackMaterial {
receive_shadows on
technique {
pass {
diffuse 0.8 0.8 0.8 1.0
specular 0.5 0.0 0 0 0
rtshader_system {
lighting_stage metal_roughness
texturing_stage late_add_blend
}
}
}
}

View File

@ -0,0 +1,15 @@
// generated by blender2ogre 0.8.3 on 2023-07-17 02:58:22
material BottomMaterial {
receive_shadows on
technique {
pass {
diffuse 0.8 0.8 0.8 1.0
specular 0.5 0.0 0 0 0
rtshader_system {
lighting_stage metal_roughness
texturing_stage late_add_blend
}
}
}
}

Binary file not shown.

View File

@ -0,0 +1,15 @@
// generated by blender2ogre 0.8.3 on 2023-07-17 02:58:22
material FrontMaterial {
receive_shadows on
technique {
pass {
diffuse 0.8 0.8 0.8 1.0
specular 0.5 0.0 0 0 0
rtshader_system {
lighting_stage metal_roughness
texturing_stage late_add_blend
}
}
}
}

View File

@ -0,0 +1,15 @@
// generated by blender2ogre 0.8.3 on 2023-07-17 02:58:22
material LeftMaterial {
receive_shadows on
technique {
pass {
diffuse 0.8 0.8 0.8 1.0
specular 0.5 0.0 0 0 0
rtshader_system {
lighting_stage metal_roughness
texturing_stage late_add_blend
}
}
}
}

View File

@ -0,0 +1,15 @@
// generated by blender2ogre 0.8.3 on 2023-07-17 02:58:22
material RightMaterial {
receive_shadows on
technique {
pass {
diffuse 0.8 0.8 0.8 1.0
specular 0.5 0.0 0 0 0
rtshader_system {
lighting_stage metal_roughness
texturing_stage late_add_blend
}
}
}
}

View File

@ -0,0 +1,15 @@
// generated by blender2ogre 0.8.3 on 2023-07-17 02:58:22
material TopMaterial {
receive_shadows on
technique {
pass {
diffuse 0.8 0.8 0.8 1.0
specular 0.5 0.0 0 0 0
rtshader_system {
lighting_stage metal_roughness
texturing_stage late_add_blend
}
}
}
}

View File

@ -1,28 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- exporter: blender2ogre 0.8.3 -->
<!-- export_time: Mon, 10 Jul 2023 21:20:16 +0000 -->
<!-- export_time: Mon, 17 Jul 2023 06:58:22 +0000 -->
<!-- previous_export_time: Mon, 17 Jul 2023 06:14:49 +0000 -->
<scene author="caesium" formatVersion="1.1" >
<nodes >
<node name="FormFactor_Brick" >
<node name="Cube" >
<position x="0.000000" y="0.000000" z="0.000000" />
<rotation qw="1.000000" qx="0.000000" qy="0.000000" qz="0.000000" />
<scale x="1.000000" y="1.000000" z="1.000000" />
<entity meshFile="Cube.mesh" name="FormFactor_Brick" >
<entity meshFile="Cube.mesh" name="Cube" >
<userData />
</entity>
</node>
<node name="Camera" >
<position x="7.358891" y="-6.925791" z="4.958309" />
<rotation qw="0.780483" qx="0.483536" qy="0.208704" qz="0.336872" />
<scale x="1.000000" y="1.000000" z="1.000000" />
<camera fov="0.356186" name="Camera" projectionType="perspective" >
<clipping far="100.000000" near="0.100000" />
</camera>
</node>
</nodes>
<externals >
<item type="material" >
<file name="Material.material" />
<file name="TopMaterial.material" />
</item>
<item type="material" >
<file name="BackMaterial.material" />
</item>
<item type="material" >
<file name="BottomMaterial.material" />
</item>
<item type="material" >
<file name="FrontMaterial.material" />
</item>
<item type="material" >
<file name="LeftMaterial.material" />
</item>
<item type="material" >
<file name="RightMaterial.material" />
</item>
</externals>
<environment >

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

2
Dependencies/Luau vendored

@ -1 +1 @@
Subproject commit 218159140c7d79ae745e646da721d12331f536f5
Subproject commit e25de95445f2d635a125ab463426bb7fda017093

View File

@ -13,6 +13,12 @@ namespace RNR
m_geom->setCastShadows(true);
m_partEntity = world->getOgreSceneManager()->createEntity("fonts/Cube.mesh");
m_partEntity->setCastShadows(true);
for(int i = 0; i < m_partEntity->getNumSubEntities(); i++)
{
Ogre::SubEntity* surface = m_partEntity->getSubEntity(i);
Ogre::TextureUnitState* texture = surface->getMaterial()->getTechnique(0)->getPass(0)->createTextureUnitState("textures/stud_top.png");
}
}
void Workspace::onChildAdded(Instance* childAdded)
@ -25,9 +31,30 @@ namespace RNR
PartInstance* child_part = dynamic_cast<PartInstance*>(instance);
if(child_part)
{
#ifndef DONT_USE_BRICKCOLOR_MATERIAL
m_partEntity->setMaterial(BrickColor::material(child_part->getBrickColor()));
#endif
Ogre::Vector3 part_size = child_part->getSize();
for(int i = 0; i < m_partEntity->getNumSubEntities(); i++)
{
Ogre::SubEntity* surface = m_partEntity->getSubEntity(i);
Ogre::TextureUnitState* texture = surface->getMaterial()->getTechnique(0)->getPass(0)->getTextureUnitState(0);
Ogre::Vector2 uvs;
std::string surf_name = std::string(surface->getMaterialName().c_str());
if(surf_name == "TopMaterial")
uvs = Ogre::Vector2(part_size.x, part_size.z);
else if(surf_name == "BottomMaterial")
uvs = Ogre::Vector2(-part_size.x, part_size.z);
else if(surf_name == "LeftMaterial")
uvs = Ogre::Vector2(part_size.y, part_size.z);
else if(surf_name == "RightMaterial")
uvs = Ogre::Vector2(-part_size.y, part_size.z);
else if(surf_name == "BackMaterial")
uvs = Ogre::Vector2(part_size.x, part_size.z);
else if(surf_name == "FrontMaterial")
uvs = Ogre::Vector2(-part_size.x, part_size.z);
texture->setTextureScale(uvs.x,uvs.y);
}
m_geom->addEntity(m_partEntity,
child_part->getCFrame().getPosition(),
Ogre::Quaternion(child_part->getCFrame().getRotation()),