12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- #include "ChunkModelBuilder.h"
- #include "Chunk.h"
- ChunkModelBuilder::ChunkModelBuilder(
- FactoryCraftModel* target, Chunk* zChunk, int type)
- : ReferenceCounter(),
- zChunk(zChunk),
- type(type),
- target(target)
- {}
- ChunkModelBuilder::~ChunkModelBuilder()
- {
- target->release();
- }
- Block** ChunkModelBuilder::blocks()
- {
- return zChunk->blocks;
- }
- void ChunkModelBuilder::setBlockPartOfModel(Block* zBlock, bool partOfModel)
- {
- int state = zBlock->getPartOfModels();
- if (!state && partOfModel)
- {
- zChunk->visibleBlocks.removeValue(zBlock);
- }
- zBlock->setPartOfModel(type, partOfModel);
- if (state && !zBlock->getPartOfModels())
- {
- zChunk->visibleBlocks.add(zBlock);
- }
- }
- Framework::Punkt ChunkModelBuilder::chunkCenter()
- {
- return zChunk->location;
- }
- FactoryCraftModel* ChunkModelBuilder::zModel() const
- {
- return target;
- }
- int ChunkModelBuilder::getType() const
- {
- return type;
- }
|