Use a uniform material loading for non-glsl (for server)
This commit is contained in:
parent
bc675ffd81
commit
f975e37dea
@ -354,13 +354,6 @@ void PhysicalObject::init(const PhysicalObject::Settings& settings)
|
|||||||
case MP_EXACT:
|
case MP_EXACT:
|
||||||
{
|
{
|
||||||
extend.setY(0);
|
extend.setY(0);
|
||||||
|
|
||||||
// In case of readonly materials we have to get the material from
|
|
||||||
// the mesh, otherwise from the node. This is esp. important for
|
|
||||||
// water nodes, which only have the material defined in the node,
|
|
||||||
// but not in the mesh at all!
|
|
||||||
bool is_readonly_material = false;
|
|
||||||
|
|
||||||
scene::IMesh* mesh = NULL;
|
scene::IMesh* mesh = NULL;
|
||||||
switch (presentation->getNode()->getType())
|
switch (presentation->getNode()->getType())
|
||||||
{
|
{
|
||||||
@ -371,7 +364,6 @@ void PhysicalObject::init(const PhysicalObject::Settings& settings)
|
|||||||
scene::IMeshSceneNode *node =
|
scene::IMeshSceneNode *node =
|
||||||
(scene::IMeshSceneNode*)presentation->getNode();
|
(scene::IMeshSceneNode*)presentation->getNode();
|
||||||
mesh = node->getMesh();
|
mesh = node->getMesh();
|
||||||
is_readonly_material = node->isReadOnlyMaterials();
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case scene::ESNT_ANIMATED_MESH :
|
case scene::ESNT_ANIMATED_MESH :
|
||||||
@ -380,7 +372,6 @@ void PhysicalObject::init(const PhysicalObject::Settings& settings)
|
|||||||
scene::IAnimatedMeshSceneNode *node =
|
scene::IAnimatedMeshSceneNode *node =
|
||||||
(scene::IAnimatedMeshSceneNode*)presentation->getNode();
|
(scene::IAnimatedMeshSceneNode*)presentation->getNode();
|
||||||
mesh = node->getMesh()->getMesh(0);
|
mesh = node->getMesh()->getMesh(0);
|
||||||
is_readonly_material = node->isReadOnlyMaterials();
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
@ -436,27 +427,27 @@ void PhysicalObject::init(const PhysicalObject::Settings& settings)
|
|||||||
mb->getVertexType());
|
mb->getVertexType());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
const video::SMaterial& irrMaterial = mb->getMaterial();
|
||||||
// Handle readonly materials correctly: mb->getMaterial can return
|
std::string t1_full_path, t2_full_path;
|
||||||
// NULL if the node is not using readonly materials. E.g. in case
|
video::ITexture* t1 = irrMaterial.getTexture(0);
|
||||||
// of a water scene node, the mesh (which is the animated copy of
|
if (t1)
|
||||||
// the original mesh) does not contain any material information,
|
|
||||||
// the material is only available in the node.
|
|
||||||
const video::SMaterial &irrMaterial =
|
|
||||||
is_readonly_material ? mb->getMaterial()
|
|
||||||
: presentation->getNode()->getMaterial(i);
|
|
||||||
video::ITexture* t=irrMaterial.getTexture(0);
|
|
||||||
|
|
||||||
const Material* material=0;
|
|
||||||
if(t)
|
|
||||||
{
|
{
|
||||||
std::string image =
|
t1_full_path = t1->getName().getPtr();
|
||||||
std::string(core::stringc(t->getName()).c_str());
|
t1_full_path = file_manager->getFileSystem()->getAbsolutePath(
|
||||||
material = material_manager
|
t1_full_path.c_str()).c_str();
|
||||||
->getMaterial(StringUtils::getBasename(image));
|
|
||||||
if(material->isIgnore())
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
|
video::ITexture* t2 = irrMaterial.getTexture(1);
|
||||||
|
if (t2)
|
||||||
|
{
|
||||||
|
t2_full_path = t2->getName().getPtr();
|
||||||
|
t2_full_path = file_manager->getFileSystem()->getAbsolutePath(
|
||||||
|
t2_full_path.c_str()).c_str();
|
||||||
|
}
|
||||||
|
const Material* material = material_manager->getMaterialSPM(
|
||||||
|
t1_full_path, t2_full_path);
|
||||||
|
if (material->isIgnore())
|
||||||
|
continue;
|
||||||
|
|
||||||
if (mb->getVertexType() == video::EVT_STANDARD)
|
if (mb->getVertexType() == video::EVT_STANDARD)
|
||||||
{
|
{
|
||||||
irr::video::S3DVertex* mbVertices =
|
irr::video::S3DVertex* mbVertices =
|
||||||
|
@ -918,26 +918,15 @@ void Track::convertTrackToBullet(scene::ISceneNode *node)
|
|||||||
matrices.push_back(node->getAbsoluteTransformation());
|
matrices.push_back(node->getAbsoluteTransformation());
|
||||||
|
|
||||||
scene::IMesh *mesh;
|
scene::IMesh *mesh;
|
||||||
// In case of readonly materials we have to get the material from
|
|
||||||
// the mesh, otherwise from the node. This is esp. important for
|
|
||||||
// water nodes, which only have the material defined in the node,
|
|
||||||
// but not in the mesh at all!
|
|
||||||
bool is_readonly_material=false;
|
|
||||||
|
|
||||||
|
|
||||||
switch(node->getType())
|
switch(node->getType())
|
||||||
{
|
{
|
||||||
case scene::ESNT_MESH :
|
case scene::ESNT_MESH :
|
||||||
case scene::ESNT_WATER_SURFACE :
|
case scene::ESNT_WATER_SURFACE :
|
||||||
case scene::ESNT_OCTREE :
|
case scene::ESNT_OCTREE :
|
||||||
mesh = ((scene::IMeshSceneNode*)node)->getMesh();
|
mesh = ((scene::IMeshSceneNode*)node)->getMesh();
|
||||||
is_readonly_material =
|
|
||||||
((scene::IMeshSceneNode*)node)->isReadOnlyMaterials();
|
|
||||||
break;
|
break;
|
||||||
case scene::ESNT_ANIMATED_MESH :
|
case scene::ESNT_ANIMATED_MESH :
|
||||||
mesh = ((scene::IAnimatedMeshSceneNode*)node)->getMesh();
|
mesh = ((scene::IAnimatedMeshSceneNode*)node)->getMesh();
|
||||||
is_readonly_material =
|
|
||||||
((scene::IAnimatedMeshSceneNode*)node)->isReadOnlyMaterials();
|
|
||||||
break;
|
break;
|
||||||
case scene::ESNT_SKY_BOX :
|
case scene::ESNT_SKY_BOX :
|
||||||
case scene::ESNT_SKY_DOME:
|
case scene::ESNT_SKY_DOME:
|
||||||
@ -1021,38 +1010,35 @@ void Track::convertTrackToBullet(scene::ISceneNode *node)
|
|||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
// Handle readonly materials correctly: mb->getMaterial can return
|
const video::SMaterial& irrMaterial = mb->getMaterial();
|
||||||
// NULL if the node is not using readonly materials. E.g. in case
|
std::string t1_full_path, t2_full_path;
|
||||||
// of a water scene node, the mesh (which is the animated copy of
|
video::ITexture* t1 = irrMaterial.getTexture(0);
|
||||||
// the original mesh) does not contain any material information,
|
if (t1)
|
||||||
// the material is only available in the node.
|
|
||||||
const video::SMaterial &irrMaterial =
|
|
||||||
is_readonly_material ? mb->getMaterial()
|
|
||||||
: node->getMaterial(i);
|
|
||||||
video::ITexture* t=irrMaterial.getTexture(0);
|
|
||||||
|
|
||||||
const Material* material=0;
|
|
||||||
TriangleMesh *tmesh = m_track_mesh;
|
|
||||||
if(t)
|
|
||||||
{
|
{
|
||||||
std::string image = t->getName().getPtr();
|
t1_full_path = t1->getName().getPtr();
|
||||||
|
t1_full_path = file_manager->getFileSystem()->getAbsolutePath(
|
||||||
// the third boolean argument is false because at this point we're
|
t1_full_path.c_str()).c_str();
|
||||||
// dealing physics, so it's useless to warn about missing textures,
|
}
|
||||||
// we'd just get duplicate/useless warnings
|
video::ITexture* t2 = irrMaterial.getTexture(1);
|
||||||
material=material_manager->getMaterial(StringUtils::getBasename(image),
|
if (t2)
|
||||||
false, false, false);
|
{
|
||||||
|
t2_full_path = t2->getName().getPtr();
|
||||||
|
t2_full_path = file_manager->getFileSystem()->getAbsolutePath(
|
||||||
|
t2_full_path.c_str()).c_str();
|
||||||
|
}
|
||||||
|
const Material* material = material_manager->getMaterialSPM(
|
||||||
|
t1_full_path, t2_full_path);
|
||||||
|
TriangleMesh *tmesh = m_track_mesh;
|
||||||
// Special gfx meshes will not be stored as a normal physics body,
|
// Special gfx meshes will not be stored as a normal physics body,
|
||||||
// but converted to a collision body only, so that ray tests
|
// but converted to a collision body only, so that ray tests
|
||||||
// against them can be done.
|
// against them can be done.
|
||||||
if(material->isSurface())
|
if (material->isSurface())
|
||||||
tmesh = m_gfx_effect_mesh;
|
tmesh = m_gfx_effect_mesh;
|
||||||
// A material which is a surface must be converted,
|
// A material which is a surface must be converted,
|
||||||
// even if it's marked as ignore. So only ignore
|
// even if it's marked as ignore. So only ignore
|
||||||
// non-surface materials.
|
// non-surface materials.
|
||||||
else if(material->isIgnore())
|
else if(material->isIgnore())
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
|
|
||||||
if (mb->getVertexType() == video::EVT_STANDARD)
|
if (mb->getVertexType() == video::EVT_STANDARD)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user