Commit 39fc2a42 authored by hybrid's avatar hybrid

Avoid destructor on md3 substructures which causes crash due to...

Avoid destructor on md3 substructures which causes crash due to non-constructed array elements. Fixed color writing in irr mesh writer.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@928 dfc29bdd-3216-0410-991c-e03cc46cb475
parent 8a3a2a2a
......@@ -180,10 +180,10 @@ namespace scene
}
// construct from a position and euler angles in degrees
SMD3QuaterionTag ( const core::vector3df&pos, const core::vector3df &angle )
SMD3QuaterionTag ( const core::vector3df &pos, const core::vector3df &angle )
{
position = pos;
rotation.set ( angle.X * core::DEGTORAD, angle.Y * core::DEGTORAD, angle.Z * core::DEGTORAD );
rotation.set ( angle * core::DEGTORAD );
}
core::stringc Name;
......@@ -199,6 +199,8 @@ namespace scene
// holds a assoziative list of named quaternions
struct SMD3QuaterionTagList : public virtual IReferenceCounted
{
~SMD3QuaterionTagList() {}
SMD3QuaterionTag* get ( const core::stringc& name )
{
SMD3QuaterionTag search ( name );
......
......@@ -71,6 +71,9 @@ class quaternion
//! sets new quaternion based on euler angles (radians)
inline void set(f32 x, f32 y, f32 z);
//! sets new quaternion based on euler angles (radians)
inline void set(const core::vector3df& vec);
//! normalizes the quaternion
inline quaternion& normalize();
......@@ -397,6 +400,12 @@ inline void quaternion::set(f32 x, f32 y, f32 z)
normalize();
}
//! sets new quaternion based on euler angles
inline void quaternion::set(const core::vector3df& vec)
{
set(vec.X, vec.Y, vec.Z);
}
//! normalizes the quaternion
inline quaternion& quaternion::normalize()
{
......
......@@ -184,7 +184,7 @@ void CIrrMeshWriter::writeMeshBuffer(const scene::IMeshBuffer* buffer)
str += getVectorAsStringLine(vtx[j].Normal);
char tmp[12];
sprintf(tmp, " %08x ", vtx[j].Color);
sprintf(tmp, " %08x ", vtx[j].Color.color);
str += tmp;
str += getVectorAsStringLine(vtx[j].TCoords);
......@@ -204,7 +204,7 @@ void CIrrMeshWriter::writeMeshBuffer(const scene::IMeshBuffer* buffer)
str += getVectorAsStringLine(vtx[j].Normal);
char tmp[12];
sprintf(tmp, " %08x ", vtx[j].Color);
sprintf(tmp, " %08x ", vtx[j].Color.color);
str += tmp;
str += getVectorAsStringLine(vtx[j].TCoords);
......@@ -226,7 +226,7 @@ void CIrrMeshWriter::writeMeshBuffer(const scene::IMeshBuffer* buffer)
str += getVectorAsStringLine(vtx[j].Normal);
char tmp[12];
sprintf(tmp, " %08x ", vtx[j].Color);
sprintf(tmp, " %08x ", vtx[j].Color.color);
str += tmp;
str += getVectorAsStringLine(vtx[j].TCoords);
......
......@@ -281,7 +281,7 @@ ITexture* CNullDriver::getTexture(const c8* filename)
if (texture)
{
addTexture(texture);
texture->drop(); // drop it becaus we created it, one grab too much
texture->drop(); // drop it because we created it, one grab too much
}
}
else
......
......@@ -41,7 +41,6 @@ namespace video
class COpenGLDriver;
class IShaderConstantSetCallBack;
class IMaterialRenderer;
//! Class for using GLSL shaders with OpenGL
//! Please note: This renderer implements its own IMaterialRendererServices
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment