|
|
@@ -135,20 +135,19 @@ void ChunkFluidModel::buildModel()
|
|
|
setBlockPartOfModel(blocks()[i], 1);
|
|
|
int index = 0;
|
|
|
for (Text* textureName :
|
|
|
- *blocks()[i]->zBlockType()->getModelInfo().getTexturNames())
|
|
|
+ *blocks()[i]->getCurrentModelInfo().getTexturNames())
|
|
|
{
|
|
|
Framework::Vec3<int> location(
|
|
|
(i / WORLD_HEIGHT) / CHUNK_SIZE,
|
|
|
(i / WORLD_HEIGHT) % CHUNK_SIZE,
|
|
|
i % WORLD_HEIGHT);
|
|
|
Framework::Vec3<int> aboveLocation
|
|
|
- = location
|
|
|
- + getDirection(Direction::TOP);
|
|
|
+ = location + getDirection(Direction::TOP);
|
|
|
int aboveIndex = Chunk::index(aboveLocation);
|
|
|
bool sameAbove = aboveLocation.z < WORLD_HEIGHT
|
|
|
- && blocks()[aboveIndex]
|
|
|
- && blocks()[aboveIndex]->zBlockType()
|
|
|
- == blocks()[i]->zBlockType();
|
|
|
+ && blocks()[aboveIndex]
|
|
|
+ && blocks()[aboveIndex]->zBlockType()
|
|
|
+ == blocks()[i]->zBlockType();
|
|
|
if (isPartOfGroundModel(location, index))
|
|
|
{
|
|
|
if (!groundModelBuidler.get(
|
|
|
@@ -212,16 +211,19 @@ void ChunkFluidModel::buildModel()
|
|
|
char maxFlowDist = blocks()[i]
|
|
|
->zBlockType()
|
|
|
->getMaxFlowDistance();
|
|
|
- float dist = (float)(maxFlowDist + 1 - blocks()[i]
|
|
|
- ->getDistanceToSource()) / (float)(maxFlowDist + 1);
|
|
|
+ float dist
|
|
|
+ = (float)(maxFlowDist + 1
|
|
|
+ - blocks()[i]
|
|
|
+ ->getDistanceToSource())
|
|
|
+ / (float)(maxFlowDist + 1);
|
|
|
groundVerticies[groundVertexCount - 1].pos.z
|
|
|
-= (1 - dist);
|
|
|
}
|
|
|
groundVerticies[groundVertexCount - 1].pos
|
|
|
+= blocks()[i]->getPos()
|
|
|
- - Vec3<float>((float)chunkCenter().x,
|
|
|
- (float)chunkCenter().y,
|
|
|
- (float)WORLD_HEIGHT / 2.f);
|
|
|
+ - Vec3<float>((float)chunkCenter().x,
|
|
|
+ (float)chunkCenter().y,
|
|
|
+ (float)WORLD_HEIGHT / 2.f);
|
|
|
groundVerticies[groundVertexCount - 1].id
|
|
|
= groundVertexCount - 1;
|
|
|
}
|
|
|
@@ -261,15 +263,13 @@ bool ChunkFluidModel::updateLightning()
|
|
|
int groundVertexCount = 0;
|
|
|
for (int i = 0; i < CHUNK_SIZE * CHUNK_SIZE * WORLD_HEIGHT; i++)
|
|
|
{
|
|
|
- if (blocks()[i]
|
|
|
- && isPartOfModel(blocks()[i]))
|
|
|
+ if (blocks()[i] && isPartOfModel(blocks()[i]))
|
|
|
{
|
|
|
int index = 0;
|
|
|
for (Text* textureName :
|
|
|
- *blocks()[i]->zBlockType()->getModelInfo().getTexturNames())
|
|
|
+ *blocks()[i]->getCurrentModelInfo().getTexturNames())
|
|
|
{
|
|
|
- Framework::Vec3<int> location(
|
|
|
- (i / WORLD_HEIGHT) / CHUNK_SIZE,
|
|
|
+ Framework::Vec3<int> location((i / WORLD_HEIGHT) / CHUNK_SIZE,
|
|
|
(i / WORLD_HEIGHT) % CHUNK_SIZE,
|
|
|
i % WORLD_HEIGHT);
|
|
|
if (isPartOfGroundModel(location, index))
|
|
|
@@ -282,9 +282,11 @@ bool ChunkFluidModel::updateLightning()
|
|
|
{
|
|
|
if (oldVertexCount <= groundVertexCount)
|
|
|
{
|
|
|
- std::cout << "ERROR: to many vertecies in chunk fluid model" << std::endl;
|
|
|
+ std::cout << "ERROR: to many vertecies in chunk "
|
|
|
+ "fluid model"
|
|
|
+ << std::endl;
|
|
|
return 0;
|
|
|
- }
|
|
|
+ }
|
|
|
lightBuffer[groundVertexCount++] = calculateLight(
|
|
|
vBuffer[polygon->indexList[vi]].pos,
|
|
|
location,
|