From 37bb81685056882d2de50d88195e0fda643d60e0 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 24 Mar 2016 16:10:17 +0100 Subject: [PATCH] - some adjustments for voxels. --- src/gl/models/gl_models.cpp | 10 +++++----- src/gl/models/gl_models.h | 2 +- src/gl/models/gl_voxels.cpp | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/gl/models/gl_models.cpp b/src/gl/models/gl_models.cpp index 7776657db5..a33a91604f 100644 --- a/src/gl/models/gl_models.cpp +++ b/src/gl/models/gl_models.cpp @@ -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(); diff --git a/src/gl/models/gl_models.h b/src/gl/models/gl_models.h index af7af7c0f6..0159d2667a 100644 --- a/src/gl/models/gl_models.h +++ b/src/gl/models/gl_models.h @@ -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. }; diff --git a/src/gl/models/gl_voxels.cpp b/src/gl/models/gl_voxels.cpp index c092f9dd7f..3a34117b9e 100644 --- a/src/gl/models/gl_voxels.cpp +++ b/src/gl/models/gl_voxels.cpp @@ -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];