/* =============== R_Init =============== */ void R_Init( void ) { int err; int i; byte *ptr; ri.Printf( PRINT_ALL, "----- R_Init -----\n" ); // clear all our internal state memset( &tr, 0, sizeof( tr ) ); memset( &backEnd, 0, sizeof( backEnd ) ); memset( &tess, 0, sizeof( tess ) ); if(sizeof(glconfig_t) != 7268) ri.Error( ERR_FATAL, "Mod ABI incompatible: sizeof(glconfig_t) == %u != 7268", (unsigned int) sizeof(glconfig_t)); // Swap_Init(); if ( (intptr_t)tess.xyz & 15 ) { ri.Printf( PRINT_WARNING, "tess.xyz not 16 byte aligned\n" ); } memset( tess.constantColor255, 255, sizeof( tess.constantColor255 ) ); // // init function tables // for ( i = 0; i < FUNCTABLE_SIZE; i++ ) { tr.sinTable[i] = sin( DEG2RAD( i * 360.0f / ( ( float ) ( FUNCTABLE_SIZE - 1 ) ) ) ); tr.squareTable[i] = ( i < FUNCTABLE_SIZE / 2 ) ? 1.0f : -1.0f; tr.sawToothTable[i] = (float)i / FUNCTABLE_SIZE; tr.inverseSawToothTable[i] = 1.0f - tr.sawToothTable[i]; if ( i < FUNCTABLE_SIZE / 2 ) { if ( i < FUNCTABLE_SIZE / 4 ) { tr.triangleTable[i] = ( float ) i / ( FUNCTABLE_SIZE / 4 ); } else { tr.triangleTable[i] = 1.0f - tr.triangleTable[i - FUNCTABLE_SIZE / 4]; } } else { tr.triangleTable[i] = -tr.triangleTable[i - FUNCTABLE_SIZE / 2]; } } // Ridah, init the virtual memory R_Hunk_Begin(); R_InitFogTable(); R_NoiseInit(); R_Register(); #ifdef USE_BLOOM R_BloomInit(); #endif max_polys = r_maxpolys->integer; if ( max_polys < MAX_POLYS ) { max_polys = MAX_POLYS; } max_polyverts = r_maxpolyverts->integer; if ( max_polyverts < MAX_POLYVERTS ) { max_polyverts = MAX_POLYVERTS; } ptr = ri.Hunk_Alloc( sizeof( *backEndData ) + sizeof(srfPoly_t) * max_polys + sizeof(polyVert_t) * max_polyverts, h_low); backEndData = (backEndData_t *) ptr; backEndData->polys = (srfPoly_t *) ((char *) ptr + sizeof( *backEndData )); backEndData->polyVerts = (polyVert_t *) ((char *) ptr + sizeof( *backEndData ) + sizeof(srfPoly_t) * max_polys); R_InitNextFrame(); InitOpenGL(); R_InitImages(); R_InitShaders(); R_InitSkins(); R_ModelInit(); R_InitFreeType(); err = qglGetError(); if ( err != GL_NO_ERROR ) { ri.Printf( PRINT_ALL, "glGetError() = 0x%x\n", err ); } ri.Printf( PRINT_ALL, "----- finished R_Init -----\n" ); }
/* =============== R_Init =============== */ void R_Init( void ) { int i; ri.Printf( PRINT_DEVELOPER, "----- R_Init -----\n" ); // clear all our internal state memset( &tr, 0, sizeof( tr ) ); memset( &backEnd, 0, sizeof( backEnd ) ); memset( &tess, 0, sizeof( tess ) ); tess.xyz = tess_xyz; tess.texCoords0 = tess_texCoords0; tess.texCoords1 = tess_texCoords1; tess.indexes = tess_indexes; tess.normal = tess_normal; tess.vertexColors = tess_vertexColors; tess.maxShaderVerts = SHADER_MAX_VERTEXES; tess.maxShaderIndicies = SHADER_MAX_INDEXES; if ( ( intptr_t ) tess.xyz & 15 ) { Com_DPrintf( "WARNING: tess.xyz not 16 byte aligned\n" ); } memset( tess.constantColor255, 255, sizeof( tess.constantColor255 ) ); // // init function tables // for ( i = 0; i < FUNCTABLE_SIZE; i++ ) { tr.sinTable[ i ] = sin( DEG2RAD( i * 360.0f / ( ( float )( FUNCTABLE_SIZE - 1 ) ) ) ); tr.squareTable[ i ] = ( i < FUNCTABLE_SIZE / 2 ) ? 1.0f : -1.0f; tr.sawToothTable[ i ] = ( float ) i / FUNCTABLE_SIZE; tr.inverseSawToothTable[ i ] = 1.0f - tr.sawToothTable[ i ]; if ( i < FUNCTABLE_SIZE / 2 ) { if ( i < FUNCTABLE_SIZE / 4 ) { tr.triangleTable[ i ] = ( float ) i / ( FUNCTABLE_SIZE / 4 ); } else { tr.triangleTable[ i ] = 1.0f - tr.triangleTable[ i - FUNCTABLE_SIZE / 4 ]; } } else { tr.triangleTable[ i ] = -tr.triangleTable[ i - FUNCTABLE_SIZE / 2 ]; } } // Ridah, init the virtual memory R_Hunk_Begin(); R_InitFogTable(); R_NoiseInit(); R_Register(); max_polys = r_maxpolys->integer; if ( max_polys < MAX_POLYS ) { max_polys = MAX_POLYS; } max_polyverts = r_maxpolyverts->integer; if ( max_polyverts < MAX_POLYVERTS ) { max_polyverts = MAX_POLYVERTS; } // backEndData[0] = ri.Hunk_Alloc( sizeof( *backEndData[0] ), h_low ); backEndData[ 0 ] = ri.Hunk_Alloc( sizeof( *backEndData[ 0 ] ) + sizeof( srfPoly_t ) * max_polys + sizeof( polyVert_t ) * max_polyverts, h_low ); if ( r_smp->integer ) { // backEndData[1] = ri.Hunk_Alloc( sizeof( *backEndData[1] ), h_low ); backEndData[ 1 ] = ri.Hunk_Alloc( sizeof( *backEndData[ 1 ] ) + sizeof( srfPoly_t ) * max_polys + sizeof( polyVert_t ) * max_polyverts, h_low ); } else { backEndData[ 1 ] = NULL; } R_ToggleSmpFrame(); InitOpenGL(); R_InitImages(); R_InitShaders(); R_InitSkins(); R_ModelInit(); #if defined( USE_REFENTITY_ANIMATIONSYSTEM ) R_InitAnimations(); #endif R_InitFreeType(); GL_CheckErrors(); // print info GfxInfo_f(); ri.Printf( PRINT_DEVELOPER, "----- finished R_Init -----\n" ); }
/* =============== R_Init =============== */ void R_Init( void ) { int err; int i; ri.Printf( PRINT_ALL, "----- R_Init -----\n" ); // clear all our internal state memset( &tr, 0, sizeof( tr ) ); memset( &backEnd, 0, sizeof( backEnd ) ); memset( &tess, 0, sizeof( tess ) ); Swap_Init(); if ( (intptr_t)tess.xyz & 15 ) { Com_Printf( "WARNING: tess.xyz not 16 byte aligned\n" ); } memset( tess.constantColor255, 255, sizeof( tess.constantColor255 ) ); // // init function tables // for ( i = 0; i < FUNCTABLE_SIZE; i++ ) { tr.sinTable[i] = sin( DEG2RAD( i * 360.0f / ( ( float ) ( FUNCTABLE_SIZE - 1 ) ) ) ); tr.squareTable[i] = ( i < FUNCTABLE_SIZE / 2 ) ? 1.0f : -1.0f; tr.sawToothTable[i] = (float)i / FUNCTABLE_SIZE; tr.inverseSawToothTable[i] = 1.0f - tr.sawToothTable[i]; if ( i < FUNCTABLE_SIZE / 2 ) { if ( i < FUNCTABLE_SIZE / 4 ) { tr.triangleTable[i] = ( float ) i / ( FUNCTABLE_SIZE / 4 ); } else { tr.triangleTable[i] = 1.0f - tr.triangleTable[i - FUNCTABLE_SIZE / 4]; } } else { tr.triangleTable[i] = -tr.triangleTable[i - FUNCTABLE_SIZE / 2]; } } R_InitFogTable(); R_NoiseInit(); R_Register(); // Ridah, init the virtual memory R_Hunk_Begin(); max_polys = r_maxpolys->integer; if ( max_polys < MAX_POLYS ) { max_polys = MAX_POLYS; } max_polyverts = r_maxpolyverts->integer; if ( max_polyverts < MAX_POLYVERTS ) { max_polyverts = MAX_POLYVERTS; } // backEndData[0] = ri.Hunk_Alloc( sizeof( *backEndData[0] ), h_low ); backEndData[0] = ri.Hunk_Alloc( sizeof( *backEndData[0] ) + sizeof( srfPoly_t ) * max_polys + sizeof( polyVert_t ) * max_polyverts, h_low ); if ( r_smp->integer ) { // backEndData[1] = ri.Hunk_Alloc( sizeof( *backEndData[1] ), h_low ); backEndData[1] = ri.Hunk_Alloc( sizeof( *backEndData[1] ) + sizeof( srfPoly_t ) * max_polys + sizeof( polyVert_t ) * max_polyverts, h_low ); } else { backEndData[1] = NULL; } R_ToggleSmpFrame(); InitOpenGL(); R_InitImages(); R_InitShaders(); R_InitSkins(); R_ModelInit(); R_InitFreeType(); RB_ZombieFXInit(); err = qglGetError(); if ( err != GL_NO_ERROR ) { ri.Printf( PRINT_ALL, "glGetError() = 0x%x\n", err ); } ri.Printf( PRINT_ALL, "----- finished R_Init -----\n" ); }
/* =============== R_Init =============== */ void R_Init(void) { int err; int i; byte *ptr; ri.Printf(PRINT_ALL, "----- R_Init -----\n"); // clear all our internal state Com_Memset(&tr, 0, sizeof(tr)); Com_Memset(&backEnd, 0, sizeof(backEnd)); Com_Memset(&tess, 0, sizeof(tess)); tess.xyz = tess_xyz; tess.texCoords0 = tess_texCoords0; tess.texCoords1 = tess_texCoords1; tess.indexes = tess_indexes; tess.normal = tess_normal; tess.vertexColors = tess_vertexColors; tess.maxShaderVerts = SHADER_MAX_VERTEXES; tess.maxShaderIndicies = SHADER_MAX_INDEXES; if ((intptr_t) tess.xyz & 15) { ri.Printf(PRINT_WARNING, "tess.xyz not 16 byte aligned\n"); } Com_Memset(tess.constantColor255, 255, sizeof(tess.constantColor255)); // init function tables for (i = 0; i < FUNCTABLE_SIZE; i++) { tr.sinTable[i] = sin(DEG2RAD(i * 360.0f / (( float ) (FUNCTABLE_SIZE - 1)))); tr.squareTable[i] = (i < FUNCTABLE_SIZE / 2) ? 1.0f : -1.0f; tr.sawToothTable[i] = ( float ) i / FUNCTABLE_SIZE; tr.inverseSawToothTable[i] = 1.0f - tr.sawToothTable[i]; if (i < FUNCTABLE_SIZE / 2) { if (i < FUNCTABLE_SIZE / 4) { tr.triangleTable[i] = ( float ) i / (FUNCTABLE_SIZE / 4); } else { tr.triangleTable[i] = 1.0f - tr.triangleTable[i - FUNCTABLE_SIZE / 4]; } } else { tr.triangleTable[i] = -tr.triangleTable[i - FUNCTABLE_SIZE / 2]; } } // init the virtual memory R_Hunk_Begin(); R_NoiseInit(); R_Register(); ptr = ri.Hunk_Alloc(sizeof(*backEndData) + sizeof(srfPoly_t) * r_maxpolys->integer + sizeof(polyVert_t) * r_maxpolyverts->integer, h_low); backEndData = (backEndData_t *) ptr; backEndData->polys = (srfPoly_t *) ((char *) ptr + sizeof(*backEndData)); backEndData->polyVerts = (polyVert_t *) ((char *) ptr + sizeof(*backEndData) + sizeof(srfPoly_t) * r_maxpolys->integer); R_InitNextFrame(); InitOpenGL(); R_InitImages(); R_InitShaders(); R_InitSkins(); R_ModelInit(); R_InitFreeType(); err = qglGetError(); if (err != GL_NO_ERROR) { ri.Printf(PRINT_ALL, "glGetError() = 0x%x\n", err); } ri.Printf(PRINT_ALL, "----- finished R_Init -----\n"); }
/** * @brief R_Init */ void R_Init(void) { int err; int i; byte *ptr; Ren_Print("----- R_Init -----\n"); // clear all our internal state Com_Memset(&tr, 0, sizeof(tr)); Com_Memset(&backEnd, 0, sizeof(backEnd)); Com_Memset(&tess, 0, sizeof(tess)); if ((intptr_t) tess.xyz & 15) { Ren_Warning("tess.xyz not 16 byte aligned\n"); } Com_Memset(tess.constantColor255, 255, sizeof(tess.constantColor255)); // init function tables for (i = 0; i < FUNCTABLE_SIZE; i++) { tr.sinTable[i] = sin(DEG2RAD(i * 360.0f / (( float ) (FUNCTABLE_SIZE - 1)))); tr.squareTable[i] = (i < FUNCTABLE_SIZE / 2) ? 1.0f : -1.0f; tr.sawToothTable[i] = ( float ) i / FUNCTABLE_SIZE; tr.inverseSawToothTable[i] = 1.0f - tr.sawToothTable[i]; if (i < FUNCTABLE_SIZE / 2) { if (i < FUNCTABLE_SIZE / 4) { tr.triangleTable[i] = ( float ) i / (FUNCTABLE_SIZE / 4); } else { tr.triangleTable[i] = 1.0f - tr.triangleTable[i - FUNCTABLE_SIZE / 4]; } } else { tr.triangleTable[i] = -tr.triangleTable[i - FUNCTABLE_SIZE / 2]; } } // init the virtual memory R_Hunk_Begin(); R_NoiseInit(); R_Register(); ptr = ri.Hunk_Alloc(sizeof(*backEndData) + sizeof(srfPoly_t) * r_maxPolys->integer + sizeof(polyVert_t) * r_maxPolyVerts->integer, h_low); backEndData = (backEndData_t *) ptr; backEndData->polys = (srfPoly_t *) ((char *) ptr + sizeof(*backEndData)); backEndData->polyVerts = (polyVert_t *) ((char *) ptr + sizeof(*backEndData) + sizeof(srfPoly_t) * r_maxPolys->integer); R_InitNextFrame(); InitOpenGL(); R_InitImages(); R_InitShaders(); R_InitSkins(); R_ModelInit(); R_InitFreeType(); err = qglGetError(); if (err != GL_NO_ERROR) { Ren_Print("R_Init: glGetError() = 0x%x\n", err); } Ren_Print("----- finished R_Init -----\n"); }