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 ...@@ -180,10 +180,10 @@ namespace scene
} }
// construct from a position and euler angles in degrees // 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; position = pos;
rotation.set ( angle.X * core::DEGTORAD, angle.Y * core::DEGTORAD, angle.Z * core::DEGTORAD ); rotation.set ( angle * core::DEGTORAD );
} }
core::stringc Name; core::stringc Name;
...@@ -199,6 +199,8 @@ namespace scene ...@@ -199,6 +199,8 @@ namespace scene
// holds a assoziative list of named quaternions // holds a assoziative list of named quaternions
struct SMD3QuaterionTagList : public virtual IReferenceCounted struct SMD3QuaterionTagList : public virtual IReferenceCounted
{ {
~SMD3QuaterionTagList() {}
SMD3QuaterionTag* get ( const core::stringc& name ) SMD3QuaterionTag* get ( const core::stringc& name )
{ {
SMD3QuaterionTag search ( name ); SMD3QuaterionTag search ( name );
......
...@@ -71,6 +71,9 @@ class quaternion ...@@ -71,6 +71,9 @@ class quaternion
//! sets new quaternion based on euler angles (radians) //! sets new quaternion based on euler angles (radians)
inline void set(f32 x, f32 y, f32 z); 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 //! normalizes the quaternion
inline quaternion& normalize(); inline quaternion& normalize();
...@@ -397,6 +400,12 @@ inline void quaternion::set(f32 x, f32 y, f32 z) ...@@ -397,6 +400,12 @@ inline void quaternion::set(f32 x, f32 y, f32 z)
normalize(); 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 //! normalizes the quaternion
inline quaternion& quaternion::normalize() inline quaternion& quaternion::normalize()
{ {
......
...@@ -79,8 +79,8 @@ namespace scene ...@@ -79,8 +79,8 @@ namespace scene
private: private:
//! animates one frame //! animates one frame
inline void Animate (u32 frame); inline void Animate (u32 frame);
video::SMaterial Material; video::SMaterial Material;
......
...@@ -184,7 +184,7 @@ void CIrrMeshWriter::writeMeshBuffer(const scene::IMeshBuffer* buffer) ...@@ -184,7 +184,7 @@ void CIrrMeshWriter::writeMeshBuffer(const scene::IMeshBuffer* buffer)
str += getVectorAsStringLine(vtx[j].Normal); str += getVectorAsStringLine(vtx[j].Normal);
char tmp[12]; char tmp[12];
sprintf(tmp, " %08x ", vtx[j].Color); sprintf(tmp, " %08x ", vtx[j].Color.color);
str += tmp; str += tmp;
str += getVectorAsStringLine(vtx[j].TCoords); str += getVectorAsStringLine(vtx[j].TCoords);
...@@ -204,7 +204,7 @@ void CIrrMeshWriter::writeMeshBuffer(const scene::IMeshBuffer* buffer) ...@@ -204,7 +204,7 @@ void CIrrMeshWriter::writeMeshBuffer(const scene::IMeshBuffer* buffer)
str += getVectorAsStringLine(vtx[j].Normal); str += getVectorAsStringLine(vtx[j].Normal);
char tmp[12]; char tmp[12];
sprintf(tmp, " %08x ", vtx[j].Color); sprintf(tmp, " %08x ", vtx[j].Color.color);
str += tmp; str += tmp;
str += getVectorAsStringLine(vtx[j].TCoords); str += getVectorAsStringLine(vtx[j].TCoords);
...@@ -226,7 +226,7 @@ void CIrrMeshWriter::writeMeshBuffer(const scene::IMeshBuffer* buffer) ...@@ -226,7 +226,7 @@ void CIrrMeshWriter::writeMeshBuffer(const scene::IMeshBuffer* buffer)
str += getVectorAsStringLine(vtx[j].Normal); str += getVectorAsStringLine(vtx[j].Normal);
char tmp[12]; char tmp[12];
sprintf(tmp, " %08x ", vtx[j].Color); sprintf(tmp, " %08x ", vtx[j].Color.color);
str += tmp; str += tmp;
str += getVectorAsStringLine(vtx[j].TCoords); str += getVectorAsStringLine(vtx[j].TCoords);
......
...@@ -281,7 +281,7 @@ ITexture* CNullDriver::getTexture(const c8* filename) ...@@ -281,7 +281,7 @@ ITexture* CNullDriver::getTexture(const c8* filename)
if (texture) if (texture)
{ {
addTexture(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 else
......
...@@ -41,7 +41,6 @@ namespace video ...@@ -41,7 +41,6 @@ namespace video
class COpenGLDriver; class COpenGLDriver;
class IShaderConstantSetCallBack; class IShaderConstantSetCallBack;
class IMaterialRenderer;
//! Class for using GLSL shaders with OpenGL //! Class for using GLSL shaders with OpenGL
//! Please note: This renderer implements its own IMaterialRendererServices //! 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