Permalink
Browse files

Revert "R2: Start of rendering sky"

This reverts commit bc42925.
  • Loading branch information...
thunderpwn committed Nov 11, 2017
1 parent bc42925 commit 20a574a0965db6da30df6d7160af204d33aab0f5
@@ -103,7 +103,7 @@ skybox
{
filename "skybox"
macros USE_PORTAL_CLIPPING
attribs ATTR_POSITION ATTR_TEXCOORD ATTR_COLOR
attribs ATTR_POSITION
}
fogQuake3
@@ -1,12 +1,10 @@
/* skybox_fp.glsl */
//uniform samplerCube u_ColorMap;
uniform sampler2D u_ColorMap;
uniform samplerCube u_ColorMap;
uniform vec3 u_ViewOrigin;
uniform vec4 u_PortalPlane;
varying vec2 var_Tex;
varying vec3 var_Position;
//varying vec4 var_Color;
varying vec3 var_Position;
void main()
{
@@ -23,9 +21,8 @@ void main()
// compute incident ray
vec3 I = normalize(var_Position - u_ViewOrigin);
vec4 color = texture2D(u_ColorMap, var_Tex);
//vec4 color = textureCube(u_ColorMap, I).rgba;
//vec4 color = textureCube(u_ColorMap, var_Tex);
//color *= var_Color;
vec4 color = textureCube(u_ColorMap, I).rgba;
gl_FragColor = color;
}
@@ -1,17 +1,11 @@
/* skybox_vp.glsl */
attribute vec4 attr_Position;
attribute vec4 attr_TexCoord0;
attribute vec4 attr_Color;
varying vec2 var_Tex;
uniform vec3 u_ViewOrigin;
uniform mat4 u_ColorTextureMatrix;
uniform mat4 u_ModelMatrix;
uniform mat4 u_ModelViewProjectionMatrix;
vec4 texCoord;
varying vec3 var_Position;
uniform vec4 u_Color;
//varying vec4 var_Color;
void main()
{
@@ -20,10 +14,4 @@ void main()
// transform position into world space
var_Position = (u_ModelMatrix * attr_Position).xyz;
texCoord = attr_TexCoord0;
var_Tex = (u_ColorTextureMatrix * texCoord).st;
//var_Color = attr_Color + u_Color;
}
@@ -318,7 +318,7 @@ static void RB_RenderDrawSurfaces(qboolean opaque, int drawSurfFilter)
/*
* @brief RB_RenderOpaqueSurfacesIntoDepth
* @note Unused*/
* @note Unused
static void RB_RenderOpaqueSurfacesIntoDepth(qboolean onlyWorld)
{
trRefEntity_t *entity, *oldEntity;
@@ -455,7 +455,7 @@ static void RB_RenderOpaqueSurfacesIntoDepth(qboolean onlyWorld)
GL_CheckErrors();
}
*/
// *INDENT-OFF*
/**
@@ -5892,8 +5892,6 @@ static void RB_RenderViewFront(void)
// world fog requests a screen clear (distance fog rather than quake sky)
clearBits |= GL_COLOR_BUFFER_BIT;
}
//put it on
R_CopyToFBO(NULL, tr.SkyRenderFBO, GL_COLOR_BUFFER_BIT, GL_NEAREST);
}
}
@@ -5931,7 +5929,7 @@ static void RB_RenderViewFront(void)
if (r_dynamicEntityOcclusionCulling->integer)
{
// draw everything from world that is opaque into black so we can benefit from early-z rejections later
RB_RenderOpaqueSurfacesIntoDepth(qtrue);
//RB_RenderOpaqueSurfacesIntoDepth(true);
RB_RenderDrawSurfaces(qtrue, DRAWSURFACES_WORLD_ONLY);
// try to cull entities using hardware occlusion queries
View
@@ -576,39 +576,7 @@ void R_InitFBOs(void)
// make sure the render thread is stopped
R_IssuePendingRenderCommands();
if(glConfig2.textureNPOTAvailable)
{
width = glConfig.vidWidth;
height = glConfig.vidHeight;
}
else
{
width = NearestPowerOfTwo(glConfig.vidWidth);
height = NearestPowerOfTwo(glConfig.vidHeight);
}
for (i = 0; i < 6; i++)
tr.SkyRenderFBO = R_CreateFBO(va("_SkyRenderFBO"), width, height);
R_BindFBO(tr.SkyRenderFBO);
{
R_CreateFBODepthBuffer(tr.SkyRenderFBO, GL_DEPTH_COMPONENT24_ARB);
R_AttachFBOTextureDepth(tr.depthRenderImage->texnum);
}
for (i = 0; i < 6; i++)
R_CreateFBOColorBuffer(tr.SkyRenderFBO, GL_RGBA, 0);
R_AttachFBOTexture2D(GL_TEXTURE_2D, tr.SkyRenderFBOImage[i]->texnum, 0);
R_CheckFBO(tr.SkyRenderFBO);
{
// forward shading
if (glConfig2.textureNPOTAvailable)
{
@@ -639,7 +607,7 @@ void R_InitFBOs(void)
R_AttachFBOTextureDepth(tr.depthRenderImage->texnum);
R_CheckFBO(tr.deferredRenderFBO);
}
if (glConfig2.framebufferBlitAvailable)
{
View
@@ -3134,25 +3134,6 @@ static void R_CreatePortalRenderImage(void)
}
}
/**
* @brief R_CreateSkyRenderFBOImage
*/
static void R_CreateSkyRenderFBOImage(void)
{
int i = 0;
for (i = 0; i < 6; i++)
if (r_hdrRendering->integer && glConfig2.textureFloatAvailable)
{
tr.SkyRenderFBOImage[i] = R_CreateRenderImageSize(va("_SkyRenderFBOImage", i), 2048, 2048,IF_RGBA16F, FT_NEAREST, WT_CLAMP);
}
else
{
tr.SkyRenderFBOImage[i] = R_CreateRenderImageSize(va("_SkyRenderFBOImage", i), 2048, 2048, IF_NOCOMPRESSION, FT_NEAREST, WT_CLAMP);
}
}
/**
* @brief R_CreateOcclusionRenderFBOImage
*/
@@ -3504,7 +3485,6 @@ void R_CreateBuiltinImages(void)
R_CreateRandomNormalsImage();
R_CreateFogImage();
R_CreateSkyRenderFBOImage();
R_CreateNoFalloffImage();
R_CreateAttenuationXYImage();
R_CreateContrastRenderFBOImage();
View
@@ -3521,7 +3521,7 @@ typedef struct
image_t *blackCubeImage;
image_t *whiteCubeImage;
image_t *autoCubeImage; ///< special pointer to the nearest cubemap probe
image_t *SkyRenderFBOImage[6]; //for sky
image_t *contrastRenderFBOImage;
image_t *bloomRenderFBOImage[2];
image_t *currentRenderImage;
@@ -3565,12 +3565,11 @@ typedef struct
FBO_t *bloomRenderFBO[2];
FBO_t *shadowMapFBO[MAX_SHADOWMAPS];
FBO_t *sunShadowMapFBO[MAX_SHADOWMAPS];
FBO_t *SkyRenderFBO; //for sky SHOULD THIS BE [6]?
// vertex buffer objects
VBO_t *unitCubeVBO;
IBO_t *unitCubeIBO;
VBO_t *SkyVBO; //for sky
IBO_t *SkyIBO;// for sky
// internal shaders
shader_t *defaultShader;
shader_t *defaultPointLightShader;
@@ -2936,7 +2936,7 @@ void ParseDeform(char **text)
Ren_Warning("WARNING: unknown deformVertexes subtype '%s' found in shader '%s'\n", token, shader.name);
}
const char *suf[6] = { "rt", "lf", "bk", "ft", "up", "dn" };
const char *suf[6] = { "rt", "bk", "lf", "ft", "up", "dn" };
/**
* @brief ParseSkyParms
@@ -2966,7 +2966,7 @@ void ParseSkyParms(char **text)
{
pathname = va("%s_%s.tga", buffer, suf[i]);
shader.sky.outerbox[i] = R_FindImageFile(pathname, IF_NONE, FT_DEFAULT, WT_EDGE_CLAMP, shader.name);
//tr.SkyRenderFBOImage = shader.sky.outerbox[i];
if (!shader.sky.outerbox[i])
{
Ren_Warning("WARNING: could not find image '%s' for outer skybox in shader '%s'\n", pathname, shader.name);
View
@@ -445,7 +445,6 @@ static void DrawSkySide(struct image_s *image, const int mins[2], const int maxs
int sWidth = maxs[0] - mins[0] + 1;
GL_SelectTexture(0);
GL_Bind(image);
for (t = mins[1] + HALF_SKY_SUBDIVISIONS; t <= maxs[1] + HALF_SKY_SUBDIVISIONS; t++)
@@ -676,8 +675,8 @@ static void DrawSkyBox(shader_t *shader, qboolean outerbox)
int sky_mins_subd[2], sky_maxs_subd[2];
int s, t;
sky_min = 1.0 / 256.0; // FIXME: not correct?
sky_max = 255.0 / 256.0;
sky_min = 0;
sky_max = 1;
Com_Memset(s_skyTexCoords, 0, sizeof(s_skyTexCoords));
@@ -763,11 +762,8 @@ static void DrawSkyBox(shader_t *shader, qboolean outerbox)
}
Tess_UpdateVBOs(tess.attribsSet);
//GL_Cull(CT_TWO_SIDED);
glDepthRange(1.0, 1.0);
Tess_DrawElements();
glDepthRange(0.0, 1.0);
}
/**
@@ -1103,33 +1099,25 @@ void Tess_StageIteratorSky(void)
// draw the outer skybox
if (tess.surfaceShader->sky.outerbox[0] && tess.surfaceShader->sky.outerbox[0] != tr.defaultImage)
{
R_BindVBO(tr.SkyVBO);
R_BindIBO(tr.SkyIBO);
R_BindVBO(tess.vbo);
R_BindIBO(tess.ibo);
SetMacrosAndSelectProgram(trProg.gl_skyboxShader, USE_PORTAL_CLIPPING, backEnd.viewParms.isPortal);
SetUniformVec3(UNIFORM_VIEWORIGIN, backEnd.viewParms.orientation.origin); // in world space
SetUniformMatrix16(UNIFORM_MODELMATRIX, backEnd.orientation.transformMatrix);
SetUniformMatrix16(UNIFORM_MODELVIEWPROJECTIONMATRIX, GLSTACK_MVPM);
SetUniformVec4(UNIFORM_COLOR, tess.svars.color);
//SetUniformMatrix16(UNIFORM_VIEWMATRIX, backEnd.viewParms.world.viewMatrix);
SetUniformMatrix16(UNIFORM_COLORTEXTUREMATRIX, tess.svars.texMatrices[TB_COLORMAP]);
// u_PortalPlane
if (backEnd.viewParms.isPortal)
{
// clipping plane in world space
clipPortalPlane();
}
SelectTexture(TEX_COLOR);
GL_Bind(tess.surfaceShader->sky.outerbox[0]);
GLSL_SetRequiredVertexPointers(trProg.gl_skyboxShader);
DrawSkyBox(tess.surfaceShader, qtrue);
GL_CheckErrors();
}
// generate the vertexes for all the clouds, which will be drawn
@@ -1144,8 +1132,8 @@ void Tess_StageIteratorSky(void)
// draw the inner skybox
if (tess.surfaceShader->sky.innerbox[0] && tess.surfaceShader->sky.innerbox[0] != tr.defaultImage)
{
R_BindVBO(tr.SkyVBO);
R_BindIBO(tr.SkyIBO);
R_BindVBO(tess.vbo);
R_BindIBO(tess.ibo);
SetMacrosAndSelectProgram(trProg.gl_skyboxShader, USE_PORTAL_CLIPPING, backEnd.viewParms.isPortal);
View
@@ -516,7 +516,7 @@ static void R_InitUnitCubeVBO()
tess.numIndexes = 0;
tess.numVertexes = 0;
Tess_AddCube(vec3_origin, mins, maxs, colorMdBlue);
Tess_AddCube(vec3_origin, mins, maxs, colorWhite);
verts = (srfVert_t *)ri.Hunk_AllocateTempMemory(tess.numVertexes * sizeof(srfVert_t));
triangles = (srfTriangle_t *)ri.Hunk_AllocateTempMemory((tess.numIndexes / 3) * sizeof(srfTriangle_t));
@@ -544,56 +544,6 @@ static void R_InitUnitCubeVBO()
tess.numVertexes = 0;
}
/**
* @brief R_InitUnitCubeVBO
*/
static void R_InitSkyVBO()
{
vec3_t mins = { -1, -1, -1 };
vec3_t maxs = { 1, 1, 1 };
int i;
srfVert_t *verts;
srfTriangle_t *triangles;
if (glConfig.smpActive)
{
Ren_Fatal("R_InitSkyVBO: FIXME SMP");
}
tess.multiDrawPrimitives = 0;
tess.numIndexes = 0;
tess.numVertexes = 0;
Tess_AddCube(vec3_origin, mins, maxs, colorMdBlue);
verts = (srfVert_t *)ri.Hunk_AllocateTempMemory(tess.numVertexes * sizeof(srfVert_t));
triangles = (srfTriangle_t *)ri.Hunk_AllocateTempMemory((tess.numIndexes / 3) * sizeof(srfTriangle_t));
for (i = 0; i < tess.numVertexes; i++)
{
VectorCopy(tess.xyz[i], verts[i].xyz);
}
for (i = 0; i < (tess.numIndexes / 3); i++)
{
triangles[i].indexes[0] = tess.indexes[i * 3 + 0];
triangles[i].indexes[1] = tess.indexes[i * 3 + 1];
triangles[i].indexes[2] = tess.indexes[i * 3 + 2];
}
tr.SkyVBO = R_CreateVBO2("SkyVBO", tess.numVertexes, verts, ATTR_POSITION, VBO_USAGE_STATIC);
tr.SkyIBO = R_CreateIBO2("SkyIBO", tess.numIndexes / 3, triangles, VBO_USAGE_STATIC);
ri.Hunk_FreeTempMemory(triangles);
ri.Hunk_FreeTempMemory(verts);
tess.multiDrawPrimitives = 0;
tess.numIndexes = 0;
tess.numVertexes = 0;
}
/**
* @brief R_InitVBOs
*/
@@ -635,7 +585,6 @@ void R_InitVBOs(void)
Com_Dealloc(data);
R_InitUnitCubeVBO();
R_InitSkyVBO();//for sky
R_BindNullVBO();
R_BindNullIBO();

0 comments on commit 20a574a

Please sign in to comment.