first commit
This commit is contained in:
50
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/AnvilTile_SPU.h
Normal file
50
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/AnvilTile_SPU.h
Normal file
@@ -0,0 +1,50 @@
|
||||
#pragma once
|
||||
|
||||
#include "Tile_SPU.h"
|
||||
|
||||
class FallingTile;
|
||||
|
||||
class AnvilTile_SPU : public Tile_SPU
|
||||
{
|
||||
public:
|
||||
static const int PART_BASE = 0;
|
||||
static const int PART_JOINT = 1;
|
||||
static const int PART_COLUMN = 2;
|
||||
static const int PART_TOP = 3;
|
||||
|
||||
static const int ANVIL_NAMES_LENGTH = 3;
|
||||
|
||||
|
||||
// public:
|
||||
//int part;
|
||||
|
||||
AnvilTile_SPU(int id) : Tile_SPU(id) {}
|
||||
|
||||
public:
|
||||
bool isCubeShaped() { return false; }
|
||||
bool isSolidRender(bool isServerLevel = false) { return false; }
|
||||
Icon_SPU *getTexture(int face, int data)
|
||||
{
|
||||
if (ms_pTileData->anvilPart == PART_TOP && face == Facing::UP)
|
||||
{
|
||||
int damage = (data >> 2) % ANVIL_NAMES_LENGTH;
|
||||
return &ms_pTileData->anvil_icons[damage];
|
||||
}
|
||||
return icon();
|
||||
}
|
||||
int getRenderShape() { return Tile_SPU::SHAPE_ANVIL; }
|
||||
void updateShape(ChunkRebuildData *level, int x, int y, int z)
|
||||
{
|
||||
int dir = level->getData(x, y, z) & 3;
|
||||
if (dir == Direction::EAST || dir == Direction::WEST)
|
||||
{
|
||||
setShape(0, 0, 2 / 16.0f, 1, 1, 1 - 2 / 16.0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
setShape(2 / 16.0f, 0, 0, 1 - 2 / 16.0f, 1, 1);
|
||||
}
|
||||
}
|
||||
|
||||
bool shouldRenderFace(ChunkRebuildData *level, int x, int y, int z, int face) { return true; }
|
||||
};
|
||||
28
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/BedTile_SPU.h
Normal file
28
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/BedTile_SPU.h
Normal file
@@ -0,0 +1,28 @@
|
||||
#pragma once
|
||||
#include "Tile_SPU.h"
|
||||
|
||||
|
||||
|
||||
// TileRenderer not implemented, so minimum of stuff here
|
||||
class BedTile_SPU : public Tile_SPU
|
||||
{
|
||||
public:
|
||||
// static const int PART_FOOT = 0;
|
||||
// static const int PART_HEAD = 1;
|
||||
//
|
||||
// static const int HEAD_PIECE_DATA = 0x8;
|
||||
// static const int OCCUPIED_DATA = 0x4;
|
||||
//
|
||||
// static int HEAD_DIRECTION_OFFSETS[4][2];
|
||||
|
||||
BedTile_SPU(int id) : Tile_SPU(id) {}
|
||||
|
||||
virtual Icon_SPU *getTexture(int face, int data) { return NULL; }
|
||||
virtual int getRenderShape() { return Tile_SPU::SHAPE_BED; }
|
||||
virtual bool isSolidRender(bool isServerLevel = false) { return false; }
|
||||
virtual void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = NULL) // 4J added forceData, forceEntity param
|
||||
{
|
||||
setShape();
|
||||
}
|
||||
void setShape() { Tile_SPU::setShape(0, 0, 0, 1, 9 / 16.0f, 1); }
|
||||
};
|
||||
@@ -0,0 +1,17 @@
|
||||
#pragma once
|
||||
#include "Tile_SPU.h"
|
||||
|
||||
class Random;
|
||||
|
||||
class BookshelfTile_SPU : public Tile_SPU
|
||||
{
|
||||
public:
|
||||
BookshelfTile_SPU(int id) : Tile_SPU(id) {}
|
||||
|
||||
virtual Icon_SPU *getTexture(int face, int data)
|
||||
{
|
||||
if (face == Facing::UP || face == Facing::DOWN)
|
||||
return TileRef_SPU(wood_Id)->getTexture(face);
|
||||
return Tile_SPU::getTexture(face, data);
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
#include "EntityTile_SPU.h"
|
||||
|
||||
|
||||
class BrewingStandTile_SPU : public EntityTile_SPU
|
||||
{
|
||||
public:
|
||||
BrewingStandTile_SPU(int id) : EntityTile_SPU(id) {}
|
||||
virtual bool isSolidRender(bool isServerLevel = false) { return false; }
|
||||
virtual int getRenderShape() { return SHAPE_BREWING_STAND; }
|
||||
virtual bool isCubeShaped() { return false; }
|
||||
virtual void updateDefaultShape() { setShape(0, 0, 0, 1, 2.0f / 16.0f, 1); }
|
||||
Icon_SPU *getBaseTexture() { return &ms_pTileData->brewingStand_iconBase; }
|
||||
};
|
||||
12
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/Bush_SPU.h
Normal file
12
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/Bush_SPU.h
Normal file
@@ -0,0 +1,12 @@
|
||||
#pragma once
|
||||
#include "Tile_SPU.h"
|
||||
|
||||
class Bush_SPU : public Tile_SPU
|
||||
{
|
||||
public:
|
||||
Bush_SPU(int id) : Tile_SPU(id) {}
|
||||
|
||||
virtual bool blocksLight() { return false; }
|
||||
virtual bool isSolidRender(bool isServerLevel = false) { return false; }
|
||||
virtual int getRenderShape() { return Tile_SPU::SHAPE_CROSS_TEXTURE; }
|
||||
};
|
||||
54
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/ButtonTile_SPU.h
Normal file
54
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/ButtonTile_SPU.h
Normal file
@@ -0,0 +1,54 @@
|
||||
#pragma once
|
||||
#include "Tile_SPU.h"
|
||||
|
||||
|
||||
class ButtonTile_SPU : public Tile_SPU
|
||||
{
|
||||
|
||||
public:
|
||||
ButtonTile_SPU(int id) : Tile_SPU(id) {}
|
||||
|
||||
Icon_SPU *getTexture(int face, int data)
|
||||
{
|
||||
if(id == Tile_SPU::button_wood_Id)
|
||||
return TileRef_SPU(wood_Id)->getTexture(Facing::UP);
|
||||
else
|
||||
return TileRef_SPU(rock_Id)->getTexture(Facing::UP);
|
||||
}
|
||||
virtual bool blocksLight() { return false; }
|
||||
virtual bool isSolidRender(bool isServerLevel = false) { return false; }
|
||||
virtual bool isCubeShaped() { return false; }
|
||||
virtual void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = NULL) // 4J added forceData, forceEntity param
|
||||
{
|
||||
int data = level->getData(x, y, z);
|
||||
int dir = data & 7;
|
||||
bool pressed = (data & 8) > 0;
|
||||
|
||||
float h0 = 6 / 16.0f;
|
||||
float h1 = 10 / 16.0f;
|
||||
float r = 3 / 16.0f;
|
||||
float d = 2 / 16.0f;
|
||||
if (pressed) d = 1 / 16.0f;
|
||||
|
||||
if (dir == 1)
|
||||
{
|
||||
setShape(0, h0, 0.5f - r, d, h1, 0.5f + r);
|
||||
} else if (dir == 2)
|
||||
{
|
||||
setShape(1 - d, h0, 0.5f - r, 1, h1, 0.5f + r);
|
||||
} else if (dir == 3)
|
||||
{
|
||||
setShape(0.5f - r, h0, 0, 0.5f + r, h1, d);
|
||||
} else if (dir == 4)
|
||||
{
|
||||
setShape(0.5f - r, h0, 1 - d, 0.5f + r, h1, 1);
|
||||
}
|
||||
}
|
||||
virtual void updateDefaultShape()
|
||||
{
|
||||
float x = 3 / 16.0f;
|
||||
float y = 2 / 16.0f;
|
||||
float z = 2 / 16.0f;
|
||||
setShape(0.5f - x, 0.5f - y, 0.5f - z, 0.5f + x, 0.5f + y, 0.5f + z);
|
||||
}
|
||||
};
|
||||
18
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/CactusTile_SPU.h
Normal file
18
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/CactusTile_SPU.h
Normal file
@@ -0,0 +1,18 @@
|
||||
#pragma once
|
||||
#include "Tile_SPU.h"
|
||||
|
||||
class CactusTile_SPU : public Tile_SPU
|
||||
{
|
||||
public:
|
||||
CactusTile_SPU(int id) : Tile_SPU(id) {}
|
||||
|
||||
virtual Icon_SPU *getTexture(int face, int data)
|
||||
{
|
||||
if (face == Facing::UP) return &ms_pTileData->cactusTile_iconTop;
|
||||
if (face == Facing::DOWN) return &ms_pTileData->cactusTile_iconBottom;
|
||||
else return icon();
|
||||
}
|
||||
virtual bool isCubeShaped() { return false; }
|
||||
virtual bool isSolidRender(bool isServerLevel = false) { return false;}
|
||||
virtual int getRenderShape() { return Tile_SPU::SHAPE_CACTUS; }
|
||||
};
|
||||
31
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/CakeTile_SPU.h
Normal file
31
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/CakeTile_SPU.h
Normal file
@@ -0,0 +1,31 @@
|
||||
#pragma once
|
||||
#include "Tile_SPU.h"
|
||||
#include "ChunkRebuildData.h"
|
||||
class CakeTile_SPU : public Tile_SPU
|
||||
{
|
||||
public:
|
||||
CakeTile_SPU(int id) : Tile_SPU(id) {}
|
||||
virtual void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = NULL) // 4J added forceData, forceEntity param
|
||||
{
|
||||
int d = level->getData(x, y, z);
|
||||
float r = 1 / 16.0f;
|
||||
float r2 = (1 + d * 2) / 16.0f;
|
||||
float h = 8 / 16.0f;
|
||||
this->setShape(r2, 0, r, 1 - r, h, 1 - r);
|
||||
}
|
||||
virtual void updateDefaultShape()
|
||||
{
|
||||
float r = 1 / 16.0f;
|
||||
float h = 8 / 16.0f;
|
||||
this->setShape(r, 0, r, 1 - r, h, 1 - r);
|
||||
}
|
||||
virtual Icon_SPU *getTexture(int face, int data)
|
||||
{
|
||||
if (face == Facing::UP) return &ms_pTileData->cakeTile_iconTop;
|
||||
if (face == Facing::DOWN) return &ms_pTileData->cakeTile_iconBottom;
|
||||
if (data > 0 && face == Facing::WEST) return &ms_pTileData->cakeTile_iconInner;
|
||||
return icon();
|
||||
}
|
||||
virtual bool isCubeShaped() { return false; }
|
||||
virtual bool isSolidRender(bool isServerLevel = false) { return false; }
|
||||
};
|
||||
28
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/CarrotTile_SPU.h
Normal file
28
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/CarrotTile_SPU.h
Normal file
@@ -0,0 +1,28 @@
|
||||
#pragma once
|
||||
|
||||
#include "CropTile_SPU.h"
|
||||
|
||||
class CarrotTile_SPU : public CropTile_SPU
|
||||
{
|
||||
private:
|
||||
// Icon *icons[4];
|
||||
public:
|
||||
CarrotTile_SPU(int id) : CropTile_SPU(id) {}
|
||||
|
||||
Icon_SPU *getTexture(int face, int data)
|
||||
{
|
||||
if (data < 7)
|
||||
{
|
||||
if (data == 6)
|
||||
{
|
||||
data = 5;
|
||||
}
|
||||
return &ms_pTileData->carrot_icons[data >> 1];
|
||||
}
|
||||
else
|
||||
{
|
||||
return &ms_pTileData->carrot_icons[3];
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
@@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
#include "Tile_SPU.h"
|
||||
|
||||
|
||||
class CauldronTile_SPU : public Tile_SPU
|
||||
{
|
||||
public:
|
||||
CauldronTile_SPU(int id) : Tile_SPU(id) {}
|
||||
virtual Icon_SPU *getTexture(int face, int data) { return NULL; }
|
||||
//@Override
|
||||
// virtual void updateDefaultShape();
|
||||
virtual bool isSolidRender(bool isServerLevel = false) { return false; }
|
||||
virtual int getRenderShape() { return SHAPE_CAULDRON; }
|
||||
};
|
||||
10
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/ChestTile_SPU.h
Normal file
10
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/ChestTile_SPU.h
Normal file
@@ -0,0 +1,10 @@
|
||||
#pragma once
|
||||
#include "EntityTile_SPU.h"
|
||||
|
||||
class ChestTile_SPU : public EntityTile_SPU
|
||||
{
|
||||
public:
|
||||
ChestTile_SPU(int id) : EntityTile_SPU(id) {}
|
||||
virtual bool isSolidRender(bool isServerLevel = false) { return false; }
|
||||
virtual int getRenderShape() { return Tile_SPU::SHAPE_ENTITYTILE_ANIMATED; }
|
||||
};
|
||||
894
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/ChunkRebuildData.cpp
Normal file
894
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/ChunkRebuildData.cpp
Normal file
@@ -0,0 +1,894 @@
|
||||
#include "stdafx.h"
|
||||
#ifdef __PS3__
|
||||
#ifndef SN_TARGET_PS3_SPU
|
||||
// #include "..\..\..\stdafx.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "ChunkRebuildData.h"
|
||||
#include "Tesselator_SPU.h"
|
||||
|
||||
|
||||
#ifndef SN_TARGET_PS3_SPU
|
||||
#include "..\..\..\..\Minecraft.World\Tile.h"
|
||||
#include "..\..\..\..\Minecraft.World\Level.h"
|
||||
#include "..\..\..\..\Minecraft.World\Dimension.h"
|
||||
//
|
||||
// #include "..\..\..\Chunk.h"
|
||||
// #include "..\..\..\TileRenderer.h"
|
||||
// #include "..\..\..\TileEntityRenderDispatcher.h"
|
||||
// #include "..\..\..\LevelRenderer.h"
|
||||
#include "..\..\..\..\Minecraft.World\net.minecraft.world.level.h"
|
||||
#include "..\..\..\..\Minecraft.World\net.minecraft.world.level.chunk.h"
|
||||
#include "..\..\..\..\Minecraft.World\net.minecraft.world.level.tile.h"
|
||||
#include "..\..\..\..\Minecraft.World\net.minecraft.world.level.tile.entity.h"
|
||||
#include "..\..\..\..\Minecraft.World\Icon.h"
|
||||
#include "..\..\..\..\Minecraft.World\BiomeSource.h"
|
||||
|
||||
#else
|
||||
|
||||
#include "..\Common\spu_assert.h"
|
||||
|
||||
#endif //SN_TARGET_PS3_SPU
|
||||
|
||||
static const int Level_maxBuildHeight = 256;
|
||||
static const int Level_MAX_LEVEL_SIZE = 30000000;
|
||||
static const int Level_MAX_BRIGHTNESS = 15;
|
||||
|
||||
|
||||
#include "TileRenderer_SPU.h"
|
||||
#include "Tile_SPU.h"
|
||||
#include "ChunkRebuildData.h"
|
||||
TileData_SPU g_tileSPUData;
|
||||
|
||||
static const int MAX_LEVEL_SIZE = 30000000;
|
||||
static const int MAX_BRIGHTNESS = 15;
|
||||
|
||||
#if 0 //def SN_TARGET_PS3_SPU
|
||||
int ChunkRebuildData::getTile( int x, int y, int z ) { return m_tileIds[getTileIdx(x,y,z)]; }
|
||||
int ChunkRebuildData::getBrightnessSky(int x, int y, int z) { return m_brightness[getTileIdx(x,y,z)] & 0x0f; }
|
||||
int ChunkRebuildData::getBrightnessBlock(int x, int y, int z) { return m_brightness[getTileIdx(x,y,z)] >> 4; }
|
||||
int ChunkRebuildData::getData(int x, int y, int z) { return m_data_flags[getTileIdx(x,y,z)] & 0x0f; }
|
||||
int ChunkRebuildData::getGrassColor( int x, int z ) { return m_grassColor[getTileIdx(x,z)]; }
|
||||
int ChunkRebuildData::getFoliageColor( int x, int z ) { return m_foliageColor[getTileIdx(x,z)]; }
|
||||
int ChunkRebuildData::getFlags(int x, int y, int z) { return m_data_flags[getTileIdx(x,y,z)] >> 4; }
|
||||
void ChunkRebuildData::setFlag(int x, int y, int z, int flag) { m_data_flags[getTileIdx(x,y,z)] |= (flag<<4);}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
void ChunkRebuildData::disableUnseenTiles()
|
||||
{
|
||||
// We now go through the vertical section of this level chunk that we are interested in and try and establish
|
||||
// (1) if it is completely empty
|
||||
// (2) if any of the tiles can be quickly determined to not need rendering because they are in the middle of other tiles and
|
||||
// so can't be seen. A large amount (> 60% in tests) of tiles that call tesselateInWorld in the unoptimised version
|
||||
// of this function fall into this category. By far the largest category of these are tiles in solid regions of rock.
|
||||
int startX = m_x0+2; // beginning of the chunk
|
||||
int startY = m_y0+2; // beginning of the chunk
|
||||
int startZ = m_z0+2; // beginning of the chunk
|
||||
|
||||
for(int iX=startX; iX<(startX+16); iX++)
|
||||
{
|
||||
for(int iY=startY; iY<(startY+16); iY++)
|
||||
{
|
||||
for(int iZ=startZ; iZ<(startZ+16); iZ++)
|
||||
{
|
||||
int tileID = getTile(iX,iY,iZ);
|
||||
if( tileID == 0 ) continue;
|
||||
m_flags &= ~e_flag_EmptyChunk;
|
||||
|
||||
|
||||
// Don't bother trying to work out neighbours for this tile if we are at the edge of the chunk - apart from the very
|
||||
// bottom of the world where we shouldn't ever be able to see
|
||||
if( iY == 127 ) continue;
|
||||
if(( iX-startX == 0 ) || ( iX-startX == 15 )) continue;
|
||||
if(( iZ-startZ == 0 ) || ( iZ-startZ == 15 )) continue;
|
||||
|
||||
int flags = getFlags(iX, iY, iZ);
|
||||
|
||||
// Establish whether this tile and its neighbours are all made of rock, dirt, unbreakable tiles, or have already
|
||||
// been determined to meet this criteria themselves and have a tile of 255 set.
|
||||
if( !( ( tileID == Tile_SPU::rock_Id ) || ( tileID == Tile_SPU::dirt_Id ) || ( tileID == Tile_SPU::unbreakable_Id ) || ( flags & e_flag_NoRender) ) ) continue;
|
||||
tileID = getTile(iX-1, iY, iZ);
|
||||
flags = getFlags(iX-1, iY, iZ);
|
||||
if( !( ( tileID == Tile_SPU::rock_Id ) || ( tileID == Tile_SPU::dirt_Id ) || ( tileID == Tile_SPU::unbreakable_Id ) || ( flags & e_flag_NoRender) ) ) continue;
|
||||
tileID = getTile(iX+1, iY, iZ);
|
||||
flags = getFlags(iX+1, iY, iZ);
|
||||
if( !( ( tileID == Tile_SPU::rock_Id ) || ( tileID == Tile_SPU::dirt_Id ) || ( tileID == Tile_SPU::unbreakable_Id ) || ( flags & e_flag_NoRender) ) ) continue;
|
||||
tileID = getTile(iX, iY, iZ-1);
|
||||
flags = getFlags(iX, iY, iZ-1);
|
||||
if( !( ( tileID == Tile_SPU::rock_Id ) || ( tileID == Tile_SPU::dirt_Id ) || ( tileID == Tile_SPU::unbreakable_Id ) || ( flags & e_flag_NoRender) ) ) continue;
|
||||
tileID = getTile(iX, iY, iZ+1);
|
||||
flags = getFlags(iX, iY, iZ+1);
|
||||
if( !( ( tileID == Tile_SPU::rock_Id ) || ( tileID == Tile_SPU::dirt_Id ) || ( tileID == Tile_SPU::unbreakable_Id ) || ( flags & e_flag_NoRender) ) ) continue;
|
||||
// Treat the bottom of the world differently - we shouldn't ever be able to look up at this, so consider tiles as invisible
|
||||
// if they are surrounded on sides other than the bottom
|
||||
if( iY > 0 )
|
||||
{
|
||||
tileID = getTile(iX, iY-1, iZ);
|
||||
flags = getFlags(iX, iY-1, iZ);
|
||||
if( !( ( tileID == Tile_SPU::rock_Id ) || ( tileID == Tile_SPU::dirt_Id ) || ( tileID == Tile_SPU::unbreakable_Id ) || ( flags & e_flag_NoRender) ) ) continue;
|
||||
}
|
||||
tileID = getTile(iX, iY+1, iZ);
|
||||
flags = getFlags(iX, iY+1, iZ);
|
||||
if( !( ( tileID == Tile_SPU::rock_Id ) || ( tileID == Tile_SPU::dirt_Id ) || ( tileID == Tile_SPU::unbreakable_Id ) || ( flags & e_flag_NoRender) ) ) continue;
|
||||
|
||||
// This tile is surrounded. Flag it as not requiring to be rendered by setting its id to 255.
|
||||
setFlag(iX, iY, iZ, e_flag_NoRender);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef SN_TARGET_PS3_SPU
|
||||
|
||||
void setIconSPUFromIcon(Icon_SPU* iconSpu, Icon* icon)
|
||||
{
|
||||
iconSpu->set(icon->getX(), icon->getY(), icon->getWidth(), icon->getHeight(), icon->getSourceWidth(), icon->getSourceHeight());
|
||||
}
|
||||
|
||||
void ChunkRebuildData::buildMaterial(int matSPUIndex, Material* mat)
|
||||
{
|
||||
Material_SPU* matSPU = &m_tileData.materials[matSPUIndex];
|
||||
matSPU->id = matSPUIndex;
|
||||
matSPU->color = mat->color->col;
|
||||
matSPU->flags =0;
|
||||
matSPU->flags |= mat->isFlammable() ? Material_SPU::e_flammable : 0;
|
||||
matSPU->flags |= mat->isReplaceable() ? Material_SPU::e_replaceable : 0;
|
||||
matSPU->flags |= mat->_neverBuildable ? Material_SPU::e_neverBuildable : 0;
|
||||
matSPU->flags |= mat->isSolid() ? Material_SPU::e_isSolid : 0;
|
||||
matSPU->flags |= mat->isLiquid() ? Material_SPU::e_isLiquid : 0;
|
||||
matSPU->flags |= mat->blocksLight() ? Material_SPU::e_blocksLight : 0;
|
||||
matSPU->flags |= mat->blocksMotion() ? Material_SPU::e_blocksMotion : 0;
|
||||
}
|
||||
|
||||
void ChunkRebuildData::buildMaterials()
|
||||
{
|
||||
buildMaterial(Material_SPU::air_Id, Material::air);
|
||||
buildMaterial(Material_SPU::grass_Id, Material::grass);
|
||||
buildMaterial(Material_SPU::dirt_Id, Material::dirt);
|
||||
buildMaterial(Material_SPU::wood_Id, Material::wood);
|
||||
buildMaterial(Material_SPU::stone_Id, Material::stone);
|
||||
buildMaterial(Material_SPU::metal_Id, Material::metal);
|
||||
buildMaterial(Material_SPU::water_Id, Material::water);
|
||||
buildMaterial(Material_SPU::lava_Id, Material::lava);
|
||||
buildMaterial(Material_SPU::leaves_Id, Material::leaves);
|
||||
buildMaterial(Material_SPU::plant_Id, Material::plant);
|
||||
buildMaterial(Material_SPU::replaceable_plant_Id, Material::replaceable_plant);
|
||||
buildMaterial(Material_SPU::sponge_Id, Material::sponge);
|
||||
buildMaterial(Material_SPU::cloth_Id, Material::cloth);
|
||||
buildMaterial(Material_SPU::fire_Id, Material::fire);
|
||||
buildMaterial(Material_SPU::sand_Id, Material::sand);
|
||||
buildMaterial(Material_SPU::decoration_Id, Material::decoration);
|
||||
buildMaterial(Material_SPU::clothDecoration_Id, Material::clothDecoration);
|
||||
buildMaterial(Material_SPU::glass_Id, Material::glass);
|
||||
buildMaterial(Material_SPU::explosive_Id, Material::explosive);
|
||||
buildMaterial(Material_SPU::coral_Id, Material::coral);
|
||||
buildMaterial(Material_SPU::ice_Id, Material::ice);
|
||||
buildMaterial(Material_SPU::topSnow_Id, Material::topSnow);
|
||||
buildMaterial(Material_SPU::snow_Id, Material::snow);
|
||||
buildMaterial(Material_SPU::cactus_Id, Material::cactus);
|
||||
buildMaterial(Material_SPU::clay_Id, Material::clay);
|
||||
buildMaterial(Material_SPU::vegetable_Id, Material::vegetable);
|
||||
buildMaterial(Material_SPU::egg_Id, Material::egg);
|
||||
buildMaterial(Material_SPU::portal_Id, Material::portal);
|
||||
buildMaterial(Material_SPU::cake_Id, Material::cake);
|
||||
buildMaterial(Material_SPU::web_Id, Material::web);
|
||||
buildMaterial(Material_SPU::piston_Id, Material::piston);
|
||||
buildMaterial(Material_SPU::buildable_glass_Id, Material::buildable_glass);
|
||||
buildMaterial(Material_SPU::heavyMetal_Id, Material::heavyMetal);
|
||||
}
|
||||
|
||||
int ChunkRebuildData::getMaterialID(Tile* pTile)
|
||||
{
|
||||
Material* m = pTile->material;
|
||||
if(m == Material::air) return Material_SPU::air_Id;
|
||||
if(m == Material::grass) return Material_SPU::grass_Id;
|
||||
if(m == Material::dirt) return Material_SPU::dirt_Id;
|
||||
if(m == Material::wood) return Material_SPU::wood_Id;
|
||||
if(m == Material::stone) return Material_SPU::stone_Id;
|
||||
if(m == Material::metal) return Material_SPU::metal_Id;
|
||||
if(m == Material::water) return Material_SPU::water_Id;
|
||||
if(m == Material::lava) return Material_SPU::lava_Id;
|
||||
if(m == Material::leaves) return Material_SPU::leaves_Id;
|
||||
if(m == Material::plant) return Material_SPU::plant_Id;
|
||||
if(m == Material::replaceable_plant)return Material_SPU::replaceable_plant_Id;
|
||||
if(m == Material::sponge) return Material_SPU::sponge_Id;
|
||||
if(m == Material::cloth) return Material_SPU::cloth_Id;
|
||||
if(m == Material::fire) return Material_SPU::fire_Id;
|
||||
if(m == Material::sand) return Material_SPU::sand_Id;
|
||||
if(m == Material::decoration) return Material_SPU::decoration_Id;
|
||||
if(m == Material::clothDecoration) return Material_SPU::clothDecoration_Id;
|
||||
if(m == Material::glass) return Material_SPU::glass_Id;
|
||||
if(m == Material::explosive) return Material_SPU::explosive_Id;
|
||||
if(m == Material::coral) return Material_SPU::coral_Id;
|
||||
if(m == Material::ice) return Material_SPU::ice_Id;
|
||||
if(m == Material::topSnow) return Material_SPU::topSnow_Id;
|
||||
if(m == Material::snow) return Material_SPU::snow_Id;
|
||||
if(m == Material::cactus) return Material_SPU::cactus_Id;
|
||||
if(m == Material::clay) return Material_SPU::clay_Id;
|
||||
if(m == Material::vegetable) return Material_SPU::vegetable_Id;
|
||||
if(m == Material::egg) return Material_SPU::egg_Id;
|
||||
if(m == Material::portal) return Material_SPU::portal_Id;
|
||||
if(m == Material::cake) return Material_SPU::cake_Id;
|
||||
if(m == Material::web) return Material_SPU::web_Id;
|
||||
if(m == Material::piston) return Material_SPU::piston_Id;
|
||||
if(m == Material::buildable_glass) return Material_SPU::buildable_glass_Id;
|
||||
if(m == Material::heavyMetal) return Material_SPU::heavyMetal_Id;
|
||||
assert(0);
|
||||
return Material_SPU::air_Id;
|
||||
}
|
||||
|
||||
|
||||
void ChunkRebuildData::createTileData()
|
||||
{
|
||||
// build the material data
|
||||
buildMaterials();
|
||||
|
||||
// build the tile data
|
||||
for(int i=0;i<256;i++)
|
||||
{
|
||||
m_tileData.mipmapEnable.set(i, Tile::mipmapEnable[i]);
|
||||
m_tileData.solid.set(i, Tile::solid[i]);
|
||||
m_tileData.transculent.set(i, Tile::transculent[i]);
|
||||
// m_tileData._sendTileData.set(i, Tile::_sendTileData[i]);
|
||||
m_tileData.propagate.set(i, Tile::propagate[i]);
|
||||
m_tileData.lightBlock[i] = Tile::lightBlock[i];
|
||||
m_tileData.lightEmission[i] = Tile::lightEmission[i];
|
||||
if(Tile::tiles[i])
|
||||
{
|
||||
m_tileData.signalSource.set(i, Tile::tiles[i]->isSignalSource());
|
||||
m_tileData.cubeShaped.set(i, Tile::tiles[i]->isCubeShaped());
|
||||
|
||||
m_tileData.xx0[i] = (float)Tile::tiles[i]->getShapeX0();
|
||||
m_tileData.yy0[i] = (float)Tile::tiles[i]->getShapeY0();
|
||||
m_tileData.zz0[i] = (float)Tile::tiles[i]->getShapeZ0();
|
||||
m_tileData.xx1[i] = (float)Tile::tiles[i]->getShapeX1();
|
||||
m_tileData.yy1[i] = (float)Tile::tiles[i]->getShapeY1();
|
||||
m_tileData.zz1[i] = (float)Tile::tiles[i]->getShapeZ1();
|
||||
Icon* pTex = Tile::tiles[i]->icon;
|
||||
if(pTex)
|
||||
{
|
||||
setIconSPUFromIcon(&m_tileData.iconData[i], pTex);
|
||||
}
|
||||
m_tileData.materialIDs[i] = getMaterialID(Tile::tiles[i]);
|
||||
}
|
||||
}
|
||||
m_tileData.leafTile_allowSame = Tile::leaves->allowSame;
|
||||
m_tileData.leafTile_fancyTextureSet = Tile::leaves->fancyTextureSet;
|
||||
|
||||
|
||||
// Custom tile textures
|
||||
// get the width and height of any texture, since everything uses the same texture
|
||||
m_tileData.iconTexWidth = Tile::grass->iconTop->getSourceWidth();
|
||||
m_tileData.iconTexHeight = Tile::grass->iconTop->getSourceHeight();
|
||||
// Grass tile
|
||||
setIconSPUFromIcon(&m_tileData.grass_iconTop, Tile::grass->iconTop);
|
||||
setIconSPUFromIcon(&m_tileData.grass_iconSnowSide, Tile::grass->iconSnowSide);
|
||||
setIconSPUFromIcon(&m_tileData.grass_iconSideOverlay, Tile::grass->iconSideOverlay);
|
||||
|
||||
// ThinFence
|
||||
setIconSPUFromIcon(&m_tileData.ironFence_EdgeTexture, ((ThinFenceTile*)Tile::ironFence)->getEdgeTexture());
|
||||
setIconSPUFromIcon(&m_tileData.thinGlass_EdgeTexture, ((ThinFenceTile*)Tile::thinGlass)->getEdgeTexture());
|
||||
|
||||
//FarmTile
|
||||
setIconSPUFromIcon(&m_tileData.farmTile_Dry, ((FarmTile*)Tile::farmland)->iconDry);
|
||||
setIconSPUFromIcon(&m_tileData.farmTile_Wet, ((FarmTile*)Tile::farmland)->iconWet);
|
||||
|
||||
// DoorTile
|
||||
for(int i=0;i<8; i++)
|
||||
{
|
||||
setIconSPUFromIcon(&m_tileData.doorTile_Icons[i], ((DoorTile*)Tile::door_wood)->icons[i]);
|
||||
// we're not supporting flipped icons, so manually flip here
|
||||
if(i>=4)
|
||||
m_tileData.doorTile_Icons[i].flipHorizontal();
|
||||
}
|
||||
|
||||
// TallGrass
|
||||
for(int i=0;i<3; i++)
|
||||
setIconSPUFromIcon(&m_tileData.tallGrass_Icons[i], Tile::tallgrass->icons[i]);
|
||||
|
||||
// SandStoneTile
|
||||
for(int i=0;i<3; i++)
|
||||
setIconSPUFromIcon(&m_tileData.sandStone_icons[i], ((SandStoneTile*)Tile::sandStone)->icons[i]);
|
||||
setIconSPUFromIcon(&m_tileData.sandStone_iconTop, ((SandStoneTile*)Tile::sandStone)->iconTop);
|
||||
setIconSPUFromIcon(&m_tileData.sandStone_iconBottom, ((SandStoneTile*)Tile::sandStone)->iconBottom);
|
||||
|
||||
// WoodTile
|
||||
// assert(WoodTile_SPU::WOOD_NAMES_LENGTH == 4);
|
||||
for(int i=0;i<4; i++)
|
||||
setIconSPUFromIcon(&m_tileData.woodTile_icons[i], ((WoodTile*)Tile::wood)->icons[i]);
|
||||
|
||||
// TreeTile
|
||||
// assert(TreeTile_SPU::TREE_NAMES_LENGTH == 4);
|
||||
for(int i=0;i<4; i++)
|
||||
setIconSPUFromIcon(&m_tileData.treeTile_icons[i], ((TreeTile*)Tile::treeTrunk)->icons[i]);
|
||||
setIconSPUFromIcon(&m_tileData.treeTile_iconTop, ((TreeTile*)Tile::treeTrunk)->iconTop);
|
||||
|
||||
// LeafTile
|
||||
for(int i=0;i<2; i++)
|
||||
for(int j=0;j<4;j++)
|
||||
setIconSPUFromIcon(&m_tileData.leafTile_icons[i][j], ((LeafTile*)Tile::leaves)->icons[i][j]);
|
||||
|
||||
// CropTile
|
||||
for(int i=0;i<8; i++)
|
||||
setIconSPUFromIcon(&m_tileData.cropTile_icons[i], ((CropTile*)Tile::crops)->icons[i]);
|
||||
|
||||
// FurnaceTile
|
||||
setIconSPUFromIcon(&m_tileData.furnaceTile_iconTop, ((FurnaceTile*)Tile::furnace)->iconTop);
|
||||
setIconSPUFromIcon(&m_tileData.furnaceTile_iconFront, ((FurnaceTile*)Tile::furnace)->iconFront);
|
||||
setIconSPUFromIcon(&m_tileData.furnaceTile_iconFront_lit, ((FurnaceTile*)Tile::furnace_lit)->iconFront);
|
||||
|
||||
//LiquidTile
|
||||
setIconSPUFromIcon(&m_tileData.liquidTile_iconWaterStill, (Tile::water)->icons[0]);
|
||||
setIconSPUFromIcon(&m_tileData.liquidTile_iconWaterFlow, (Tile::water)->icons[1]);
|
||||
setIconSPUFromIcon(&m_tileData.liquidTile_iconLavaStill, (Tile::lava)->icons[0]);
|
||||
setIconSPUFromIcon(&m_tileData.liquidTile_iconLavaFlow, (Tile::lava)->icons[1]);
|
||||
|
||||
//FireTile
|
||||
for(int i=0;i<2;i++)
|
||||
setIconSPUFromIcon(&m_tileData.fireTile_icons[i], (Tile::fire)->icons[i]);
|
||||
|
||||
// Sapling
|
||||
for(int i=0;i<4;i++)
|
||||
setIconSPUFromIcon(&m_tileData.sapling_icons[i], ((Sapling*)Tile::sapling)->icons[i]);
|
||||
|
||||
m_tileData.glassTile_allowSame = ((GlassTile*)Tile::glass)->allowSame;
|
||||
m_tileData.iceTile_allowSame = ((IceTile*)Tile::ice)->allowSame;
|
||||
|
||||
// DispenserTile
|
||||
setIconSPUFromIcon(&m_tileData.dispenserTile_iconTop, ((DispenserTile*)Tile::dispenser)->iconTop);
|
||||
setIconSPUFromIcon(&m_tileData.dispenserTile_iconFront, ((DispenserTile*)Tile::dispenser)->iconFront);
|
||||
setIconSPUFromIcon(&m_tileData.dispenserTile_iconFrontVertical, ((DispenserTile*)Tile::dispenser)->iconFrontVertical);
|
||||
|
||||
// RailTile
|
||||
setIconSPUFromIcon(&m_tileData.railTile_iconTurn, ((RailTile*)Tile::rail)->iconTurn);
|
||||
setIconSPUFromIcon(&m_tileData.railTile_iconTurnGolden, ((RailTile*)Tile::goldenRail)->iconTurn);
|
||||
|
||||
for(int i=0;i<2;i++)
|
||||
setIconSPUFromIcon(&m_tileData.detectorRailTile_icons[i], ((DetectorRailTile*)Tile::detectorRail)->icons[i]);
|
||||
|
||||
// tntTile
|
||||
setIconSPUFromIcon(&m_tileData.tntTile_iconBottom, ((TntTile*)Tile::tnt)->iconBottom);
|
||||
setIconSPUFromIcon(&m_tileData.tntTile_iconTop, ((TntTile*)Tile::tnt)->iconTop);
|
||||
|
||||
// workbenchTile
|
||||
setIconSPUFromIcon(&m_tileData.workBench_iconFront, ((WorkbenchTile*)Tile::workBench)->iconFront);
|
||||
setIconSPUFromIcon(&m_tileData.workBench_iconTop, ((WorkbenchTile*)Tile::workBench)->iconTop);
|
||||
|
||||
// cactusTile
|
||||
setIconSPUFromIcon(&m_tileData.cactusTile_iconTop, ((CactusTile*)Tile::cactus)->iconTop);
|
||||
setIconSPUFromIcon(&m_tileData.cactusTile_iconBottom, ((CactusTile*)Tile::cactus)->iconBottom);
|
||||
|
||||
// recordPlayer
|
||||
setIconSPUFromIcon(&m_tileData.recordPlayer_iconTop, ((RecordPlayerTile*)Tile::recordPlayer)->iconTop);
|
||||
|
||||
// pumpkin
|
||||
setIconSPUFromIcon(&m_tileData.pumpkinTile_iconTop, ((PumpkinTile*)Tile::pumpkin)->iconTop);
|
||||
setIconSPUFromIcon(&m_tileData.pumpkinTile_iconFace, ((PumpkinTile*)Tile::pumpkin)->iconFace);
|
||||
setIconSPUFromIcon(&m_tileData.pumpkinTile_iconFaceLit, ((PumpkinTile*)Tile::litPumpkin)->iconFace);
|
||||
|
||||
// cakeTile
|
||||
setIconSPUFromIcon(&m_tileData.cakeTile_iconTop, ((CakeTile*)Tile::cake)->iconTop);
|
||||
setIconSPUFromIcon(&m_tileData.cakeTile_iconBottom, ((CakeTile*)Tile::cake)->iconBottom);
|
||||
setIconSPUFromIcon(&m_tileData.cakeTile_iconInner, ((CakeTile*)Tile::cake)->iconInner);
|
||||
|
||||
// SmoothStoneBrickTile
|
||||
for(int i=0;i<4;i++)
|
||||
setIconSPUFromIcon(&m_tileData.smoothStoneBrick_icons[i], ((SmoothStoneBrickTile*)Tile::stoneBrickSmooth)->icons[i]);
|
||||
|
||||
// HugeMushroomTile
|
||||
for(int i=0;i<2;i++)
|
||||
setIconSPUFromIcon(&m_tileData.hugeMushroom_icons[i], ((HugeMushroomTile*)Tile::hugeMushroom1)->icons[i]);
|
||||
setIconSPUFromIcon(&m_tileData.hugeMushroom_iconStem, ((HugeMushroomTile*)Tile::hugeMushroom1)->iconStem);
|
||||
setIconSPUFromIcon(&m_tileData.hugeMushroom_iconInside, ((HugeMushroomTile*)Tile::hugeMushroom1)->iconInside);
|
||||
|
||||
|
||||
// MelonTile
|
||||
setIconSPUFromIcon(&m_tileData.melonTile_iconTop, ((MelonTile*)Tile::melon)->iconTop);
|
||||
|
||||
// StemTile
|
||||
setIconSPUFromIcon(&m_tileData.stemTile_iconAngled, ((StemTile*)Tile::melonStem)->iconAngled);
|
||||
|
||||
// MycelTile
|
||||
setIconSPUFromIcon(&m_tileData.mycelTile_iconTop, (Tile::mycel)->iconTop);
|
||||
setIconSPUFromIcon(&m_tileData.mycelTile_iconSnowSide, (Tile::mycel)->iconSnowSide);
|
||||
|
||||
// NetherStalkTile
|
||||
for(int i=0;i<3;i++)
|
||||
setIconSPUFromIcon(&m_tileData.netherStalk_icons[i], ((NetherStalkTile*)Tile::netherStalk)->icons[i]);
|
||||
|
||||
// EnchantmentTableTile
|
||||
setIconSPUFromIcon(&m_tileData.enchantmentTable_iconTop, ((EnchantmentTableTile*)Tile::enchantTable)->iconTop);
|
||||
setIconSPUFromIcon(&m_tileData.enchantmentTable_iconBottom, ((EnchantmentTableTile*)Tile::enchantTable)->iconBottom);
|
||||
|
||||
//BrewingStandTile
|
||||
setIconSPUFromIcon(&m_tileData.brewingStand_iconBase, ((BrewingStandTile*)Tile::brewingStand)->iconBase);
|
||||
|
||||
//RedStoneDust
|
||||
setIconSPUFromIcon(&m_tileData.redStoneDust_iconCross, (Tile::redStoneDust)->iconCross);
|
||||
setIconSPUFromIcon(&m_tileData.redStoneDust_iconCross, (Tile::redStoneDust)->iconLine);
|
||||
setIconSPUFromIcon(&m_tileData.redStoneDust_iconCrossOver, (Tile::redStoneDust)->iconCrossOver);
|
||||
setIconSPUFromIcon(&m_tileData.redStoneDust_iconLineOver, (Tile::redStoneDust)->iconLineOver);
|
||||
|
||||
setIconSPUFromIcon(&m_tileData.stoneSlab_iconSide, ((StoneSlabTile*)(Tile::stoneSlab))->iconSide);
|
||||
|
||||
for(int i=0;i<16;i++)
|
||||
setIconSPUFromIcon(&m_tileData.clothTile_icons[i], ((ClothTile*)Tile::cloth)->icons[i]);
|
||||
|
||||
// CarrotTile
|
||||
for(int i=0;i<4;i++)
|
||||
setIconSPUFromIcon(&m_tileData.carrot_icons[i], ((CarrotTile*)Tile::carrots)->icons[i]);
|
||||
|
||||
// PotatoTile
|
||||
for(int i=0;i<4;i++)
|
||||
setIconSPUFromIcon(&m_tileData.potato_icons[i], ((PotatoTile*)Tile::potatoes)->icons[i]);
|
||||
|
||||
// AnvilTile
|
||||
for(int i=0;i<3;i++)
|
||||
setIconSPUFromIcon(&m_tileData.anvil_icons[i], ((AnvilTile*)Tile::anvil)->icons[i]);
|
||||
|
||||
|
||||
// QuartzBlockTile
|
||||
for(int i=0;i<5;i++)
|
||||
setIconSPUFromIcon(&m_tileData.quartzBlock_icons[i], ((QuartzBlockTile*)Tile::quartzBlock)->icons[i]);
|
||||
|
||||
setIconSPUFromIcon(&m_tileData.quartzBlock_iconChiseledTop, ((QuartzBlockTile*)Tile::quartzBlock)->iconChiseledTop);
|
||||
setIconSPUFromIcon(&m_tileData.quartzBlock_iconLinesTop, ((QuartzBlockTile*)Tile::quartzBlock)->iconLinesTop);
|
||||
setIconSPUFromIcon(&m_tileData.quartzBlock_iconTop, ((QuartzBlockTile*)Tile::quartzBlock)->iconTop);
|
||||
setIconSPUFromIcon(&m_tileData.quartzBlock_iconBottom, ((QuartzBlockTile*)Tile::quartzBlock)->iconBottom);
|
||||
}
|
||||
|
||||
// extern int g_lastHitBlockX;
|
||||
// extern int g_lastHitBlockY;
|
||||
// extern int g_lastHitBlockZ;
|
||||
|
||||
void ChunkRebuildData::buildForChunk( Region* region, Level* level, int x0, int y0, int z0 )
|
||||
{
|
||||
static bool bCreatedTileData = false;
|
||||
if(!bCreatedTileData)
|
||||
{
|
||||
createTileData();
|
||||
bCreatedTileData = true;
|
||||
}
|
||||
|
||||
m_tileData.stemTile_minColour = Minecraft::GetInstance()->getColourTable()->getColor( eMinecraftColour_Tile_StemMin );
|
||||
m_tileData.stemTile_maxColour = Minecraft::GetInstance()->getColourTable()->getColor( eMinecraftColour_Tile_StemMax );
|
||||
m_tileData.waterLily_colour = Minecraft::GetInstance()->getColourTable()->getColor( eMinecraftColour_Tile_WaterLily );
|
||||
|
||||
m_tileData.foliageColor_evergreenColor = FoliageColor::getEvergreenColor();
|
||||
m_tileData.foliageColor_birchColor = FoliageColor::getBirchColor();
|
||||
|
||||
|
||||
// m_lastHitBlockX = g_lastHitBlockX;
|
||||
// m_lastHitBlockY = g_lastHitBlockY;
|
||||
// m_lastHitBlockZ = g_lastHitBlockZ;
|
||||
|
||||
m_x0 = x0-2;
|
||||
m_y0 = y0-2;
|
||||
m_z0 = z0-2;
|
||||
m_pRegion = region;
|
||||
m_flags = 0;//e_flag_EmptyChunk;
|
||||
|
||||
// for(int iX=m_x0; iX<(m_x0+sc_size); iX++)
|
||||
// {
|
||||
// for(int iY=m_y0; iY<(m_y0+sc_size); iY++)
|
||||
// {
|
||||
// for(int iZ=m_z0; iZ<(m_z0+sc_size); iZ++)
|
||||
// {
|
||||
// buildTile(iX, iY, iZ);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
BiomeCache::Block* cacheBlocks[9];
|
||||
cacheBlocks[0] = region->getBiomeSource()->getBlockAt(m_x0, m_z0);
|
||||
cacheBlocks[1] = region->getBiomeSource()->getBlockAt(m_x0+2, m_z0);
|
||||
cacheBlocks[2] = region->getBiomeSource()->getBlockAt(m_x0+18, m_z0);
|
||||
|
||||
cacheBlocks[3] = region->getBiomeSource()->getBlockAt(m_x0, m_z0+2);
|
||||
cacheBlocks[4] = region->getBiomeSource()->getBlockAt(m_x0+2, m_z0+2);
|
||||
cacheBlocks[5] = region->getBiomeSource()->getBlockAt(m_x0+18, m_z0+2);
|
||||
|
||||
cacheBlocks[6] = region->getBiomeSource()->getBlockAt(m_x0, m_z0+18);
|
||||
cacheBlocks[7] = region->getBiomeSource()->getBlockAt(m_x0+2, m_z0+18);
|
||||
cacheBlocks[8] = region->getBiomeSource()->getBlockAt(m_x0+18, m_z0+18);
|
||||
|
||||
int cacheMap[20] = { 0,0, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 2,2};
|
||||
|
||||
ColourTable* pColourTable = Minecraft::GetInstance()->getColourTable();
|
||||
|
||||
for(int iX=m_x0; iX<(m_x0+sc_size); iX++)
|
||||
{
|
||||
for(int iZ=m_z0; iZ<(m_z0+sc_size); iZ++)
|
||||
{
|
||||
int newX = ( iX - m_x0 );
|
||||
int newZ = ( iZ - m_z0 );
|
||||
int index = (newX*sc_size) + newZ;
|
||||
// assert(index < 400);
|
||||
int cacheBlockIndex = (cacheMap[iZ-m_z0]*3) + cacheMap[iX-m_x0];
|
||||
BiomeCache::Block* pCacheBlock = cacheBlocks[cacheBlockIndex];
|
||||
// assert(region->getBiomeSource()->getBlockAt(iX, iZ) == pCacheBlock);
|
||||
Biome* pBiome = pCacheBlock->getBiome(iX, iZ);
|
||||
m_grassColor[index] = pColourTable->getColor(pBiome->m_grassColor);
|
||||
m_foliageColor[index] = pColourTable->getColor(pBiome->m_foliageColor);
|
||||
m_waterColor[index] = pColourTable->getColor(pBiome->m_waterColor);
|
||||
}
|
||||
}
|
||||
|
||||
if(isEmptyChunk())
|
||||
return;
|
||||
|
||||
|
||||
if(level->dimension->hasCeiling)
|
||||
m_flags |= e_flag_HasCeiling;
|
||||
for(int i=0;i<16;i++)
|
||||
m_brightnessRamp[i] = level->dimension->brightnessRamp[i];
|
||||
m_levelSkyDarken = level->skyDarken;
|
||||
}
|
||||
|
||||
void ChunkRebuildData::copyFromTesselator()
|
||||
{
|
||||
Tesselator* t = Tesselator::getInstance(); // 4J - added - static initialiser being set at the wrong time
|
||||
|
||||
m_tesselator.m_PPUArray = t->_array->data;
|
||||
assert(t->p == 0);
|
||||
m_tesselator.m_PPUOffset = 0;
|
||||
|
||||
// copy tesselator vars over
|
||||
m_tesselator.vertices = t->vertices;
|
||||
m_tesselator.u = t->u;
|
||||
m_tesselator.v = t->v;
|
||||
m_tesselator._tex2 = t->_tex2;
|
||||
m_tesselator.col = t->col;
|
||||
m_tesselator.hasColor = t->hasColor;
|
||||
m_tesselator.hasTexture = t->hasTexture;
|
||||
m_tesselator.hasTexture2 = t->hasTexture2;
|
||||
m_tesselator.hasNormal = t->hasNormal;
|
||||
m_tesselator.p = t->p;
|
||||
m_tesselator.useCompactFormat360 = t->useCompactFormat360;
|
||||
m_tesselator.useProjectedTexturePixelShader = t->useProjectedTexturePixelShader;
|
||||
m_tesselator.count = t->count;
|
||||
m_tesselator._noColor = t->_noColor;
|
||||
m_tesselator.mode = t->mode;
|
||||
m_tesselator.xo = t->xo;
|
||||
m_tesselator.yo = t->yo;
|
||||
m_tesselator.zo = t->zo;
|
||||
m_tesselator.count = t->count ;
|
||||
m_tesselator._normal = t->_normal;
|
||||
m_tesselator.tesselating = t->tesselating;
|
||||
m_tesselator.mipmapEnable = t->mipmapEnable; // 4J added
|
||||
m_tesselator.vboId = t->vboId;
|
||||
m_tesselator.vboCounts = t->vboCounts;
|
||||
m_tesselator.size = t->size;
|
||||
for(int i=0;i<6;i++)
|
||||
m_tesselator.bounds.boundingBox[i] = t->bounds.boundingBox[i];
|
||||
|
||||
}
|
||||
|
||||
|
||||
void ChunkRebuildData::buildTile(int x, int y, int z)
|
||||
{
|
||||
int newX = ( x - m_x0 );
|
||||
int newY = ( y - m_y0 );
|
||||
int newZ = ( z - m_z0 );
|
||||
|
||||
int index = (newX*sc_size*sc_size) + (newY*sc_size) + newZ;
|
||||
|
||||
m_tileIds[index] = m_pRegion->getTile(x, y, z);
|
||||
m_brightness[index] = m_pRegion->getBrightness(LightLayer::Sky, x, y, z);
|
||||
m_brightness[index] |= (m_pRegion->getBrightness(LightLayer::Block, x, y, z)) << 4;
|
||||
m_data_flags[index] = m_pRegion->getData(x,y,z);
|
||||
}
|
||||
|
||||
|
||||
void ChunkRebuildData::storeInTesselator()
|
||||
{
|
||||
Tesselator* t = Tesselator::getInstance(); // 4J - added - static initialiser being set at the wrong time
|
||||
|
||||
// copy tesselator vars over
|
||||
t->vertices = m_tesselator.vertices;
|
||||
t->u = m_tesselator.u;
|
||||
t->v = m_tesselator.v;
|
||||
t->_tex2 = m_tesselator._tex2;
|
||||
t->col = m_tesselator.col;
|
||||
t->hasColor = m_tesselator.hasColor;
|
||||
t->hasTexture = m_tesselator.hasTexture;
|
||||
t->hasTexture2 = m_tesselator.hasTexture2;
|
||||
t->hasNormal = m_tesselator.hasNormal;
|
||||
t->p = m_tesselator.m_PPUOffset/4;
|
||||
t->useCompactFormat360 = m_tesselator.useCompactFormat360;
|
||||
t->useProjectedTexturePixelShader = m_tesselator.useProjectedTexturePixelShader;
|
||||
t->count = m_tesselator.count;
|
||||
t->_noColor = m_tesselator._noColor;
|
||||
t->mode = m_tesselator.mode;
|
||||
t->xo = m_tesselator.xo;
|
||||
t->yo = m_tesselator.yo;
|
||||
t->zo = m_tesselator.zo;
|
||||
t->count = m_tesselator.count;
|
||||
t->_normal = m_tesselator._normal;
|
||||
t->tesselating = m_tesselator.tesselating;
|
||||
t->mipmapEnable = m_tesselator.mipmapEnable; // 4J added
|
||||
t->vboId = m_tesselator.vboId;
|
||||
t->vboCounts = m_tesselator.vboCounts;
|
||||
t->size = m_tesselator.size;
|
||||
for(int i=0;i<6;i++)
|
||||
t->bounds.boundingBox[i] = m_tesselator.bounds.boundingBox[i];
|
||||
}
|
||||
#endif // SN_TARGET_PS3_SPU
|
||||
|
||||
|
||||
|
||||
void ChunkRebuildData::tesselateAllTiles(TileRenderer_SPU* pTileRenderer)
|
||||
{
|
||||
Tile_SPU::ms_pTileData = &m_tileData;
|
||||
// 4J - changed loop order here to leave y as the innermost loop for better cache performance
|
||||
bool renderNextLayer = false;
|
||||
bool rendered = false;
|
||||
int numRenderedLayer0 = 0;
|
||||
int startX = m_x0+2; // beginning of the chunk
|
||||
int startY = m_y0+2; // beginning of the chunk
|
||||
int startZ = m_z0+2; // beginning of the chunk
|
||||
|
||||
m_tesselator.beginData();
|
||||
for (int z = startZ; z < (startZ+16); z++)
|
||||
{
|
||||
for (int x = startX; x < (startX+16); x++)
|
||||
{
|
||||
for (int y = startY; y < (startY+16); y++)
|
||||
{
|
||||
// 4J - get tile from those copied into our local array in earlier optimisation
|
||||
int flags = getFlags(x,y,z);
|
||||
if(flags & ChunkRebuildData::e_flag_NoRender)
|
||||
continue;
|
||||
unsigned char tileId = getTile(x,y,z);
|
||||
if (tileId > 0)
|
||||
{
|
||||
// if (m_currentLayer == 0 && m_tileData.isEntityTile[tileId])
|
||||
// {
|
||||
// shared_ptr<TileEntity> et = region->getTileEntity(x, y, z);
|
||||
// if (TileEntityRenderDispatcher::instance->hasRenderer(et))
|
||||
// {
|
||||
// renderableTileEntities.push_back(et);
|
||||
// }
|
||||
// }
|
||||
TileRef_SPU tile(tileId);
|
||||
int renderLayer = tile->getRenderLayer();
|
||||
|
||||
if (renderLayer != m_currentLayer)
|
||||
{
|
||||
renderNextLayer = true;
|
||||
}
|
||||
else //if (renderLayer == m_currentLayer)
|
||||
{
|
||||
if(pTileRenderer->hasRenderer(tile.getPtr()))
|
||||
{
|
||||
numRenderedLayer0++;
|
||||
rendered |= pTileRenderer->tesselateInWorld(tile.getPtr(), x, y, z);
|
||||
}
|
||||
else
|
||||
{
|
||||
setFlag(x, y, z, e_flag_SPURenderCodeMissing);
|
||||
// #ifdef SN_TARGET_PS3_SPU
|
||||
// spu_print("Render code missing for tile ID %d : render shape %d\n", tile->id, tile->getRenderShape());
|
||||
// #endif
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(rendered)
|
||||
m_flags |= e_flag_Rendered;
|
||||
|
||||
// spu_print("(%d,%d,%d) SPU num rendered : %d\n", m_x0+2, m_y0+2, m_z0+2, numRenderedLayer0);
|
||||
|
||||
m_tesselator.endData();
|
||||
}
|
||||
|
||||
bool ChunkRebuildData::isEmptyTile(int x, int y, int z)
|
||||
{
|
||||
return getTile(x, y, z) == 0;
|
||||
}
|
||||
|
||||
bool ChunkRebuildData::isSolidRenderTile(int x, int y, int z)
|
||||
{
|
||||
TileRef_SPU tile(getTile(x,y,z));
|
||||
if (tile.getPtr() == NULL) return false;
|
||||
|
||||
|
||||
// 4J - addition here to make rendering big blocks of leaves more efficient. Normally leaves never consider themselves as solid, so
|
||||
// blocks of leaves will have all sides of each block completely visible. Changing to consider as solid if this block is surrounded by
|
||||
// other leaves. This is paired with another change in Tile::getTexture which makes such solid tiles actually visibly solid (these
|
||||
// textures exist already for non-fancy graphics). Note: this tile-specific code is here rather than making some new virtual method in the tiles,
|
||||
// for the sake of efficiency - I don't imagine we'll be doing much more of this sort of thing
|
||||
if( tile->id == Tile_SPU::leaves_Id )
|
||||
{
|
||||
int axo[6] = { 1,-1, 0, 0, 0, 0};
|
||||
int ayo[6] = { 0, 0, 1,-1, 0, 0};
|
||||
int azo[6] = { 0, 0, 0, 0, 1,-1};
|
||||
for( int i = 0; i < 6; i++ )
|
||||
{
|
||||
int t = getTile(x + axo[i], y + ayo[i] , z + azo[i]);
|
||||
if( ( t != Tile_SPU::leaves_Id ) && ( ( Tile_SPU::m_tiles[t].id == -1) || !Tile_SPU::m_tiles[t].isSolidRender() ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
return tile->isSolidRender();
|
||||
}
|
||||
|
||||
|
||||
bool ChunkRebuildData::isSolidBlockingTile(int x, int y, int z)
|
||||
{
|
||||
TileRef_SPU tile(getTile(x, y, z));
|
||||
if (tile.getPtr() == NULL) return false;
|
||||
bool ret = tile->getMaterial()->blocksMotion() && tile->isCubeShaped();
|
||||
return ret;
|
||||
}
|
||||
|
||||
float ChunkRebuildData::getBrightness(int x, int y, int z, int emitt)
|
||||
{
|
||||
int n = getRawBrightness(x, y, z);
|
||||
if (n < emitt) n = emitt;
|
||||
return m_brightnessRamp[n];
|
||||
}
|
||||
|
||||
float ChunkRebuildData::getBrightness(int x, int y, int z)
|
||||
{
|
||||
return m_brightnessRamp[getRawBrightness(x, y, z)];
|
||||
}
|
||||
|
||||
// 4J - brought forward from 1.8.2
|
||||
int ChunkRebuildData::getBrightness(LightLayer::variety layer, int x, int y, int z)
|
||||
{
|
||||
#ifndef SN_TARGET_PS3_SPU
|
||||
assert(Level_MAX_LEVEL_SIZE == Level::MAX_LEVEL_SIZE);
|
||||
assert(Level_maxBuildHeight == Level::maxBuildHeight);
|
||||
assert(Level_MAX_BRIGHTNESS == Level::MAX_BRIGHTNESS);
|
||||
#endif
|
||||
|
||||
if (y < 0) y = 0;
|
||||
if (y >= Level_maxBuildHeight) y = Level_maxBuildHeight - 1;
|
||||
if (y < 0 || y >= Level_maxBuildHeight || x < -Level_MAX_LEVEL_SIZE || z < -Level_MAX_LEVEL_SIZE || x >= Level_MAX_LEVEL_SIZE || z > Level_MAX_LEVEL_SIZE)
|
||||
{
|
||||
// 4J Stu - The java LightLayer was an enum class type with a member "surrounding" which is what we
|
||||
// were returning here. Surrounding has the same value as the enum value in our C++ code, so just cast
|
||||
// it to an int
|
||||
return (int)layer;
|
||||
}
|
||||
|
||||
if(layer == LightLayer::Sky)
|
||||
return getBrightnessSky(x, y, z);
|
||||
return getBrightnessBlock(x, y, z);
|
||||
}
|
||||
|
||||
// 4J - brought forward from 1.8.2
|
||||
int ChunkRebuildData::getBrightnessPropagate(LightLayer::variety layer, int x, int y, int z)
|
||||
{
|
||||
if (y < 0) y = 0;
|
||||
if (y >= Level_maxBuildHeight) y = Level_maxBuildHeight - 1;
|
||||
if (y < 0 || y >= Level_maxBuildHeight || x < -Level_MAX_LEVEL_SIZE || z < -Level_MAX_LEVEL_SIZE || x >= Level_MAX_LEVEL_SIZE || z > Level_MAX_LEVEL_SIZE)
|
||||
{
|
||||
// 4J Stu - The java LightLayer was an enum class type with a member "surrounding" which is what we
|
||||
// were returning here. Surrounding has the same value as the enum value in our C++ code, so just cast
|
||||
// it to an int
|
||||
return (int)layer;
|
||||
}
|
||||
|
||||
{
|
||||
int id = getTile(x, y, z);
|
||||
if (m_tileData.propagate[getTile(x, y, z)])
|
||||
{
|
||||
int br = getBrightness(layer, x, y + 1, z);
|
||||
int br1 = getBrightness(layer, x + 1, y, z);
|
||||
int br2 = getBrightness(layer, x - 1, y, z);
|
||||
int br3 = getBrightness(layer, x, y, z + 1);
|
||||
int br4 = getBrightness(layer, x, y, z - 1);
|
||||
if (br1 > br) br = br1;
|
||||
if (br2 > br) br = br2;
|
||||
if (br3 > br) br = br3;
|
||||
if (br4 > br) br = br4;
|
||||
return br;
|
||||
}
|
||||
}
|
||||
|
||||
if(layer == LightLayer::Sky)
|
||||
return getBrightnessSky(x, y, z);
|
||||
return getBrightnessBlock(x, y, z);
|
||||
|
||||
}
|
||||
int ChunkRebuildData::getLightColor(int x, int y, int z, int emitt) // 4J - change brought forward from 1.8.2
|
||||
{
|
||||
int s = getBrightnessPropagate(LightLayer::Sky, x, y, z);
|
||||
int b = getBrightnessPropagate(LightLayer::Block, x, y, z);
|
||||
if (b < emitt) b = emitt;
|
||||
return s << 20 | b << 4;
|
||||
}
|
||||
|
||||
|
||||
int ChunkRebuildData::getRawBrightness(int x, int y, int z)
|
||||
{
|
||||
return getRawBrightness(x, y, z, true);
|
||||
}
|
||||
|
||||
|
||||
int ChunkRebuildData::getRawBrightness(int x, int y, int z, bool propagate)
|
||||
{
|
||||
if (x < -Level_MAX_LEVEL_SIZE || z < -Level_MAX_LEVEL_SIZE || x >= Level_MAX_LEVEL_SIZE || z > Level_MAX_LEVEL_SIZE)
|
||||
{
|
||||
return Level_MAX_BRIGHTNESS;
|
||||
}
|
||||
|
||||
if (propagate)
|
||||
{
|
||||
int id = getTile(x, y, z);
|
||||
switch(id)
|
||||
{
|
||||
case Tile_SPU::stoneSlabHalf_Id:
|
||||
case Tile_SPU::woodSlabHalf_Id:
|
||||
case Tile_SPU::farmland_Id:
|
||||
case Tile_SPU::stairs_stone_Id:
|
||||
case Tile_SPU::stairs_wood_Id:
|
||||
{
|
||||
int br = getRawBrightness(x, y + 1, z, false);
|
||||
int br1 = getRawBrightness(x + 1, y, z, false);
|
||||
int br2 = getRawBrightness(x - 1, y, z, false);
|
||||
int br3 = getRawBrightness(x, y, z + 1, false);
|
||||
int br4 = getRawBrightness(x, y, z - 1, false);
|
||||
if (br1 > br) br = br1;
|
||||
if (br2 > br) br = br2;
|
||||
if (br3 > br) br = br3;
|
||||
if (br4 > br) br = br4;
|
||||
return br;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (y < 0) return 0;
|
||||
if (y >= Level_maxBuildHeight)
|
||||
{
|
||||
int br = Level_MAX_BRIGHTNESS - m_levelSkyDarken;
|
||||
if (br < 0) br = 0;
|
||||
return br;
|
||||
}
|
||||
|
||||
return LevelChunk_getRawBrightness(x, y, z, m_levelSkyDarken);
|
||||
}
|
||||
|
||||
int ChunkRebuildData::LevelChunk_getRawBrightness(int x, int y, int z, int skyDampen)
|
||||
{
|
||||
int light = (m_flags & e_flag_HasCeiling) ? 0 : getBrightnessSky(x, y, z);
|
||||
if (light > 0)
|
||||
m_flags |= e_flag_TouchedSky;
|
||||
light -= skyDampen;
|
||||
int block = getBrightnessBlock(x, y, z);
|
||||
if (block > light) light = block;
|
||||
|
||||
/*
|
||||
* int xd = (absFloor(level.player.x-(this->x*16+x))); int yd =
|
||||
* (absFloor(level.player.y-(y))); int zd =
|
||||
* (absFloor(level.player.z-(this->z*16+z))); int dd = xd+yd+zd; if
|
||||
* (dd<15){ int carried = 15-dd; if (carried<0) carried = 0; if
|
||||
* (carried>15) carried = 15; if (carried > light) light = carried; }
|
||||
*/
|
||||
|
||||
return light;
|
||||
|
||||
}
|
||||
|
||||
|
||||
Material_SPU *ChunkRebuildData::getMaterial(int x, int y, int z)
|
||||
{
|
||||
int t = getTile(x, y, z);
|
||||
int matID = Material_SPU::air_Id;
|
||||
if (t != 0)
|
||||
matID = m_tileData.materialIDs[t];
|
||||
return &m_tileData.materials[matID];
|
||||
}
|
||||
129
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/ChunkRebuildData.h
Normal file
129
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/ChunkRebuildData.h
Normal file
@@ -0,0 +1,129 @@
|
||||
|
||||
#pragma once
|
||||
#ifndef SN_TARGET_PS3_SPU
|
||||
#include "..\..\..\stdafx.h"
|
||||
#include "..\..\..\..\Minecraft.World\Region.h"
|
||||
#include "..\..\..\Tesselator.h"
|
||||
#include "..\..\..\..\Minecraft.World\LightLayer.h"
|
||||
#endif // SN_TARGET_PS3_SPU
|
||||
|
||||
#include "..\..\..\..\Minecraft.World\LightLayer.h"
|
||||
#include "Tile_SPU.h"
|
||||
#include "Tesselator_SPU.h"
|
||||
|
||||
class TileRenderer_SPU;
|
||||
|
||||
|
||||
|
||||
class ChunkRebuildData
|
||||
{
|
||||
public:
|
||||
enum tileFlags
|
||||
{
|
||||
e_flag_NoRender = 0x01,
|
||||
e_flag_SPURenderCodeMissing = 0x02
|
||||
};
|
||||
|
||||
enum chunkFlags
|
||||
{
|
||||
e_flag_EmptyChunk = 0x01,
|
||||
e_flag_HasCeiling = 0x02,
|
||||
e_flag_TouchedSky = 0x04,
|
||||
e_flag_Rendered = 0x08
|
||||
};
|
||||
|
||||
// private:
|
||||
static const int sc_size = 20;
|
||||
unsigned char m_tileIds[sc_size*sc_size*sc_size]; // byte
|
||||
unsigned char m_brightness[sc_size*sc_size*sc_size]; // 2x 4bit
|
||||
unsigned char m_data_flags[sc_size*sc_size*sc_size]; // 2x 4bit
|
||||
int m_grassColor[sc_size*sc_size];
|
||||
int m_foliageColor[sc_size*sc_size];
|
||||
int m_waterColor[sc_size*sc_size];
|
||||
|
||||
TileData_SPU m_tileData;
|
||||
Tesselator_SPU m_tesselator;
|
||||
|
||||
#ifdef SN_TARGET_PS3_SPU
|
||||
void* m_pRegion;
|
||||
#else
|
||||
Region* m_pRegion;
|
||||
#endif // SN_TARGET_PS3_SPU
|
||||
int m_x0;
|
||||
int m_y0;
|
||||
int m_z0;
|
||||
float m_brightnessRamp[16];
|
||||
int m_levelSkyDarken;
|
||||
unsigned int m_flags;
|
||||
unsigned int m_currentLayer;
|
||||
int m_lastHitBlockX;
|
||||
int m_lastHitBlockY;
|
||||
int m_lastHitBlockZ;
|
||||
unsigned int m_pad[3];// padding to 16 byte alignment
|
||||
|
||||
|
||||
int getTileIdx(int x, int y, int z) { return (( x - m_x0 )*sc_size*sc_size) + (( y - m_y0 )*sc_size) + ( z - m_z0 ); }
|
||||
int getTileIdx(int x, int z) { return (( x - m_x0 )*sc_size) + ( z - m_z0 ); }
|
||||
|
||||
void buildTile(int x, int y, int z);
|
||||
void disableUnseenTiles();
|
||||
void createTileData();
|
||||
public:
|
||||
|
||||
#if 0 //def SN_TARGET_PS3_SPU
|
||||
int getTile(int x, int y, int z);
|
||||
int getBrightnessSky(int x, int y, int z);
|
||||
int getBrightnessBlock(int x, int y, int z);
|
||||
int getData(int x, int y, int z);
|
||||
int getFlags(int x, int y, int z);
|
||||
|
||||
void setFlag(int x, int y, int z, int flag);
|
||||
int getGrassColor(int x, int z);
|
||||
int getFoliageColor(int x, int z);
|
||||
|
||||
#else
|
||||
int getTile( int x, int y, int z ) { return m_tileIds[getTileIdx(x,y,z)]; }
|
||||
int getBrightnessSky(int x, int y, int z) { return m_brightness[getTileIdx(x,y,z)] & 0x0f; }
|
||||
int getBrightnessBlock(int x, int y, int z) { return m_brightness[getTileIdx(x,y,z)] >> 4; }
|
||||
int getData(int x, int y, int z) { return m_data_flags[getTileIdx(x,y,z)] & 0x0f; }
|
||||
int getFlags(int x, int y, int z) { return m_data_flags[getTileIdx(x,y,z)] >> 4; }
|
||||
|
||||
void setFlag(int x, int y, int z, int flag) { m_data_flags[getTileIdx(x,y,z)] |= (flag<<4); }
|
||||
int getGrassColor( int x, int z ) { return m_grassColor[getTileIdx(x,z)]; }
|
||||
int getFoliageColor( int x, int z ) { return m_foliageColor[getTileIdx(x,z)]; }
|
||||
int getWaterColor( int x, int z ) { return m_waterColor[getTileIdx(x,z)]; }
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef SN_TARGET_PS3_SPU
|
||||
void buildMaterials();
|
||||
void buildMaterial(int matSPUIndex, Material* mat);
|
||||
int getMaterialID(Tile* pTile);
|
||||
void buildForChunk(Region* region, Level* level, int x0, int y0, int z0);
|
||||
void copyFromTesselator();
|
||||
void storeInTesselator();
|
||||
#endif
|
||||
bool isEmptyTile(int x, int y, int z);
|
||||
bool isEmptyChunk() { return m_flags & e_flag_EmptyChunk;}
|
||||
bool isSolidRenderTile(int x, int y, int z);
|
||||
bool isSolidBlockingTile(int x, int y, int z);
|
||||
float getBrightness(int x, int y, int z, int emitt);
|
||||
float getBrightness(int x, int y, int z);
|
||||
|
||||
// 4J - changes brought forward from 1.8.2
|
||||
int getBrightness(LightLayer::variety layer, int x, int y, int z);
|
||||
int getBrightnessPropagate(LightLayer::variety layer, int x, int y, int z);
|
||||
|
||||
int getLightColor(int x, int y, int z, int emitt); // 4J - change brought forward from 1.8.2
|
||||
int getRawBrightness(int x, int y, int z);
|
||||
int getRawBrightness(int x, int y, int z, bool propagate);
|
||||
|
||||
int LevelChunk_getRawBrightness(int x, int y, int z, int skyDampen);
|
||||
Material_SPU* getMaterial(int x, int y, int z);
|
||||
|
||||
|
||||
void tesselateAllTiles(TileRenderer_SPU* pTileRenderer);
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -0,0 +1,267 @@
|
||||
<?xml version="1.0" encoding="us-ascii"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="ContentPackage|PS3">
|
||||
<Configuration>ContentPackage</Configuration>
|
||||
<Platform>PS3</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|PS3">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>PS3</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|PS3">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>PS3</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="AnvilTile_SPU.h" />
|
||||
<ClInclude Include="BedTile_SPU.h" />
|
||||
<ClInclude Include="BookshelfTile_SPU.h" />
|
||||
<ClInclude Include="BrewingStandTile_SPU.h" />
|
||||
<ClInclude Include="Bush_SPU.h" />
|
||||
<ClInclude Include="ButtonTile_SPU.h" />
|
||||
<ClInclude Include="CactusTile_SPU.h" />
|
||||
<ClInclude Include="CakeTile_SPU.h" />
|
||||
<ClInclude Include="CarrotTile_SPU.h" />
|
||||
<ClInclude Include="CauldronTile_SPU.h" />
|
||||
<ClInclude Include="ChestTile_SPU.h" />
|
||||
<ClInclude Include="ChunkRebuildData.h" />
|
||||
<ClInclude Include="ClothTile_SPU.h" />
|
||||
<ClInclude Include="CocoaTile_SPU.h" />
|
||||
<ClInclude Include="CropTile_SPU.h" />
|
||||
<ClInclude Include="DetectorRailTile_SPU.h" />
|
||||
<ClInclude Include="DiodeTile_SPU.h" />
|
||||
<ClInclude Include="DirectionalTile_SPU.h" />
|
||||
<ClInclude Include="Direction_SPU.h" />
|
||||
<ClInclude Include="DirtTile_SPU.h" />
|
||||
<ClInclude Include="DispenserTile_SPU.h" />
|
||||
<ClInclude Include="DoorTile_SPU.h" />
|
||||
<ClInclude Include="EggTile_SPU.h" />
|
||||
<ClInclude Include="EnchantmentTableTile_SPU.h" />
|
||||
<ClInclude Include="EnderChestTile_SPU.h" />
|
||||
<ClInclude Include="EntityTile_SPU.h" />
|
||||
<ClInclude Include="Facing_SPU.h" />
|
||||
<ClInclude Include="FarmTile_SPU.h" />
|
||||
<ClInclude Include="FenceGateTile_SPU.h" />
|
||||
<ClInclude Include="FenceTile_SPU.h" />
|
||||
<ClInclude Include="FireTile_SPU.h" />
|
||||
<ClInclude Include="FlowerPotTile_SPU.h" />
|
||||
<ClInclude Include="FurnaceTile_SPU.h" />
|
||||
<ClInclude Include="GlassTile_SPU.h" />
|
||||
<ClInclude Include="GrassTile_SPU.h" />
|
||||
<ClInclude Include="HalfSlabTile_SPU.h" />
|
||||
<ClInclude Include="HalfTransparentTile_SPU.h" />
|
||||
<ClInclude Include="HugeMushroomTile_SPU.h" />
|
||||
<ClInclude Include="IceTile_SPU.h" />
|
||||
<ClInclude Include="Icon_SPU.h" />
|
||||
<ClInclude Include="Item_SPU.h" />
|
||||
<ClInclude Include="LadderTile_SPU.h" />
|
||||
<ClInclude Include="LeafTile_SPU.h" />
|
||||
<ClInclude Include="LeverTile_SPU.h" />
|
||||
<ClInclude Include="LiquidTile_SPU.h" />
|
||||
<ClInclude Include="Material_SPU.h" />
|
||||
<ClInclude Include="MelonTile_SPU.h" />
|
||||
<ClInclude Include="MobSpawnerTile_SPU.h" />
|
||||
<ClInclude Include="Mushroom_SPU.h" />
|
||||
<ClInclude Include="MycelTile_SPU.h" />
|
||||
<ClInclude Include="NetherStalkTile_SPU.h" />
|
||||
<ClInclude Include="PistonBaseTile_SPU.h" />
|
||||
<ClInclude Include="PistonExtensionTile_SPU.h" />
|
||||
<ClInclude Include="PistonMovingPiece_SPU.h" />
|
||||
<ClInclude Include="PortalTile_SPU.h" />
|
||||
<ClInclude Include="PotatoTile_SPU.h" />
|
||||
<ClInclude Include="PressurePlateTile_SPU.h" />
|
||||
<ClInclude Include="PumpkinTile_SPU.h" />
|
||||
<ClInclude Include="QuartzBlockTile_SPU.h" />
|
||||
<ClInclude Include="RailTile_SPU.h" />
|
||||
<ClInclude Include="RecordPlayerTile_SPU.h" />
|
||||
<ClInclude Include="RedlightTile_SPU.h" />
|
||||
<ClInclude Include="RedStoneDustTile_SPU.h" />
|
||||
<ClInclude Include="ReedTile_SPU.h" />
|
||||
<ClInclude Include="SandStoneTile_SPU.h" />
|
||||
<ClInclude Include="Sapling_SPU.h" />
|
||||
<ClInclude Include="SignTile_SPU.h" />
|
||||
<ClInclude Include="SkullTile_SPU.h" />
|
||||
<ClInclude Include="SmoothStoneBrickTile_SPU.h" />
|
||||
<ClInclude Include="StairTile_SPU.h" />
|
||||
<ClInclude Include="stdafx.h" />
|
||||
<ClInclude Include="StemTile_SPU.h" />
|
||||
<ClInclude Include="StoneMonsterTile_SPU.h" />
|
||||
<ClInclude Include="StoneSlabTile_SPU.h" />
|
||||
<ClInclude Include="stubs_SPU.h" />
|
||||
<ClInclude Include="TallGrass_SPU.h" />
|
||||
<ClInclude Include="Tesselator_SPU.h" />
|
||||
<ClInclude Include="TheEndPortalFrameTile_SPU.h" />
|
||||
<ClInclude Include="TheEndPortal_SPU.h" />
|
||||
<ClInclude Include="ThinFenceTile_SPU.h" />
|
||||
<ClInclude Include="TileItem_SPU.h" />
|
||||
<ClInclude Include="TileRenderer_SPU.h" />
|
||||
<ClInclude Include="Tile_SPU.h" />
|
||||
<ClInclude Include="TntTile_SPU.h" />
|
||||
<ClInclude Include="TopSnowTile_SPU.h" />
|
||||
<ClInclude Include="TorchTile_SPU.h" />
|
||||
<ClInclude Include="TrapDoorTile_SPU.h" />
|
||||
<ClInclude Include="TreeTile_SPU.h" />
|
||||
<ClInclude Include="TripWireSourceTile_SPU.h" />
|
||||
<ClInclude Include="TripWireTile_SPU.h" />
|
||||
<ClInclude Include="VineTile_SPU.h" />
|
||||
<ClInclude Include="WallTile_SPU.h" />
|
||||
<ClInclude Include="WaterLilyTile_SPU.h" />
|
||||
<ClInclude Include="WebTile_SPU.h" />
|
||||
<ClInclude Include="WoodSlabTile_SPU.h" />
|
||||
<ClInclude Include="WoodTile_SPU.h" />
|
||||
<ClInclude Include="WoolCarpetTile_SPU.h" />
|
||||
<ClInclude Include="WorkbenchTile_SPU.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="ChunkRebuildData.cpp" />
|
||||
<ClCompile Include="DiodeTile_SPU.cpp" />
|
||||
<ClCompile Include="Direction_SPU.cpp" />
|
||||
<ClCompile Include="DoorTile_SPU.cpp" />
|
||||
<ClCompile Include="Facing_SPU.cpp" />
|
||||
<ClCompile Include="FenceTile_SPU.cpp" />
|
||||
<ClCompile Include="GrassTile_SPU.cpp" />
|
||||
<ClCompile Include="HalfSlabTile_SPU.cpp" />
|
||||
<ClCompile Include="Icon_SPU.cpp" />
|
||||
<ClCompile Include="LeafTile_SPU.cpp" />
|
||||
<ClCompile Include="LiquidTile_SPU.cpp" />
|
||||
<ClCompile Include="PressurePlateTile_SPU.cpp" />
|
||||
<ClCompile Include="StairTile_SPU.cpp" />
|
||||
<ClCompile Include="TallGrass_SPU.cpp" />
|
||||
<ClCompile Include="task.cpp" />
|
||||
<ClCompile Include="Tesselator_SPU.cpp" />
|
||||
<ClCompile Include="ThinFenceTile_SPU.cpp" />
|
||||
<ClCompile Include="TileRenderer_SPU.cpp" />
|
||||
<ClCompile Include="Tile_SPU.cpp" />
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{4B7786BE-4F10-4FAA-A75A-631DF39570DD}</ProjectGuid>
|
||||
<ProjectName>ChunkUpdate</ProjectName>
|
||||
<SccProjectName>SAK</SccProjectName>
|
||||
<SccAuxPath>SAK</SccAuxPath>
|
||||
<SccLocalPath>SAK</SccLocalPath>
|
||||
<SccProvider>SAK</SccProvider>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|PS3'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset>SPU</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ContentPackage|PS3'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset>SPU</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|PS3'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset>SPU</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|PS3'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='ContentPackage|PS3'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|PS3'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup>
|
||||
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|PS3'">PS3_Debug\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|PS3'">PS3_Debug\</IntDir>
|
||||
<ExtensionsToDeleteOnClean Condition="'$(Configuration)|$(Platform)'=='Debug|PS3'">*.obj;*.d;*.map;*.lst;*.pch;$(TargetPath);undefined;$(ExtensionsToDeleteOnClean)</ExtensionsToDeleteOnClean>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|PS3'" />
|
||||
<GenerateManifest Condition="'$(Configuration)|$(Platform)'=='Debug|PS3'">false</GenerateManifest>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|PS3'">PS3_Release\</OutDir>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='ContentPackage|PS3'">PS3_ContentPackage\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|PS3'">PS3_Release\</IntDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='ContentPackage|PS3'">PS3_ContentPackage\</IntDir>
|
||||
<ExtensionsToDeleteOnClean Condition="'$(Configuration)|$(Platform)'=='Release|PS3'">*.obj;*.d;*.map;*.lst;*.pch;$(TargetPath);undefined;$(ExtensionsToDeleteOnClean)</ExtensionsToDeleteOnClean>
|
||||
<ExtensionsToDeleteOnClean Condition="'$(Configuration)|$(Platform)'=='ContentPackage|PS3'">*.obj;*.d;*.map;*.lst;*.pch;$(TargetPath);undefined;$(ExtensionsToDeleteOnClean)</ExtensionsToDeleteOnClean>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|PS3'" />
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='ContentPackage|PS3'" />
|
||||
<GenerateManifest Condition="'$(Configuration)|$(Platform)'=='Release|PS3'">false</GenerateManifest>
|
||||
<GenerateManifest Condition="'$(Configuration)|$(Platform)'=='ContentPackage|PS3'">false</GenerateManifest>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|PS3'">$(ProjectName)</TargetName>
|
||||
<SpursUsage>SpursInit</SpursUsage>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release|PS3'">$(ProjectName)</TargetName>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='ContentPackage|PS3'">$(ProjectName)</TargetName>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|PS3'">
|
||||
<ClCompile>
|
||||
<AdditionalOptions>-ffunction-sections -fdata-sections -fstack-check %(AdditionalOptions)</AdditionalOptions>
|
||||
<AdditionalIncludeDirectories>$(SN_PS3_PATH)\spu\include\sn;$(SCE_PS3_ROOT)\target\spu\include;$(SCE_PS3_ROOT)\target\common\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<PreprocessorDefinitions>SN_TARGET_PS3_SPU;_DEBUG;__GCC__;SPU;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<OptimizationLevel>Level3</OptimizationLevel>
|
||||
</ClCompile>
|
||||
<ProjectReference>
|
||||
<LinkLibraryDependencies>true</LinkLibraryDependencies>
|
||||
</ProjectReference>
|
||||
<Link>
|
||||
<AdditionalOptions>-Wl,--gc-sections -g %(AdditionalOptions)</AdditionalOptions>
|
||||
<AdditionalDependencies>-ldma;-lspurs_jq;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||
<DataExecutionPrevention>
|
||||
</DataExecutionPrevention>
|
||||
</Link>
|
||||
<SpuElfConversion>
|
||||
<EmbedFormat>JobBin2</EmbedFormat>
|
||||
<OutputFile>..\ObjFiles\Debug\$(TargetName).ppu$(ObjectExt)</OutputFile>
|
||||
</SpuElfConversion>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|PS3'">
|
||||
<ClCompile>
|
||||
<AdditionalOptions>-ffunction-sections -fdata-sections -fstack-check %(AdditionalOptions)</AdditionalOptions>
|
||||
<AdditionalIncludeDirectories>$(SN_PS3_PATH)\spu\include\sn;$(SCE_PS3_ROOT)\target\spu\include;$(SCE_PS3_ROOT)\target\common\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<OptimizationLevel>Level3</OptimizationLevel>
|
||||
<PreprocessorDefinitions>SN_TARGET_PS3_SPU;NDEBUG;__GCC__;SPU;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<ProjectReference>
|
||||
<LinkLibraryDependencies>true</LinkLibraryDependencies>
|
||||
</ProjectReference>
|
||||
<Link>
|
||||
<AdditionalOptions>-Wl,--gc-sections -g %(AdditionalOptions)</AdditionalOptions>
|
||||
<AdditionalDependencies>-ldma;-lspurs_jq;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||
<DataExecutionPrevention>
|
||||
</DataExecutionPrevention>
|
||||
</Link>
|
||||
<SpuElfConversion>
|
||||
<EmbedFormat>JobBin2</EmbedFormat>
|
||||
<OutputFile>..\ObjFiles\Release\$(TargetName).ppu$(ObjectExt)</OutputFile>
|
||||
</SpuElfConversion>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='ContentPackage|PS3'">
|
||||
<ClCompile>
|
||||
<AdditionalOptions>-ffunction-sections -fdata-sections -fstack-check %(AdditionalOptions)</AdditionalOptions>
|
||||
<AdditionalIncludeDirectories>$(SN_PS3_PATH)\spu\include\sn;$(SCE_PS3_ROOT)\target\spu\include;$(SCE_PS3_ROOT)\target\common\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<GenerateDebugInformation>false</GenerateDebugInformation>
|
||||
<OptimizationLevel>Level3</OptimizationLevel>
|
||||
<PreprocessorDefinitions>SN_TARGET_PS3_SPU;NDEBUG;__GCC__;SPU;_CONTENT_PACKAGE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<ProjectReference>
|
||||
<LinkLibraryDependencies>true</LinkLibraryDependencies>
|
||||
</ProjectReference>
|
||||
<Link>
|
||||
<AdditionalOptions>-Wl,--gc-sections -g %(AdditionalOptions)</AdditionalOptions>
|
||||
<AdditionalDependencies>-ldma;-lspurs_jq;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||
<DataExecutionPrevention>
|
||||
</DataExecutionPrevention>
|
||||
</Link>
|
||||
<SpuElfConversion>
|
||||
<EmbedFormat>JobBin2</EmbedFormat>
|
||||
<OutputFile>..\ObjFiles\ContentPackage\$(TargetName).ppu$(ObjectExt)</OutputFile>
|
||||
<StripMode>Hard</StripMode>
|
||||
</SpuElfConversion>
|
||||
</ItemDefinitionGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,170 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{881f28ee-ca74-4afc-94a6-2346cb88f86d}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cxx;cc;s;asm</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="stdafx.h" />
|
||||
<ClInclude Include="StemTile_SPU.h" />
|
||||
<ClInclude Include="StoneMonsterTile_SPU.h" />
|
||||
<ClInclude Include="stubs_SPU.h" />
|
||||
<ClInclude Include="TallGrass_SPU.h" />
|
||||
<ClInclude Include="Tesselator_SPU.h" />
|
||||
<ClInclude Include="TheEndPortal_SPU.h" />
|
||||
<ClInclude Include="TheEndPortalFrameTile_SPU.h" />
|
||||
<ClInclude Include="ThinFenceTile_SPU.h" />
|
||||
<ClInclude Include="Tile_SPU.h" />
|
||||
<ClInclude Include="TileRenderer_SPU.h" />
|
||||
<ClInclude Include="TntTile_SPU.h" />
|
||||
<ClInclude Include="TopSnowTile_SPU.h" />
|
||||
<ClInclude Include="TorchTile_SPU.h" />
|
||||
<ClInclude Include="TrapDoorTile_SPU.h" />
|
||||
<ClInclude Include="TreeTile_SPU.h" />
|
||||
<ClInclude Include="VineTile_SPU.h" />
|
||||
<ClInclude Include="WaterLilyTile_SPU.h" />
|
||||
<ClInclude Include="WebTile_SPU.h" />
|
||||
<ClInclude Include="WoodTile_SPU.h" />
|
||||
<ClInclude Include="WorkbenchTile_SPU.h" />
|
||||
<ClInclude Include="BedTile_SPU.h" />
|
||||
<ClInclude Include="BookshelfTile_SPU.h" />
|
||||
<ClInclude Include="BrewingStandTile_SPU.h" />
|
||||
<ClInclude Include="Bush_SPU.h" />
|
||||
<ClInclude Include="ButtonTile_SPU.h" />
|
||||
<ClInclude Include="CactusTile_SPU.h" />
|
||||
<ClInclude Include="CakeTile_SPU.h" />
|
||||
<ClInclude Include="CauldronTile_SPU.h" />
|
||||
<ClInclude Include="ChestTile_SPU.h" />
|
||||
<ClInclude Include="ChunkRebuildData.h" />
|
||||
<ClInclude Include="CocoaTile_SPU.h" />
|
||||
<ClInclude Include="CropTile_SPU.h" />
|
||||
<ClInclude Include="DetectorRailTile_SPU.h" />
|
||||
<ClInclude Include="DiodeTile_SPU.h" />
|
||||
<ClInclude Include="Direction_SPU.h" />
|
||||
<ClInclude Include="DirectionalTile_SPU.h" />
|
||||
<ClInclude Include="DirtTile_SPU.h" />
|
||||
<ClInclude Include="DispenserTile_SPU.h" />
|
||||
<ClInclude Include="DoorTile_SPU.h" />
|
||||
<ClInclude Include="EggTile_SPU.h" />
|
||||
<ClInclude Include="EnchantmentTableTile_SPU.h" />
|
||||
<ClInclude Include="EntityTile_SPU.h" />
|
||||
<ClInclude Include="Facing_SPU.h" />
|
||||
<ClInclude Include="FarmTile_SPU.h" />
|
||||
<ClInclude Include="FenceGateTile_SPU.h" />
|
||||
<ClInclude Include="FenceTile_SPU.h" />
|
||||
<ClInclude Include="FireTile_SPU.h" />
|
||||
<ClInclude Include="FurnaceTile_SPU.h" />
|
||||
<ClInclude Include="GlassTile_SPU.h" />
|
||||
<ClInclude Include="GrassTile_SPU.h" />
|
||||
<ClInclude Include="HalfSlabTile_SPU.h" />
|
||||
<ClInclude Include="HalfTransparentTile_SPU.h" />
|
||||
<ClInclude Include="HugeMushroomTile_SPU.h" />
|
||||
<ClInclude Include="IceTile_SPU.h" />
|
||||
<ClInclude Include="Icon_SPU.h" />
|
||||
<ClInclude Include="LadderTile_SPU.h" />
|
||||
<ClInclude Include="LeafTile_SPU.h" />
|
||||
<ClInclude Include="LeverTile_SPU.h" />
|
||||
<ClInclude Include="LiquidTile_SPU.h" />
|
||||
<ClInclude Include="Material_SPU.h" />
|
||||
<ClInclude Include="MelonTile_SPU.h" />
|
||||
<ClInclude Include="Mushroom_SPU.h" />
|
||||
<ClInclude Include="MycelTile_SPU.h" />
|
||||
<ClInclude Include="NetherStalkTile_SPU.h" />
|
||||
<ClInclude Include="PistonBaseTile_SPU.h" />
|
||||
<ClInclude Include="PistonExtensionTile_SPU.h" />
|
||||
<ClInclude Include="PistonMovingPiece_SPU.h" />
|
||||
<ClInclude Include="PortalTile_SPU.h" />
|
||||
<ClInclude Include="PressurePlateTile_SPU.h" />
|
||||
<ClInclude Include="PumpkinTile_SPU.h" />
|
||||
<ClInclude Include="RailTile_SPU.h" />
|
||||
<ClInclude Include="RecordPlayerTile_SPU.h" />
|
||||
<ClInclude Include="RedlightTile_SPU.h" />
|
||||
<ClInclude Include="RedStoneDustTile_SPU.h" />
|
||||
<ClInclude Include="ReedTile_SPU.h" />
|
||||
<ClInclude Include="SandStoneTile_SPU.h" />
|
||||
<ClInclude Include="Sapling_SPU.h" />
|
||||
<ClInclude Include="SignTile_SPU.h" />
|
||||
<ClInclude Include="SmoothStoneBrickTile_SPU.h" />
|
||||
<ClInclude Include="StairTile_SPU.h" />
|
||||
<ClInclude Include="TileItem_SPU.h" />
|
||||
<ClInclude Include="Item_SPU.h">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="ClothTile_SPU.h" />
|
||||
<ClInclude Include="SkullTile_SPU.h" />
|
||||
<ClInclude Include="WoodSlabTile_SPU.h" />
|
||||
<ClInclude Include="StoneSlabTile_SPU.h" />
|
||||
<ClInclude Include="MobSpawnerTile_SPU.h" />
|
||||
<ClInclude Include="FlowerPotTile_SPU.h" />
|
||||
<ClInclude Include="TripWireSourceTile_SPU.h" />
|
||||
<ClInclude Include="TripWireTile_SPU.h" />
|
||||
<ClInclude Include="WallTile_SPU.h" />
|
||||
<ClInclude Include="QuartzBlockTile_SPU.h" />
|
||||
<ClInclude Include="PotatoTile_SPU.h" />
|
||||
<ClInclude Include="CarrotTile_SPU.h" />
|
||||
<ClInclude Include="AnvilTile_SPU.h" />
|
||||
<ClInclude Include="EnderChestTile_SPU.h" />
|
||||
<ClInclude Include="WoolCarpetTile_SPU.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="ChunkRebuildData.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="DiodeTile_SPU.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Direction_SPU.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="DoorTile_SPU.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Facing_SPU.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="FenceTile_SPU.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="GrassTile_SPU.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="HalfSlabTile_SPU.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Icon_SPU.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="LeafTile_SPU.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="LiquidTile_SPU.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="PressurePlateTile_SPU.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="StairTile_SPU.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="TallGrass_SPU.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="task.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Tesselator_SPU.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ThinFenceTile_SPU.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Tile_SPU.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="TileRenderer_SPU.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
11
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/ClothTile_SPU.h
Normal file
11
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/ClothTile_SPU.h
Normal file
@@ -0,0 +1,11 @@
|
||||
#pragma once
|
||||
#include "Tile_SPU.h"
|
||||
|
||||
class ClothTile_SPU : public Tile_SPU
|
||||
{
|
||||
public:
|
||||
ClothTile_SPU(int id) : Tile_SPU(id) {}
|
||||
virtual Icon_SPU *getTexture(int face, int data) { return &ms_pTileData->clothTile_icons[data]; }
|
||||
|
||||
|
||||
};
|
||||
18
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/CocoaTile_SPU.h
Normal file
18
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/CocoaTile_SPU.h
Normal file
@@ -0,0 +1,18 @@
|
||||
#pragma once
|
||||
|
||||
#include "DirectionalTile_SPU.h"
|
||||
|
||||
class CocoaTile_SPU : public DirectionalTile_SPU
|
||||
{
|
||||
public:
|
||||
static const int COCOA_TEXTURES_LENGTH = 3;
|
||||
|
||||
public:
|
||||
CocoaTile_SPU(int id) : DirectionalTile_SPU(id) {}
|
||||
|
||||
// virtual Icon *getTexture(int face, int data);
|
||||
// virtual Icon *getTextureForAge(int age);
|
||||
virtual int getRenderShape() { return SHAPE_COCOA; }
|
||||
virtual bool isCubeShaped() { return false; }
|
||||
virtual bool isSolidRender(bool isServerLevel = false) { return false; }
|
||||
};
|
||||
19
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/CropTile_SPU.h
Normal file
19
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/CropTile_SPU.h
Normal file
@@ -0,0 +1,19 @@
|
||||
#pragma once
|
||||
#include "Bush_SPU.h"
|
||||
|
||||
|
||||
class CropTile_SPU : public Bush_SPU
|
||||
{
|
||||
public:
|
||||
CropTile_SPU(int id) : Bush_SPU(id) {}
|
||||
virtual Icon_SPU *getTexture(int face, int data)
|
||||
{
|
||||
if (data < 0 || data > 7) data = 7;
|
||||
return &ms_pTileData->cropTile_icons[data];
|
||||
}
|
||||
|
||||
virtual int getRenderShape()
|
||||
{
|
||||
return Tile_SPU::SHAPE_ROWS;
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,17 @@
|
||||
#pragma once
|
||||
#include "RailTile_SPU.h"
|
||||
|
||||
|
||||
class DetectorRailTile_SPU : public RailTile_SPU
|
||||
{
|
||||
public:
|
||||
DetectorRailTile_SPU(int id) : RailTile_SPU(id) {}
|
||||
Icon_SPU *getTexture(int face, int data)
|
||||
{
|
||||
if ((data & RAIL_DATA_BIT) != 0)
|
||||
{
|
||||
return &ms_pTileData->detectorRailTile_icons[1];
|
||||
}
|
||||
return &ms_pTileData->detectorRailTile_icons[0];
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,5 @@
|
||||
#include "stdafx.h"
|
||||
#include "DiodeTile_SPU.h"
|
||||
|
||||
const double DiodeTile_SPU::DELAY_RENDER_OFFSETS[4] = { -1.0f / 16.0f, 1.0f / 16.0f, 3.0f / 16.0f, 5.0f / 16.0f };
|
||||
const int DiodeTile_SPU::DELAYS[4] = { 1, 2, 3, 4 };
|
||||
44
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/DiodeTile_SPU.h
Normal file
44
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/DiodeTile_SPU.h
Normal file
@@ -0,0 +1,44 @@
|
||||
#pragma once
|
||||
#include "Tile_SPU.h"
|
||||
#include "Facing_SPU.h"
|
||||
|
||||
class DiodeTile_SPU : public Tile_SPU
|
||||
{
|
||||
public:
|
||||
static const int DIRECTION_MASK = 0x3;
|
||||
static const int DELAY_MASK = 0xC;
|
||||
static const int DELAY_SHIFT = 2;
|
||||
|
||||
static const double DELAY_RENDER_OFFSETS[4];
|
||||
static const int DELAYS[4];
|
||||
|
||||
public:
|
||||
DiodeTile_SPU(int id) : Tile_SPU(id) {}
|
||||
virtual Icon_SPU *getTexture(int face, int data)
|
||||
{
|
||||
// down is used by the torch tesselator
|
||||
if (face == Facing::DOWN)
|
||||
{
|
||||
if (id==diode_on_Id)
|
||||
{
|
||||
return TileRef_SPU(notGate_on_Id)->getTexture(face);
|
||||
}
|
||||
return TileRef_SPU(notGate_off_Id)->getTexture(face);
|
||||
}
|
||||
if (face == Facing::UP)
|
||||
{
|
||||
return icon();
|
||||
}
|
||||
// edge of stone half-step
|
||||
return TileRef_SPU(stoneSlab_Id)->getTexture(Facing::UP);
|
||||
}
|
||||
virtual bool shouldRenderFace(LevelSource *level, int x, int y, int z, int face)
|
||||
{
|
||||
if (face == Facing::DOWN || face == Facing::UP)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual int getRenderShape() { return SHAPE_DIODE; }
|
||||
virtual bool isSolidRender(bool isServerLevel = false) { return false; }
|
||||
};
|
||||
62
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/Direction_SPU.cpp
Normal file
62
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/Direction_SPU.cpp
Normal file
@@ -0,0 +1,62 @@
|
||||
#include "stdafx.h"
|
||||
#include "Direction_SPU.h"
|
||||
#include "Facing_SPU.h"
|
||||
|
||||
const int Direction::STEP_X[] =
|
||||
{
|
||||
0, -1, 0, 1
|
||||
};
|
||||
|
||||
const int Direction::STEP_Z[] =
|
||||
{
|
||||
1, 0, -1, 0
|
||||
};
|
||||
|
||||
// for [direction] it gives [tile-face]
|
||||
int Direction::DIRECTION_FACING[4] =
|
||||
{
|
||||
Facing::SOUTH, Facing::WEST, Facing::NORTH, Facing::EAST
|
||||
};
|
||||
|
||||
// for [facing] it gives [direction]
|
||||
int Direction::FACING_DIRECTION[] =
|
||||
{
|
||||
UNDEFINED, UNDEFINED, NORTH, SOUTH, WEST, EAST
|
||||
};
|
||||
|
||||
int Direction::DIRECTION_OPPOSITE[4] =
|
||||
{
|
||||
Direction::NORTH, Direction::EAST, Direction::SOUTH, Direction::WEST
|
||||
};
|
||||
|
||||
// for [direction] it gives [90 degrees clockwise direction]
|
||||
int Direction::DIRECTION_CLOCKWISE[] =
|
||||
{
|
||||
Direction::WEST, Direction::NORTH, Direction::EAST, Direction::SOUTH
|
||||
};
|
||||
|
||||
// for [direction] it gives [90 degrees counter clockwise direction]
|
||||
int Direction::DIRECTION_COUNTER_CLOCKWISE[] =
|
||||
{
|
||||
Direction::EAST, Direction::SOUTH, Direction::WEST, Direction::NORTH
|
||||
};
|
||||
|
||||
int Direction::RELATIVE_DIRECTION_FACING[4][6] =
|
||||
{
|
||||
// south
|
||||
{
|
||||
Facing::UP, Facing::DOWN, Facing::SOUTH, Facing::NORTH, Facing::EAST, Facing::WEST
|
||||
},
|
||||
// west
|
||||
{
|
||||
Facing::UP, Facing::DOWN, Facing::EAST, Facing::WEST, Facing::NORTH, Facing::SOUTH
|
||||
},
|
||||
// north
|
||||
{
|
||||
Facing::UP, Facing::DOWN, Facing::NORTH, Facing::SOUTH, Facing::WEST, Facing::EAST
|
||||
},
|
||||
// east
|
||||
{
|
||||
Facing::UP, Facing::DOWN, Facing::WEST, Facing::EAST, Facing::SOUTH, Facing::NORTH
|
||||
}
|
||||
};
|
||||
32
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/Direction_SPU.h
Normal file
32
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/Direction_SPU.h
Normal file
@@ -0,0 +1,32 @@
|
||||
#pragma once
|
||||
|
||||
class Direction
|
||||
{
|
||||
public:
|
||||
static const int UNDEFINED = -1;
|
||||
static const int SOUTH = 0;
|
||||
static const int WEST = 1;
|
||||
static const int NORTH = 2;
|
||||
static const int EAST = 3;
|
||||
|
||||
static const int STEP_X[];
|
||||
static const int STEP_Z[];
|
||||
|
||||
// for [direction] it gives [tile-face]
|
||||
static int DIRECTION_FACING[];
|
||||
|
||||
// for [facing] it gives [direction]
|
||||
static int FACING_DIRECTION[];
|
||||
|
||||
// for [direction] it gives [opposite direction]
|
||||
static int DIRECTION_OPPOSITE[];
|
||||
|
||||
// for [direction] it gives [90 degrees clockwise direction]
|
||||
static int DIRECTION_CLOCKWISE[];
|
||||
|
||||
// for [direction] it gives [90 degrees counter-clockwise direction]
|
||||
static int DIRECTION_COUNTER_CLOCKWISE[];
|
||||
|
||||
// for [direction][world-facing] it gives [tile-facing]
|
||||
static int RELATIVE_DIRECTION_FACING[4][6];
|
||||
};
|
||||
@@ -0,0 +1,16 @@
|
||||
#pragma once
|
||||
|
||||
#include "Tile_SPU.h"
|
||||
|
||||
class DirectionalTile_SPU : public Tile_SPU
|
||||
{
|
||||
public:
|
||||
static const int DIRECTION_MASK = 0x3;
|
||||
static const int DIRECTION_INV_MASK = 0xC;
|
||||
|
||||
protected:
|
||||
DirectionalTile_SPU(int id) : Tile_SPU(id) {}
|
||||
|
||||
public:
|
||||
static int getDirection(int data) { return data & DIRECTION_MASK; }
|
||||
};
|
||||
@@ -0,0 +1,8 @@
|
||||
#pragma once
|
||||
#include "Tile_SPU.h"
|
||||
|
||||
class DirtTile_SPU : public Tile_SPU
|
||||
{
|
||||
public:
|
||||
DirtTile_SPU(int id) : Tile_SPU(id) {}
|
||||
};
|
||||
@@ -0,0 +1,38 @@
|
||||
#pragma once
|
||||
#include "EntityTile_SPU.h"
|
||||
|
||||
|
||||
class DispenserTile_SPU : public EntityTile_SPU
|
||||
{
|
||||
|
||||
public:
|
||||
static const int FACING_MASK = 0x7;
|
||||
DispenserTile_SPU(int id) : EntityTile_SPU(id) {}
|
||||
|
||||
public:
|
||||
virtual Icon_SPU *getTexture(int face, int data)
|
||||
{
|
||||
int dir = data & FACING_MASK;
|
||||
if (face == dir)
|
||||
{
|
||||
if (dir == Facing::UP || dir == Facing::DOWN)
|
||||
{
|
||||
return &ms_pTileData->dispenserTile_iconFrontVertical;
|
||||
}
|
||||
else
|
||||
{
|
||||
return &ms_pTileData->dispenserTile_iconFront;
|
||||
}
|
||||
}
|
||||
|
||||
if (dir == Facing::UP || dir == Facing::DOWN)
|
||||
{
|
||||
return &ms_pTileData->dispenserTile_iconTop;
|
||||
}
|
||||
else if (face == Facing::UP || face == Facing::DOWN)
|
||||
{
|
||||
return &ms_pTileData->dispenserTile_iconTop;
|
||||
}
|
||||
return icon();
|
||||
}
|
||||
};
|
||||
136
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/DoorTile_SPU.cpp
Normal file
136
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/DoorTile_SPU.cpp
Normal file
@@ -0,0 +1,136 @@
|
||||
#include "stdafx.h"
|
||||
#include "DoorTile_SPU.h"
|
||||
#include "Facing_SPU.h"
|
||||
#include "ChunkRebuildData.h"
|
||||
|
||||
|
||||
|
||||
Icon_SPU *DoorTile_SPU::getTexture(int face, int data)
|
||||
{
|
||||
int texBase;
|
||||
if (getMaterial()->getID() == Material_SPU::metal_Id)
|
||||
texBase = 2;
|
||||
else
|
||||
texBase = 0;
|
||||
|
||||
return &ms_pTileData->doorTile_Icons[texBase];
|
||||
}
|
||||
|
||||
Icon_SPU *DoorTile_SPU::getTexture(ChunkRebuildData *level, int x, int y, int z, int face)
|
||||
{
|
||||
int texBase;
|
||||
if (getMaterial()->getID() == Material_SPU::metal_Id)
|
||||
texBase = 2;
|
||||
else
|
||||
texBase = 0;
|
||||
|
||||
if (face == Facing::UP || face == Facing::DOWN) return &ms_pTileData->doorTile_Icons[texBase];
|
||||
|
||||
int compositeData = getCompositeData(level, x, y, z);
|
||||
int dir = compositeData & C_DIR_MASK;
|
||||
bool isOpen = (compositeData & C_OPEN_MASK) != 0;
|
||||
bool flip = false;
|
||||
bool upper = (compositeData & C_IS_UPPER_MASK) != 0;
|
||||
|
||||
if (isOpen)
|
||||
{
|
||||
if (dir == 0 && face == 2) flip = !flip;
|
||||
else if (dir == 1 && face == 5) flip = !flip;
|
||||
else if (dir == 2 && face == 3) flip = !flip;
|
||||
else if (dir == 3 && face == 4) flip = !flip;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (dir == 0 && face == 5) flip = !flip;
|
||||
else if (dir == 1 && face == 3) flip = !flip;
|
||||
else if (dir == 2 && face == 4) flip = !flip;
|
||||
else if (dir == 3 && face == 2) flip = !flip;
|
||||
if ((compositeData & C_RIGHT_HINGE_MASK) != 0) flip = !flip;
|
||||
}
|
||||
|
||||
return &ms_pTileData->doorTile_Icons[texBase + (flip ? DOOR_TILE_TEXTURE_COUNT : 0) + (upper ? 1 : 0)];
|
||||
}
|
||||
|
||||
void DoorTile_SPU::updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData, TileEntity* forceEntity) // 4J added forceData, forceEntity param
|
||||
{
|
||||
setShape(getCompositeData(level,x, y, z));
|
||||
}
|
||||
|
||||
bool DoorTile_SPU::isOpen(ChunkRebuildData *level, int x, int y, int z)
|
||||
{
|
||||
return (getCompositeData(level, x, y, z) & C_OPEN_MASK) != 0;
|
||||
}
|
||||
|
||||
void DoorTile_SPU::setShape(int compositeData)
|
||||
{
|
||||
float r = 3 / 16.0f;
|
||||
Tile_SPU::setShape(0, 0, 0, 1, 2, 1);
|
||||
int dir = compositeData & C_DIR_MASK;
|
||||
bool open = (compositeData & C_OPEN_MASK) != 0;
|
||||
bool hasRightHinge = (compositeData & C_RIGHT_HINGE_MASK) != 0;
|
||||
if (dir == 0)
|
||||
{
|
||||
if (open)
|
||||
{
|
||||
if (!hasRightHinge) setShape(0, 0, 0, 1, 1, r);
|
||||
else setShape(0, 0, 1 - r, 1, 1, 1);
|
||||
}
|
||||
else setShape(0, 0, 0, r, 1, 1);
|
||||
}
|
||||
else if (dir == 1)
|
||||
{
|
||||
if (open)
|
||||
{
|
||||
if (!hasRightHinge) setShape(1 - r, 0, 0, 1, 1, 1);
|
||||
else setShape(0, 0, 0, r, 1, 1);
|
||||
}
|
||||
else setShape(0, 0, 0, 1, 1, r);
|
||||
}
|
||||
else if (dir == 2)
|
||||
{
|
||||
if (open)
|
||||
{
|
||||
if (!hasRightHinge) setShape(0, 0, 1 - r, 1, 1, 1);
|
||||
else setShape(0, 0, 0, 1, 1, r);
|
||||
}
|
||||
else setShape(1 - r, 0, 0, 1, 1, 1);
|
||||
}
|
||||
else if (dir == 3)
|
||||
{
|
||||
if (open)
|
||||
{
|
||||
if (!hasRightHinge) setShape(0, 0, 0, r, 1, 1);
|
||||
else setShape(1 - r, 0, 0, 1, 1, 1);
|
||||
}
|
||||
else setShape(0, 0, 1 - r, 1, 1, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool DoorTile_SPU::isOpen(int data)
|
||||
{
|
||||
return (data & 4) != 0;
|
||||
}
|
||||
|
||||
|
||||
int DoorTile_SPU::getCompositeData(ChunkRebuildData *level, int x, int y, int z)
|
||||
{
|
||||
int data = level->getData(x, y, z);
|
||||
bool isUpper = (data & UPPER_BIT) != 0;
|
||||
int lowerData;
|
||||
int upperData;
|
||||
if (isUpper)
|
||||
{
|
||||
lowerData = level->getData(x, y - 1, z);
|
||||
upperData = data;
|
||||
}
|
||||
else
|
||||
{
|
||||
lowerData = data;
|
||||
upperData = level->getData(x, y + 1, z);
|
||||
}
|
||||
|
||||
// bits: dir, dir, open/closed, isUpper, isRightHinge
|
||||
bool isRightHinge = (upperData & 1) != 0;
|
||||
return lowerData & C_LOWER_DATA_MASK | (isUpper ? 8 : 0) | (isRightHinge ? 16 : 0);
|
||||
}
|
||||
37
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/DoorTile_SPU.h
Normal file
37
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/DoorTile_SPU.h
Normal file
@@ -0,0 +1,37 @@
|
||||
#pragma once
|
||||
#include "Tile_SPU.h"
|
||||
|
||||
|
||||
class DoorTile_SPU : public Tile_SPU
|
||||
{
|
||||
public:
|
||||
static const int UPPER_BIT = 8;
|
||||
static const int C_DIR_MASK = 3;
|
||||
static const int C_OPEN_MASK = 4;
|
||||
static const int C_LOWER_DATA_MASK = 7;
|
||||
static const int C_IS_UPPER_MASK = 8;
|
||||
static const int C_RIGHT_HINGE_MASK = 16;
|
||||
|
||||
private:
|
||||
static const int DOOR_TILE_TEXTURE_COUNT = 4;
|
||||
|
||||
public:
|
||||
DoorTile_SPU(int id) : Tile_SPU(id){}
|
||||
virtual Icon_SPU *getTexture(int face, int data);
|
||||
//@Override
|
||||
Icon_SPU *getTexture(ChunkRebuildData *level, int x, int y, int z, int face);
|
||||
//@Override
|
||||
virtual bool blocksLight() { return false; }
|
||||
virtual bool isSolidRender(bool isServerLevel = false) { return false; }
|
||||
virtual int getRenderShape() { return Tile_SPU::SHAPE_DOOR; }
|
||||
virtual void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = NULL); // 4J added forceData, forceEntity param
|
||||
|
||||
int getDir(ChunkRebuildData *level, int x, int y, int z);
|
||||
bool isOpen(ChunkRebuildData *level, int x, int y, int z);
|
||||
private:
|
||||
using Tile_SPU::setShape;
|
||||
virtual void setShape(int compositeData);
|
||||
public:
|
||||
static bool isOpen(int data);
|
||||
int getCompositeData(ChunkRebuildData *level, int x, int y, int z);
|
||||
};
|
||||
13
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/EggTile_SPU.h
Normal file
13
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/EggTile_SPU.h
Normal file
@@ -0,0 +1,13 @@
|
||||
#pragma once
|
||||
#include "Tile_SPU.h"
|
||||
|
||||
class EggTile_SPU : public Tile_SPU
|
||||
{
|
||||
public:
|
||||
EggTile_SPU(int id) : Tile_SPU(id) {}
|
||||
virtual bool blocksLight() { return false; }
|
||||
virtual bool isSolidRender(bool isServerLevel = false) { return false; }
|
||||
virtual int getRenderShape() { return Tile_SPU::SHAPE_EGG; }
|
||||
virtual bool shouldRenderFace(ChunkRebuildData *level, int x, int y, int z, int face) { return true; }
|
||||
|
||||
};
|
||||
@@ -0,0 +1,17 @@
|
||||
#pragma once
|
||||
#include "EntityTile_SPU.h"
|
||||
|
||||
class EnchantmentTableTile_SPU : public EntityTile_SPU
|
||||
{
|
||||
public:
|
||||
EnchantmentTableTile_SPU(int id) : EntityTile_SPU(id) {}
|
||||
|
||||
bool isCubeShaped() { return false; }
|
||||
bool isSolidRender(bool isServerLevel = false) { return false; }
|
||||
Icon_SPU *getTexture(int face, int data)
|
||||
{
|
||||
if (face == Facing::DOWN) return &ms_pTileData->enchantmentTable_iconBottom;
|
||||
if (face == Facing::UP) return &ms_pTileData->enchantmentTable_iconTop;
|
||||
return icon();
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,13 @@
|
||||
#pragma once
|
||||
|
||||
#include "EntityTile_SPU.h"
|
||||
|
||||
class EnderChestTile_SPU : public EntityTile_SPU
|
||||
{
|
||||
public:
|
||||
EnderChestTile_SPU(int id) : EntityTile_SPU(id) {}
|
||||
|
||||
bool isSolidRender(bool isServerLevel = false) { return false; }
|
||||
bool isCubeShaped() { return false; }
|
||||
int getRenderShape() { return Tile_SPU::SHAPE_ENTITYTILE_ANIMATED; }
|
||||
};
|
||||
@@ -0,0 +1,8 @@
|
||||
#pragma once
|
||||
#include "Tile_SPU.h"
|
||||
|
||||
class EntityTile_SPU : public Tile_SPU
|
||||
{
|
||||
public:
|
||||
EntityTile_SPU(int id) : Tile_SPU(id) {}
|
||||
};
|
||||
22
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/Facing_SPU.cpp
Normal file
22
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/Facing_SPU.cpp
Normal file
@@ -0,0 +1,22 @@
|
||||
#include "stdafx.h"
|
||||
#include "Facing_SPU.h"
|
||||
|
||||
const int Facing::OPPOSITE_FACING[6] =
|
||||
{
|
||||
UP, DOWN, SOUTH, NORTH, EAST, WEST
|
||||
};
|
||||
|
||||
const int Facing::STEP_X[6] =
|
||||
{
|
||||
0, 0, 0, 0, -1, 1
|
||||
};
|
||||
|
||||
const int Facing::STEP_Y[6] =
|
||||
{
|
||||
-1, 1, 0, 0, 0, 0
|
||||
};
|
||||
|
||||
const int Facing::STEP_Z[6] =
|
||||
{
|
||||
0, 0, -1, 1, 0, 0
|
||||
};
|
||||
17
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/Facing_SPU.h
Normal file
17
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/Facing_SPU.h
Normal file
@@ -0,0 +1,17 @@
|
||||
#pragma once
|
||||
|
||||
class Facing
|
||||
{
|
||||
public:
|
||||
static const int DOWN = 0;
|
||||
static const int UP = 1;
|
||||
static const int NORTH = 2;
|
||||
static const int SOUTH = 3;
|
||||
static const int WEST = 4;
|
||||
static const int EAST = 5;
|
||||
|
||||
static const int OPPOSITE_FACING[6];
|
||||
static const int STEP_X[6];
|
||||
static const int STEP_Y[6];
|
||||
static const int STEP_Z[6];
|
||||
};
|
||||
22
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/FarmTile_SPU.h
Normal file
22
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/FarmTile_SPU.h
Normal file
@@ -0,0 +1,22 @@
|
||||
#pragma once
|
||||
#include "Tile_SPU.h"
|
||||
#include "Facing_SPU.h"
|
||||
|
||||
class FarmTile_SPU : public Tile_SPU
|
||||
{
|
||||
public:
|
||||
FarmTile_SPU(int id): Tile_SPU(id) {}
|
||||
virtual bool isSolidRender(bool isServerLevel = false) { return false; }
|
||||
virtual Icon_SPU *getTexture(int face, int data)
|
||||
{
|
||||
if (face == Facing::UP)
|
||||
{
|
||||
if(data > 0)
|
||||
return &ms_pTileData->farmTile_Wet;
|
||||
else
|
||||
return &ms_pTileData->farmTile_Dry;
|
||||
}
|
||||
return TileRef_SPU(dirt_Id)->getTexture(face);
|
||||
}
|
||||
virtual bool blocksLight() { return true; }
|
||||
};
|
||||
@@ -0,0 +1,32 @@
|
||||
#pragma once
|
||||
#include "Tile_SPU.h"
|
||||
|
||||
class FenceGateTile_SPU : public Tile_SPU
|
||||
{
|
||||
private:
|
||||
static const int DIRECTION_MASK = 3;
|
||||
static const int OPEN_BIT = 4;
|
||||
|
||||
public:
|
||||
FenceGateTile_SPU(int id) : Tile_SPU(id) {}
|
||||
Icon_SPU *getTexture(int face, int data) { return TileRef_SPU(wood_Id)->getTexture(face); }
|
||||
static int getDirection(int data) { return (data & DIRECTION_MASK); }
|
||||
|
||||
virtual void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = NULL) // 4J added forceData, forceEntity param // Brought forward from 1.2.3
|
||||
{
|
||||
int data = getDirection(level->getData(x, y, z));
|
||||
if (data == Direction::NORTH || data == Direction::SOUTH)
|
||||
{
|
||||
setShape(0, 0, 6.0f / 16.0f, 1, 1.0f, 10.0f / 16.0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
setShape(6.0f / 16.0f, 0, 0, 10.0f / 16.0f, 1.0f, 1);
|
||||
}
|
||||
}
|
||||
virtual bool blocksLight() { return false; }
|
||||
virtual bool isSolidRender(bool isServerLevel = false) { return false; }
|
||||
virtual int getRenderShape() { return Tile_SPU::SHAPE_FENCE_GATE; }
|
||||
virtual bool shouldRenderFace(LevelSource *level, int x, int y, int z, int face){ return true; }
|
||||
static bool isOpen(int data) { return (data & OPEN_BIT) != 0; }
|
||||
};
|
||||
75
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/FenceTile_SPU.cpp
Normal file
75
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/FenceTile_SPU.cpp
Normal file
@@ -0,0 +1,75 @@
|
||||
#include "stdafx.h"
|
||||
#include "FenceTile_SPU.h"
|
||||
#include "ChunkRebuildData.h"
|
||||
|
||||
|
||||
|
||||
void FenceTile_SPU::updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData, TileEntity* forceEntity) // 4J added forceData, forceEntity param
|
||||
{
|
||||
bool n = connectsTo(level, x, y, z - 1);
|
||||
bool s = connectsTo(level, x, y, z + 1);
|
||||
bool w = connectsTo(level, x - 1, y, z);
|
||||
bool e = connectsTo(level, x + 1, y, z);
|
||||
|
||||
float west = 6.0f / 16.0f;
|
||||
float east = 10.0f / 16.0f;
|
||||
float north = 6.0f / 16.0f;
|
||||
float south = 10.0f / 16.0f;
|
||||
|
||||
if (n)
|
||||
{
|
||||
north = 0;
|
||||
}
|
||||
if (s)
|
||||
{
|
||||
south = 1;
|
||||
}
|
||||
if (w)
|
||||
{
|
||||
west = 0;
|
||||
}
|
||||
if (e)
|
||||
{
|
||||
east = 1;
|
||||
}
|
||||
|
||||
setShape(west, 0, north, east, 1.0f, south);
|
||||
}
|
||||
|
||||
bool FenceTile_SPU::blocksLight()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool FenceTile_SPU::isSolidRender(bool isServerLevel)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
int FenceTile_SPU::getRenderShape()
|
||||
{
|
||||
return Tile_SPU::SHAPE_FENCE;
|
||||
}
|
||||
|
||||
bool FenceTile_SPU::connectsTo(ChunkRebuildData *level, int x, int y, int z)
|
||||
{
|
||||
int tile = level->getTile(x, y, z);
|
||||
if (tile == id || tile == Tile_SPU::fenceGate_Id)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
TileRef_SPU tileInstance(tile);
|
||||
if (tileInstance.getPtr() != NULL)
|
||||
{
|
||||
if (tileInstance->getMaterial()->isSolidBlocking() && tileInstance->isCubeShaped())
|
||||
{
|
||||
return tileInstance->getMaterial()->getID() != Material_SPU::vegetable_Id;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool FenceTile_SPU::shouldRenderFace(ChunkRebuildData *level, int x, int y, int z, int face)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
14
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/FenceTile_SPU.h
Normal file
14
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/FenceTile_SPU.h
Normal file
@@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
#include "Tile_SPU.h"
|
||||
|
||||
class FenceTile_SPU : public Tile_SPU
|
||||
{
|
||||
public:
|
||||
FenceTile_SPU(int id) : Tile_SPU(id) {}
|
||||
virtual void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = NULL); // 4J added forceData, forceEntity param
|
||||
virtual bool blocksLight();
|
||||
virtual bool isSolidRender(bool isServerLevel = false);
|
||||
virtual int getRenderShape();
|
||||
virtual bool shouldRenderFace(ChunkRebuildData *level, int x, int y, int z, int face);
|
||||
bool connectsTo(ChunkRebuildData *level, int x, int y, int z);
|
||||
};
|
||||
44
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/FireTile_SPU.h
Normal file
44
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/FireTile_SPU.h
Normal file
@@ -0,0 +1,44 @@
|
||||
#pragma once
|
||||
#include "Tile_SPU.h"
|
||||
|
||||
|
||||
class FireTile_SPU : public Tile_SPU
|
||||
{
|
||||
public:
|
||||
FireTile_SPU(int id) : Tile_SPU(id) {}
|
||||
|
||||
virtual bool blocksLight() { return false; }
|
||||
virtual bool isSolidRender(bool isServerLevel = false) { return false; }
|
||||
virtual bool isCubeShaped() { return false; }
|
||||
virtual int getRenderShape() {return Tile_SPU::SHAPE_FIRE; }
|
||||
|
||||
Icon_SPU *getTextureLayer(int layer) { return &ms_pTileData->fireTile_icons[layer];}
|
||||
Icon_SPU *getTexture(int face, int data) { return &ms_pTileData->fireTile_icons[0];}
|
||||
|
||||
static bool canBurn(ChunkRebuildData *level, int x, int y, int z)
|
||||
{
|
||||
int id = level->getTile(x, y, z);
|
||||
switch (id)
|
||||
{
|
||||
case Tile_SPU::wood_Id:
|
||||
case Tile_SPU::woodSlab_Id:
|
||||
case Tile_SPU::woodSlabHalf_Id:
|
||||
case Tile_SPU::fence_Id:
|
||||
case Tile_SPU::stairs_wood_Id:
|
||||
case Tile_SPU::stairs_birchwood_Id:
|
||||
case Tile_SPU::stairs_sprucewood_Id:
|
||||
case Tile_SPU::stairs_junglewood_Id:
|
||||
case Tile_SPU::treeTrunk_Id:
|
||||
case Tile_SPU::leaves_Id:
|
||||
case Tile_SPU::bookshelf_Id:
|
||||
case Tile_SPU::tnt_Id:
|
||||
case Tile_SPU::tallgrass_Id:
|
||||
case Tile_SPU::cloth_Id:
|
||||
case Tile_SPU::vine_Id:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,32 @@
|
||||
#pragma once
|
||||
|
||||
#include "Tile_SPU.h"
|
||||
|
||||
class FlowerPotTile_SPU : public Tile_SPU
|
||||
{
|
||||
public:
|
||||
static const int TYPE_FLOWER_RED = 1;
|
||||
static const int TYPE_FLOWER_YELLOW = 2;
|
||||
static const int TYPE_SAPLING_DEFAULT = 3;
|
||||
static const int TYPE_SAPLING_EVERGREEN = 4;
|
||||
static const int TYPE_SAPLING_BIRCH = 5;
|
||||
static const int TYPE_SAPLING_JUNGLE = 6;
|
||||
static const int TYPE_MUSHROOM_RED = 7;
|
||||
static const int TYPE_MUSHROOM_BROWN = 8;
|
||||
static const int TYPE_CACTUS = 9;
|
||||
static const int TYPE_DEAD_BUSH = 10;
|
||||
static const int TYPE_FERN = 11;
|
||||
|
||||
FlowerPotTile_SPU(int id) : Tile_SPU(id) {}
|
||||
|
||||
void updateDefaultShape()
|
||||
{
|
||||
float size = 6.0f / 16.0f;
|
||||
float half = size / 2;
|
||||
setShape(0.5f - half, 0, 0.5f - half, 0.5f + half, size, 0.5f + half);
|
||||
}
|
||||
|
||||
bool isSolidRender(bool isServerLevel = false) { return false; }
|
||||
int getRenderShape() { return SHAPE_FLOWER_POT; }
|
||||
bool isCubeShaped() { return false; }
|
||||
};
|
||||
20
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/FurnaceTile_SPU.h
Normal file
20
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/FurnaceTile_SPU.h
Normal file
@@ -0,0 +1,20 @@
|
||||
#pragma once
|
||||
#include "EntityTile_SPU.h"
|
||||
#include "Facing_SPU.h"
|
||||
|
||||
class FurnaceTile_SPU : public EntityTile_SPU
|
||||
{
|
||||
public:
|
||||
FurnaceTile_SPU(int id) : EntityTile_SPU(id){}
|
||||
Icon_SPU *getTexture(int face, int data)
|
||||
{
|
||||
if (face == Facing::UP) return &ms_pTileData->furnaceTile_iconTop;
|
||||
if (face == Facing::DOWN) return &ms_pTileData->furnaceTile_iconTop;
|
||||
|
||||
if (face != data) return icon();
|
||||
if(id == furnace_Id)
|
||||
return &ms_pTileData->furnaceTile_iconFront;
|
||||
else //furnace_lit_Id
|
||||
return &ms_pTileData->furnaceTile_iconFront_lit;
|
||||
}
|
||||
};
|
||||
18
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/GlassTile_SPU.h
Normal file
18
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/GlassTile_SPU.h
Normal file
@@ -0,0 +1,18 @@
|
||||
#pragma once
|
||||
#include "HalfTransparentTile_SPU.h"
|
||||
|
||||
class GlassTile_SPU : public HalfTransparentTile_SPU
|
||||
{
|
||||
public:
|
||||
GlassTile_SPU(int id) : HalfTransparentTile_SPU(id) {}
|
||||
|
||||
virtual bool shouldRenderFace(ChunkRebuildData *level, int x, int y, int z, int face) // from parent class, here because it needs storgage
|
||||
{
|
||||
int id = level->getTile(x, y, z);
|
||||
if (!ms_pTileData->glassTile_allowSame && id == this->id) return false;
|
||||
return Tile_SPU::shouldRenderFace(level, x, y, z, face);
|
||||
|
||||
}
|
||||
|
||||
virtual int getRenderLayer() { return 0; }
|
||||
};
|
||||
65
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/GrassTile_SPU.cpp
Normal file
65
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/GrassTile_SPU.cpp
Normal file
@@ -0,0 +1,65 @@
|
||||
#include "stdafx.h"
|
||||
#include "GrassTile_SPU.h"
|
||||
// #include "net.minecraft.world.level.h"
|
||||
// #include "net.minecraft.world.level.biome.h"
|
||||
// #include "net.minecraft.h"
|
||||
// #include "net.minecraft.world.h"
|
||||
|
||||
#include "Facing_SPU.h"
|
||||
#include "ChunkRebuildData.h"
|
||||
|
||||
|
||||
Icon_SPU *GrassTile_SPU::getTexture(int face, int data)
|
||||
{
|
||||
if (face == Facing::UP) return &ms_pTileData->grass_iconTop;
|
||||
if (face == Facing::DOWN) return TileRef_SPU(dirt_Id)->getTexture(face);
|
||||
return icon();
|
||||
}
|
||||
|
||||
Icon_SPU *GrassTile_SPU::getTexture(ChunkRebuildData *level, int x, int y, int z, int face)
|
||||
{
|
||||
if (face == Facing::UP) return &ms_pTileData->grass_iconTop;
|
||||
if (face == Facing::DOWN) return TileRef_SPU(dirt_Id)->getTexture(face);
|
||||
Material_SPU *above = level->getMaterial(x, y + 1, z);
|
||||
if (above->getID() == Material_SPU::topSnow_Id || above->getID() == Material_SPU::snow_Id)
|
||||
return &ms_pTileData->grass_iconSnowSide;
|
||||
else
|
||||
return icon();
|
||||
}
|
||||
|
||||
|
||||
int GrassTile_SPU::getColor(ChunkRebuildData *level, int x, int y, int z)
|
||||
{
|
||||
return getColor( level, x, y, z, level->getData( x, y, z ) );
|
||||
}
|
||||
|
||||
// 4J - changed interface to have data passed in, and put existing interface as wrapper above
|
||||
int GrassTile_SPU::getColor(ChunkRebuildData *level, int x, int y, int z, int data)
|
||||
{
|
||||
//return level->getBiomeSource()->getBiome(x, z)->getGrassColor(level, x, y, z);
|
||||
|
||||
int totalRed = 0;
|
||||
int totalGreen = 0;
|
||||
int totalBlue = 0;
|
||||
|
||||
for (int oz = -1; oz <= 1; oz++)
|
||||
{
|
||||
for (int ox = -1; ox <= 1; ox++)
|
||||
{
|
||||
int grassColor = level->getGrassColor(x + ox, z + oz);
|
||||
totalRed += (grassColor & 0xff0000) >> 16;
|
||||
totalGreen += (grassColor & 0xff00) >> 8;
|
||||
totalBlue += (grassColor & 0xff);
|
||||
}
|
||||
}
|
||||
|
||||
// return level.getBiomeSource().getBiome(x, z).getGrassColor(level, x, y, z);
|
||||
return (((totalRed / 9) & 0xFF) << 16) | (((totalGreen / 9) & 0xFF) << 8) | (((totalBlue / 9) & 0xFF));
|
||||
}
|
||||
|
||||
|
||||
Icon_SPU *GrassTile_SPU::getSideTextureOverlay()
|
||||
{
|
||||
return &ms_pTileData->grass_iconSideOverlay;
|
||||
}
|
||||
|
||||
23
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/GrassTile_SPU.h
Normal file
23
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/GrassTile_SPU.h
Normal file
@@ -0,0 +1,23 @@
|
||||
#pragma once
|
||||
#include "Tile_SPU.h"
|
||||
|
||||
|
||||
class GrassTile_SPU : public Tile_SPU
|
||||
{
|
||||
friend class Tile_SPU;
|
||||
private:
|
||||
// Icon *iconTop;
|
||||
// Icon *iconSnowSide;
|
||||
// Icon *iconSideOverlay;
|
||||
public:
|
||||
static const int MIN_BRIGHTNESS = 4;
|
||||
|
||||
protected:
|
||||
GrassTile_SPU(int id) : Tile_SPU(id) {}
|
||||
public:
|
||||
virtual Icon_SPU *getTexture(int face, int data);
|
||||
virtual Icon_SPU *getTexture(ChunkRebuildData *level, int x, int y, int z, int face);
|
||||
virtual int getColor(ChunkRebuildData *level, int x, int y, int z);
|
||||
virtual int getColor(ChunkRebuildData *level, int x, int y, int z, int data); // 4J added
|
||||
static Icon_SPU *getSideTextureOverlay();
|
||||
};
|
||||
@@ -0,0 +1,77 @@
|
||||
#include "stdafx.h"
|
||||
#include "HalfSlabTile_SPU.h"
|
||||
#include "Facing_SPU.h"
|
||||
#include "ChunkRebuildData.h"
|
||||
|
||||
void HalfSlabTile_SPU::updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData /* = -1 */, TileEntity* forceEntity /* = NULL */)
|
||||
{
|
||||
if (fullSize())
|
||||
{
|
||||
setShape(0, 0, 0, 1, 1, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
bool upper = (level->getData(x, y, z) & TOP_SLOT_BIT) != 0;
|
||||
if (upper)
|
||||
{
|
||||
setShape(0, 0.5f, 0, 1, 1, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
setShape(0, 0, 0, 1, 0.5f, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void HalfSlabTile_SPU::updateDefaultShape()
|
||||
{
|
||||
if (fullSize())
|
||||
{
|
||||
setShape(0, 0, 0, 1, 1, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
setShape(0, 0, 0, 1, 0.5f, 1);
|
||||
}
|
||||
}
|
||||
|
||||
bool HalfSlabTile_SPU::isSolidRender(bool isServerLevel)
|
||||
{
|
||||
return fullSize();
|
||||
}
|
||||
|
||||
bool HalfSlabTile_SPU::shouldRenderFace(ChunkRebuildData *level, int x, int y, int z, int face)
|
||||
{
|
||||
if (fullSize()) return Tile_SPU::shouldRenderFace(level, x, y, z, face);
|
||||
|
||||
if (face != Facing::UP && face != Facing::DOWN && !Tile_SPU::shouldRenderFace(level, x, y, z, face))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
int ox = x, oy = y, oz = z;
|
||||
ox += Facing::STEP_X[Facing::OPPOSITE_FACING[face]];
|
||||
oy += Facing::STEP_Y[Facing::OPPOSITE_FACING[face]];
|
||||
oz += Facing::STEP_Z[Facing::OPPOSITE_FACING[face]];
|
||||
|
||||
bool isUpper = (level->getData(ox, oy, oz) & TOP_SLOT_BIT) != 0;
|
||||
if (isUpper)
|
||||
{
|
||||
if (face == Facing::DOWN) return true;
|
||||
if (face == Facing::UP && Tile_SPU::shouldRenderFace(level, x, y, z, face)) return true;
|
||||
return !(isHalfSlab(level->getTile(x, y, z)) && (level->getData(x, y, z) & TOP_SLOT_BIT) != 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (face == Facing::UP) return true;
|
||||
if (face == Facing::DOWN && Tile_SPU::shouldRenderFace(level, x, y, z, face)) return true;
|
||||
return !(isHalfSlab(level->getTile(x, y, z)) && (level->getData(x, y, z) & TOP_SLOT_BIT) == 0);
|
||||
}
|
||||
}
|
||||
|
||||
bool HalfSlabTile_SPU::isHalfSlab(int tileId)
|
||||
{
|
||||
return tileId == Tile_SPU::stoneSlabHalf_Id || tileId == Tile_SPU::woodSlabHalf_Id;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
#pragma once
|
||||
#include "Tile_SPU.h"
|
||||
|
||||
|
||||
class HalfSlabTile_SPU : public Tile_SPU
|
||||
{
|
||||
public:
|
||||
static const int TYPE_MASK = 7;
|
||||
static const int TOP_SLOT_BIT = 8;
|
||||
|
||||
HalfSlabTile_SPU(int id) : Tile_SPU(id) {}
|
||||
virtual void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = NULL); // 4J added forceData, forceEntity param
|
||||
virtual void updateDefaultShape();
|
||||
virtual bool isSolidRender(bool isServerLevel);
|
||||
virtual bool shouldRenderFace(ChunkRebuildData *level, int x, int y, int z, int face);
|
||||
|
||||
bool fullSize() { return !isHalfSlab(id); }
|
||||
static bool isHalfSlab(int tileId);
|
||||
};
|
||||
@@ -0,0 +1,11 @@
|
||||
#pragma once
|
||||
#include "Tile_SPU.h"
|
||||
|
||||
class HalfTransparentTile_SPU : public Tile_SPU
|
||||
{
|
||||
public:
|
||||
HalfTransparentTile_SPU(int id) : Tile_SPU(id) {}
|
||||
virtual bool isSolidRender(bool isServerLevel = false) { return false; }
|
||||
virtual bool shouldRenderFace(ChunkRebuildData *level, int x, int y, int z, int face) = 0; // make sure the inherited class defines this, as it needs some storage (allowSame)
|
||||
virtual bool blocksLight() { return false; }
|
||||
};
|
||||
@@ -0,0 +1,43 @@
|
||||
#pragma once
|
||||
#include "Tile_SPU.h"
|
||||
|
||||
class HugeMushroomTile_SPU : public Tile_SPU
|
||||
{
|
||||
public:
|
||||
// static const wstring TEXTURE_STEM;
|
||||
// static const wstring TEXTURE_INSIDE;
|
||||
|
||||
private:
|
||||
static const int HUGE_MUSHROOM_TEXTURE_COUNT = 2;
|
||||
public:
|
||||
HugeMushroomTile_SPU(int id) : Tile_SPU(id) {}
|
||||
Icon_SPU *getTexture(int face, int data)
|
||||
{
|
||||
Icon_SPU* icons = ms_pTileData->hugeMushroom_icons;
|
||||
int type = 0; // hugeMushroom1_Id
|
||||
if(id == hugeMushroom2_Id)
|
||||
type = 1;
|
||||
// 123
|
||||
// 456 10
|
||||
// 789
|
||||
if (data == 10 && face > 1) return &ms_pTileData->hugeMushroom_iconStem;
|
||||
if (data >= 1 && data <= 9 && face == 1) return &icons[type];
|
||||
if (data >= 1 && data <= 3 && face == 2) return &icons[type];
|
||||
if (data >= 7 && data <= 9 && face == 3) return &icons[type];
|
||||
|
||||
if ((data == 1 || data == 4 || data == 7) && face == 4) return &icons[type];
|
||||
if ((data == 3 || data == 6 || data == 9) && face == 5) return &icons[type];
|
||||
|
||||
// two special cases requested by rhodox (painterly pack)
|
||||
if (data == 14)
|
||||
{
|
||||
return &icons[type];
|
||||
}
|
||||
if (data == 15)
|
||||
{
|
||||
return &ms_pTileData->hugeMushroom_iconStem;
|
||||
}
|
||||
|
||||
return &ms_pTileData->hugeMushroom_iconInside;
|
||||
}
|
||||
};
|
||||
17
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/IceTile_SPU.h
Normal file
17
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/IceTile_SPU.h
Normal file
@@ -0,0 +1,17 @@
|
||||
#pragma once
|
||||
#include "HalfTransparentTile_SPU.h"
|
||||
|
||||
class Random;
|
||||
|
||||
class IceTile_SPU : public HalfTransparentTile_SPU
|
||||
{
|
||||
public:
|
||||
IceTile_SPU(int id) : HalfTransparentTile_SPU(id) {}
|
||||
virtual int getRenderLayer() { return 1; }
|
||||
virtual bool shouldRenderFace(ChunkRebuildData *level, int x, int y, int z, int face)
|
||||
{
|
||||
int id = level->getTile(x, y, z);
|
||||
if (!ms_pTileData->iceTile_allowSame && id == this->id) return false;
|
||||
return Tile_SPU::shouldRenderFace(level, x, y, z, 1 - face);
|
||||
}
|
||||
};
|
||||
1
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/Icon_SPU.cpp
Normal file
1
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/Icon_SPU.cpp
Normal file
@@ -0,0 +1 @@
|
||||
|
||||
56
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/Icon_SPU.h
Normal file
56
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/Icon_SPU.h
Normal file
@@ -0,0 +1,56 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
class Icon_SPU
|
||||
{
|
||||
|
||||
int16_t x0;
|
||||
int16_t y0;
|
||||
int16_t x1;
|
||||
int16_t y1;
|
||||
|
||||
public:
|
||||
|
||||
// static const int TYPE_TERRAIN = 0;
|
||||
// static const int TYPE_ITEM = 1;
|
||||
//
|
||||
static const float UVAdjust = (1.0f/16.0f)/256.0f;
|
||||
|
||||
// int getX() const { return x; }
|
||||
// int getY() const { return y; }
|
||||
// int getWidth() const { return (w<0) ? -w : w; } // can be negative, to support flipped icons (only doors for now).
|
||||
// int getHeight() const { return h; }
|
||||
|
||||
void set(int16_t _x, int16_t _y, int16_t _w, int16_t _h, int texWidth, int texHeight)
|
||||
{
|
||||
x0 = (int16_t)(4096 * (float(_x) / texWidth));
|
||||
y0 = (int16_t)(4096 * (float(_y) / texHeight));
|
||||
x1 = x0 + (int16_t)(4096 * (float(_w) / texWidth));
|
||||
y1 = y0 + (int16_t)(4096 * (float(_h) / texHeight));
|
||||
}
|
||||
|
||||
void flipHorizontal() { int16_t temp = x0; x0 = x1; x1 = temp; }
|
||||
void flipVertical() { int16_t temp = y0; y0 = y1; y1 = temp; }
|
||||
|
||||
float getU0() const { return (float(x0) / 4096) + UVAdjust; }//sc_texWidth) + getUAdjust(); }
|
||||
float getU1() const { return (float(x1) / 4096.0f) - UVAdjust; } //sc_texWidth) - getUAdjust(); }
|
||||
float getU(double offset) const
|
||||
{
|
||||
float diff = getU1() - getU0();
|
||||
return getU0() + (diff * ((float) offset / 16));//SharedConstants::WORLD_RESOLUTION));
|
||||
}
|
||||
|
||||
float getV0() const { return (float(y0) / 4096.0f) + UVAdjust; } //sc_texHeight) + getVAdjust(); }
|
||||
float getV1() const { return (float(y1) / 4096.0f) - UVAdjust; } //sc_texHeight) - getVAdjust(); }
|
||||
float getV(double offset) const
|
||||
{
|
||||
float diff = getV1() - getV0();
|
||||
return getV0() + (diff * ((float) offset / 16)); //SharedConstants::WORLD_RESOLUTION));
|
||||
}
|
||||
|
||||
// virtual wstring getName() const = 0;
|
||||
// virtual int getSourceWidth() const = 0;
|
||||
// virtual int getSourceHeight() const = 0;
|
||||
};
|
||||
|
||||
13
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/LadderTile_SPU.h
Normal file
13
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/LadderTile_SPU.h
Normal file
@@ -0,0 +1,13 @@
|
||||
#pragma once
|
||||
#include "Tile_SPU.h"
|
||||
|
||||
|
||||
class LadderTile_SPU : public Tile_SPU
|
||||
{
|
||||
public:
|
||||
LadderTile_SPU(int id) : Tile_SPU(id) {}
|
||||
virtual bool blocksLight() { return false; }
|
||||
virtual bool isSolidRender(bool isServerLevel = false) { return false; }
|
||||
virtual bool isCubeShaped() { return false; }
|
||||
virtual int getRenderShape() { return Tile_SPU::SHAPE_LADDER; }
|
||||
};
|
||||
88
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/LeafTile_SPU.cpp
Normal file
88
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/LeafTile_SPU.cpp
Normal file
@@ -0,0 +1,88 @@
|
||||
#include "stdafx.h"
|
||||
#include "LeafTile_SPU.h"
|
||||
#include "ChunkRebuildData.h"
|
||||
|
||||
|
||||
// const unsigned int LeafTile::LEAF_NAMES[LEAF_NAMES_LENGTH] = { IDS_TILE_LEAVES_OAK,
|
||||
// IDS_TILE_LEAVES_SPRUCE,
|
||||
// IDS_TILE_LEAVES_BIRCH,
|
||||
// };
|
||||
//
|
||||
// const wstring LeafTile::TEXTURES[2][4] = { {L"leaves", L"leaves_spruce", L"leaves", L"leaves_jungle"}, {L"leaves_opaque", L"leaves_spruce_opaque", L"leaves_opaque", L"leaves_jungle_opaque"},};
|
||||
|
||||
|
||||
// from TransparentTile, since we're no longer inheriting
|
||||
bool LeafTile_SPU::shouldRenderFace(ChunkRebuildData *level, int x, int y, int z, int face)
|
||||
{
|
||||
int id = level->getTile(x, y, z);
|
||||
if (!ms_pTileData->leafTile_allowSame && id == this->id) return false;
|
||||
return Tile_SPU::shouldRenderFace(level, x, y, z, face);
|
||||
}
|
||||
|
||||
int LeafTile_SPU::getColor(ChunkRebuildData *level, int x, int y, int z)
|
||||
{
|
||||
return getColor(level, x, y, z, level->getData(x, y, z) );
|
||||
}
|
||||
|
||||
// 4J - changed interface to have data passed in, and put existing interface as wrapper above
|
||||
int LeafTile_SPU::getColor(ChunkRebuildData *level, int x, int y, int z, int data)
|
||||
{
|
||||
if ((data & LEAF_TYPE_MASK) == EVERGREEN_LEAF)
|
||||
{
|
||||
return ms_pTileData->foliageColor_evergreenColor; //FoliageColor::getEvergreenColor();
|
||||
}
|
||||
if ((data & LEAF_TYPE_MASK) == BIRCH_LEAF)
|
||||
{
|
||||
return ms_pTileData->foliageColor_birchColor;//FoliageColor::getBirchColor();
|
||||
}
|
||||
|
||||
//return level->getBiomeSource()->getBiome(x, z)->getFolageColor(level, x, y, z);
|
||||
|
||||
int totalRed = 0;
|
||||
int totalGreen = 0;
|
||||
int totalBlue = 0;
|
||||
|
||||
for (int oz = -1; oz <= 1; oz++)
|
||||
{
|
||||
for (int ox = -1; ox <= 1; ox++)
|
||||
{
|
||||
int foliageColor = level->getFoliageColor(x + ox, z + oz);
|
||||
|
||||
totalRed += (foliageColor & 0xff0000) >> 16;
|
||||
totalGreen += (foliageColor & 0xff00) >> 8;
|
||||
totalBlue += (foliageColor & 0xff);
|
||||
}
|
||||
}
|
||||
|
||||
// return level.getBiomeSource().getBiome(x, z).getGrassColor(level, x, y, z);
|
||||
return (((totalRed / 9) & 0xFF) << 16) | (((totalGreen / 9) & 0xFF) << 8) | (((totalBlue / 9) & 0xFF));
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool LeafTile_SPU::isSolidRender(bool isServerLevel)
|
||||
{
|
||||
// 4J Stu - The server level shouldn't care how the tile is rendered!
|
||||
// Fix for #9407 - Gameplay: Destroying a block of snow on top of trees, removes any adjacent snow.
|
||||
if(isServerLevel) return true;
|
||||
return !ms_pTileData->leafTile_allowSame;
|
||||
}
|
||||
|
||||
Icon_SPU *LeafTile_SPU::getTexture(int face, int data)
|
||||
{
|
||||
if ((data & LEAF_TYPE_MASK) == EVERGREEN_LEAF)
|
||||
{
|
||||
return &ms_pTileData->leafTile_icons[ms_pTileData->leafTile_fancyTextureSet][EVERGREEN_LEAF];
|
||||
}
|
||||
if ((data & LEAF_TYPE_MASK) == JUNGLE_LEAF)
|
||||
{
|
||||
return &ms_pTileData->leafTile_icons[ms_pTileData->leafTile_fancyTextureSet][JUNGLE_LEAF];
|
||||
}
|
||||
return &ms_pTileData->leafTile_icons[ms_pTileData->leafTile_fancyTextureSet][0];
|
||||
}
|
||||
|
||||
void LeafTile_SPU::setFancy(bool fancyGraphics)
|
||||
{
|
||||
ms_pTileData->leafTile_allowSame = fancyGraphics;
|
||||
ms_pTileData->leafTile_fancyTextureSet = (fancyGraphics ? 0 : 1);
|
||||
}
|
||||
38
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/LeafTile_SPU.h
Normal file
38
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/LeafTile_SPU.h
Normal file
@@ -0,0 +1,38 @@
|
||||
#pragma once
|
||||
#include "Tile_SPU.h"
|
||||
|
||||
class LeafTile_SPU : public Tile_SPU
|
||||
{
|
||||
friend class Tile;
|
||||
public:
|
||||
static const int REQUIRED_WOOD_RANGE = 4;
|
||||
static const int UPDATE_LEAF_BIT = 8;
|
||||
static const int PERSISTENT_LEAF_BIT = 4; // player-placed
|
||||
static const int NORMAL_LEAF = 0;
|
||||
static const int EVERGREEN_LEAF = 1;
|
||||
static const int BIRCH_LEAF = 2;
|
||||
static const int JUNGLE_LEAF = 3;
|
||||
|
||||
static const int LEAF_NAMES_LENGTH = 3;
|
||||
|
||||
static const int LEAF_TYPE_MASK = 3;
|
||||
|
||||
// pppppppppp ppppppppppp pppppppppp ppppppp
|
||||
// ssssssssss sssssssssss s
|
||||
|
||||
LeafTile_SPU(int id) : Tile_SPU(id) {}
|
||||
public:
|
||||
virtual bool isSolidRender(bool isServerLevel = false);
|
||||
virtual bool shouldRenderFace(ChunkRebuildData *level, int x, int y, int z, int face); // from TransparentTile, since we're no longer inheriting
|
||||
virtual bool blocksLight() { return false; }
|
||||
|
||||
|
||||
// virtual int getColor() const;
|
||||
// virtual int getColor(int data);
|
||||
virtual int getColor(ChunkRebuildData *level, int x, int y, int z);
|
||||
virtual int getColor(ChunkRebuildData *level, int x, int y, int z, int data); // 4J added
|
||||
|
||||
public:
|
||||
virtual Icon_SPU *getTexture(int face, int data);
|
||||
static void setFancy(bool fancyGraphics);
|
||||
};
|
||||
12
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/LeverTile_SPU.h
Normal file
12
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/LeverTile_SPU.h
Normal file
@@ -0,0 +1,12 @@
|
||||
#pragma once
|
||||
#include "Tile_SPU.h"
|
||||
|
||||
class LeverTile_SPU : public Tile_SPU
|
||||
{
|
||||
public:
|
||||
LeverTile_SPU(int id) : Tile_SPU(id) {}
|
||||
virtual bool blocksLight() { return false; }
|
||||
virtual bool isSolidRender(bool isServerLevel = false) { return false; }
|
||||
virtual int getRenderShape() { return Tile_SPU::SHAPE_LEVER; }
|
||||
// virtual void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, shared_ptr<TileEntity> forceEntity = shared_ptr<TileEntity>()); // 4J added forceData, forceEntity param
|
||||
};
|
||||
224
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/LiquidTile_SPU.cpp
Normal file
224
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/LiquidTile_SPU.cpp
Normal file
@@ -0,0 +1,224 @@
|
||||
#include "stdafx.h"
|
||||
#include "LiquidTile_SPU.h"
|
||||
#include "Facing_SPU.h"
|
||||
#include "ChunkRebuildData.h"
|
||||
|
||||
#ifdef SN_TARGET_PS3_SPU
|
||||
#include "..\Common\spu_assert.h"
|
||||
#endif
|
||||
|
||||
// const wstring LiquidTile::TEXTURE_LAVA_STILL = L"lava";
|
||||
// const wstring LiquidTile::TEXTURE_WATER_STILL = L"water";
|
||||
// const wstring LiquidTile::TEXTURE_WATER_FLOW = L"water_flow";
|
||||
// const wstring LiquidTile::TEXTURE_LAVA_FLOW = L"lava_flow";
|
||||
|
||||
#define MATH_PI (3.141592654f)
|
||||
|
||||
|
||||
int LiquidTile_SPU::getColor(ChunkRebuildData *level, int x, int y, int z)
|
||||
{
|
||||
|
||||
return getColor(level, x, y, z, 0);
|
||||
}
|
||||
|
||||
int LiquidTile_SPU::getColor(ChunkRebuildData *level, int x, int y, int z, int d)
|
||||
{
|
||||
// MGH - TODO
|
||||
if (getMaterial()->getID() == Material_SPU::water_Id)
|
||||
{
|
||||
// Biome b = level.getBiomeSource().getBiome(x, z);
|
||||
// return b.waterColor;
|
||||
|
||||
int totalRed = 0;
|
||||
int totalGreen = 0;
|
||||
int totalBlue = 0;
|
||||
|
||||
for (int oz = -1; oz <= 1; oz++)
|
||||
{
|
||||
for (int ox = -1; ox <= 1; ox++)
|
||||
{
|
||||
int waterColor = level->getWaterColor(x + ox, z + oz);
|
||||
|
||||
totalRed += (waterColor & 0xff0000) >> 16;
|
||||
totalGreen += (waterColor & 0xff00) >> 8;
|
||||
totalBlue += (waterColor & 0xff);
|
||||
}
|
||||
}
|
||||
|
||||
// return level.getBiomeSource().getBiome(x, z).getGrassColor(level, x, y, z);
|
||||
return (((totalRed / 9) & 0xFF) << 16) | (((totalGreen / 9) & 0xFF) << 8) | (((totalBlue / 9) & 0xFF));
|
||||
}
|
||||
return 0xffffff;
|
||||
}
|
||||
|
||||
float LiquidTile_SPU::getHeight(int d)
|
||||
{
|
||||
// if (d == 0) d++;
|
||||
if (d >= 8) d = 0;
|
||||
return (d + 1) / 9.0f;
|
||||
}
|
||||
|
||||
Icon_SPU *LiquidTile_SPU::getTexture(int face, int data)
|
||||
{
|
||||
if (face == Facing::DOWN || face == Facing::UP)
|
||||
{
|
||||
if(id == water_Id || id == calmWater_Id)
|
||||
return &ms_pTileData->liquidTile_iconWaterStill;
|
||||
else //(id == lava_Id || id == calmLava_Id)
|
||||
return &ms_pTileData->liquidTile_iconLavaStill;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(id == water_Id || id == calmWater_Id)
|
||||
return &ms_pTileData->liquidTile_iconWaterFlow;
|
||||
else //(id == lava_Id || id == calmLava_Id)
|
||||
return &ms_pTileData->liquidTile_iconLavaFlow;
|
||||
}
|
||||
}
|
||||
|
||||
int LiquidTile_SPU::getDepth(ChunkRebuildData *level, int x, int y, int z)
|
||||
{
|
||||
if (level->getMaterial(x, y, z)->getID() != getMaterial()->getID()) return -1;
|
||||
else return -1;;
|
||||
}
|
||||
|
||||
int LiquidTile_SPU::getRenderedDepth(ChunkRebuildData *level, int x, int y, int z)
|
||||
{
|
||||
if (level->getMaterial(x, y, z)->getID() != getMaterial()->getID()) return -1;
|
||||
int d = level->getData(x, y, z);
|
||||
if (d >= 8) d = 0;
|
||||
return d;
|
||||
}
|
||||
|
||||
|
||||
bool LiquidTile_SPU::isSolidRender(bool isServerLevel)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool LiquidTile_SPU::isSolidFace(ChunkRebuildData *level, int x, int y, int z, int face)
|
||||
{
|
||||
Material_SPU *m = level->getMaterial(x, y, z);
|
||||
if (m->getID() == this->getMaterial()->getID()) return false;
|
||||
if (face == Facing::UP) return true;
|
||||
if (m->getID() == Material_SPU::ice_Id) return false;
|
||||
|
||||
return Tile_SPU::isSolidFace(level, x, y, z, face);
|
||||
}
|
||||
|
||||
bool LiquidTile_SPU::shouldRenderFace(ChunkRebuildData *level, int x, int y, int z, int face)
|
||||
{
|
||||
Material_SPU *m = level->getMaterial(x, y, z);
|
||||
if (m->getID() == this->getMaterial()->getID()) return false;
|
||||
if (face == Facing::UP) return true;
|
||||
if (m->getID() == Material_SPU::ice_Id) return false;
|
||||
return Tile_SPU::shouldRenderFace(level, x, y, z, face);
|
||||
}
|
||||
|
||||
int LiquidTile_SPU::getRenderShape()
|
||||
{
|
||||
return Tile_SPU::SHAPE_WATER;
|
||||
}
|
||||
|
||||
|
||||
Vec3_SPU LiquidTile_SPU::getFlow(ChunkRebuildData *level, int x, int y, int z)
|
||||
{
|
||||
Vec3_SPU flow = Vec3_SPU(0,0,0);
|
||||
int mid = getRenderedDepth(level, x, y, z);
|
||||
for (int d = 0; d < 4; d++)
|
||||
{
|
||||
|
||||
int xt = x;
|
||||
int yt = y;
|
||||
int zt = z;
|
||||
|
||||
if (d == 0) xt--;
|
||||
if (d == 1) zt--;
|
||||
if (d == 2) xt++;
|
||||
if (d == 3) zt++;
|
||||
|
||||
int t = getRenderedDepth(level, xt, yt, zt);
|
||||
if (t < 0)
|
||||
{
|
||||
if (!level->getMaterial(xt, yt, zt)->blocksMotion())
|
||||
{
|
||||
t = getRenderedDepth(level, xt, yt - 1, zt);
|
||||
if (t >= 0)
|
||||
{
|
||||
int dir = t - (mid - 8);
|
||||
flow = flow.add((xt - x) * dir, (yt - y) * dir, (zt - z) * dir);
|
||||
}
|
||||
}
|
||||
} else
|
||||
{
|
||||
if (t >= 0)
|
||||
{
|
||||
int dir = t - mid;
|
||||
flow = flow.add((xt - x) * dir, (yt - y) * dir, (zt - z) * dir);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if (level->getData(x, y, z) >= 8)
|
||||
{
|
||||
bool ok = false;
|
||||
if (ok || isSolidFace(level, x, y, z - 1, 2)) ok = true;
|
||||
if (ok || isSolidFace(level, x, y, z + 1, 3)) ok = true;
|
||||
if (ok || isSolidFace(level, x - 1, y, z, 4)) ok = true;
|
||||
if (ok || isSolidFace(level, x + 1, y, z, 5)) ok = true;
|
||||
if (ok || isSolidFace(level, x, y + 1, z - 1, 2)) ok = true;
|
||||
if (ok || isSolidFace(level, x, y + 1, z + 1, 3)) ok = true;
|
||||
if (ok || isSolidFace(level, x - 1, y + 1, z, 4)) ok = true;
|
||||
if (ok || isSolidFace(level, x + 1, y + 1, z, 5)) ok = true;
|
||||
if (ok) flow = flow.normalize().add(0, -6, 0);
|
||||
}
|
||||
flow = flow.normalize();
|
||||
return flow;
|
||||
}
|
||||
|
||||
|
||||
// 4J - change brought forward from 1.8.2
|
||||
int LiquidTile_SPU::getLightColor(ChunkRebuildData *level, int x, int y, int z)
|
||||
{
|
||||
int a = level->getLightColor(x, y, z, 0);
|
||||
int b = level->getLightColor(x, y + 1, z, 0);
|
||||
|
||||
int aa = a & 0xff;
|
||||
int ba = b & 0xff;
|
||||
int ab = (a >> 16) & 0xff;
|
||||
int bb = (b >> 16) & 0xff;
|
||||
|
||||
return (aa > ba ? aa : ba) | ((ab > bb ? ab : bb) << 16);
|
||||
}
|
||||
|
||||
float LiquidTile_SPU::getBrightness(ChunkRebuildData *level, int x, int y, int z)
|
||||
{
|
||||
float a = level->getBrightness(x, y, z);
|
||||
float b = level->getBrightness(x, y + 1, z);
|
||||
return a > b ? a : b;
|
||||
}
|
||||
|
||||
|
||||
int LiquidTile_SPU::getRenderLayer()
|
||||
{
|
||||
return getMaterial()->getID() == Material_SPU::water_Id ? 1 : 0;
|
||||
}
|
||||
|
||||
|
||||
double LiquidTile_SPU::getSlopeAngle(ChunkRebuildData *level, int x, int y, int z, Material_SPU *m)
|
||||
{
|
||||
Vec3_SPU flow = Vec3_SPU(0,0,0);
|
||||
if (m->getID() == Material_SPU::water_Id)
|
||||
{
|
||||
TileRef_SPU tRef(Tile_SPU::water_Id);
|
||||
flow = ((LiquidTile_SPU*)tRef.getPtr())->getFlow(level, x, y, z);
|
||||
}
|
||||
if (m->getID() == Material_SPU::lava_Id)
|
||||
{
|
||||
TileRef_SPU tRef(Tile_SPU::lava_Id);
|
||||
flow = ((LiquidTile_SPU*)tRef.getPtr())->getFlow(level, x, y, z);
|
||||
}
|
||||
if (flow.x == 0 && flow.z == 0) return -1000;
|
||||
return atan2(flow.z, flow.x) - MATH_PI / 2;
|
||||
}
|
||||
|
||||
47
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/LiquidTile_SPU.h
Normal file
47
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/LiquidTile_SPU.h
Normal file
@@ -0,0 +1,47 @@
|
||||
#pragma once
|
||||
#include "Tile_SPU.h"
|
||||
#include <math.h>
|
||||
|
||||
class Vec3_SPU
|
||||
{
|
||||
public:
|
||||
float x,y,z;
|
||||
Vec3_SPU(float xVal, float yVal, float zVal) :x(xVal), y(yVal), z(zVal) {}
|
||||
Vec3_SPU normalize()
|
||||
{
|
||||
float dist = sqrtf(x * x + y * y + z * z);
|
||||
if (dist < 0.0001) return Vec3_SPU(0, 0, 0);
|
||||
return Vec3_SPU(x / dist, y / dist, z / dist);
|
||||
}
|
||||
Vec3_SPU add(float x, float y, float z)
|
||||
{
|
||||
return Vec3_SPU(this->x+x, this->y+y, this->z+z);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
class LiquidTile_SPU : public Tile_SPU
|
||||
{
|
||||
public:
|
||||
|
||||
LiquidTile_SPU(int id) : Tile_SPU(id) {}
|
||||
public:
|
||||
// virtual int getColor() const;
|
||||
virtual int getColor(ChunkRebuildData *level, int x, int y, int z);
|
||||
virtual int getColor(ChunkRebuildData *level, int x, int y, int z, int data); // 4J added
|
||||
static float getHeight(int d);
|
||||
static double getSlopeAngle(ChunkRebuildData *level, int x, int y, int z, Material_SPU *m);
|
||||
virtual Icon_SPU *getTexture(int face, int data);
|
||||
virtual int getDepth(ChunkRebuildData *level, int x, int y, int z);
|
||||
virtual int getRenderedDepth(ChunkRebuildData *level, int x, int y, int z);
|
||||
virtual bool isSolidRender(bool isServerLevel = false);
|
||||
virtual bool isSolidFace(ChunkRebuildData *level, int x, int y, int z, int face);
|
||||
virtual bool shouldRenderFace(ChunkRebuildData *level, int x, int y, int z, int face);
|
||||
virtual int getRenderShape();
|
||||
virtual Vec3_SPU getFlow(ChunkRebuildData *level, int x, int y, int z);
|
||||
virtual int getRenderLayer();
|
||||
virtual int getLightColor(ChunkRebuildData *level, int x, int y, int z); // 4J - brought forward from 1.8.2
|
||||
virtual float getBrightness(ChunkRebuildData *level, int x, int y, int z);
|
||||
private:
|
||||
};
|
||||
74
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/Material_SPU.h
Normal file
74
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/Material_SPU.h
Normal file
@@ -0,0 +1,74 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
class ChunkRebuildData;
|
||||
class Material_SPU
|
||||
{
|
||||
friend class ChunkRebuildData;
|
||||
public:
|
||||
static const int air_Id = 0;
|
||||
static const int grass_Id = 1;
|
||||
static const int dirt_Id = 2;
|
||||
static const int wood_Id = 3;
|
||||
static const int stone_Id = 4;
|
||||
static const int metal_Id = 5;
|
||||
static const int water_Id = 6;
|
||||
static const int lava_Id = 7;
|
||||
static const int leaves_Id = 8;
|
||||
static const int plant_Id = 9;
|
||||
static const int replaceable_plant_Id = 10;
|
||||
static const int sponge_Id = 11;
|
||||
static const int cloth_Id = 12;
|
||||
static const int fire_Id = 13;
|
||||
static const int sand_Id = 14;
|
||||
static const int decoration_Id = 15;
|
||||
static const int glass_Id = 16;
|
||||
static const int explosive_Id = 17;
|
||||
static const int coral_Id = 18;
|
||||
static const int ice_Id = 19;
|
||||
static const int topSnow_Id = 20;
|
||||
static const int snow_Id = 21;
|
||||
static const int cactus_Id = 22;
|
||||
static const int clay_Id = 23;
|
||||
static const int vegetable_Id = 24;
|
||||
static const int egg_Id = 25;
|
||||
static const int portal_Id = 26;
|
||||
static const int cake_Id = 27;
|
||||
static const int web_Id = 28;
|
||||
static const int piston_Id = 29;
|
||||
static const int buildable_glass_Id = 30;
|
||||
static const int heavyMetal_Id = 31;
|
||||
static const int clothDecoration_Id = 32;
|
||||
static const int num_Ids = 32;
|
||||
|
||||
enum Flags
|
||||
{
|
||||
e_flammable = 0x01,
|
||||
e_replaceable = 0x02,
|
||||
e_neverBuildable = 0x04,
|
||||
e_isSolid = 0x08,
|
||||
e_isLiquid = 0x10,
|
||||
e_blocksLight = 0x20,
|
||||
e_blocksMotion = 0x40
|
||||
};
|
||||
|
||||
private:
|
||||
uint16_t id;
|
||||
uint16_t flags;
|
||||
|
||||
public:
|
||||
int color;
|
||||
|
||||
public:
|
||||
int getID() { return id;}
|
||||
bool isLiquid() { return (flags & e_isLiquid) != 0; }
|
||||
bool letsWaterThrough() { return (!isLiquid() && !isSolid()); }
|
||||
bool isSolid() { return (flags & e_isSolid) != 0;}
|
||||
bool blocksLight() { return (flags & e_blocksLight) != 0; }
|
||||
bool blocksMotion() { return (flags & e_blocksMotion) != 0; }
|
||||
bool isFlammable() { return (flags & e_flammable) != 0; }
|
||||
bool isReplaceable(){ return (flags & e_replaceable) != 0; }
|
||||
bool isSolidBlocking(){ if (flags & e_neverBuildable) return false; return blocksMotion(); }
|
||||
};
|
||||
|
||||
14
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/MelonTile_SPU.h
Normal file
14
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/MelonTile_SPU.h
Normal file
@@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
#include "Tile_SPU.h"
|
||||
|
||||
|
||||
class MelonTile_SPU : public Tile_SPU
|
||||
{
|
||||
public:
|
||||
MelonTile_SPU(int id) : Tile_SPU(id) {}
|
||||
virtual Icon_SPU *getTexture(int face, int data)
|
||||
{
|
||||
if (face == Facing::UP || face == Facing::DOWN) return &ms_pTileData->melonTile_iconTop;
|
||||
return icon();
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,12 @@
|
||||
#pragma once
|
||||
#include "EntityTile_SPU.h"
|
||||
|
||||
class Random;
|
||||
|
||||
class MobSpawnerTile_SPU : public EntityTile_SPU
|
||||
{
|
||||
public:
|
||||
MobSpawnerTile_SPU(int id) : EntityTile_SPU(id) {}
|
||||
virtual bool isSolidRender(bool isServerLevel = false) { return false; }
|
||||
virtual bool blocksLight() { return false; }
|
||||
};
|
||||
@@ -0,0 +1,8 @@
|
||||
#pragma once
|
||||
#include "Bush_SPU.h"
|
||||
|
||||
class Mushroom_SPU : public Bush_SPU
|
||||
{
|
||||
public:
|
||||
Mushroom_SPU(int id) : Bush_SPU(id){}
|
||||
};
|
||||
25
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/MycelTile_SPU.h
Normal file
25
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/MycelTile_SPU.h
Normal file
@@ -0,0 +1,25 @@
|
||||
#pragma once
|
||||
#include "Tile_SPU.h"
|
||||
|
||||
class MycelTile_SPU : public Tile_SPU
|
||||
{
|
||||
public:
|
||||
MycelTile_SPU(int id) : Tile_SPU(id) {}
|
||||
|
||||
virtual Icon_SPU *getTexture(int face, int data)
|
||||
{
|
||||
if (face == Facing::UP) return &ms_pTileData->mycelTile_iconTop;
|
||||
if (face == Facing::DOWN) return TileRef_SPU(dirt_Id)->getTexture(face);
|
||||
return icon();
|
||||
}
|
||||
virtual Icon_SPU *getTexture(ChunkRebuildData *level, int x, int y, int z, int face)
|
||||
{
|
||||
if (face == Facing::UP) return &ms_pTileData->mycelTile_iconTop;
|
||||
if (face == Facing::DOWN) return TileRef_SPU(dirt_Id)->getTexture(face);
|
||||
Material_SPU *above = level->getMaterial(x, y + 1, z);
|
||||
if (above->getID() == Material_SPU::topSnow_Id || above->getID() == Material_SPU::snow_Id)
|
||||
return &ms_pTileData->mycelTile_iconSnowSide;
|
||||
else return icon();
|
||||
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,29 @@
|
||||
#pragma once
|
||||
#include "Bush_SPU.h"
|
||||
|
||||
class NetherStalkTile_SPU : public Bush_SPU
|
||||
{
|
||||
private:
|
||||
static const int MAX_AGE = 3;
|
||||
static const int NETHER_STALK_TEXTURE_COUNT = 3;
|
||||
|
||||
|
||||
public:
|
||||
NetherStalkTile_SPU(int id) : Bush_SPU(id) {}
|
||||
|
||||
virtual Icon_SPU *getTexture(int face, int data)
|
||||
{
|
||||
Icon_SPU* icons = ms_pTileData->netherStalk_icons;
|
||||
if (data >= MAX_AGE)
|
||||
{
|
||||
return &icons[2];
|
||||
}
|
||||
if (data > 0)
|
||||
{
|
||||
return &icons[1];
|
||||
}
|
||||
return &icons[0];
|
||||
|
||||
}
|
||||
virtual int getRenderShape() { return Tile_SPU::SHAPE_ROWS; }
|
||||
};
|
||||
@@ -0,0 +1,18 @@
|
||||
#pragma once
|
||||
#include "Tile_SPU.h"
|
||||
|
||||
// TileRenderer not implemented, so minimum of stuff here
|
||||
class PistonBaseTile_SPU : public Tile_SPU
|
||||
{
|
||||
|
||||
public:
|
||||
PistonBaseTile_SPU(int id) : Tile_SPU(id) {}
|
||||
// virtual void updateShape(float x0, float y0, float z0, float x1, float y1, float z1);
|
||||
virtual Icon_SPU *getTexture(int face, int data) { return NULL; }
|
||||
virtual int getRenderShape() { return SHAPE_PISTON_BASE; }
|
||||
virtual bool isSolidRender(bool isServerLevel = false) { return false; }
|
||||
|
||||
// virtual void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, shared_ptr<TileEntity> forceEntity = shared_ptr<TileEntity>()); // 4J added forceData, forceEntity param
|
||||
// virtual void updateDefaultShape();
|
||||
|
||||
};
|
||||
@@ -0,0 +1,13 @@
|
||||
#pragma once
|
||||
#include "Tile_SPU.h"
|
||||
|
||||
class PistonExtensionTile_SPU : public Tile_SPU
|
||||
{
|
||||
|
||||
public:
|
||||
PistonExtensionTile_SPU(int id) : Tile_SPU(id) {}
|
||||
virtual Icon_SPU *getTexture(int face, int data) { return NULL; }
|
||||
virtual int getRenderShape() { return SHAPE_PISTON_EXTENSION; }
|
||||
virtual bool isSolidRender(bool isServerLevel = false) { return false; }
|
||||
// virtual void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, shared_ptr<TileEntity> forceEntity = shared_ptr<TileEntity>()); // 4J added forceData, forceEntity param
|
||||
};
|
||||
@@ -0,0 +1,17 @@
|
||||
|
||||
#pragma once
|
||||
#include "EntityTile_SPU.h"
|
||||
|
||||
|
||||
class PistonMovingPiece_SPU : public EntityTile_SPU
|
||||
{
|
||||
public:
|
||||
PistonMovingPiece_SPU(int id) : EntityTile_SPU(id) {}
|
||||
|
||||
virtual int getRenderShape() { return SHAPE_INVISIBLE; }
|
||||
virtual bool isSolidRender(bool isServerLevel = false) { return false; }
|
||||
virtual void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = NULL) // 4J added forceData, forceEntity param
|
||||
{
|
||||
// should never get here.
|
||||
}
|
||||
};
|
||||
48
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/PortalTile_SPU.h
Normal file
48
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/PortalTile_SPU.h
Normal file
@@ -0,0 +1,48 @@
|
||||
#pragma once
|
||||
#include "HalfTransparentTile_SPU.h"
|
||||
|
||||
class PortalTile_SPU : public HalfTransparentTile_SPU
|
||||
{
|
||||
public:
|
||||
PortalTile_SPU(int id): HalfTransparentTile_SPU(id) {}
|
||||
virtual void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = NULL) // 4J added forceData, forceEntity param
|
||||
{
|
||||
if (level->getTile(x - 1, y, z) == id || level->getTile(x + 1, y, z) == id)
|
||||
{
|
||||
float xr = 8 / 16.0f;
|
||||
float yr = 2 / 16.0f;
|
||||
this->setShape(0.5f - xr, 0, 0.5f - yr, 0.5f + xr, 1, 0.5f + yr);
|
||||
}
|
||||
else
|
||||
{
|
||||
float xr = 2 / 16.0f;
|
||||
float yr = 8 / 16.0f;
|
||||
this->setShape(0.5f - xr, 0, 0.5f - yr, 0.5f + xr, 1, 0.5f + yr);
|
||||
}
|
||||
|
||||
}
|
||||
virtual bool isSolidRender(bool isServerLevel = false) { return false; }
|
||||
virtual bool isCubeShaped() { return false; }
|
||||
virtual bool shouldRenderFace(ChunkRebuildData *level, int x, int y, int z, int face)
|
||||
{
|
||||
if (level->getTile(x, y, z) == id) return false;
|
||||
|
||||
bool w = level->getTile(x - 1, y, z) == id && level->getTile(x - 2, y, z) != id;
|
||||
bool e = level->getTile(x + 1, y, z) == id && level->getTile(x + 2, y, z) != id;
|
||||
|
||||
bool n = level->getTile(x, y, z - 1) == id && level->getTile(x, y, z - 2) != id;
|
||||
bool s = level->getTile(x, y, z + 1) == id && level->getTile(x, y, z + 2) != id;
|
||||
|
||||
bool we = w || e;
|
||||
bool ns = n || s;
|
||||
|
||||
if (we && face == 4) return true;
|
||||
if (we && face == 5) return true;
|
||||
if (ns && face == 2) return true;
|
||||
if (ns && face == 3) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual int getRenderLayer() { return 1; }
|
||||
};
|
||||
28
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/PotatoTile_SPU.h
Normal file
28
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/PotatoTile_SPU.h
Normal file
@@ -0,0 +1,28 @@
|
||||
#pragma once
|
||||
|
||||
#include "CropTile_SPU.h"
|
||||
|
||||
class PotatoTile_SPU : public CropTile_SPU
|
||||
{
|
||||
private:
|
||||
// Icon *icons[4];
|
||||
|
||||
public:
|
||||
PotatoTile_SPU(int id) : CropTile_SPU(id) {}
|
||||
|
||||
Icon_SPU *getTexture(int face, int data)
|
||||
{
|
||||
if (data < 7)
|
||||
{
|
||||
if (data == 6)
|
||||
{
|
||||
data = 5;
|
||||
}
|
||||
return &ms_pTileData->potato_icons[data >> 1];
|
||||
}
|
||||
else
|
||||
{
|
||||
return &ms_pTileData->potato_icons[3];
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,41 @@
|
||||
#include "stdafx.h"
|
||||
#include "PressurePlateTile_SPU.h"
|
||||
#include "ChunkRebuildData.h"
|
||||
|
||||
|
||||
bool PressurePlateTile_SPU::isSolidRender(bool isServerLevel)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool PressurePlateTile_SPU::blocksLight()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void PressurePlateTile_SPU::updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData, TileEntity* forceEntity) // 4J added forceData, forceEntity param
|
||||
{
|
||||
bool pressed = level->getData(x, y, z) == 1;
|
||||
|
||||
float o = 1 / 16.0f;
|
||||
if (pressed)
|
||||
{
|
||||
this->setShape(o, 0, o, 1 - o, 0.5f / 16.0f, 1 - o);
|
||||
}
|
||||
else
|
||||
{
|
||||
setShape(o, 0, o, 1 - o, 1 / 16.0f, 1 - o);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void PressurePlateTile_SPU::updateDefaultShape()
|
||||
{
|
||||
float x = 8 / 16.0f;
|
||||
float y = 2 / 16.0f;
|
||||
float z = 8 / 16.0f;
|
||||
setShape(0.5f - x, 0.5f - y, 0.5f - z, 0.5f + x, 0.5f + y, 0.5f + z);
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
#pragma once
|
||||
#include "Tile_SPU.h"
|
||||
|
||||
|
||||
class PressurePlateTile_SPU : public Tile_SPU
|
||||
{
|
||||
public:
|
||||
enum Sensitivity
|
||||
{
|
||||
everything,
|
||||
mobs,
|
||||
players
|
||||
};
|
||||
|
||||
PressurePlateTile_SPU(int id) : Tile_SPU(id) {}
|
||||
virtual bool isSolidRender(bool isServerLevel = false);
|
||||
virtual bool blocksLight();
|
||||
|
||||
virtual void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = NULL); // 4J added forceData, forceEntity param
|
||||
virtual void updateDefaultShape();
|
||||
};
|
||||
30
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/PumpkinTile_SPU.h
Normal file
30
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/PumpkinTile_SPU.h
Normal file
@@ -0,0 +1,30 @@
|
||||
#pragma once
|
||||
#include "Tile_SPU.h"
|
||||
|
||||
class PumpkinTile_SPU : public Tile_SPU
|
||||
{
|
||||
public:
|
||||
static const int DIR_SOUTH = 0;
|
||||
static const int DIR_WEST = 1;
|
||||
static const int DIR_NORTH = 2;
|
||||
static const int DIR_EAST = 3;
|
||||
|
||||
public:
|
||||
PumpkinTile_SPU(int id) : Tile_SPU(id) {}
|
||||
virtual Icon_SPU *getTexture(int face, int data)
|
||||
{
|
||||
if (face == Facing::UP) return &ms_pTileData->pumpkinTile_iconTop;
|
||||
if (face == Facing::DOWN) return &ms_pTileData->pumpkinTile_iconTop;
|
||||
|
||||
Icon_SPU* iconFace = &ms_pTileData->pumpkinTile_iconFace;
|
||||
if(id == litPumpkin_Id)
|
||||
iconFace = &ms_pTileData->pumpkinTile_iconFaceLit;
|
||||
|
||||
if (data == DIR_NORTH && face == Facing::NORTH) return iconFace;
|
||||
if (data == DIR_EAST && face == Facing::EAST) return iconFace;
|
||||
if (data == DIR_SOUTH && face == Facing::SOUTH) return iconFace;
|
||||
if (data == DIR_WEST && face == Facing::WEST) return iconFace;
|
||||
|
||||
else return icon();
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,65 @@
|
||||
#pragma once
|
||||
|
||||
#include "Tile_SPU.h"
|
||||
|
||||
class QuartzBlockTile_SPU : public Tile_SPU
|
||||
{
|
||||
public:
|
||||
static const int TYPE_DEFAULT = 0;
|
||||
static const int TYPE_CHISELED = 1;
|
||||
static const int TYPE_LINES_Y = 2;
|
||||
static const int TYPE_LINES_X = 3;
|
||||
static const int TYPE_LINES_Z = 4;
|
||||
|
||||
static const int QUARTZ_BLOCK_NAMES = 3;
|
||||
|
||||
private:
|
||||
static const int QUARTZ_BLOCK_TEXTURES = 5;
|
||||
|
||||
// Icon *icons[QUARTZ_BLOCK_TEXTURES];
|
||||
// Icon *iconChiseledTop;
|
||||
// Icon *iconLinesTop;
|
||||
// Icon *iconTop;
|
||||
// Icon *iconBottom;
|
||||
|
||||
public:
|
||||
QuartzBlockTile_SPU(int id) : Tile_SPU(id) {}
|
||||
|
||||
Icon_SPU *getTexture(int face, int data)
|
||||
{
|
||||
if (data == TYPE_LINES_Y || data == TYPE_LINES_X || data == TYPE_LINES_Z)
|
||||
{
|
||||
if (data == TYPE_LINES_Y && (face == Facing::UP || face == Facing::DOWN))
|
||||
{
|
||||
return &ms_pTileData->quartzBlock_iconLinesTop;
|
||||
}
|
||||
else if (data == TYPE_LINES_X && (face == Facing::EAST || face == Facing::WEST))
|
||||
{
|
||||
return &ms_pTileData->quartzBlock_iconLinesTop;
|
||||
}
|
||||
else if (data == TYPE_LINES_Z && (face == Facing::NORTH || face == Facing::SOUTH))
|
||||
{
|
||||
return &ms_pTileData->quartzBlock_iconLinesTop;
|
||||
}
|
||||
|
||||
return &ms_pTileData->quartzBlock_icons[data];
|
||||
}
|
||||
|
||||
if (face == Facing::UP || (face == Facing::DOWN && data == TYPE_CHISELED))
|
||||
{
|
||||
if (data == TYPE_CHISELED)
|
||||
{
|
||||
return &ms_pTileData->quartzBlock_iconChiseledTop;
|
||||
}
|
||||
return &ms_pTileData->quartzBlock_iconTop;
|
||||
}
|
||||
if (face == Facing::DOWN)
|
||||
{
|
||||
return &ms_pTileData->quartzBlock_iconBottom;
|
||||
}
|
||||
if (data < 0 || data >= QUARTZ_BLOCK_TEXTURES) data = 0;
|
||||
return &ms_pTileData->quartzBlock_icons[data];
|
||||
}
|
||||
|
||||
int getRenderShape() { return Tile_SPU::SHAPE_QUARTZ; }
|
||||
};
|
||||
58
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/RailTile_SPU.h
Normal file
58
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/RailTile_SPU.h
Normal file
@@ -0,0 +1,58 @@
|
||||
#pragma once
|
||||
#include "Tile_SPU.h"
|
||||
|
||||
class RailTile_SPU : public Tile_SPU
|
||||
{
|
||||
|
||||
public:
|
||||
static const int RAIL_DATA_BIT = 8;
|
||||
static const int RAIL_DIRECTION_MASK = 7;
|
||||
|
||||
RailTile_SPU(int id) : Tile_SPU(id) {}
|
||||
virtual bool isSolidRender(bool isServerLevel = false) { return false; }
|
||||
virtual void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = NULL) // 4J added forceData, forceEntity param
|
||||
{
|
||||
int data = level->getData(x, y, z);
|
||||
if (data >= 2 && data <= 5)
|
||||
{
|
||||
setShape(0, 0, 0, 1, 2 / 16.0f + 0.5f, 1);
|
||||
} else
|
||||
{
|
||||
setShape(0, 0, 0, 1, 2 / 16.0f, 1);
|
||||
}
|
||||
}
|
||||
virtual Icon_SPU *getTexture(int face, int data)
|
||||
{
|
||||
bool usesDataBit = false;
|
||||
Icon_SPU* iconTurn = &ms_pTileData->railTile_iconTurn;
|
||||
if(id == goldenRail_Id)
|
||||
{
|
||||
usesDataBit = true;
|
||||
iconTurn = &ms_pTileData->railTile_iconTurnGolden;
|
||||
}
|
||||
|
||||
if (usesDataBit)
|
||||
{
|
||||
// if (id == Tile::goldenRail_Id)
|
||||
// {
|
||||
if ((data & RAIL_DATA_BIT) == 0)
|
||||
{
|
||||
return icon();
|
||||
}
|
||||
else
|
||||
{
|
||||
return iconTurn; // Actually the powered rail on version
|
||||
}
|
||||
// }
|
||||
} else if (data >= 6) return iconTurn;
|
||||
return icon();
|
||||
|
||||
}
|
||||
virtual int getRenderShape() { return Tile_SPU::SHAPE_RAIL; }
|
||||
bool isUsesDataBit()
|
||||
{
|
||||
if(id == goldenRail_Id || id == detectorRail_Id)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,18 @@
|
||||
#pragma once
|
||||
|
||||
#include "EntityTile_SPU.h"
|
||||
|
||||
|
||||
class RecordPlayerTile_SPU : public EntityTile_SPU
|
||||
{
|
||||
public:
|
||||
RecordPlayerTile_SPU(int id) : EntityTile_SPU(id) {}
|
||||
virtual Icon_SPU *getTexture(int face, int data)
|
||||
{
|
||||
if (face == Facing::UP)
|
||||
{
|
||||
return &ms_pTileData->recordPlayer_iconTop;
|
||||
}
|
||||
return icon();
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,48 @@
|
||||
#pragma once
|
||||
#include "Tile_SPU.h"
|
||||
#include "DiodeTile_SPU.h"
|
||||
|
||||
class RedStoneDustTile_SPU : public Tile_SPU
|
||||
{
|
||||
public:
|
||||
static const int TEXTURE_CROSS = 0;
|
||||
static const int TEXTURE_LINE = 1;
|
||||
static const int TEXTURE_CROSS_OVERLAY = 2;
|
||||
static const int TEXTURE_LINE_OVERLAY = 3;
|
||||
|
||||
RedStoneDustTile_SPU(int id) : Tile_SPU(id) {}
|
||||
virtual bool isSolidRender(bool isServerLevel = false) { return false; }
|
||||
virtual bool isCubeShaped() { return false; }
|
||||
virtual int getRenderShape() { return Tile_SPU::SHAPE_RED_DUST; }
|
||||
virtual int getColor() const { return 0x800000; }// 4J Added
|
||||
virtual int getColor(LevelSource *level, int x, int y, int z) { return 0x800000; }
|
||||
virtual int getColor(LevelSource *level, int x, int y, int z, int data) { return 0x800000; } // 4J added
|
||||
static Icon_SPU *getTextureByName(int name)
|
||||
{
|
||||
switch(name)
|
||||
{
|
||||
case TEXTURE_CROSS: return &ms_pTileData->redStoneDust_iconCross;
|
||||
case TEXTURE_LINE: return &ms_pTileData->redStoneDust_iconLine;
|
||||
case TEXTURE_CROSS_OVERLAY: return &ms_pTileData->redStoneDust_iconCrossOver;
|
||||
case TEXTURE_LINE_OVERLAY: return &ms_pTileData->redStoneDust_iconLineOver;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static bool shouldConnectTo(ChunkRebuildData *level, int x, int y, int z, int direction)
|
||||
{
|
||||
int t = level->getTile(x, y, z);
|
||||
if (t == Tile_SPU::redStoneDust_Id) return true;
|
||||
if (t == 0) return false;
|
||||
if (t == Tile_SPU::diode_off_Id || t == Tile_SPU::diode_on_Id)
|
||||
{
|
||||
int data = level->getData(x, y, z);
|
||||
return direction == (data & DiodeTile_SPU::DIRECTION_MASK) || direction == Direction::DIRECTION_OPPOSITE[data & DiodeTile_SPU::DIRECTION_MASK];
|
||||
}
|
||||
else if (TileRef_SPU(t)->isSignalSource() && direction != Direction::UNDEFINED) return true;
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
@@ -0,0 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#include "Tile_SPU.h"
|
||||
|
||||
class RedlightTile_SPU : public Tile_SPU
|
||||
{
|
||||
public:
|
||||
RedlightTile_SPU(int id) : Tile_SPU(id) {}
|
||||
};
|
||||
15
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/ReedTile_SPU.h
Normal file
15
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/ReedTile_SPU.h
Normal file
@@ -0,0 +1,15 @@
|
||||
#pragma once
|
||||
|
||||
#include "Tile_SPU.h"
|
||||
|
||||
|
||||
class ReedTile_SPU : public Tile_SPU
|
||||
{
|
||||
public:
|
||||
ReedTile_SPU(int id) : Tile_SPU(id) {}
|
||||
|
||||
bool blocksLight() { return false; }
|
||||
bool isSolidRender(bool isServerLevel = false) { return false; }
|
||||
bool isCubeShaped() { return false; }
|
||||
int getRenderShape() { return Tile_SPU::SHAPE_CROSS_TEXTURE; }
|
||||
};
|
||||
@@ -0,0 +1,32 @@
|
||||
#pragma once
|
||||
|
||||
#include "Tile_SPU.h"
|
||||
#include "Facing_SPU.h"
|
||||
|
||||
class SandStoneTile_SPU : public Tile_SPU
|
||||
{
|
||||
public:
|
||||
static const int TYPE_DEFAULT = 0;
|
||||
static const int TYPE_HEIROGLYPHS = 1;
|
||||
static const int TYPE_SMOOTHSIDE = 2;
|
||||
|
||||
// Add this in when we need it
|
||||
//static final String[] SANDSTONE_NAMES = {"default", "chiseled", "smooth"};
|
||||
|
||||
private:
|
||||
static const int SANDSTONE_TILE_TEXTURE_COUNT = 3;
|
||||
public:
|
||||
SandStoneTile_SPU(int id) : Tile_SPU(id) {}
|
||||
|
||||
public:
|
||||
Icon_SPU *getTexture(int face, int data)
|
||||
{
|
||||
if (face == Facing::UP || (face == Facing::DOWN && (data == TYPE_HEIROGLYPHS || data == TYPE_SMOOTHSIDE)))
|
||||
return &ms_pTileData->sandStone_iconTop;
|
||||
if (face == Facing::DOWN)
|
||||
return &ms_pTileData->sandStone_iconBottom;
|
||||
if (data < 0 || data >= SANDSTONE_TILE_TEXTURE_COUNT)
|
||||
data = 0;
|
||||
return &ms_pTileData->sandStone_icons[data];
|
||||
}
|
||||
};
|
||||
14
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/Sapling_SPU.h
Normal file
14
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/Sapling_SPU.h
Normal file
@@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
|
||||
#include "Bush_SPU.h"
|
||||
|
||||
class Random;
|
||||
|
||||
class Sapling_SPU : public Bush_SPU
|
||||
{
|
||||
static const int TYPE_MASK = 3;
|
||||
|
||||
public:
|
||||
Sapling_SPU(int id) : Bush_SPU(id) {}
|
||||
Icon_SPU *getTexture(int face, int data) { data = data & TYPE_MASK; return &ms_pTileData->sapling_icons[data]; }
|
||||
};
|
||||
38
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/SignTile_SPU.h
Normal file
38
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/SignTile_SPU.h
Normal file
@@ -0,0 +1,38 @@
|
||||
#pragma once
|
||||
|
||||
#include "EntityTile_SPU.h"
|
||||
|
||||
|
||||
class SignTile_SPU : public EntityTile_SPU
|
||||
{
|
||||
public:
|
||||
SignTile_SPU(int id) : EntityTile_SPU(id) {}
|
||||
bool onGround()
|
||||
{
|
||||
if(id == wallSign_Id)
|
||||
return false;
|
||||
// sign_Id
|
||||
return true;
|
||||
}
|
||||
|
||||
Icon_SPU *getTexture(int face, int data){ return TileRef_SPU(wood_Id)->getTexture(face); }
|
||||
void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = NULL) // 4J added forceData, forceEntity param
|
||||
{
|
||||
if (onGround()) return;
|
||||
int face = level->getData(x, y, z);
|
||||
float h0 = (4 + 0.5f) / 16.0f;
|
||||
float h1 = (12 + 0.5f) / 16.0f;
|
||||
float w0 = 0 / 16.0f;
|
||||
float w1 = 16 / 16.0f;
|
||||
float d0 = 2 / 16.0f;
|
||||
setShape(0, 0, 0, 1, 1, 1);
|
||||
if (face == 2) setShape(w0, h0, 1 - d0, w1, h1, 1);
|
||||
if (face == 3) setShape(w0, h0, 0, w1, h1, d0);
|
||||
if (face == 4) setShape(1 - d0, h0, w0, 1, h1, w1);
|
||||
if (face == 5) setShape(0, h0, w0, d0, h1, w1);
|
||||
}
|
||||
|
||||
int getRenderShape() { return Tile_SPU::SHAPE_INVISIBLE; }
|
||||
bool isCubeShaped() { return false; }
|
||||
bool isSolidRender(bool isServerLevel = false) { return false; }
|
||||
};
|
||||
47
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/SkullTile_SPU.h
Normal file
47
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/SkullTile_SPU.h
Normal file
@@ -0,0 +1,47 @@
|
||||
#pragma once
|
||||
|
||||
#include "Tile_SPU.h"
|
||||
#include "EntityTile_SPU.h"
|
||||
|
||||
|
||||
class SkullTile_SPU : public EntityTile_SPU
|
||||
{
|
||||
public:
|
||||
static const int MAX_SKULL_TILES = 40;
|
||||
public:
|
||||
static const int PLACEMENT_MASK = 0x7;
|
||||
static const int NO_DROP_BIT = 0x8;
|
||||
|
||||
SkullTile_SPU(int id) : EntityTile_SPU(id) {}
|
||||
|
||||
public:
|
||||
int getRenderShape() { return SHAPE_INVISIBLE; }
|
||||
bool isSolidRender(bool isServerLevel = false) { return false; }
|
||||
bool isCubeShaped() { return false; }
|
||||
void updateShape(ChunkRebuildData *level, int x, int y, int z)
|
||||
{
|
||||
int data = level->getData(x, y, z) & PLACEMENT_MASK;
|
||||
|
||||
switch (data)
|
||||
{
|
||||
default:
|
||||
case Facing::UP:
|
||||
setShape(4.0f / 16.0f, 0, 4.0f / 16.0f, 12.0f / 16.0f, .5f, 12.0f / 16.0f);
|
||||
break;
|
||||
case Facing::NORTH:
|
||||
setShape(4.0f / 16.0f, 4.0f / 16.0f, .5f, 12.0f / 16.0f, 12.0f / 16.0f, 1);
|
||||
break;
|
||||
case Facing::SOUTH:
|
||||
setShape(4.0f / 16.0f, 4.0f / 16.0f, 0, 12.0f / 16.0f, 12.0f / 16.0f, .5f);
|
||||
break;
|
||||
case Facing::WEST:
|
||||
setShape(.5f, 4.0f / 16.0f, 4.0f / 16.0f, 1, 12.0f / 16.0f, 12.0f / 16.0f);
|
||||
break;
|
||||
case Facing::EAST:
|
||||
setShape(0, 4.0f / 16.0f, 4.0f / 16.0f, .5f, 12.0f / 16.0f, 12.0f / 16.0f);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Icon_SPU *getTexture(int face, int data) { return TileRef_SPU(hellSand_Id)->getTexture(face); }
|
||||
};
|
||||
@@ -0,0 +1,25 @@
|
||||
#pragma once
|
||||
#include "Tile_SPU.h"
|
||||
|
||||
class SmoothStoneBrickTile_SPU : public Tile_SPU
|
||||
{
|
||||
public:
|
||||
static const int TYPE_DEFAULT = 0;
|
||||
static const int TYPE_MOSSY = 1;
|
||||
static const int TYPE_CRACKED = 2;
|
||||
static const int TYPE_DETAIL = 3;
|
||||
|
||||
static const int SMOOTH_STONE_BRICK_NAMES_LENGTH = 4;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
SmoothStoneBrickTile_SPU(int id) : Tile_SPU(id) {}
|
||||
|
||||
virtual Icon_SPU *getTexture(int face, int data)
|
||||
{
|
||||
if (data < 0 || data >= SMOOTH_STONE_BRICK_NAMES_LENGTH) data = 0;
|
||||
return &ms_pTileData->smoothStoneBrick_icons[data];
|
||||
}
|
||||
|
||||
};
|
||||
292
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/StairTile_SPU.cpp
Normal file
292
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/StairTile_SPU.cpp
Normal file
@@ -0,0 +1,292 @@
|
||||
#include "stdafx.h"
|
||||
#include "StairTile_SPU.h"
|
||||
#include "ChunkRebuildData.h"
|
||||
|
||||
|
||||
void StairTile_SPU::updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData, TileEntity* forceEntity) // 4J added forceData, forceEntity param
|
||||
{
|
||||
setShape(0, 0, 0, 1, 1, 1);
|
||||
}
|
||||
|
||||
bool StairTile_SPU::isSolidRender(bool isServerLevel)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
int StairTile_SPU::getRenderShape()
|
||||
{
|
||||
return Tile_SPU::SHAPE_STAIRS;
|
||||
}
|
||||
|
||||
void StairTile_SPU::setBaseShape(ChunkRebuildData *level, int x, int y, int z)
|
||||
{
|
||||
int data = level->getData(x, y, z);
|
||||
|
||||
if ((data & UPSIDEDOWN_BIT) != 0)
|
||||
{
|
||||
setShape(0, .5f, 0, 1, 1, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
setShape(0, 0, 0, 1, .5f, 1);
|
||||
}
|
||||
}
|
||||
|
||||
bool StairTile_SPU::isStairs(int id)
|
||||
{
|
||||
switch(id)
|
||||
{
|
||||
case Tile_SPU::stairs_wood_Id:
|
||||
case Tile_SPU::stairs_stone_Id:
|
||||
case Tile_SPU::stairs_bricks_Id:
|
||||
case Tile_SPU::stairs_stoneBrickSmooth_Id:
|
||||
case Tile_SPU::stairs_netherBricks_Id:
|
||||
case Tile_SPU::stairs_sandstone_Id:
|
||||
case Tile_SPU::stairs_sprucewood_Id:
|
||||
case Tile_SPU::stairs_birchwood_Id:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool StairTile_SPU::isLockAttached(ChunkRebuildData *level, int x, int y, int z, int data)
|
||||
{
|
||||
int lockTile = level->getTile(x, y, z);
|
||||
if (isStairs(lockTile) && level->getData(x, y, z) == data)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool StairTile_SPU::setStepShape(ChunkRebuildData *level, int x, int y, int z)
|
||||
{
|
||||
int data = level->getData(x, y, z);
|
||||
int dir = data & 0x3;
|
||||
|
||||
float bottom = 0.5f;
|
||||
float top = 1.0f;
|
||||
|
||||
if ((data & UPSIDEDOWN_BIT) != 0)
|
||||
{
|
||||
bottom = 0;
|
||||
top = .5f;
|
||||
}
|
||||
|
||||
float west = 0;
|
||||
float east = 1;
|
||||
float north = 0;
|
||||
float south = .5f;
|
||||
|
||||
bool checkInnerPiece = true;
|
||||
|
||||
if (dir == DIR_EAST)
|
||||
{
|
||||
west = .5f;
|
||||
south = 1;
|
||||
|
||||
int backTile = level->getTile(x + 1, y, z);
|
||||
int backData = level->getData(x + 1, y, z);
|
||||
if (isStairs(backTile) && ((data & UPSIDEDOWN_BIT) == (backData & UPSIDEDOWN_BIT)))
|
||||
{
|
||||
int backDir = backData & 0x3;
|
||||
if (backDir == DIR_NORTH && !isLockAttached(level, x, y, z + 1, data))
|
||||
{
|
||||
south = .5f;
|
||||
checkInnerPiece = false;
|
||||
}
|
||||
else if (backDir == DIR_SOUTH && !isLockAttached(level, x, y, z - 1, data))
|
||||
{
|
||||
north = .5f;
|
||||
checkInnerPiece = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (dir == DIR_WEST)
|
||||
{
|
||||
east = .5f;
|
||||
south = 1;
|
||||
|
||||
int backTile = level->getTile(x - 1, y, z);
|
||||
int backData = level->getData(x - 1, y, z);
|
||||
if (isStairs(backTile) && ((data & UPSIDEDOWN_BIT) == (backData & UPSIDEDOWN_BIT)))
|
||||
{
|
||||
int backDir = backData & 0x3;
|
||||
if (backDir == DIR_NORTH && !isLockAttached(level, x, y, z + 1, data))
|
||||
{
|
||||
south = .5f;
|
||||
checkInnerPiece = false;
|
||||
}
|
||||
else if (backDir == DIR_SOUTH && !isLockAttached(level, x, y, z - 1, data))
|
||||
{
|
||||
north = .5f;
|
||||
checkInnerPiece = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (dir == DIR_SOUTH)
|
||||
{
|
||||
north = .5f;
|
||||
south = 1;
|
||||
|
||||
int backTile = level->getTile(x, y, z + 1);
|
||||
int backData = level->getData(x, y, z + 1);
|
||||
if (isStairs(backTile) && ((data & UPSIDEDOWN_BIT) == (backData & UPSIDEDOWN_BIT)))
|
||||
{
|
||||
int backDir = backData & 0x3;
|
||||
if (backDir == DIR_WEST && !isLockAttached(level, x + 1, y, z, data))
|
||||
{
|
||||
east = .5f;
|
||||
checkInnerPiece = false;
|
||||
}
|
||||
else if (backDir == DIR_EAST && !isLockAttached(level, x - 1, y, z, data))
|
||||
{
|
||||
west = .5f;
|
||||
checkInnerPiece = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (dir == DIR_NORTH)
|
||||
{
|
||||
int backTile = level->getTile(x, y, z - 1);
|
||||
int backData = level->getData(x, y, z - 1);
|
||||
if (isStairs(backTile) && ((data & UPSIDEDOWN_BIT) == (backData & UPSIDEDOWN_BIT)))
|
||||
{
|
||||
int backDir = backData & 0x3;
|
||||
if (backDir == DIR_WEST && !isLockAttached(level, x + 1, y, z, data))
|
||||
{
|
||||
east = .5f;
|
||||
checkInnerPiece = false;
|
||||
}
|
||||
else if (backDir == DIR_EAST && !isLockAttached(level, x - 1, y, z, data))
|
||||
{
|
||||
west = .5f;
|
||||
checkInnerPiece = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
setShape(west, bottom, north, east, top, south);
|
||||
return checkInnerPiece;
|
||||
}
|
||||
|
||||
/*
|
||||
* This method adds an extra 1/8 block if the stairs can attach as an
|
||||
* "inner corner."
|
||||
*/
|
||||
bool StairTile_SPU::setInnerPieceShape(ChunkRebuildData *level, int x, int y, int z)
|
||||
{
|
||||
int data = level->getData(x, y, z);
|
||||
int dir = data & 0x3;
|
||||
|
||||
float bottom = 0.5f;
|
||||
float top = 1.0f;
|
||||
|
||||
if ((data & UPSIDEDOWN_BIT) != 0)
|
||||
{
|
||||
bottom = 0;
|
||||
top = .5f;
|
||||
}
|
||||
|
||||
float west = 0;
|
||||
float east = .5f;
|
||||
float north = .5f;
|
||||
float south = 1.0f;
|
||||
|
||||
bool hasInnerPiece = false;
|
||||
|
||||
if (dir == DIR_EAST)
|
||||
{
|
||||
int frontTile = level->getTile(x - 1, y, z);
|
||||
int frontData = level->getData(x - 1, y, z);
|
||||
if (isStairs(frontTile) && ((data & UPSIDEDOWN_BIT) == (frontData & UPSIDEDOWN_BIT)))
|
||||
{
|
||||
int frontDir = frontData & 0x3;
|
||||
if (frontDir == DIR_NORTH && !isLockAttached(level, x, y, z - 1, data))
|
||||
{
|
||||
north = 0;
|
||||
south = .5f;
|
||||
hasInnerPiece = true;
|
||||
}
|
||||
else if (frontDir == DIR_SOUTH && !isLockAttached(level, x, y, z + 1, data))
|
||||
{
|
||||
north = .5f;
|
||||
south = 1;
|
||||
hasInnerPiece = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (dir == DIR_WEST)
|
||||
{
|
||||
int frontTile = level->getTile(x + 1, y, z);
|
||||
int frontData = level->getData(x + 1, y, z);
|
||||
if (isStairs(frontTile) && ((data & UPSIDEDOWN_BIT) == (frontData & UPSIDEDOWN_BIT)))
|
||||
{
|
||||
west = .5f;
|
||||
east = 1.0f;
|
||||
int frontDir = frontData & 0x3;
|
||||
if (frontDir == DIR_NORTH && !isLockAttached(level, x, y, z - 1, data))
|
||||
{
|
||||
north = 0;
|
||||
south = .5f;
|
||||
hasInnerPiece = true;
|
||||
}
|
||||
else if (frontDir == DIR_SOUTH && !isLockAttached(level, x, y, z + 1, data))
|
||||
{
|
||||
north = .5f;
|
||||
south = 1;
|
||||
hasInnerPiece = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (dir == DIR_SOUTH)
|
||||
{
|
||||
int frontTile = level->getTile(x, y, z - 1);
|
||||
int frontData = level->getData(x, y, z - 1);
|
||||
if (isStairs(frontTile) && ((data & UPSIDEDOWN_BIT) == (frontData & UPSIDEDOWN_BIT)))
|
||||
{
|
||||
north = 0;
|
||||
south = .5f;
|
||||
|
||||
int frontDir = frontData & 0x3;
|
||||
if (frontDir == DIR_WEST && !isLockAttached(level, x - 1, y, z, data))
|
||||
{
|
||||
hasInnerPiece = true;
|
||||
}
|
||||
else if (frontDir == DIR_EAST && !isLockAttached(level, x + 1, y, z, data))
|
||||
{
|
||||
west = .5f;
|
||||
east = 1.0f;
|
||||
hasInnerPiece = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (dir == DIR_NORTH)
|
||||
{
|
||||
int frontTile = level->getTile(x, y, z + 1);
|
||||
int frontData = level->getData(x, y, z + 1);
|
||||
if (isStairs(frontTile) && ((data & UPSIDEDOWN_BIT) == (frontData & UPSIDEDOWN_BIT)))
|
||||
{
|
||||
int frontDir = frontData & 0x3;
|
||||
if (frontDir == DIR_WEST && !isLockAttached(level, x - 1, y, z, data))
|
||||
{
|
||||
hasInnerPiece = true;
|
||||
}
|
||||
else if (frontDir == DIR_EAST && !isLockAttached(level, x + 1, y, z, data))
|
||||
{
|
||||
west = .5f;
|
||||
east = 1.0f;
|
||||
hasInnerPiece = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (hasInnerPiece)
|
||||
{
|
||||
setShape(west, bottom, north, east, top, south);
|
||||
}
|
||||
return hasInnerPiece;
|
||||
}
|
||||
30
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/StairTile_SPU.h
Normal file
30
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/StairTile_SPU.h
Normal file
@@ -0,0 +1,30 @@
|
||||
#pragma once
|
||||
|
||||
#include "Tile_SPU.h"
|
||||
|
||||
class StairTile_SPU : public Tile_SPU
|
||||
{
|
||||
public:
|
||||
static const int UPSIDEDOWN_BIT = 4;
|
||||
|
||||
// the direction is the way going up (for normal non-upsidedown stairs)
|
||||
static const int DIR_EAST = 0;
|
||||
static const int DIR_WEST = 1;
|
||||
static const int DIR_SOUTH = 2;
|
||||
static const int DIR_NORTH = 3;
|
||||
|
||||
public:
|
||||
StairTile_SPU(int id) : Tile_SPU(id) {}
|
||||
void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = NULL); // 4J added forceData, forceEntity param
|
||||
bool isSolidRender(bool isServerLevel = false);
|
||||
int getRenderShape();
|
||||
void setBaseShape(ChunkRebuildData *level, int x, int y, int z);
|
||||
static bool isStairs(int id);
|
||||
|
||||
private:
|
||||
bool isLockAttached(ChunkRebuildData *level, int x, int y, int z, int data);
|
||||
|
||||
public:
|
||||
bool setStepShape(ChunkRebuildData *level, int x, int y, int z);
|
||||
bool setInnerPieceShape(ChunkRebuildData *level, int x, int y, int z);
|
||||
};
|
||||
62
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/StemTile_SPU.h
Normal file
62
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/StemTile_SPU.h
Normal file
@@ -0,0 +1,62 @@
|
||||
#pragma once
|
||||
#include "Bush_SPU.h"
|
||||
|
||||
class StemTile_SPU : public Bush_SPU
|
||||
{
|
||||
private:
|
||||
public:
|
||||
StemTile_SPU(int id) : Bush_SPU(id) {}
|
||||
|
||||
public:
|
||||
int getColor(int data) const
|
||||
{
|
||||
//int r = data * 32;
|
||||
//int g = 255 - data * 8;
|
||||
//int b = data * 4;
|
||||
//return r << 16 | g << 8 | b;
|
||||
|
||||
int colour = 0;
|
||||
|
||||
unsigned int minColour = ms_pTileData->stemTile_minColour;
|
||||
unsigned int maxColour = ms_pTileData->stemTile_maxColour;
|
||||
|
||||
byte redComponent = ((minColour>>16)&0xFF) + (( (maxColour>>16)&0xFF - (minColour>>16)&0xFF)*( data/7.0f));
|
||||
byte greenComponent = ((minColour>>8)&0xFF) + (( (maxColour>>8)&0xFF - (minColour>>8)&0xFF)*( data/7.0f));
|
||||
byte blueComponent = ((minColour)&0xFF) + (( (maxColour)&0xFF - (minColour)&0xFF)*( data/7.0f));
|
||||
|
||||
colour = redComponent<<16 | greenComponent<<8 | blueComponent;
|
||||
return colour;
|
||||
}
|
||||
|
||||
virtual int getColor(ChunkRebuildData *level, int x, int y, int z) { return getColor(level->getData(x, y, z)); }
|
||||
virtual void updateDefaultShape()
|
||||
{
|
||||
float ss = 0.125f;
|
||||
this->setShape(0.5f - ss, 0, 0.5f - ss, 0.5f + ss, 0.25f, 0.5f + ss);
|
||||
}
|
||||
|
||||
virtual void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = NULL) // 4J added forceData, forceEntity param
|
||||
{
|
||||
ms_pTileData->yy1[id] = (level->getData(x, y, z) * 2 + 2) / 16.0f;
|
||||
float ss = 0.125f;
|
||||
this->setShape(0.5f - ss, 0, 0.5f - ss, 0.5f + ss, (float) ms_pTileData->yy1[id], 0.5f + ss);
|
||||
}
|
||||
|
||||
int getConnectDir(ChunkRebuildData *level, int x, int y, int z)
|
||||
{
|
||||
int fruitID = pumpkin_Id;
|
||||
if(id == melonStem_Id)
|
||||
fruitID = melon_Id;
|
||||
|
||||
int d = level->getData(x, y, z);
|
||||
if (d < 7) return -1;
|
||||
if (level->getTile(x - 1, y, z) == fruitID) return 0;
|
||||
if (level->getTile(x + 1, y, z) == fruitID) return 1;
|
||||
if (level->getTile(x, y, z - 1) == fruitID) return 2;
|
||||
if (level->getTile(x, y, z + 1) == fruitID) return 3;
|
||||
return -1;
|
||||
}
|
||||
|
||||
virtual int getRenderShape() { return Tile_SPU::SHAPE_STEM; }
|
||||
Icon_SPU *getAngledTexture() { return &ms_pTileData->stemTile_iconAngled; }
|
||||
};
|
||||
@@ -0,0 +1,32 @@
|
||||
#pragma once
|
||||
#include "Tile_SPU.h"
|
||||
|
||||
class Random;
|
||||
|
||||
class StoneMonsterTile_SPU : public Tile_SPU
|
||||
{
|
||||
public:
|
||||
static const int HOST_ROCK = 0;
|
||||
static const int HOST_COBBLE = 1;
|
||||
static const int HOST_STONEBRICK = 2;
|
||||
|
||||
static const int STONE_MONSTER_NAMES_LENGTH = 3;
|
||||
|
||||
// 4J Stu - I don't know why this is protected in Java
|
||||
//protected:
|
||||
public:
|
||||
StoneMonsterTile_SPU(int id) : Tile_SPU(id) {}
|
||||
public:
|
||||
virtual Icon_SPU *getTexture(int face, int data)
|
||||
{
|
||||
if (data == HOST_COBBLE)
|
||||
{
|
||||
return TileRef_SPU(stoneBrick_Id)->getTexture(face);
|
||||
}
|
||||
if (data == HOST_STONEBRICK)
|
||||
{
|
||||
return TileRef_SPU(stoneBrickSmooth_Id)->getTexture(face);
|
||||
}
|
||||
return TileRef_SPU(rock_Id)->getTexture(face);
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,60 @@
|
||||
#pragma once
|
||||
|
||||
#include "HalfSlabTile_SPU.h"
|
||||
#include "Facing_SPU.h"
|
||||
|
||||
class StoneSlabTile_SPU : public HalfSlabTile_SPU
|
||||
{
|
||||
public:
|
||||
static const int STONE_SLAB = 0;
|
||||
static const int SAND_SLAB = 1;
|
||||
static const int WOOD_SLAB = 2;
|
||||
static const int COBBLESTONE_SLAB = 3;
|
||||
static const int BRICK_SLAB = 4;
|
||||
static const int SMOOTHBRICK_SLAB = 5;
|
||||
static const int NETHERBRICK_SLAB = 6;
|
||||
static const int QUARTZ_SLAB = 7;
|
||||
|
||||
static const int SLAB_NAMES_LENGTH = 8;
|
||||
|
||||
|
||||
|
||||
public:
|
||||
StoneSlabTile_SPU(int id) : HalfSlabTile_SPU(id) {}
|
||||
|
||||
virtual Icon_SPU *getTexture(int face, int data)
|
||||
{
|
||||
int type = data & TYPE_MASK;
|
||||
if (fullSize() && (data & TOP_SLOT_BIT) != 0)
|
||||
{
|
||||
face = Facing::UP;
|
||||
}
|
||||
switch(type)
|
||||
{
|
||||
case STONE_SLAB:
|
||||
if (face == Facing::UP || face == Facing::DOWN)
|
||||
return icon();
|
||||
return &ms_pTileData->stoneSlab_iconSide;
|
||||
break;
|
||||
case SAND_SLAB:
|
||||
return TileRef_SPU(sandStone_Id)->getTexture(face); //Tile::sandStone->getTexture(face);
|
||||
case WOOD_SLAB:
|
||||
return TileRef_SPU(wood_Id)->getTexture(face); //Tile::wood->getTexture(face);
|
||||
case COBBLESTONE_SLAB:
|
||||
return TileRef_SPU(stoneBrick_Id)->getTexture(face); //Tile::stoneBrick->getTexture(face);
|
||||
case BRICK_SLAB:
|
||||
return TileRef_SPU(redBrick_Id)->getTexture(face); //Tile::redBrick->getTexture(face);
|
||||
case SMOOTHBRICK_SLAB:
|
||||
return TileRef_SPU(stoneBrickSmooth_Id)->getTexture(face); //Tile::stoneBrickSmooth->getTexture(face, SmoothStoneBrickTile::TYPE_DEFAULT);
|
||||
case NETHERBRICK_SLAB:
|
||||
return TileRef_SPU(netherBrick_Id)->getTexture(Facing::UP); //Tile::netherBrick->getTexture(Facing::UP);
|
||||
case QUARTZ_SLAB:
|
||||
return TileRef_SPU(quartzBlock_Id)->getTexture(face); //Tile::quartzBlock->getTexture(face);
|
||||
|
||||
}
|
||||
|
||||
return icon();
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
35
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/TallGrass_SPU.cpp
Normal file
35
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/TallGrass_SPU.cpp
Normal file
@@ -0,0 +1,35 @@
|
||||
#include "stdafx.h"
|
||||
#include "TallGrass_SPU.h"
|
||||
#include "ChunkRebuildData.h"
|
||||
|
||||
// const unsigned int TallGrass_SPU::TALL_GRASS_TILE_NAMES[TALL_GRASS_TILE_NAMES_LENGTH] = { IDS_TILE_SHRUB,
|
||||
// IDS_TILE_GRASS,
|
||||
// IDS_TILE_FERN,
|
||||
// };
|
||||
|
||||
const int TallGrass_SPU::DEAD_SHRUB = 0;
|
||||
const int TallGrass_SPU::TALL_GRASS = 1;
|
||||
const int TallGrass_SPU::FERN = 2;
|
||||
|
||||
// const wstring TallGrass::TEXTURE_NAMES[] = {L"deadbush", L"tallgrass", L"fern"};
|
||||
|
||||
|
||||
Icon_SPU *TallGrass_SPU::getTexture(int face, int data)
|
||||
{
|
||||
if (data >= TALL_GRASS_TILE_NAMES_LENGTH) data = 0;
|
||||
return &ms_pTileData->tallGrass_Icons[data];
|
||||
}
|
||||
|
||||
int TallGrass_SPU::getColor(ChunkRebuildData *level, int x, int y, int z )
|
||||
{
|
||||
return getColor( level, x, y, z, level->getData(x, y, z) );
|
||||
}
|
||||
|
||||
// 4J - changed interface to have data passed in, and put existing interface as wrapper above
|
||||
int TallGrass_SPU::getColor(ChunkRebuildData *level, int x, int y, int z, int data)
|
||||
{
|
||||
int d = data;
|
||||
if (d == DEAD_SHRUB) return 0xffffff;
|
||||
|
||||
return level->getGrassColor(x, z);
|
||||
}
|
||||
22
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/TallGrass_SPU.h
Normal file
22
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/TallGrass_SPU.h
Normal file
@@ -0,0 +1,22 @@
|
||||
#pragma once
|
||||
|
||||
#include "Bush_SPU.h"
|
||||
|
||||
class TallGrass_SPU : public Bush_SPU
|
||||
{
|
||||
public:
|
||||
static const int DEAD_SHRUB;
|
||||
static const int TALL_GRASS;
|
||||
static const int FERN;
|
||||
|
||||
static const int TALL_GRASS_TILE_NAMES_LENGTH = 3;
|
||||
|
||||
// static const unsigned int TALL_GRASS_TILE_NAMES[TALL_GRASS_TILE_NAMES_LENGTH];
|
||||
|
||||
|
||||
TallGrass_SPU(int id) : Bush_SPU(id) {}
|
||||
|
||||
virtual Icon_SPU *getTexture(int face, int data);
|
||||
virtual int getColor(ChunkRebuildData *level, int x, int y, int z);
|
||||
virtual int getColor(ChunkRebuildData *level, int x, int y, int z, int data); // 4J added
|
||||
};
|
||||
796
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/Tesselator_SPU.cpp
Normal file
796
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/Tesselator_SPU.cpp
Normal file
@@ -0,0 +1,796 @@
|
||||
#include "stdafx.h"
|
||||
|
||||
|
||||
#ifdef SN_TARGET_PS3_SPU
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#include <spu_intrinsics.h>
|
||||
#include <cell/spurs.h>
|
||||
#include <cell/dma.h>
|
||||
#include <math.h>
|
||||
#include "..\Common\spu_assert.h"
|
||||
#endif // SN_TARGET_PS3_SPU
|
||||
|
||||
#include "Tesselator_SPU.h"
|
||||
|
||||
static const bool sc_verbose = false;
|
||||
// #include "..\Minecraft.World\BasicTypeContainers.h"
|
||||
// #include "..\Minecraft.World\FloatBuffer.h"
|
||||
// #include "..\Minecraft.World\IntBuffer.h"
|
||||
// #include "..\Minecraft.World\ByteBuffer.h"
|
||||
|
||||
#ifdef SN_TARGET_PS3_SPU
|
||||
|
||||
const int GL_LINES = 4;//C4JRender::PRIMITIVE_TYPE_LINE_LIST;
|
||||
const int GL_LINE_STRIP = 5;//C4JRender::PRIMITIVE_TYPE_LINE_STRIP;
|
||||
const int GL_QUADS = 3;//C4JRender::PRIMITIVE_TYPE_QUAD_LIST;
|
||||
const int GL_TRIANGLE_FAN = 2;//C4JRender::PRIMITIVE_TYPE_TRIANGLE_FAN;
|
||||
const int GL_TRIANGLE_STRIP = 1;//C4JRender::PRIMITIVE_TYPE_TRIANGLE_STRIP;
|
||||
|
||||
#endif
|
||||
|
||||
bool Tesselator_SPU::TRIANGLE_MODE = false;
|
||||
// bool Tesselator_SPU::USE_VBO = false;
|
||||
|
||||
/* Things to check we are intialising in the constructor...
|
||||
|
||||
|
||||
|
||||
double u, v;
|
||||
int col;
|
||||
int mode;
|
||||
double xo, yo, zo;
|
||||
int normal;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
*/
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// taken from http://my.safaribooksonline.com/book/programming/opengl/9780321563835/gl-half-float-oes/app01lev1sec2
|
||||
|
||||
// -15 stored using a single precision bias of 127
|
||||
const unsigned int HALF_FLOAT_MIN_BIASED_EXP_AS_SINGLE_FP_EXP = 0x38000000;
|
||||
// max exponent value in single precision that will be converted
|
||||
// to Inf or Nan when stored as a half-float
|
||||
const unsigned int HALF_FLOAT_MAX_BIASED_EXP_AS_SINGLE_FP_EXP = 0x47800000;
|
||||
|
||||
// 255 is the max exponent biased value
|
||||
const unsigned int FLOAT_MAX_BIASED_EXP = (0xFF << 23);
|
||||
|
||||
const unsigned int HALF_FLOAT_MAX_BIASED_EXP = (0x1F << 10);
|
||||
|
||||
typedef unsigned short hfloat;
|
||||
|
||||
hfloat convertFloatToHFloat(float f)
|
||||
{
|
||||
unsigned int x = *(unsigned int *)&f;
|
||||
unsigned int sign = (unsigned short)(x >> 31);
|
||||
unsigned int mantissa;
|
||||
unsigned int exp;
|
||||
hfloat hf;
|
||||
|
||||
// get mantissa
|
||||
mantissa = x & ((1 << 23) - 1);
|
||||
// get exponent bits
|
||||
exp = x & FLOAT_MAX_BIASED_EXP;
|
||||
if (exp >= HALF_FLOAT_MAX_BIASED_EXP_AS_SINGLE_FP_EXP)
|
||||
{
|
||||
// check if the original single precision float number is a NaN
|
||||
if (mantissa && (exp == FLOAT_MAX_BIASED_EXP))
|
||||
{
|
||||
// we have a single precision NaN
|
||||
mantissa = (1 << 23) - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
// 16-bit half-float representation stores number as Inf
|
||||
mantissa = 0;
|
||||
}
|
||||
hf = (((hfloat)sign) << 15) | (hfloat)(HALF_FLOAT_MAX_BIASED_EXP) |
|
||||
(hfloat)(mantissa >> 13);
|
||||
}
|
||||
// check if exponent is <= -15
|
||||
else if (exp <= HALF_FLOAT_MIN_BIASED_EXP_AS_SINGLE_FP_EXP)
|
||||
{
|
||||
|
||||
// store a denorm half-float value or zero
|
||||
exp = (HALF_FLOAT_MIN_BIASED_EXP_AS_SINGLE_FP_EXP - exp) >> 23;
|
||||
mantissa >>= (14 + exp);
|
||||
|
||||
hf = (((hfloat)sign) << 15) | (hfloat)(mantissa);
|
||||
}
|
||||
else
|
||||
{
|
||||
hf = (((hfloat)sign) << 15) |
|
||||
(hfloat)((exp - HALF_FLOAT_MIN_BIASED_EXP_AS_SINGLE_FP_EXP) >> 13) |
|
||||
(hfloat)(mantissa >> 13);
|
||||
}
|
||||
|
||||
return hf;
|
||||
}
|
||||
|
||||
float convertHFloatToFloat(hfloat hf)
|
||||
{
|
||||
unsigned int sign = (unsigned int)(hf >> 15);
|
||||
unsigned int mantissa = (unsigned int)(hf & ((1 << 10) - 1));
|
||||
unsigned int exp = (unsigned int)(hf & HALF_FLOAT_MAX_BIASED_EXP);
|
||||
unsigned int f;
|
||||
|
||||
if (exp == HALF_FLOAT_MAX_BIASED_EXP)
|
||||
{
|
||||
// we have a half-float NaN or Inf
|
||||
// half-float NaNs will be converted to a single precision NaN
|
||||
// half-float Infs will be converted to a single precision Inf
|
||||
exp = FLOAT_MAX_BIASED_EXP;
|
||||
if (mantissa)
|
||||
mantissa = (1 << 23) - 1; // set all bits to indicate a NaN
|
||||
}
|
||||
else if (exp == 0x0)
|
||||
{
|
||||
// convert half-float zero/denorm to single precision value
|
||||
if (mantissa)
|
||||
{
|
||||
mantissa <<= 1;
|
||||
exp = HALF_FLOAT_MIN_BIASED_EXP_AS_SINGLE_FP_EXP;
|
||||
// check for leading 1 in denorm mantissa
|
||||
while ((mantissa & (1 << 10)) == 0)
|
||||
{
|
||||
// for every leading 0, decrement single precision exponent by 1
|
||||
// and shift half-float mantissa value to the left
|
||||
mantissa <<= 1;
|
||||
exp -= (1 << 23);
|
||||
}
|
||||
// clamp the mantissa to 10-bits
|
||||
mantissa &= ((1 << 10) - 1);
|
||||
// shift left to generate single-precision mantissa of 23-bits
|
||||
mantissa <<= 13;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// shift left to generate single-precision mantissa of 23-bits
|
||||
mantissa <<= 13;
|
||||
// generate single precision biased exponent value
|
||||
exp = (exp << 13) + HALF_FLOAT_MIN_BIASED_EXP_AS_SINGLE_FP_EXP;
|
||||
}
|
||||
|
||||
f = (sign << 31) | exp | mantissa;
|
||||
return *((float *)&f);
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
// DWORD Tesselator_SPU::tlsIdx = TlsAlloc();
|
||||
//
|
||||
Tesselator_SPU *Tesselator_SPU::getInstance()
|
||||
{
|
||||
return NULL;
|
||||
// return (Tesselator_SPU *)TlsGetValue(tlsIdx);
|
||||
}
|
||||
|
||||
// void Tesselator_SPU::CreateNewThreadStorage(int bytes)
|
||||
// {
|
||||
// Tesselator_SPU *instance = new Tesselator_SPU(bytes/4);
|
||||
// TlsSetValue(tlsIdx, instance);
|
||||
// }
|
||||
|
||||
|
||||
|
||||
void Tesselator_SPU::end()
|
||||
{
|
||||
// // if (!tesselating) throw new IllegalStateException("Not tesselating!"); // 4J - removed
|
||||
// tesselating = false;
|
||||
// if (vertices > 0)
|
||||
// {
|
||||
// // 4J - a lot of stuff taken out here for fiddling round with enable client states etc.
|
||||
// // that don't matter for our renderer
|
||||
// if (!hasColor)
|
||||
// {
|
||||
// // 4J - TEMP put in fixed vertex colors if we don't have any, until we have a shader that can cope without them
|
||||
// unsigned int *pColData = (unsigned int *)_array->data;
|
||||
// pColData += 5;
|
||||
// for( int i = 0; i < vertices; i++ )
|
||||
// {
|
||||
// *pColData = 0xffffffff;
|
||||
// pColData += 8;
|
||||
// }
|
||||
// }
|
||||
// if (mode == GL_QUADS && TRIANGLE_MODE)
|
||||
// {
|
||||
// // glDrawArrays(GL_TRIANGLES, 0, vertices); // 4J - changed for xbox
|
||||
// #ifdef _XBOX
|
||||
// RenderManager.DrawVertices(D3DPT_TRIANGLELIST,vertices,_array->data,
|
||||
// useCompactFormat360?C4JRender::VERTEX_TYPE_PS3_TS2_CS1:C4JRender::VERTEX_TYPE_PF3_TF2_CB4_NB4_XW1,
|
||||
// useProjectedTexturePixelShader?C4JRender::PIXEL_SHADER_TYPE_PROJECTION:C4JRender::PIXEL_SHADER_TYPE_STANDARD);
|
||||
// #else
|
||||
// RenderManager.DrawVertices(C4JRender::PRIMITIVE_TYPE_TRIANGLE_LIST,vertices,_array->data,
|
||||
// useCompactFormat360?C4JRender::VERTEX_TYPE_COMPRESSED:C4JRender::VERTEX_TYPE_PF3_TF2_CB4_NB4_XW1,
|
||||
// useProjectedTexturePixelShader?C4JRender::PIXEL_SHADER_TYPE_PROJECTION:C4JRender::PIXEL_SHADER_TYPE_STANDARD);
|
||||
// #endif
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// // glDrawArrays(mode, 0, vertices); // 4J - changed for xbox
|
||||
// // For compact vertices, the vertexCount has to be calculated from the amount of data written, as
|
||||
// // we insert extra fake vertices to encode supplementary data for more awkward quads that have non
|
||||
// // axis aligned UVs (eg flowing lava/water)
|
||||
// #ifdef _XBOX
|
||||
// int vertexCount = vertices;
|
||||
// if( useCompactFormat360 )
|
||||
// {
|
||||
// vertexCount = p / 2;
|
||||
// RenderManager.DrawVertices((D3DPRIMITIVETYPE)mode,vertexCount,_array->data,C4JRender::VERTEX_TYPE_PS3_TS2_CS1, C4JRender::PIXEL_SHADER_TYPE_STANDARD);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// if( useProjectedTexturePixelShader )
|
||||
// {
|
||||
// RenderManager.DrawVertices((D3DPRIMITIVETYPE)mode,vertexCount,_array->data,C4JRender::VERTEX_TYPE_PF3_TF2_CB4_NB4_XW1_TEXGEN, C4JRender::PIXEL_SHADER_TYPE_PROJECTION);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// RenderManager.DrawVertices((D3DPRIMITIVETYPE)mode,vertexCount,_array->data,C4JRender::VERTEX_TYPE_PF3_TF2_CB4_NB4_XW1, C4JRender::PIXEL_SHADER_TYPE_STANDARD);
|
||||
// }
|
||||
// }
|
||||
// #else
|
||||
// int vertexCount = vertices;
|
||||
// if( useCompactFormat360 )
|
||||
// {
|
||||
// RenderManager.DrawVertices((C4JRender::ePrimitiveType)mode,vertexCount,_array->data,C4JRender::VERTEX_TYPE_COMPRESSED, C4JRender::PIXEL_SHADER_TYPE_STANDARD);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// if( useProjectedTexturePixelShader )
|
||||
// {
|
||||
// RenderManager.DrawVertices((C4JRender::ePrimitiveType)mode,vertexCount,_array->data,C4JRender::VERTEX_TYPE_PF3_TF2_CB4_NB4_XW1_TEXGEN, C4JRender::PIXEL_SHADER_TYPE_PROJECTION);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// RenderManager.DrawVertices((C4JRender::ePrimitiveType)mode,vertexCount,_array->data,C4JRender::VERTEX_TYPE_PF3_TF2_CB4_NB4_XW1, C4JRender::PIXEL_SHADER_TYPE_STANDARD);
|
||||
// }
|
||||
// }
|
||||
// #endif
|
||||
// }
|
||||
// glDisableClientState(GL_VERTEX_ARRAY);
|
||||
// if (hasTexture) glDisableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
// if (hasColor) glDisableClientState(GL_COLOR_ARRAY);
|
||||
// if (hasNormal) glDisableClientState(GL_NORMAL_ARRAY);
|
||||
// }
|
||||
//
|
||||
// clear();
|
||||
}
|
||||
|
||||
void Tesselator_SPU::clear()
|
||||
{
|
||||
vertices = 0;
|
||||
|
||||
p = 0;
|
||||
count = 0;
|
||||
}
|
||||
|
||||
void Tesselator_SPU::begin()
|
||||
{
|
||||
begin(GL_QUADS);
|
||||
bounds.reset();
|
||||
}
|
||||
|
||||
void Tesselator_SPU::useProjectedTexture(bool enable)
|
||||
{
|
||||
useProjectedTexturePixelShader = enable;
|
||||
}
|
||||
|
||||
void Tesselator_SPU::useCompactVertices(bool enable)
|
||||
{
|
||||
useCompactFormat360 = enable;
|
||||
}
|
||||
|
||||
bool Tesselator_SPU::setMipmapEnable(bool enable)
|
||||
{
|
||||
bool prev = mipmapEnable;
|
||||
mipmapEnable = enable;
|
||||
return prev;
|
||||
}
|
||||
|
||||
void Tesselator_SPU::begin(int mode)
|
||||
{
|
||||
/* // 4J - removed
|
||||
if (tesselating) {
|
||||
throw new IllegalStateException("Already tesselating!");
|
||||
} */
|
||||
tesselating = true;
|
||||
|
||||
clear();
|
||||
this->mode = mode;
|
||||
hasNormal = false;
|
||||
hasColor = false;
|
||||
hasTexture = false;
|
||||
hasTexture2 = false;
|
||||
_noColor = false;
|
||||
}
|
||||
|
||||
void Tesselator_SPU::tex(float u, float v)
|
||||
{
|
||||
hasTexture = true;
|
||||
this->u = u;
|
||||
this->v = v;
|
||||
}
|
||||
|
||||
void Tesselator_SPU::tex2(int tex2)
|
||||
{
|
||||
hasTexture2 = true;
|
||||
this->_tex2 = tex2;
|
||||
}
|
||||
|
||||
void Tesselator_SPU::color(float r, float g, float b)
|
||||
{
|
||||
color((int) (r * 255), (int) (g * 255), (int) (b * 255));
|
||||
}
|
||||
|
||||
void Tesselator_SPU::color(float r, float g, float b, float a)
|
||||
{
|
||||
color((int) (r * 255), (int) (g * 255), (int) (b * 255), (int) (a * 255));
|
||||
}
|
||||
|
||||
void Tesselator_SPU::color(int r, int g, int b)
|
||||
{
|
||||
color(r, g, b, 255);
|
||||
}
|
||||
|
||||
void Tesselator_SPU::color(int r, int g, int b, int a)
|
||||
{
|
||||
if (_noColor) return;
|
||||
|
||||
if (r > 255) r = 255;
|
||||
if (g > 255) g = 255;
|
||||
if (b > 255) b = 255;
|
||||
if (a > 255) a = 255;
|
||||
if (r < 0) r = 0;
|
||||
if (g < 0) g = 0;
|
||||
if (b < 0) b = 0;
|
||||
if (a < 0) a = 0;
|
||||
|
||||
hasColor = true;
|
||||
// 4J - removed little-endian option
|
||||
col = (r << 24) | (g << 16) | (b << 8) | (a);
|
||||
}
|
||||
|
||||
void Tesselator_SPU::color(byte r, byte g, byte b)
|
||||
{
|
||||
color(r & 0xff, g & 0xff, b & 0xff);
|
||||
}
|
||||
|
||||
void Tesselator_SPU::vertexUV(float x, float y, float z, float u, float v)
|
||||
{
|
||||
tex(u, v);
|
||||
vertex(x, y, z);
|
||||
}
|
||||
|
||||
// Pack the 4 vertices of a quad up into a compact format. This is structured as 8 bytes per vertex,
|
||||
// arranged in blocks of 4 vertices per quad. Currently this is (one letter per nyblle):
|
||||
//
|
||||
// cccc xxyy zzll rgbi (vertex 0)
|
||||
// umin xxyy zzll rgbi (vertex 1)
|
||||
// vmin xxyy zzll rgbi (vertex 2)
|
||||
// udvd xxyy zzll rgbi (vertex 3)
|
||||
//
|
||||
// where: cccc is a 15-bit (5 bits per x/y/z) origin position / offset for the whole quad. Each
|
||||
// component is unsigned, and offset by 16 so has a range 0 to 31 actually representing -16 to 15
|
||||
// xx,yy,zz are 8-bit deltas from this origin to each vertex. These are unsigned 1.7 fixed point, ie
|
||||
// representing a range of 0 to 1.9921875
|
||||
// rgb is 4:4:4 RGB
|
||||
// umin, vmin are 3:13 unsigned fixed point UVs reprenting the min u and v required by the quad
|
||||
// ud,vd are 8-bit unsigned fixed pont UV deltas, which can be added to umin/vmin to get umax, vmax
|
||||
// and therefore define the 4 corners of an axis aligned UV mapping
|
||||
// i is a code per vertex that indicates which of umin/umax should be used for u, and which
|
||||
// of vmin/vmax should be used for v for this vertex. The coding is:
|
||||
// 0 - u = umin, v = vmin
|
||||
// 1 - u = umin, v = vmax
|
||||
// 2 - u = umax, v = vmin
|
||||
// 3 - u = umax, v = vmax
|
||||
// 4 - not axis aligned, use uv stored in the vertex data 4 on from this one
|
||||
// ll is an 8-bit (4 bit per u/v) index into the current lighting texture
|
||||
//
|
||||
// For quads that don't have axis aligned UVs (ie have a code for 4 in i as described above) the 8 byte vertex
|
||||
// is followed by a further 8 bytes which have explicit UVs defined for each vertex:
|
||||
//
|
||||
// 0000 0000 uuuu vvvv (vertex 0)
|
||||
// 0000 0000 uuuu vvvv (vertex 1)
|
||||
// 0000 0000 uuuu vvvv (vertex 2)
|
||||
// 0000 0000 uuuu vvvv (vertex 3)
|
||||
//
|
||||
|
||||
void Tesselator_SPU::packCompactQuad()
|
||||
{
|
||||
// Offset x/y/z by 16 so that we can deal with a -16 -> 16 range
|
||||
for( int i = 0; i < 4; i++ )
|
||||
{
|
||||
m_ix[i] += 16 * 128;
|
||||
m_iy[i] += 16 * 128;
|
||||
m_iz[i] += 16 * 128;
|
||||
}
|
||||
// Find min x/y/z
|
||||
unsigned int minx = m_ix[0];
|
||||
unsigned int miny = m_iy[0];
|
||||
unsigned int minz = m_iz[0];
|
||||
for( int i = 1; i < 4; i++ )
|
||||
{
|
||||
if( m_ix[i] < minx ) minx = m_ix[i];
|
||||
if( m_iy[i] < miny ) miny = m_iy[i];
|
||||
if( m_iz[i] < minz ) minz = m_iz[i];
|
||||
}
|
||||
// Everything has been scaled by a factor of 128 to get it into an int, and so
|
||||
// the minimum now should be in the range of (0->32) * 128. Get the base x/y/z
|
||||
// that our quad will be referenced from now, which can be stored in 5 bits
|
||||
unsigned int basex = ( minx >> 7 );
|
||||
unsigned int basey = ( miny >> 7 );
|
||||
unsigned int basez = ( minz >> 7 );
|
||||
// If the min is 32, then this whole quad must be in that plane - make the min 15 instead so
|
||||
// we can still offset from that with our delta to get to the exact edge
|
||||
if( basex == 32 ) basex = 31;
|
||||
if( basey == 32 ) basey = 31;
|
||||
if( basez == 32 ) basez = 31;
|
||||
// Now get deltas to each vertex - these have an 8-bit range so they can span a
|
||||
// full unit range from the base position
|
||||
for( int i = 0; i < 4; i++ )
|
||||
{
|
||||
m_ix[i] -= basex << 7;
|
||||
m_iy[i] -= basey << 7;
|
||||
m_iz[i] -= basez << 7;
|
||||
}
|
||||
// Now write the data out
|
||||
unsigned int *data = (unsigned int *)&_array->data[p];
|
||||
|
||||
for( int i = 0; i < 4; i++ )
|
||||
{
|
||||
data[i * 2 + 0] = ( m_ix[i] << 8 ) | ( m_iy[i] );
|
||||
data[i * 2 + 1] = ( m_iz[i] << 24 ) | ( m_clr[i] );
|
||||
}
|
||||
data[0] |= ( basex << 26 ) | ( basey << 21 )| ( basez << 16 );
|
||||
|
||||
// Now process UVs. First find min & max U & V
|
||||
unsigned int minu = m_u[0];
|
||||
unsigned int minv = m_v[0];
|
||||
unsigned int maxu = m_u[0];
|
||||
unsigned int maxv = m_v[0];
|
||||
|
||||
for( int i = 1; i < 4; i++ )
|
||||
{
|
||||
if( m_u[i] < minu ) minu = m_u[i];
|
||||
if( m_v[i] < minv ) minv = m_v[i];
|
||||
if( m_u[i] > maxu ) maxu = m_u[i];
|
||||
if( m_v[i] > maxv ) maxv = m_v[i];
|
||||
}
|
||||
// In nearly all cases, all our UVs should be axis aligned for this quad. So the only values they should
|
||||
// have in each dimension should be the min/max. We're going to store:
|
||||
// (1) minu/maxu (16 bits each, only actuall needs to store 14 bits to get a 0 to 2 range for each
|
||||
// (2) du/dv ( ie maxu-minu, maxv-minv) - 8 bits each, to store a range of 0 to 15.9375 texels. This
|
||||
// should be enough to map the full UV range of a single 16x16 region of the terrain texture, since
|
||||
// we always pull UVs in by 1/16th of their range at the sides
|
||||
unsigned int du = maxu - minu;
|
||||
unsigned int dv = maxv - minv;
|
||||
if( du > 255 ) du = 255;
|
||||
if( dv > 255 ) dv = 255;
|
||||
// Check if this quad has UVs that can be referenced this way. This should only happen for flowing water
|
||||
// and lava, where the texture coordinates are rotated for the top surface of the tile.
|
||||
bool axisAligned = true;
|
||||
for( int i = 0; i < 4; i++ )
|
||||
{
|
||||
if(! ( ( ( m_u[i] == minu ) || ( m_u[i] == maxu ) ) &&
|
||||
( ( m_v[i] == minv ) || ( m_v[i] == maxv ) ) ) )
|
||||
{
|
||||
axisAligned = false;
|
||||
}
|
||||
}
|
||||
|
||||
if( axisAligned )
|
||||
{
|
||||
// Now go through each vertex, and work out which of the min/max should be used for each dimension,
|
||||
// and store
|
||||
for( int i = 0; i < 4; i++ )
|
||||
{
|
||||
unsigned int code = 0;
|
||||
if( m_u[i] == maxu ) code |= 2;
|
||||
if( m_v[i] == maxv ) code |= 1;
|
||||
data[i * 2 + 1] |= code;
|
||||
data[i * 2 + 1] |= m_t2[i] << 16;
|
||||
}
|
||||
// Finally, store the minu/minv/du/dv
|
||||
data[1 * 2 + 0] |= minu << 16;
|
||||
data[2 * 2 + 0] |= minv << 16;
|
||||
data[3 * 2 + 0] |= ( du << 24 | dv << 16 );
|
||||
|
||||
incData(4 * 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
// The UVs aren't axis aligned - store them in the next 4 vertices. These will be indexed from
|
||||
// our base vertices because we'll set a special code (4) for the UVs. They won't be drawn as actual
|
||||
// verts when these extra vertices go through the vertex shader, because we'll make sure that
|
||||
// they get interpreted as a zero area quad and so they'll be quickly eliminated from rendering post-tranform
|
||||
|
||||
for( int i = 0; i < 4; i++ )
|
||||
{
|
||||
data[i * 2 + 1] |= ( 4 ); // The special code to indicate they need further data to be fetched
|
||||
data[i * 2 + 1] |= m_t2[i] << 16;
|
||||
data[8 + i * 2] = 0; // This includes x/y coordinate of each vert as (0,0) so they will be interpreted as a zero area quad
|
||||
data[9 + i * 2] = m_u[i] << 16 | m_v[i];
|
||||
}
|
||||
|
||||
// Extra 8 bytes required
|
||||
incData(8 * 2);
|
||||
}
|
||||
}
|
||||
|
||||
void Tesselator_SPU::vertex(float x, float y, float z)
|
||||
{
|
||||
bounds.addVert(x+xo, y+yo, z+zo); // 4J MGH - added
|
||||
count++;
|
||||
|
||||
// Signal to pixel shader whether to use mipmapping or not, by putting u into > 1 range if it is to be disabled
|
||||
float uu = mipmapEnable ? u : (u + 1.0f);
|
||||
|
||||
// 4J - this format added for 360 to keep memory size of tesselated tiles down -
|
||||
// see comments in packCompactQuad() for exact format
|
||||
if( useCompactFormat360 )
|
||||
{
|
||||
unsigned int ucol = (unsigned int)col;
|
||||
|
||||
#ifdef _XBOX
|
||||
// Pack as 4:4:4 RGB_
|
||||
unsigned short packedcol = (((col & 0xf0000000 ) >> 16 ) |
|
||||
((col & 0x00f00000 ) >> 12 ) |
|
||||
((col & 0x0000f000 ) >> 8 ));
|
||||
int ipackedcol = ((int)packedcol) & 0xffff; // 0 to 65535 range
|
||||
|
||||
int quadIdx = vertices % 4;
|
||||
m_ix[ quadIdx ] = (unsigned int)((x + xo) * 128.0f);
|
||||
m_iy[ quadIdx ] = (unsigned int)((y + yo) * 128.0f);
|
||||
m_iz[ quadIdx ] = (unsigned int)((z + zo) * 128.0f);
|
||||
m_clr[ quadIdx ] = (unsigned int)ipackedcol;
|
||||
m_u[ quadIdx ] = (int)(uu * 4096.0f);
|
||||
m_v[ quadIdx ] = (int)(v * 4096.0f);
|
||||
m_t2[ quadIdx ] = ( ( _tex2 & 0x00f00000 ) >> 20 ) | ( _tex2 & 0x000000f0 );
|
||||
if( quadIdx == 3 )
|
||||
{
|
||||
packCompactQuad();
|
||||
}
|
||||
#else
|
||||
unsigned short packedcol = ((col & 0xf8000000 ) >> 16 ) |
|
||||
((col & 0x00fc0000 ) >> 13 ) |
|
||||
((col & 0x0000f800 ) >> 11 );
|
||||
int ipackedcol = ((int)packedcol) & 0xffff; // 0 to 65535 range
|
||||
|
||||
ipackedcol -= 32768; // -32768 to 32767 range
|
||||
ipackedcol &= 0xffff;
|
||||
|
||||
int16_t* pShortData = (int16_t*)&_array->data[p];
|
||||
#ifdef __PS3__
|
||||
#define INT_ROUND(x) (int)(floorf(x+0.5))
|
||||
float tex2U = ((int16_t*)&_tex2)[1] + 8;
|
||||
float tex2V = ((int16_t*)&_tex2)[0] + 8;
|
||||
float colVal1 = ((col&0xff000000)>>24)/256.0f;
|
||||
float colVal2 = ((col&0x00ff0000)>>16)/256.0f;
|
||||
float colVal3 = ((col&0x0000ff00)>>8)/256.0f;
|
||||
|
||||
// pShortData[0] = convertFloatToHFloat(x + xo);
|
||||
// pShortData[1] = convertFloatToHFloat(y + yo);
|
||||
// pShortData[2] = convertFloatToHFloat(z + zo);
|
||||
// pShortData[3] = convertFloatToHFloat(uu);
|
||||
// pShortData[4] = convertFloatToHFloat(tex2U + colVal1);
|
||||
// pShortData[5] = convertFloatToHFloat(tex2V + colVal2);
|
||||
// pShortData[6] = convertFloatToHFloat(colVal3);
|
||||
// pShortData[7] = convertFloatToHFloat(v);
|
||||
|
||||
pShortData[0] = ((INT_ROUND((x + xo ) * 1024.0f))&0xffff);
|
||||
pShortData[1] = ((INT_ROUND((y + yo ) * 1024.0f))&0xffff);
|
||||
pShortData[2] = ((INT_ROUND((z + zo ) * 1024.0f))&0xffff);
|
||||
pShortData[3] = ipackedcol;
|
||||
pShortData[4] = ((INT_ROUND(uu * 8192.0f))&0xffff);
|
||||
pShortData[5] = ((INT_ROUND(v * 8192.0f))&0xffff);
|
||||
pShortData[6] = ((INT_ROUND(tex2U * (8192.0f/256.0f)))&0xffff);
|
||||
pShortData[7] = ((INT_ROUND(tex2V * (8192.0f/256.0f)))&0xffff);
|
||||
incData(4);
|
||||
#else
|
||||
pShortData[0] = (((int)((x + xo ) * 1024.0f))&0xffff);
|
||||
pShortData[1] = (((int)((y + yo ) * 1024.0f))&0xffff);
|
||||
pShortData[2] = (((int)((z + zo ) * 1024.0f))&0xffff);
|
||||
pShortData[3] = ipackedcol;
|
||||
pShortData[4] = (((int)(uu * 8192.0f))&0xffff);
|
||||
pShortData[5] = (((int)(v * 8192.0f))&0xffff);
|
||||
pShortData[6] = ((int16_t*)&_tex2)[0];
|
||||
pShortData[7] = ((int16_t*)&_tex2)[1];
|
||||
incData(4);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
vertices++;
|
||||
#ifdef _XBOX
|
||||
if (vertices % 4 == 0 && ( ( p >= size - 8 * 2 ) || ( ( p / 2 ) >= 65532 ) ) ) // Max 65535 verts in D3D, so 65532 is the last point at the end of a quad to catch it
|
||||
#else
|
||||
if (vertices % 4 == 0 && ( ( p >= size - 4 * 4 ) || ( ( p / 4 ) >= 65532 ) ) ) // Max 65535 verts in D3D, so 65532 is the last point at the end of a quad to catch it
|
||||
#endif
|
||||
{
|
||||
// end();
|
||||
tesselating = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (mode == GL_QUADS && TRIANGLE_MODE && count % 4 == 0)
|
||||
{
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
int offs = 8 * (3 - i);
|
||||
if (hasTexture)
|
||||
{
|
||||
_array->data[p + 3] = _array->data[p - offs + 3];
|
||||
_array->data[p + 4] = _array->data[p - offs + 4];
|
||||
}
|
||||
if (hasColor)
|
||||
{
|
||||
_array->data[p + 5] = _array->data[p - offs + 5];
|
||||
}
|
||||
|
||||
_array->data[p + 0] = _array->data[p - offs + 0];
|
||||
_array->data[p + 1] = _array->data[p - offs + 1];
|
||||
_array->data[p + 2] = _array->data[p - offs + 2];
|
||||
|
||||
vertices++;
|
||||
incData(8);
|
||||
}
|
||||
}
|
||||
|
||||
if (hasTexture)
|
||||
{
|
||||
float *fdata = (float *)(_array->data + p + 3);
|
||||
*fdata++ = uu;
|
||||
*fdata++ = v;
|
||||
}
|
||||
if (hasColor)
|
||||
{
|
||||
_array->data[p + 5] = col;
|
||||
}
|
||||
if (hasNormal)
|
||||
{
|
||||
_array->data[p + 6] = _normal;
|
||||
}
|
||||
if (hasTexture2)
|
||||
{
|
||||
#ifdef _XBOX
|
||||
_array->data[p + 7] = ( ( _tex2 >> 16 ) & 0xffff ) | ( _tex2 << 16 );
|
||||
#else
|
||||
#ifdef __PS3__
|
||||
int16_t tex2U = ((int16_t*)&_tex2)[1] + 8;
|
||||
int16_t tex2V = ((int16_t*)&_tex2)[0] + 8;
|
||||
int16_t* pShortArray = (int16_t*)&_array->data[p + 7];
|
||||
pShortArray[0] = tex2U;
|
||||
pShortArray[1] = tex2V;
|
||||
#else
|
||||
_array->data[p + 7] = _tex2;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
// -512 each for u/v will mean that the renderer will use global settings (set via
|
||||
// RenderManager.StateSetVertexTextureUV) rather than these local ones
|
||||
*(unsigned int *)(&_array->data[p + 7]) = 0xfe00fe00;
|
||||
}
|
||||
|
||||
float *fdata = (float *)(_array->data + p);
|
||||
*fdata++ = (x + xo);
|
||||
*fdata++ = (y + yo);
|
||||
*fdata++ = (z + zo);
|
||||
incData(8);
|
||||
|
||||
vertices++;
|
||||
if (vertices % 4 == 0 && p >= size - 8 * 4)
|
||||
{
|
||||
// end();
|
||||
tesselating = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Tesselator_SPU::color(int c)
|
||||
{
|
||||
int r = ((c >> 16) & 255);
|
||||
int g = ((c >> 8) & 255);
|
||||
int b = ((c) & 255);
|
||||
color(r, g, b);
|
||||
}
|
||||
|
||||
void Tesselator_SPU::color(int c, int alpha)
|
||||
{
|
||||
int r = ((c >> 16) & 255);
|
||||
int g = ((c >> 8) & 255);
|
||||
int b = ((c) & 255);
|
||||
color(r, g, b, alpha);
|
||||
}
|
||||
|
||||
void Tesselator_SPU::noColor()
|
||||
{
|
||||
_noColor = true;
|
||||
}
|
||||
|
||||
void Tesselator_SPU::normal(float x, float y, float z)
|
||||
{
|
||||
hasNormal = true;
|
||||
byte xx = (byte) (x * 127);
|
||||
byte yy = (byte) (y * 127);
|
||||
byte zz = (byte) (z * 127);
|
||||
|
||||
_normal = (xx & 0xff) | ((yy & 0xff) << 8) | ((zz & 0xff) << 16);
|
||||
}
|
||||
|
||||
void Tesselator_SPU::offset(float xo, float yo, float zo)
|
||||
{
|
||||
this->xo = xo;
|
||||
this->yo = yo;
|
||||
this->zo = zo;
|
||||
}
|
||||
|
||||
void Tesselator_SPU::addOffset(float x, float y, float z)
|
||||
{
|
||||
xo += x;
|
||||
yo += y;
|
||||
zo += z;
|
||||
}
|
||||
|
||||
void Tesselator_SPU::incData( int numInts )
|
||||
{
|
||||
p+=numInts;
|
||||
|
||||
#ifdef SN_TARGET_PS3_SPU
|
||||
if(p > 4096)
|
||||
{
|
||||
int dmaSize = p*4;
|
||||
unsigned int dmaTag = 2;
|
||||
void* src = _array->data;
|
||||
uintptr_t dest = (uintptr_t)(((char*)m_PPUArray) + m_PPUOffset);
|
||||
if(sc_verbose)
|
||||
spu_print("Tesselator : DMA SPU->PPU : 0x%08x -> 0x%08x : size : %d bytes\n", (unsigned int)src, (unsigned int)dest, dmaSize);
|
||||
cellDmaLargePut(src, dest, dmaSize, dmaTag, 0, 0);
|
||||
cellDmaWaitTagStatusAll(1 << dmaTag);
|
||||
|
||||
// int copySize = (p-4096);
|
||||
// for(int i=0;i<copySize;i++)
|
||||
// _array->data[i] = _array->data[4096+i];
|
||||
//p -= 4096;
|
||||
p=0;
|
||||
m_PPUOffset += dmaSize;//16384;
|
||||
}
|
||||
#endif // SN_TARGET_PS3_SPU
|
||||
}
|
||||
|
||||
void Tesselator_SPU::endData()
|
||||
{
|
||||
#ifdef SN_TARGET_PS3_SPU
|
||||
int dmaSize = p*4;
|
||||
unsigned int dmaTag = 2;
|
||||
void* src = _array->data;
|
||||
uintptr_t dest = (uintptr_t)(((char*)m_PPUArray) + m_PPUOffset);
|
||||
if(sc_verbose)
|
||||
spu_print("Tesselator : DMA SPU->PPU : 0x%08x -> 0x%08x : size : %d bytes\n", (unsigned int)src, (unsigned int)dest, dmaSize);
|
||||
cellDmaLargePut(src, dest, dmaSize, dmaTag, 0, 0);
|
||||
cellDmaWaitTagStatusAll(1 << dmaTag);
|
||||
if(sc_verbose)
|
||||
spu_print("endData - Tesselator : DMA SPU->PPU complete : %d verts, %d bytes in total\n", vertices, m_PPUOffset+ dmaSize);
|
||||
p=0;
|
||||
m_PPUOffset += dmaSize;
|
||||
#else // SN_TARGET_PS3_SPU
|
||||
m_PPUOffset = p*4;
|
||||
#endif
|
||||
}
|
||||
|
||||
void Tesselator_SPU::beginData()
|
||||
{
|
||||
p = 0;
|
||||
}
|
||||
167
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/Tesselator_SPU.h
Normal file
167
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/Tesselator_SPU.h
Normal file
@@ -0,0 +1,167 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef __PS3__
|
||||
#ifdef SN_TARGET_PS3_SPU
|
||||
typedef unsigned int DWORD;
|
||||
typedef unsigned char byte;
|
||||
#include <float.h>
|
||||
#else
|
||||
#include "..\..\..\stdafx.h"
|
||||
class ChunkRebuildData;
|
||||
#endif
|
||||
#endif
|
||||
class intArray_SPU
|
||||
{
|
||||
public:
|
||||
unsigned int* data;
|
||||
|
||||
intArray_SPU(unsigned int* preAllocData) { data = preAllocData; }
|
||||
~intArray_SPU(){ }
|
||||
};
|
||||
|
||||
class ChunkRebuildData;
|
||||
|
||||
class Tesselator_SPU
|
||||
{
|
||||
#ifndef SN_TARGET_PS3_SPU
|
||||
friend ChunkRebuildData;
|
||||
#endif
|
||||
// private static boolean TRIANGLE_MODE = false;
|
||||
public:
|
||||
static bool TRIANGLE_MODE;
|
||||
static bool USE_VBO;
|
||||
|
||||
static const int MAX_MEMORY_USE = 16 * 1024 * 1024;
|
||||
static const int MAX_FLOATS = MAX_MEMORY_USE / 4 / 2;
|
||||
|
||||
void* m_PPUArray;
|
||||
int m_PPUOffset;
|
||||
public:
|
||||
intArray_SPU* _array;
|
||||
private:
|
||||
int vertices;
|
||||
float u, v;
|
||||
int _tex2;
|
||||
int col;
|
||||
bool hasColor;
|
||||
bool hasTexture;
|
||||
bool hasTexture2;
|
||||
bool hasNormal;
|
||||
int p ;
|
||||
bool useCompactFormat360; // 4J - added
|
||||
bool useProjectedTexturePixelShader; // 4J - added
|
||||
public:
|
||||
int count;
|
||||
private:
|
||||
bool _noColor;
|
||||
int mode;
|
||||
float xo, yo, zo;
|
||||
int _normal;
|
||||
|
||||
// 4J - added for thread local storage
|
||||
public:
|
||||
// static void CreateNewThreadStorage(int bytes);
|
||||
private:
|
||||
// static DWORD tlsIdx;
|
||||
public:
|
||||
static Tesselator_SPU *getInstance();
|
||||
|
||||
private:
|
||||
bool tesselating;
|
||||
bool mipmapEnable; // 4J added
|
||||
|
||||
bool vboMode;
|
||||
// IntBuffer *vboIds;
|
||||
int vboId;
|
||||
int vboCounts;
|
||||
int size;
|
||||
|
||||
public:
|
||||
Tesselator_SPU() {}
|
||||
void end();
|
||||
private:
|
||||
void clear();
|
||||
|
||||
// 4J - added to handle compact quad vertex format, which need packaged up as quads
|
||||
unsigned int m_ix[4],m_iy[4],m_iz[4];
|
||||
unsigned int m_clr[4];
|
||||
unsigned int m_u[4], m_v[4];
|
||||
unsigned int m_t2[4];
|
||||
void packCompactQuad();
|
||||
void incData(int numInts);
|
||||
public:
|
||||
|
||||
class Bounds
|
||||
{
|
||||
public:
|
||||
void reset()
|
||||
{
|
||||
boundingBox[0] = FLT_MAX;
|
||||
boundingBox[1] = FLT_MAX;
|
||||
boundingBox[2] = FLT_MAX;
|
||||
boundingBox[3] = -FLT_MAX;
|
||||
boundingBox[4] = -FLT_MAX;
|
||||
boundingBox[5] = -FLT_MAX;
|
||||
}
|
||||
void addVert(float x, float y, float z)
|
||||
{
|
||||
if(x < boundingBox[0])
|
||||
boundingBox[0] = x;
|
||||
if(y < boundingBox[1])
|
||||
boundingBox[1] = y;
|
||||
if(z < boundingBox[2])
|
||||
boundingBox[2] = z;
|
||||
|
||||
if(x > boundingBox[3])
|
||||
boundingBox[3] = x;
|
||||
if(y > boundingBox[4])
|
||||
boundingBox[4] = y;
|
||||
if(z > boundingBox[5])
|
||||
boundingBox[5] = z;
|
||||
}
|
||||
void addBounds(Bounds& ob)
|
||||
{
|
||||
if(ob.boundingBox[0] < boundingBox[0])
|
||||
boundingBox[0] = ob.boundingBox[0];
|
||||
if(ob.boundingBox[1] < boundingBox[1])
|
||||
boundingBox[1] = ob.boundingBox[1];
|
||||
if(ob.boundingBox[2] < boundingBox[2])
|
||||
boundingBox[2] = ob.boundingBox[2];
|
||||
|
||||
if(ob.boundingBox[3] > boundingBox[3])
|
||||
boundingBox[3] = ob.boundingBox[3];
|
||||
if(ob.boundingBox[4] > boundingBox[4])
|
||||
boundingBox[4] = ob.boundingBox[4];
|
||||
if(ob.boundingBox[5] > boundingBox[5])
|
||||
boundingBox[5] = ob.boundingBox[5];
|
||||
}
|
||||
float boundingBox[6]; // 4J MGH added
|
||||
|
||||
} bounds;
|
||||
|
||||
|
||||
|
||||
void beginData();
|
||||
void endData();
|
||||
|
||||
void begin();
|
||||
void begin(int mode);
|
||||
void useCompactVertices(bool enable); // 4J added
|
||||
void useProjectedTexture(bool enable); // 4J added
|
||||
void tex(float u, float v);
|
||||
void tex2(int tex2); // 4J - change brought forward from 1.8.2
|
||||
void color(float r, float g, float b);
|
||||
void color(float r, float g, float b, float a);
|
||||
void color(int r, int g, int b);
|
||||
void color(int r, int g, int b, int a);
|
||||
void color(byte r, byte g, byte b);
|
||||
void vertexUV(float x, float y, float z, float u, float v);
|
||||
void vertex(float x, float y, float z);
|
||||
void color(int c);
|
||||
void color(int c, int alpha);
|
||||
void noColor();
|
||||
void normal(float x, float y, float z);
|
||||
void offset(float xo, float yo, float zo);
|
||||
void addOffset(float x, float y, float z);
|
||||
bool setMipmapEnable(bool enable); // 4J added
|
||||
};
|
||||
@@ -0,0 +1,12 @@
|
||||
#pragma once
|
||||
#include "Tile_SPU.h"
|
||||
|
||||
class TheEndPortalFrameTile_SPU : public Tile_SPU
|
||||
{
|
||||
public:
|
||||
TheEndPortalFrameTile_SPU(int id) : Tile_SPU(id) {}
|
||||
virtual Icon_SPU *getTexture(int face, int data) { return NULL; }
|
||||
virtual bool isSolidRender(bool isServerLevel = false) { return false; }
|
||||
virtual int getRenderShape() { return SHAPE_PORTAL_FRAME; }
|
||||
// virtual void updateDefaultShape();
|
||||
};
|
||||
@@ -0,0 +1,17 @@
|
||||
#pragma once
|
||||
#include "EntityTile_SPU.h"
|
||||
|
||||
class TheEndPortal_SPU : public EntityTile_SPU
|
||||
{
|
||||
public:
|
||||
TheEndPortal_SPU(int id) : EntityTile_SPU(id) {}
|
||||
|
||||
// virtual void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, shared_ptr<TileEntity> forceEntity = shared_ptr<TileEntity>()); // 4J added forceData, forceEntity param
|
||||
virtual bool shouldRenderFace(ChunkRebuildData *level, int x, int y, int z, int face)
|
||||
{
|
||||
if (face != 0) return false;
|
||||
return EntityTile_SPU::shouldRenderFace(level, x, y, z, face);
|
||||
}
|
||||
virtual bool isSolidRender(bool isServerLevel = false) { return false; }
|
||||
virtual int getRenderShape() { return SHAPE_INVISIBLE; }
|
||||
};
|
||||
@@ -0,0 +1,83 @@
|
||||
#include "stdafx.h"
|
||||
#include "ThinFenceTile_SPU.h"
|
||||
#include "ChunkRebuildData.h"
|
||||
|
||||
bool ThinFenceTile_SPU::isSolidRender(bool isServerLevel)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
int ThinFenceTile_SPU::getRenderShape()
|
||||
{
|
||||
return Tile_SPU::SHAPE_IRON_FENCE;
|
||||
}
|
||||
|
||||
bool ThinFenceTile_SPU::shouldRenderFace(ChunkRebuildData *level, int x, int y, int z, int face)
|
||||
{
|
||||
int id = level->getTile(x, y, z);
|
||||
if (id == this->id) return false;
|
||||
return Tile_SPU::shouldRenderFace(level, x, y, z, face);
|
||||
}
|
||||
|
||||
void ThinFenceTile_SPU::updateDefaultShape()
|
||||
{
|
||||
setShape(0, 0, 0, 1, 1, 1);
|
||||
}
|
||||
|
||||
void ThinFenceTile_SPU::updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData, TileEntity* forceEntity) // 4J added forceData, forceEntity param
|
||||
{
|
||||
float minX = 7.0f / 16.0f;
|
||||
float maxX = 9.0f / 16.0f;
|
||||
float minZ = 7.0f / 16.0f;
|
||||
float maxZ = 9.0f / 16.0f;
|
||||
|
||||
bool n = attachsTo(level->getTile(x, y, z - 1));
|
||||
bool s = attachsTo(level->getTile(x, y, z + 1));
|
||||
bool w = attachsTo(level->getTile(x - 1, y, z));
|
||||
bool e = attachsTo(level->getTile(x + 1, y, z));
|
||||
|
||||
if ((w && e) || (!w && !e && !n && !s))
|
||||
{
|
||||
minX = 0;
|
||||
maxX = 1;
|
||||
}
|
||||
else if (w && !e)
|
||||
{
|
||||
minX = 0;
|
||||
}
|
||||
else if (!w && e)
|
||||
{
|
||||
maxX = 1;
|
||||
}
|
||||
if ((n && s) || (!w && !e && !n && !s))
|
||||
{
|
||||
minZ = 0;
|
||||
maxZ = 1;
|
||||
}
|
||||
else if (n && !s)
|
||||
{
|
||||
minZ = 0;
|
||||
}
|
||||
else if (!n && s)
|
||||
{
|
||||
maxZ = 1;
|
||||
}
|
||||
setShape(minX, 0, minZ, maxX, 1, maxZ);
|
||||
}
|
||||
|
||||
Icon_SPU *ThinFenceTile_SPU::getEdgeTexture()
|
||||
{
|
||||
if(id == Tile_SPU::ironFence_Id)
|
||||
return &ms_pTileData->ironFence_EdgeTexture;
|
||||
if(id == Tile_SPU::thinGlass_Id)
|
||||
return &ms_pTileData->thinGlass_EdgeTexture;
|
||||
#ifndef SN_TARGET_PS3_SPU
|
||||
assert(0);
|
||||
#endif
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool ThinFenceTile_SPU::attachsTo(int tile)
|
||||
{
|
||||
return ms_pTileData->solid[tile] || tile == id || tile == Tile_SPU::glass_Id;
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
#pragma once
|
||||
#include "Tile_SPU.h"
|
||||
|
||||
class ThinFenceTile_SPU : public Tile_SPU
|
||||
{
|
||||
|
||||
public:
|
||||
ThinFenceTile_SPU(int id) : Tile_SPU(id) {}
|
||||
|
||||
virtual bool isSolidRender(bool isServerLevel = false);
|
||||
virtual int getRenderShape();
|
||||
virtual bool shouldRenderFace(ChunkRebuildData *level, int x, int y, int z, int face);
|
||||
virtual void updateDefaultShape();
|
||||
virtual void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = NULL); // 4J added forceData, forceEntity param
|
||||
virtual Icon_SPU *getEdgeTexture();
|
||||
bool attachsTo(int tile);
|
||||
};
|
||||
7635
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/TileRenderer_SPU.cpp
Normal file
7635
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/TileRenderer_SPU.cpp
Normal file
File diff suppressed because it is too large
Load Diff
205
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/TileRenderer_SPU.h
Normal file
205
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/TileRenderer_SPU.h
Normal file
@@ -0,0 +1,205 @@
|
||||
#pragma once
|
||||
|
||||
#include <stddef.h>
|
||||
//#include <string>
|
||||
#include "Tile_SPU.h"
|
||||
#include "Icon_SPU.h"
|
||||
#include "ChunkRebuildData.h"
|
||||
|
||||
class Level;
|
||||
class LevelSource;
|
||||
class Tile_SPU;
|
||||
class RailTile_SPU;
|
||||
class Material;
|
||||
class TileEntity;
|
||||
class ThinFenceTile;
|
||||
class FenceTile_SPU;
|
||||
class FenceGateTile_SPU;
|
||||
class BrewingStandTile_SPU;
|
||||
class CauldronTile_SPU;
|
||||
class EggTile_SPU;
|
||||
class TheEndPortalFrameTile;
|
||||
class DiodeTile_SPU;
|
||||
class FireTile_SPU;
|
||||
class StemTile_SPU;
|
||||
class WaterlilyTile_SPU;
|
||||
class StairTile_SPU;
|
||||
class CocoaTile_SPU;
|
||||
class AnvilTile_SPU;
|
||||
class FlowerPotTile_SPU;
|
||||
class WallTile_SPU;
|
||||
|
||||
class Icon;
|
||||
class Minecraft;
|
||||
|
||||
class TileRenderer_SPU
|
||||
{
|
||||
friend class FallingTileRenderer_SPU;
|
||||
private:
|
||||
ChunkRebuildData* level;
|
||||
Icon_SPU *fixedTexture;
|
||||
bool xFlipTexture;
|
||||
bool noCulling;
|
||||
public :
|
||||
static bool fancy;
|
||||
bool setColor;
|
||||
|
||||
float tileShapeX0;
|
||||
float tileShapeX1;
|
||||
float tileShapeY0;
|
||||
float tileShapeY1;
|
||||
float tileShapeZ0;
|
||||
float tileShapeZ1;
|
||||
bool fixedShape;
|
||||
bool smoothShapeLighting;
|
||||
// Minecraft *minecraft;
|
||||
|
||||
void _init();
|
||||
|
||||
public:
|
||||
TileRenderer_SPU( ChunkRebuildData* level );
|
||||
TileRenderer_SPU();
|
||||
Tesselator_SPU* getTesselator();
|
||||
|
||||
bool hasRenderer(Tile_SPU* tt);
|
||||
void setFixedTexture( Icon_SPU *fixedTexture );
|
||||
void clearFixedTexture();
|
||||
bool hasFixedTexture();
|
||||
void setShape(float x0, float y0, float z0, float x1, float y1, float z1);
|
||||
void setShape(Tile_SPU *tt);
|
||||
void setFixedShape(float x0, float y0, float z0, float x1, float y1, float z1);
|
||||
void clearFixedShape();
|
||||
|
||||
void tesselateInWorldFixedTexture( Tile_SPU* tile, int x, int y, int z, Icon_SPU *fixedTexture ); // 4J renamed to differentiate from tesselateInWorld
|
||||
void tesselateInWorldNoCulling( Tile_SPU* tile, int x, int y, int z, int forceData = -1,
|
||||
TileEntity* forceEntity = NULL ); // 4J added forceData, forceEntity param
|
||||
bool tesselateInWorld( Tile_SPU* tt, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = NULL ); // 4J added forceData, forceEntity param
|
||||
|
||||
private:
|
||||
bool tesselateAirPortalFrameInWorld(TheEndPortalFrameTile *tt, int x, int y, int z);
|
||||
bool tesselateBedInWorld( Tile_SPU* tt, int x, int y, int z );
|
||||
bool tesselateBrewingStandInWorld(BrewingStandTile_SPU *tt, int x, int y, int z);
|
||||
bool tesselateCauldronInWorld(CauldronTile_SPU *tt, int x, int y, int z);
|
||||
bool tesselateFlowerPotInWorld(FlowerPotTile_SPU *tt, int x, int y, int z);
|
||||
bool tesselateAnvilInWorld(AnvilTile_SPU *tt, int x, int y, int z);
|
||||
|
||||
public:
|
||||
bool tesselateAnvilInWorld(AnvilTile_SPU *tt, int x, int y, int z, int data);
|
||||
|
||||
private:
|
||||
bool tesselateAnvilInWorld(AnvilTile_SPU *tt, int x, int y, int z, int data, bool render);
|
||||
float tesselateAnvilPiece(AnvilTile_SPU *tt, int x, int y, int z, int part, float bottom, float width, float height, float length, bool rotate, bool render, int data);
|
||||
|
||||
|
||||
public:
|
||||
bool tesselateTorchInWorld( Tile_SPU* tt, int x, int y, int z );
|
||||
private:
|
||||
bool tesselateDiodeInWorld(DiodeTile_SPU *tt, int x, int y, int z);
|
||||
void tesselateDiodeInWorld( DiodeTile_SPU* tt, int x, int y, int z, int dir );
|
||||
static const int FLIP_NONE = 0, FLIP_CW = 1, FLIP_CCW = 2, FLIP_180 = 3;
|
||||
|
||||
int northFlip;
|
||||
int southFlip;
|
||||
int eastFlip;
|
||||
int westFlip;
|
||||
int upFlip;
|
||||
int downFlip;
|
||||
public:
|
||||
void tesselatePistonBaseForceExtended( Tile_SPU* tile, int x, int y, int z, int forceData = -1 ); // 4J added data param
|
||||
private:
|
||||
bool tesselatePistonBaseInWorld( Tile_SPU* tt, int x, int y, int z, bool forceExtended, int forceData = -1 ); // 4J added data param
|
||||
void renderPistonArmUpDown( float x0, float x1, float y0, float y1, float z0, float z1, float br, float armLengthPixels );
|
||||
void renderPistonArmNorthSouth( float x0, float x1, float y0, float y1, float z0, float z1, float br, float armLengthPixels );
|
||||
void renderPistonArmEastWest( float x0, float x1, float y0, float y1, float z0, float z1, float br, float armLengthPixels );
|
||||
public:
|
||||
void tesselatePistonArmNoCulling( Tile_SPU* tile, int x, int y, int z, bool fullArm, int forceData = -1 ); // 4J added data param
|
||||
private:
|
||||
bool tesselatePistonExtensionInWorld( Tile_SPU* tt, int x, int y, int z, bool fullArm, int forceData = -1 ); // 4J added data param
|
||||
public:
|
||||
bool tesselateLeverInWorld( Tile_SPU* tt, int x, int y, int z );
|
||||
bool tesselateTripwireSourceInWorld(Tile_SPU *tt, int x, int y, int z);
|
||||
bool tesselateTripwireInWorld(Tile_SPU *tt, int x, int y, int z);
|
||||
bool tesselateFireInWorld( FireTile_SPU* tt, int x, int y, int z );
|
||||
bool tesselateDustInWorld( Tile_SPU* tt, int x, int y, int z );
|
||||
bool tesselateRailInWorld( RailTile_SPU* tt, int x, int y, int z );
|
||||
bool tesselateLadderInWorld( Tile_SPU* tt, int x, int y, int z );
|
||||
bool tesselateVineInWorld( Tile_SPU* tt, int x, int y, int z );
|
||||
bool tesselateThinFenceInWorld( ThinFenceTile* tt, int x, int y, int z );
|
||||
bool tesselateCrossInWorld( Tile_SPU* tt, int x, int y, int z );
|
||||
bool tesselateStemInWorld( Tile_SPU* _tt, int x, int y, int z );
|
||||
bool tesselateRowInWorld( Tile_SPU* tt, int x, int y, int z );
|
||||
void tesselateTorch( Tile_SPU* tt, float x, float y, float z, float xxa, float zza, int data );
|
||||
void tesselateCrossTexture( Tile_SPU* tt, int data, float x, float y, float z, float scale );
|
||||
void tesselateStemTexture( Tile_SPU* tt, int data, float h, float x, float y, float z );
|
||||
bool tesselateLilypadInWorld(WaterlilyTile_SPU *tt, int x, int y, int z);
|
||||
void tesselateStemDirTexture( StemTile_SPU* tt, int data, int dir, float h, float x, float y, float z );
|
||||
|
||||
void tesselateRowTexture( Tile_SPU* tt, int data, float x, float y, float z );
|
||||
bool tesselateWaterInWorld( Tile_SPU* tt, int x, int y, int z );
|
||||
private:
|
||||
float getWaterHeight( int x, int y, int z, Material_SPU* m );
|
||||
public:
|
||||
void renderBlock( Tile_SPU* tt, ChunkRebuildData* level, int x, int y, int z );
|
||||
void renderBlock(Tile_SPU *tt, ChunkRebuildData *level, int x, int y, int z, int data);
|
||||
bool tesselateBlockInWorld( Tile_SPU* tt, int x, int y, int z );
|
||||
bool tesselateTreeInWorld(Tile_SPU *tt, int x, int y, int z);
|
||||
bool tesselateQuartzInWorld(Tile_SPU *tt, int x, int y, int z);
|
||||
bool tesselateCocoaInWorld(CocoaTile_SPU *tt, int x, int y, int z);
|
||||
|
||||
private:
|
||||
bool applyAmbienceOcclusion;
|
||||
float ll000, llx00, ll0y0, ll00z, llX00, ll0Y0, ll00Z;
|
||||
float llxyz, llxy0, llxyZ, ll0yz, ll0yZ, llXyz, llXy0;
|
||||
float llXyZ, llxYz, llxY0, llxYZ, ll0Yz, llXYz, llXY0;
|
||||
float ll0YZ, llXYZ, llx0z, llX0z, llx0Z, llX0Z;
|
||||
// 4J - brought forward changes from 1.8.2
|
||||
int ccx00, cc00z, cc0Y0, cc00Z;
|
||||
int ccxyz, ccxy0, ccxyZ, cc0yz, cc0yZ, ccXyz, ccXy0;
|
||||
int ccXyZ, ccxYz, ccxY0, ccxYZ, cc0Yz, ccXYz, ccXY0;
|
||||
int cc0YZ, ccXYZ, ccx0z, ccX0z, ccx0Z, ccX0Z;
|
||||
int blsmooth;
|
||||
int tc1, tc2, tc3, tc4; // 4J - brought forward changes from 1.8.2
|
||||
float c1r, c2r, c3r, c4r;
|
||||
float c1g, c2g, c3g, c4g;
|
||||
float c1b, c2b, c3b, c4b;
|
||||
bool llTrans0Yz, llTransXY0, llTransxY0, llTrans0YZ;
|
||||
bool llTransx0z, llTransX0Z, llTransx0Z, llTransX0z;
|
||||
bool llTrans0yz, llTransXy0, llTransxy0, llTrans0yZ;
|
||||
|
||||
public:
|
||||
// 4J - brought forward changes from 1.8.2
|
||||
bool tesselateBlockInWorldWithAmbienceOcclusionTexLighting( Tile_SPU* tt, int pX, int pY, int pZ, float pBaseRed,
|
||||
float pBaseGreen, float pBaseBlue );
|
||||
bool tesselateBlockInWorldWithAmbienceOcclusionOldLighting( Tile_SPU* tt, int pX, int pY, int pZ, float pBaseRed,
|
||||
float pBaseGreen, float pBaseBlue );
|
||||
private:
|
||||
int blend( int a, int b, int c, int def );
|
||||
int blend(int a, int b, int c, int d, float fa, float fb, float fc, float fd);
|
||||
public:
|
||||
bool tesselateBlockInWorld( Tile_SPU* tt, int x, int y, int z, float r, float g, float b );
|
||||
bool tesselateCactusInWorld( Tile_SPU* tt, int x, int y, int z );
|
||||
bool tesselateCactusInWorld( Tile_SPU* tt, int x, int y, int z, float r, float g, float b );
|
||||
bool tesselateFenceInWorld( FenceTile_SPU* tt, int x, int y, int z );
|
||||
bool tesselateWallInWorld(WallTile_SPU *tt, int x, int y, int z);
|
||||
bool tesselateEggInWorld(EggTile_SPU *tt, int x, int y, int z);
|
||||
bool tesselateFenceGateInWorld(FenceGateTile_SPU *tt, int x, int y, int z);
|
||||
bool tesselateStairsInWorld( StairTile_SPU* tt, int x, int y, int z );
|
||||
bool tesselateDoorInWorld( Tile_SPU* tt, int x, int y, int z );
|
||||
void renderFaceUp( Tile_SPU* tt, float x, float y, float z, Icon_SPU *tex );
|
||||
void renderFaceDown( Tile_SPU* tt, float x, float y, float z, Icon_SPU *tex );
|
||||
void renderNorth( Tile_SPU* tt, float x, float y, float z, Icon_SPU *tex );
|
||||
void renderSouth( Tile_SPU* tt, float x, float y, float z, Icon_SPU *tex );
|
||||
void renderWest( Tile_SPU* tt, float x, float y, float z, Icon_SPU *tex );
|
||||
void renderEast( Tile_SPU* tt, float x, float y, float z, Icon_SPU *tex );
|
||||
// void renderCube( Tile_SPU* tile, float alpha );
|
||||
// void renderTile( Tile_SPU* tile, int data, float brightness, float fAlpha = 1.0f );
|
||||
static bool canRender( int renderShape );
|
||||
Icon_SPU *getTexture(Tile_SPU *tile, ChunkRebuildData *level, int x, int y, int z, int face);
|
||||
|
||||
Icon_SPU *getTexture(Tile_SPU *tile, int face, int data);
|
||||
Icon_SPU *getTexture(Tile_SPU *tile, int face);
|
||||
Icon_SPU *getTexture(Tile_SPU *tile);
|
||||
Icon_SPU *getTextureOrMissing(Icon_SPU *icon);
|
||||
|
||||
bool isAnaglyph3d() { return false; } //GameRenderer::anaglyph3d
|
||||
};
|
||||
899
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/Tile_SPU.cpp
Normal file
899
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/Tile_SPU.cpp
Normal file
@@ -0,0 +1,899 @@
|
||||
#include "stdafx.h"
|
||||
#include "Tile_SPU.h"
|
||||
#include "ChunkRebuildData.h"
|
||||
#include "GrassTile_SPU.h"
|
||||
#include "HalfSlabTile_SPU.h"
|
||||
#include "WoodSlabTile_SPU.h"
|
||||
#include "StoneSlabTile_SPU.h"
|
||||
#include "ChestTile_SPU.h"
|
||||
#include "ThinFenceTile_SPU.h"
|
||||
#include "FenceTile_SPU.h"
|
||||
#include "StairTile_SPU.h"
|
||||
#include "DirtTile_SPU.h"
|
||||
#include "DoorTile_SPU.h"
|
||||
#include "PressurePlateTile_SPU.h"
|
||||
#include "FarmTile_SPU.h"
|
||||
#include "Bush_SPU.h"
|
||||
#include "TallGrass_SPU.h"
|
||||
#include "SandStoneTile_SPU.h"
|
||||
#include "WoodTile_SPU.h"
|
||||
#include "TreeTile_SPU.h"
|
||||
#include "LeafTile_SPU.h"
|
||||
#include "CropTile_SPU.h"
|
||||
#include "ReedTile_SPU.h"
|
||||
#include "TorchTile_SPU.h"
|
||||
#include "Mushroom_SPU.h"
|
||||
#include "FurnaceTile_SPU.h"
|
||||
#include "WebTile_SPU.h"
|
||||
#include "LiquidTile_SPU.h"
|
||||
#include "FireTile_SPU.h"
|
||||
#include "Sapling_SPU.h"
|
||||
#include "GlassTile_SPU.h"
|
||||
#include "IceTile_SPU.h"
|
||||
#include "PortalTile_SPU.h"
|
||||
#include "DispenserTile_SPU.h"
|
||||
#include "RailTile_SPU.h"
|
||||
#include "DetectorRailTile_SPU.h"
|
||||
#include "TntTile_SPU.h"
|
||||
#include "BookshelfTile_SPU.h"
|
||||
#include "WorkbenchTile_SPU.h"
|
||||
#include "SignTile_SPU.h"
|
||||
#include "LadderTile_SPU.h"
|
||||
#include "ButtonTile_SPU.h"
|
||||
#include "TopSnowTile_SPU.h"
|
||||
#include "CactusTile_SPU.h"
|
||||
#include "RecordPlayerTile_SPU.h"
|
||||
#include "PumpkinTile_SPU.h"
|
||||
#include "CakeTile_SPU.h"
|
||||
#include "TrapDoorTile_SPU.h"
|
||||
#include "StoneMonsterTile_SPU.h"
|
||||
#include "SmoothStoneBrickTile_SPU.h"
|
||||
#include "HugeMushroomTile_SPU.h"
|
||||
#include "MelonTile_SPU.h"
|
||||
#include "StemTile_SPU.h"
|
||||
#include "VineTile_SPU.h"
|
||||
#include "MycelTile_SPU.h"
|
||||
#include "WaterlilyTile_SPU.h"
|
||||
#include "NetherStalkTile_SPU.h"
|
||||
#include "EnchantmentTableTile_SPU.h"
|
||||
#include "BrewingStandTile_SPU.h"
|
||||
#include "DiodeTile_SPU.h"
|
||||
#include "RedStoneDustTile_SPU.h"
|
||||
#include "FenceGateTile_SPU.h"
|
||||
#include "BedTile_SPU.h"
|
||||
#include "PistonBaseTile_SPU.h"
|
||||
#include "PistonExtensionTile_SPU.h"
|
||||
#include "PistonMovingPiece_SPU.h"
|
||||
#include "LeverTile_SPU.h"
|
||||
#include "CauldronTile_SPU.h"
|
||||
#include "TheEndPortal_SPU.h"
|
||||
#include "TheEndPortalFrameTile_SPU.h"
|
||||
#include "EggTile_SPU.h"
|
||||
#include "CocoaTile_SPU.h"
|
||||
#include "RedlightTile_SPU.h"
|
||||
#include "ClothTile_SPU.h"
|
||||
#include "SkullTile_SPU.h"
|
||||
#include "MobSpawnerTile_SPU.h"
|
||||
#include "EnderChestTile_SPU.h"
|
||||
#include "TripWireSourceTile_SPU.h"
|
||||
#include "TripWireTile_SPU.h"
|
||||
#include "WallTile_SPU.h"
|
||||
#include "FlowerPotTile_SPU.h"
|
||||
#include "CarrotTile_SPU.h"
|
||||
#include "PotatoTile_SPU.h"
|
||||
#include "QuartzBlockTile_SPU.h"
|
||||
#include "WoolCarpetTile_SPU.h"
|
||||
|
||||
#ifdef SN_TARGET_PS3_SPU
|
||||
#include "..\Common\spu_assert.h"
|
||||
#endif
|
||||
|
||||
#include <assert.h>
|
||||
#include <new>
|
||||
#include "AnvilTile_SPU.h"
|
||||
|
||||
TileData_SPU* Tile_SPU::ms_pTileData = NULL;
|
||||
|
||||
Tile_SPU Tile_SPU::m_tiles[256];
|
||||
|
||||
|
||||
|
||||
int Tile_SPU::getRenderShape()
|
||||
{
|
||||
return SHAPE_BLOCK;
|
||||
}
|
||||
|
||||
|
||||
void Tile_SPU::setShape(float x0, float y0, float z0, float x1, float y1, float z1)
|
||||
{
|
||||
ms_pTileData->xx0[id] = x0;
|
||||
ms_pTileData->yy0[id] = y0;
|
||||
ms_pTileData->zz0[id] = z0;
|
||||
ms_pTileData->xx1[id] = x1;
|
||||
ms_pTileData->yy1[id] = y1;
|
||||
ms_pTileData->zz1[id] = z1;
|
||||
}
|
||||
|
||||
float Tile_SPU::getBrightness(ChunkRebuildData *level, int x, int y, int z)
|
||||
{
|
||||
return level->getBrightness(x, y, z, ms_pTileData->lightEmission[id]);
|
||||
}
|
||||
//
|
||||
// // 4J - brought forward from 1.8.2
|
||||
int Tile_SPU::getLightColor(ChunkRebuildData *level, int x, int y, int z)
|
||||
{
|
||||
int tileID = level->getTile(x, y, z);
|
||||
return level->getLightColor(x, y, z, ms_pTileData->lightEmission[tileID]);
|
||||
}
|
||||
//
|
||||
// bool Tile_SPU::isFaceVisible(Level *level, int x, int y, int z, int f)
|
||||
// {
|
||||
// if (f == 0) y--;
|
||||
// if (f == 1) y++;
|
||||
// if (f == 2) z--;
|
||||
// if (f == 3) z++;
|
||||
// if (f == 4) x--;
|
||||
// if (f == 5) x++;
|
||||
// return !level->isSolidRenderTile(x, y, z);
|
||||
// }
|
||||
//
|
||||
bool Tile_SPU::shouldRenderFace(ChunkRebuildData *level, int x, int y, int z, int face)
|
||||
{
|
||||
if (face == 0 && getShapeY0() > 0) return true;
|
||||
if (face == 1 && getShapeY1() < 1) return true;
|
||||
if (face == 2 && getShapeZ0() > 0) return true;
|
||||
if (face == 3 && getShapeZ1() < 1) return true;
|
||||
if (face == 4 && getShapeX0() > 0) return true;
|
||||
if (face == 5 && getShapeX1() < 1) return true;
|
||||
return (!level->isSolidRenderTile(x, y, z));
|
||||
}
|
||||
//
|
||||
bool Tile_SPU::isSolidFace(ChunkRebuildData *level, int x, int y, int z, int face)
|
||||
{
|
||||
return (level->getMaterial(x, y, z)->isSolid());
|
||||
}
|
||||
|
||||
Icon_SPU *Tile_SPU::getTexture(ChunkRebuildData *level, int x, int y, int z, int face)
|
||||
{
|
||||
// 4J - addition here to make rendering big blocks of leaves more efficient. Normally leaves never consider themselves as solid, so
|
||||
// blocks of leaves will have all sides of each block completely visible. Changing to consider as solid if this block is surrounded by
|
||||
// other leaves. This is paired with another change in Level::isSolidRenderTile/Region::isSolidRenderTile which makes things solid
|
||||
// code-wise (ie for determining visible sides of neighbouring blocks). This change just makes the texture a solid one (tex + 1) which
|
||||
// we already have in the texture map for doing non-fancy graphics. Note: this tile-specific code is here rather than making some new virtual
|
||||
// method in the tiles, for the sake of efficiency - I don't imagine we'll be doing much more of this sort of thing
|
||||
|
||||
int tileId = level->getTile(x, y, z);
|
||||
int tileData = level->getData(x, y, z);
|
||||
|
||||
if( tileId == Tile_SPU::leaves_Id )
|
||||
{
|
||||
bool opaque = true;
|
||||
int axo[6] = { 1,-1, 0, 0, 0, 0};
|
||||
int ayo[6] = { 0, 0, 1,-1, 0, 0};
|
||||
int azo[6] = { 0, 0, 0, 0, 1,-1};
|
||||
for( int i = 0; (i < 6) && opaque; i++ )
|
||||
{
|
||||
int t = level->getTile(x + axo[i], y + ayo[i] , z + azo[i]);
|
||||
if( ( t != Tile_SPU::leaves_Id ) && ( ( Tile_SPU::m_tiles[t].id == -1) || !Tile_SPU::m_tiles[t].isSolidRender() ) )
|
||||
{
|
||||
opaque = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Icon_SPU *icon = NULL;
|
||||
if(opaque)
|
||||
{
|
||||
LeafTile_SPU::setFancy(false);
|
||||
icon = getTexture(face, tileData);
|
||||
LeafTile_SPU::setFancy(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
icon = getTexture(face, tileData);
|
||||
}
|
||||
return icon;
|
||||
}
|
||||
return getTexture(face, tileData);
|
||||
}
|
||||
//
|
||||
Icon_SPU *Tile_SPU::getTexture(int face, int data)
|
||||
{
|
||||
return &ms_pTileData->iconData[id];
|
||||
}
|
||||
//
|
||||
Icon_SPU *Tile_SPU::getTexture(int face)
|
||||
{
|
||||
return getTexture(face, 0);
|
||||
}
|
||||
//
|
||||
// AABB *Tile_SPU::getTileAABB(Level *level, int x, int y, int z)
|
||||
// {
|
||||
// return AABB::newTemp(x + xx0, y + yy0, z + zz0, x + xx1, y + yy1, z + zz1);
|
||||
// }
|
||||
//
|
||||
// void Tile_SPU::addAABBs(Level *level, int x, int y, int z, AABB *box, AABBList *boxes, Entity *source)
|
||||
// {
|
||||
// AABB *aabb = getAABB(level, x, y, z);
|
||||
// if (aabb != NULL && box->intersects(aabb)) boxes->push_back(aabb);
|
||||
// }
|
||||
//
|
||||
// void Tile_SPU::addAABBs(Level *level, int x, int y, int z, AABB *box, AABBList *boxes)
|
||||
// {
|
||||
// AABB *aabb = getAABB(level, x, y, z);
|
||||
// if (aabb != NULL && box->intersects(aabb)) boxes->push_back(aabb);
|
||||
// }
|
||||
//
|
||||
// AABB *Tile_SPU::getAABB(Level *level, int x, int y, int z)
|
||||
// {
|
||||
// return AABB::newTemp(x + xx0, y + yy0, z + zz0, x + xx1, y + yy1, z + zz1);
|
||||
// }
|
||||
//
|
||||
bool Tile_SPU::isSolidRender(bool isServerLevel)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// bool Tile_SPU::mayPick(int data, bool liquid)
|
||||
// {
|
||||
// return mayPick();
|
||||
// }
|
||||
//
|
||||
// bool Tile_SPU::mayPick()
|
||||
// {
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
// void Tile_SPU::tick(Level *level, int x, int y, int z, Random *random)
|
||||
// {
|
||||
// }
|
||||
//
|
||||
// void Tile_SPU::animateTick(Level *level, int x, int y, int z, Random *random)
|
||||
// {
|
||||
// }
|
||||
//
|
||||
// void Tile_SPU::destroy(Level *level, int x, int y, int z, int data)
|
||||
// {
|
||||
// }
|
||||
//
|
||||
// void Tile_SPU::neighborChanged(Level *level, int x, int y, int z, int type)
|
||||
// {
|
||||
// }
|
||||
//
|
||||
// void Tile_SPU::addLights(Level *level, int x, int y, int z)
|
||||
// {
|
||||
// }
|
||||
//
|
||||
// int Tile_SPU::getTickDelay()
|
||||
// {
|
||||
// return 10;
|
||||
// }
|
||||
//
|
||||
// void Tile_SPU::onPlace(Level *level, int x, int y, int z)
|
||||
// {
|
||||
// }
|
||||
//
|
||||
// void Tile_SPU::onRemove(Level *level, int x, int y, int z)
|
||||
// {
|
||||
// }
|
||||
//
|
||||
// int Tile_SPU::getResourceCount(Random *random)
|
||||
// {
|
||||
// return 1;
|
||||
// }
|
||||
//
|
||||
// int Tile_SPU::getResource(int data, Random *random, int playerBonusLevel)
|
||||
// {
|
||||
// return id;
|
||||
// }
|
||||
//
|
||||
// float Tile_SPU::getDestroyProgress(shared_ptr<Player> player)
|
||||
// {
|
||||
// if (destroySpeed < 0) return 0;
|
||||
// if (!player->canDestroy(this)) return 1 / destroySpeed / 100.0f;
|
||||
// return (player->getDestroySpeed(this) / destroySpeed) / 30;
|
||||
// }
|
||||
//
|
||||
// void Tile_SPU::spawnResources(Level *level, int x, int y, int z, int data, int playerBonusLevel)
|
||||
// {
|
||||
// spawnResources(level, x, y, z, data, 1, playerBonusLevel);
|
||||
// }
|
||||
//
|
||||
// void Tile_SPU::spawnResources(Level *level, int x, int y, int z, int data, float odds, int playerBonusLevel)
|
||||
// {
|
||||
// if (level->isClientSide) return;
|
||||
// int count = getResourceCountForLootBonus(playerBonusLevel, level->random);
|
||||
// for (int i = 0; i < count; i++)
|
||||
// {
|
||||
// if (level->random->nextFloat() > odds) continue;
|
||||
// int type = getResource(data, level->random, playerBonusLevel);
|
||||
// if (type <= 0) continue;
|
||||
//
|
||||
// popResource(level, x, y, z, shared_ptr<ItemInstance>( new ItemInstance(type, 1, getSpawnResourcesAuxValue(data) ) ) );
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// void Tile_SPU::popResource(Level *level, int x, int y, int z, shared_ptr<ItemInstance> itemInstance)
|
||||
// {
|
||||
// if( level->isClientSide ) return;
|
||||
//
|
||||
// float s = 0.7f;
|
||||
// double xo = level->random->nextFloat() * s + (1 - s) * 0.5;
|
||||
// double yo = level->random->nextFloat() * s + (1 - s) * 0.5;
|
||||
// double zo = level->random->nextFloat() * s + (1 - s) * 0.5;
|
||||
// shared_ptr<ItemEntity> item = shared_ptr<ItemEntity>( new ItemEntity(level, x + xo, y + yo, z + zo, itemInstance ) );
|
||||
// item->throwTime = 10;
|
||||
// level->addEntity(item);
|
||||
// }
|
||||
//
|
||||
// // Brought forward for TU7
|
||||
// void Tile_SPU::popExperience(Level *level, int x, int y, int z, int amount)
|
||||
// {
|
||||
// if (!level->isClientSide)
|
||||
// {
|
||||
// while (amount > 0)
|
||||
// {
|
||||
// int newCount = ExperienceOrb::getExperienceValue(amount);
|
||||
// amount -= newCount;
|
||||
// level->addEntity(shared_ptr<ExperienceOrb>( new ExperienceOrb(level, x + .5, y + .5, z + .5, newCount)));
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// int Tile_SPU::getSpawnResourcesAuxValue(int data)
|
||||
// {
|
||||
// return 0;
|
||||
// }
|
||||
//
|
||||
// float Tile_SPU::getExplosionResistance(shared_ptr<Entity> source)
|
||||
// {
|
||||
// return explosionResistance / 5.0f;
|
||||
// }
|
||||
//
|
||||
// HitResult *Tile_SPU::clip(Level *level, int xt, int yt, int zt, Vec3 *a, Vec3 *b)
|
||||
// {
|
||||
// EnterCriticalSection(&m_csShape);
|
||||
// updateShape(level, xt, yt, zt);
|
||||
//
|
||||
// a = a->add(-xt, -yt, -zt);
|
||||
// b = b->add(-xt, -yt, -zt);
|
||||
//
|
||||
// Vec3 *xh0 = a->clipX(b, xx0);
|
||||
// Vec3 *xh1 = a->clipX(b, xx1);
|
||||
//
|
||||
// Vec3 *yh0 = a->clipY(b, yy0);
|
||||
// Vec3 *yh1 = a->clipY(b, yy1);
|
||||
//
|
||||
// Vec3 *zh0 = a->clipZ(b, zz0);
|
||||
// Vec3 *zh1 = a->clipZ(b, zz1);
|
||||
//
|
||||
// Vec3 *closest = NULL;
|
||||
//
|
||||
// if (containsX(xh0) && (closest == NULL || a->distanceTo(xh0) < a->distanceTo(closest))) closest = xh0;
|
||||
// if (containsX(xh1) && (closest == NULL || a->distanceTo(xh1) < a->distanceTo(closest))) closest = xh1;
|
||||
// if (containsY(yh0) && (closest == NULL || a->distanceTo(yh0) < a->distanceTo(closest))) closest = yh0;
|
||||
// if (containsY(yh1) && (closest == NULL || a->distanceTo(yh1) < a->distanceTo(closest))) closest = yh1;
|
||||
// if (containsZ(zh0) && (closest == NULL || a->distanceTo(zh0) < a->distanceTo(closest))) closest = zh0;
|
||||
// if (containsZ(zh1) && (closest == NULL || a->distanceTo(zh1) < a->distanceTo(closest))) closest = zh1;
|
||||
//
|
||||
// LeaveCriticalSection(&m_csShape);
|
||||
//
|
||||
// if (closest == NULL) return NULL;
|
||||
//
|
||||
// int face = -1;
|
||||
//
|
||||
// if (closest == xh0) face = 4;
|
||||
// if (closest == xh1) face = 5;
|
||||
// if (closest == yh0) face = 0;
|
||||
// if (closest == yh1) face = 1;
|
||||
// if (closest == zh0) face = 2;
|
||||
// if (closest == zh1) face = 3;
|
||||
//
|
||||
// return new HitResult(xt, yt, zt, face, closest->add(xt, yt, zt));
|
||||
// }
|
||||
//
|
||||
// bool Tile_SPU::containsX(Vec3 *v)
|
||||
// {
|
||||
// if( v == NULL) return false;
|
||||
// return v->y >= yy0 && v->y <= yy1 && v->z >= zz0 && v->z <= zz1;
|
||||
// }
|
||||
//
|
||||
// bool Tile_SPU::containsY(Vec3 *v)
|
||||
// {
|
||||
// if( v == NULL) return false;
|
||||
// return v->x >= xx0 && v->x <= xx1 && v->z >= zz0 && v->z <= zz1;
|
||||
// }
|
||||
//
|
||||
// bool Tile_SPU::containsZ(Vec3 *v)
|
||||
// {
|
||||
// if( v == NULL) return false;
|
||||
// return v->x >= xx0 && v->x <= xx1 && v->y >= yy0 && v->y <= yy1;
|
||||
// }
|
||||
//
|
||||
// void Tile_SPU::wasExploded(Level *level, int x, int y, int z)
|
||||
// {
|
||||
// }
|
||||
//
|
||||
int Tile_SPU::getRenderLayer()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
//
|
||||
// bool Tile_SPU::mayPlace(Level *level, int x, int y, int z, int face)
|
||||
// {
|
||||
// return mayPlace(level, x, y, z);
|
||||
// }
|
||||
//
|
||||
// bool Tile_SPU::mayPlace(Level *level, int x, int y, int z)
|
||||
// {
|
||||
// int t = level->getTile(x, y, z);
|
||||
// return t == 0 || Tile_SPU::tiles[t]->material->isReplaceable();
|
||||
// }
|
||||
//
|
||||
// // 4J-PB - Adding a TestUse for tooltip display
|
||||
// bool Tile_SPU::TestUse()
|
||||
// {
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// bool Tile_SPU::TestUse(Level *level, int x, int y, int z, shared_ptr<Player> player)
|
||||
// {
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// bool Tile_SPU::use(Level *level, int x, int y, int z, shared_ptr<Player> player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly/*=false*/) // 4J added soundOnly param
|
||||
// {
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// void Tile_SPU::stepOn(Level *level, int x, int y, int z, shared_ptr<Entity> entity)
|
||||
// {
|
||||
// }
|
||||
//
|
||||
// void Tile_SPU::setPlacedOnFace(Level *level, int x, int y, int z, int face)
|
||||
// {
|
||||
// }
|
||||
//
|
||||
// void Tile_SPU::prepareRender(Level *level, int x, int y, int z)
|
||||
// {
|
||||
// }
|
||||
//
|
||||
// void Tile_SPU::attack(Level *level, int x, int y, int z, shared_ptr<Player> player)
|
||||
// {
|
||||
// }
|
||||
//
|
||||
// void Tile_SPU::handleEntityInside(Level *level, int x, int y, int z, shared_ptr<Entity> e, Vec3 *current)
|
||||
// {
|
||||
// }
|
||||
//
|
||||
void Tile_SPU::updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData, TileEntity* forceEntity) // 4J added forceData, forceEntity param
|
||||
{
|
||||
}
|
||||
//
|
||||
|
||||
int Tile_SPU::getColor(ChunkRebuildData *level, int x, int y, int z)
|
||||
{
|
||||
return 0xffffff;
|
||||
}
|
||||
|
||||
//
|
||||
// int Tile_SPU::getColor(LevelSource *level, int x, int y, int z, int data)
|
||||
// {
|
||||
// return 0xffffff;
|
||||
// }
|
||||
//
|
||||
// bool Tile_SPU::getSignal(LevelSource *level, int x, int y, int z)
|
||||
// {
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// bool Tile_SPU::getSignal(LevelSource *level, int x, int y, int z, int dir)
|
||||
// {
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// bool Tile_SPU::isSignalSource()
|
||||
// {
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// void Tile_SPU::entityInside(Level *level, int x, int y, int z, shared_ptr<Entity> entity)
|
||||
// {
|
||||
// }
|
||||
//
|
||||
// bool Tile_SPU::getDirectSignal(Level *level, int x, int y, int z, int dir)
|
||||
// {
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
void Tile_SPU::updateDefaultShape()
|
||||
{
|
||||
}
|
||||
//
|
||||
// void Tile_SPU::playerDestroy(Level *level, shared_ptr<Player> player, int x, int y, int z, int data)
|
||||
// {
|
||||
// // 4J Stu - Special case - only record a crop destroy if is fully grown
|
||||
// if(id==Tile_SPU::crops_Id)
|
||||
// {
|
||||
// if( Tile_SPU::crops->getResource(data, NULL, 0) > 0 )
|
||||
// player->awardStat(Stats::blocksMined[id], 1);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// player->awardStat(Stats::blocksMined[id], 1);
|
||||
// }
|
||||
// player->awardStat(Stats::totalBlocksMined, 1); // 4J : WESTY : Added for other award.
|
||||
// player->causeFoodExhaustion(FoodConstants::EXHAUSTION_MINE);
|
||||
//
|
||||
// if( id == Tile_SPU::treeTrunk_Id )
|
||||
// player->awardStat(Achievements::mineWood);
|
||||
//
|
||||
//
|
||||
// if (isCubeShaped() && !isEntityTile[id] && EnchantmentHelper::hasSilkTouch(player->inventory))
|
||||
// {
|
||||
// shared_ptr<ItemInstance> item = getSilkTouchItemInstance(data);
|
||||
// if (item != NULL)
|
||||
// {
|
||||
// popResource(level, x, y, z, item);
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// int playerBonusLevel = EnchantmentHelper::getDiggingLootBonus(player->inventory);
|
||||
// spawnResources(level, x, y, z, data, playerBonusLevel);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// shared_ptr<ItemInstance> Tile_SPU::getSilkTouchItemInstance(int data)
|
||||
// {
|
||||
// int popData = 0;
|
||||
// if (id >= 0 && id < Item::items.length && Item::items[id]->isStackedByData())
|
||||
// {
|
||||
// popData = data;
|
||||
// }
|
||||
// return shared_ptr<ItemInstance>(new ItemInstance(id, 1, popData));
|
||||
// }
|
||||
//
|
||||
// int Tile_SPU::getResourceCountForLootBonus(int bonusLevel, Random *random)
|
||||
// {
|
||||
// return getResourceCount(random);
|
||||
// }
|
||||
//
|
||||
// bool Tile_SPU::canSurvive(Level *level, int x, int y, int z)
|
||||
// {
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
// void Tile_SPU::setPlacedBy(Level *level, int x, int y, int z, shared_ptr<Mob> by)
|
||||
// {
|
||||
// }
|
||||
//
|
||||
// Tile *Tile_SPU::setDescriptionId(unsigned int id)
|
||||
// {
|
||||
// this->descriptionId = id;
|
||||
// return this;
|
||||
// }
|
||||
//
|
||||
// wstring Tile_SPU::getName()
|
||||
// {
|
||||
// return I18n::get(getDescriptionId() + L".name");
|
||||
// }
|
||||
//
|
||||
// unsigned int Tile_SPU::getDescriptionId(int iData /*= -1*/)
|
||||
// {
|
||||
// return descriptionId;
|
||||
// }
|
||||
//
|
||||
// Tile *Tile_SPU::setUseDescriptionId(unsigned int id)
|
||||
// {
|
||||
// this->useDescriptionId = id;
|
||||
// return this;
|
||||
// }
|
||||
//
|
||||
// unsigned int Tile_SPU::getUseDescriptionId()
|
||||
// {
|
||||
// return useDescriptionId;
|
||||
// }
|
||||
//
|
||||
// void Tile_SPU::triggerEvent(Level *level, int x, int y, int z, int b0, int b1)
|
||||
// {
|
||||
// }
|
||||
//
|
||||
// bool Tile_SPU::isCollectStatistics()
|
||||
// {
|
||||
// return collectStatistics;
|
||||
// }
|
||||
//
|
||||
// Tile *Tile_SPU::setNotCollectStatistics()
|
||||
// {
|
||||
// collectStatistics = false;
|
||||
// return this;
|
||||
// }
|
||||
//
|
||||
// int Tile_SPU::getPistonPushReaction()
|
||||
// {
|
||||
// return material->getPushReaction();
|
||||
// }
|
||||
//
|
||||
// // 4J - brought forward from 1.8.2
|
||||
float Tile_SPU::getShadeBrightness(ChunkRebuildData *level, int x, int y, int z)
|
||||
{
|
||||
return level->isSolidBlockingTile(x, y, z) ? 0.2f : 1.0f;
|
||||
}
|
||||
|
||||
Tile_SPU* Tile_SPU::createFromID( int tileID )
|
||||
{
|
||||
if(tileID == 0)
|
||||
return NULL;
|
||||
|
||||
if(m_tiles[tileID].id != -1)
|
||||
return &m_tiles[tileID];
|
||||
|
||||
#ifndef SN_TARGET_PS3_SPU
|
||||
app.DebugPrintf("missing tile ID %d\n", tileID);
|
||||
#else
|
||||
spu_print("missing tile ID %d\n", tileID);
|
||||
#endif
|
||||
return &m_tiles[1];
|
||||
|
||||
}
|
||||
|
||||
Material_SPU* Tile_SPU::getMaterial()
|
||||
{
|
||||
int matID = ms_pTileData->materialIDs[id];
|
||||
return &ms_pTileData->materials[matID];
|
||||
}
|
||||
|
||||
//
|
||||
// void Tile_SPU::fallOn(Level *level, int x, int y, int z, shared_ptr<Entity> entity, float fallDistance)
|
||||
// {
|
||||
// }
|
||||
//
|
||||
// void Tile_SPU::registerIcons(IconRegister *iconRegister)
|
||||
// {
|
||||
// icon = iconRegister->registerIcon(m_textureName);
|
||||
// }
|
||||
//
|
||||
// wstring Tile_SPU::getTileItemIconName()
|
||||
// {
|
||||
// return L"";
|
||||
// }
|
||||
//
|
||||
// Tile *Tile_SPU::setTextureName(const wstring &name)
|
||||
// {
|
||||
// m_textureName = name;
|
||||
// return this;
|
||||
// }
|
||||
|
||||
|
||||
|
||||
void Tile_SPU::initTilePointers()
|
||||
{
|
||||
|
||||
#define CREATE_TILE_TYPE(index, className) new (&m_tiles[index]) className(index);
|
||||
|
||||
|
||||
CREATE_TILE_TYPE(grass_Id, GrassTile_SPU);
|
||||
CREATE_TILE_TYPE(stoneSlab_Id, StoneSlabTile_SPU);
|
||||
CREATE_TILE_TYPE(stoneSlabHalf_Id, StoneSlabTile_SPU);
|
||||
CREATE_TILE_TYPE(woodSlab_Id, WoodSlabTile_SPU);
|
||||
CREATE_TILE_TYPE(woodSlabHalf_Id, WoodSlabTile_SPU);
|
||||
|
||||
CREATE_TILE_TYPE(chest_Id, ChestTile_SPU);
|
||||
|
||||
CREATE_TILE_TYPE(ironFence_Id, ThinFenceTile_SPU);
|
||||
CREATE_TILE_TYPE(thinGlass_Id, ThinFenceTile_SPU);
|
||||
|
||||
CREATE_TILE_TYPE(fence_Id, FenceTile_SPU);
|
||||
CREATE_TILE_TYPE(netherFence_Id, FenceTile_SPU);
|
||||
|
||||
CREATE_TILE_TYPE(stairs_wood_Id, StairTile_SPU);
|
||||
CREATE_TILE_TYPE(stairs_stone_Id, StairTile_SPU);
|
||||
CREATE_TILE_TYPE(stairs_bricks_Id, StairTile_SPU);
|
||||
CREATE_TILE_TYPE(stairs_stoneBrickSmooth_Id, StairTile_SPU);
|
||||
CREATE_TILE_TYPE(stairs_netherBricks_Id, StairTile_SPU);
|
||||
CREATE_TILE_TYPE(stairs_sandstone_Id, StairTile_SPU);
|
||||
CREATE_TILE_TYPE(stairs_sprucewood_Id, StairTile_SPU);
|
||||
CREATE_TILE_TYPE(stairs_birchwood_Id, StairTile_SPU);
|
||||
CREATE_TILE_TYPE(stairs_junglewood_Id, StairTile_SPU);
|
||||
|
||||
CREATE_TILE_TYPE(dirt_Id, DirtTile_SPU);
|
||||
|
||||
CREATE_TILE_TYPE(door_iron_Id, DoorTile_SPU);
|
||||
CREATE_TILE_TYPE(door_wood_Id, DoorTile_SPU);
|
||||
|
||||
CREATE_TILE_TYPE(pressurePlate_stone_Id, PressurePlateTile_SPU);
|
||||
CREATE_TILE_TYPE(pressurePlate_wood_Id, PressurePlateTile_SPU);
|
||||
|
||||
CREATE_TILE_TYPE(farmland_Id, FarmTile_SPU);
|
||||
|
||||
CREATE_TILE_TYPE(flower_Id, Bush_SPU);
|
||||
CREATE_TILE_TYPE(rose_Id, Bush_SPU);
|
||||
CREATE_TILE_TYPE(deadBush_Id, Bush_SPU); // DeadBushTile
|
||||
|
||||
CREATE_TILE_TYPE(tallgrass_Id, TallGrass_SPU);
|
||||
|
||||
CREATE_TILE_TYPE(sandStone_Id, SandStoneTile_SPU);
|
||||
|
||||
CREATE_TILE_TYPE(wood_Id, WoodTile_SPU);
|
||||
|
||||
CREATE_TILE_TYPE(treeTrunk_Id, TreeTile_SPU);
|
||||
|
||||
CREATE_TILE_TYPE(leaves_Id, LeafTile_SPU);
|
||||
|
||||
CREATE_TILE_TYPE(crops_Id, CropTile_SPU);
|
||||
|
||||
CREATE_TILE_TYPE(reeds_Id, ReedTile_SPU);
|
||||
|
||||
CREATE_TILE_TYPE(torch_Id, TorchTile_SPU);
|
||||
CREATE_TILE_TYPE(notGate_off_Id, TorchTile_SPU); // TorchTile->NotGateTile
|
||||
CREATE_TILE_TYPE(notGate_on_Id, TorchTile_SPU); // TorchTile->NotGateTile
|
||||
|
||||
CREATE_TILE_TYPE(mushroom1_Id, Mushroom_SPU);
|
||||
CREATE_TILE_TYPE(mushroom2_Id, Mushroom_SPU);
|
||||
|
||||
CREATE_TILE_TYPE(mobSpawner_Id, MobSpawnerTile_SPU);
|
||||
CREATE_TILE_TYPE(musicBlock_Id, EntityTile_SPU); // MusicTile->EntityTile
|
||||
|
||||
CREATE_TILE_TYPE(furnace_Id, FurnaceTile_SPU);
|
||||
CREATE_TILE_TYPE(furnace_lit_Id, FurnaceTile_SPU);
|
||||
|
||||
CREATE_TILE_TYPE(web_Id, WebTile_SPU);
|
||||
|
||||
CREATE_TILE_TYPE(water_Id, LiquidTile_SPU);
|
||||
CREATE_TILE_TYPE(lava_Id, LiquidTile_SPU);
|
||||
CREATE_TILE_TYPE(calmLava_Id, LiquidTile_SPU); // LiquidTileStatic
|
||||
CREATE_TILE_TYPE(calmWater_Id, LiquidTile_SPU); // LiquidTileStatic
|
||||
|
||||
CREATE_TILE_TYPE(fire_Id, FireTile_SPU);
|
||||
|
||||
CREATE_TILE_TYPE(sapling_Id, Sapling_SPU);
|
||||
|
||||
CREATE_TILE_TYPE(glass_Id, GlassTile_SPU);
|
||||
|
||||
CREATE_TILE_TYPE(ice_Id, IceTile_SPU);
|
||||
|
||||
CREATE_TILE_TYPE(portalTile_Id, PortalTile_SPU);
|
||||
|
||||
CREATE_TILE_TYPE(dispenser_Id, DispenserTile_SPU);
|
||||
|
||||
CREATE_TILE_TYPE(rail_Id, RailTile_SPU);
|
||||
CREATE_TILE_TYPE(goldenRail_Id, RailTile_SPU);
|
||||
|
||||
CREATE_TILE_TYPE(detectorRail_Id, DetectorRailTile_SPU);
|
||||
|
||||
CREATE_TILE_TYPE(tnt_Id, TntTile_SPU);
|
||||
|
||||
CREATE_TILE_TYPE(bookshelf_Id, BookshelfTile_SPU);
|
||||
|
||||
CREATE_TILE_TYPE(workBench_Id, WorkbenchTile_SPU);
|
||||
|
||||
CREATE_TILE_TYPE(sign_Id, SignTile_SPU);
|
||||
CREATE_TILE_TYPE(wallSign_Id, SignTile_SPU);
|
||||
|
||||
CREATE_TILE_TYPE(ladder_Id, LadderTile_SPU);
|
||||
|
||||
CREATE_TILE_TYPE(button_stone_Id, ButtonTile_SPU);
|
||||
CREATE_TILE_TYPE(button_wood_Id, ButtonTile_SPU);
|
||||
|
||||
CREATE_TILE_TYPE(topSnow_Id, TopSnowTile_SPU);
|
||||
|
||||
CREATE_TILE_TYPE(cactus_Id, CactusTile_SPU);
|
||||
|
||||
CREATE_TILE_TYPE(recordPlayer_Id, RecordPlayerTile_SPU);
|
||||
|
||||
CREATE_TILE_TYPE(pumpkin_Id, PumpkinTile_SPU);
|
||||
CREATE_TILE_TYPE(litPumpkin_Id, PumpkinTile_SPU);
|
||||
|
||||
CREATE_TILE_TYPE(cake_Id, CakeTile_SPU);
|
||||
|
||||
CREATE_TILE_TYPE(trapdoor_Id, TrapDoorTile_SPU);
|
||||
|
||||
CREATE_TILE_TYPE(monsterStoneEgg_Id, StoneMonsterTile_SPU);
|
||||
|
||||
CREATE_TILE_TYPE(stoneBrickSmooth_Id, SmoothStoneBrickTile_SPU);
|
||||
|
||||
CREATE_TILE_TYPE(hugeMushroom1_Id, HugeMushroomTile_SPU);
|
||||
CREATE_TILE_TYPE(hugeMushroom2_Id, HugeMushroomTile_SPU);
|
||||
|
||||
CREATE_TILE_TYPE(melon_Id, MelonTile_SPU);
|
||||
|
||||
CREATE_TILE_TYPE(melonStem_Id, StemTile_SPU);
|
||||
CREATE_TILE_TYPE(pumpkinStem_Id, StemTile_SPU);
|
||||
|
||||
CREATE_TILE_TYPE(vine_Id, VineTile_SPU);
|
||||
|
||||
CREATE_TILE_TYPE(mycel_Id, MycelTile_SPU);
|
||||
|
||||
CREATE_TILE_TYPE(waterLily_Id, WaterlilyTile_SPU);
|
||||
|
||||
CREATE_TILE_TYPE(netherStalk_Id, NetherStalkTile_SPU);
|
||||
|
||||
CREATE_TILE_TYPE(enchantTable_Id, EnchantmentTableTile_SPU);
|
||||
|
||||
CREATE_TILE_TYPE(brewingStand_Id, BrewingStandTile_SPU);
|
||||
|
||||
CREATE_TILE_TYPE(diode_on_Id, DiodeTile_SPU);
|
||||
CREATE_TILE_TYPE(diode_off_Id, DiodeTile_SPU);
|
||||
|
||||
CREATE_TILE_TYPE(redStoneDust_Id, RedStoneDustTile_SPU);
|
||||
|
||||
CREATE_TILE_TYPE(fenceGate_Id, FenceGateTile_SPU);
|
||||
|
||||
CREATE_TILE_TYPE(bed_Id, BedTile_SPU);
|
||||
|
||||
CREATE_TILE_TYPE(pistonBase_Id, PistonBaseTile_SPU);
|
||||
CREATE_TILE_TYPE(pistonStickyBase_Id, PistonBaseTile_SPU);
|
||||
|
||||
CREATE_TILE_TYPE(pistonExtensionPiece_Id, PistonExtensionTile_SPU);
|
||||
|
||||
CREATE_TILE_TYPE(pistonMovingPiece_Id, PistonMovingPiece_SPU);
|
||||
|
||||
CREATE_TILE_TYPE(lever_Id, LeverTile_SPU);
|
||||
|
||||
CREATE_TILE_TYPE(cauldron_Id, CauldronTile_SPU);
|
||||
|
||||
CREATE_TILE_TYPE(endPortalTile_Id, TheEndPortal_SPU);
|
||||
|
||||
CREATE_TILE_TYPE(endPortalFrameTile_Id, TheEndPortalFrameTile_SPU);
|
||||
|
||||
CREATE_TILE_TYPE(dragonEgg_Id, EggTile_SPU);
|
||||
|
||||
CREATE_TILE_TYPE(cocoa_Id, CocoaTile_SPU);
|
||||
|
||||
CREATE_TILE_TYPE(redstoneLight_Id, RedlightTile_SPU);
|
||||
CREATE_TILE_TYPE(redstoneLight_lit_Id, RedlightTile_SPU);
|
||||
|
||||
CREATE_TILE_TYPE(skull_Id, SkullTile_SPU);
|
||||
|
||||
// these tile types don't have any additional code that we need.
|
||||
CREATE_TILE_TYPE(stoneBrick_Id, Tile_SPU); // Tile
|
||||
CREATE_TILE_TYPE(lapisBlock_Id, Tile_SPU);
|
||||
CREATE_TILE_TYPE(redBrick_Id, Tile_SPU);
|
||||
CREATE_TILE_TYPE(mossStone_Id, Tile_SPU);
|
||||
CREATE_TILE_TYPE(netherBrick_Id, Tile_SPU);
|
||||
CREATE_TILE_TYPE(whiteStone_Id, Tile_SPU);
|
||||
CREATE_TILE_TYPE(unbreakable_Id, Tile_SPU);
|
||||
CREATE_TILE_TYPE(sponge_Id, Tile_SPU);
|
||||
CREATE_TILE_TYPE(rock_Id, Tile_SPU); // StoneTile
|
||||
CREATE_TILE_TYPE(obsidian_Id, Tile_SPU); // StoneTile->ObsidianTile
|
||||
CREATE_TILE_TYPE(sand_Id, Tile_SPU); // HeavyTile
|
||||
CREATE_TILE_TYPE(gravel_Id, Tile_SPU); // GravelTile
|
||||
CREATE_TILE_TYPE(goldOre_Id, Tile_SPU); // OreTile
|
||||
CREATE_TILE_TYPE(ironOre_Id, Tile_SPU); // OreTile
|
||||
CREATE_TILE_TYPE(coalOre_Id, Tile_SPU); // OreTile
|
||||
CREATE_TILE_TYPE(lapisOre_Id, Tile_SPU); // OreTile
|
||||
CREATE_TILE_TYPE(diamondOre_Id, Tile_SPU); // OreTile
|
||||
CREATE_TILE_TYPE(clay_Id, Tile_SPU); // ClayTile
|
||||
CREATE_TILE_TYPE(redStoneOre_Id, Tile_SPU); // RedStoneOreTile
|
||||
CREATE_TILE_TYPE(redStoneOre_lit_Id, Tile_SPU); // RedStoneOreTile
|
||||
CREATE_TILE_TYPE(goldBlock_Id, Tile_SPU); // MetalTile
|
||||
CREATE_TILE_TYPE(ironBlock_Id, Tile_SPU); // MetalTile
|
||||
CREATE_TILE_TYPE(diamondBlock_Id, Tile_SPU); // MetalTile
|
||||
CREATE_TILE_TYPE(snow_Id, Tile_SPU); // SnowTile
|
||||
CREATE_TILE_TYPE(hellRock_Id, Tile_SPU); // HellStoneTile
|
||||
CREATE_TILE_TYPE(hellSand_Id, Tile_SPU); // HellSandTile
|
||||
CREATE_TILE_TYPE(lightGem_Id, Tile_SPU); // LightGemTile
|
||||
CREATE_TILE_TYPE(aprilFoolsJoke_Id, Tile_SPU); // LockedChestTile
|
||||
|
||||
CREATE_TILE_TYPE(cloth_Id, ClothTile_SPU); // wool
|
||||
|
||||
|
||||
CREATE_TILE_TYPE(emeraldOre_Id, Tile_SPU); // OreTile
|
||||
CREATE_TILE_TYPE(enderChest_Id, EnderChestTile_SPU);
|
||||
CREATE_TILE_TYPE(tripWireSource_Id, TripWireSourceTile_SPU);
|
||||
CREATE_TILE_TYPE(tripWire_Id, TripWireTile_SPU);
|
||||
//
|
||||
CREATE_TILE_TYPE(emeraldBlock_Id, Tile_SPU); // MetalTile
|
||||
CREATE_TILE_TYPE(cobbleWall_Id, WallTile_SPU);
|
||||
CREATE_TILE_TYPE(flowerPot_Id, FlowerPotTile_SPU);
|
||||
CREATE_TILE_TYPE(carrots_Id, CarrotTile_SPU);
|
||||
CREATE_TILE_TYPE(potatoes_Id, PotatoTile_SPU);
|
||||
CREATE_TILE_TYPE(anvil_Id, AnvilTile_SPU);
|
||||
CREATE_TILE_TYPE(netherQuartz_Id, Tile_SPU); // OreTile
|
||||
CREATE_TILE_TYPE(quartzBlock_Id, QuartzBlockTile_SPU);
|
||||
CREATE_TILE_TYPE(stairs_quartz_Id, StairTile_SPU);
|
||||
CREATE_TILE_TYPE(woolCarpet_Id, WoolCarpetTile_SPU);
|
||||
|
||||
};
|
||||
510
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/Tile_SPU.h
Normal file
510
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/Tile_SPU.h
Normal file
@@ -0,0 +1,510 @@
|
||||
#pragma once
|
||||
// #include "Material.h"
|
||||
// #include "Vec3.h"
|
||||
// #include "Definitions.h"
|
||||
// #include "SoundTypes.h"
|
||||
// using namespace std;
|
||||
#include "Icon_SPU.h"
|
||||
#include "Material_SPU.h"
|
||||
#include <stddef.h>
|
||||
|
||||
class ChunkRebuildData;
|
||||
class GrassTile_SPU;
|
||||
class LeafTile;
|
||||
class TallGrass;
|
||||
class DeadBushTile;
|
||||
class FireTile;
|
||||
class PortalTile;
|
||||
class MycelTile;
|
||||
class PistonExtensionTile;
|
||||
class PistonMovingPiece;
|
||||
class StoneTile;
|
||||
class stoneBrick;
|
||||
class Bush;
|
||||
class StairTile;
|
||||
class LiquidTile;
|
||||
class PistonBaseTile;
|
||||
class ChestTile;
|
||||
class RedStoneDustTile;
|
||||
class RepeaterTile;
|
||||
class CauldronTile;
|
||||
class TripWireSourceTile;
|
||||
class Random;
|
||||
class HitResult;
|
||||
class Level;
|
||||
|
||||
class Player;
|
||||
class LevelSource;
|
||||
class Mob;
|
||||
class TileEntity;
|
||||
class HalfSlabTile;
|
||||
class IconRegister;
|
||||
|
||||
class TileData_SPU
|
||||
{
|
||||
public:
|
||||
|
||||
class Bitfield256
|
||||
{
|
||||
unsigned int m_data[8];
|
||||
|
||||
void setBit(unsigned char i){ m_data[i>>5] |= (1<<(i%32)); }
|
||||
void clearBit(unsigned char i) { m_data[i>>5] &= ~(1<<(i%32)); }
|
||||
public:
|
||||
bool operator[](unsigned char i) { return (m_data[i>>5] & 1<<(i%32)) != 0; }
|
||||
void set(unsigned char i, bool val){ (val) ? setBit(i) : clearBit(i); }
|
||||
};
|
||||
Bitfield256 mipmapEnable;
|
||||
Bitfield256 solid;
|
||||
Bitfield256 transculent;
|
||||
Bitfield256 _sendTileData;
|
||||
Bitfield256 propagate;
|
||||
Bitfield256 signalSource;
|
||||
Bitfield256 cubeShaped;
|
||||
|
||||
|
||||
char lightBlock[256];
|
||||
char lightEmission[256];
|
||||
char materialIDs[256];
|
||||
Material_SPU materials[Material_SPU::num_Ids];
|
||||
|
||||
float xx0[256];
|
||||
float yy0[256];
|
||||
float zz0[256];
|
||||
float xx1[256];
|
||||
float yy1[256];
|
||||
float zz1[256];
|
||||
|
||||
int iconTexWidth;
|
||||
int iconTexHeight;
|
||||
Icon_SPU iconData[256];
|
||||
|
||||
|
||||
Icon_SPU grass_iconTop;
|
||||
Icon_SPU grass_iconSnowSide;
|
||||
Icon_SPU grass_iconSideOverlay;
|
||||
|
||||
Icon_SPU ironFence_EdgeTexture;
|
||||
Icon_SPU thinGlass_EdgeTexture;
|
||||
|
||||
Icon_SPU farmTile_Wet;
|
||||
Icon_SPU farmTile_Dry;
|
||||
|
||||
Icon_SPU doorTile_Icons[8];
|
||||
|
||||
Icon_SPU tallGrass_Icons[3];
|
||||
|
||||
Icon_SPU sandStone_icons[3];
|
||||
Icon_SPU sandStone_iconTop;
|
||||
Icon_SPU sandStone_iconBottom;
|
||||
|
||||
Icon_SPU woodTile_icons[4];
|
||||
|
||||
Icon_SPU treeTile_icons[4];
|
||||
Icon_SPU treeTile_iconTop;
|
||||
|
||||
Icon_SPU leafTile_icons[2][4];
|
||||
bool leafTile_allowSame;
|
||||
int leafTile_fancyTextureSet;
|
||||
|
||||
Icon_SPU cropTile_icons[8];
|
||||
|
||||
Icon_SPU furnaceTile_iconTop;
|
||||
Icon_SPU furnaceTile_iconFront;
|
||||
Icon_SPU furnaceTile_iconFront_lit;
|
||||
|
||||
Icon_SPU liquidTile_iconWaterStill;
|
||||
Icon_SPU liquidTile_iconWaterFlow;
|
||||
Icon_SPU liquidTile_iconLavaStill;
|
||||
Icon_SPU liquidTile_iconLavaFlow;
|
||||
|
||||
Icon_SPU fireTile_icons[2];
|
||||
Icon_SPU sapling_icons[4];
|
||||
|
||||
bool glassTile_allowSame;
|
||||
bool iceTile_allowSame;
|
||||
|
||||
Icon_SPU dispenserTile_iconTop;
|
||||
Icon_SPU dispenserTile_iconFront;
|
||||
Icon_SPU dispenserTile_iconFrontVertical;
|
||||
|
||||
Icon_SPU railTile_iconTurn;
|
||||
Icon_SPU railTile_iconTurnGolden;
|
||||
|
||||
Icon_SPU detectorRailTile_icons[2];
|
||||
|
||||
Icon_SPU tntTile_iconBottom;
|
||||
Icon_SPU tntTile_iconTop;
|
||||
|
||||
Icon_SPU workBench_iconTop;
|
||||
Icon_SPU workBench_iconFront;
|
||||
|
||||
Icon_SPU cactusTile_iconTop;
|
||||
Icon_SPU cactusTile_iconBottom;
|
||||
|
||||
Icon_SPU recordPlayer_iconTop;
|
||||
|
||||
Icon_SPU pumpkinTile_iconTop;
|
||||
Icon_SPU pumpkinTile_iconFace;
|
||||
Icon_SPU pumpkinTile_iconFaceLit;
|
||||
|
||||
Icon_SPU cakeTile_iconTop;
|
||||
Icon_SPU cakeTile_iconBottom;
|
||||
Icon_SPU cakeTile_iconInner;
|
||||
|
||||
Icon_SPU smoothStoneBrick_icons[4];
|
||||
|
||||
Icon_SPU hugeMushroom_icons[2];
|
||||
Icon_SPU hugeMushroom_iconStem;
|
||||
Icon_SPU hugeMushroom_iconInside;
|
||||
|
||||
Icon_SPU melonTile_iconTop;
|
||||
|
||||
Icon_SPU stemTile_iconAngled;
|
||||
|
||||
Icon_SPU mycelTile_iconTop;
|
||||
Icon_SPU mycelTile_iconSnowSide;
|
||||
|
||||
Icon_SPU netherStalk_icons[3];
|
||||
|
||||
Icon_SPU enchantmentTable_iconTop;
|
||||
Icon_SPU enchantmentTable_iconBottom;
|
||||
|
||||
Icon_SPU brewingStand_iconBase;
|
||||
|
||||
Icon_SPU redStoneDust_iconCross;
|
||||
Icon_SPU redStoneDust_iconLine;
|
||||
Icon_SPU redStoneDust_iconCrossOver;
|
||||
Icon_SPU redStoneDust_iconLineOver;
|
||||
|
||||
Icon_SPU clothTile_icons[16];
|
||||
|
||||
Icon_SPU stoneSlab_iconSide;
|
||||
|
||||
Icon_SPU carrot_icons[4];
|
||||
Icon_SPU potato_icons[4];
|
||||
Icon_SPU anvil_icons[3];
|
||||
|
||||
|
||||
Icon_SPU quartzBlock_icons[5];
|
||||
Icon_SPU quartzBlock_iconChiseledTop;
|
||||
Icon_SPU quartzBlock_iconLinesTop;
|
||||
Icon_SPU quartzBlock_iconTop;
|
||||
Icon_SPU quartzBlock_iconBottom;
|
||||
|
||||
|
||||
int anvilPart; // normally part of the AnvilTile class
|
||||
|
||||
unsigned int stemTile_minColour;
|
||||
unsigned int stemTile_maxColour;
|
||||
unsigned int waterLily_colour;
|
||||
|
||||
unsigned int foliageColor_evergreenColor;
|
||||
unsigned int foliageColor_birchColor;
|
||||
|
||||
|
||||
protected:
|
||||
// float destroySpeed;
|
||||
// float explosionResistance;
|
||||
// bool isInventoryItem;
|
||||
// bool collectStatistics;
|
||||
// int m_iMaterial;
|
||||
// int m_iBaseItemType;
|
||||
|
||||
|
||||
public:
|
||||
// const SoundType *soundType;
|
||||
//
|
||||
// float gravity;
|
||||
// Material *material;
|
||||
// float friction;
|
||||
|
||||
private:
|
||||
// unsigned int descriptionId;
|
||||
// unsigned int useDescriptionId; // 4J Added
|
||||
//
|
||||
// wstring m_textureName;
|
||||
|
||||
protected:
|
||||
// Icon *icon;
|
||||
|
||||
public:
|
||||
|
||||
int getRenderShape();
|
||||
|
||||
void setShape(float x0, float y0, float z0, float x1, float y1, float z1);
|
||||
float getBrightness(ChunkRebuildData *level, int x, int y, int z);
|
||||
int getLightColor(ChunkRebuildData *level, int x, int y, int z); // 4J - brought forward from 1.8.2
|
||||
bool shouldRenderFace(ChunkRebuildData *level, int x, int y, int z, int face);
|
||||
|
||||
public:
|
||||
Icon_SPU *getTexture(ChunkRebuildData *level, int x, int y, int z, int face);
|
||||
Icon_SPU *getTexture(int face, int data);
|
||||
Icon_SPU *getTexture(int face);
|
||||
public:
|
||||
void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = NULL); // 4J added forceData, forceEntity param
|
||||
double getShapeX0();
|
||||
double getShapeX1();
|
||||
double getShapeY0();
|
||||
double getShapeY1();
|
||||
double getShapeZ0();
|
||||
double getShapeZ1();
|
||||
// int getColor(int auxData);
|
||||
int getColor(ChunkRebuildData *level, int x, int y, int z);
|
||||
float getShadeBrightness(ChunkRebuildData *level, int x, int y, int z); // 4J - brought forward from 1.8.2
|
||||
bool hasMaterialLiquid() { return false; } // material->isLiquid()
|
||||
};
|
||||
|
||||
class Tile_SPU
|
||||
{
|
||||
public:
|
||||
static const int SHAPE_INVISIBLE = -1;
|
||||
static const int SHAPE_BLOCK = 0;
|
||||
static const int SHAPE_CROSS_TEXTURE = 1;
|
||||
static const int SHAPE_TORCH = 2;
|
||||
static const int SHAPE_FIRE = 3;
|
||||
static const int SHAPE_WATER = 4;
|
||||
static const int SHAPE_RED_DUST = 5;
|
||||
static const int SHAPE_ROWS = 6;
|
||||
static const int SHAPE_DOOR = 7;
|
||||
static const int SHAPE_LADDER = 8;
|
||||
static const int SHAPE_RAIL = 9;
|
||||
static const int SHAPE_STAIRS = 10;
|
||||
static const int SHAPE_FENCE = 11;
|
||||
static const int SHAPE_LEVER = 12;
|
||||
static const int SHAPE_CACTUS = 13;
|
||||
static const int SHAPE_BED = 14;
|
||||
static const int SHAPE_DIODE = 15;
|
||||
static const int SHAPE_PISTON_BASE = 16;
|
||||
static const int SHAPE_PISTON_EXTENSION = 17;
|
||||
static const int SHAPE_IRON_FENCE = 18;
|
||||
static const int SHAPE_STEM = 19;
|
||||
static const int SHAPE_VINE = 20;
|
||||
static const int SHAPE_FENCE_GATE = 21;
|
||||
static const int SHAPE_ENTITYTILE_ANIMATED = 22;
|
||||
static const int SHAPE_LILYPAD = 23;
|
||||
static const int SHAPE_CAULDRON = 24;
|
||||
static const int SHAPE_BREWING_STAND = 25;
|
||||
static const int SHAPE_PORTAL_FRAME = 26;
|
||||
static const int SHAPE_EGG = 27;
|
||||
static const int SHAPE_COCOA = 28;
|
||||
static const int SHAPE_TRIPWIRE_SOURCE = 29;
|
||||
static const int SHAPE_TRIPWIRE = 30;
|
||||
static const int SHAPE_TREE = 31;
|
||||
static const int SHAPE_WALL = 32;
|
||||
static const int SHAPE_FLOWER_POT = 33;
|
||||
static const int SHAPE_BEACON = 34;
|
||||
static const int SHAPE_ANVIL = 35;
|
||||
static const int SHAPE_QUARTZ = 39;
|
||||
|
||||
// 4J - this array of simple constants made so the compiler can optimise references to Ids that were previous of the form Tile_SPU::<whatever>->id, and are now simply Tile_SPU::whatever_Id
|
||||
static const int rock_Id = 1;
|
||||
static const int grass_Id = 2;
|
||||
static const int dirt_Id = 3;
|
||||
static const int stoneBrick_Id = 4;
|
||||
static const int wood_Id = 5;
|
||||
static const int sapling_Id = 6;
|
||||
static const int unbreakable_Id = 7;
|
||||
static const int water_Id = 8;
|
||||
static const int calmWater_Id = 9;
|
||||
static const int lava_Id = 10;
|
||||
static const int calmLava_Id = 11;
|
||||
static const int sand_Id = 12;
|
||||
static const int gravel_Id = 13;
|
||||
static const int goldOre_Id = 14;
|
||||
static const int ironOre_Id = 15;
|
||||
static const int coalOre_Id = 16;
|
||||
static const int treeTrunk_Id = 17;
|
||||
static const int leaves_Id = 18;
|
||||
static const int sponge_Id = 19;
|
||||
static const int glass_Id = 20;
|
||||
static const int lapisOre_Id = 21;
|
||||
static const int lapisBlock_Id = 22;
|
||||
static const int dispenser_Id = 23;
|
||||
static const int sandStone_Id = 24;
|
||||
static const int musicBlock_Id = 25;
|
||||
static const int bed_Id = 26;
|
||||
static const int goldenRail_Id = 27;
|
||||
static const int detectorRail_Id = 28;
|
||||
static const int pistonStickyBase_Id = 29;
|
||||
static const int web_Id = 30;
|
||||
static const int tallgrass_Id = 31;
|
||||
static const int deadBush_Id = 32;
|
||||
static const int pistonBase_Id = 33;
|
||||
static const int pistonExtensionPiece_Id = 34;
|
||||
static const int cloth_Id = 35;
|
||||
static const int pistonMovingPiece_Id = 36;
|
||||
static const int flower_Id = 37;
|
||||
static const int rose_Id = 38;
|
||||
static const int mushroom1_Id = 39;
|
||||
static const int mushroom2_Id = 40;
|
||||
static const int goldBlock_Id = 41;
|
||||
static const int ironBlock_Id = 42;
|
||||
static const int stoneSlab_Id = 43;
|
||||
static const int stoneSlabHalf_Id = 44;
|
||||
static const int redBrick_Id = 45;
|
||||
static const int tnt_Id = 46;
|
||||
static const int bookshelf_Id = 47;
|
||||
static const int mossStone_Id = 48;
|
||||
static const int obsidian_Id = 49;
|
||||
static const int torch_Id = 50;
|
||||
static const int fire_Id = 51;
|
||||
static const int mobSpawner_Id = 52;
|
||||
static const int stairs_wood_Id = 53;
|
||||
static const int chest_Id = 54;
|
||||
static const int redStoneDust_Id = 55;
|
||||
static const int diamondOre_Id = 56;
|
||||
static const int diamondBlock_Id = 57;
|
||||
static const int workBench_Id = 58;
|
||||
static const int crops_Id = 59;
|
||||
static const int farmland_Id = 60;
|
||||
static const int furnace_Id = 61;
|
||||
static const int furnace_lit_Id = 62;
|
||||
static const int sign_Id = 63;
|
||||
static const int door_wood_Id = 64;
|
||||
static const int ladder_Id = 65;
|
||||
static const int rail_Id = 66;
|
||||
static const int stairs_stone_Id = 67;
|
||||
static const int wallSign_Id = 68;
|
||||
static const int lever_Id = 69;
|
||||
static const int pressurePlate_stone_Id = 70;
|
||||
static const int door_iron_Id = 71;
|
||||
static const int pressurePlate_wood_Id = 72;
|
||||
static const int redStoneOre_Id = 73;
|
||||
static const int redStoneOre_lit_Id = 74;
|
||||
static const int notGate_off_Id = 75;
|
||||
static const int notGate_on_Id = 76;
|
||||
static const int button_stone_Id = 77;
|
||||
static const int topSnow_Id = 78;
|
||||
static const int ice_Id = 79;
|
||||
static const int snow_Id = 80;
|
||||
static const int cactus_Id = 81;
|
||||
static const int clay_Id = 82;
|
||||
static const int reeds_Id = 83;
|
||||
static const int recordPlayer_Id = 84;
|
||||
static const int fence_Id = 85;
|
||||
static const int pumpkin_Id = 86;
|
||||
static const int hellRock_Id = 87;
|
||||
static const int hellSand_Id = 88;
|
||||
static const int lightGem_Id = 89;
|
||||
static const int portalTile_Id = 90;
|
||||
static const int litPumpkin_Id = 91;
|
||||
static const int cake_Id = 92;
|
||||
static const int diode_off_Id = 93;
|
||||
static const int diode_on_Id = 94;
|
||||
static const int aprilFoolsJoke_Id = 95;
|
||||
static const int trapdoor_Id = 96;
|
||||
|
||||
static const int monsterStoneEgg_Id = 97;
|
||||
static const int stoneBrickSmooth_Id = 98;
|
||||
static const int hugeMushroom1_Id = 99;
|
||||
static const int hugeMushroom2_Id = 100;
|
||||
static const int ironFence_Id = 101;
|
||||
static const int thinGlass_Id = 102;
|
||||
static const int melon_Id = 103;
|
||||
static const int pumpkinStem_Id = 104;
|
||||
static const int melonStem_Id = 105;
|
||||
static const int vine_Id = 106;
|
||||
static const int fenceGate_Id = 107;
|
||||
static const int stairs_bricks_Id = 108;
|
||||
static const int stairs_stoneBrickSmooth_Id = 109;
|
||||
|
||||
static const int mycel_Id = 110;
|
||||
static const int waterLily_Id = 111;
|
||||
static const int netherBrick_Id = 112;
|
||||
static const int netherFence_Id = 113;
|
||||
static const int stairs_netherBricks_Id = 114;
|
||||
static const int netherStalk_Id = 115;
|
||||
static const int enchantTable_Id = 116;
|
||||
static const int brewingStand_Id = 117;
|
||||
static const int cauldron_Id = 118;
|
||||
static const int endPortalTile_Id = 119;
|
||||
static const int endPortalFrameTile_Id = 120;
|
||||
static const int whiteStone_Id = 121;
|
||||
static const int dragonEgg_Id = 122;
|
||||
static const int redstoneLight_Id = 123;
|
||||
static const int redstoneLight_lit_Id = 124;
|
||||
|
||||
|
||||
static const int woodSlab_Id = 125;
|
||||
static const int woodSlabHalf_Id = 126;
|
||||
static const int cocoa_Id = 127;
|
||||
static const int stairs_sandstone_Id = 128;
|
||||
static const int stairs_sprucewood_Id = 134;
|
||||
static const int stairs_birchwood_Id = 135;
|
||||
static const int stairs_junglewood_Id = 136;
|
||||
static const int emeraldOre_Id = 129;
|
||||
static const int enderChest_Id = 130;
|
||||
static const int tripWireSource_Id = 131;
|
||||
static const int tripWire_Id = 132;
|
||||
static const int emeraldBlock_Id = 133;
|
||||
|
||||
static const int cobbleWall_Id = 139;
|
||||
static const int flowerPot_Id = 140;
|
||||
static const int carrots_Id = 141;
|
||||
static const int potatoes_Id = 142;
|
||||
static const int anvil_Id = 145;
|
||||
static const int button_wood_Id = 143;
|
||||
static const int skull_Id = 144;
|
||||
static const int netherQuartz_Id = 153;
|
||||
static const int quartzBlock_Id = 155;
|
||||
static const int stairs_quartz_Id = 156;
|
||||
static const int woolCarpet_Id = 171;
|
||||
|
||||
static Tile_SPU m_tiles[256];
|
||||
|
||||
Tile_SPU() { id = -1;}
|
||||
Tile_SPU(int tileID) { id = tileID; }
|
||||
virtual ~Tile_SPU() {}
|
||||
|
||||
double getShapeX0() { return ms_pTileData->xx0[id]; }
|
||||
double getShapeX1() { return ms_pTileData->xx1[id]; }
|
||||
double getShapeY0() { return ms_pTileData->yy0[id]; }
|
||||
double getShapeY1() { return ms_pTileData->yy1[id]; }
|
||||
double getShapeZ0() { return ms_pTileData->zz0[id]; }
|
||||
double getShapeZ1() { return ms_pTileData->zz1[id]; }
|
||||
Material_SPU* getMaterial();
|
||||
|
||||
virtual void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = NULL); // 4J added forceData, forceEntity param
|
||||
virtual void updateDefaultShape();
|
||||
virtual void setShape(float x0, float y0, float z0, float x1, float y1, float z1);
|
||||
virtual float getBrightness(ChunkRebuildData *level, int x, int y, int z);
|
||||
virtual int getLightColor(ChunkRebuildData *level, int x, int y, int z); // 4J - brought forward from 1.8.2
|
||||
virtual bool shouldRenderFace(ChunkRebuildData *level, int x, int y, int z, int face);
|
||||
virtual int getRenderShape();
|
||||
virtual int getColor(ChunkRebuildData *level, int x, int y, int z);
|
||||
virtual float getShadeBrightness(ChunkRebuildData *level, int x, int y, int z); // 4J - brought forward from 1.8.2
|
||||
virtual bool isSolidRender(bool isServerLevel = false);
|
||||
virtual bool isSolidFace(ChunkRebuildData *level, int x, int y, int z, int face);
|
||||
virtual int getRenderLayer();
|
||||
virtual Icon_SPU *getTexture(ChunkRebuildData *level, int x, int y, int z, int face);
|
||||
virtual Icon_SPU *getTexture(int face, int data);
|
||||
virtual Icon_SPU *getTexture(int face);
|
||||
|
||||
bool isSignalSource() { return ms_pTileData->signalSource[id]; }
|
||||
bool isCubeShaped() { return ms_pTileData->cubeShaped[id]; }
|
||||
|
||||
Icon_SPU* icon() { return &ms_pTileData->iconData[id]; }
|
||||
|
||||
|
||||
int id;
|
||||
static TileData_SPU* ms_pTileData;
|
||||
|
||||
static void initTilePointers();
|
||||
static Tile_SPU* createFromID(int tileID);
|
||||
|
||||
};
|
||||
|
||||
class TileRef_SPU
|
||||
{
|
||||
// because of the way this ref stuff works, we need all the tile classes to be of the same size,
|
||||
// so make sure no data is added to child classes.
|
||||
Tile_SPU* m_pTile;
|
||||
public:
|
||||
TileRef_SPU(int tileID) { m_pTile = Tile_SPU::createFromID(tileID); }
|
||||
virtual ~TileRef_SPU() { }
|
||||
Tile_SPU* operator->() const { return m_pTile; }
|
||||
Tile_SPU* getPtr() { return m_pTile; }
|
||||
};
|
||||
|
||||
//class stoneBrick : public Tile {};
|
||||
18
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/TntTile_SPU.h
Normal file
18
Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/TntTile_SPU.h
Normal file
@@ -0,0 +1,18 @@
|
||||
#pragma once
|
||||
|
||||
#include "Tile_SPU.h"
|
||||
|
||||
class TntTile_SPU : public Tile_SPU
|
||||
{
|
||||
public:
|
||||
static const int EXPLODE_BIT = 1;
|
||||
TntTile_SPU(int id) : Tile_SPU(id) {}
|
||||
|
||||
Icon_SPU *getTexture(int face, int data)
|
||||
{
|
||||
if (face == Facing::DOWN) return &ms_pTileData->tntTile_iconBottom;
|
||||
if (face == Facing::UP) return &ms_pTileData->tntTile_iconTop;
|
||||
return icon();
|
||||
|
||||
}
|
||||
};
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user