Fix matrix4 pointer in windows

Also allow minimum azdo rendering and avoid skinning empty joints
This commit is contained in:
Benau 2016-12-08 16:12:54 +08:00
parent 407ed319de
commit 21d9117b2d
3 changed files with 22 additions and 6 deletions

View File

@ -14,6 +14,17 @@
#include "matrix4.h"
#include "quaternion.h"
class Matrix4x4
{
private:
float data[16];
public:
inline Matrix4x4(const irr::core::matrix4& m)
{
memcpy(data, m.pointer(), 16 * sizeof(float));
}
};
class JointInfluence
{
public:
@ -181,7 +192,6 @@ namespace scene
u32 getTotalJointSize() const
{
_IRR_DEBUG_BREAK_IF(m_joint_total_size == 0);
return m_joint_total_size;
}
@ -231,7 +241,7 @@ private:
bool PreparedForSkinning;
bool AnimateNormals;
bool HardwareSkinning;
core::array<core::matrix4> m_joint_matrixes;
core::array<Matrix4x4> m_joint_matrixes;
u32 m_joint_total_size;
};

View File

@ -254,7 +254,7 @@ void DrawCalls::handleSTKCommon(scene::ISceneNode *Node,
{
skinning_offset = getSkinningOffset();
m_mesh_for_skinning.insert(am);
am->setSkinningOffset(skinning_offset * sizeof(core::matrix4));
am->setSkinningOffset(skinning_offset * 16 * sizeof(float));
}
if (!culled_for_cams[0])
@ -712,6 +712,7 @@ void DrawCalls::multidrawSolidFirstPass() const
{
m_solid_cmd_buffer->bind();
m_solid_cmd_buffer->multidrawFirstPass<DefaultMaterial>();
m_solid_cmd_buffer->multidrawFirstPass<SkinnedSolid>();
m_solid_cmd_buffer->multidrawFirstPass<AlphaRef>();
m_solid_cmd_buffer->multidrawFirstPass<SphereMap>();
m_solid_cmd_buffer->multidrawFirstPass<UnlitMat>();
@ -750,6 +751,7 @@ void DrawCalls::multidrawSolidSecondPass(const std::vector<uint64_t> &handles) c
{
m_solid_cmd_buffer->bind();
m_solid_cmd_buffer->multidraw2ndPass<DefaultMaterial>(handles);
m_solid_cmd_buffer->multidraw2ndPass<SkinnedSolid>(handles);
m_solid_cmd_buffer->multidraw2ndPass<AlphaRef>(handles);
m_solid_cmd_buffer->multidraw2ndPass<SphereMap>(handles);
m_solid_cmd_buffer->multidraw2ndPass<UnlitMat>(handles);

View File

@ -243,7 +243,7 @@ void STKAnimatedMesh::updateGL()
video::IMaterialRenderer* rnd = driver->getMaterialRenderer(type);
GLMesh &mesh = GLmeshes[i];
if (!rnd->isTransparent())
if (1)//!rnd->isTransparent())
{
Material* material = material_manager->getMaterialFor(mb->getMaterial().getTexture(0), mb);
Material* material2 = NULL;
@ -251,7 +251,7 @@ void STKAnimatedMesh::updateGL()
material2 = material_manager->getMaterialFor(mb->getMaterial().getTexture(1), mb);
Material::ShaderType MatType = getMeshMaterialFromType(type, mb->getVertexType(), material, material2);
initTextures(mesh, MatType);
initTextures(mesh, m_skinned_mesh ? Material::SHADERTYPE_SOLID_SKINNED_MESH : MatType);
}
else
initTexturesTransparent(mesh);
@ -278,7 +278,7 @@ void STKAnimatedMesh::updateGL()
if (m_skinning_offset == -1) return;
glBindBuffer(GL_UNIFORM_BUFFER, SharedGPUObjects::getSkinningUBO());
glBufferSubData(GL_UNIFORM_BUFFER, m_skinning_offset,
m_skinned_mesh->getTotalJointSize() * sizeof(core::matrix4),
m_skinned_mesh->getTotalJointSize() * 16 * sizeof(float),
m_skinned_mesh->getJointPointer());
m_skinning_offset = -1;
return;
@ -337,5 +337,9 @@ void STKAnimatedMesh::resetSkinningState(scene::IAnimatedMesh* mesh)
m_skinning_offset = -1;
m_skinned_mesh = dynamic_cast<scene::CSkinnedMesh*>(mesh);
if (m_skinned_mesh)
{
m_skinned_mesh->convertForSkinning();
if (m_skinned_mesh->getTotalJointSize() == 0)
m_skinned_mesh = NULL;
}
}