mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-01-24 01:52:24 -05:00
Don't bother allocating a vertex buffer when map sides/edges is a gas draw type block such as air. Fixes #406
This commit is contained in:
parent
ddac95104c
commit
652e697bf8
3 changed files with 13 additions and 9 deletions
|
@ -47,7 +47,6 @@ namespace ClassicalSharp.Renderers {
|
|||
public void RenderSides(double delta) {
|
||||
if (sidesVb == -1) return;
|
||||
BlockID block = game.World.Env.SidesBlock;
|
||||
if (game.BlockInfo.Draw[block] == DrawType.Gas) return;
|
||||
|
||||
gfx.SetupAlphaState(game.BlockInfo.Draw[block]);
|
||||
gfx.Texturing = true;
|
||||
|
@ -63,8 +62,7 @@ namespace ClassicalSharp.Renderers {
|
|||
|
||||
public void RenderEdges(double delta) {
|
||||
if (edgesVb == -1) return;
|
||||
BlockID block = game.World.Env.EdgeBlock;
|
||||
if (game.BlockInfo.Draw[block] == DrawType.Gas) return;
|
||||
BlockID block = game.World.Env.EdgeBlock;
|
||||
|
||||
Vector3 camPos = game.CurrentCameraPos;
|
||||
gfx.SetupAlphaState(game.BlockInfo.Draw[block]);
|
||||
|
@ -161,6 +159,8 @@ namespace ClassicalSharp.Renderers {
|
|||
void RebuildSides(int y, int axisSize) {
|
||||
BlockID block = game.World.Env.SidesBlock;
|
||||
sidesVertices = 0;
|
||||
if (game.BlockInfo.Draw[block] == DrawType.Gas) return;
|
||||
|
||||
for (int i = 0; i < rects.Length; i++) {
|
||||
Rectangle r = rects[i];
|
||||
sidesVertices += Utils.CountVertices(r.Width, r.Height, axisSize); // YQuads outside
|
||||
|
@ -200,6 +200,8 @@ namespace ClassicalSharp.Renderers {
|
|||
void RebuildEdges(int y, int axisSize) {
|
||||
BlockID block = game.World.Env.EdgeBlock;
|
||||
edgesVertices = 0;
|
||||
if (game.BlockInfo.Draw[block] == DrawType.Gas) return;
|
||||
|
||||
for (int i = 0; i < rects.Length; i++) {
|
||||
Rectangle r = rects[i];
|
||||
edgesVertices += Utils.CountVertices(r.Width, r.Height, axisSize); // YPlanes outside
|
||||
|
|
|
@ -41,7 +41,7 @@ namespace ClassicalSharp.Renderers {
|
|||
/// true = left mouse pressed, false = right mouse pressed. </summary>
|
||||
internal void SetClickAnim(bool dig) {
|
||||
// TODO: timing still not quite right, rotate2 still not quite right
|
||||
ResetAnimationState(true, dig ? 3.35 : 3.25);
|
||||
ResetAnimationState(true, dig ? 0.35 : 0.25);
|
||||
swingAnim = false;
|
||||
digAnim = dig;
|
||||
doAnim = true;
|
||||
|
@ -56,7 +56,7 @@ namespace ClassicalSharp.Renderers {
|
|||
if (time > period * 0.5)
|
||||
time = period - time;
|
||||
} else {
|
||||
ResetAnimationState(false, 3.25);
|
||||
ResetAnimationState(false, 0.25);
|
||||
doAnim = true;
|
||||
swingAnim = true;
|
||||
}
|
||||
|
@ -83,7 +83,7 @@ namespace ClassicalSharp.Renderers {
|
|||
}
|
||||
time += delta;
|
||||
if (time > period)
|
||||
ResetAnimationState(true, 3.25);
|
||||
ResetAnimationState(true, 0.25);
|
||||
}
|
||||
|
||||
// Based off incredible gifs from (Thanks goodlyay!)
|
||||
|
|
|
@ -39,7 +39,7 @@ void BordersRenderer_UseLegacyMode(bool legacy) {
|
|||
|
||||
/* Avoid code duplication in sides and edge rendering */
|
||||
#define BordersRenderer_SetupState(block, texId, vb) \
|
||||
if (vb == -1 || Block_Draw[block] == DrawType_Gas) { return; }\
|
||||
if (vb == -1) { return; }\
|
||||
\
|
||||
GfxCommon_SetupAlphaState(Block_Draw[block]);\
|
||||
Gfx_SetTexturing(true);\
|
||||
|
@ -160,8 +160,9 @@ void BordersRenderer_ResetEdges(void) {
|
|||
void BordersRenderer_RebuildSides(Int32 y, Int32 axisSize) {
|
||||
BlockID block = WorldEnv_SidesBlock;
|
||||
borders_sidesVertices = 0;
|
||||
Int32 i;
|
||||
if (Block_Draw[block] == DrawType_Gas) return;
|
||||
|
||||
Int32 i;
|
||||
for (i = 0; i < 4; i++) {
|
||||
Rectangle r = borders_rects[i];
|
||||
borders_sidesVertices += Math_CountVertices(r.Width, r.Height, axisSize); /* YQuads outside */
|
||||
|
@ -204,8 +205,9 @@ void BordersRenderer_RebuildSides(Int32 y, Int32 axisSize) {
|
|||
void BordersRenderer_RebuildEdges(Int32 y, Int32 axisSize) {
|
||||
BlockID block = WorldEnv_EdgeBlock;
|
||||
borders_edgesVertices = 0;
|
||||
Int32 i;
|
||||
if (Block_Draw[block] == DrawType_Gas) return;
|
||||
|
||||
Int32 i;
|
||||
for (i = 0; i < 4; i++) {
|
||||
Rectangle r = borders_rects[i];
|
||||
borders_edgesVertices += Math_CountVertices(r.Width, r.Height, axisSize); /* YPlanes outside */
|
||||
|
|
Loading…
Add table
Reference in a new issue