Final version of this Renderer, will improve upon it in the next prototype
This commit is contained in:
@@ -211,7 +211,7 @@ namespace VoxelIsometricRenderer
|
||||
// MessageBox.Show(LightLevel + "");
|
||||
}
|
||||
}
|
||||
return LightLevel;
|
||||
return LightLevel > 0 ? LightLevel : 1;
|
||||
}
|
||||
public static bool IsWithinCircle(int Radius, int CentreX, int CentreY, int posX, int PosY)
|
||||
{
|
||||
@@ -256,7 +256,7 @@ namespace VoxelIsometricRenderer
|
||||
}
|
||||
}
|
||||
TotalLightLevel /= Dimensions;
|
||||
return (byte)Math.Min(Math.Max(TotalLightLevel,0),255);
|
||||
return (byte)Math.Min(Math.Max(TotalLightLevel,1),255);
|
||||
}
|
||||
private void SetUpLightLevels()
|
||||
{
|
||||
@@ -474,7 +474,7 @@ namespace VoxelIsometricRenderer
|
||||
new float[] {0, GetShadingValue(GetSunlightValue(face,ShadowLevel), 1, face, Lights), 0, 0, 0}, // green
|
||||
new float[] {0, 0, GetShadingValue(GetSunlightValue(face,ShadowLevel), 2, face, Lights), 0, 0}, // blue
|
||||
new float[] {0, 0, 0, 1, 0}, // alpha
|
||||
new float[] {0, 0, 0, 0, 1}}; // three translations of 0.2
|
||||
new float[] {0, 0, 0, 0, 1}};
|
||||
|
||||
colorMatrix = new ColorMatrix(colorMatrixElements);
|
||||
imageAttributes = new ImageAttributes();
|
||||
@@ -486,7 +486,7 @@ namespace VoxelIsometricRenderer
|
||||
new float[] {0, GetShadingValue(GetSunlightValue(face,ShadowLevel), 1, face, Lights), 0, 0, 0}, // green
|
||||
new float[] {0, 0, GetShadingValue(GetSunlightValue(face,ShadowLevel), 2, face, Lights), 0, 0}, // blue
|
||||
new float[] {0, 0, 0, 1, 0}, // alpha
|
||||
new float[] {0, 0, 0, 0, 1}}; // three translations of 0.2
|
||||
new float[] {0, 0, 0, 0, 1}};
|
||||
|
||||
colorMatrix = new ColorMatrix(colorMatrixElements);
|
||||
imageAttributes = new ImageAttributes();
|
||||
@@ -498,7 +498,7 @@ namespace VoxelIsometricRenderer
|
||||
new float[] {0, GetShadingValue(GetSunlightValue(face,ShadowLevel), 1, face, Lights), 0, 0, 0}, // green
|
||||
new float[] {0, 0, GetShadingValue(GetSunlightValue(face,ShadowLevel), 2, face, Lights), 0, 0}, // blue
|
||||
new float[] {0, 0, 0, 1, 0}, // alpha
|
||||
new float[] {0, 0, 0, 0, 1}}; // three translations of 0.2
|
||||
new float[] {0, 0, 0, 0, 1}};
|
||||
|
||||
colorMatrix = new ColorMatrix(colorMatrixElements);
|
||||
imageAttributes = new ImageAttributes();
|
||||
@@ -510,7 +510,7 @@ namespace VoxelIsometricRenderer
|
||||
new float[] {0, GetShadingValue(GetSunlightValue(face,ShadowLevel), 1, face, Lights), 0, 0, 0}, // green
|
||||
new float[] {0, 0, GetShadingValue(GetSunlightValue(face,ShadowLevel), 2, face, Lights), 0, 0}, // blue
|
||||
new float[] {0, 0, 0, 1, 0}, // alpha
|
||||
new float[] {0, 0, 0, 0, 1}}; // three translations of 0.2
|
||||
new float[] {0, 0, 0, 0, 1}};
|
||||
|
||||
colorMatrix = new ColorMatrix(colorMatrixElements);
|
||||
imageAttributes = new ImageAttributes();
|
||||
@@ -522,7 +522,7 @@ namespace VoxelIsometricRenderer
|
||||
new float[] {0, GetShadingValue(GetSunlightValue(face,ShadowLevel), 1, face, Lights), 0, 0, 0}, // green
|
||||
new float[] {0, 0, GetShadingValue(GetSunlightValue(face,ShadowLevel), 2, face, Lights), 0, 0}, // blue
|
||||
new float[] {0, 0, 0, 1, 0}, // alpha
|
||||
new float[] {0, 0, 0, 0, 1}}; // three translations of 0.2
|
||||
new float[] {0, 0, 0, 0, 1}};
|
||||
|
||||
colorMatrix = new ColorMatrix(colorMatrixElements);
|
||||
imageAttributes = new ImageAttributes();
|
||||
@@ -534,7 +534,7 @@ namespace VoxelIsometricRenderer
|
||||
new float[] {0, GetShadingValue(GetSunlightValue(face,ShadowLevel), 1, face, Lights), 0, 0, 0}, // green
|
||||
new float[] {0, 0, GetShadingValue(GetSunlightValue(face,ShadowLevel), 2, face, Lights), 0, 0}, // blue
|
||||
new float[] {0, 0, 0, 1, 0}, // alpha
|
||||
new float[] {0, 0, -0, 0, 1}}; // three translations of 0.2
|
||||
new float[] {0, 0, -0, 0, 1}};
|
||||
|
||||
colorMatrix = new ColorMatrix(colorMatrixElements);
|
||||
imageAttributes = new ImageAttributes();
|
||||
@@ -1088,6 +1088,7 @@ namespace VoxelIsometricRenderer
|
||||
{
|
||||
if (BlockReg[x, y, z] != -1 && Culled[x, y, z] == false)
|
||||
{
|
||||
if (SkyLightHeightMap[x, y, z] == 0 ) SkyLightHeightMap[x, y, z] = 255;
|
||||
BlockRegistry.RenderBlock(g, BlockReg[x, y, z], x + ChunkPos[0] * ChunkRegistry.FetchDimensions()[0], y + ChunkPos[1] * ChunkRegistry.FetchDimensions()[1], z + ChunkPos[2] * ChunkRegistry.FetchDimensions()[2], SkyLightHeightMap[x, y, z]);
|
||||
}
|
||||
}
|
||||
@@ -1098,7 +1099,8 @@ namespace VoxelIsometricRenderer
|
||||
{
|
||||
for (int i = 0; i < DrawList.Count; i++)
|
||||
{
|
||||
BlockRegistry.RenderBlock(g, DrawList[i], DrawPositions[i][0] + ChunkPos[0] * ChunkRegistry.FetchDimensions()[0], DrawPositions[i][1] + ChunkPos[1] * ChunkRegistry.FetchDimensions()[1], DrawPositions[i][2] + ChunkPos[1] * ChunkRegistry.FetchDimensions()[1], SkyLightHeightMap[DrawPositions[i][0], DrawPositions[i][1], DrawPositions[i][2]]);
|
||||
if (SkyLightHeightMap[DrawPositions[i][0], DrawPositions[i][1], DrawPositions[i][2]] == 0 ) SkyLightHeightMap[DrawPositions[i][0], DrawPositions[i][1], DrawPositions[i][2]] = 255;
|
||||
BlockRegistry.RenderBlock(g, DrawList[i], DrawPositions[i][0] + ChunkPos[0] * ChunkRegistry.FetchDimensions()[0], DrawPositions[i][1] + ChunkPos[1] * ChunkRegistry.FetchDimensions()[1], DrawPositions[i][2] + ChunkPos[2] * ChunkRegistry.FetchDimensions()[2], SkyLightHeightMap[DrawPositions[i][0], DrawPositions[i][1], DrawPositions[i][2]]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user