]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - render.h
cleaned up qw-related todo items and added some newly discovered qw issues
[xonotic/darkplaces.git] / render.h
index 10fc55458a8aeb769b57777b4b3ec663c9c14508..889ed6406380311a7d3f3c7e863269ea9d6bb630 100644 (file)
--- a/render.h
+++ b/render.h
@@ -175,6 +175,7 @@ extern cvar_t r_test;
 
 extern rtexture_t *r_texture_blanknormalmap;
 extern rtexture_t *r_texture_white;
+extern rtexture_t *r_texture_grey128;
 extern rtexture_t *r_texture_black;
 extern rtexture_t *r_texture_notexture;
 extern rtexture_t *r_texture_whitecube;
@@ -214,6 +215,7 @@ typedef struct rsurfacestate_s
        float *array_deformedsvector3f;
        float *array_deformedtvector3f;
        float *array_deformednormal3f;
+       float *array_generatedtexcoordtexture2f;
        float *array_color4f;
        float *array_texcoord3f;
 
@@ -244,6 +246,21 @@ typedef struct rsurfacestate_s
        float *modelnormal3f;
        int modelnormal3f_bufferobject;
        size_t modelnormal3f_bufferoffset;
+       float *modellightmapcolor4f;
+       int modellightmapcolor4f_bufferobject;
+       size_t modellightmapcolor4f_bufferoffset;
+       float *modeltexcoordtexture2f;
+       int modeltexcoordtexture2f_bufferobject;
+       size_t modeltexcoordtexture2f_bufferoffset;
+       float *modeltexcoordlightmap2f;
+       int modeltexcoordlightmap2f_bufferobject;
+       size_t modeltexcoordlightmap2f_bufferoffset;
+       int *modelelement3i;
+       int modelelement3i_bufferobject;
+       int *modellightmapoffsets;
+       int modelnum_vertices;
+       int modelnum_triangles;
+       msurface_t *modelsurfaces;
        // current rendering array pointers
        // these may point to any of several different buffers depending on how
        // much processing was needed to prepare this model for rendering
@@ -269,6 +286,12 @@ typedef struct rsurfacestate_s
        float *lightmapcolor4f;
        int lightmapcolor4f_bufferobject;
        size_t lightmapcolor4f_bufferoffset;
+       float *texcoordtexture2f;
+       int texcoordtexture2f_bufferobject;
+       size_t texcoordtexture2f_bufferoffset;
+       float *texcoordlightmap2f;
+       int texcoordlightmap2f_bufferobject;
+       size_t texcoordlightmap2f_bufferoffset;
        // transform matrices to render this entity and effects on this entity
        matrix4x4_t matrix;
        matrix4x4_t inversematrix;
@@ -283,8 +306,6 @@ typedef struct rsurfacestate_s
        vec3_t colormap_shirtcolor;
        // view location in model space
        vec3_t modelorg; // TODO: rename this
-       // model being rendered
-       const model_t *model; // TODO: eliminate this
        // current texture in batching code
        texture_t *texture;
        // whether lightmapping is active on this batch
@@ -294,6 +315,27 @@ typedef struct rsurfacestate_s
        rsurfmode_t mode;
        // type of vertex lighting being used on this batch
        int lightmode; // 0 = lightmap or fullbright, 1 = color array from q3bsp, 2 = vertex shaded model
+
+       // rtlight rendering
+       // light currently being rendered
+       rtlight_t *rtlight;
+       // current light's cull box (copied out of an rtlight or calculated by GetLightInfo)
+       vec3_t rtlight_cullmins;
+       vec3_t rtlight_cullmaxs;
+       // current light's culling planes
+       int rtlight_numfrustumplanes;
+       mplane_t rtlight_frustumplanes[12+6+6]; // see R_Shadow_ComputeShadowCasterCullingPlanes
+
+       // this is the location of the light in entity space
+       vec3_t entitylightorigin;
+       // this transforms entity coordinates to light filter cubemap coordinates
+       // (also often used for other purposes)
+       matrix4x4_t entitytolight;
+       // based on entitytolight this transforms -1 to +1 to 0 to 1 for purposes
+       // of attenuation texturing in full 3D (Z result often ignored)
+       matrix4x4_t entitytoattenuationxyz;
+       // this transforms only the Z to S, and T is always 0.5
+       matrix4x4_t entitytoattenuationz;
 }
 rsurfacestate_t;
 
@@ -325,12 +367,13 @@ void RSurf_DrawBatch_Simple(int texturenumsurfaces, msurface_t **texturesurfacel
 #define SHADERPERMUTATION_FOG (1<<5) // tint the color by fog color or black if using additive blend mode
 #define SHADERPERMUTATION_COLORMAPPING (1<<6) // indicates this is a colormapped skin
 #define SHADERPERMUTATION_DIFFUSE (1<<7) // (lightsource) whether to use directional shading
-#define SHADERPERMUTATION_SPECULAR (1<<8) // (lightsource or deluxemapping) render specular effects
-#define SHADERPERMUTATION_CUBEFILTER (1<<9) // (lightsource) use cubemap light filter
-#define SHADERPERMUTATION_OFFSETMAPPING (1<<10) // adjust texcoords to roughly simulate a displacement mapped surface
-#define SHADERPERMUTATION_OFFSETMAPPING_RELIEFMAPPING (1<<11) // adjust texcoords to accurately simulate a displacement mapped surface (requires OFFSETMAPPING to also be set!)
+#define SHADERPERMUTATION_CONTRASTBOOST (1<<8) // r_glsl_contrastboost boosts the contrast at low color levels (similar to gamma)
+#define SHADERPERMUTATION_SPECULAR (1<<9) // (lightsource or deluxemapping) render specular effects
+#define SHADERPERMUTATION_CUBEFILTER (1<<10) // (lightsource) use cubemap light filter
+#define SHADERPERMUTATION_OFFSETMAPPING (1<<11) // adjust texcoords to roughly simulate a displacement mapped surface
+#define SHADERPERMUTATION_OFFSETMAPPING_RELIEFMAPPING (1<<12) // adjust texcoords to accurately simulate a displacement mapped surface (requires OFFSETMAPPING to also be set!)
 
-#define SHADERPERMUTATION_MAX (1<<12) // how many permutations are possible
+#define SHADERPERMUTATION_MAX (1<<13) // how many permutations are possible
 #define SHADERPERMUTATION_MASK (SHADERPERMUTATION_MAX - 1) // mask of valid indexing bits for r_glsl_permutations[] array
 
 // these are additional flags used only by R_GLSL_CompilePermutation
@@ -367,12 +410,13 @@ typedef struct r_glsl_permutation_s
        int loc_SpecularScale;
        int loc_SpecularPower;
        int loc_GlowScale;
-       int loc_SceneBrightness;
+       int loc_SceneBrightness; // or: Scenebrightness * ContrastBoost
        int loc_OffsetMapping_Scale;
        int loc_AmbientColor;
        int loc_DiffuseColor;
        int loc_SpecularColor;
        int loc_LightDir;
+       int loc_ContrastBoostCoeff; // 1 - 1/ContrastBoost
 }
 r_glsl_permutation_t;