|
UFO: Alien Invasion
|
Material related code. More...

Go to the source code of this file.
Macros | |
| #define | UPDATE_THRESHOLD 0.02 |
Functions | |
| static void | R_UpdateMaterial (material_t *m) |
| Materials "think" every few milliseconds to advance animations. | |
| static void | R_StageGlow (const materialStage_t *stage) |
| static void | R_StageLighting (const mBspSurface_t *surf, const materialStage_t *stage) |
| Manages state for stages supporting static, dynamic, and per-pixel lighting. | |
| static void | R_StageVertex (const mBspSurface_t *surf, const materialStage_t *stage, const vec3_t in, vec3_t out) |
| Vertex deformation. | |
| static void | R_StageTextureMatrix (const mBspSurface_t *surf, const materialStage_t *stage) |
| Manages texture matrix manipulations for stages supporting rotations, scrolls, and stretches (rotate, translate, scale). | |
| static void | R_StageTexCoord (const materialStage_t *stage, const vec3_t v, const vec2_t in, vec2_t out) |
| Generates a single texture coordinate for the specified stage and vertex. | |
| static void | R_StageColor (const materialStage_t *stage, const vec3_t v, vec4_t color) |
| Generates a single color for the specified stage and vertex. | |
| static void | R_SetSurfaceStageState (const mBspSurface_t *surf, const materialStage_t *stage) |
| Manages all state for the specified surface and stage. | |
| static void | R_DrawSurfaceStage (mBspSurface_t *surf, materialStage_t *stage) |
| Render the specified stage for the surface. Resolve vertex attributes via helper functions, outputting to the default vertex arrays. | |
| void | R_DrawMaterialSurfaces (const mBspSurfaces_t *surfs, glElementIndex_t *indexPtr) |
| Iterates the specified surfaces list, updating materials as they are encountered, and rendering all visible stages. State is lazily managed throughout the iteration, so there is a concerted effort to restore the state after all surface stages have been rendered. | |
| static GLenum | R_ConstByName (const char *c) |
| Translate string into glmode. | |
| static void | R_CreateMaterialData_ (model_t *mod) |
| static void | R_CreateMaterialData (void) |
| static int | R_LoadAnimImages (materialStage_t *s) |
| static int | R_ParseStage (materialStage_t *s, const char **buffer) |
| Material stage parser. | |
| void | R_LoadMaterials (const char *map) |
| Load material definitions for each map that has one. | |
| void | R_UpdateDefaultMaterial (const char *cvarName, const char *oldValue, const char *newValue, void *data) |
| Change listener callback for material value cvars. | |
Variables | |
| mBspSurfaces_t | r_material_surfaces |
| material_t | defaultMaterial = {0, 0.0f, DEFAULT_BUMP, DEFAULT_PARALLAX, DEFAULT_HARDNESS, DEFAULT_SPECULAR, DEFAULT_GLOWSCALE, nullptr, 0} |
| static const float | dirtmap [] |
| Array with 'random' alpha values for the dirtmap. | |
Material related code.
Definition in file r_material.cpp.
| #define UPDATE_THRESHOLD 0.02 |
Definition at line 36 of file r_material.cpp.
Referenced by R_UpdateMaterial().
|
static |
Translate string into glmode.
Definition at line 480 of file r_material.cpp.
References Com_Printf(), GLenum, and Q_streq.
Referenced by R_ParseStage().
Definition at line 512 of file r_material.cpp.
References i, R_CreateMaterialData_(), r_mapTiles, r_modelsInline, r_numMapTiles, and r_numModelsInline.
Referenced by R_LoadMaterials().
Definition at line 503 of file r_material.cpp.
References model_t::bsp, i, mBspModel_t::numsurfaces, R_CreateSurfaceFlare(), and mBspModel_t::surfaces.
Referenced by R_CreateMaterialData().
| void R_DrawMaterialSurfaces | ( | const mBspSurfaces_t * | surfs, |
| glElementIndex_t * | indexPtr ) |
Iterates the specified surfaces list, updating materials as they are encountered, and rendering all visible stages. State is lazily managed throughout the iteration, so there is a concerted effort to restore the state after all surface stages have been rendered.
Definition at line 399 of file r_material.cpp.
References mBspSurfaces_t::count, mBspSurface_t::frame, i, mBspTexInfo_t::image, m, image_t::material, R_BlendFunc(), R_Color(), R_DrawSurfaceStage(), R_EnableBumpmap(), R_EnableColorArray(), R_EnableFog(), R_EnableGlowMap(), R_EnableLighting(), R_EnableModelLights(), R_EnableTexture(), r_locals, r_materials, R_ResetArrayState(), R_SetSurfaceStageState(), r_state, R_UpdateMaterial(), r_wire, STAGE_RENDER, mBspSurfaces_t::surfaces, mBspSurface_t::texinfo, and texunit_lightmap.
Referenced by R_RenderMaterialBspRRefs().
|
static |
Render the specified stage for the surface. Resolve vertex attributes via helper functions, outputting to the default vertex arrays.
Definition at line 349 of file r_material.cpp.
References i, mBspSurface_t::index, mBspSurface_t::numedges, R_CheckError, r_mapTiles, R_ReallocateStateArrays(), R_ReallocateTexunitArray(), R_StageColor(), R_StageTexCoord(), R_StageVertex(), r_state, refdef, texunit_diffuse, texunit_lightmap, mBspSurface_t::tile, and v.
Referenced by R_DrawMaterialSurfaces().
|
static |
Definition at line 523 of file r_material.cpp.
References materialStage_t::anim, Com_Printf(), i, materialStage_t::image, anim_t::images, it_material, MAX_QPATH, name, anim_t::num_frames, Q_strncpyz(), R_FindImage(), r_noTexture, and va().
Referenced by R_LoadMaterials().
| void R_LoadMaterials | ( | const char * | map | ) |
Load material definitions for each map that has one.
| [in] | map | the base name of the map to load the material for |
Definition at line 920 of file r_material.cpp.
References Com_DPrintf(), Com_Parse(), Com_Printf(), Com_SkipPath(), Com_sprintf(), DEBUG_RENDERER, defaultMaterial, materialStage_t::flags, FS_FreeFile(), FS_LoadFile(), image_t::glowmap, materialStage_t::glowscale, it_glowmap, it_normalmap, m, image_t::material, MAX_QPATH, Mem_Free, Mem_PoolAllocType, image_t::name, materialStage_t::next, image_t::normalmap, Q_streq, Q_strvalid, R_CreateMaterialData(), R_FindImage(), R_GetImage(), R_ImageClearMaterials(), R_LoadAnimImages(), r_materials, r_noTexture, r_overridematerial, R_ParseStage(), STAGE_ANIM, va(), and vid_imagePool.
Referenced by R_ModEndLoading().
|
static |
Material stage parser.
Definition at line 563 of file r_material.cpp.
References stretch_t::amp, materialStage_t::anim, ANIM_ALTERNATE, ANIM_BACKWARDS, ANIM_NORMAL, ANIM_RANDOM, ANIM_RANDOMFORCE, materialStage_t::blend, tape_t::ceil, terrain_t::ceil, tape_t::center, materialStage_t::color, Com_DPrintf(), Com_Parse(), Com_Printf(), DEBUG_RENDERER, defaultMaterial, blendmode_t::dest, materialStage_t::dirt, pulse_t::dutycycle, materialStage_t::flags, tape_t::floor, terrain_t::floor, anim_t::fps, materialStage_t::glowscale, tape_t::height, terrain_t::height, pulse_t::hz, rotate_t::hz, stretch_t::hz, i, materialStage_t::image, dirt_t::intensity, it_material, tape_t::max, MAX_ANIM_FRAMES, MAX_ENVMAPTEXTURES, tape_t::min, NUM_FLARETEXTURES, anim_t::num_frames, materialStage_t::pulse, Q_streq, Q_strstart(), R_ConstByName(), r_envmaptextures, R_FindImage(), r_flaretextures, r_noTexture, materialStage_t::rotate, scale_t::s, scroll_t::s, materialStage_t::scale, materialStage_t::scroll, blendmode_t::src, STAGE_ANIM, STAGE_BLEND, STAGE_COLOR, STAGE_DIRTMAP, STAGE_ENVMAP, STAGE_FLARE, STAGE_GLOWMAPLINK, STAGE_LIGHTING, STAGE_LIGHTMAP, STAGE_PULSE, STAGE_RENDER, STAGE_ROTATE, STAGE_SCALE_S, STAGE_SCALE_T, STAGE_SCROLL_S, STAGE_SCROLL_T, STAGE_STRETCH, STAGE_TAPE, STAGE_TERRAIN, STAGE_TEXTURE, materialStage_t::stretch, scale_t::t, scroll_t::t, materialStage_t::tape, materialStage_t::terrain, anim_t::type, and va().
Referenced by R_LoadMaterials().
|
static |
Manages all state for the specified surface and stage.
Definition at line 292 of file r_material.cpp.
References materialStage_t::blend, materialStage_t::color, blendmode_t::dest, pulse_t::dhz, materialStage_t::flags, materialStage_t::image, mBspSurface_t::lightColor, materialStage_t::pulse, R_BindTexture, R_BlendFunc(), R_Color(), R_EnableColorArray(), R_EnableFog(), R_StageGlow(), R_StageLighting(), R_StageTextureMatrix(), r_state, blendmode_t::src, STAGE_BLEND, STAGE_COLOR, STAGE_DIRTMAP, STAGE_ENVMAP, STAGE_PULSE, STAGE_TAPE, STAGE_TERRAIN, VectorCopy, and VectorSet.
Referenced by R_DrawMaterialSurfaces().
|
static |
Generates a single color for the specified stage and vertex.
Definition at line 240 of file r_material.cpp.
References terrain_t::ceil, tape_t::center, materialStage_t::color, materialStage_t::dirt, dirtmap, DotProduct, materialStage_t::flags, terrain_t::floor, terrain_t::height, index, int(), dirt_t::intensity, lengthof, tape_t::max, tape_t::min, STAGE_COLOR, STAGE_DIRTMAP, STAGE_TAPE, STAGE_TERRAIN, materialStage_t::tape, materialStage_t::terrain, v, Vector4Set, VectorCopy, and VectorSet.
Referenced by R_DrawSurfaceStage().
|
static |
Definition at line 109 of file r_material.cpp.
References materialStage_t::flags, materialStage_t::glowscale, materialStage_t::image, R_EnableGlowMap(), R_ProgramParameter1f(), r_state, and STAGE_GLOWMAPLINK.
Referenced by R_SetSurfaceStageState().
|
static |
Manages state for stages supporting static, dynamic, and per-pixel lighting.
Definition at line 130 of file r_material.cpp.
References materialStage_t::flags, mBspSurface_t::flags, materialStage_t::image, mBspSurface_t::lightmap_texnum, MSURF_LIGHTMAP, R_BindLightmapTexture(), R_EnableLighting(), R_EnableTexture(), r_materials, R_SetSurfaceBumpMappingParameters(), r_state, STAGE_LIGHTING, STAGE_LIGHTMAP, and texunit_lightmap.
Referenced by R_SetSurfaceStageState().
|
static |
Generates a single texture coordinate for the specified stage and vertex.
Definition at line 219 of file r_material.cpp.
References materialStage_t::flags, refdef, STAGE_ENVMAP, v, Vector2Copy, VectorNormalizeFast(), and VectorSubtract.
Referenced by R_DrawSurfaceStage().
|
inlinestatic |
Manages texture matrix manipulations for stages supporting rotations, scrolls, and stretches (rotate, translate, scale).
Definition at line 171 of file r_material.cpp.
References stretch_t::damp, rotate_t::deg, scroll_t::ds, scroll_t::dt, materialStage_t::flags, image_t::height, mBspTexInfo_t::image, materialStage_t::rotate, scale_t::s, materialStage_t::scale, materialStage_t::scroll, STAGE_ROTATE, STAGE_SCALE_S, STAGE_SCALE_T, STAGE_SCROLL_S, STAGE_SCROLL_T, STAGE_STRETCH, STAGE_TEXTURE_MATRIX, mBspSurface_t::stcenter, materialStage_t::stretch, scale_t::t, mBspSurface_t::texinfo, and image_t::width.
Referenced by R_SetSurfaceStageState().
|
inlinestatic |
Vertex deformation.
Definition at line 162 of file r_material.cpp.
References VectorCopy.
Referenced by R_DrawSurfaceStage().
| void R_UpdateDefaultMaterial | ( | const char * | cvarName, |
| const char * | oldValue, | ||
| const char * | newValue, | ||
| void * | data ) |
Change listener callback for material value cvars.
Definition at line 1092 of file r_material.cpp.
References data, defaultMaterial, r_default_hardness, and r_default_specular.
Referenced by R_Init(), R_RegisterSystemVars(), and R_ReinitOpenglContext().
|
static |
Materials "think" every few milliseconds to advance animations.
Definition at line 40 of file r_material.cpp.
References ANIM_ALTERNATE, ANIM_BACKWARDS, ANIM_NORMAL, ANIM_RANDOM, ANIM_RANDOMFORCE, m, M_PI, refdef, STAGE_ANIM, STAGE_PULSE, STAGE_ROTATE, STAGE_SCROLL_S, STAGE_SCROLL_T, STAGE_STRETCH, and UPDATE_THRESHOLD.
Referenced by R_DrawMaterialSurfaces().
| material_t defaultMaterial = {0, 0.0f, DEFAULT_BUMP, DEFAULT_PARALLAX, DEFAULT_HARDNESS, DEFAULT_SPECULAR, DEFAULT_GLOWSCALE, nullptr, 0} |
Definition at line 34 of file r_material.cpp.
Referenced by R_EnableBumpmap(), R_EnableModelLights(), R_ImageClearMaterials(), R_InitModelProgram(), R_InitWorldProgram(), R_LoadImageData(), R_LoadMaterials(), R_ParseStage(), R_UpdateDefaultMaterial(), and R_UseMaterial().
|
static |
Array with 'random' alpha values for the dirtmap.
Definition at line 232 of file r_material.cpp.
Referenced by R_StageColor().
| mBspSurfaces_t r_material_surfaces |
Definition at line 31 of file r_material.cpp.