- some adjustments for voxels.

This commit is contained in:
Christoph Oelckers 2016-03-24 16:10:17 +01:00
parent 379d5bc0c5
commit 37bb816850
3 changed files with 9 additions and 9 deletions

View file

@ -421,8 +421,8 @@ void gl_InitModels()
memset(&smf, 0, sizeof(smf));
smf.models[0] = md;
smf.skins[0] = md->GetPaletteTexture();
smf.xscale = smf.yscale = smf.zscale = FIXED2FLOAT(VoxelDefs[i]->Scale);
smf.angleoffset = VoxelDefs[i]->AngleOffset;
smf.xscale = smf.yscale = smf.zscale = VoxelDefs[i]->Scale;
smf.angleoffset = VoxelDefs[i]->AngleOffset.Degrees;
if (VoxelDefs[i]->PlacedSpin != 0)
{
smf.yrotate = 1.f;
@ -523,7 +523,7 @@ void gl_InitModels()
else if (sc.Compare("angleoffset"))
{
sc.MustGetFloat();
smf.angleoffset = FLOAT2ANGLE(sc.Float);
smf.angleoffset = sc.Float;
}
else if (sc.Compare("pitchoffset"))
{
@ -919,7 +919,7 @@ void gl_RenderModel(GLSprite * spr)
gl_RenderState.mModelMatrix.translate(smf->xoffset / smf->xscale, smf->zoffset / smf->zscale, smf->yoffset / smf->yscale);
// 5) Applying model rotations.
gl_RenderState.mModelMatrix.rotate(-ANGLE2FLOAT(smf->angleoffset), 0, 1, 0);
gl_RenderState.mModelMatrix.rotate(-smf->angleoffset, 0, 1, 0);
gl_RenderState.mModelMatrix.rotate(smf->pitchoffset, 0, 0, 1);
gl_RenderState.mModelMatrix.rotate(-smf->rolloffset, 1, 0, 0);
@ -982,7 +982,7 @@ void gl_RenderHUDModel(pspdef_t *psp, fixed_t ofsx, fixed_t ofsy)
gl_RenderState.mViewMatrix.rotate(90.f, 0, 1, 0);
// Applying angleoffset, pitchoffset, rolloffset.
gl_RenderState.mViewMatrix.rotate(-ANGLE2FLOAT(smf->angleoffset), 0, 1, 0);
gl_RenderState.mViewMatrix.rotate(-smf->angleoffset, 0, 1, 0);
gl_RenderState.mViewMatrix.rotate(smf->pitchoffset, 0, 0, 1);
gl_RenderState.mViewMatrix.rotate(-smf->rolloffset, 1, 0, 0);
gl_RenderState.ApplyMatrices();

View file

@ -354,7 +354,7 @@ struct FSpriteModelFrame
short frame;
FState * state; // for later!
int hashnext;
angle_t angleoffset;
float angleoffset;
// added pithoffset, rolloffset.
float pitchoffset, rolloffset; // I don't want to bother with type transformations, so I made this variables float.
};

View file

@ -253,9 +253,9 @@ unsigned int FVoxelModel::AddVertex(FModelVertex &vert, FVoxelMap &check)
void FVoxelModel::AddFace(int x1, int y1, int z1, int x2, int y2, int z2, int x3, int y3, int z3, int x4, int y4, int z4, BYTE col, FVoxelMap &check)
{
float PivotX = mVoxel->Mips[0].PivotX / 256.f;
float PivotY = mVoxel->Mips[0].PivotY / 256.f;
float PivotZ = mVoxel->Mips[0].PivotZ / 256.f;
float PivotX = mVoxel->Mips[0].Pivot.X;
float PivotY = mVoxel->Mips[0].Pivot.Y;
float PivotZ = mVoxel->Mips[0].Pivot.Z;
int h = mVoxel->Mips[0].SizeZ;
FModelVertex vert;
unsigned int indx[4];