Merge branch 'master' of https://github.com/supertuxkart/stk-code
This commit is contained in:
commit
3c3b076458
@ -8,8 +8,11 @@ STKInstancedSceneNode::STKInstancedSceneNode(irr::scene::IMesh* mesh, ISceneNode
|
|||||||
const irr::core::vector3df& scale) :
|
const irr::core::vector3df& scale) :
|
||||||
CMeshSceneNode(mesh, parent, mgr, id, position, rotation, scale)
|
CMeshSceneNode(mesh, parent, mgr, id, position, rotation, scale)
|
||||||
{
|
{
|
||||||
|
if (irr_driver->isGLSL())
|
||||||
|
{
|
||||||
createGLMeshes();
|
createGLMeshes();
|
||||||
setAutomaticCulling(0);
|
setAutomaticCulling(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void STKInstancedSceneNode::cleanGL()
|
void STKInstancedSceneNode::cleanGL()
|
||||||
@ -39,6 +42,7 @@ void STKInstancedSceneNode::cleanGL()
|
|||||||
|
|
||||||
STKInstancedSceneNode::~STKInstancedSceneNode()
|
STKInstancedSceneNode::~STKInstancedSceneNode()
|
||||||
{
|
{
|
||||||
|
if (irr_driver->isGLSL())
|
||||||
cleanGL();
|
cleanGL();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -306,6 +310,12 @@ static void drawSMGrass(GLMesh &mesh, const core::matrix4 &ModelViewProjectionMa
|
|||||||
|
|
||||||
void STKInstancedSceneNode::render()
|
void STKInstancedSceneNode::render()
|
||||||
{
|
{
|
||||||
|
if (!irr_driver->isGLSL())
|
||||||
|
{
|
||||||
|
CMeshSceneNode::render();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
setFirstTimeMaterial();
|
setFirstTimeMaterial();
|
||||||
|
|
||||||
if (irr_driver->getPhase() == SOLID_NORMAL_AND_DEPTH_PASS)
|
if (irr_driver->getPhase() == SOLID_NORMAL_AND_DEPTH_PASS)
|
||||||
|
@ -145,3 +145,10 @@ void ModelDefinitionLoader::clear()
|
|||||||
{
|
{
|
||||||
m_lod_groups.clear();
|
m_lod_groups.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
scene::IMesh* ModelDefinitionLoader::getFirstMeshFor(const std::string& name)
|
||||||
|
{
|
||||||
|
return irr_driver->getMesh(m_lod_groups[name][0].m_model_file);
|
||||||
|
}
|
@ -90,6 +90,8 @@ public:
|
|||||||
|
|
||||||
void clear();
|
void clear();
|
||||||
|
|
||||||
|
|
||||||
|
scene::IMesh* getFirstMeshFor(const std::string& name);
|
||||||
}; // ModelDefinitionLoader
|
}; // ModelDefinitionLoader
|
||||||
|
|
||||||
#endif // HEADER_LOD_NODE_LOADER_HPP
|
#endif // HEADER_LOD_NODE_LOADER_HPP
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
#include "graphics/material_manager.hpp"
|
#include "graphics/material_manager.hpp"
|
||||||
#include "graphics/particle_emitter.hpp"
|
#include "graphics/particle_emitter.hpp"
|
||||||
#include "graphics/particle_kind_manager.hpp"
|
#include "graphics/particle_kind_manager.hpp"
|
||||||
|
#include "graphics/stkinstancedscenenode.hpp"
|
||||||
#include "io/file_manager.hpp"
|
#include "io/file_manager.hpp"
|
||||||
#include "io/xml_node.hpp"
|
#include "io/xml_node.hpp"
|
||||||
#include "input/device_manager.hpp"
|
#include "input/device_manager.hpp"
|
||||||
@ -160,6 +161,8 @@ TrackObjectPresentationInstancing::TrackObjectPresentationInstancing(const XMLNo
|
|||||||
scene::ISceneNode* parent,
|
scene::ISceneNode* parent,
|
||||||
ModelDefinitionLoader& model_def_loader) : TrackObjectPresentationSceneNode(xml_node)
|
ModelDefinitionLoader& model_def_loader) : TrackObjectPresentationSceneNode(xml_node)
|
||||||
{
|
{
|
||||||
|
m_instancing_group = NULL;
|
||||||
|
|
||||||
std::string instancing_model;
|
std::string instancing_model;
|
||||||
xml_node.get("instancing_model", &instancing_model);
|
xml_node.get("instancing_model", &instancing_model);
|
||||||
|
|
||||||
@ -168,9 +171,17 @@ TrackObjectPresentationInstancing::TrackObjectPresentationInstancing(const XMLNo
|
|||||||
m_node->setRotation(m_init_hpr);
|
m_node->setRotation(m_init_hpr);
|
||||||
m_node->setScale(m_init_scale);
|
m_node->setScale(m_init_scale);
|
||||||
m_node->updateAbsolutePosition();
|
m_node->updateAbsolutePosition();
|
||||||
|
if (irr_driver->isGLSL())
|
||||||
|
{
|
||||||
m_instancing_group = model_def_loader.instanciate(m_node->getAbsolutePosition(),
|
m_instancing_group = model_def_loader.instanciate(m_node->getAbsolutePosition(),
|
||||||
m_node->getAbsoluteTransformation().getRotationDegrees(), m_node->getAbsoluteTransformation().getScale(),
|
m_node->getAbsoluteTransformation().getRotationDegrees(), m_node->getAbsoluteTransformation().getScale(),
|
||||||
instancing_model);
|
instancing_model);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_instancing_group = new STKInstancedSceneNode(model_def_loader.getFirstMeshFor(instancing_model),
|
||||||
|
m_node, irr_driver->getSceneManager(), -1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TrackObjectPresentationInstancing::~TrackObjectPresentationInstancing()
|
TrackObjectPresentationInstancing::~TrackObjectPresentationInstancing()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user