Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Misc changes forward ported from GLM patch.

  • Loading branch information...
commit 7bd4da5cc94b2f1800f02896910168a90451f076 1 parent d5f3a24
@perim perim authored
View
1  data/base/shaders/button.frag
@@ -5,7 +5,6 @@ uniform sampler2D Texture0;
uniform sampler2D Texture1;
uniform vec4 teamcolour;
uniform int tcmask;
-//uniform int fogEnabled;
void main(void)
{
View
4 lib/ivis_opengl/piedraw.cpp
@@ -427,7 +427,7 @@ void pie_Draw3DShape(iIMDShape *shape, int frame, int team, PIELIGHT colour, int
else
{
SHAPE tshape;
- glGetFloatv(GL_MODELVIEW_MATRIX, tshape.matrix);
+ pie_GetMatrix(tshape.matrix);
tshape.shape = shape;
tshape.frame = frame;
tshape.colour = colour;
@@ -447,7 +447,7 @@ void pie_Draw3DShape(iIMDShape *shape, int frame, int team, PIELIGHT colour, int
// draw a shadow
ShadowcastingShape scshape;
- glGetFloatv(GL_MODELVIEW_MATRIX, scshape.matrix);
+ pie_GetMatrix(scshape.matrix);
distance = scshape.matrix[12] * scshape.matrix[12];
distance += scshape.matrix[13] * scshape.matrix[13];
distance += scshape.matrix[14] * scshape.matrix[14];
View
42 lib/ivis_opengl/piematrix.cpp
@@ -50,37 +50,17 @@ struct SDMATRIX
d, e, f,
g, h, i,
j, k, l;
+
+ SDMATRIX() : a(FP12_MULTIPLIER), b(0), c(0), d(0), e(FP12_MULTIPLIER), f(0), g(0), h(0), i(FP12_MULTIPLIER), j(0), k(0), l(0) {}
};
static SDMATRIX aMatrixStack[MATRIX_MAX];
static SDMATRIX *psMatrix = &aMatrixStack[0];
//*************************************************************************
-static const SDMATRIX Identitymatrix = {
- FP12_MULTIPLIER, 0, 0,
- 0, FP12_MULTIPLIER, 0,
- 0, 0, FP12_MULTIPLIER,
- 0, 0, 0,
-};
static SDWORD _MATRIX_INDEX;
//*************************************************************************
-//*** reset transformation matrix stack and make current identity
-//*
-//******
-
-static void pie_MatReset(void)
-{
- psMatrix = &aMatrixStack[0];
-
- // make 1st matrix identity
- *psMatrix = Identitymatrix;
-
- glLoadIdentity();
-}
-
-
-//*************************************************************************
//*** create new matrix from current transformation matrix and make current
//*
//******
@@ -168,7 +148,6 @@ void pie_MatScale(float scale)
//*** matrix rotate y (yaw) current transformation matrix
//*
//******
-
void pie_MatRotY(uint16_t y)
{
/*
@@ -209,7 +188,6 @@ void pie_MatRotY(uint16_t y)
//*** matrix rotate z (roll) current transformation matrix
//*
//******
-
void pie_MatRotZ(uint16_t z)
{
/*
@@ -250,7 +228,6 @@ void pie_MatRotZ(uint16_t z)
//*** matrix rotate x (pitch) current transformation matrix
//*
//******
-
void pie_MatRotX(uint16_t x)
{
/*
@@ -286,6 +263,14 @@ void pie_MatRotX(uint16_t x)
}
}
+//*************************************************************************
+//*** get current transformation matrix
+//*
+//******
+void pie_GetMatrix(float *matrix)
+{
+ glGetFloatv(GL_MODELVIEW_MATRIX, matrix);
+}
/*!
* 3D vector perspective projection
@@ -363,11 +348,10 @@ void pie_SetGeometricOffset(int x, int y)
rendSurface.ycentre = y;
}
-/** Sets up transformation matrices/quaternions and trig tables
- */
+/** Sets up transformation matrices */
void pie_MatInit(void)
{
- // init matrix/quat stack
- pie_MatReset();
+ psMatrix = &aMatrixStack[0];
+ glLoadIdentity();
}
View
1  lib/ivis_opengl/piematrix.h
@@ -70,6 +70,7 @@ extern void pie_MatRotX(uint16_t x);
extern void pie_MatRotY(uint16_t y);
extern void pie_MatRotZ(uint16_t z);
extern int32_t pie_RotateProject(const Vector3i *src, Vector2i *dest);
+void pie_GetMatrix(float *matrix);
//*************************************************************************
View
15 lib/ivis_opengl/piestate.cpp
@@ -368,10 +368,19 @@ void pie_ActivateShader(SHADER_MODE shaderMode, iIMDShape* shape, PIELIGHT teamc
pal_PIELIGHTtoRGBA4f(&colour4f[0], teamcolour);
glUniform4fv(locTeam, 1, &colour4f[0]);
- glUniform1f(locStretch, shaderStretch);
glUniform1i(locTCMask, maskpage != iV_TEX_INVALID);
- glUniform1i(locNormalMap, normalpage != iV_TEX_INVALID);
- glUniform1i(locEcm, ecmState);
+ if (locStretch >= 0)
+ {
+ glUniform1f(locStretch, shaderStretch);
+ }
+ if (locNormalMap >= 0)
+ {
+ glUniform1i(locNormalMap, normalpage != iV_TEX_INVALID);
+ }
+ if (locEcm >= 0)
+ {
+ glUniform1i(locEcm, ecmState);
+ }
if (maskpage != iV_TEX_INVALID)
{
View
3  src/bucket3d.cpp
@@ -136,9 +136,6 @@ static SDWORD bucketCalculateZ(RENDER_TYPE objectType, void* pObject)
position.x = psSimpObj->pos.x - player.p.x;
position.z = -(psSimpObj->pos.y - player.p.z);
- //if((objectType == RENDER_STRUCTURE) && (((STRUCTURE*)pObject)->
- // pStructureType->type >= REF_DEFENSE) &&
- // (((STRUCTURE*)pObject)->pStructureType->type<=REF_TOWER4))
if((objectType == RENDER_STRUCTURE) &&
((((STRUCTURE*)pObject)->pStructureType->type == REF_DEFENSE) ||
(((STRUCTURE*)pObject)->pStructureType->type == REF_WALL) ||
View
14 src/display3d.cpp
@@ -23,7 +23,6 @@
* Originally by Alex McLean & Jeremy Sallis, Pumpkin Studios, EIDOS INTERACTIVE
*/
-
#include "lib/framework/frame.h"
#include "lib/framework/opengl.h"
#include "lib/framework/math_ext.h"
@@ -138,7 +137,6 @@ extern bool writeGameInfo(const char *pFileName); // Used to help debug issues w
// To get the real camera position, still need to add Vector3i(player.p.x, 0, player.p.z).
static Vector3i actualCameraPosition;
-
bool bRender3DOnly;
static bool bRangeDisplay = false;
static SDWORD rangeCenterX,rangeCenterY,rangeRadius;
@@ -1482,13 +1480,10 @@ void displayStaticObjects( void )
if ( psStructure->visible[selectedPlayer] )
{
//check not a resource extractors
- if (psStructure->pStructureType->type !=
- REF_RESOURCE_EXTRACTOR)
+ if (psStructure->pStructureType->type != REF_RESOURCE_EXTRACTOR)
{
displayAnimation( psAnimObj, false );
}
- //check that a power gen exists before animationg res extrac
- //else if (getPowerGenExists(psStructure->player))
/*check the building is active*/
else if (psStructure->pFunctionality->resourceExtractor.active)
{
@@ -1696,12 +1691,7 @@ void displayBlueprints(void)
/// Draw Factory Delivery Points
void displayDelivPoints(void)
{
- FLAG_POSITION *psDelivPoint;
-
- //only do the selected players'
- /* go through all DPs for that player */
- for(psDelivPoint = apsFlagPosLists[selectedPlayer]; psDelivPoint != NULL;
- psDelivPoint = psDelivPoint->psNext)
+ for (FLAG_POSITION *psDelivPoint = apsFlagPosLists[selectedPlayer]; psDelivPoint != NULL; psDelivPoint = psDelivPoint->psNext)
{
if (clipXY(psDelivPoint->coords.x, psDelivPoint->coords.y))
{
Please sign in to comment.
Something went wrong with that request. Please try again.