mirror of
https://github.com/UberGames/lilium-voyager.git
synced 2024-11-10 06:31:47 +00:00
OpenGL2: Remove half float support.
Not enough accuracy for textures larger than 1024x1024, such as merged lightmaps.
This commit is contained in:
parent
863adfcfc2
commit
41ae7815c9
7 changed files with 44 additions and 131 deletions
|
@ -454,7 +454,7 @@ static void R_LoadLightmaps( lump_t *l, lump_t *surfs ) {
|
|||
}
|
||||
|
||||
if (r_mergeLightmaps->integer)
|
||||
R_UpdateSubImage(tr.lightmaps[lightmapnum], image, xoff, yoff, tr.lightmapSize, tr.lightmapSize);
|
||||
R_UpdateSubImage(tr.lightmaps[lightmapnum], image, xoff, yoff, tr.lightmapSize, tr.lightmapSize, textureInternalFormat);
|
||||
else
|
||||
tr.lightmaps[i] = R_CreateImage(va("*lightmap%d", i), image, tr.lightmapSize, tr.lightmapSize, IMGTYPE_COLORALPHA, imgFlags, textureInternalFormat );
|
||||
|
||||
|
@ -483,7 +483,7 @@ static void R_LoadLightmaps( lump_t *l, lump_t *surfs ) {
|
|||
}
|
||||
|
||||
if (r_mergeLightmaps->integer)
|
||||
R_UpdateSubImage(tr.deluxemaps[lightmapnum], image, xoff, yoff, tr.lightmapSize, tr.lightmapSize );
|
||||
R_UpdateSubImage(tr.deluxemaps[lightmapnum], image, xoff, yoff, tr.lightmapSize, tr.lightmapSize, GL_RGBA8 );
|
||||
else
|
||||
tr.deluxemaps[i] = R_CreateImage(va("*deluxemap%d", i), image, tr.lightmapSize, tr.lightmapSize, IMGTYPE_DELUXE, imgFlags, 0 );
|
||||
}
|
||||
|
|
|
@ -166,20 +166,6 @@ void GLimp_InitExtraExtensions()
|
|||
ri.Printf(PRINT_ALL, result[2], extension);
|
||||
}
|
||||
|
||||
// GL_ARB_half_float_pixel
|
||||
extension = "GL_ARB_half_float_pixel";
|
||||
glRefConfig.halfFloatPixel = qfalse;
|
||||
if( GLimp_HaveExtension( extension ) )
|
||||
{
|
||||
glRefConfig.halfFloatPixel = !!r_arb_half_float_pixel->integer;
|
||||
|
||||
ri.Printf(PRINT_ALL, result[glRefConfig.halfFloatPixel], extension);
|
||||
}
|
||||
else
|
||||
{
|
||||
ri.Printf(PRINT_ALL, result[2], extension);
|
||||
}
|
||||
|
||||
// GL_EXT_framebuffer_object
|
||||
extension = "GL_EXT_framebuffer_object";
|
||||
glRefConfig.framebufferObject = qfalse;
|
||||
|
@ -311,27 +297,6 @@ void GLimp_InitExtraExtensions()
|
|||
ri.Printf(PRINT_ALL, result[2], extension);
|
||||
}
|
||||
|
||||
// GL_ARB_half_float_vertex
|
||||
extension = "GL_ARB_half_float_vertex";
|
||||
glRefConfig.packedTexcoordDataType = GL_FLOAT;
|
||||
glRefConfig.packedTexcoordDataSize = sizeof(float) * 2;
|
||||
if( GLimp_HaveExtension( extension ) )
|
||||
{
|
||||
qboolean useExt = !!r_arb_half_float_vertex->integer;
|
||||
|
||||
if (useExt)
|
||||
{
|
||||
glRefConfig.packedTexcoordDataType = GL_HALF_FLOAT;
|
||||
glRefConfig.packedTexcoordDataSize = sizeof(uint16_t) * 2;
|
||||
}
|
||||
|
||||
ri.Printf(PRINT_ALL, result[useExt], extension);
|
||||
}
|
||||
else
|
||||
{
|
||||
ri.Printf(PRINT_ALL, result[2], extension);
|
||||
}
|
||||
|
||||
// GL_EXT_direct_state_access
|
||||
extension = "GL_EXT_direct_state_access";
|
||||
glRefConfig.directStateAccess = qfalse;
|
||||
|
|
|
@ -1921,6 +1921,9 @@ static int CalculateMipSize(int width, int height, GLenum picFormat)
|
|||
case GL_SRGB8_ALPHA8_EXT:
|
||||
return numPixels * 4;
|
||||
|
||||
case GL_RGBA16:
|
||||
return numPixels * 8;
|
||||
|
||||
default:
|
||||
ri.Printf(PRINT_ALL, "Unsupported texture format %08x\n", picFormat);
|
||||
return 0;
|
||||
|
@ -1948,29 +1951,15 @@ static GLenum PixelDataFormatFromInternalFormat(GLenum internalFormat)
|
|||
static void RawImage_UploadTexture(GLuint texture, byte *data, int x, int y, int width, int height, GLenum target, GLenum picFormat, int numMips, GLenum internalFormat, imgType_t type, imgFlags_t flags, qboolean subtexture )
|
||||
{
|
||||
GLenum dataFormat, dataType;
|
||||
qboolean rgtc = (internalFormat == GL_COMPRESSED_RG_RGTC2);
|
||||
qboolean compressed = (!(picFormat == GL_RGBA8) || (picFormat == GL_SRGB8_ALPHA8_EXT));
|
||||
qboolean rgtc = internalFormat == GL_COMPRESSED_RG_RGTC2;
|
||||
qboolean rgba8 = picFormat == GL_RGBA8 || picFormat == GL_SRGB8_ALPHA8_EXT;
|
||||
qboolean rgba = rgba8 || picFormat == GL_RGBA16;
|
||||
qboolean mipmap = !!(flags & IMGFLAG_MIPMAP);
|
||||
int size, miplevel;
|
||||
qboolean lastMip = qfalse;
|
||||
|
||||
dataFormat = PixelDataFormatFromInternalFormat(internalFormat);
|
||||
|
||||
// FIXME: This is an old hack to use half floats with lightmaps, use picFormat to determine this instead.
|
||||
switch (internalFormat)
|
||||
{
|
||||
case GL_RGBA16F_ARB:
|
||||
dataType = GL_HALF_FLOAT_ARB;
|
||||
break;
|
||||
|
||||
case GL_RGBA16:
|
||||
dataType = GL_UNSIGNED_SHORT;
|
||||
break;
|
||||
|
||||
default:
|
||||
dataType = GL_UNSIGNED_BYTE;
|
||||
break;
|
||||
}
|
||||
dataType = picFormat == GL_RGBA16 ? GL_UNSIGNED_SHORT : GL_UNSIGNED_BYTE;
|
||||
|
||||
miplevel = 0;
|
||||
do
|
||||
|
@ -1978,21 +1967,21 @@ static void RawImage_UploadTexture(GLuint texture, byte *data, int x, int y, int
|
|||
lastMip = (width == 1 && height == 1) || !mipmap;
|
||||
size = CalculateMipSize(width, height, picFormat);
|
||||
|
||||
if (compressed)
|
||||
if (!rgba)
|
||||
{
|
||||
qglCompressedTextureSubImage2DEXT(texture, target, miplevel, x, y, width, height, picFormat, size, data);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (miplevel != 0 && r_colorMipLevels->integer)
|
||||
if (rgba8 && miplevel != 0 && r_colorMipLevels->integer)
|
||||
R_BlendOverTexture((byte *)data, width * height, mipBlendColors[miplevel]);
|
||||
|
||||
if (rgtc)
|
||||
if (rgba8 && rgtc)
|
||||
RawImage_UploadToRgtc2Texture(texture, miplevel, x, y, width, height, data);
|
||||
else
|
||||
qglTextureSubImage2DEXT(texture, target, miplevel, x, y, width, height, dataFormat, dataType, data);
|
||||
|
||||
if (!lastMip && numMips < 2)
|
||||
if (rgba8 && !lastMip && numMips < 2)
|
||||
{
|
||||
if (type == IMGTYPE_NORMAL || type == IMGTYPE_NORMALHEIGHT)
|
||||
R_MipMapNormalHeight(data, data, width, height, glRefConfig.swizzleNormalmap);
|
||||
|
@ -2031,12 +2020,12 @@ static void Upload32(byte *data, int x, int y, int width, int height, GLenum pic
|
|||
imgType_t type = image->type;
|
||||
imgFlags_t flags = image->flags;
|
||||
GLenum internalFormat = image->internalFormat;
|
||||
qboolean compressed = (picFormat != GL_RGBA8 && picFormat != GL_SRGB8_ALPHA8_EXT);
|
||||
qboolean mipmap = !!(flags & IMGFLAG_MIPMAP) && (!compressed || numMips > 1);
|
||||
qboolean rgba8 = picFormat == GL_RGBA8 || picFormat == GL_SRGB8_ALPHA8_EXT;
|
||||
qboolean mipmap = !!(flags & IMGFLAG_MIPMAP) && (rgba8 || numMips > 1);
|
||||
qboolean cubemap = !!(flags & IMGFLAG_CUBEMAP);
|
||||
|
||||
// These operations cannot be performed on pre-compressed images.
|
||||
if (!compressed && !cubemap)
|
||||
// These operations cannot be performed on non-rgba8 images.
|
||||
if (rgba8 && !cubemap)
|
||||
{
|
||||
c = width*height;
|
||||
scan = data;
|
||||
|
@ -2109,7 +2098,7 @@ image_t *R_CreateImage2( const char *name, byte *pic, int width, int height, GLe
|
|||
qboolean isLightmap = qfalse, scaled = qfalse;
|
||||
long hash;
|
||||
int glWrapClampMode, mipWidth, mipHeight, miplevel;
|
||||
qboolean compressed = (!(picFormat == GL_RGBA8) || (picFormat == GL_SRGB8_ALPHA8_EXT));
|
||||
qboolean rgba8 = picFormat == GL_RGBA8 || picFormat == GL_SRGB8_ALPHA8_EXT;
|
||||
qboolean mipmap = !!(flags & IMGFLAG_MIPMAP);
|
||||
qboolean cubemap = !!(flags & IMGFLAG_CUBEMAP);
|
||||
qboolean picmip = !!(flags & IMGFLAG_PICMIP);
|
||||
|
@ -2150,10 +2139,10 @@ image_t *R_CreateImage2( const char *name, byte *pic, int width, int height, GLe
|
|||
image->internalFormat = internalFormat;
|
||||
|
||||
// Possibly scale image before uploading.
|
||||
// if compressed and uploading an image, skip picmips.
|
||||
// if not rgba8 and uploading an image, skip picmips.
|
||||
if (!cubemap)
|
||||
{
|
||||
if (!compressed)
|
||||
if (rgba8)
|
||||
scaled = RawImage_ScaleToPower2(&pic, &width, &height, type, flags, &resampledBuffer);
|
||||
else if (pic && picmip)
|
||||
{
|
||||
|
@ -2255,9 +2244,9 @@ image_t *R_CreateImage(const char *name, byte *pic, int width, int height, imgTy
|
|||
}
|
||||
|
||||
|
||||
void R_UpdateSubImage( image_t *image, byte *pic, int x, int y, int width, int height )
|
||||
void R_UpdateSubImage( image_t *image, byte *pic, int x, int y, int width, int height, GLenum picFormat )
|
||||
{
|
||||
Upload32(pic, x, y, width, height, GL_RGBA8, 0, image, qfalse);
|
||||
Upload32(pic, x, y, width, height, picFormat, 0, image, qfalse);
|
||||
}
|
||||
|
||||
//===================================================================
|
||||
|
@ -2792,25 +2781,13 @@ void R_CreateBuiltinImages( void ) {
|
|||
tr.textureDepthImage = R_CreateImage("*texturedepth", NULL, PSHADOW_MAP_SIZE, PSHADOW_MAP_SIZE, IMGTYPE_COLORALPHA, IMGFLAG_NO_COMPRESSION | IMGFLAG_CLAMPTOEDGE, GL_DEPTH_COMPONENT24_ARB);
|
||||
|
||||
{
|
||||
unsigned short sdata[4];
|
||||
void *p;
|
||||
|
||||
if (hdrFormat == GL_RGBA16F_ARB)
|
||||
{
|
||||
sdata[0] = FloatToHalf(0.0f);
|
||||
sdata[1] = FloatToHalf(0.45f);
|
||||
sdata[2] = FloatToHalf(1.0f);
|
||||
sdata[3] = FloatToHalf(1.0f);
|
||||
p = &sdata[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
data[0][0][0] = 0;
|
||||
data[0][0][1] = 0.45f * 255;
|
||||
data[0][0][2] = 255;
|
||||
data[0][0][3] = 255;
|
||||
p = data;
|
||||
}
|
||||
data[0][0][0] = 0;
|
||||
data[0][0][1] = 0.45f * 255;
|
||||
data[0][0][2] = 255;
|
||||
data[0][0][3] = 255;
|
||||
p = data;
|
||||
|
||||
tr.calcLevelsImage = R_CreateImage("*calcLevels", p, 1, 1, IMGTYPE_COLORALPHA, IMGFLAG_NO_COMPRESSION | IMGFLAG_CLAMPTOEDGE, hdrFormat);
|
||||
tr.targetLevelsImage = R_CreateImage("*targetLevels", p, 1, 1, IMGTYPE_COLORALPHA, IMGFLAG_NO_COMPRESSION | IMGFLAG_CLAMPTOEDGE, hdrFormat);
|
||||
|
|
|
@ -102,8 +102,6 @@ cvar_t *r_ext_draw_range_elements;
|
|||
cvar_t *r_ext_multi_draw_arrays;
|
||||
cvar_t *r_ext_framebuffer_object;
|
||||
cvar_t *r_ext_texture_float;
|
||||
cvar_t *r_arb_half_float_pixel;
|
||||
cvar_t *r_arb_half_float_vertex;
|
||||
cvar_t *r_ext_framebuffer_multisample;
|
||||
cvar_t *r_arb_seamless_cube_map;
|
||||
cvar_t *r_arb_vertex_array_object;
|
||||
|
@ -1162,8 +1160,6 @@ void R_Register( void )
|
|||
r_ext_multi_draw_arrays = ri.Cvar_Get( "r_ext_multi_draw_arrays", "1", CVAR_ARCHIVE | CVAR_LATCH);
|
||||
r_ext_framebuffer_object = ri.Cvar_Get( "r_ext_framebuffer_object", "1", CVAR_ARCHIVE | CVAR_LATCH);
|
||||
r_ext_texture_float = ri.Cvar_Get( "r_ext_texture_float", "1", CVAR_ARCHIVE | CVAR_LATCH);
|
||||
r_arb_half_float_pixel = ri.Cvar_Get( "r_arb_half_float_pixel", "1", CVAR_ARCHIVE | CVAR_LATCH);
|
||||
r_arb_half_float_vertex = ri.Cvar_Get( "r_arb_half_float_vertex", "1", CVAR_ARCHIVE | CVAR_LATCH);
|
||||
r_ext_framebuffer_multisample = ri.Cvar_Get( "r_ext_framebuffer_multisample", "0", CVAR_ARCHIVE | CVAR_LATCH);
|
||||
r_arb_seamless_cube_map = ri.Cvar_Get( "r_arb_seamless_cube_map", "0", CVAR_ARCHIVE | CVAR_LATCH);
|
||||
r_arb_vertex_array_object = ri.Cvar_Get( "r_arb_vertex_array_object", "1", CVAR_ARCHIVE | CVAR_LATCH);
|
||||
|
|
|
@ -1388,7 +1388,6 @@ typedef struct {
|
|||
|
||||
qboolean textureNonPowerOfTwo;
|
||||
qboolean textureFloat;
|
||||
qboolean halfFloatPixel;
|
||||
textureCompressionRef_t textureCompression;
|
||||
qboolean swizzleNormalmap;
|
||||
|
||||
|
@ -1398,9 +1397,6 @@ typedef struct {
|
|||
qboolean depthClamp;
|
||||
qboolean seamlessCubeMap;
|
||||
|
||||
GLenum packedTexcoordDataType;
|
||||
int packedTexcoordDataSize;
|
||||
|
||||
qboolean vertexArrayObject;
|
||||
qboolean directStateAccess;
|
||||
} glRefConfig_t;
|
||||
|
@ -1696,8 +1692,6 @@ extern cvar_t *r_ext_draw_range_elements;
|
|||
extern cvar_t *r_ext_multi_draw_arrays;
|
||||
extern cvar_t *r_ext_framebuffer_object;
|
||||
extern cvar_t *r_ext_texture_float;
|
||||
extern cvar_t *r_arb_half_float_pixel;
|
||||
extern cvar_t *r_arb_half_float_vertex;
|
||||
extern cvar_t *r_ext_framebuffer_multisample;
|
||||
extern cvar_t *r_arb_seamless_cube_map;
|
||||
extern cvar_t *r_arb_vertex_array_object;
|
||||
|
@ -1924,7 +1918,7 @@ qboolean R_GetEntityToken( char *buffer, int size );
|
|||
model_t *R_AllocModel( void );
|
||||
|
||||
void R_Init( void );
|
||||
void R_UpdateSubImage( image_t *image, byte *pic, int x, int y, int width, int height );
|
||||
void R_UpdateSubImage( image_t *image, byte *pic, int x, int y, int width, int height, GLenum picFormat );
|
||||
|
||||
void R_SetColorMappings( void );
|
||||
void R_GammaCorrect( byte *buffer, int bufSize );
|
||||
|
@ -2157,7 +2151,6 @@ VERTEX BUFFER OBJECTS
|
|||
|
||||
void R_VaoPackTangent(int16_t *out, vec4_t v);
|
||||
void R_VaoPackNormal(int16_t *out, vec3_t v);
|
||||
int R_VaoPackTexCoord(byte *out, vec2_t st);
|
||||
void R_VaoPackColor(uint16_t *out, vec4_t c);
|
||||
void R_VaoUnpackTangent(vec4_t v, int16_t *pack);
|
||||
void R_VaoUnpackNormal(vec3_t v, int16_t *pack);
|
||||
|
|
|
@ -683,10 +683,10 @@ static qboolean R_LoadMD3(model_t * mod, int lod, void *buffer, int bufferSize,
|
|||
{
|
||||
// vertex animation, store texcoords first, then position/normal/tangents
|
||||
offset_st = 0;
|
||||
offset_xyz = surf->numVerts * glRefConfig.packedTexcoordDataSize;
|
||||
offset_xyz = surf->numVerts * sizeof(vec2_t);
|
||||
offset_normal = offset_xyz + sizeof(vec3_t);
|
||||
offset_tangent = offset_normal + sizeof(int16_t) * 4;
|
||||
stride_st = glRefConfig.packedTexcoordDataSize;
|
||||
stride_st = sizeof(vec2_t);
|
||||
stride_xyz = sizeof(vec3_t) + sizeof(int16_t) * 4;
|
||||
stride_xyz += sizeof(int16_t) * 4;
|
||||
stride_normal = stride_tangent = stride_xyz;
|
||||
|
@ -698,7 +698,7 @@ static qboolean R_LoadMD3(model_t * mod, int lod, void *buffer, int bufferSize,
|
|||
// no animation, interleave everything
|
||||
offset_xyz = 0;
|
||||
offset_st = offset_xyz + sizeof(vec3_t);
|
||||
offset_normal = offset_st + glRefConfig.packedTexcoordDataSize;
|
||||
offset_normal = offset_st + sizeof(vec2_t);
|
||||
offset_tangent = offset_normal + sizeof(int16_t) * 4;
|
||||
stride_xyz = offset_tangent + sizeof(int16_t) * 4;
|
||||
stride_st = stride_normal = stride_tangent = stride_xyz;
|
||||
|
@ -714,7 +714,8 @@ static qboolean R_LoadMD3(model_t * mod, int lod, void *buffer, int bufferSize,
|
|||
{
|
||||
st = surf->st;
|
||||
for ( j = 0 ; j < surf->numVerts ; j++, st++ ) {
|
||||
dataOfs += R_VaoPackTexCoord(data + dataOfs, st->st);
|
||||
memcpy(data + dataOfs, &st->st, sizeof(vec2_t));
|
||||
dataOfs += sizeof(st->st);
|
||||
}
|
||||
|
||||
v = surf->verts;
|
||||
|
@ -744,7 +745,8 @@ static qboolean R_LoadMD3(model_t * mod, int lod, void *buffer, int bufferSize,
|
|||
dataOfs += sizeof(v->xyz);
|
||||
|
||||
// st
|
||||
dataOfs += R_VaoPackTexCoord(data + dataOfs, st->st);
|
||||
memcpy(data + dataOfs, &st->st, sizeof(vec2_t));
|
||||
dataOfs += sizeof(st->st);
|
||||
|
||||
// normal
|
||||
memcpy(data + dataOfs, &v->normal, sizeof(int16_t) * 4);
|
||||
|
@ -778,7 +780,7 @@ static qboolean R_LoadMD3(model_t * mod, int lod, void *buffer, int bufferSize,
|
|||
vaoSurf->vao->attribs[ATTR_INDEX_TANGENT ].count = 4;
|
||||
|
||||
vaoSurf->vao->attribs[ATTR_INDEX_POSITION].type = GL_FLOAT;
|
||||
vaoSurf->vao->attribs[ATTR_INDEX_TEXCOORD].type = glRefConfig.packedTexcoordDataType;
|
||||
vaoSurf->vao->attribs[ATTR_INDEX_TEXCOORD].type = GL_FLOAT;
|
||||
vaoSurf->vao->attribs[ATTR_INDEX_NORMAL ].type = GL_SHORT;
|
||||
vaoSurf->vao->attribs[ATTR_INDEX_TANGENT ].type = GL_SHORT;
|
||||
|
||||
|
|
|
@ -39,28 +39,6 @@ void R_VaoPackNormal(int16_t *out, vec3_t v)
|
|||
out[3] = 0;
|
||||
}
|
||||
|
||||
int R_VaoPackTexCoord(byte *out, vec2_t st)
|
||||
{
|
||||
if (glRefConfig.packedTexcoordDataType == GL_HALF_FLOAT)
|
||||
{
|
||||
uint16_t *num = (uint16_t *)out;
|
||||
|
||||
*num++ = FloatToHalf(st[0]);
|
||||
*num++ = FloatToHalf(st[1]);
|
||||
|
||||
return sizeof(*num) * 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
float *num = (float *)out;
|
||||
|
||||
*num++ = st[0];
|
||||
*num++ = st[1];
|
||||
|
||||
return sizeof(*num) * 2;
|
||||
}
|
||||
}
|
||||
|
||||
void R_VaoPackColor(uint16_t *out, vec4_t c)
|
||||
{
|
||||
out[0] = c[0] * 65535.0f + 0.5f;
|
||||
|
@ -247,8 +225,8 @@ vao_t *R_CreateVao2(const char *name, int numVertexes, srfVert_t *verts, int num
|
|||
vao->attribs[ATTR_INDEX_POSITION ].type = GL_FLOAT;
|
||||
vao->attribs[ATTR_INDEX_NORMAL ].type = GL_SHORT;
|
||||
vao->attribs[ATTR_INDEX_TANGENT ].type = GL_SHORT;
|
||||
vao->attribs[ATTR_INDEX_TEXCOORD ].type = glRefConfig.packedTexcoordDataType;
|
||||
vao->attribs[ATTR_INDEX_LIGHTCOORD ].type = glRefConfig.packedTexcoordDataType;
|
||||
vao->attribs[ATTR_INDEX_TEXCOORD ].type = GL_FLOAT;
|
||||
vao->attribs[ATTR_INDEX_LIGHTCOORD ].type = GL_FLOAT;
|
||||
vao->attribs[ATTR_INDEX_COLOR ].type = GL_UNSIGNED_SHORT;
|
||||
vao->attribs[ATTR_INDEX_LIGHTDIRECTION].type = GL_SHORT;
|
||||
|
||||
|
@ -263,8 +241,8 @@ vao_t *R_CreateVao2(const char *name, int numVertexes, srfVert_t *verts, int num
|
|||
vao->attribs[ATTR_INDEX_POSITION ].offset = 0; dataSize = sizeof(verts[0].xyz);
|
||||
vao->attribs[ATTR_INDEX_NORMAL ].offset = dataSize; dataSize += sizeof(verts[0].normal);
|
||||
vao->attribs[ATTR_INDEX_TANGENT ].offset = dataSize; dataSize += sizeof(verts[0].tangent);
|
||||
vao->attribs[ATTR_INDEX_TEXCOORD ].offset = dataSize; dataSize += glRefConfig.packedTexcoordDataSize;
|
||||
vao->attribs[ATTR_INDEX_LIGHTCOORD ].offset = dataSize; dataSize += glRefConfig.packedTexcoordDataSize;
|
||||
vao->attribs[ATTR_INDEX_TEXCOORD ].offset = dataSize; dataSize += sizeof(verts[0].st);
|
||||
vao->attribs[ATTR_INDEX_LIGHTCOORD ].offset = dataSize; dataSize += sizeof(verts[0].lightmap);
|
||||
vao->attribs[ATTR_INDEX_COLOR ].offset = dataSize; dataSize += sizeof(verts[0].color);
|
||||
vao->attribs[ATTR_INDEX_LIGHTDIRECTION].offset = dataSize; dataSize += sizeof(verts[0].lightdir);
|
||||
|
||||
|
@ -304,10 +282,12 @@ vao_t *R_CreateVao2(const char *name, int numVertexes, srfVert_t *verts, int num
|
|||
dataOfs += sizeof(verts[i].tangent);
|
||||
|
||||
// texcoords
|
||||
dataOfs += R_VaoPackTexCoord(data + dataOfs, verts[i].st);
|
||||
memcpy(data + dataOfs, &verts[i].st, sizeof(verts[i].st));
|
||||
dataOfs += sizeof(verts[i].st);
|
||||
|
||||
// lightmap texcoords
|
||||
dataOfs += R_VaoPackTexCoord(data + dataOfs, verts[i].lightmap);
|
||||
memcpy(data + dataOfs, &verts[i].lightmap, sizeof(verts[i].lightmap));
|
||||
dataOfs += sizeof(verts[i].lightmap);
|
||||
|
||||
// colors
|
||||
memcpy(data + dataOfs, &verts[i].color, sizeof(verts[i].color));
|
||||
|
|
Loading…
Reference in a new issue