Final version of this Renderer, will improve upon it in the next prototype
This commit is contained in:
@@ -12,11 +12,12 @@ namespace VoxelIsometricRenderer
|
||||
public static class PlayerObject
|
||||
{
|
||||
static int BlockID = 0;
|
||||
static int VoxelID = 0;
|
||||
static float PositionX = 0;
|
||||
static float PositionY = 0;
|
||||
static float PositionZ = 0;
|
||||
static int BlockposX = 5;
|
||||
static int BlockposY = 17;
|
||||
static int BlockposY = 16;
|
||||
static int BlockposZ =5;
|
||||
static float PrecisePositionX = 0.0f;
|
||||
static float PrecisePositionY = 0.0f;
|
||||
@@ -24,11 +25,15 @@ namespace VoxelIsometricRenderer
|
||||
static Rectangle CameraCentre = new Rectangle(0,0,100,100);
|
||||
static int[] LastPositions = new int[] { 0, -192 };
|
||||
static Rectangle PlayerPosition = new Rectangle(0,0,100,100);
|
||||
public static int GetVoxelID()
|
||||
{
|
||||
return VoxelID;
|
||||
}
|
||||
public static void Draw(Graphics g)
|
||||
{
|
||||
Chunk PlayerChunk = ChunkRegistry.FetchChunk(String.Format("x={0};y={1};z={2}", (int)Math.Floor(BlockposX / (double)ChunkRegistry.FetchDimensions()[0]), (int)Math.Floor(BlockposY / (double)ChunkRegistry.FetchDimensions()[1]), (int)Math.Floor(BlockposZ / (double)ChunkRegistry.FetchDimensions()[2])));
|
||||
BlockRegistry.RenderBlock(g,BlockID, BlockposX, BlockposY, BlockposZ, PlayerChunk != null ? PlayerChunk.SkyLightHeightMap[Math.Min(BlockposX - (PlayerChunk.ChunkPos[0] * ChunkRegistry.FetchDimensions()[0]) + 1, PlayerChunk.SkyLightHeightMap.GetLength(0) - 1), Math.Min(BlockposY - (PlayerChunk.ChunkPos[1] * ChunkRegistry.FetchDimensions()[1]) + 1, ChunkRegistry.FetchDimensions()[1] - 1), Math.Max(BlockposZ - (PlayerChunk.ChunkPos[2] * ChunkRegistry.FetchDimensions()[2]) - 1, 0)] : 1);
|
||||
int[] Positions = BlockRegistry.GetDrawLocation(BlockposX, BlockposY, BlockposZ,PositionX,PositionY,PositionZ);
|
||||
BlockRegistry.RenderBlock(g, BlockID, BlockposX, BlockposY, BlockposZ, PlayerChunk != null ? PlayerChunk.SkyLightHeightMap[Math.Max(BlockposX - (PlayerChunk.ChunkPos[0] * ChunkRegistry.FetchDimensions()[0]), 0), Math.Max(BlockposY - (PlayerChunk.ChunkPos[1] * ChunkRegistry.FetchDimensions()[1]), 0), Math.Max(BlockposZ - (PlayerChunk.ChunkPos[2] * ChunkRegistry.FetchDimensions()[2]), 0)] : 1);
|
||||
int[] Positions = BlockRegistry.GetDrawLocation(BlockposX, BlockposY, BlockposZ, PositionX, PositionY, PositionZ);
|
||||
if (Positions[0] != LastPositions[0] || Positions[1] != LastPositions[1])
|
||||
{
|
||||
//MessageBox.Show(Positions[0] + "_" + Positions[1]);
|
||||
@@ -117,6 +122,7 @@ namespace VoxelIsometricRenderer
|
||||
{
|
||||
index = VoxelRegistry.IndexVoxel(voxel);
|
||||
}
|
||||
VoxelID = index;
|
||||
Block newBlock = new Block(index, BlockstateRegistry.GetBlockstateIndex(blockState), -1);
|
||||
int x = BlockposX;
|
||||
int y = BlockposY;
|
||||
|
||||
Reference in New Issue
Block a user