Commit 78b7ae18 authored by cutealien's avatar cutealien

Fix compiling on gcc/Linux. Remove a bunch of warnings.


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@3342 dfc29bdd-3216-0410-991c-e03cc46cb475
parent 59b24ed7
...@@ -61,7 +61,7 @@ namespace scene ...@@ -61,7 +61,7 @@ namespace scene
//! No Animation //! No Animation
EAMT_STILL, EAMT_STILL,
//! From Start to End, then Stop ( Limited Line ) //! From Start to End, then Stop ( Limited Line )
EAMT_WAYPOINT, EAMT_WAYPOINT,
//! Linear Cycling Animation ( Sawtooth ) //! Linear Cycling Animation ( Sawtooth )
EAMT_LOOPING, EAMT_LOOPING,
//! Linear bobbing ( Triangle ) //! Linear bobbing ( Triangle )
...@@ -103,10 +103,9 @@ namespace scene ...@@ -103,10 +103,9 @@ namespace scene
KeyFrameInterpolation ( const c8 * name = "", s32 start = 0, s32 frames = 0, s32 loopingframes = 0, KeyFrameInterpolation ( const c8 * name = "", s32 start = 0, s32 frames = 0, s32 loopingframes = 0,
f32 fps = 0.f, f32 relativefps = 1.f ) f32 fps = 0.f, f32 relativefps = 1.f )
: Name ( name ), AnimationType ( loopingframes ? EAMT_LOOPING : EAMT_WAYPOINT), : Name ( name ), AnimationType ( loopingframes ? EAMT_LOOPING : EAMT_WAYPOINT),
StartFrame ( start ), CurrentFrame ( (f32) start ), NextFrame ( start ), CurrentFrame ( (f32) start ), NextFrame ( start ), StartFrame ( start ),
Frames ( frames ), EndFrame ( start + frames - 1 ), Frames ( frames ), LoopingFrames ( loopingframes ), EndFrame ( start + frames - 1 ),
FramesPerSecond ( fps ), RelativeSpeed ( relativefps ), FramesPerSecond ( fps ), RelativeSpeed ( relativefps ),
LoopingFrames ( loopingframes ),
BeginTime ( 0 ), EndTime ( 0 ), LastTime ( 0 ) BeginTime ( 0 ), EndTime ( 0 ), LastTime ( 0 )
{ {
} }
......
...@@ -21,167 +21,167 @@ namespace scene ...@@ -21,167 +21,167 @@ namespace scene
using namespace video; using namespace video;
void AngleQuaternion( const vec3_hl angles, vec4_hl quaternion ) void AngleQuaternion( const vec3_hl angles, vec4_hl quaternion )
{ {
f32 angle; f32 angle;
f32 sr, sp, sy, cr, cp, cy; f32 sr, sp, sy, cr, cp, cy;
// FIXME: rescale the inputs to 1/2 angle // FIXME: rescale the inputs to 1/2 angle
angle = angles[2] * 0.5f; angle = angles[2] * 0.5f;
sy = sin(angle); sy = sin(angle);
cy = cos(angle); cy = cos(angle);
angle = angles[1] * 0.5f; angle = angles[1] * 0.5f;
sp = sin(angle); sp = sin(angle);
cp = cos(angle); cp = cos(angle);
angle = angles[0] * 0.5f; angle = angles[0] * 0.5f;
sr = sin(angle); sr = sin(angle);
cr = cos(angle); cr = cos(angle);
quaternion[0] = sr*cp*cy-cr*sp*sy; // X quaternion[0] = sr*cp*cy-cr*sp*sy; // X
quaternion[1] = cr*sp*cy+sr*cp*sy; // Y quaternion[1] = cr*sp*cy+sr*cp*sy; // Y
quaternion[2] = cr*cp*sy-sr*sp*cy; // Z quaternion[2] = cr*cp*sy-sr*sp*cy; // Z
quaternion[3] = cr*cp*cy+sr*sp*sy; // W quaternion[3] = cr*cp*cy+sr*sp*sy; // W
} }
void QuaternionMatrix( const vec4_hl quaternion, f32 (*matrix)[4] ) void QuaternionMatrix( const vec4_hl quaternion, f32 (*matrix)[4] )
{ {
matrix[0][0] = 1.f - 2.f * quaternion[1] * quaternion[1] - 2.f * quaternion[2] * quaternion[2]; matrix[0][0] = 1.f - 2.f * quaternion[1] * quaternion[1] - 2.f * quaternion[2] * quaternion[2];
matrix[1][0] = 2.f * quaternion[0] * quaternion[1] + 2.f * quaternion[3] * quaternion[2]; matrix[1][0] = 2.f * quaternion[0] * quaternion[1] + 2.f * quaternion[3] * quaternion[2];
matrix[2][0] = 2.f * quaternion[0] * quaternion[2] - 2.f * quaternion[3] * quaternion[1]; matrix[2][0] = 2.f * quaternion[0] * quaternion[2] - 2.f * quaternion[3] * quaternion[1];
matrix[0][1] = 2.f * quaternion[0] * quaternion[1] - 2.f * quaternion[3] * quaternion[2]; matrix[0][1] = 2.f * quaternion[0] * quaternion[1] - 2.f * quaternion[3] * quaternion[2];
matrix[1][1] = 1.f - 2.f * quaternion[0] * quaternion[0] - 2.f * quaternion[2] * quaternion[2]; matrix[1][1] = 1.f - 2.f * quaternion[0] * quaternion[0] - 2.f * quaternion[2] * quaternion[2];
matrix[2][1] = 2.f * quaternion[1] * quaternion[2] + 2.f * quaternion[3] * quaternion[0]; matrix[2][1] = 2.f * quaternion[1] * quaternion[2] + 2.f * quaternion[3] * quaternion[0];
matrix[0][2] = 2.f * quaternion[0] * quaternion[2] + 2.f * quaternion[3] * quaternion[1]; matrix[0][2] = 2.f * quaternion[0] * quaternion[2] + 2.f * quaternion[3] * quaternion[1];
matrix[1][2] = 2.f * quaternion[1] * quaternion[2] - 2.f * quaternion[3] * quaternion[0]; matrix[1][2] = 2.f * quaternion[1] * quaternion[2] - 2.f * quaternion[3] * quaternion[0];
matrix[2][2] = 1.f - 2.f * quaternion[0] * quaternion[0] - 2.f * quaternion[1] * quaternion[1]; matrix[2][2] = 1.f - 2.f * quaternion[0] * quaternion[0] - 2.f * quaternion[1] * quaternion[1];
} }
void QuaternionSlerp( const vec4_hl p, vec4_hl q, f32 t, vec4_hl qt ) void QuaternionSlerp( const vec4_hl p, vec4_hl q, f32 t, vec4_hl qt )
{ {
s32 i; s32 i;
f32 omega, cosom, sinom, sclp, sclq; f32 omega, cosom, sinom, sclp, sclq;
// decide if one of the quaternions is backwards // decide if one of the quaternions is backwards
f32 a = 0; f32 a = 0;
f32 b = 0; f32 b = 0;
for (i = 0; i < 4; i++) { for (i = 0; i < 4; i++) {
a += (p[i]-q[i])*(p[i]-q[i]); a += (p[i]-q[i])*(p[i]-q[i]);
b += (p[i]+q[i])*(p[i]+q[i]); b += (p[i]+q[i])*(p[i]+q[i]);
} }
if (a > b) { if (a > b) {
for (i = 0; i < 4; i++) { for (i = 0; i < 4; i++) {
q[i] = -q[i]; q[i] = -q[i];
} }
} }
cosom = p[0]*q[0] + p[1]*q[1] + p[2]*q[2] + p[3]*q[3]; cosom = p[0]*q[0] + p[1]*q[1] + p[2]*q[2] + p[3]*q[3];
if ((1.f + cosom) > 0.00000001) { if ((1.f + cosom) > 0.00000001) {
if ((1.f - cosom) > 0.00000001) { if ((1.f - cosom) > 0.00000001) {
omega = acos( cosom ); omega = acos( cosom );
sinom = sin( omega ); sinom = sin( omega );
sclp = sin( (1.f - t)*omega) / sinom; sclp = sin( (1.f - t)*omega) / sinom;
sclq = sin( t*omega ) / sinom; sclq = sin( t*omega ) / sinom;
} }
else { else {
sclp = 1.f - t; sclp = 1.f - t;
sclq = t; sclq = t;
} }
for (i = 0; i < 4; i++) { for (i = 0; i < 4; i++) {
qt[i] = sclp * p[i] + sclq * q[i]; qt[i] = sclp * p[i] + sclq * q[i];
} }
} }
else { else {
qt[0] = -p[1]; qt[0] = -p[1];
qt[1] = p[0]; qt[1] = p[0];
qt[2] = -p[3]; qt[2] = -p[3];
qt[3] = p[2]; qt[3] = p[2];
sclp = sin( (1.f - t) * 0.5f * core::PI); sclp = sin( (1.f - t) * 0.5f * core::PI);
sclq = sin( t * 0.5f * core::PI); sclq = sin( t * 0.5f * core::PI);
for (i = 0; i < 3; i++) { for (i = 0; i < 3; i++) {
qt[i] = sclp * p[i] + sclq * qt[i]; qt[i] = sclp * p[i] + sclq * qt[i];
} }
} }
} }
void R_ConcatTransforms (const f32 in1[3][4], const f32 in2[3][4], f32 out[3][4]) void R_ConcatTransforms (const f32 in1[3][4], const f32 in2[3][4], f32 out[3][4])
{ {
out[0][0] = in1[0][0] * in2[0][0] + in1[0][1] * in2[1][0] + in1[0][2] * in2[2][0]; out[0][0] = in1[0][0] * in2[0][0] + in1[0][1] * in2[1][0] + in1[0][2] * in2[2][0];
out[0][1] = in1[0][0] * in2[0][1] + in1[0][1] * in2[1][1] + in1[0][2] * in2[2][1]; out[0][1] = in1[0][0] * in2[0][1] + in1[0][1] * in2[1][1] + in1[0][2] * in2[2][1];
out[0][2] = in1[0][0] * in2[0][2] + in1[0][1] * in2[1][2] + in1[0][2] * in2[2][2]; out[0][2] = in1[0][0] * in2[0][2] + in1[0][1] * in2[1][2] + in1[0][2] * in2[2][2];
out[0][3] = in1[0][0] * in2[0][3] + in1[0][1] * in2[1][3] + in1[0][2] * in2[2][3] + in1[0][3]; out[0][3] = in1[0][0] * in2[0][3] + in1[0][1] * in2[1][3] + in1[0][2] * in2[2][3] + in1[0][3];
out[1][0] = in1[1][0] * in2[0][0] + in1[1][1] * in2[1][0] + in1[1][2] * in2[2][0]; out[1][0] = in1[1][0] * in2[0][0] + in1[1][1] * in2[1][0] + in1[1][2] * in2[2][0];
out[1][1] = in1[1][0] * in2[0][1] + in1[1][1] * in2[1][1] + in1[1][2] * in2[2][1]; out[1][1] = in1[1][0] * in2[0][1] + in1[1][1] * in2[1][1] + in1[1][2] * in2[2][1];
out[1][2] = in1[1][0] * in2[0][2] + in1[1][1] * in2[1][2] + in1[1][2] * in2[2][2]; out[1][2] = in1[1][0] * in2[0][2] + in1[1][1] * in2[1][2] + in1[1][2] * in2[2][2];
out[1][3] = in1[1][0] * in2[0][3] + in1[1][1] * in2[1][3] + in1[1][2] * in2[2][3] + in1[1][3]; out[1][3] = in1[1][0] * in2[0][3] + in1[1][1] * in2[1][3] + in1[1][2] * in2[2][3] + in1[1][3];
out[2][0] = in1[2][0] * in2[0][0] + in1[2][1] * in2[1][0] + in1[2][2] * in2[2][0]; out[2][0] = in1[2][0] * in2[0][0] + in1[2][1] * in2[1][0] + in1[2][2] * in2[2][0];
out[2][1] = in1[2][0] * in2[0][1] + in1[2][1] * in2[1][1] + in1[2][2] * in2[2][1]; out[2][1] = in1[2][0] * in2[0][1] + in1[2][1] * in2[1][1] + in1[2][2] * in2[2][1];
out[2][2] = in1[2][0] * in2[0][2] + in1[2][1] * in2[1][2] + in1[2][2] * in2[2][2]; out[2][2] = in1[2][0] * in2[0][2] + in1[2][1] * in2[1][2] + in1[2][2] * in2[2][2];
out[2][3] = in1[2][0] * in2[0][3] + in1[2][1] * in2[1][3] + in1[2][2] * in2[2][3] + in1[2][3]; out[2][3] = in1[2][0] * in2[0][3] + in1[2][1] * in2[1][3] + in1[2][2] * in2[2][3] + in1[2][3];
} }
#define EQUAL_EPSILON 0.001 #define EQUAL_EPSILON 0.001
s32 VectorCompare (vec3_hl v1, vec3_hl v2) s32 VectorCompare (vec3_hl v1, vec3_hl v2)
{ {
s32 i; s32 i;
for (i=0 ; i<3 ; i++) for (i=0 ; i<3 ; i++)
if (fabs(v1[i]-v2[i]) > EQUAL_EPSILON) if (fabs(v1[i]-v2[i]) > EQUAL_EPSILON)
return false; return false;
return true; return true;
} }
#define DotProduct(x,y) ((x)[0]*(y)[0]+(x)[1]*(y)[1]+(x)[2]*(y)[2]) #define DotProduct(x,y) ((x)[0]*(y)[0]+(x)[1]*(y)[1]+(x)[2]*(y)[2])
inline void VectorTransform (const vec3_hl in1, const f32 in2[3][4], vec3_hl out) inline void VectorTransform (const vec3_hl in1, const f32 in2[3][4], vec3_hl out)
{ {
out[0] = DotProduct(in1, in2[0]) + in2[0][3]; out[0] = DotProduct(in1, in2[0]) + in2[0][3];
out[1] = DotProduct(in1, in2[1]) + in2[1][3]; out[1] = DotProduct(in1, in2[1]) + in2[1][3];
out[2] = DotProduct(in1, in2[2]) + in2[2][3]; out[2] = DotProduct(in1, in2[2]) + in2[2][3];
} }
inline void VectorTransform2 (core::vector3df &out, const vec3_hl in1, const f32 in2[3][4]) inline void VectorTransform2 (core::vector3df &out, const vec3_hl in1, const f32 in2[3][4])
{ {
out.X = DotProduct(in1, in2[0]) + in2[0][3]; out.X = DotProduct(in1, in2[0]) + in2[0][3];
out.Z = DotProduct(in1, in2[1]) + in2[1][3]; out.Z = DotProduct(in1, in2[1]) + in2[1][3];
out.Y = DotProduct(in1, in2[2]) + in2[2][3]; out.Y = DotProduct(in1, in2[2]) + in2[2][3];
} }
static f32 BoneTransform[MAXSTUDIOBONES][3][4]; // bone transformation matrix static f32 BoneTransform[MAXSTUDIOBONES][3][4]; // bone transformation matrix
void getBoneVector ( core::vector3df &out, u32 index ) void getBoneVector ( core::vector3df &out, u32 index )
{ {
out.X = BoneTransform[index][0][3]; out.X = BoneTransform[index][0][3];
out.Z = BoneTransform[index][1][3]; out.Z = BoneTransform[index][1][3];
out.Y = BoneTransform[index][2][3]; out.Y = BoneTransform[index][2][3];
} }
void getBoneBox ( core::aabbox3df &box, u32 index, f32 size = 0.5f ) void getBoneBox ( core::aabbox3df &box, u32 index, f32 size = 0.5f )
{ {
box.MinEdge.X = BoneTransform[index][0][3] - size; box.MinEdge.X = BoneTransform[index][0][3] - size;
box.MinEdge.Z = BoneTransform[index][1][3] - size; box.MinEdge.Z = BoneTransform[index][1][3] - size;
box.MinEdge.Y = BoneTransform[index][2][3] - size; box.MinEdge.Y = BoneTransform[index][2][3] - size;
size *= 2.f; size *= 2.f;
box.MaxEdge.X = box.MinEdge.X + size; box.MaxEdge.X = box.MinEdge.X + size;
box.MaxEdge.Y = box.MinEdge.Y + size; box.MaxEdge.Y = box.MinEdge.Y + size;
box.MaxEdge.Z = box.MinEdge.Z + size; box.MaxEdge.Z = box.MinEdge.Z + size;
} }
void getTransformedBoneVector ( core::vector3df &out, u32 index, const vec3_hl in) void getTransformedBoneVector ( core::vector3df &out, u32 index, const vec3_hl in)
{ {
out.X = DotProduct(in, BoneTransform[index][0]) + BoneTransform[index][0][3]; out.X = DotProduct(in, BoneTransform[index][0]) + BoneTransform[index][0][3];
out.Z = DotProduct(in, BoneTransform[index][1]) + BoneTransform[index][1][3]; out.Z = DotProduct(in, BoneTransform[index][1]) + BoneTransform[index][1][3];
out.Y = DotProduct(in, BoneTransform[index][2]) + BoneTransform[index][2][3]; out.Y = DotProduct(in, BoneTransform[index][2]) + BoneTransform[index][2][3];
} }
//! Constructor //! Constructor
...@@ -284,9 +284,9 @@ void CAnimatedMeshHalfLife::setDirty(E_BUFFER_TYPE buffer) ...@@ -284,9 +284,9 @@ void CAnimatedMeshHalfLife::setDirty(E_BUFFER_TYPE buffer)
static vec3_hl TransformedVerts[MAXSTUDIOVERTS]; // transformed vertices static vec3_hl TransformedVerts[MAXSTUDIOVERTS]; // transformed vertices
static vec3_hl TransformedNormals[MAXSTUDIOVERTS]; // light surface normals static vec3_hl TransformedNormals[MAXSTUDIOVERTS]; // light surface normals
/*! /*!
*/ */
...@@ -296,67 +296,67 @@ void CAnimatedMeshHalfLife::initModel () ...@@ -296,67 +296,67 @@ void CAnimatedMeshHalfLife::initModel ()
KeyFrameInterpolation ipol; KeyFrameInterpolation ipol;
ipol.Name.reserve ( 64 ); ipol.Name.reserve ( 64 );
u32 i; u32 i;
AnimList.clear(); AnimList.clear();
FrameCount = 0; FrameCount = 0;
SHalflifeSequence *seq = (SHalflifeSequence*) ((u8*) Header + Header->seqindex); SHalflifeSequence *seq = (SHalflifeSequence*) ((u8*) Header + Header->seqindex);
for ( i = 0; i < Header->numseq; i++) for ( i = 0; i < Header->numseq; i++)
{ {
ipol.Name = seq[i].label; ipol.Name = seq[i].label;
ipol.StartFrame = FrameCount; ipol.StartFrame = FrameCount;
ipol.Frames = core::max_ ( 1, seq[i].numframes - 1 ); ipol.Frames = core::max_ ( 1, seq[i].numframes - 1 );
ipol.EndFrame = ipol.StartFrame + ipol.Frames - 1; ipol.EndFrame = ipol.StartFrame + ipol.Frames - 1;
ipol.FramesPerSecond = seq[i].fps; ipol.FramesPerSecond = seq[i].fps;
ipol.AnimationType = seq[i].flags & STUDIO_LOOPING ? EAMT_LOOPING : EAMT_WAYPOINT; ipol.AnimationType = seq[i].flags & STUDIO_LOOPING ? EAMT_LOOPING : EAMT_WAYPOINT;
AnimList.push_back ( ipol ); AnimList.push_back ( ipol );
FrameCount += ipol.Frames; FrameCount += ipol.Frames;
} }
// initBoneControllers // initBoneControllers
/* /*
SHalflifeBoneController *bonecontroller = (SHalflifeBoneController *)((u8*) Header + Header->bonecontrollerindex); SHalflifeBoneController *bonecontroller = (SHalflifeBoneController *)((u8*) Header + Header->bonecontrollerindex);
for ( i = 0; i < Header->numbonecontrollers; i++) for ( i = 0; i < Header->numbonecontrollers; i++)
{ {
printf ( "BoneController%d index:%d%s range:%f - %f\n", printf ( "BoneController%d index:%d%s range:%f - %f\n",
i, i,
bonecontroller[i].index, bonecontroller[i].index == MOUTH_CONTROLLER ? " (Mouth)": "", bonecontroller[i].index, bonecontroller[i].index == MOUTH_CONTROLLER ? " (Mouth)": "",
bonecontroller[i].start,bonecontroller[i].end bonecontroller[i].start,bonecontroller[i].end
); );
} }
// initSkins // initSkins
for (i = 0; i < TextureHeader->numskinfamilies; i++) for (i = 0; i < TextureHeader->numskinfamilies; i++)
{ {
printf ( "Skin%d\n", i + 1); printf ( "Skin%d\n", i + 1);
} }
*/ */
// initBodyparts // initBodyparts
u32 meshBuffer = 0; u32 meshBuffer = 0;
BodyList.clear(); BodyList.clear();
SHalflifeBody *body = (SHalflifeBody *) ((u8*) Header + Header->bodypartindex); SHalflifeBody *body = (SHalflifeBody *) ((u8*) Header + Header->bodypartindex);
for ( i = 0; i < Header->numbodyparts; ++i) for ( i = 0; i < Header->numbodyparts; ++i)
{ {
BodyPart part; BodyPart part;
part.name = body[i].name; part.name = body[i].name;
part.defaultModel = core::max_ ( 0, (s32) body[i].base - 1 ); part.defaultModel = core::max_ ( 0, (s32) body[i].base - 1 );
SHalflifeModel * model = (SHalflifeModel *)((u8*) Header + body[i].modelindex); SHalflifeModel * model = (SHalflifeModel *)((u8*) Header + body[i].modelindex);
for ( u32 g = 0; g < body[i].nummodels; ++g) for ( u32 g = 0; g < body[i].nummodels; ++g)
{ {
SubModel sub; SubModel sub;
sub.name = model[g].name; sub.name = model[g].name;
sub.startBuffer = meshBuffer; sub.startBuffer = meshBuffer;
sub.endBuffer = sub.startBuffer + model[g].nummesh; sub.endBuffer = sub.startBuffer + model[g].nummesh;
sub.state = g == part.defaultModel; sub.state = g == part.defaultModel;
part.model.push_back ( sub ); part.model.push_back ( sub );
meshBuffer += model[g].nummesh; meshBuffer += model[g].nummesh;
} }
BodyList.push_back ( part ); BodyList.push_back ( part );
} }
SequenceIndex = 0; SequenceIndex = 0;
CurrentFrame = 0.f; CurrentFrame = 0.f;
...@@ -367,293 +367,293 @@ void CAnimatedMeshHalfLife::initModel () ...@@ -367,293 +367,293 @@ void CAnimatedMeshHalfLife::initModel ()
SetController (MOUTH_CONTROLLER, 0.f); SetController (MOUTH_CONTROLLER, 0.f);
SetSkin (0); SetSkin (0);
// init Meshbuffers // init Meshbuffers
io::path store; io::path store;
const SHalflifeTexture *tex = (SHalflifeTexture *) ((u8*) TextureHeader + TextureHeader->textureindex); const SHalflifeTexture *tex = (SHalflifeTexture *) ((u8*) TextureHeader + TextureHeader->textureindex);
const u16 *skinref = (u16 *)((u8*)TextureHeader + TextureHeader->skinindex); const u16 *skinref = (u16 *)((u8*)TextureHeader + TextureHeader->skinindex);
if (SkinGroupSelection != 0 && SkinGroupSelection < TextureHeader->numskinfamilies) if (SkinGroupSelection != 0 && SkinGroupSelection < TextureHeader->numskinfamilies)
skinref += (SkinGroupSelection * TextureHeader->numskinref); skinref += (SkinGroupSelection * TextureHeader->numskinref);
io::path fname; io::path fname;
io::path ext; io::path ext;
core::vector2df tex_scale; core::vector2df tex_scale;
core::vector2di tex_trans ( 0, 0 ); core::vector2di tex_trans ( 0, 0 );
#ifdef HL_TEXTURE_ATLAS #ifdef HL_TEXTURE_ATLAS
TextureAtlas.getScale ( tex_scale ); TextureAtlas.getScale ( tex_scale );
#endif #endif
for ( u32 bodypart=0 ; bodypart < Header->numbodyparts ; ++bodypart) for ( u32 bodypart=0 ; bodypart < Header->numbodyparts ; ++bodypart)
{ {
const SHalflifeBody *body = (SHalflifeBody *)((u8*) Header + Header->bodypartindex) + bodypart; const SHalflifeBody *body = (SHalflifeBody *)((u8*) Header + Header->bodypartindex) + bodypart;
for ( u32 modelnr = 0; modelnr < body->nummodels; ++modelnr ) for ( u32 modelnr = 0; modelnr < body->nummodels; ++modelnr )
{ {
const SHalflifeModel *model = (SHalflifeModel *)((u8*) Header + body->modelindex) + modelnr; const SHalflifeModel *model = (SHalflifeModel *)((u8*) Header + body->modelindex) + modelnr;
#if 0
const vec3_hl *studioverts = (vec3_hl *)((u8*)Header + model->vertindex); const vec3_hl *studioverts = (vec3_hl *)((u8*)Header + model->vertindex);
const vec3_hl *studionorms = (vec3_hl *)((u8*)Header + model->normindex); const vec3_hl *studionorms = (vec3_hl *)((u8*)Header + model->normindex);
#endif
for (i = 0; i < model->nummesh; ++i) for (i = 0; i < model->nummesh; ++i)
{ {
const SHalflifeMesh *mesh = (SHalflifeMesh *)((u8*)Header + model->meshindex) + i; const SHalflifeMesh *mesh = (SHalflifeMesh *)((u8*)Header + model->meshindex) + i;
const SHalflifeTexture *currentex = &tex[skinref[mesh->skinref]]; const SHalflifeTexture *currentex = &tex[skinref[mesh->skinref]];
#ifdef HL_TEXTURE_ATLAS #ifdef HL_TEXTURE_ATLAS
TextureAtlas.getTranslation ( currentex->name, tex_trans ); TextureAtlas.getTranslation ( currentex->name, tex_trans );
#else #else
tex_scale.X = 1.f/(f32)currentex->width; tex_scale.X = 1.f/(f32)currentex->width;
tex_scale.Y = 1.f/(f32)currentex->height; tex_scale.Y = 1.f/(f32)currentex->height;
#endif #endif
SMeshBuffer * buffer = new SMeshBuffer(); SMeshBuffer * buffer = new SMeshBuffer();
// count index vertex size indexcount = mesh->numtris * 3 // count index vertex size indexcount = mesh->numtris * 3
u32 indexCount = 0; u32 indexCount = 0;
u32 vertexCount = 0; u32 vertexCount = 0;
const s16 *tricmd = (s16*)((u8*)Header + mesh->triindex); const s16 *tricmd = (s16*)((u8*)Header + mesh->triindex);
s32 c; s32 c;
while (c = *(tricmd++)) while ( (c = *(tricmd++)) )
{ {
if (c < 0) if (c < 0)
c = -c; c = -c;
indexCount += ( c - 2 ) * 3; indexCount += ( c - 2 ) * 3;
vertexCount += c; vertexCount += c;
tricmd += ( 4 * c ); tricmd += ( 4 * c );
} }
// indices // indices
buffer->Indices.set_used ( indexCount ); buffer->Indices.set_used ( indexCount );
buffer->Vertices.set_used ( vertexCount ); buffer->Vertices.set_used ( vertexCount );
// fill in static indices and vertex // fill in static indices and vertex
u16 *index = buffer->Indices.pointer(); u16 *index = buffer->Indices.pointer();
video::S3DVertex * v = buffer->Vertices.pointer(); video::S3DVertex * v = buffer->Vertices.pointer();
// blow up gl_triangle_fan/gl_triangle_strip to indexed triangle list // blow up gl_triangle_fan/gl_triangle_strip to indexed triangle list
E_PRIMITIVE_TYPE type; E_PRIMITIVE_TYPE type;
vertexCount = 0; vertexCount = 0;
indexCount = 0; indexCount = 0;
tricmd = (s16*)((u8*)Header + mesh->triindex); tricmd = (s16*)((u8*)Header + mesh->triindex);
while (c = *(tricmd++)) while ( (c = *(tricmd++)) )
{ {
if (c < 0) if (c < 0)
{ {
// triangle fan // triangle fan
c = -c; c = -c;
type = EPT_TRIANGLE_FAN; type = EPT_TRIANGLE_FAN;
} }
else else
{ {
type = EPT_TRIANGLE_STRIP; type = EPT_TRIANGLE_STRIP;
} }
for ( s32 g = 0; g < c; ++g, v += 1, tricmd += 4 ) for ( s32 g = 0; g < c; ++g, v += 1, tricmd += 4 )
{ {
// fill vertex // fill vertex
#if 0 #if 0
const f32 *av = studioverts[tricmd[0]]; const f32 *av = studioverts[tricmd[0]];
v->Pos.X = av[0]; v->Pos.X = av[0];
v->Pos.Z = av[1]; v->Pos.Z = av[1];
v->Pos.Y = av[2]; v->Pos.Y = av[2];
av = studionorms[tricmd[1]]; av = studionorms[tricmd[1]];
v->Normal.X = av[0]; v->Normal.X = av[0];
v->Normal.Z = av[1]; v->Normal.Z = av[1];
v->Normal.Y = av[2]; v->Normal.Y = av[2];
#endif #endif
v->Normal.X = 0.f; v->Normal.X = 0.f;
v->Normal.Z = 0.f; v->Normal.Z = 0.f;
v->Normal.Y = 1.f; v->Normal.Y = 1.f;
v->TCoords.X = (tex_trans.X + tricmd[2])*tex_scale.X; v->TCoords.X = (tex_trans.X + tricmd[2])*tex_scale.X;
v->TCoords.Y = (tex_trans.Y + tricmd[3])*tex_scale.Y; v->TCoords.Y = (tex_trans.Y + tricmd[3])*tex_scale.Y;
v->Color.color = 0xFFFFFFFF; v->Color.color = 0xFFFFFFFF;
// fill index // fill index
if ( g < c - 2 ) if ( g < c - 2 )
{ {
if ( type == EPT_TRIANGLE_FAN ) if ( type == EPT_TRIANGLE_FAN )
{ {
index[indexCount+0] = vertexCount; index[indexCount+0] = vertexCount;
index[indexCount+1] = vertexCount+g+1; index[indexCount+1] = vertexCount+g+1;
index[indexCount+2] = vertexCount+g+2; index[indexCount+2] = vertexCount+g+2;
} }
else else
{ {
if ( g & 1 ) if ( g & 1 )
{ {
index[indexCount+0] = vertexCount+g+1; index[indexCount+0] = vertexCount+g+1;
index[indexCount+1] = vertexCount+g+0; index[indexCount+1] = vertexCount+g+0;
index[indexCount+2] = vertexCount+g+2; index[indexCount+2] = vertexCount+g+2;
} }
else else
{ {
index[indexCount+0] = vertexCount+g+0; index[indexCount+0] = vertexCount+g+0;
index[indexCount+1] = vertexCount+g+1; index[indexCount+1] = vertexCount+g+1;
index[indexCount+2] = vertexCount+g+2; index[indexCount+2] = vertexCount+g+2;
} }
} }
indexCount += 3; indexCount += 3;
} }
} }
vertexCount += c; vertexCount += c;
} }
// material // material
video::SMaterial &m = buffer->getMaterial(); video::SMaterial &m = buffer->getMaterial();
m.MaterialType = video::EMT_SOLID; m.MaterialType = video::EMT_SOLID;
m.BackfaceCulling = true; m.BackfaceCulling = true;
if ( currentex->flags & STUDIO_NF_CHROME ) if ( currentex->flags & STUDIO_NF_CHROME )
{ {
// don't know what to do with chrome here // don't know what to do with chrome here
} }
#ifdef HL_TEXTURE_ATLAS #ifdef HL_TEXTURE_ATLAS
store = TextureBaseName + "atlas"; store = TextureBaseName + "atlas";
#else #else
core::splitFilename ( currentex->name, 0, &fname, &ext ); core::splitFilename ( currentex->name, 0, &fname, &ext );
store = TextureBaseName + fname; store = TextureBaseName + fname;
#endif #endif
m.TextureLayer[0].Texture = SceneManager->getVideoDriver()->getTexture ( store ); m.TextureLayer[0].Texture = SceneManager->getVideoDriver()->getTexture ( store );
m.Lighting = false; m.Lighting = false;
MeshIPol.addMeshBuffer ( buffer ); MeshIPol.addMeshBuffer ( buffer );
buffer->drop (); buffer->drop ();
} // mesh } // mesh
} // model } // model
} // body part } // body part
} }
/*! /*!
*/ */
void CAnimatedMeshHalfLife::buildVertices () void CAnimatedMeshHalfLife::buildVertices ()
{ {
/* /*
const u16 *skinref = (u16 *)((u8*)TextureHeader + TextureHeader->skinindex); const u16 *skinref = (u16 *)((u8*)TextureHeader + TextureHeader->skinindex);
if (SkinGroupSelection != 0 && SkinGroupSelection < TextureHeader->numskinfamilies) if (SkinGroupSelection != 0 && SkinGroupSelection < TextureHeader->numskinfamilies)
skinref += (SkinGroupSelection * TextureHeader->numskinref); skinref += (SkinGroupSelection * TextureHeader->numskinref);
*/ */
u32 i; u32 i;
s32 c,g; s32 c,g;
const s16 *tricmd; const s16 *tricmd;
u32 meshBufferNr = 0; u32 meshBufferNr = 0;
for ( u32 bodypart = 0 ; bodypart < Header->numbodyparts; ++bodypart) for ( u32 bodypart = 0 ; bodypart < Header->numbodyparts; ++bodypart)
{ {
const SHalflifeBody *body = (SHalflifeBody *)((u8*) Header + Header->bodypartindex) + bodypart; const SHalflifeBody *body = (SHalflifeBody *)((u8*) Header + Header->bodypartindex) + bodypart;
for ( u32 modelnr = 0; modelnr < body->nummodels; ++modelnr ) for ( u32 modelnr = 0; modelnr < body->nummodels; ++modelnr )
{ {
const SHalflifeModel *model = (SHalflifeModel *)((u8*) Header + body->modelindex) + modelnr; const SHalflifeModel *model = (SHalflifeModel *)((u8*) Header + body->modelindex) + modelnr;
const u8 *vertbone = ((u8*)Header + model->vertinfoindex); const u8 *vertbone = ((u8*)Header + model->vertinfoindex);
const u8 *normbone = ((u8*)Header + model->norminfoindex); const u8 *normbone = ((u8*)Header + model->norminfoindex);
const vec3_hl *studioverts = (vec3_hl *)((u8*)Header + model->vertindex); const vec3_hl *studioverts = (vec3_hl *)((u8*)Header + model->vertindex);
const vec3_hl *studionorms = (vec3_hl *)((u8*)Header + model->normindex); const vec3_hl *studionorms = (vec3_hl *)((u8*)Header + model->normindex);
for ( i = 0; i < model->numverts; i++) for ( i = 0; i < model->numverts; i++)
{ {
VectorTransform ( studioverts[i], BoneTransform[vertbone[i]], TransformedVerts[i] ); VectorTransform ( studioverts[i], BoneTransform[vertbone[i]], TransformedVerts[i] );
} }
/* /*
for ( i = 0; i < model->numnorms; i++) for ( i = 0; i < model->numnorms; i++)
{ {
VectorTransform ( studionorms[i], BoneTransform[normbone[i]], TransformedNormals[i] ); VectorTransform ( studionorms[i], BoneTransform[normbone[i]], TransformedNormals[i] );
} }
*/ */
for (i = 0; i < model->nummesh; i++) for (i = 0; i < model->nummesh; i++)
{ {
const SHalflifeMesh *mesh = (SHalflifeMesh *)((u8*)Header + model->meshindex) + i; const SHalflifeMesh *mesh = (SHalflifeMesh *)((u8*)Header + model->meshindex) + i;
IMeshBuffer * buffer = MeshIPol.getMeshBuffer ( meshBufferNr++ ); IMeshBuffer * buffer = MeshIPol.getMeshBuffer ( meshBufferNr++ );
video::S3DVertex* v = (video::S3DVertex* ) buffer->getVertices(); video::S3DVertex* v = (video::S3DVertex* ) buffer->getVertices();
tricmd = (s16*)((u8*)Header + mesh->triindex); tricmd = (s16*)((u8*)Header + mesh->triindex);
while (c = *(tricmd++)) while ( (c = *(tricmd++)) )
{ {
if (c < 0) if (c < 0)
c = -c; c = -c;
for ( g = 0; g < c; ++g, v += 1, tricmd += 4 ) for ( g = 0; g < c; ++g, v += 1, tricmd += 4 )
{ {
// fill vertex // fill vertex
const f32 *av = TransformedVerts[tricmd[0]]; const f32 *av = TransformedVerts[tricmd[0]];
v->Pos.X = av[0]; v->Pos.X = av[0];
v->Pos.Z = av[1]; v->Pos.Z = av[1];
v->Pos.Y = av[2]; v->Pos.Y = av[2];
/* /*
av = TransformedNormals[tricmd[1]]; av = TransformedNormals[tricmd[1]];
v->Normal.X = av[0]; v->Normal.X = av[0];
v->Normal.Z = av[1]; v->Normal.Z = av[1];
v->Normal.Y = av[2]; v->Normal.Y = av[2];
//v->Normal.normalize(); //v->Normal.normalize();
*/ */
} }
} // tricmd } // tricmd
} // nummesh } // nummesh
} // model } // model
} // bodypart } // bodypart
} }
/*! /*!
render Bones render Bones
*/ */
void CAnimatedMeshHalfLife::renderModel ( u32 param, IVideoDriver * driver, const core::matrix4 &absoluteTransformation) void CAnimatedMeshHalfLife::renderModel ( u32 param, IVideoDriver * driver, const core::matrix4 &absoluteTransformation)
{ {
SHalflifeBone *bone = (SHalflifeBone *) ((u8 *) Header + Header->boneindex); SHalflifeBone *bone = (SHalflifeBone *) ((u8 *) Header + Header->boneindex);
video::SColor blue ( 0xFF000080 ); video::SColor blue ( 0xFF000080 );
video::SColor red ( 0xFF800000 ); video::SColor red ( 0xFF800000 );
video::SColor yellow ( 0xFF808000 ); video::SColor yellow ( 0xFF808000 );
video::SColor cyan ( 0xFF008080 ); video::SColor cyan ( 0xFF008080 );
core::aabbox3df box; core::aabbox3df box;
u32 i; u32 i;
for ( i = 0; i < Header->numbones; i++) for ( i = 0; i < Header->numbones; i++)
{ {
if (bone[i].parent >= 0) if (bone[i].parent >= 0)
{ {
getBoneVector ( box.MinEdge, bone[i].parent ); getBoneVector ( box.MinEdge, bone[i].parent );
getBoneVector ( box.MaxEdge, i ); getBoneVector ( box.MaxEdge, i );
driver->draw3DLine ( box.MinEdge, box.MaxEdge, blue ); driver->draw3DLine ( box.MinEdge, box.MaxEdge, blue );
// draw parent bone node // draw parent bone node
if (bone[bone[i].parent].parent >=0 ) if (bone[bone[i].parent].parent >=0 )
{ {
getBoneBox ( box, bone[i].parent ); getBoneBox ( box, bone[i].parent );
driver->draw3DBox ( box, blue ); driver->draw3DBox ( box, blue );
} }
getBoneBox ( box, i ); getBoneBox ( box, i );
driver->draw3DBox ( box, blue ); driver->draw3DBox ( box, blue );
} }
else else
{ {
// draw parent bone node // draw parent bone node
getBoneBox ( box, i, 1.f ); getBoneBox ( box, i, 1.f );
driver->draw3DBox ( box , red ); driver->draw3DBox ( box , red );
} }
} }
// attachements // attachements
SHalfelifeAttachment *attach = (SHalfelifeAttachment *) ((u8*) Header + Header->attachmentindex); SHalfelifeAttachment *attach = (SHalfelifeAttachment *) ((u8*) Header + Header->attachmentindex);
core::vector3df v[8]; core::vector3df v[8];
for ( i = 0; i < Header->numattachments; i++) for ( i = 0; i < Header->numattachments; i++)
...@@ -668,48 +668,48 @@ void CAnimatedMeshHalfLife::renderModel ( u32 param, IVideoDriver * driver, con ...@@ -668,48 +668,48 @@ void CAnimatedMeshHalfLife::renderModel ( u32 param, IVideoDriver * driver, con
} }
// hit boxes // hit boxes
SHalflifeBBox *hitbox = (SHalflifeBBox *) ((u8*) Header + Header->hitboxindex); SHalflifeBBox *hitbox = (SHalflifeBBox *) ((u8*) Header + Header->hitboxindex);
f32 *bbmin,*bbmax; f32 *bbmin,*bbmax;
vec3_hl v2[8]; vec3_hl v2[8];
for (i = 0; i < Header->numhitboxes; i++) for (i = 0; i < Header->numhitboxes; i++)
{ {
bbmin = hitbox[i].bbmin; bbmin = hitbox[i].bbmin;
bbmax = hitbox[i].bbmax; bbmax = hitbox[i].bbmax;
v2[0][0] = bbmin[0]; v2[0][0] = bbmin[0];
v2[0][1] = bbmax[1]; v2[0][1] = bbmax[1];
v2[0][2] = bbmin[2]; v2[0][2] = bbmin[2];
v2[1][0] = bbmin[0]; v2[1][0] = bbmin[0];
v2[1][1] = bbmin[1]; v2[1][1] = bbmin[1];
v2[1][2] = bbmin[2]; v2[1][2] = bbmin[2];
v2[2][0] = bbmax[0]; v2[2][0] = bbmax[0];
v2[2][1] = bbmax[1]; v2[2][1] = bbmax[1];
v2[2][2] = bbmin[2]; v2[2][2] = bbmin[2];
v2[3][0] = bbmax[0]; v2[3][0] = bbmax[0];
v2[3][1] = bbmin[1]; v2[3][1] = bbmin[1];
v2[3][2] = bbmin[2]; v2[3][2] = bbmin[2];
v2[4][0] = bbmax[0]; v2[4][0] = bbmax[0];
v2[4][1] = bbmax[1]; v2[4][1] = bbmax[1];
v2[4][2] = bbmax[2]; v2[4][2] = bbmax[2];
v2[5][0] = bbmax[0]; v2[5][0] = bbmax[0];
v2[5][1] = bbmin[1]; v2[5][1] = bbmin[1];
v2[5][2] = bbmax[2]; v2[5][2] = bbmax[2];
v2[6][0] = bbmin[0]; v2[6][0] = bbmin[0];
v2[6][1] = bbmax[1]; v2[6][1] = bbmax[1];
v2[6][2] = bbmax[2]; v2[6][2] = bbmax[2];
v2[7][0] = bbmin[0]; v2[7][0] = bbmin[0];
v2[7][1] = bbmin[1]; v2[7][1] = bbmin[1];
v2[7][2] = bbmax[2]; v2[7][2] = bbmax[2];
for ( u32 g = 0; g < 8; ++g ) for ( u32 g = 0; g < 8; ++g )
getTransformedBoneVector ( v[g],hitbox[i].bone,v2[g] ); getTransformedBoneVector ( v[g],hitbox[i].bone,v2[g] );
driver->draw3DLine(v[0], v[1], yellow); driver->draw3DLine(v[0], v[1], yellow);
...@@ -727,7 +727,7 @@ void CAnimatedMeshHalfLife::renderModel ( u32 param, IVideoDriver * driver, con ...@@ -727,7 +727,7 @@ void CAnimatedMeshHalfLife::renderModel ( u32 param, IVideoDriver * driver, con
driver->draw3DLine(v[3], v[5], yellow); driver->draw3DLine(v[3], v[5], yellow);
driver->draw3DLine(v[2], v[4], yellow); driver->draw3DLine(v[2], v[4], yellow);
} }
} }
//! Returns the animated mesh based on a detail level. 0 is the lowest, 255 the highest detail. //! Returns the animated mesh based on a detail level. 0 is the lowest, 255 the highest detail.
IMesh* CAnimatedMeshHalfLife::getMesh(s32 frameInt, s32 detailLevel, s32 startFrameLoop, s32 endFrameLoop) IMesh* CAnimatedMeshHalfLife::getMesh(s32 frameInt, s32 detailLevel, s32 startFrameLoop, s32 endFrameLoop)
...@@ -738,35 +738,35 @@ IMesh* CAnimatedMeshHalfLife::getMesh(s32 frameInt, s32 detailLevel, s32 startFr ...@@ -738,35 +738,35 @@ IMesh* CAnimatedMeshHalfLife::getMesh(s32 frameInt, s32 detailLevel, s32 startFr
u32 i; u32 i;
SHalflifeSequence *seq = (SHalflifeSequence*) ((u8*) Header + Header->seqindex); SHalflifeSequence *seq = (SHalflifeSequence*) ((u8*) Header + Header->seqindex);
// find SequenceIndex from summed list // find SequenceIndex from summed list
u32 frameCount = 0; u32 frameCount = 0;
for ( i = 0; i < Header->numseq; i++) for ( i = 0; i < Header->numseq; i++)
{ {
u32 val = core::max_ ( 1, seq[i].numframes - 1 ); u32 val = core::max_ ( 1, seq[i].numframes - 1 );
if ( frameCount + val > frameA ) if ( frameCount + val > frameA )
{ {
SequenceIndex = i; SequenceIndex = i;
CurrentFrame = frame - frameCount; CurrentFrame = frame - frameCount;
break; break;
} }
frameCount += val; frameCount += val;
} }
seq += SequenceIndex; seq += SequenceIndex;
//SetBodyPart ( 1, 1 ); //SetBodyPart ( 1, 1 );
setUpBones (); setUpBones ();
buildVertices(); buildVertices();
MeshIPol.BoundingBox.MinEdge.X = seq->bbmin[0]; MeshIPol.BoundingBox.MinEdge.X = seq->bbmin[0];
MeshIPol.BoundingBox.MinEdge.Z = seq->bbmin[1]; MeshIPol.BoundingBox.MinEdge.Z = seq->bbmin[1];
MeshIPol.BoundingBox.MinEdge.Y = seq->bbmin[2]; MeshIPol.BoundingBox.MinEdge.Y = seq->bbmin[2];
MeshIPol.BoundingBox.MaxEdge.X = seq->bbmax[0]; MeshIPol.BoundingBox.MaxEdge.X = seq->bbmax[0];
MeshIPol.BoundingBox.MaxEdge.Z = seq->bbmax[1]; MeshIPol.BoundingBox.MaxEdge.Z = seq->bbmax[1];
MeshIPol.BoundingBox.MaxEdge.Y = seq->bbmax[2]; MeshIPol.BoundingBox.MaxEdge.Y = seq->bbmax[2];
return &MeshIPol; return &MeshIPol;
} }
...@@ -777,33 +777,33 @@ void CAnimatedMeshHalfLife::initData () ...@@ -777,33 +777,33 @@ void CAnimatedMeshHalfLife::initData ()
{ {
u32 i; u32 i;
Header = 0; Header = 0;
TextureHeader = 0; TextureHeader = 0;
OwnTexModel = false; OwnTexModel = false;
for ( i = 0; i < 32; ++i ) for ( i = 0; i < 32; ++i )
AnimationHeader[i] = 0; AnimationHeader[i] = 0;
SequenceIndex = 0; SequenceIndex = 0;
CurrentFrame = 0.f; CurrentFrame = 0.f;
for ( i = 0; i < 5; ++i ) for ( i = 0; i < 5; ++i )
BoneController[i] = 0; BoneController[i] = 0;
for ( i = 0; i < 2; ++i ) for ( i = 0; i < 2; ++i )
Blending[i] = 0; Blending[i] = 0;
SkinGroupSelection = 0; SkinGroupSelection = 0;
AnimList.clear(); AnimList.clear();
FrameCount = 0; FrameCount = 0;
MeshIPol.clear(); MeshIPol.clear();
#ifdef HL_TEXTURE_ATLAS #ifdef HL_TEXTURE_ATLAS
TextureAtlas.release(); TextureAtlas.release();
#endif #endif
} }
/*! /*!
*/ */
...@@ -813,8 +813,8 @@ void CAnimatedMeshHalfLife::freeModel () ...@@ -813,8 +813,8 @@ void CAnimatedMeshHalfLife::freeModel ()
if (OwnTexModel ) if (OwnTexModel )
delete [] (u8*) TextureHeader; delete [] (u8*) TextureHeader;
for ( u32 i = 0; i < 32; ++i ) for ( u32 i = 0; i < 32; ++i )
delete [] (u8*) AnimationHeader[i]; delete [] (u8*) AnimationHeader[i];
} }
...@@ -1237,148 +1237,148 @@ bool CAnimatedMeshHalfLife::postLoadModel( const io::path &filename ) ...@@ -1237,148 +1237,148 @@ bool CAnimatedMeshHalfLife::postLoadModel( const io::path &filename )
/*! /*!
*/ */
void CAnimatedMeshHalfLife::dumpModelInfo ( u32 level ) void CAnimatedMeshHalfLife::dumpModelInfo ( u32 level )
{ {
u8 *phdr = (u8*) Header; u8 *phdr = (u8*) Header;
SHalflifeHeader * hdr = Header; SHalflifeHeader * hdr = Header;
u32 i; u32 i;
if ( level == 0 ) if ( level == 0 )
{ {
printf ( printf (
"Bones: %d\n" "Bones: %d\n"
"Bone Controllers: %d\n" "Bone Controllers: %d\n"
"Hit Boxes: %d\n" "Hit Boxes: %d\n"
"Sequences: %d\n" "Sequences: %d\n"
"Sequence Groups: %d\n", "Sequence Groups: %d\n",
hdr->numbones, hdr->numbones,
hdr->numbonecontrollers, hdr->numbonecontrollers,
hdr->numhitboxes, hdr->numhitboxes,
hdr->numseq, hdr->numseq,
hdr->numseqgroups hdr->numseqgroups
); );
printf ( printf (
"Textures: %d\n" "Textures: %d\n"
"Skin Families: %d\n" "Skin Families: %d\n"
"Bodyparts: %d\n" "Bodyparts: %d\n"
"Attachments: %d\n" "Attachments: %d\n"
"Transitions: %d\n", "Transitions: %d\n",
hdr->numtextures, hdr->numtextures,
hdr->numskinfamilies, hdr->numskinfamilies,
hdr->numbodyparts, hdr->numbodyparts,
hdr->numattachments, hdr->numattachments,
hdr->numtransitions); hdr->numtransitions);
return; return;
} }
printf("id: %c%c%c%c\n", phdr[0], phdr[1], phdr[2], phdr[3]); printf("id: %c%c%c%c\n", phdr[0], phdr[1], phdr[2], phdr[3]);
printf("version: %d\n", hdr->version); printf("version: %d\n", hdr->version);
printf("name: \"%s\"\n", hdr->name); printf("name: \"%s\"\n", hdr->name);
printf("length: %d\n\n", hdr->length); printf("length: %d\n\n", hdr->length);
printf("eyeposition: %f %f %f\n", hdr->eyeposition[0], hdr->eyeposition[1], hdr->eyeposition[2]); printf("eyeposition: %f %f %f\n", hdr->eyeposition[0], hdr->eyeposition[1], hdr->eyeposition[2]);
printf("min: %f %f %f\n", hdr->min[0], hdr->min[1], hdr->min[2]); printf("min: %f %f %f\n", hdr->min[0], hdr->min[1], hdr->min[2]);
printf("max: %f %f %f\n", hdr->max[0], hdr->max[1], hdr->max[2]); printf("max: %f %f %f\n", hdr->max[0], hdr->max[1], hdr->max[2]);
printf("bbmin: %f %f %f\n", hdr->bbmin[0], hdr->bbmin[1], hdr->bbmin[2]); printf("bbmin: %f %f %f\n", hdr->bbmin[0], hdr->bbmin[1], hdr->bbmin[2]);
printf("bbmax: %f %f %f\n", hdr->bbmax[0], hdr->bbmax[1], hdr->bbmax[2]); printf("bbmax: %f %f %f\n", hdr->bbmax[0], hdr->bbmax[1], hdr->bbmax[2]);
printf("flags: %d\n\n", hdr->flags); printf("flags: %d\n\n", hdr->flags);
printf("numbones: %d\n", hdr->numbones); printf("numbones: %d\n", hdr->numbones);
for (i = 0; i < hdr->numbones; i++) for (i = 0; i < hdr->numbones; i++)
{ {
SHalflifeBone *bone = (SHalflifeBone *) (phdr + hdr->boneindex); SHalflifeBone *bone = (SHalflifeBone *) (phdr + hdr->boneindex);
printf("bone %d.name: \"%s\"\n", i + 1, bone[i].name); printf("bone %d.name: \"%s\"\n", i + 1, bone[i].name);
printf("bone %d.parent: %d\n", i + 1, bone[i].parent); printf("bone %d.parent: %d\n", i + 1, bone[i].parent);
printf("bone %d.flags: %d\n", i + 1, bone[i].flags); printf("bone %d.flags: %d\n", i + 1, bone[i].flags);
printf("bone %d.bonecontroller: %d %d %d %d %d %d\n", i + 1, bone[i].bonecontroller[0], bone[i].bonecontroller[1], bone[i].bonecontroller[2], bone[i].bonecontroller[3], bone[i].bonecontroller[4], bone[i].bonecontroller[5]); printf("bone %d.bonecontroller: %d %d %d %d %d %d\n", i + 1, bone[i].bonecontroller[0], bone[i].bonecontroller[1], bone[i].bonecontroller[2], bone[i].bonecontroller[3], bone[i].bonecontroller[4], bone[i].bonecontroller[5]);
printf("bone %d.value: %f %f %f %f %f %f\n", i + 1, bone[i].value[0], bone[i].value[1], bone[i].value[2], bone[i].value[3], bone[i].value[4], bone[i].value[5]); printf("bone %d.value: %f %f %f %f %f %f\n", i + 1, bone[i].value[0], bone[i].value[1], bone[i].value[2], bone[i].value[3], bone[i].value[4], bone[i].value[5]);
printf("bone %d.scale: %f %f %f %f %f %f\n", i + 1, bone[i].scale[0], bone[i].scale[1], bone[i].scale[2], bone[i].scale[3], bone[i].scale[4], bone[i].scale[5]); printf("bone %d.scale: %f %f %f %f %f %f\n", i + 1, bone[i].scale[0], bone[i].scale[1], bone[i].scale[2], bone[i].scale[3], bone[i].scale[4], bone[i].scale[5]);
} }
printf("\nnumbonecontrollers: %d\n", hdr->numbonecontrollers); printf("\nnumbonecontrollers: %d\n", hdr->numbonecontrollers);
SHalflifeBoneController *bonecontrollers = (SHalflifeBoneController *) (phdr + hdr->bonecontrollerindex); SHalflifeBoneController *bonecontrollers = (SHalflifeBoneController *) (phdr + hdr->bonecontrollerindex);
for (i = 0; i < hdr->numbonecontrollers; i++) for (i = 0; i < hdr->numbonecontrollers; i++)
{ {
printf("bonecontroller %d.bone: %d\n", i + 1, bonecontrollers[i].bone); printf("bonecontroller %d.bone: %d\n", i + 1, bonecontrollers[i].bone);
printf("bonecontroller %d.type: %d\n", i + 1, bonecontrollers[i].type); printf("bonecontroller %d.type: %d\n", i + 1, bonecontrollers[i].type);
printf("bonecontroller %d.start: %f\n", i + 1, bonecontrollers[i].start); printf("bonecontroller %d.start: %f\n", i + 1, bonecontrollers[i].start);
printf("bonecontroller %d.end: %f\n", i + 1, bonecontrollers[i].end); printf("bonecontroller %d.end: %f\n", i + 1, bonecontrollers[i].end);
printf("bonecontroller %d.rest: %d\n", i + 1, bonecontrollers[i].rest); printf("bonecontroller %d.rest: %d\n", i + 1, bonecontrollers[i].rest);
printf("bonecontroller %d.index: %d\n", i + 1, bonecontrollers[i].index); printf("bonecontroller %d.index: %d\n", i + 1, bonecontrollers[i].index);
} }
printf("\nnumhitboxes: %d\n", hdr->numhitboxes); printf("\nnumhitboxes: %d\n", hdr->numhitboxes);
SHalflifeBBox *box = (SHalflifeBBox *) (phdr + hdr->hitboxindex); SHalflifeBBox *box = (SHalflifeBBox *) (phdr + hdr->hitboxindex);
for (i = 0; i < hdr->numhitboxes; i++) for (i = 0; i < hdr->numhitboxes; i++)
{ {
printf("hitbox %d.bone: %d\n", i + 1, box[i].bone); printf("hitbox %d.bone: %d\n", i + 1, box[i].bone);
printf("hitbox %d.group: %d\n", i + 1, box[i].group); printf("hitbox %d.group: %d\n", i + 1, box[i].group);
printf("hitbox %d.bbmin: %f %f %f\n", i + 1, box[i].bbmin[0], box[i].bbmin[1], box[i].bbmin[2]); printf("hitbox %d.bbmin: %f %f %f\n", i + 1, box[i].bbmin[0], box[i].bbmin[1], box[i].bbmin[2]);
printf("hitbox %d.bbmax: %f %f %f\n", i + 1, box[i].bbmax[0], box[i].bbmax[1], box[i].bbmax[2]); printf("hitbox %d.bbmax: %f %f %f\n", i + 1, box[i].bbmax[0], box[i].bbmax[1], box[i].bbmax[2]);
} }
printf("\nnumseq: %d\n", hdr->numseq); printf("\nnumseq: %d\n", hdr->numseq);
SHalflifeSequence *seq = (SHalflifeSequence *) (phdr + hdr->seqindex); SHalflifeSequence *seq = (SHalflifeSequence *) (phdr + hdr->seqindex);
for (i = 0; i < hdr->numseq; i++) for (i = 0; i < hdr->numseq; i++)
{ {
printf("seqdesc %d.label: \"%s\"\n", i + 1, seq[i].label); printf("seqdesc %d.label: \"%s\"\n", i + 1, seq[i].label);
printf("seqdesc %d.fps: %f\n", i + 1, seq[i].fps); printf("seqdesc %d.fps: %f\n", i + 1, seq[i].fps);
printf("seqdesc %d.flags: %d\n", i + 1, seq[i].flags); printf("seqdesc %d.flags: %d\n", i + 1, seq[i].flags);
printf("<...>\n"); printf("<...>\n");
} }
printf("\nnumseqgroups: %d\n", hdr->numseqgroups); printf("\nnumseqgroups: %d\n", hdr->numseqgroups);
for (i = 0; i < hdr->numseqgroups; i++) for (i = 0; i < hdr->numseqgroups; i++)
{ {
SHalflifeSequenceGroup *group = (SHalflifeSequenceGroup *) (phdr + hdr->seqgroupindex); SHalflifeSequenceGroup *group = (SHalflifeSequenceGroup *) (phdr + hdr->seqgroupindex);
printf("\nseqgroup %d.label: \"%s\"\n", i + 1, group[i].label); printf("\nseqgroup %d.label: \"%s\"\n", i + 1, group[i].label);
printf("\nseqgroup %d.namel: \"%s\"\n", i + 1, group[i].name); printf("\nseqgroup %d.namel: \"%s\"\n", i + 1, group[i].name);
printf("\nseqgroup %d.data: %d\n", i + 1, group[i].data); printf("\nseqgroup %d.data: %d\n", i + 1, group[i].data);
} }
printf("\nnumskinref: %d\n", hdr->numskinref); printf("\nnumskinref: %d\n", hdr->numskinref);
printf("numskinfamilies: %d\n", hdr->numskinfamilies); printf("numskinfamilies: %d\n", hdr->numskinfamilies);
printf("\nnumbodyparts: %d\n", hdr->numbodyparts); printf("\nnumbodyparts: %d\n", hdr->numbodyparts);
SHalflifeBody *pbodyparts = (SHalflifeBody*) ((u8*) hdr + hdr->bodypartindex); SHalflifeBody *pbodyparts = (SHalflifeBody*) ((u8*) hdr + hdr->bodypartindex);
for (i = 0; i < hdr->numbodyparts; i++) for (i = 0; i < hdr->numbodyparts; i++)
{ {
printf("bodypart %d.name: \"%s\"\n", i + 1, pbodyparts[i].name); printf("bodypart %d.name: \"%s\"\n", i + 1, pbodyparts[i].name);
printf("bodypart %d.nummodels: %d\n", i + 1, pbodyparts[i].nummodels); printf("bodypart %d.nummodels: %d\n", i + 1, pbodyparts[i].nummodels);
printf("bodypart %d.base: %d\n", i + 1, pbodyparts[i].base); printf("bodypart %d.base: %d\n", i + 1, pbodyparts[i].base);
printf("bodypart %d.modelindex: %d\n", i + 1, pbodyparts[i].modelindex); printf("bodypart %d.modelindex: %d\n", i + 1, pbodyparts[i].modelindex);
} }
printf("\nnumattachments: %d\n", hdr->numattachments); printf("\nnumattachments: %d\n", hdr->numattachments);
for (i = 0; i < hdr->numattachments; i++) for (i = 0; i < hdr->numattachments; i++)
{ {
SHalfelifeAttachment *attach = (SHalfelifeAttachment *) ((u8*) hdr + hdr->attachmentindex); SHalfelifeAttachment *attach = (SHalfelifeAttachment *) ((u8*) hdr + hdr->attachmentindex);
printf("attachment %d.name: \"%s\"\n", i + 1, attach[i].name); printf("attachment %d.name: \"%s\"\n", i + 1, attach[i].name);
} }
hdr = TextureHeader; hdr = TextureHeader;
printf("\nnumtextures: %d\n", hdr->numtextures); printf("\nnumtextures: %d\n", hdr->numtextures);
printf("textureindex: %d\n", hdr->textureindex); printf("textureindex: %d\n", hdr->textureindex);
printf("texturedataindex: %d\n", hdr->texturedataindex); printf("texturedataindex: %d\n", hdr->texturedataindex);
SHalflifeTexture *ptextures = (SHalflifeTexture *) ((u8*) hdr + hdr->textureindex); SHalflifeTexture *ptextures = (SHalflifeTexture *) ((u8*) hdr + hdr->textureindex);
for (i = 0; i < hdr->numtextures; i++) for (i = 0; i < hdr->numtextures; i++)
{ {
printf("texture %d.name: \"%s\"\n", i + 1, ptextures[i].name); printf("texture %d.name: \"%s\"\n", i + 1, ptextures[i].name);
printf("texture %d.flags: %d\n", i + 1, ptextures[i].flags); printf("texture %d.flags: %d\n", i + 1, ptextures[i].flags);
printf("texture %d.width: %d\n", i + 1, ptextures[i].width); printf("texture %d.width: %d\n", i + 1, ptextures[i].width);
printf("texture %d.height: %d\n", i + 1, ptextures[i].height); printf("texture %d.height: %d\n", i + 1, ptextures[i].height);
printf("texture %d.index: %d\n", i + 1, ptextures[i].index); printf("texture %d.index: %d\n", i + 1, ptextures[i].index);
} }
} }
/*! /*!
*/ */
void CAnimatedMeshHalfLife::ExtractBbox( s32 sequence, core::aabbox3df &box ) void CAnimatedMeshHalfLife::ExtractBbox( s32 sequence, core::aabbox3df &box )
{ {
SHalflifeSequence *seq = (SHalflifeSequence *)((u8*)Header + Header->seqindex) + sequence; SHalflifeSequence *seq = (SHalflifeSequence *)((u8*)Header + Header->seqindex) + sequence;
box.MinEdge.X = seq[0].bbmin[0]; box.MinEdge.X = seq[0].bbmin[0];
box.MinEdge.Y = seq[0].bbmin[1]; box.MinEdge.Y = seq[0].bbmin[1];
box.MinEdge.Z = seq[0].bbmin[2]; box.MinEdge.Z = seq[0].bbmin[2];
...@@ -1388,324 +1388,324 @@ void CAnimatedMeshHalfLife::ExtractBbox( s32 sequence, core::aabbox3df &box ) ...@@ -1388,324 +1388,324 @@ void CAnimatedMeshHalfLife::ExtractBbox( s32 sequence, core::aabbox3df &box )
box.MaxEdge.Z = seq[0].bbmax[2]; box.MaxEdge.Z = seq[0].bbmax[2];
} }
/*! /*!
*/ */
void CAnimatedMeshHalfLife::calcBoneAdj() void CAnimatedMeshHalfLife::calcBoneAdj()
{ {
u32 j; u32 j;
s32 i; s32 i;
f32 value; f32 value;
SHalflifeBoneController *bonecontroller; SHalflifeBoneController *bonecontroller;
bonecontroller = (SHalflifeBoneController *)((u8*) Header + Header->bonecontrollerindex); bonecontroller = (SHalflifeBoneController *)((u8*) Header + Header->bonecontrollerindex);
for (j = 0; j < Header->numbonecontrollers; j++) for (j = 0; j < Header->numbonecontrollers; j++)
{ {
i = bonecontroller[j].index; i = bonecontroller[j].index;
f32 range = i <= 3 ? 255.f : 64.f; f32 range = i <= 3 ? 255.f : 64.f;
// check for 360% wrapping // check for 360% wrapping
if (bonecontroller[j].type & STUDIO_RLOOP) if (bonecontroller[j].type & STUDIO_RLOOP)
{ {
value = BoneController[i] * (360.f/256.f) + bonecontroller[j].start; value = BoneController[i] * (360.f/256.f) + bonecontroller[j].start;
} }
else else
{ {
value = BoneController[i] / range; value = BoneController[i] / range;
if (value < 0.f) value = 0.f; if (value < 0.f) value = 0.f;
if (value > 1.f) value = 1.f; if (value > 1.f) value = 1.f;
value = (1.f - value) * bonecontroller[j].start + value * bonecontroller[j].end; value = (1.f - value) * bonecontroller[j].start + value * bonecontroller[j].end;
} }
switch(bonecontroller[j].type & STUDIO_TYPES) switch(bonecontroller[j].type & STUDIO_TYPES)
{ {
case STUDIO_XR: case STUDIO_XR:
case STUDIO_YR: case STUDIO_YR:
case STUDIO_ZR: case STUDIO_ZR:
BoneAdj[j] = value * (core::PI / 180.f); BoneAdj[j] = value * (core::PI / 180.f);
break; break;
case STUDIO_X: case STUDIO_X:
case STUDIO_Y: case STUDIO_Y:
case STUDIO_Z: case STUDIO_Z:
BoneAdj[j] = value; BoneAdj[j] = value;
break; break;
} }
} }
} }
/*! /*!
*/ */
void CAnimatedMeshHalfLife::calcBoneQuaternion( s32 frame, f32 s, SHalflifeBone *bone, SHalflifeAnimOffset *anim, f32 *q ) const void CAnimatedMeshHalfLife::calcBoneQuaternion( s32 frame, f32 s, SHalflifeBone *bone, SHalflifeAnimOffset *anim, f32 *q ) const
{ {
s32 j, k; s32 j, k;
vec4_hl q1, q2; vec4_hl q1, q2;
vec3_hl angle1, angle2; vec3_hl angle1, angle2;
SHalfelifeAnimationFrame *animvalue; SHalfelifeAnimationFrame *animvalue;
for (j = 0; j < 3; j++) for (j = 0; j < 3; j++)
{ {
if (anim->offset[j+3] == 0) if (anim->offset[j+3] == 0)
{ {
angle2[j] = angle1[j] = bone->value[j+3]; // default; angle2[j] = angle1[j] = bone->value[j+3]; // default;
} }
else else
{ {
animvalue = (SHalfelifeAnimationFrame *)((u8*)anim + anim->offset[j+3]); animvalue = (SHalfelifeAnimationFrame *)((u8*)anim + anim->offset[j+3]);
k = frame; k = frame;
while (animvalue->num.total <= k) while (animvalue->num.total <= k)
{ {
k -= animvalue->num.total; k -= animvalue->num.total;
animvalue += animvalue->num.valid + 1; animvalue += animvalue->num.valid + 1;
} }
// Bah, missing blend! // Bah, missing blend!
if (animvalue->num.valid > k) if (animvalue->num.valid > k)
{ {
angle1[j] = animvalue[k+1].value; angle1[j] = animvalue[k+1].value;
if (animvalue->num.valid > k + 1) if (animvalue->num.valid > k + 1)
{ {
angle2[j] = animvalue[k+2].value; angle2[j] = animvalue[k+2].value;
} }
else else
{ {
if (animvalue->num.total > k + 1) if (animvalue->num.total > k + 1)
angle2[j] = angle1[j]; angle2[j] = angle1[j];
else else
angle2[j] = animvalue[animvalue->num.valid+2].value; angle2[j] = animvalue[animvalue->num.valid+2].value;
} }
} }
else else
{ {
angle1[j] = animvalue[animvalue->num.valid].value; angle1[j] = animvalue[animvalue->num.valid].value;
if (animvalue->num.total > k + 1) if (animvalue->num.total > k + 1)
{ {
angle2[j] = angle1[j]; angle2[j] = angle1[j];
} }
else else
{ {
angle2[j] = animvalue[animvalue->num.valid + 2].value; angle2[j] = animvalue[animvalue->num.valid + 2].value;
} }
} }
angle1[j] = bone->value[j+3] + angle1[j] * bone->scale[j+3]; angle1[j] = bone->value[j+3] + angle1[j] * bone->scale[j+3];
angle2[j] = bone->value[j+3] + angle2[j] * bone->scale[j+3]; angle2[j] = bone->value[j+3] + angle2[j] * bone->scale[j+3];
} }
if (bone->bonecontroller[j+3] != -1) if (bone->bonecontroller[j+3] != -1)
{ {
angle1[j] += BoneAdj[bone->bonecontroller[j+3]]; angle1[j] += BoneAdj[bone->bonecontroller[j+3]];
angle2[j] += BoneAdj[bone->bonecontroller[j+3]]; angle2[j] += BoneAdj[bone->bonecontroller[j+3]];
} }
} }
if (!VectorCompare( angle1, angle2 )) if (!VectorCompare( angle1, angle2 ))
{ {
AngleQuaternion( angle1, q1 ); AngleQuaternion( angle1, q1 );
AngleQuaternion( angle2, q2 ); AngleQuaternion( angle2, q2 );
QuaternionSlerp( q1, q2, s, q ); QuaternionSlerp( q1, q2, s, q );
} }
else else
{ {
AngleQuaternion( angle1, q ); AngleQuaternion( angle1, q );
} }
} }
/*! /*!
*/ */
void CAnimatedMeshHalfLife::calcBonePosition( s32 frame, f32 s, SHalflifeBone *bone, SHalflifeAnimOffset *anim, f32 *pos ) const void CAnimatedMeshHalfLife::calcBonePosition( s32 frame, f32 s, SHalflifeBone *bone, SHalflifeAnimOffset *anim, f32 *pos ) const
{ {
s32 j, k; s32 j, k;
SHalfelifeAnimationFrame *animvalue; SHalfelifeAnimationFrame *animvalue;
for (j = 0; j < 3; j++) for (j = 0; j < 3; j++)
{ {
pos[j] = bone->value[j]; // default; pos[j] = bone->value[j]; // default;
if (anim->offset[j] != 0) if (anim->offset[j] != 0)
{ {
animvalue = (SHalfelifeAnimationFrame *)((u8*)anim + anim->offset[j]); animvalue = (SHalfelifeAnimationFrame *)((u8*)anim + anim->offset[j]);
k = frame; k = frame;
// find span of values that includes the frame we want // find span of values that includes the frame we want
while (animvalue->num.total <= k) while (animvalue->num.total <= k)
{ {
k -= animvalue->num.total; k -= animvalue->num.total;
animvalue += animvalue->num.valid + 1; animvalue += animvalue->num.valid + 1;
} }
// if we're inside the span // if we're inside the span
if (animvalue->num.valid > k) if (animvalue->num.valid > k)
{ {
// and there's more data in the span // and there's more data in the span
if (animvalue->num.valid > k + 1) if (animvalue->num.valid > k + 1)
{ {
pos[j] += (animvalue[k+1].value * (1.f - s) + s * animvalue[k+2].value) * bone->scale[j]; pos[j] += (animvalue[k+1].value * (1.f - s) + s * animvalue[k+2].value) * bone->scale[j];
} }
else else
{ {
pos[j] += animvalue[k+1].value * bone->scale[j]; pos[j] += animvalue[k+1].value * bone->scale[j];
} }
} }
else else
{ {
// are we at the end of the repeating values section and there's another section with data? // are we at the end of the repeating values section and there's another section with data?
if (animvalue->num.total <= k + 1) if (animvalue->num.total <= k + 1)
{ {
pos[j] += (animvalue[animvalue->num.valid].value * (1.f - s) + s * animvalue[animvalue->num.valid + 2].value) * bone->scale[j]; pos[j] += (animvalue[animvalue->num.valid].value * (1.f - s) + s * animvalue[animvalue->num.valid + 2].value) * bone->scale[j];
} }
else else
{ {
pos[j] += animvalue[animvalue->num.valid].value * bone->scale[j]; pos[j] += animvalue[animvalue->num.valid].value * bone->scale[j];
} }
} }
} }
if (bone->bonecontroller[j] != -1) if (bone->bonecontroller[j] != -1)
{ {
pos[j] += BoneAdj[bone->bonecontroller[j]]; pos[j] += BoneAdj[bone->bonecontroller[j]];
} }
} }
} }
/*! /*!
*/ */
void CAnimatedMeshHalfLife::calcRotations ( vec3_hl *pos, vec4_hl *q, SHalflifeSequence *seq, SHalflifeAnimOffset *anim, f32 f ) void CAnimatedMeshHalfLife::calcRotations ( vec3_hl *pos, vec4_hl *q, SHalflifeSequence *seq, SHalflifeAnimOffset *anim, f32 f )
{ {
s32 frame; s32 frame;
SHalflifeBone *bone; SHalflifeBone *bone;
f32 s; f32 s;
frame = (s32)f; frame = (s32)f;
s = (f - frame); s = (f - frame);
// add in programatic controllers // add in programatic controllers
calcBoneAdj( ); calcBoneAdj( );
bone = (SHalflifeBone *)((u8 *)Header + Header->boneindex); bone = (SHalflifeBone *)((u8 *)Header + Header->boneindex);
for ( u32 i = 0; i < Header->numbones; i++, bone++, anim++) for ( u32 i = 0; i < Header->numbones; i++, bone++, anim++)
{ {
calcBoneQuaternion( frame, s, bone, anim, q[i] ); calcBoneQuaternion( frame, s, bone, anim, q[i] );
calcBonePosition( frame, s, bone, anim, pos[i] ); calcBonePosition( frame, s, bone, anim, pos[i] );
} }
if (seq->motiontype & STUDIO_X) if (seq->motiontype & STUDIO_X)
pos[seq->motionbone][0] = 0.f; pos[seq->motionbone][0] = 0.f;
if (seq->motiontype & STUDIO_Y) if (seq->motiontype & STUDIO_Y)
pos[seq->motionbone][1] = 0.f; pos[seq->motionbone][1] = 0.f;
if (seq->motiontype & STUDIO_Z) if (seq->motiontype & STUDIO_Z)
pos[seq->motionbone][2] = 0.f; pos[seq->motionbone][2] = 0.f;
} }
/*! /*!
*/ */
SHalflifeAnimOffset * CAnimatedMeshHalfLife::getAnim( SHalflifeSequence *seq ) SHalflifeAnimOffset * CAnimatedMeshHalfLife::getAnim( SHalflifeSequence *seq )
{ {
SHalflifeSequenceGroup *seqgroup; SHalflifeSequenceGroup *seqgroup;
seqgroup = (SHalflifeSequenceGroup *)((u8*)Header + Header->seqgroupindex) + seq->seqgroup; seqgroup = (SHalflifeSequenceGroup *)((u8*)Header + Header->seqgroupindex) + seq->seqgroup;
if (seq->seqgroup == 0) if (seq->seqgroup == 0)
{ {
return (SHalflifeAnimOffset *)((u8*)Header + seqgroup->data + seq->animindex); return (SHalflifeAnimOffset *)((u8*)Header + seqgroup->data + seq->animindex);
} }
return (SHalflifeAnimOffset *)((u8*)AnimationHeader[seq->seqgroup] + seq->animindex); return (SHalflifeAnimOffset *)((u8*)AnimationHeader[seq->seqgroup] + seq->animindex);
} }
/*! /*!
*/ */
void CAnimatedMeshHalfLife::slerpBones( vec4_hl q1[], vec3_hl pos1[], vec4_hl q2[], vec3_hl pos2[], f32 s ) void CAnimatedMeshHalfLife::slerpBones( vec4_hl q1[], vec3_hl pos1[], vec4_hl q2[], vec3_hl pos2[], f32 s )
{ {
vec4_hl q3; vec4_hl q3;
f32 s1; f32 s1;
if (s < 0) s = 0; if (s < 0) s = 0;
else if (s > 1.f) s = 1.f; else if (s > 1.f) s = 1.f;
s1 = 1.f - s; s1 = 1.f - s;
for ( u32 i = 0; i < Header->numbones; i++) for ( u32 i = 0; i < Header->numbones; i++)
{ {
QuaternionSlerp( q1[i], q2[i], s, q3 ); QuaternionSlerp( q1[i], q2[i], s, q3 );
q1[i][0] = q3[0]; q1[i][0] = q3[0];
q1[i][1] = q3[1]; q1[i][1] = q3[1];
q1[i][2] = q3[2]; q1[i][2] = q3[2];
q1[i][3] = q3[3]; q1[i][3] = q3[3];
pos1[i][0] = pos1[i][0] * s1 + pos2[i][0] * s; pos1[i][0] = pos1[i][0] * s1 + pos2[i][0] * s;
pos1[i][1] = pos1[i][1] * s1 + pos2[i][1] * s; pos1[i][1] = pos1[i][1] * s1 + pos2[i][1] * s;
pos1[i][2] = pos1[i][2] * s1 + pos2[i][2] * s; pos1[i][2] = pos1[i][2] * s1 + pos2[i][2] * s;
} }
} }
/*! /*!
*/ */
void CAnimatedMeshHalfLife::setUpBones () void CAnimatedMeshHalfLife::setUpBones ()
{ {
SHalflifeBone *bone; SHalflifeBone *bone;
SHalflifeSequence *seq; SHalflifeSequence *seq;
SHalflifeAnimOffset *anim; SHalflifeAnimOffset *anim;
static vec3_hl pos[MAXSTUDIOBONES]; static vec3_hl pos[MAXSTUDIOBONES];
f32 bonematrix[3][4]; f32 bonematrix[3][4];
static vec4_hl q[MAXSTUDIOBONES]; static vec4_hl q[MAXSTUDIOBONES];
static vec3_hl pos2[MAXSTUDIOBONES]; static vec3_hl pos2[MAXSTUDIOBONES];
static vec4_hl q2[MAXSTUDIOBONES]; static vec4_hl q2[MAXSTUDIOBONES];
static vec3_hl pos3[MAXSTUDIOBONES]; static vec3_hl pos3[MAXSTUDIOBONES];
static vec4_hl q3[MAXSTUDIOBONES]; static vec4_hl q3[MAXSTUDIOBONES];
static vec3_hl pos4[MAXSTUDIOBONES]; static vec3_hl pos4[MAXSTUDIOBONES];
static vec4_hl q4[MAXSTUDIOBONES]; static vec4_hl q4[MAXSTUDIOBONES];
if (SequenceIndex >= Header->numseq) if (SequenceIndex >= Header->numseq)
SequenceIndex = 0; SequenceIndex = 0;
seq = (SHalflifeSequence *)((u8*) Header + Header->seqindex) + SequenceIndex; seq = (SHalflifeSequence *)((u8*) Header + Header->seqindex) + SequenceIndex;
anim = getAnim( seq ); anim = getAnim( seq );
calcRotations( pos, q, seq, anim, CurrentFrame ); calcRotations( pos, q, seq, anim, CurrentFrame );
if (seq->numblends > 1) if (seq->numblends > 1)
{ {
f32 s; f32 s;
anim += Header->numbones; anim += Header->numbones;
calcRotations( pos2, q2, seq, anim, CurrentFrame ); calcRotations( pos2, q2, seq, anim, CurrentFrame );
s = Blending[0] / 255.f; s = Blending[0] / 255.f;
slerpBones( q, pos, q2, pos2, s ); slerpBones( q, pos, q2, pos2, s );
if (seq->numblends == 4) if (seq->numblends == 4)
{ {
anim += Header->numbones; anim += Header->numbones;
calcRotations( pos3, q3, seq, anim, CurrentFrame ); calcRotations( pos3, q3, seq, anim, CurrentFrame );
anim += Header->numbones; anim += Header->numbones;
calcRotations( pos4, q4, seq, anim, CurrentFrame ); calcRotations( pos4, q4, seq, anim, CurrentFrame );
s = Blending[0] / 255.f; s = Blending[0] / 255.f;
slerpBones( q3, pos3, q4, pos4, s ); slerpBones( q3, pos3, q4, pos4, s );
s = Blending[1] / 255.f; s = Blending[1] / 255.f;
slerpBones( q, pos, q3, pos3, s ); slerpBones( q, pos, q3, pos3, s );
} }
} }
bone = (SHalflifeBone *)((u8*) Header + Header->boneindex); bone = (SHalflifeBone *)((u8*) Header + Header->boneindex);
for (u32 i = 0; i < Header->numbones; i++) for (u32 i = 0; i < Header->numbones; i++)
{ {
QuaternionMatrix( q[i], bonematrix ); QuaternionMatrix( q[i], bonematrix );
bonematrix[0][3] = pos[i][0]; bonematrix[0][3] = pos[i][0];
bonematrix[1][3] = pos[i][1]; bonematrix[1][3] = pos[i][1];
bonematrix[2][3] = pos[i][2]; bonematrix[2][3] = pos[i][2];
if (bone[i].parent == -1) { if (bone[i].parent == -1) {
memcpy(BoneTransform[i], bonematrix, sizeof(f32) * 12); memcpy(BoneTransform[i], bonematrix, sizeof(f32) * 12);
} }
else { else {
R_ConcatTransforms (BoneTransform[bone[i].parent], bonematrix, BoneTransform[i]); R_ConcatTransforms (BoneTransform[bone[i].parent], bonematrix, BoneTransform[i]);
} }
} }
} }
......
...@@ -18,7 +18,7 @@ namespace video ...@@ -18,7 +18,7 @@ namespace video
#if defined(_IRR_COMPILE_WITH_DDS_LOADER_) || defined(_IRR_COMPILE_WITH_DDS_WRITER_) #if defined(_IRR_COMPILE_WITH_DDS_LOADER_) || defined(_IRR_COMPILE_WITH_DDS_WRITER_)
// byte-align structures // byte-align structures
#if defined(_MSC_VER) || defined(__BORLANDC__) || defined (__BCPLUSPLUS__) #if defined(_MSC_VER) || defined(__BORLANDC__) || defined (__BCPLUSPLUS__)
# pragma pack( push, packing ) # pragma pack( push, packing )
# pragma pack( 1 ) # pragma pack( 1 )
# define PACK_STRUCT # define PACK_STRUCT
...@@ -131,7 +131,7 @@ struct ddsBuffer ...@@ -131,7 +131,7 @@ struct ddsBuffer
u32 size; u32 size;
u32 flags; u32 flags;
u32 height; u32 height;
u32 width; u32 width;
union union
{ {
s32 pitch; s32 pitch;
...@@ -149,18 +149,18 @@ struct ddsBuffer ...@@ -149,18 +149,18 @@ struct ddsBuffer
void *surface; void *surface;
union union
{ {
ddsColorKey ckDestOverlay; ddsColorKey ckDestOverlay;
u32 emptyFaceColor; u32 emptyFaceColor;
}; };
ddsColorKey ckDestBlt; ddsColorKey ckDestBlt;
ddsColorKey ckSrcOverlay; ddsColorKey ckSrcOverlay;
ddsColorKey ckSrcBlt; ddsColorKey ckSrcBlt;
union union
{ {
ddsPixelFormat pixelFormat; ddsPixelFormat pixelFormat;
u32 fvf; u32 fvf;
}; };
ddsCaps ddsCaps; ddsCaps caps;
u32 textureStage; u32 textureStage;
/* data (Varying size) */ /* data (Varying size) */
...@@ -284,7 +284,7 @@ floatSwapUnion; ...@@ -284,7 +284,7 @@ floatSwapUnion;
// Default alignment // Default alignment
#if defined(_MSC_VER) || defined(__BORLANDC__) || defined (__BCPLUSPLUS__) #if defined(_MSC_VER) || defined(__BORLANDC__) || defined (__BCPLUSPLUS__)
# pragma pack( pop, packing ) # pragma pack( pop, packing )
#endif #endif
......
...@@ -40,7 +40,7 @@ struct mat4{ ...@@ -40,7 +40,7 @@ struct mat4{
float m[4][4]; float m[4][4];
vec4 operator* ( const vec4 &in ) const vec4 operator* ( const vec4 &in ) const
{ {
vec4 out; vec4 out;
return out; return out;
} }
...@@ -51,7 +51,7 @@ struct mat3{ ...@@ -51,7 +51,7 @@ struct mat3{
float m[3][3]; float m[3][3];
vec3 operator* ( const vec3 &in ) const vec3 operator* ( const vec3 &in ) const
{ {
vec3 out; vec3 out;
return out; return out;
} }
...@@ -164,7 +164,7 @@ struct gl_MaterialParameters ...@@ -164,7 +164,7 @@ struct gl_MaterialParameters
uniform gl_MaterialParameters gl_FrontMaterial; uniform gl_MaterialParameters gl_FrontMaterial;
uniform gl_MaterialParameters gl_BackMaterial; uniform gl_MaterialParameters gl_BackMaterial;
// GLSL has some built-in attributes in a vertex shader: // GLSL has some built-in attributes in a vertex shader:
attribute vec4 gl_Vertex; // 4D vector representing the vertex position attribute vec4 gl_Vertex; // 4D vector representing the vertex position
attribute vec3 gl_Normal; // 3D vector representing the vertex normal attribute vec3 gl_Normal; // 3D vector representing the vertex normal
attribute vec4 gl_Color; // 4D vector representing the vertex color attribute vec4 gl_Color; // 4D vector representing the vertex color
...@@ -197,7 +197,7 @@ vec4 ftransform(void) ...@@ -197,7 +197,7 @@ vec4 ftransform(void)
vec3 fnormal(void) vec3 fnormal(void)
{ {
//Compute the normal //Compute the normal
vec3 normal = gl_NormalMatrix * gl_Normal; vec3 normal = gl_NormalMatrix * gl_Normal;
normal = normalize(normal); normal = normalize(normal);
return normal; return normal;
...@@ -256,7 +256,7 @@ struct program1 ...@@ -256,7 +256,7 @@ struct program1
vec3 fnormal(void) vec3 fnormal(void)
{ {
//Compute the normal //Compute the normal
vec3 normal = gl_NormalMatrix * gl_Normal; vec3 normal = gl_NormalMatrix * gl_Normal;
normal = normalize(normal); normal = normalize(normal);
return normal; return normal;
...@@ -312,13 +312,13 @@ struct program1 ...@@ -312,13 +312,13 @@ struct program1
ftexgen(transformedNormal, ecPosition); ftexgen(transformedNormal, ecPosition);
} }
void fragmentshader_main (void) void fragmentshader_main (void)
{ {
vec4 color; vec4 color;
color = gl_Color; color = gl_Color;
color *= texture2D(texUnit0, gl_TexCoord[0].xy); color *= texture2D(texUnit0, vec2(gl_TexCoord[0].x, gl_TexCoord[0].y) );
color += gl_SecondaryColor; color += gl_SecondaryColor;
color = clamp(color, 0.0, 1.0); color = clamp(color, 0.0, 1.0);
...@@ -2633,7 +2633,7 @@ void CBurningVideoDriver::drawStencilShadowVolume(const core::vector3df* triangl ...@@ -2633,7 +2633,7 @@ void CBurningVideoDriver::drawStencilShadowVolume(const core::vector3df* triangl
//glDrawArrays(GL_TRIANGLES,0,count); //glDrawArrays(GL_TRIANGLES,0,count);
} }
} }
//! Fills the stencil shadow with color. After the shadow volume has been drawn //! Fills the stencil shadow with color. After the shadow volume has been drawn
......
...@@ -562,6 +562,8 @@ ...@@ -562,6 +562,8 @@
<Unit filename="BuiltInFont.h" /> <Unit filename="BuiltInFont.h" />
<Unit filename="C3DSMeshFileLoader.cpp" /> <Unit filename="C3DSMeshFileLoader.cpp" />
<Unit filename="C3DSMeshFileLoader.h" /> <Unit filename="C3DSMeshFileLoader.h" />
<Unit filename="CAnimatedMeshHalfLife.cpp" />
<Unit filename="CAnimatedMeshHalfLife.h" />
<Unit filename="CAnimatedMeshMD2.cpp" /> <Unit filename="CAnimatedMeshMD2.cpp" />
<Unit filename="CAnimatedMeshMD2.h" /> <Unit filename="CAnimatedMeshMD2.h" />
<Unit filename="CAnimatedMeshMD3.cpp" /> <Unit filename="CAnimatedMeshMD3.cpp" />
...@@ -696,6 +698,8 @@ ...@@ -696,6 +698,8 @@
<Unit filename="CImage.h" /> <Unit filename="CImage.h" />
<Unit filename="CImageLoaderBMP.cpp" /> <Unit filename="CImageLoaderBMP.cpp" />
<Unit filename="CImageLoaderBMP.h" /> <Unit filename="CImageLoaderBMP.h" />
<Unit filename="CImageLoaderDDS.cpp" />
<Unit filename="CImageLoaderDDS.h" />
<Unit filename="CImageLoaderJPG.cpp" /> <Unit filename="CImageLoaderJPG.cpp" />
<Unit filename="CImageLoaderJPG.h" /> <Unit filename="CImageLoaderJPG.h" />
<Unit filename="CImageLoaderPCX.cpp" /> <Unit filename="CImageLoaderPCX.cpp" />
...@@ -889,6 +893,8 @@ ...@@ -889,6 +893,8 @@
<Unit filename="CTRGouraudAlpha2.cpp" /> <Unit filename="CTRGouraudAlpha2.cpp" />
<Unit filename="CTRGouraudAlphaNoZ2.cpp" /> <Unit filename="CTRGouraudAlphaNoZ2.cpp" />
<Unit filename="CTRGouraudWire.cpp" /> <Unit filename="CTRGouraudWire.cpp" />
<Unit filename="CTRNormalMap.cpp" />
<Unit filename="CTRStencilShadow.cpp" />
<Unit filename="CTRTextureBlend.cpp" /> <Unit filename="CTRTextureBlend.cpp" />
<Unit filename="CTRTextureDetailMap2.cpp" /> <Unit filename="CTRTextureDetailMap2.cpp" />
<Unit filename="CTRTextureFlat.cpp" /> <Unit filename="CTRTextureFlat.cpp" />
...@@ -928,6 +934,8 @@ ...@@ -928,6 +934,8 @@
<Unit filename="CVideoModeList.h" /> <Unit filename="CVideoModeList.h" />
<Unit filename="CVolumeLightSceneNode.cpp" /> <Unit filename="CVolumeLightSceneNode.cpp" />
<Unit filename="CVolumeLightSceneNode.h" /> <Unit filename="CVolumeLightSceneNode.h" />
<Unit filename="CWADReader.cpp" />
<Unit filename="CWADReader.h" />
<Unit filename="CWaterSurfaceSceneNode.cpp" /> <Unit filename="CWaterSurfaceSceneNode.cpp" />
<Unit filename="CWaterSurfaceSceneNode.h" /> <Unit filename="CWaterSurfaceSceneNode.h" />
<Unit filename="CWriteFile.cpp" /> <Unit filename="CWriteFile.cpp" />
......
...@@ -27,16 +27,16 @@ IRRMESHWRITER = CColladaMeshWriter.o CIrrMeshWriter.o CSTLMeshWriter.o COBJMeshW ...@@ -27,16 +27,16 @@ IRRMESHWRITER = CColladaMeshWriter.o CIrrMeshWriter.o CSTLMeshWriter.o COBJMeshW
IRRMESHOBJ = $(IRRMESHLOADER) $(IRRMESHWRITER) \ IRRMESHOBJ = $(IRRMESHLOADER) $(IRRMESHWRITER) \
CSkinnedMesh.o CBoneSceneNode.o CMeshSceneNode.o \ CSkinnedMesh.o CBoneSceneNode.o CMeshSceneNode.o \
CAnimatedMeshSceneNode.o CAnimatedMeshMD2.o CAnimatedMeshMD3.o \ CAnimatedMeshSceneNode.o CAnimatedMeshMD2.o CAnimatedMeshMD3.o \
CQ3LevelMesh.o CQuake3ShaderSceneNode.o CQ3LevelMesh.o CQuake3ShaderSceneNode.o CAnimatedMeshHalfLife.o
IRROBJ = CBillboardSceneNode.o CCameraSceneNode.o CDummyTransformationSceneNode.o CEmptySceneNode.o CGeometryCreator.o CLightSceneNode.o CMeshManipulator.o CMetaTriangleSelector.o COctreeSceneNode.o COctreeTriangleSelector.o CSceneCollisionManager.o CSceneManager.o CShadowVolumeSceneNode.o CSkyBoxSceneNode.o CSkyDomeSceneNode.o CTerrainSceneNode.o CTerrainTriangleSelector.o CVolumeLightSceneNode.o CCubeSceneNode.o CSphereSceneNode.o CTextSceneNode.o CTriangleBBSelector.o CTriangleSelector.o CWaterSurfaceSceneNode.o CMeshCache.o CDefaultSceneNodeAnimatorFactory.o CDefaultSceneNodeFactory.o IRROBJ = CBillboardSceneNode.o CCameraSceneNode.o CDummyTransformationSceneNode.o CEmptySceneNode.o CGeometryCreator.o CLightSceneNode.o CMeshManipulator.o CMetaTriangleSelector.o COctreeSceneNode.o COctreeTriangleSelector.o CSceneCollisionManager.o CSceneManager.o CShadowVolumeSceneNode.o CSkyBoxSceneNode.o CSkyDomeSceneNode.o CTerrainSceneNode.o CTerrainTriangleSelector.o CVolumeLightSceneNode.o CCubeSceneNode.o CSphereSceneNode.o CTextSceneNode.o CTriangleBBSelector.o CTriangleSelector.o CWaterSurfaceSceneNode.o CMeshCache.o CDefaultSceneNodeAnimatorFactory.o CDefaultSceneNodeFactory.o
IRRPARTICLEOBJ = CParticleAnimatedMeshSceneNodeEmitter.o CParticleBoxEmitter.o CParticleCylinderEmitter.o CParticleMeshEmitter.o CParticlePointEmitter.o CParticleRingEmitter.o CParticleSphereEmitter.o CParticleAttractionAffector.o CParticleFadeOutAffector.o CParticleGravityAffector.o CParticleRotationAffector.o CParticleSystemSceneNode.o CParticleScaleAffector.o IRRPARTICLEOBJ = CParticleAnimatedMeshSceneNodeEmitter.o CParticleBoxEmitter.o CParticleCylinderEmitter.o CParticleMeshEmitter.o CParticlePointEmitter.o CParticleRingEmitter.o CParticleSphereEmitter.o CParticleAttractionAffector.o CParticleFadeOutAffector.o CParticleGravityAffector.o CParticleRotationAffector.o CParticleSystemSceneNode.o CParticleScaleAffector.o
IRRANIMOBJ = CSceneNodeAnimatorCameraFPS.o CSceneNodeAnimatorCameraMaya.o CSceneNodeAnimatorCollisionResponse.o CSceneNodeAnimatorDelete.o CSceneNodeAnimatorFlyCircle.o CSceneNodeAnimatorFlyStraight.o CSceneNodeAnimatorFollowSpline.o CSceneNodeAnimatorRotation.o CSceneNodeAnimatorTexture.o IRRANIMOBJ = CSceneNodeAnimatorCameraFPS.o CSceneNodeAnimatorCameraMaya.o CSceneNodeAnimatorCollisionResponse.o CSceneNodeAnimatorDelete.o CSceneNodeAnimatorFlyCircle.o CSceneNodeAnimatorFlyStraight.o CSceneNodeAnimatorFollowSpline.o CSceneNodeAnimatorRotation.o CSceneNodeAnimatorTexture.o
IRRDRVROBJ = CNullDriver.o COpenGLDriver.o COpenGLNormalMapRenderer.o COpenGLParallaxMapRenderer.o COpenGLShaderMaterialRenderer.o COpenGLTexture.o COpenGLSLMaterialRenderer.o COpenGLExtensionHandler.o CD3D8Driver.o CD3D8NormalMapRenderer.o CD3D8ParallaxMapRenderer.o CD3D8ShaderMaterialRenderer.o CD3D8Texture.o CD3D9Driver.o CD3D9HLSLMaterialRenderer.o CD3D9NormalMapRenderer.o CD3D9ParallaxMapRenderer.o CD3D9ShaderMaterialRenderer.o CD3D9Texture.o IRRDRVROBJ = CNullDriver.o COpenGLDriver.o COpenGLNormalMapRenderer.o COpenGLParallaxMapRenderer.o COpenGLShaderMaterialRenderer.o COpenGLTexture.o COpenGLSLMaterialRenderer.o COpenGLExtensionHandler.o CD3D8Driver.o CD3D8NormalMapRenderer.o CD3D8ParallaxMapRenderer.o CD3D8ShaderMaterialRenderer.o CD3D8Texture.o CD3D9Driver.o CD3D9HLSLMaterialRenderer.o CD3D9NormalMapRenderer.o CD3D9ParallaxMapRenderer.o CD3D9ShaderMaterialRenderer.o CD3D9Texture.o
IRRIMAGEOBJ = CColorConverter.o CImage.o CImageLoaderBMP.o CImageLoaderJPG.o CImageLoaderPCX.o CImageLoaderPNG.o CImageLoaderPSD.o CImageLoaderTGA.o CImageLoaderPPM.o CImageLoaderWAL.o CImageLoaderRGB.o \ IRRIMAGEOBJ = CColorConverter.o CImage.o CImageLoaderBMP.o CImageLoaderDDS.o CImageLoaderJPG.o CImageLoaderPCX.o CImageLoaderPNG.o CImageLoaderPSD.o CImageLoaderTGA.o CImageLoaderPPM.o CImageLoaderWAL.o CImageLoaderRGB.o \
CImageWriterBMP.o CImageWriterJPG.o CImageWriterPCX.o CImageWriterPNG.o CImageWriterPPM.o CImageWriterPSD.o CImageWriterTGA.o CImageWriterBMP.o CImageWriterJPG.o CImageWriterPCX.o CImageWriterPNG.o CImageWriterPPM.o CImageWriterPSD.o CImageWriterTGA.o
IRRVIDEOOBJ = CVideoModeList.o CFPSCounter.o $(IRRDRVROBJ) $(IRRIMAGEOBJ) IRRVIDEOOBJ = CVideoModeList.o CFPSCounter.o $(IRRDRVROBJ) $(IRRIMAGEOBJ)
IRRSWRENDEROBJ = CSoftwareDriver.o CSoftwareTexture.o CTRFlat.o CTRFlatWire.o CTRGouraud.o CTRGouraudWire.o CTRTextureFlat.o CTRTextureFlatWire.o CTRTextureGouraud.o CTRTextureGouraudAdd.o CTRTextureGouraudNoZ.o CTRTextureGouraudWire.o CZBuffer.o CTRTextureGouraudVertexAlpha2.o CTRTextureGouraudNoZ2.o CTRTextureLightMap2_M2.o CTRTextureLightMap2_M4.o CTRTextureLightMap2_M1.o CSoftwareDriver2.o CSoftwareTexture2.o CTRTextureGouraud2.o CTRGouraud2.o CTRGouraudAlpha2.o CTRGouraudAlphaNoZ2.o CTRTextureDetailMap2.o CTRTextureGouraudAdd2.o CTRTextureGouraudAddNoZ2.o CTRTextureWire2.o CTRTextureLightMap2_Add.o CTRTextureLightMapGouraud2_M4.o IBurningShader.o CTRTextureBlend.o CTRTextureGouraudAlpha.o CTRTextureGouraudAlphaNoZ.o CDepthBuffer.o CBurningShader_Raster_Reference.o IRRSWRENDEROBJ = CSoftwareDriver.o CSoftwareTexture.o CTRFlat.o CTRFlatWire.o CTRGouraud.o CTRGouraudWire.o CTRNormalMap.o CTRStencilShadow.o CTRTextureFlat.o CTRTextureFlatWire.o CTRTextureGouraud.o CTRTextureGouraudAdd.o CTRTextureGouraudNoZ.o CTRTextureGouraudWire.o CZBuffer.o CTRTextureGouraudVertexAlpha2.o CTRTextureGouraudNoZ2.o CTRTextureLightMap2_M2.o CTRTextureLightMap2_M4.o CTRTextureLightMap2_M1.o CSoftwareDriver2.o CSoftwareTexture2.o CTRTextureGouraud2.o CTRGouraud2.o CTRGouraudAlpha2.o CTRGouraudAlphaNoZ2.o CTRTextureDetailMap2.o CTRTextureGouraudAdd2.o CTRTextureGouraudAddNoZ2.o CTRTextureWire2.o CTRTextureLightMap2_Add.o CTRTextureLightMapGouraud2_M4.o IBurningShader.o CTRTextureBlend.o CTRTextureGouraudAlpha.o CTRTextureGouraudAlphaNoZ.o CDepthBuffer.o CBurningShader_Raster_Reference.o
IRRIOOBJ = CFileList.o CFileSystem.o CLimitReadFile.o CMemoryFile.o CReadFile.o CWriteFile.o CXMLReader.o CXMLWriter.o CZipReader.o CPakReader.o CNPKReader.o CTarReader.o CMountPointReader.o irrXML.o CAttributes.o lzma/LzmaDec.o IRRIOOBJ = CFileList.o CFileSystem.o CLimitReadFile.o CMemoryFile.o CReadFile.o CWriteFile.o CXMLReader.o CXMLWriter.o CWADReader.o CZipReader.o CPakReader.o CNPKReader.o CTarReader.o CMountPointReader.o irrXML.o CAttributes.o lzma/LzmaDec.o
IRROTHEROBJ = CIrrDeviceSDL.o CIrrDeviceLinux.o CIrrDeviceConsole.o CIrrDeviceStub.o CIrrDeviceWin32.o CIrrDeviceFB.o CLogger.o COSOperator.o Irrlicht.o os.o IRROTHEROBJ = CIrrDeviceSDL.o CIrrDeviceLinux.o CIrrDeviceConsole.o CIrrDeviceStub.o CIrrDeviceWin32.o CIrrDeviceFB.o CLogger.o COSOperator.o Irrlicht.o os.o
IRRGUIOBJ = CGUIButton.o CGUICheckBox.o CGUIComboBox.o CGUIContextMenu.o CGUIEditBox.o CGUIEnvironment.o CGUIFileOpenDialog.o CGUIFont.o CGUIImage.o CGUIInOutFader.o CGUIListBox.o CGUIMenu.o CGUIMeshViewer.o CGUIMessageBox.o CGUIModalScreen.o CGUIScrollBar.o CGUISpinBox.o CGUISkin.o CGUIStaticText.o CGUITabControl.o CGUITable.o CGUIToolBar.o CGUIWindow.o CGUIColorSelectDialog.o CDefaultGUIElementFactory.o CGUISpriteBank.o CGUIImageList.o CGUITreeView.o IRRGUIOBJ = CGUIButton.o CGUICheckBox.o CGUIComboBox.o CGUIContextMenu.o CGUIEditBox.o CGUIEnvironment.o CGUIFileOpenDialog.o CGUIFont.o CGUIImage.o CGUIInOutFader.o CGUIListBox.o CGUIMenu.o CGUIMeshViewer.o CGUIMessageBox.o CGUIModalScreen.o CGUIScrollBar.o CGUISpinBox.o CGUISkin.o CGUIStaticText.o CGUITabControl.o CGUITable.o CGUIToolBar.o CGUIWindow.o CGUIColorSelectDialog.o CDefaultGUIElementFactory.o CGUISpriteBank.o CGUIImageList.o CGUITreeView.o
ZLIBOBJ = zlib/adler32.o zlib/compress.o zlib/crc32.o zlib/deflate.o zlib/inffast.o zlib/inflate.o zlib/inftrees.o zlib/trees.o zlib/uncompr.o zlib/zutil.o ZLIBOBJ = zlib/adler32.o zlib/compress.o zlib/crc32.o zlib/deflate.o zlib/inffast.o zlib/inflate.o zlib/inftrees.o zlib/trees.o zlib/uncompr.o zlib/zutil.o
......
...@@ -112,10 +112,10 @@ struct sVec4 ...@@ -112,10 +112,10 @@ struct sVec4
{ {
struct { f32 x, y, z, w; }; struct { f32 x, y, z, w; };
struct { f32 a, r, g, b; }; struct { f32 a, r, g, b; };
struct { sVec2 xy, zw; }; // struct { sVec2 xy, zw; }; // sorry, this does not compile with gcc
}; };
sVec4 () {} sVec4 () {}
...@@ -640,7 +640,7 @@ struct sPixelShaderData ...@@ -640,7 +640,7 @@ struct sPixelShaderData
/* /*
load a color value load a color value
*/ */
inline void getTexel_plain2 ( tFixPoint &r, tFixPoint &g, tFixPoint &b, inline void getTexel_plain2 ( tFixPoint &r, tFixPoint &g, tFixPoint &b,
const sVec4 &v const sVec4 &v
) )
{ {
...@@ -652,7 +652,7 @@ inline void getTexel_plain2 ( tFixPoint &r, tFixPoint &g, tFixPoint &b, ...@@ -652,7 +652,7 @@ inline void getTexel_plain2 ( tFixPoint &r, tFixPoint &g, tFixPoint &b,
/* /*
load a color value load a color value
*/ */
inline void getSample_color ( tFixPoint &a, tFixPoint &r, tFixPoint &g, tFixPoint &b, inline void getSample_color ( tFixPoint &a, tFixPoint &r, tFixPoint &g, tFixPoint &b,
const sVec4 &v const sVec4 &v
) )
{ {
...@@ -689,5 +689,5 @@ inline void getSample_color ( tFixPoint &r, tFixPoint &g, tFixPoint &b, ...@@ -689,5 +689,5 @@ inline void getSample_color ( tFixPoint &r, tFixPoint &g, tFixPoint &b,
} }
#endif #endif
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