irrlicht/source/Irrlicht/CAttributeImpl.h

1971 lines
39 KiB
C
Raw Normal View History

// Copyright (C) 2002-2009 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#include "CAttributes.h"
#include "fast_atof.h"
#include "ITexture.h"
#include "IVideoDriver.h"
namespace irr
{
namespace io
{
/*
basic types
*/
// Attribute implemented for boolean values
class CBoolAttribute : public IAttribute
{
public:
CBoolAttribute(const char* name, bool value)
{
Name = name;
setBool(value);
}
virtual s32 getInt()
{
return BoolValue ? 1 : 0;
}
virtual f32 getFloat()
{
return BoolValue ? 1.0f : 0.0f;
}
virtual bool getBool()
{
return BoolValue;
}
virtual core::stringw getStringW()
{
return core::stringw( BoolValue ? L"true" : L"false" );
}
virtual void setInt(s32 intValue)
{
BoolValue = (intValue != 0);
}
virtual void setFloat(f32 floatValue)
{
BoolValue = (floatValue != 0);
}
virtual void setBool(bool boolValue)
{
BoolValue = boolValue;
}
virtual void setString(const char* string)
{
BoolValue = strcmp(string, "true") == 0;
}
virtual E_ATTRIBUTE_TYPE getType() const
{
return EAT_BOOL;
}
virtual const wchar_t* getTypeString() const
{
return L"bool";
}
bool BoolValue;
};
// Attribute implemented for integers
class CIntAttribute : public IAttribute
{
public:
CIntAttribute(const char* name, s32 value)
{
Name = name;
setInt(value);
}
virtual s32 getInt()
{
return Value;
}
virtual f32 getFloat()
{
return (f32)Value;
}
virtual bool getBool()
{
return (Value != 0);
}
virtual core::stringw getStringW()
{
return core::stringw(Value);
}
virtual void setInt(s32 intValue)
{
Value = intValue;
}
virtual void setFloat(f32 floatValue)
{
Value = (s32)floatValue;
};
virtual void setString(const char* text)
{
Value = atoi(text);
}
virtual E_ATTRIBUTE_TYPE getType() const
{
return EAT_INT;
}
virtual const wchar_t* getTypeString() const
{
return L"int";
}
s32 Value;
};
// Attribute implemented for floats
class CFloatAttribute : public IAttribute
{
public:
CFloatAttribute(const char* name, f32 value)
{
Name = name;
setFloat(value);
}
virtual s32 getInt()
{
return (s32)Value;
}
virtual f32 getFloat()
{
return Value;
}
virtual bool getBool()
{
return (Value != 0);
}
virtual core::stringw getStringW()
{
return core::stringw(Value);
}
virtual void setInt(s32 intValue)
{
Value = (f32)intValue;
}
virtual void setFloat(f32 floatValue)
{
Value = floatValue;
}
virtual void setString(const char* text)
{
Value = core::fast_atof(text);
}
virtual E_ATTRIBUTE_TYPE getType() const
{
return EAT_FLOAT;
}
virtual const wchar_t* getTypeString() const
{
return L"float";
}
f32 Value;
};
/*
Types which can be represented as a list of numbers
*/
// Base class for all attributes which are a list of numbers-
// vectors, colors, positions, triangles, etc
class CNumbersAttribute : public IAttribute
{
public:
CNumbersAttribute(const char* name, video::SColorf value) :
ValueI(), ValueF(), Count(4), IsFloat(true)
{
Name = name;
ValueF.push_back(value.r);
ValueF.push_back(value.g);
ValueF.push_back(value.b);
ValueF.push_back(value.a);
}
CNumbersAttribute(const char* name, video::SColor value) :
ValueI(), ValueF(), Count(4), IsFloat(false)
{
Name = name;
ValueI.push_back(value.getRed());
ValueI.push_back(value.getGreen());
ValueI.push_back(value.getBlue());
ValueI.push_back(value.getAlpha());
}
CNumbersAttribute(const char* name, core::vector3df value) :
ValueI(), ValueF(), Count(3), IsFloat(true)
{
Name = name;
ValueF.push_back(value.X);
ValueF.push_back(value.Y);
ValueF.push_back(value.Z);
}
CNumbersAttribute(const char* name, core::rect<s32> value) :
ValueI(), ValueF(), Count(4), IsFloat(false)
{
Name = name;
ValueI.push_back(value.UpperLeftCorner.X);
ValueI.push_back(value.UpperLeftCorner.Y);
ValueI.push_back(value.LowerRightCorner.X);
ValueI.push_back(value.LowerRightCorner.Y);
}
CNumbersAttribute(const char* name, core::rect<f32> value) :
ValueI(), ValueF(), Count(4), IsFloat(true)
{
Name = name;
ValueF.push_back(value.UpperLeftCorner.X);
ValueF.push_back(value.UpperLeftCorner.Y);
ValueF.push_back(value.LowerRightCorner.X);
ValueF.push_back(value.LowerRightCorner.Y);
}
CNumbersAttribute(const char* name, core::matrix4 value) :
ValueI(), ValueF(), Count(16), IsFloat(true)
{
Name = name;
for (s32 r=0; r<4; ++r)
for (s32 c=0; c<4; ++c)
ValueF.push_back(value(r,c));
}
CNumbersAttribute(const char* name, core::quaternion value) :
ValueI(), ValueF(), Count(4), IsFloat(true)
{
Name = name;
ValueF.push_back(value.X);
ValueF.push_back(value.Y);
ValueF.push_back(value.Z);
ValueF.push_back(value.W);
}
CNumbersAttribute(const char* name, core::aabbox3d<f32> value) :
ValueI(), ValueF(), Count(6), IsFloat(true)
{
Name = name;
ValueF.push_back(value.MinEdge.X);
ValueF.push_back(value.MinEdge.Y);
ValueF.push_back(value.MinEdge.Z);
ValueF.push_back(value.MaxEdge.X);
ValueF.push_back(value.MaxEdge.Y);
ValueF.push_back(value.MaxEdge.Z);
}
CNumbersAttribute(const char* name, core::plane3df value) :
ValueI(), ValueF(), Count(4), IsFloat(true)
{
Name = name;
ValueF.push_back(value.Normal.X);
ValueF.push_back(value.Normal.Y);
ValueF.push_back(value.Normal.Z);
ValueF.push_back(value.D);
}
CNumbersAttribute(const char* name, core::triangle3df value) :
ValueI(), ValueF(), Count(9), IsFloat(true)
{
Name = name;
ValueF.push_back(value.pointA.X);
ValueF.push_back(value.pointA.Y);
ValueF.push_back(value.pointA.Z);
ValueF.push_back(value.pointB.X);
ValueF.push_back(value.pointB.Y);
ValueF.push_back(value.pointB.Z);
ValueF.push_back(value.pointC.X);
ValueF.push_back(value.pointC.Y);
ValueF.push_back(value.pointC.Z);
}
CNumbersAttribute(const char* name, core::vector2df value) :
ValueI(), ValueF(), Count(2), IsFloat(true)
{
Name = name;
ValueF.push_back(value.X);
ValueF.push_back(value.Y);
}
CNumbersAttribute(const char* name, core::vector2di value) :
ValueI(), ValueF(), Count(2), IsFloat(false)
{
Name = name;
ValueI.push_back(value.X);
ValueI.push_back(value.Y);
}
CNumbersAttribute(const char* name, core::line2di value) :
ValueI(), ValueF(), Count(4), IsFloat(false)
{
Name = name;
ValueI.push_back(value.start.X);
ValueI.push_back(value.start.Y);
ValueI.push_back(value.end.X);
ValueI.push_back(value.end.Y);
}
CNumbersAttribute(const char* name, core::line2df value) :
ValueI(), ValueF(), Count(4), IsFloat(true)
{
Name = name;
ValueF.push_back(value.start.X);
ValueF.push_back(value.start.Y);
ValueF.push_back(value.end.X);
ValueF.push_back(value.end.Y);
}
CNumbersAttribute(const char* name, core::line3df value) :
ValueI(), ValueF(), Count(6), IsFloat(true)
{
Name = name;
ValueF.push_back(value.start.X);
ValueF.push_back(value.start.Y);
ValueF.push_back(value.start.Z);
ValueF.push_back(value.end.X);
ValueF.push_back(value.end.Y);
ValueF.push_back(value.end.Z);
}
CNumbersAttribute(const char* name, core::dimension2du value) :
ValueI(), ValueF(), Count(2), IsFloat(false)
{
Name = name;
ValueI.push_back(value.Width);
ValueI.push_back(value.Height);
}
CNumbersAttribute(const char* name, core::dimension2df value) :
ValueI(), ValueF(), Count(2), IsFloat(true)
{
Name = name;
ValueF.push_back(value.Width);
ValueF.push_back(value.Height);
}
// getting values
virtual s32 getInt()
{
if (Count==0)
return 0;
if (IsFloat)
return (s32)ValueF[0];
else
return ValueI[0];
}
virtual f32 getFloat()
{
if (Count==0)
return 0.0f;
if (IsFloat)
return ValueF[0];
else
return (f32)ValueI[0];
}
virtual bool getBool()
{
// return true if any number is nonzero
bool ret=false;
for (u32 i=0; i < Count; ++i)
if ( IsFloat ? (ValueF[i] != 0) : (ValueI[i] != 0) )
{
ret=true;
break;
}
return ret;
}
virtual core::stringc getString()
{
core::stringc outstr;
for (u32 i=0; i <Count; ++i)
{
if (IsFloat)
outstr += ValueF[i];
else
outstr += ValueI[i];
if (i < Count-1)
outstr += ", ";
}
return outstr;
}
virtual core::stringw getStringW()
{
core::stringw outstr;
for (u32 i=0; i <Count; ++i)
{
if (IsFloat)
outstr += ValueF[i];
else
outstr += ValueI[i];
if (i < Count-1)
outstr += L", ";
}
return outstr;
}
virtual core::position2di getPosition()
{
core::position2di p;
if (IsFloat)
{
p.X = (s32)(Count > 0 ? ValueF[0] : 0);
p.Y = (s32)(Count > 1 ? ValueF[1] : 0);
}
else
{
p.X = Count > 0 ? ValueI[0] : 0;
p.Y = Count > 1 ? ValueI[1] : 0;
}
return p;
}
virtual core::vector3df getVector()
{
core::vector3df v;
if (IsFloat)
{
v.X = Count > 0 ? ValueF[0] : 0;
v.Y = Count > 1 ? ValueF[1] : 0;
v.Z = Count > 2 ? ValueF[2] : 0;
}
else
{
v.X = (f32)(Count > 0 ? ValueI[0] : 0);
v.Y = (f32)(Count > 1 ? ValueI[1] : 0);
v.Z = (f32)(Count > 2 ? ValueI[2] : 0);
}
return v;
}
virtual video::SColorf getColorf()
{
video::SColorf c;
if (IsFloat)
{
c.setColorComponentValue(0, Count > 0 ? ValueF[0] : 0);
c.setColorComponentValue(1, Count > 1 ? ValueF[1] : 0);
c.setColorComponentValue(2, Count > 2 ? ValueF[2] : 0);
c.setColorComponentValue(3, Count > 3 ? ValueF[3] : 0);
}
else
{
c.setColorComponentValue(0, Count > 0 ? (f32)(ValueI[0]) / 255.0f : 0);
c.setColorComponentValue(1, Count > 1 ? (f32)(ValueI[1]) / 255.0f : 0);
c.setColorComponentValue(2, Count > 2 ? (f32)(ValueI[2]) / 255.0f : 0);
c.setColorComponentValue(3, Count > 3 ? (f32)(ValueI[3]) / 255.0f : 0);
}
return c;
}
virtual video::SColor getColor()
{
return getColorf().toSColor();
}
virtual core::rect<s32> getRect()
{
core::rect<s32> r;
if (IsFloat)
{
r.UpperLeftCorner.X = (s32)(Count > 0 ? ValueF[0] : 0);
r.UpperLeftCorner.Y = (s32)(Count > 1 ? ValueF[1] : 0);
r.LowerRightCorner.X = (s32)(Count > 2 ? ValueF[2] : r.UpperLeftCorner.X);
r.LowerRightCorner.Y = (s32)(Count > 3 ? ValueF[3] : r.UpperLeftCorner.Y);
}
else
{
r.UpperLeftCorner.X = Count > 0 ? ValueI[0] : 0;
r.UpperLeftCorner.Y = Count > 1 ? ValueI[1] : 0;
r.LowerRightCorner.X = Count > 2 ? ValueI[2] : r.UpperLeftCorner.X;
r.LowerRightCorner.Y = Count > 3 ? ValueI[3] : r.UpperLeftCorner.Y;
}
return r;
}
virtual core::matrix4 getMatrix()
{
core::matrix4 ret;
if (IsFloat)
{
for (u32 r=0; r<4; ++r)
for (u32 c=0; c<4; ++c)
if (Count > c+r*4)
ret(r,c) = ValueF[c+r*4];
}
else
{
for (u32 r=0; r<4; ++r)
for (u32 c=0; c<4; ++c)
if (Count > c+r*4)
ret(r,c) = (f32)ValueI[c+r*4];
}
return ret;
}
virtual core::quaternion getQuaternion()
{
core::quaternion ret;
if (IsFloat)
{
ret.X = Count > 0 ? ValueF[0] : 0.0f;
ret.Y = Count > 1 ? ValueF[1] : 0.0f;
ret.Z = Count > 2 ? ValueF[2] : 0.0f;
ret.W = Count > 3 ? ValueF[3] : 0.0f;
}
else
{
ret.X = Count > 0 ? (f32)ValueI[0] : 0.0f;
ret.Y = Count > 1 ? (f32)ValueI[1] : 0.0f;
ret.Z = Count > 2 ? (f32)ValueI[2] : 0.0f;
ret.W = Count > 3 ? (f32)ValueI[3] : 0.0f;
}
return ret;
}
virtual core::triangle3df getTriangle()
{
core::triangle3df ret;
if (IsFloat)
{
ret.pointA.X = Count > 0 ? ValueF[0] : 0.0f;
ret.pointA.Y = Count > 1 ? ValueF[1] : 0.0f;
ret.pointA.Z = Count > 2 ? ValueF[2] : 0.0f;
ret.pointB.X = Count > 3 ? ValueF[3] : 0.0f;
ret.pointB.Y = Count > 4 ? ValueF[4] : 0.0f;
ret.pointB.Z = Count > 5 ? ValueF[5] : 0.0f;
ret.pointC.X = Count > 6 ? ValueF[6] : 0.0f;
ret.pointC.Y = Count > 7 ? ValueF[7] : 0.0f;
ret.pointC.Z = Count > 8 ? ValueF[8] : 0.0f;
}
else
{
ret.pointA.X = Count > 0 ? (f32)ValueI[0] : 0.0f;
ret.pointA.Y = Count > 1 ? (f32)ValueI[1] : 0.0f;
ret.pointA.Z = Count > 2 ? (f32)ValueI[2] : 0.0f;
ret.pointB.X = Count > 3 ? (f32)ValueI[3] : 0.0f;
ret.pointB.Y = Count > 4 ? (f32)ValueI[4] : 0.0f;
ret.pointB.Z = Count > 5 ? (f32)ValueI[5] : 0.0f;
ret.pointC.X = Count > 6 ? (f32)ValueI[6] : 0.0f;
ret.pointC.Y = Count > 7 ? (f32)ValueI[7] : 0.0f;
ret.pointC.Z = Count > 8 ? (f32)ValueI[8] : 0.0f;
}
return ret;
}
virtual core::plane3df getPlane()
{
core::plane3df ret;
if (IsFloat)
{
ret.Normal.X = Count > 0 ? ValueF[0] : 0.0f;
ret.Normal.Y = Count > 1 ? ValueF[1] : 0.0f;
ret.Normal.Z = Count > 2 ? ValueF[2] : 0.0f;
ret.D = Count > 3 ? ValueF[3] : 0.0f;
}
else
{
ret.Normal.X = Count > 0 ? (f32)ValueI[0] : 0.0f;
ret.Normal.Y = Count > 1 ? (f32)ValueI[1] : 0.0f;
ret.Normal.Z = Count > 2 ? (f32)ValueI[2] : 0.0f;
ret.D = Count > 3 ? (f32)ValueI[3] : 0.0f;
}
return ret;
}
virtual core::aabbox3df getBBox()
{
core::aabbox3df ret;
if (IsFloat)
{
ret.MinEdge.X = Count > 0 ? ValueF[0] : 0.0f;
ret.MinEdge.Y = Count > 1 ? ValueF[1] : 0.0f;
ret.MinEdge.Z = Count > 2 ? ValueF[2] : 0.0f;
ret.MaxEdge.X = Count > 3 ? ValueF[3] : 0.0f;
ret.MaxEdge.Y = Count > 4 ? ValueF[4] : 0.0f;
ret.MaxEdge.Z = Count > 5 ? ValueF[5] : 0.0f;
}
else
{
ret.MinEdge.X = Count > 0 ? (f32)ValueI[0] : 0.0f;
ret.MinEdge.Y = Count > 1 ? (f32)ValueI[1] : 0.0f;
ret.MinEdge.Z = Count > 2 ? (f32)ValueI[2] : 0.0f;
ret.MaxEdge.X = Count > 3 ? (f32)ValueI[3] : 0.0f;
ret.MaxEdge.Y = Count > 4 ? (f32)ValueI[4] : 0.0f;
ret.MaxEdge.Z = Count > 5 ? (f32)ValueI[5] : 0.0f;
}
return ret;
}
virtual core::line2df getLine2d()
{
core::line2df ret;
if (IsFloat)
{
ret.start.X = Count > 0 ? ValueF[0] : 0.0f;
ret.start.Y = Count > 1 ? ValueF[1] : 0.0f;
ret.end.X = Count > 2 ? ValueF[2] : 0.0f;
ret.end.Y = Count > 3 ? ValueF[3] : 0.0f;
}
else
{
ret.start.X = Count > 0 ? (f32)ValueI[0] : 0.0f;
ret.start.Y = Count > 1 ? (f32)ValueI[1] : 0.0f;
ret.end.X = Count > 2 ? (f32)ValueI[2] : 0.0f;
ret.end.Y = Count > 3 ? (f32)ValueI[3] : 0.0f;
}
return ret;
}
virtual core::line3df getLine3d()
{
core::line3df ret;
if (IsFloat)
{
ret.start.X = Count > 0 ? ValueF[0] : 0.0f;
ret.start.Y = Count > 1 ? ValueF[1] : 0.0f;
ret.start.Z = Count > 2 ? ValueF[2] : 0.0f;
ret.end.X = Count > 3 ? ValueF[3] : 0.0f;
ret.end.Y = Count > 4 ? ValueF[4] : 0.0f;
ret.end.Z = Count > 5 ? ValueF[5] : 0.0f;
}
else
{
ret.start.X = Count > 0 ? (f32)ValueI[0] : 0.0f;
ret.start.Y = Count > 1 ? (f32)ValueI[1] : 0.0f;
ret.start.Z = Count > 2 ? (f32)ValueI[2] : 0.0f;
ret.end.X = Count > 3 ? (f32)ValueI[3] : 0.0f;
ret.end.Y = Count > 4 ? (f32)ValueI[4] : 0.0f;
ret.end.Z = Count > 5 ? (f32)ValueI[5] : 0.0f;
}
return ret;
}
//! get float array
virtual core::array<f32> getFloatArray()
{
if (!IsFloat)
{
ValueF.clear();
for (u32 i=0; i<Count; ++i)
ValueF.push_back( (f32) ValueI[i] );
}
return ValueF;
}
//! get int array
virtual core::array<s32> getIntArray()
{
if (IsFloat)
{
ValueI.clear();
for (u32 i=0; i<Count; ++i)
ValueI.push_back( (s32) ValueF[i] );
}
return ValueI;
}
// setting values
virtual void setInt(s32 intValue)
{
// set all values
for (u32 i=0; i < Count; ++i)
if (IsFloat)
ValueF[i] = (f32)intValue;
else
ValueI[i] = intValue;
}
virtual void setFloat(f32 floatValue)
{
// set all values
for (u32 i=0; i < Count; ++i)
if (IsFloat)
ValueF[i] = floatValue;
else
ValueI[i] = (s32)floatValue;
}
virtual void setBool(bool boolValue)
{
setInt( boolValue ? 1 : 0);
}
virtual void setString(const char* text)
{
// parse text
const char* P = (const char*)text;
reset();
u32 i=0;
for ( i=0; i<Count && *P; ++i )
{
while(*P && P[0]!='-' && ( P[0]==' ' || (P[0] < '0' || P[0] > '9') ) )
++P;
// set value
if ( *P)
{
if (IsFloat)
{
f32 c = 0;
P = core::fast_atof_move(P, c);
ValueF[i] = c;
}
else
{
// todo: fix this to read ints properly
f32 c = 0;
P = core::fast_atof_move(P, c);
ValueI[i] = (s32)c;
}
}
}
// todo: warning message
//if (i < Count-1)
//{
//
//}
}
virtual void setPosition(core::position2di v)
{
reset();
if (IsFloat)
{
if (Count > 0) ValueF[0] = (f32)v.X;
if (Count > 1) ValueF[1] = (f32)v.Y;
}
else
{
if (Count > 0) ValueI[0] = v.X;
if (Count > 1) ValueI[1] = v.Y;
}
}
virtual void setVector(core::vector3df v)
{
reset();
if (IsFloat)
{
if (Count > 0) ValueF[0] = v.X;
if (Count > 1) ValueF[1] = v.Y;
if (Count > 2) ValueF[2] = v.Z;
}
else
{
if (Count > 0) ValueI[0] = (s32)v.X;
if (Count > 1) ValueI[1] = (s32)v.Y;
if (Count > 2) ValueI[2] = (s32)v.Z;
}
}
virtual void setColor(video::SColorf color)
{
reset();
if (IsFloat)
{
if (Count > 0) ValueF[0] = color.r;
if (Count > 1) ValueF[1] = color.g;
if (Count > 2) ValueF[2] = color.b;
if (Count > 3) ValueF[3] = color.a;
}
else
{
if (Count > 0) ValueI[0] = (s32)(color.r * 255);
if (Count > 1) ValueI[1] = (s32)(color.g * 255);
if (Count > 2) ValueI[2] = (s32)(color.b * 255);
if (Count > 3) ValueI[3] = (s32)(color.a * 255);
}
}
virtual void setColor(video::SColor color)
{
reset();
if (IsFloat)
{
if (Count > 0) ValueF[0] = (f32)color.getRed() / 255.0f;
if (Count > 1) ValueF[1] = (f32)color.getGreen() / 255.0f;
if (Count > 2) ValueF[2] = (f32)color.getBlue() / 255.0f;
if (Count > 3) ValueF[3] = (f32)color.getAlpha() / 255.0f;
}
else
{
if (Count > 0) ValueI[0] = color.getRed();
if (Count > 1) ValueI[1] = color.getGreen();
if (Count > 2) ValueI[2] = color.getBlue();
if (Count > 3) ValueI[3] = color.getAlpha();
}
}
virtual void setRect(core::rect<s32> value)
{
reset();
if (IsFloat)
{
if (Count > 0) ValueF[0] = (f32)value.UpperLeftCorner.X;
if (Count > 1) ValueF[1] = (f32)value.UpperLeftCorner.Y;
if (Count > 2) ValueF[2] = (f32)value.LowerRightCorner.X;
if (Count > 3) ValueF[3] = (f32)value.LowerRightCorner.Y;
}
else
{
if (Count > 0) ValueI[0] = value.UpperLeftCorner.X;
if (Count > 1) ValueI[1] = value.UpperLeftCorner.Y;
if (Count > 2) ValueI[2] = value.LowerRightCorner.X;
if (Count > 3) ValueI[3] = value.LowerRightCorner.Y;
}
}
virtual void setMatrix(core::matrix4 value)
{
reset();
if (IsFloat)
{
for (u32 r=0; r<4; ++r)
for (u32 c=0; c<4; ++c)
if (Count > c+r*4)
ValueF[c+r*4] = value(r,c);
}
else
{
for (u32 r=0; r<4; ++r)
for (u32 c=0; c<4; ++c)
if (Count > c+r*4)
ValueI[c+r*4] = (s32)value(r,c);
}
}
virtual void setQuaternion(core::quaternion value)
{
reset();
if (IsFloat)
{
if (Count > 0) ValueF[0] = value.X;
if (Count > 1) ValueF[1] = value.Y;
if (Count > 2) ValueF[2] = value.Z;
if (Count > 3) ValueF[3] = value.W;
}
else
{
if (Count > 0) ValueI[0] = (s32)value.X;
if (Count > 1) ValueI[1] = (s32)value.Y;
if (Count > 2) ValueI[2] = (s32)value.Z;
if (Count > 3) ValueI[3] = (s32)value.W;
}
}
virtual void setBoundingBox(core::aabbox3d<f32> value)
{
reset();
if (IsFloat)
{
if (Count > 0) ValueF[0] = value.MinEdge.X;
if (Count > 1) ValueF[1] = value.MinEdge.Y;
if (Count > 2) ValueF[2] = value.MinEdge.Z;
if (Count > 3) ValueF[3] = value.MaxEdge.X;
if (Count > 4) ValueF[4] = value.MaxEdge.Y;
if (Count > 5) ValueF[5] = value.MaxEdge.Z;
}
else
{
if (Count > 0) ValueI[0] = (s32)value.MinEdge.X;
if (Count > 1) ValueI[1] = (s32)value.MinEdge.Y;
if (Count > 2) ValueI[2] = (s32)value.MinEdge.Z;
if (Count > 3) ValueI[3] = (s32)value.MaxEdge.X;
if (Count > 4) ValueI[4] = (s32)value.MaxEdge.Y;
if (Count > 5) ValueI[5] = (s32)value.MaxEdge.Z;
}
}
virtual void setPlane(core::plane3df value)
{
reset();
if (IsFloat)
{
if (Count > 0) ValueF[0] = value.Normal.X;
if (Count > 1) ValueF[1] = value.Normal.Y;
if (Count > 2) ValueF[2] = value.Normal.Z;
if (Count > 3) ValueF[3] = value.D;
}
else
{
if (Count > 0) ValueI[0] = (s32)value.Normal.X;
if (Count > 1) ValueI[1] = (s32)value.Normal.Y;
if (Count > 2) ValueI[2] = (s32)value.Normal.Z;
if (Count > 3) ValueI[3] = (s32)value.D;
}
}
virtual void setTriangle3d(core::triangle3df value)
{
reset();
if (IsFloat)
{
if (Count > 0) ValueF[0] = value.pointA.X;
if (Count > 1) ValueF[1] = value.pointA.Y;
if (Count > 2) ValueF[2] = value.pointA.Z;
if (Count > 3) ValueF[3] = value.pointB.X;
if (Count > 4) ValueF[4] = value.pointB.Y;
if (Count > 5) ValueF[5] = value.pointB.Z;
if (Count > 6) ValueF[6] = value.pointC.X;
if (Count > 7) ValueF[7] = value.pointC.Y;
if (Count > 8) ValueF[8] = value.pointC.Z;
}
else
{
if (Count > 0) ValueI[0] = (s32)value.pointA.X;
if (Count > 1) ValueI[1] = (s32)value.pointA.Y;
if (Count > 2) ValueI[2] = (s32)value.pointA.Z;
if (Count > 3) ValueI[3] = (s32)value.pointB.X;
if (Count > 4) ValueI[4] = (s32)value.pointB.Y;
if (Count > 5) ValueI[5] = (s32)value.pointB.Z;
if (Count > 6) ValueI[6] = (s32)value.pointC.X;
if (Count > 7) ValueI[7] = (s32)value.pointC.Y;
if (Count > 8) ValueI[8] = (s32)value.pointC.Z;
}
}
virtual void setVector2d(core::vector2df v)
{
reset();
if (IsFloat)
{
if (Count > 0) ValueF[0] = v.X;
if (Count > 1) ValueF[1] = v.Y;
}
else
{
if (Count > 0) ValueI[0] = (s32)v.X;
if (Count > 1) ValueI[1] = (s32)v.Y;
}
}
virtual void setVector2d(core::vector2di v)
{
reset();
if (IsFloat)
{
if (Count > 0) ValueF[0] = (f32)v.X;
if (Count > 1) ValueF[1] = (f32)v.Y;
}
else
{
if (Count > 0) ValueI[0] = v.X;
if (Count > 1) ValueI[1] = v.Y;
}
}
virtual void setLine2d(core::line2di v)
{
reset();
if (IsFloat)
{
if (Count > 0) ValueF[0] = (f32)v.start.X;
if (Count > 1) ValueF[1] = (f32)v.start.Y;
if (Count > 2) ValueF[2] = (f32)v.end.X;
if (Count > 3) ValueF[3] = (f32)v.end.Y;
}
else
{
if (Count > 0) ValueI[0] = v.start.X;
if (Count > 1) ValueI[1] = v.start.Y;
if (Count > 2) ValueI[2] = v.end.X;
if (Count > 3) ValueI[3] = v.end.Y;
}
}
virtual void setLine2d(core::line2df v)
{
reset();
if (IsFloat)
{
if (Count > 0) ValueF[0] = v.start.X;
if (Count > 1) ValueF[1] = v.start.Y;
if (Count > 2) ValueF[2] = v.end.X;
if (Count > 3) ValueF[3] = v.end.Y;
}
else
{
if (Count > 0) ValueI[0] = (s32)v.start.X;
if (Count > 1) ValueI[1] = (s32)v.start.Y;
if (Count > 2) ValueI[2] = (s32)v.end.X;
if (Count > 3) ValueI[3] = (s32)v.end.Y;
}
}
virtual void setDimension2d(core::dimension2du v)
{
reset();
if (IsFloat)
{
if (Count > 0) ValueF[0] = (f32)v.Width;
if (Count > 1) ValueF[1] = (f32)v.Height;
}
else
{
if (Count > 0) ValueI[0] = v.Width;
if (Count > 1) ValueI[1] = v.Height;
}
}
//! set float array
virtual void setFloatArray(core::array<f32> &vals)
{
reset();
for (u32 i=0; i<vals.size() && i<Count; ++i)
{
if (IsFloat)
ValueF[i] = vals[i];
else
ValueI[i] = (s32)vals[i];
}
}
//! set int array
virtual void setIntArray(core::array<s32> &vals)
{
reset();
for (u32 i=0; i<vals.size() && i<Count; ++i)
{
if (IsFloat)
ValueF[i] = (f32)vals[i];
else
ValueI[i] = vals[i];
}
}
//! is it a number list?
virtual bool isNumberList()
{
return true;
}
//! is it a float list?
virtual bool isFloat()
{
return IsFloat;
}
virtual E_ATTRIBUTE_TYPE getType() const
{
if (IsFloat)
return EAT_FLOATARRAY;
else
return EAT_INTARRAY;
}
virtual const wchar_t* getTypeString() const
{
if (IsFloat)
return L"floatlist";
else
return L"intlist";
}
protected:
//! clear all values
void reset()
{
if (IsFloat)
for (u32 i=0; i < Count ; ++i)
ValueF[i] = 0.0f;
else
for (u32 i=0; i < Count ; ++i)
ValueI[i] = 0;
}
core::array<s32> ValueI;
core::array<f32> ValueF;
u32 Count;
bool IsFloat;
};
// Attribute implemented for floating point colors
class CColorfAttribute : public CNumbersAttribute
{
public:
CColorfAttribute(const char* name, video::SColorf value) : CNumbersAttribute(name, value) {}
virtual s32 getInt()
{
return getColor().color;
}
virtual f32 getFloat()
{
return (f32)getColor().color;
}
virtual void setInt(s32 intValue)
{
video::SColorf c = video::SColor(intValue);
ValueF[0] = c.r;
ValueF[1] = c.g;
ValueF[2] = c.b;
ValueF[3] = c.a;
}
virtual void setFloat(f32 floatValue)
{
setInt((s32)floatValue);
}
virtual E_ATTRIBUTE_TYPE getType() const
{
return EAT_COLORF;
}
virtual const wchar_t* getTypeString() const
{
return L"colorf";
}
};
// Attribute implemented for colors
class CColorAttribute : public CNumbersAttribute
{
public:
CColorAttribute(const char* name, video::SColorf value) : CNumbersAttribute(name, value) {}
virtual s32 getInt()
{
return getColor().color;
}
virtual f32 getFloat()
{
return (f32)getColor().color;
}
virtual void setInt(s32 intValue)
{
video::SColorf c = video::SColor(intValue);
ValueF[0] = c.r;
ValueF[1] = c.g;
ValueF[2] = c.b;
ValueF[3] = c.a;
}
virtual void setFloat(f32 floatValue)
{
setInt((s32)floatValue);
}
virtual core::stringw getStringW()
{
char tmp[10];
const video::SColor c = getColor();
sprintf(tmp, "%02x%02x%02x%02x", c.getAlpha(), c.getRed(), c.getBlue(), c.getGreen());
return core::stringw(tmp);
}
virtual void setString(const char* text)
{
u32 c;
sscanf(text, "%08x", &c);
setColor(c);
}
virtual E_ATTRIBUTE_TYPE getType() const
{
return EAT_COLOR;
}
virtual const wchar_t* getTypeString() const
{
return L"color";
}
};
// Attribute implemented for 3d vectors
class CVector3DAttribute : public CNumbersAttribute
{
public:
CVector3DAttribute(const char* name, core::vector3df value) : CNumbersAttribute(name, value) {}
virtual E_ATTRIBUTE_TYPE getType() const
{
return EAT_VECTOR3D;
}
virtual core::matrix4 getMatrix()
{
core::matrix4 ret;
ret.makeIdentity();
ret.setTranslation( core::vector3df(ValueF[0],ValueF[1],ValueF[2]) );
return ret;
}
virtual const wchar_t* getTypeString() const
{
return L"vector3d";
}
};
// Attribute implemented for 2d vectors
class CPosition2DAttribute : public CNumbersAttribute
{
public:
CPosition2DAttribute(const char* name, core::position2di value) : CNumbersAttribute(name, value) {}
virtual E_ATTRIBUTE_TYPE getType() const
{
return EAT_POSITION2D;
}
virtual const wchar_t* getTypeString() const
{
return L"position";
}
};
// Attribute implemented for rectangles
class CRectAttribute : public CNumbersAttribute
{
public:
CRectAttribute(const char* name, core::rect<s32> value) : CNumbersAttribute(name, value) { }
virtual E_ATTRIBUTE_TYPE getType() const
{
return EAT_RECT;
}
virtual const wchar_t* getTypeString() const
{
return L"rect";
}
};
// Attribute implemented for matrices
class CMatrixAttribute : public CNumbersAttribute
{
public:
CMatrixAttribute(const char* name, core::matrix4 value) : CNumbersAttribute(name, value) { }
virtual E_ATTRIBUTE_TYPE getType() const
{
return EAT_MATRIX;
}
virtual core::quaternion getQuaternion()
{
return core::quaternion(getMatrix());
}
virtual const wchar_t* getTypeString() const
{
return L"matrix";
}
};
// Attribute implemented for quaternions
class CQuaternionAttribute : public CNumbersAttribute
{
public:
CQuaternionAttribute(const char* name, core::quaternion value) : CNumbersAttribute(name, value) { }
virtual E_ATTRIBUTE_TYPE getType() const
{
return EAT_QUATERNION;
}
virtual core::matrix4 getMatrix()
{
return getQuaternion().getMatrix();
}
virtual const wchar_t* getTypeString() const
{
return L"quaternion";
}
};
// Attribute implemented for bounding boxes
class CBBoxAttribute : public CNumbersAttribute
{
public:
CBBoxAttribute(const char* name, core::aabbox3df value) : CNumbersAttribute(name, value) { }
virtual E_ATTRIBUTE_TYPE getType() const
{
return EAT_BBOX;
}
virtual const wchar_t* getTypeString() const
{
return L"box3d";
}
};
// Attribute implemented for planes
class CPlaneAttribute : public CNumbersAttribute
{
public:
CPlaneAttribute(const char* name, core::plane3df value) : CNumbersAttribute(name, value) { }
virtual E_ATTRIBUTE_TYPE getType() const
{
return EAT_PLANE;
}
virtual const wchar_t* getTypeString() const
{
return L"plane";
}
};
// Attribute implemented for triangles
class CTriangleAttribute : public CNumbersAttribute
{
public:
CTriangleAttribute(const char* name, core::triangle3df value) : CNumbersAttribute(name, value) { }
virtual E_ATTRIBUTE_TYPE getType() const
{
return EAT_TRIANGLE3D;
}
virtual core::plane3df getPlane()
{
return getTriangle().getPlane();
}
virtual const wchar_t* getTypeString() const
{
return L"triangle";
}
};
// Attribute implemented for 2d lines
class CLine2dAttribute : public CNumbersAttribute
{
public:
CLine2dAttribute(const char* name, core::line2df value) : CNumbersAttribute(name, value) { }
virtual E_ATTRIBUTE_TYPE getType() const
{
return EAT_LINE2D;
}
virtual const wchar_t* getTypeString() const
{
return L"line2d";
}
};
// Attribute implemented for 3d lines
class CLine3dAttribute : public CNumbersAttribute
{
public:
CLine3dAttribute(const char* name, core::line3df value) : CNumbersAttribute(name, value) { }
virtual E_ATTRIBUTE_TYPE getType() const
{
return EAT_LINE3D;
}
virtual const wchar_t* getTypeString() const
{
return L"line3d";
}
};
// vector2df
// dimension2du
/*
Special attributes
*/
// Attribute implemented for enumeration literals
class CEnumAttribute : public IAttribute
{
public:
CEnumAttribute(const char* name, const char* value, const char* const* literals)
{
Name = name;
setEnum(value, literals);
}
virtual void setEnum(const char* enumValue, const char* const* enumerationLiterals)
{
int literalCount = 0;
if (enumerationLiterals)
{
s32 i;
for (i=0; enumerationLiterals[i]; ++i)
++literalCount;
EnumLiterals.reallocate(literalCount);
for (i=0; enumerationLiterals[i]; ++i)
EnumLiterals.push_back(enumerationLiterals[i]);
}
setString(enumValue);
}
virtual s32 getInt()
{
for (s32 i=0; EnumLiterals.size(); ++i)
if (Value.equals_ignore_case(EnumLiterals[i]))
{
return i;
}
return -1;
}
virtual f32 getFloat()
{
return (f32)getInt();
}
virtual bool getBool()
{
return (getInt() != 0); // does not make a lot of sense, I know
}
virtual core::stringc getString()
{
return Value;
}
virtual core::stringw getStringW()
{
return core::stringw(Value.c_str());
}
virtual void setInt(s32 intValue)
{
if (intValue>=0 && intValue<(s32)EnumLiterals.size())
Value = EnumLiterals[intValue];
else
Value = "";
}
virtual void setFloat(f32 floatValue)
{
setInt((s32)floatValue);
};
virtual void setString(const char* text)
{
Value = text;
}
virtual const char* getEnum()
{
return Value.c_str();
}
virtual E_ATTRIBUTE_TYPE getType() const
{
return EAT_ENUM;
}
virtual const wchar_t* getTypeString() const
{
return L"enum";
}
core::stringc Value;
core::array<core::stringc> EnumLiterals;
};
// Attribute implemented for strings
class CStringAttribute : public IAttribute
{
public:
CStringAttribute(const char* name, const char* value)
{
IsStringW=false;
Name = name;
setString(value);
}
CStringAttribute(const char* name, const wchar_t* value)
{
IsStringW = true;
Name = name;
setString(value);
}
CStringAttribute(const char* name, void* binaryData, s32 lenghtInBytes)
{
IsStringW=false;
Name = name;
setBinary(binaryData, lenghtInBytes);
}
virtual s32 getInt()
{
if (IsStringW)
return atoi(core::stringc(ValueW.c_str()).c_str());
else
return atoi(Value.c_str());
}
virtual f32 getFloat()
{
if (IsStringW)
return core::fast_atof(core::stringc(ValueW.c_str()).c_str());
else
return core::fast_atof(Value.c_str());
}
virtual bool getBool()
{
if (IsStringW)
return Value.equals_ignore_case(L"true");
else
return Value.equals_ignore_case("true");
}
virtual core::stringc getString()
{
if (IsStringW)
return core::stringc(ValueW.c_str());
else
return Value;
}
virtual core::stringw getStringW()
{
if (IsStringW)
return ValueW;
else
return core::stringw(Value.c_str());
}
virtual void setInt(s32 intValue)
{
if (IsStringW)
ValueW = core::stringw(intValue);
else
Value = core::stringc(intValue);
}
virtual void setFloat(f32 floatValue)
{
if (IsStringW)
{
ValueW = core::stringw(floatValue);
}
else
{
Value = core::stringc(floatValue);
}
};
virtual void setString(const char* text)
{
if (IsStringW)
ValueW = core::stringw(text);
else
Value = text;
}
virtual void setString(const wchar_t* text)
{
if (IsStringW)
ValueW = text;
else
Value = core::stringc(text);
}
virtual E_ATTRIBUTE_TYPE getType() const
{
return EAT_STRING;
}
virtual const wchar_t* getTypeString() const
{
return L"string";
}
virtual void getBinary(void* outdata, s32 maxLength)
{
s32 dataSize = maxLength;
c8* datac8 = (c8*)(outdata);
s32 p = 0;
const c8* dataString = Value.c_str();
for (s32 i=0; i<dataSize; ++i)
datac8[i] = 0;
while(dataString[p] && p<dataSize)
{
s32 v = getByteFromHex((c8)dataString[p*2]) * 16;
if (dataString[(p*2)+1])
v += getByteFromHex((c8)dataString[(p*2)+1]);
datac8[p] = v;
++p;
}
};
virtual void setBinary(void* data, s32 maxLength)
{
s32 dataSize = maxLength;
c8* datac8 = (c8*)(data);
char tmp[3];
tmp[2] = 0;
Value = "";
for (s32 b=0; b<dataSize; ++b)
{
getHexStrFromByte(datac8[b], tmp);
Value.append(tmp);
}
};
bool IsStringW;
core::stringc Value;
core::stringw ValueW;
protected:
static inline s32 getByteFromHex(c8 h)
{
if (h >= '0' && h <='9')
return h-'0';
if (h >= 'a' && h <='f')
return h-'a' + 10;
return 0;
}
static inline void getHexStrFromByte(c8 byte, c8* out)
{
s32 b = (byte & 0xf0) >> 4;
for (s32 i=0; i<2; ++i)
{
if (b >=0 && b <= 9)
out[i] = b+'0';
if (b >=10 && b <= 15)
out[i] = (b-10)+'a';
b = byte & 0x0f;
}
}
};
// Attribute implemented for binary data
class CBinaryAttribute : public CStringAttribute
{
public:
CBinaryAttribute(const char* name, void* binaryData, s32 lenghtInBytes)
: CStringAttribute(name, binaryData, lenghtInBytes)
{
}
virtual E_ATTRIBUTE_TYPE getType() const
{
return EAT_BINARY;
}
virtual const wchar_t* getTypeString() const
{
return L"binary";
}
};
// Attribute implemented for texture references
class CTextureAttribute : public IAttribute
{
public:
CTextureAttribute(const char* name, video::ITexture* value, video::IVideoDriver* driver)
: Value(0), Driver(driver)
{
if (Driver)
Driver->grab();
Name = name;
setTexture(value);
}
~CTextureAttribute()
{
if (Driver)
Driver->drop();
if (Value)
Value->drop();
}
virtual video::ITexture* getTexture()
{
return Value;
}
virtual bool getBool()
{
return (Value != 0);
}
virtual core::stringw getStringW()
{
return core::stringw(Value ? Value->getName().c_str() : 0);
}
virtual core::stringc getString()
{
return Value ? Value->getName() : core::stringc();
}
virtual void setString(const char* text)
{
if (Driver)
{
if (text && *text)
setTexture(Driver->getTexture(text));
else
setTexture(0);
}
}
virtual void setTexture(video::ITexture* value)
{
if (Value)
Value->drop();
Value = value;
if (Value)
Value->grab();
}
virtual E_ATTRIBUTE_TYPE getType() const
{
return EAT_TEXTURE;
}
virtual const wchar_t* getTypeString() const
{
return L"texture";
}
video::ITexture* Value;
video::IVideoDriver* Driver;
};
// Attribute implemented for array of stringw
class CStringWArrayAttribute : public IAttribute
{
public:
CStringWArrayAttribute(const char* name, core::array<core::stringw> value)
{
Name = name;
setArray(value);
}
virtual core::array<core::stringw> getArray()
{
return Value;
}
virtual void setArray(core::array<core::stringw> value)
{
Value = value;
}
virtual E_ATTRIBUTE_TYPE getType() const
{
return EAT_STRINGWARRAY;
}
virtual const wchar_t* getTypeString() const
{
return L"stringwarray";
}
core::array<core::stringw> Value;
};
// Attribute implemented for user pointers
class CUserPointerAttribute : public IAttribute
{
public:
CUserPointerAttribute(const char* name, void* value)
{
Name = name;
Value = value;
}
virtual s32 getInt()
{
return *(s32*)(&Value);
}
virtual bool getBool()
{
return (Value != 0);
}
Changes in version 1.6, TA - FileSystem 2.0 SUPER MASTER MAJOR API CHANGE !!! The FileSystem is know build internally like for e.q the texture-, and the meshloaders. There exists a known list of ArchiveLoader, which know how to produce a Archive. The Loaders and the Archive can be attached/detached on runtime. The FileNames are now stored as core::string<c16>. where c16 is toggled between char/wchar with the #define flag _IRR_WCHAR_FILESYSTEM, to supported unicode backends (default:off) I replaced all (const c8* filename) to string references. Basically the FileSystem is divided into two regions. Native and Virtual. Native means using the backend OS. Virtual means only use currently attach IArchives. Browsing each FileSystem has it's own workdirectory and it's own methods to - create a FileTree - add/remove files & directory ( to be done ) Hint: store a savegame in a zip archive... basic browsing for all archives is implemented. Example 21. Quake3Explorer shows this TODO: - a file filter should be implemented. - The IArchive should have a function to create a filetree for now CFileList is used. Class Hiarchy: IArchiveLoader: is able to produce a IFileArchive - ZipLoader - PakLoader - MountPointReader ( formaly known as CUnzipReader ) IFileArchive: -ZipArchive -PakArchive -MountPoint (known as FolderFile) IFileSystem - addArchiveLoader - changed implementation of isALoadableFileExtension in all loaders to have consistent behavior - added a parameter to IFileList * createFileList setFileListSystem allows to query files in any of the game archives standard behavior listtype = SYSTEM ( default) - CLimitReadFile added multiple file random-access support. solved problems with mixed compressed & uncompressed files in a zip TODO: - Big Big Testing!! - Linux Version ( minor ) - remove all double loader interfaces where only the filename differs (IReadFile/const char *filename). This blows up the the interface - many loaders use their own private filesearching we should rework this - there are a lot of helper function ( getAbsolutePath, getFileDir ) which should be adapted to the virtual filesystem - IrrlichtDevice added: virtual bool setGammaRamp( f32 red, f32 green, f32 blue, f32 brightness, f32 contrast ) = 0; virtual bool getGammaRamp( f32 &red, f32 &green, f32 &blue ) = 0; and calculating methods to DeviceStub. implemented in Win32, TODO: other Devices - irrlicht.h changed exported irrlicht.dll routines createDevice, createDeviceEx, IdentityMatrix to extern "C" name mangling. for easier dynamically loading the irrlicht library and different versions - ParticleSystem removed the private (old?,wrong?) interface from the ParticleEffectors to match the parent class irr::io::IAttributeExchangingObject::deserializeAttributes TODO: please test if the serialization works! - Generic - vector3d<T>& normalize() #if 0 f32 length = (f32)(X*X + Y*Y + Z*Z); if (core::equals(length, 0.f)) return *this; length = core::reciprocal_squareroot ( (f32)length ); #else const T length = core::reciprocal_squareroot ( (X*X + Y*Y + Z*Z) ); #endif Weak checking on zero?!?! just to avoid a sqrt?. mhm, maybe not;-) added reciprocal_squareroot for f64 - dimension2d added operator dimension2d<T>& operator=(const dimension2d<U>& other) to cast between different types - vector2d bugfix: vector2d<T>& operator+=(const dimension2d<T>& other) { X += other.Width; Y += other.Width; return *this; } to vector2d<T>& operator+=(const dimension2d<T>& other) { X += other.Width; Y += other.Height; return *this; } - C3DMeshLoader renamed chunks const u16 to a enum removing "variable declared but never used warning" - added a global const identity Material changed all references *((video::SMaterial*)0) to point to IdentityMaterial removed warning: "a NULL reference is not allowed" - modified IRRLICHT_MATH to not support reciprocal stuff but to use faster float-to-int conversion. gcc troubles may they are. i'm using intel-compiler..;-) - core::matrix4 USE_MATRIX_TEST i tried to optimize the identity-check ( in means of performance) i didn't succeed so well, so i made a define for the matrix isIdentity -check for now it's sometimes faster to always calculate versus identity-check but if there are a lot of scenenodes/ particles one can profit from the fast_inverse matrix, when no scaling is used. further approvement could be done on inverse for just tranlastion! ( many static scenenodes are not rotated, they are just placed somewhere in the world) one thing to take in account is that sizeof(matrix) is 64 byte and with the additional bool/u32 makes it 66 byte which is not really cache-friendly.. - added buildRotateFromTo Builds a matrix that rotates from one vector to another - irr::array. changed allocating routine in push_back okt, 2008. it's only allowed to alloc one element, if default constructor has to be called. removes existing crashes. ( MD3 Mesh ) and possible others ones. A new list template should be made. one with constructor/destructor calls ( safe_array ) and one without. like the array since the beginning of irrlicht. currently the array/string is extremly slow.. also a hint for the user has to be done, so that a struct T of array<T> must have a copy constructor of type T ( const T&other ). i needed hours to track that down... added a new method setAllocStrategy, safe ( used + 1 ), double ( used * 2 + 1) better default strategies will be implemented - removed binary_search_const i added it quite a long time ago, but it doesnt make real sense a call to a sort method should happen always. i just wanted to safe a few cycles.. - added binary_search_multi searches for a multi-set ( more than 1 entry in the sorted array) returns start and end-index - changed some identity matrix settings to use core::IdentityMatrix - added deletePathFromFilename to generic string functions in coreutil.h and removed from CZipReader and CPakReader - s32 deserializeAttributes used instead of virtual void deserializeAttributes in ParticleSystem ( wrong virtual was used) - strings & Locale - started to add locale support - added verify to string - added some helper functions - XBOX i have access to a XBOX development machine now. I started to compile for the XBOX. Question: Who did the previous implementation?. There is no XBOX-Device inhere. maybe it's forbidden because of using the offical Microsoft XDK. I will implement a native or sdl device based on opendk. irrlicht compiles without errors on the xbox but can't be used. TODO: - native XBOX Device - Windows Mobile reworked a little. added the mobile example to the windows solution for cross development. added maximal 128x128 texture size for windows mobile ( memory issues ) - Collision Speed Up The Collision Speed Up greatly improves with many small static child-nodes - added COctTreeTriangleSelector::getTriangles for 3dline from user Piraaate - modified createOctTreeTriangleSelector and createTriangleSelector to allow node == 0, to be added to a meta selector - CSceneNodeAnimatorCollisionResponse has the same problem as CSceneNodeAnimatorFPS on first update: Problem. you start setting the map. (setWorld). First update cames 4000 ms later. The Animator applies the missing force... big problem... changed to react on first update like camera. - add Variable FirstUpdate. if set to true ( on all changes ) then position, lasttime, and falling are initialized -added #define OCTTREE_USE_HARDWARE in Octree.h if defined octtree uses internally a derived scene::MeshBuffer which has the possibility to use the Hardware Vertex Buffer for static vertices and dirty indices;-) if defined OCTTREE_USE_HARDWARE octree uses internally a derived scene::CMeshBuffer so it's not just a replacement inside the octree. It also in the OctTreeSceneNode. #if defined (OCTTREE_USE_HARDWARE) driver->drawMeshBuffer ( &LightMapMeshes[i] ); #else driver->drawIndexedTriangleList( &LightMapMeshes[i].Vertices[0], LightMapMeshes[i].Vertices.size(), d[i].Indices, d[i].CurrentSize / 3); #endif #define OCTTREE_PARENTTEST is also used. It's skip testing on fully outside and takes everything on fully inside - virtual void ISceneNode::updateAbsolutePosition() - changed inline CMatrix4<T> CMatrix4<T>::operator*(const CMatrix4<T>& m2) const all two matrices have to be checked by isIdentity() to let the isIdentity work always -changed inline bool CMatrix4<T>::isIdentity() const on full identityCheck-> to look first on Translation, because this is the most challenging element which will likely not to be identity.. - virtual core::matrix4 getRelativeTransformation() const Hiarchy on Identity-Check 1) ->getRelativeTransform -> 9 floating point checks to be passed as Identity 2) ->isIdentity () -> 16 floating point checks to be passed as Identity - inline void CMatrix4<T>::transformBoxEx(core::aabbox3d<f32>& box) const added isIdentity() check - changed CSceneNodeAnimatorCollisionResponse - added CSceneNodeAnimatorCollisionResponse::setGravity needed to set the differents Forces for the Animator. for eq. water.. - added CSceneNodeAnimatorCollisionResponse::setAnimateTarget - added CSceneNodeAnimatorCollisionResponse::getAnimateTarget - changed CSceneNodeAnimatorCollisionResponse::animateNode to react on FirstUpdate - changad Gravity to - TODO: set Gravity to Physically frame independent values.. current response uses an frame depdended acceleration vector. ~9.81 m/s^2 was achieved at around 50 fps with a setting of -0.03 may effect existing application.. - SceneNodes - CSkyDomeSceneNode moved radius ( default 1000 ) to constructor added Normals added DebugInfo added Material.ZBuffer, added SceneMaanager - CVolumeLightSceneNode: changed default blending OneTextureBlendgl_src_color gl_src_alpha to EMT_TRANSPARENT_ADD_COLOR ( gl_src_color gl_one ) which gives the same effect on non-transparent-materials. Following the unspoken guide-line, lowest effect as default - added LensFlareSceneNode (from forum user gammaray, modified to work ) showing in example special fx - changed SceneNode Skydome f64 to f32, - AnimatedMesh -Debug Data: mesh normals didn't rotate with the scenenode fixed ( matrix-multiplication order) - Camera SceneNode setPosition Camera now finally allow to change position and target and updates all effected animators.. a call to OnAnimate ( ) lastime < time or OnAnimate ( 0 ) will reset the camera and fr. the collision animator to a new position - Device: added the current mousebutton state to the Mouse Event so i need to get the current mouse state from the OS -a dded to CIrrDeviceWin32 TODO: - Linux and SDL Device - GUI - CGUIFont: - added virtual void setInvisibleCharacters( const wchar_t *s ) = 0; define which characters should not be drawn ( send to driver) by the font. for example " " would not draw any space which is usually blank in most fonts and saves rendering of ususally full blank alpha-sprites. This saves a lot of rendering... default: setInvisibleCharacters ( L" " ); - added MultiLine rendering should avoid to us CStaticText breaking text in future - CGUIListBox - changed Scrollbar LargeStepSize to ItemHeight which easy enables to scroll line by line - CGUIScrollBar bug: Create a Window and inside a listbox with a scrollbar or a windowed irrlicht application Click & hold Scrollbar Slider. move outside it's region. Release Mouse. Go Back to Scrollbar.. it's moving always... it's generally missing the event PRESSED_MOVED, which leads to problem when an element is dragging, has a focus, or position loose and gets focus back again. ( think of a drunken mouse sliding left&right during tracking ) so added the mouse Input Buttonstates on every mouse event IrrDeviceWin32: added event.MouseInput.ButtonStates = wParam & ( MK_LBUTTON | MK_RBUTTON | MK_MBUTTON ); TODO: Linux & SDL so now i can do this case irr::EMIE_MOUSE_MOVED: if ( !event.MouseInput.isLeftPressed () ) { Dragging = false; } - bug: Scrollbar notifyListBox notify when the scrollbar is clicked. - changed timed event in draw to OnPostRender Why the hell is a gui element firing a timed event in a draw routine!!!!!. This should be corrected for all gui-elements. - added GUI Image List from Reinhard Ostermeier, modified to work added GUI Tree View from Reinhard Ostermeier, modified to work shown in the Quake3MapShader Example TODO: Spritebanks - FileOpenDialog changed the static text for the filename to an edit box. - changed the interface for addEditBox to match with addStaticText - changed the interface for addSpinBox to match with addEditBox - added MouseWheel to Spinbox - changed CGUITable CLICK_AREA from 3 to 12 to enable clicking on the visible marker - CGUISpritebank removed some crashes with empty Sprite banks - IGUIScrollBar added SetMin before min was always 0 changed ScrollWheel Direction on horizontal to move right on wheel up, left on wheel down - IComboBox -added ItemData - removed IsVisbile check in IGUIElement::draw - Image Loaders - added TGA file type 2 ( grayscale uncompressed ) - added TGA file type (1) 8 Bit indexed color uncompressed ColorConverter: - added convert_B8G8R8toA8R8G8B8 - added convert_B8G8R8A8toA8R8G8B8 - Media Files - added missing shaders and textures to map-20kdm2. Taken from free implementation - ball.wav. adjusted DC-Offset, amplified to -4dB, trim cross-zero - impact.wav clip-restoration, trim cross-zero - added gun.md2, gun.pcx to media-files copyright issues!. i don't know from where this file came from... i hope this is not from original quake2.. - added new irrlicht logo irrlicht3.png i've taken the new layout. i should ask niko to use it. - added Skydome picture to media files (skydome2.jpg) half/sphere - OctTree -added #define OCTTREE_PARENTTEST ( default: disabled ) used to leave-out children test if the parent passed a complete frustum. plus: leaves out children test minus: all edges have to be checked - added MesBuffer Hardware Hint Vertex to octtree - CQuake3ShaderSceneNode: - removed function releaseMesh Shader doesn't copy the original mesh anymore ( saving memory ) so therefore this (for others often misleading ) function was removed - changed constructor to take a (shared) destination meshbuffer for rendering reducing vertex-memory to a half - don't copy the original vertices anymore - added deformvertexes autosprite - added deformvertexes move - added support for RTCW and Raven BSPs ( qmap2 ) - added polygonoffset (TODO: not perfect) - added added nomipmaps - added rgbgen const - added alphagen - added MesBuffer Hardware Hint Vertex/Index to Quake3: static geometry, dynamic indices - added Quake3Explorer examples - added wave noise - added tcmod transform - added whiteimage - added collision to Quake3Explorer - renamed SMD3QuaterionTag* to SMD3QuaternionTag* ( typo ) - updated quake3:blendfunc - added crouch to Quake3Explorer (modifying the ellipsiodRadius of the camera animator ) added crouch to CSceneNodeAnimatorCameraFPS still problems with stand up and collision - Quake3MapLoader modified memory allocation for faster loading - Quake3LoadParam added Parameter to the Mesh-Loader - added The still existing missing caulking of curved surfaces. using round in the coordinates doesn't solve the problem. but for the demo bsp mesh it solves the problem... (luck) so for now it's switchable. TJUNCTION_SOLVER_ROUND default:off - BurningVideo - pushed BurningsVideo to 0.40 - added blendfunc gl_one_minus_dst_alpha gl_one - added blendfunc gl_dst_color gl_zero - added blendfunc gl_dst_color src_alpha - modified AlphaChannel_Ref renderer to support alpha test lessequal - addded 32 Bit Index Buffer - added sourceRect/destRect check to 2D-Blitter ( slower, but resolves crash ) - added setTextureCreationFlag video::ETCF_ALLOW_NON_POWER_2 Burning checks this flag and when set, it bypasses the power2 size check, which is necessary on 3D but can be avoided on 2D. used on fonts automatically. - added Support for Destination Alpha - OpenGL - Fixed a bug in COpenGLExtensenionHandler where a glint was downcasted to u8!!!!!! MaxTextureSize=static_cast<u32>(num); - TODO: COpenGLMaterialRenderer_ONETEXTURE_BLEND to work as expected - Direct3D8 - compile and links again - added 32 Bit Index Buffer - D3DSAMP_MIPMAPLODBIAS doesnt compile!. it is d3d9 i think. - compile for XBOX - Direc3D9 - fixed crash on RTT Textures DepthBuffer freed twice. added deleteAllTextures to destuctor - NullDriver - removeallTextures. added setMaterial ( SMaterial() ) to clean pointers for freed textures git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@2147 dfc29bdd-3216-0410-991c-e03cc46cb475
2009-01-27 07:53:53 -08:00
virtual core::stringw getStringW()
{
Changes in version 1.6, TA - FileSystem 2.0 SUPER MASTER MAJOR API CHANGE !!! The FileSystem is know build internally like for e.q the texture-, and the meshloaders. There exists a known list of ArchiveLoader, which know how to produce a Archive. The Loaders and the Archive can be attached/detached on runtime. The FileNames are now stored as core::string<c16>. where c16 is toggled between char/wchar with the #define flag _IRR_WCHAR_FILESYSTEM, to supported unicode backends (default:off) I replaced all (const c8* filename) to string references. Basically the FileSystem is divided into two regions. Native and Virtual. Native means using the backend OS. Virtual means only use currently attach IArchives. Browsing each FileSystem has it's own workdirectory and it's own methods to - create a FileTree - add/remove files & directory ( to be done ) Hint: store a savegame in a zip archive... basic browsing for all archives is implemented. Example 21. Quake3Explorer shows this TODO: - a file filter should be implemented. - The IArchive should have a function to create a filetree for now CFileList is used. Class Hiarchy: IArchiveLoader: is able to produce a IFileArchive - ZipLoader - PakLoader - MountPointReader ( formaly known as CUnzipReader ) IFileArchive: -ZipArchive -PakArchive -MountPoint (known as FolderFile) IFileSystem - addArchiveLoader - changed implementation of isALoadableFileExtension in all loaders to have consistent behavior - added a parameter to IFileList * createFileList setFileListSystem allows to query files in any of the game archives standard behavior listtype = SYSTEM ( default) - CLimitReadFile added multiple file random-access support. solved problems with mixed compressed & uncompressed files in a zip TODO: - Big Big Testing!! - Linux Version ( minor ) - remove all double loader interfaces where only the filename differs (IReadFile/const char *filename). This blows up the the interface - many loaders use their own private filesearching we should rework this - there are a lot of helper function ( getAbsolutePath, getFileDir ) which should be adapted to the virtual filesystem - IrrlichtDevice added: virtual bool setGammaRamp( f32 red, f32 green, f32 blue, f32 brightness, f32 contrast ) = 0; virtual bool getGammaRamp( f32 &red, f32 &green, f32 &blue ) = 0; and calculating methods to DeviceStub. implemented in Win32, TODO: other Devices - irrlicht.h changed exported irrlicht.dll routines createDevice, createDeviceEx, IdentityMatrix to extern "C" name mangling. for easier dynamically loading the irrlicht library and different versions - ParticleSystem removed the private (old?,wrong?) interface from the ParticleEffectors to match the parent class irr::io::IAttributeExchangingObject::deserializeAttributes TODO: please test if the serialization works! - Generic - vector3d<T>& normalize() #if 0 f32 length = (f32)(X*X + Y*Y + Z*Z); if (core::equals(length, 0.f)) return *this; length = core::reciprocal_squareroot ( (f32)length ); #else const T length = core::reciprocal_squareroot ( (X*X + Y*Y + Z*Z) ); #endif Weak checking on zero?!?! just to avoid a sqrt?. mhm, maybe not;-) added reciprocal_squareroot for f64 - dimension2d added operator dimension2d<T>& operator=(const dimension2d<U>& other) to cast between different types - vector2d bugfix: vector2d<T>& operator+=(const dimension2d<T>& other) { X += other.Width; Y += other.Width; return *this; } to vector2d<T>& operator+=(const dimension2d<T>& other) { X += other.Width; Y += other.Height; return *this; } - C3DMeshLoader renamed chunks const u16 to a enum removing "variable declared but never used warning" - added a global const identity Material changed all references *((video::SMaterial*)0) to point to IdentityMaterial removed warning: "a NULL reference is not allowed" - modified IRRLICHT_MATH to not support reciprocal stuff but to use faster float-to-int conversion. gcc troubles may they are. i'm using intel-compiler..;-) - core::matrix4 USE_MATRIX_TEST i tried to optimize the identity-check ( in means of performance) i didn't succeed so well, so i made a define for the matrix isIdentity -check for now it's sometimes faster to always calculate versus identity-check but if there are a lot of scenenodes/ particles one can profit from the fast_inverse matrix, when no scaling is used. further approvement could be done on inverse for just tranlastion! ( many static scenenodes are not rotated, they are just placed somewhere in the world) one thing to take in account is that sizeof(matrix) is 64 byte and with the additional bool/u32 makes it 66 byte which is not really cache-friendly.. - added buildRotateFromTo Builds a matrix that rotates from one vector to another - irr::array. changed allocating routine in push_back okt, 2008. it's only allowed to alloc one element, if default constructor has to be called. removes existing crashes. ( MD3 Mesh ) and possible others ones. A new list template should be made. one with constructor/destructor calls ( safe_array ) and one without. like the array since the beginning of irrlicht. currently the array/string is extremly slow.. also a hint for the user has to be done, so that a struct T of array<T> must have a copy constructor of type T ( const T&other ). i needed hours to track that down... added a new method setAllocStrategy, safe ( used + 1 ), double ( used * 2 + 1) better default strategies will be implemented - removed binary_search_const i added it quite a long time ago, but it doesnt make real sense a call to a sort method should happen always. i just wanted to safe a few cycles.. - added binary_search_multi searches for a multi-set ( more than 1 entry in the sorted array) returns start and end-index - changed some identity matrix settings to use core::IdentityMatrix - added deletePathFromFilename to generic string functions in coreutil.h and removed from CZipReader and CPakReader - s32 deserializeAttributes used instead of virtual void deserializeAttributes in ParticleSystem ( wrong virtual was used) - strings & Locale - started to add locale support - added verify to string - added some helper functions - XBOX i have access to a XBOX development machine now. I started to compile for the XBOX. Question: Who did the previous implementation?. There is no XBOX-Device inhere. maybe it's forbidden because of using the offical Microsoft XDK. I will implement a native or sdl device based on opendk. irrlicht compiles without errors on the xbox but can't be used. TODO: - native XBOX Device - Windows Mobile reworked a little. added the mobile example to the windows solution for cross development. added maximal 128x128 texture size for windows mobile ( memory issues ) - Collision Speed Up The Collision Speed Up greatly improves with many small static child-nodes - added COctTreeTriangleSelector::getTriangles for 3dline from user Piraaate - modified createOctTreeTriangleSelector and createTriangleSelector to allow node == 0, to be added to a meta selector - CSceneNodeAnimatorCollisionResponse has the same problem as CSceneNodeAnimatorFPS on first update: Problem. you start setting the map. (setWorld). First update cames 4000 ms later. The Animator applies the missing force... big problem... changed to react on first update like camera. - add Variable FirstUpdate. if set to true ( on all changes ) then position, lasttime, and falling are initialized -added #define OCTTREE_USE_HARDWARE in Octree.h if defined octtree uses internally a derived scene::MeshBuffer which has the possibility to use the Hardware Vertex Buffer for static vertices and dirty indices;-) if defined OCTTREE_USE_HARDWARE octree uses internally a derived scene::CMeshBuffer so it's not just a replacement inside the octree. It also in the OctTreeSceneNode. #if defined (OCTTREE_USE_HARDWARE) driver->drawMeshBuffer ( &LightMapMeshes[i] ); #else driver->drawIndexedTriangleList( &LightMapMeshes[i].Vertices[0], LightMapMeshes[i].Vertices.size(), d[i].Indices, d[i].CurrentSize / 3); #endif #define OCTTREE_PARENTTEST is also used. It's skip testing on fully outside and takes everything on fully inside - virtual void ISceneNode::updateAbsolutePosition() - changed inline CMatrix4<T> CMatrix4<T>::operator*(const CMatrix4<T>& m2) const all two matrices have to be checked by isIdentity() to let the isIdentity work always -changed inline bool CMatrix4<T>::isIdentity() const on full identityCheck-> to look first on Translation, because this is the most challenging element which will likely not to be identity.. - virtual core::matrix4 getRelativeTransformation() const Hiarchy on Identity-Check 1) ->getRelativeTransform -> 9 floating point checks to be passed as Identity 2) ->isIdentity () -> 16 floating point checks to be passed as Identity - inline void CMatrix4<T>::transformBoxEx(core::aabbox3d<f32>& box) const added isIdentity() check - changed CSceneNodeAnimatorCollisionResponse - added CSceneNodeAnimatorCollisionResponse::setGravity needed to set the differents Forces for the Animator. for eq. water.. - added CSceneNodeAnimatorCollisionResponse::setAnimateTarget - added CSceneNodeAnimatorCollisionResponse::getAnimateTarget - changed CSceneNodeAnimatorCollisionResponse::animateNode to react on FirstUpdate - changad Gravity to - TODO: set Gravity to Physically frame independent values.. current response uses an frame depdended acceleration vector. ~9.81 m/s^2 was achieved at around 50 fps with a setting of -0.03 may effect existing application.. - SceneNodes - CSkyDomeSceneNode moved radius ( default 1000 ) to constructor added Normals added DebugInfo added Material.ZBuffer, added SceneMaanager - CVolumeLightSceneNode: changed default blending OneTextureBlendgl_src_color gl_src_alpha to EMT_TRANSPARENT_ADD_COLOR ( gl_src_color gl_one ) which gives the same effect on non-transparent-materials. Following the unspoken guide-line, lowest effect as default - added LensFlareSceneNode (from forum user gammaray, modified to work ) showing in example special fx - changed SceneNode Skydome f64 to f32, - AnimatedMesh -Debug Data: mesh normals didn't rotate with the scenenode fixed ( matrix-multiplication order) - Camera SceneNode setPosition Camera now finally allow to change position and target and updates all effected animators.. a call to OnAnimate ( ) lastime < time or OnAnimate ( 0 ) will reset the camera and fr. the collision animator to a new position - Device: added the current mousebutton state to the Mouse Event so i need to get the current mouse state from the OS -a dded to CIrrDeviceWin32 TODO: - Linux and SDL Device - GUI - CGUIFont: - added virtual void setInvisibleCharacters( const wchar_t *s ) = 0; define which characters should not be drawn ( send to driver) by the font. for example " " would not draw any space which is usually blank in most fonts and saves rendering of ususally full blank alpha-sprites. This saves a lot of rendering... default: setInvisibleCharacters ( L" " ); - added MultiLine rendering should avoid to us CStaticText breaking text in future - CGUIListBox - changed Scrollbar LargeStepSize to ItemHeight which easy enables to scroll line by line - CGUIScrollBar bug: Create a Window and inside a listbox with a scrollbar or a windowed irrlicht application Click & hold Scrollbar Slider. move outside it's region. Release Mouse. Go Back to Scrollbar.. it's moving always... it's generally missing the event PRESSED_MOVED, which leads to problem when an element is dragging, has a focus, or position loose and gets focus back again. ( think of a drunken mouse sliding left&right during tracking ) so added the mouse Input Buttonstates on every mouse event IrrDeviceWin32: added event.MouseInput.ButtonStates = wParam & ( MK_LBUTTON | MK_RBUTTON | MK_MBUTTON ); TODO: Linux & SDL so now i can do this case irr::EMIE_MOUSE_MOVED: if ( !event.MouseInput.isLeftPressed () ) { Dragging = false; } - bug: Scrollbar notifyListBox notify when the scrollbar is clicked. - changed timed event in draw to OnPostRender Why the hell is a gui element firing a timed event in a draw routine!!!!!. This should be corrected for all gui-elements. - added GUI Image List from Reinhard Ostermeier, modified to work added GUI Tree View from Reinhard Ostermeier, modified to work shown in the Quake3MapShader Example TODO: Spritebanks - FileOpenDialog changed the static text for the filename to an edit box. - changed the interface for addEditBox to match with addStaticText - changed the interface for addSpinBox to match with addEditBox - added MouseWheel to Spinbox - changed CGUITable CLICK_AREA from 3 to 12 to enable clicking on the visible marker - CGUISpritebank removed some crashes with empty Sprite banks - IGUIScrollBar added SetMin before min was always 0 changed ScrollWheel Direction on horizontal to move right on wheel up, left on wheel down - IComboBox -added ItemData - removed IsVisbile check in IGUIElement::draw - Image Loaders - added TGA file type 2 ( grayscale uncompressed ) - added TGA file type (1) 8 Bit indexed color uncompressed ColorConverter: - added convert_B8G8R8toA8R8G8B8 - added convert_B8G8R8A8toA8R8G8B8 - Media Files - added missing shaders and textures to map-20kdm2. Taken from free implementation - ball.wav. adjusted DC-Offset, amplified to -4dB, trim cross-zero - impact.wav clip-restoration, trim cross-zero - added gun.md2, gun.pcx to media-files copyright issues!. i don't know from where this file came from... i hope this is not from original quake2.. - added new irrlicht logo irrlicht3.png i've taken the new layout. i should ask niko to use it. - added Skydome picture to media files (skydome2.jpg) half/sphere - OctTree -added #define OCTTREE_PARENTTEST ( default: disabled ) used to leave-out children test if the parent passed a complete frustum. plus: leaves out children test minus: all edges have to be checked - added MesBuffer Hardware Hint Vertex to octtree - CQuake3ShaderSceneNode: - removed function releaseMesh Shader doesn't copy the original mesh anymore ( saving memory ) so therefore this (for others often misleading ) function was removed - changed constructor to take a (shared) destination meshbuffer for rendering reducing vertex-memory to a half - don't copy the original vertices anymore - added deformvertexes autosprite - added deformvertexes move - added support for RTCW and Raven BSPs ( qmap2 ) - added polygonoffset (TODO: not perfect) - added added nomipmaps - added rgbgen const - added alphagen - added MesBuffer Hardware Hint Vertex/Index to Quake3: static geometry, dynamic indices - added Quake3Explorer examples - added wave noise - added tcmod transform - added whiteimage - added collision to Quake3Explorer - renamed SMD3QuaterionTag* to SMD3QuaternionTag* ( typo ) - updated quake3:blendfunc - added crouch to Quake3Explorer (modifying the ellipsiodRadius of the camera animator ) added crouch to CSceneNodeAnimatorCameraFPS still problems with stand up and collision - Quake3MapLoader modified memory allocation for faster loading - Quake3LoadParam added Parameter to the Mesh-Loader - added The still existing missing caulking of curved surfaces. using round in the coordinates doesn't solve the problem. but for the demo bsp mesh it solves the problem... (luck) so for now it's switchable. TJUNCTION_SOLVER_ROUND default:off - BurningVideo - pushed BurningsVideo to 0.40 - added blendfunc gl_one_minus_dst_alpha gl_one - added blendfunc gl_dst_color gl_zero - added blendfunc gl_dst_color src_alpha - modified AlphaChannel_Ref renderer to support alpha test lessequal - addded 32 Bit Index Buffer - added sourceRect/destRect check to 2D-Blitter ( slower, but resolves crash ) - added setTextureCreationFlag video::ETCF_ALLOW_NON_POWER_2 Burning checks this flag and when set, it bypasses the power2 size check, which is necessary on 3D but can be avoided on 2D. used on fonts automatically. - added Support for Destination Alpha - OpenGL - Fixed a bug in COpenGLExtensenionHandler where a glint was downcasted to u8!!!!!! MaxTextureSize=static_cast<u32>(num); - TODO: COpenGLMaterialRenderer_ONETEXTURE_BLEND to work as expected - Direct3D8 - compile and links again - added 32 Bit Index Buffer - D3DSAMP_MIPMAPLODBIAS doesnt compile!. it is d3d9 i think. - compile for XBOX - Direc3D9 - fixed crash on RTT Textures DepthBuffer freed twice. added deleteAllTextures to destuctor - NullDriver - removeallTextures. added setMaterial ( SMaterial() ) to clean pointers for freed textures git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@2147 dfc29bdd-3216-0410-991c-e03cc46cb475
2009-01-27 07:53:53 -08:00
wchar_t buf[32];
swprintf(buf, 32, L"0x%x", *(int*)(&Value));
return core::stringw(buf);
}
virtual void setString(const char* text)
{
sscanf(text, "0x%x", (unsigned int*)(&Value));
}
virtual E_ATTRIBUTE_TYPE getType() const
{
return EAT_USER_POINTER;
}
virtual void setUserPointer(void* v)
{
Value = v;
}
virtual void* getUserPointer()
{
return Value;
}
virtual const wchar_t* getTypeString() const
{
return L"userPointer";
}
void* Value;
};
// todo: CGUIFontAttribute
} // end namespace io
} // end namespace irr