|
@@ -242,38 +242,40 @@ void ChunkFluidModel::buildModel()
|
|
|
bool ChunkFluidModel::updateLightning()
|
|
|
{
|
|
|
__int64* lightBuffer = target->zLightBuffer();
|
|
|
+ int oldVertexCount = target->getVertexAnzahl();
|
|
|
int groundVertexCount = 0;
|
|
|
for (int i = 0; i < CHUNK_SIZE * CHUNK_SIZE * WORLD_HEIGHT; i++)
|
|
|
{
|
|
|
- if (blocks()[i])
|
|
|
+ if (blocks()[i] && (blocks()[i]->getPartOfModels() | getType()) )
|
|
|
{
|
|
|
- if (blocks()[i]
|
|
|
- ->zBlockType()->isFluid())
|
|
|
+ int index = 0;
|
|
|
+ for (Text* textureName :
|
|
|
+ *blocks()[i]->zBlockType()->getModelInfo().getTexturNames())
|
|
|
{
|
|
|
- int index = 0;
|
|
|
- for (Text* textureName :
|
|
|
- *blocks()[i]->zBlockType()->getModelInfo().getTexturNames())
|
|
|
+ Framework::Vec3<int> location(
|
|
|
+ (i / WORLD_HEIGHT) / CHUNK_SIZE,
|
|
|
+ (i / WORLD_HEIGHT) % CHUNK_SIZE,
|
|
|
+ i % WORLD_HEIGHT);
|
|
|
+ if (isPartOfGroundModel(location, index))
|
|
|
{
|
|
|
- Framework::Vec3<int> location(
|
|
|
- (i / WORLD_HEIGHT) / CHUNK_SIZE,
|
|
|
- (i / WORLD_HEIGHT) % CHUNK_SIZE,
|
|
|
- i % WORLD_HEIGHT);
|
|
|
- if (isPartOfGroundModel(location, index))
|
|
|
+ const Vertex3D* vBuffer
|
|
|
+ = blocks()[i]->zModelData()->zVertexBuffer();
|
|
|
+ Polygon3D* polygon
|
|
|
+ = blocks()[i]->zModelData()->getPolygon(index);
|
|
|
+ for (int vi = 0; vi < polygon->indexAnz; vi++)
|
|
|
{
|
|
|
- const Vertex3D* vBuffer
|
|
|
- = blocks()[i]->zModelData()->zVertexBuffer();
|
|
|
- Polygon3D* polygon
|
|
|
- = blocks()[i]->zModelData()->getPolygon(index);
|
|
|
- for (int vi = 0; vi < polygon->indexAnz; vi++)
|
|
|
+ if (oldVertexCount <= groundVertexCount)
|
|
|
{
|
|
|
- lightBuffer[groundVertexCount++] = calculateLight(
|
|
|
- vBuffer[polygon->indexList[vi]].pos,
|
|
|
- location,
|
|
|
- getDirectionFromIndex(index));
|
|
|
- }
|
|
|
+ std::cout << "ERROR: to many vertecies in chunk fluid model" << std::endl;
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ lightBuffer[groundVertexCount++] = calculateLight(
|
|
|
+ vBuffer[polygon->indexList[vi]].pos,
|
|
|
+ location,
|
|
|
+ getDirectionFromIndex(index));
|
|
|
}
|
|
|
- index++;
|
|
|
}
|
|
|
+ index++;
|
|
|
}
|
|
|
}
|
|
|
}
|