STKAnimatedMesh: Uses custom render.
But not direct gl draw call yet.
This commit is contained in:
parent
b738b1eab3
commit
176e46e5a9
@ -173,7 +173,7 @@ namespace scene
|
|||||||
\return The newly created clone of this node. */
|
\return The newly created clone of this node. */
|
||||||
virtual ISceneNode* clone(ISceneNode* newParent=0, ISceneManager* newManager=0);
|
virtual ISceneNode* clone(ISceneNode* newParent=0, ISceneManager* newManager=0);
|
||||||
|
|
||||||
private:
|
protected:
|
||||||
|
|
||||||
//! Get a static mesh for the current frame of this animated mesh
|
//! Get a static mesh for the current frame of this animated mesh
|
||||||
IMesh* getMeshForCurrentFrame();
|
IMesh* getMeshForCurrentFrame();
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
#include "graphics/stkanimatedmesh.hpp"
|
#include "graphics/stkanimatedmesh.hpp"
|
||||||
|
#include <ISceneManager.h>
|
||||||
|
#include <IMaterialRenderer.h>
|
||||||
|
#include <ISkinnedMesh.h>
|
||||||
|
|
||||||
using namespace irr;
|
using namespace irr;
|
||||||
|
|
||||||
@ -13,5 +16,48 @@ const core::vector3df& scale) :
|
|||||||
|
|
||||||
void STKAnimatedMesh::render()
|
void STKAnimatedMesh::render()
|
||||||
{
|
{
|
||||||
CAnimatedMeshSceneNode::render();
|
video::IVideoDriver* driver = SceneManager->getVideoDriver();
|
||||||
|
|
||||||
|
bool isTransparentPass =
|
||||||
|
SceneManager->getSceneNodeRenderPass() == scene::ESNRP_TRANSPARENT;
|
||||||
|
|
||||||
|
++PassCount;
|
||||||
|
|
||||||
|
scene::IMesh* m = getMeshForCurrentFrame();
|
||||||
|
|
||||||
|
if (m)
|
||||||
|
{
|
||||||
|
Box = m->getBoundingBox();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
#ifdef _DEBUG
|
||||||
|
os::Printer::log("Animated Mesh returned no mesh to render.", Mesh->getDebugName(), ELL_WARNING);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
driver->setTransform(video::ETS_WORLD, AbsoluteTransformation);
|
||||||
|
|
||||||
|
|
||||||
|
// render original meshes
|
||||||
|
for (u32 i = 0; i<m->getMeshBufferCount(); ++i)
|
||||||
|
{
|
||||||
|
video::IMaterialRenderer* rnd = driver->getMaterialRenderer(Materials[i].MaterialType);
|
||||||
|
bool transparent = (rnd && rnd->isTransparent());
|
||||||
|
|
||||||
|
// only render transparent buffer if this is the transparent render pass
|
||||||
|
// and solid only in solid pass
|
||||||
|
if (transparent == isTransparentPass)
|
||||||
|
{
|
||||||
|
scene::IMeshBuffer* mb = m->getMeshBuffer(i);
|
||||||
|
const video::SMaterial& material = ReadOnlyMaterials ? mb->getMaterial() : Materials[i];
|
||||||
|
if (RenderFromIdentity)
|
||||||
|
driver->setTransform(video::ETS_WORLD, core::IdentityMatrix);
|
||||||
|
else if (Mesh->getMeshType() == scene::EAMT_SKINNED)
|
||||||
|
driver->setTransform(video::ETS_WORLD, AbsoluteTransformation * ((scene::SSkinMeshBuffer*)mb)->Transformation);
|
||||||
|
printf("Material type is %d\n", material.MaterialType);
|
||||||
|
driver->setMaterial(material);
|
||||||
|
driver->drawMeshBuffer(mb);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user