Commit 66400aeb authored by Rinnegatamante's avatar Rinnegatamante
Browse files

Optimized color vertices renderering.

parent f5db2245
......@@ -78,10 +78,10 @@ of OpenGL
*/
uint16_t* indices;
float *gVertexBuffer;
float *gColorBuffer;
uint8_t *gColorBuffer;
float *gTexCoordBuffer;
float *gVertexBufferPtr;
float *gColorBufferPtr;
uint8_t *gColorBufferPtr;
float *gTexCoordBufferPtr;
uint8_t inited = 0;
......@@ -134,7 +134,7 @@ void GLimp_Init( qboolean coreContext)
vglIndexPointerMapped(indices);
glEnableClientState(GL_VERTEX_ARRAY);
gVertexBufferPtr = (float*)malloc(0x400000);
gColorBufferPtr = (float*)malloc(0x200000);
gColorBufferPtr = (uint8_t*)malloc(0x200000);
gTexCoordBufferPtr = (float*)malloc(0x200000);
gVertexBuffer = gVertexBufferPtr;
gColorBuffer = gColorBufferPtr;
......
......@@ -39,7 +39,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "../qcommon/q_shared.h"
#include "../qcommon/qcommon.h"
int _newlib_heap_size_user = 192 * 1024 * 1024;
int _newlib_heap_size_user = 200 * 1024 * 1024;
static char binaryPath[MAX_OSPATH] = {0};
static char installPath[MAX_OSPATH] = {0};
......
......@@ -177,8 +177,6 @@ char *Sys_GetCurrentUser(void) {
return nick;
}
#define MEM_THRESHOLD 96*1024*1024
/*
==================
Sys_LowPhysicalMemory
......
......@@ -31,11 +31,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#define MAX_INDICES 4096
#define VERTEXARRAYSIZE 18360
extern float *gVertexBuffer;
extern float *gColorBuffer;
extern uint8_t *gColorBuffer;
extern float *gTexCoordBuffer;
extern float *gVertexBufferPtr;
extern float *gColorBufferPtr;
extern float *gTexCoordBufferPtr;
extern uint16_t *indices;
#include "vitaGL.h"
......
......@@ -273,10 +273,10 @@ static void ProjectDlightTexture_scalar( void ) {
int i, l;
vec3_t origin;
float *texCoords;
float *colors;
byte *colors;
byte clipBits[SHADER_MAX_VERTEXES];
float texCoordsArray[SHADER_MAX_VERTEXES][2];
float colorArray[SHADER_MAX_VERTEXES][4];
byte colorArray[SHADER_MAX_VERTEXES][4];
glIndex_t hitIndexes[SHADER_MAX_INDEXES];
int numIndexes;
float scale;
......@@ -373,10 +373,10 @@ static void ProjectDlightTexture_scalar( void ) {
}
}
clipBits[i] = clip;
colors[0] = (float)(ri.ftol(floatColor[0] * modulate)) / 255.0f;
colors[1] = (float)(ri.ftol(floatColor[1] * modulate)) / 255.0f;
colors[2] = (float)(ri.ftol(floatColor[2] * modulate)) / 255.0f;
colors[3] = 1.0f;
colors[0] = ri.ftol(floatColor[0] * modulate);
colors[1] = ri.ftol(floatColor[1] * modulate);
colors[2] = ri.ftol(floatColor[2] * modulate);
colors[3] = 255;
}
// build a list of triangles that need light
......@@ -404,14 +404,14 @@ static void ProjectDlightTexture_scalar( void ) {
qglEnableClientState( GL_COLOR_ARRAY );
float *texcoord = gTexCoordBuffer;
float *colorbuf = gColorBuffer;
uint8_t *colorbuf = gColorBuffer;
for (i = 0 ; i < numIndexes ; i++) {
memcpy(gTexCoordBuffer, texCoordsArray[hitIndexes[i]], sizeof(vec2_t));
gTexCoordBuffer += 2;
memcpy(gColorBuffer, colorArray[hitIndexes[i]], sizeof(vec4_t));
memcpy(gColorBuffer, colorArray[hitIndexes[i]], sizeof(uint32_t));
gColorBuffer += 4;
}
vglColorPointerMapped(GL_FLOAT, colorbuf);
vglColorPointerMapped(GL_UNSIGNED_BYTE, colorbuf);
vglTexCoordPointerMapped(texcoord);
GL_Bind( tr.dlightImage );
......@@ -464,17 +464,17 @@ static void RB_FogPass( void ) {
}
float *texcoord = gTexCoordBuffer;
float *colorbuf = gColorBuffer;
uint8_t *colorbuf = gColorBuffer;
for (i = 0 ; i < tess.numIndexes ; i++) {
gColorBuffer[0] = (float)(tess.svars.colors[tess.indexes[i]][0]) / 255.0f;
gColorBuffer[1] = (float)(tess.svars.colors[tess.indexes[i]][1]) / 255.0f;
gColorBuffer[2] = (float)(tess.svars.colors[tess.indexes[i]][2]) / 255.0f;
gColorBuffer[3] = (float)(tess.svars.colors[tess.indexes[i]][3]) / 255.0f;
gColorBuffer[0] = tess.svars.colors[tess.indexes[i]][0];
gColorBuffer[1] = tess.svars.colors[tess.indexes[i]][1];
gColorBuffer[2] = tess.svars.colors[tess.indexes[i]][2];
gColorBuffer[3] = tess.svars.colors[tess.indexes[i]][3];
memcpy(gTexCoordBuffer, tess.svars.texcoords[0][tess.indexes[i]], sizeof(vec2_t));
gTexCoordBuffer += 2;
gColorBuffer += 4;
}
vglColorPointerMapped(GL_FLOAT, colorbuf);
vglColorPointerMapped(GL_UNSIGNED_BYTE, colorbuf);
vglTexCoordPointerMapped(texcoord);
R_DrawElements( tess.numIndexes, tess.indexes );
......@@ -820,16 +820,16 @@ static void RB_IterateStagesGeneric( shaderCommands_t *input )
//if ( !setArraysOnce )
//{
qglEnableClientState( GL_COLOR_ARRAY );
float *colorbuf = gColorBuffer;
uint8_t *colorbuf = gColorBuffer;
int i;
for (i = 0 ; i < input->numIndexes ; i++) {
gColorBuffer[0] = (float)(input->svars.colors[input->indexes[i]][0]) / 255.0f;
gColorBuffer[1] = (float)(input->svars.colors[input->indexes[i]][1]) / 255.0f;
gColorBuffer[2] = (float)(input->svars.colors[input->indexes[i]][2]) / 255.0f;
gColorBuffer[3] = (float)(input->svars.colors[input->indexes[i]][3]) / 255.0f;
gColorBuffer[0] = input->svars.colors[input->indexes[i]][0];
gColorBuffer[1] = input->svars.colors[input->indexes[i]][1];
gColorBuffer[2] = input->svars.colors[input->indexes[i]][2];
gColorBuffer[3] = input->svars.colors[input->indexes[i]][3];
gColorBuffer += 4;
}
vglColorPointerMapped(GL_FLOAT, colorbuf);
vglColorPointerMapped(GL_UNSIGNED_BYTE, colorbuf);
//}
//
......@@ -999,22 +999,22 @@ void RB_StageIteratorVertexLitTexture( void )
qglEnableClientState( GL_COLOR_ARRAY);
qglEnableClientState( GL_TEXTURE_COORD_ARRAY);
float *colorbuf = gColorBuffer;
uint8_t *colorbuf = gColorBuffer;
float *texcoord = gTexCoordBuffer;
float *vertices = gVertexBuffer;
int i;
for (i = 0 ; i < tess.numIndexes ; i++) {
gColorBuffer[0] = (float)(tess.svars.colors[tess.indexes[i]][0]) / 255.0f;
gColorBuffer[1] = (float)(tess.svars.colors[tess.indexes[i]][1]) / 255.0f;
gColorBuffer[2] = (float)(tess.svars.colors[tess.indexes[i]][2]) / 255.0f;
gColorBuffer[3] = (float)(tess.svars.colors[tess.indexes[i]][3]) / 255.0f;
gColorBuffer[0] = tess.svars.colors[tess.indexes[i]][0];
gColorBuffer[1] = tess.svars.colors[tess.indexes[i]][1];
gColorBuffer[2] = tess.svars.colors[tess.indexes[i]][2];
gColorBuffer[3] = tess.svars.colors[tess.indexes[i]][3];
gColorBuffer += 4;
memcpy(gTexCoordBuffer, tess.texCoords[tess.indexes[i]][0], sizeof(vec2_t));
gTexCoordBuffer += 2;
memcpy(gVertexBuffer, input->xyz[input->indexes[i]], sizeof(vec3_t));
gVertexBuffer += 3;
}
vglColorPointerMapped(GL_FLOAT, colorbuf);
vglColorPointerMapped(GL_UNSIGNED_BYTE, colorbuf);
vglTexCoordPointerMapped(texcoord);
vglVertexPointerMapped(vertices);
......@@ -1085,18 +1085,18 @@ void RB_StageIteratorLightmappedMultitexture( void ) {
qglEnableClientState( GL_COLOR_ARRAY );
int i;
float *vertices = gVertexBuffer;
float *colorbuf = gColorBuffer;
uint8_t *colorbuf = gColorBuffer;
for (i = 0 ; i < input->numIndexes ; i++) {
memcpy(gVertexBuffer, input->xyz[input->indexes[i]], sizeof(vec3_t));
gVertexBuffer += 3;
gColorBuffer[0] = 1.0f;
gColorBuffer[1] = 1.0f;
gColorBuffer[2] = 1.0f;
gColorBuffer[3] = 1.0f;
gColorBuffer[0] = 255;
gColorBuffer[1] = 255;
gColorBuffer[2] = 255;
gColorBuffer[3] = 255;
gColorBuffer += 4;
}
vglVertexPointerMapped(vertices);
vglColorPointerMapped(GL_FLOAT, colorbuf);
vglColorPointerMapped(GL_UNSIGNED_BYTE, colorbuf);
//
// select base stage
......
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