void MapRenderer_RenderNormal(double delta) { int batch; if (!mapChunks) return; Gfx_SetVertexFormat(VERTEX_FORMAT_P3FT2FC4B); Gfx_SetTexturing(true); Gfx_SetAlphaTest(true); Gfx_EnableMipmaps(); for (batch = 0; batch < MapRenderer_1DUsedCount; batch++) { if (normPartsCount[batch] <= 0) continue; if (hasNormParts[batch] || checkNormParts[batch]) { Gfx_BindTexture(Atlas1D.TexIds[batch]); MapRenderer_RenderNormalBatch(batch); checkNormParts[batch] = false; } } Gfx_DisableMipmaps(); MapRenderer_CheckWeather(delta); Gfx_SetAlphaTest(false); Gfx_SetTexturing(false); #if DEBUG_OCCLUSION DebugPickedPos(); #endif }
static void Rain_Render(Real32 t) { if (Rain_Count == 0) return; VertexP3fT2fC4b vertices[PARTICLES_MAX * 4]; Int32 i; VertexP3fT2fC4b* ptr = vertices; for (i = 0; i < Rain_Count; i++) { RainParticle_Render(&Rain_Particles[i], t, ptr); ptr += 4; } Gfx_BindTexture(Particles_TexId); GfxCommon_UpdateDynamicVb_IndexedTris(Particles_VB, vertices, Rain_Count * 4); }
void MapRenderer_RenderTranslucent(double delta) { int vertices, batch; if (!mapChunks) return; /* First fill depth buffer */ vertices = Game_Vertices; Gfx_SetVertexFormat(VERTEX_FORMAT_P3FT2FC4B); Gfx_SetTexturing(false); Gfx_SetAlphaBlending(false); Gfx_SetColWriteMask(false, false, false, false); for (batch = 0; batch < MapRenderer_1DUsedCount; batch++) { if (tranPartsCount[batch] <= 0) continue; if (hasTranParts[batch] || checkTranParts[batch]) { MapRenderer_RenderTranslucentBatch(batch); checkTranParts[batch] = false; } } Game_Vertices = vertices; /* Then actually draw the transluscent blocks */ Gfx_SetAlphaBlending(true); Gfx_SetTexturing(true); Gfx_SetColWriteMask(true, true, true, true); Gfx_SetDepthWrite(false); /* already calculated depth values in depth pass */ Gfx_EnableMipmaps(); for (batch = 0; batch < MapRenderer_1DUsedCount; batch++) { if (tranPartsCount[batch] <= 0) continue; if (!hasTranParts[batch]) continue; Gfx_BindTexture(Atlas1D.TexIds[batch]); MapRenderer_RenderTranslucentBatch(batch); } Gfx_DisableMipmaps(); Gfx_SetDepthWrite(true); /* If we weren't under water, render weather after to blend properly */ if (!inTranslucent && Env.Weather != WEATHER_SUNNY) { Gfx_SetAlphaTest(true); EnvRenderer_RenderWeather(delta); Gfx_SetAlphaTest(false); } Gfx_SetAlphaBlending(false); Gfx_SetTexturing(false); }
static void Terrain_Render(Real32 t) { if (Terrain_Count == 0) return; VertexP3fT2fC4b vertices[PARTICLES_MAX * 4]; Terrain_Update1DCounts(); Int32 i; for (i = 0; i < Terrain_Count; i++) { Int32 index = Atlas1D_Index(Terrain_Particles[i].TexLoc); VertexP3fT2fC4b* ptr = &vertices[Terrain_1DIndices[index]]; TerrainParticle_Render(&Terrain_Particles[i], t, ptr); Terrain_1DIndices[index] += 4; } Gfx_SetDynamicVbData(Particles_VB, vertices, Terrain_Count * 4); Int32 offset = 0; for (i = 0; i < Atlas1D_Count; i++) { UInt16 partCount = Terrain_1DCount[i]; if (partCount == 0) continue; Gfx_BindTexture(Atlas1D_TexIds[i]); Gfx_DrawVb_IndexedTris_Range(partCount, offset); offset += partCount; } }