5 #include <unordered_set> 12 #include "IObjectScriptingInterface.h" 13 #include "IAttributeFields.h" 15 #include "util/mutex.h" 16 #include "BlockTemplate.h" 17 #include "BlockCommon.h" 18 #include "BlockChunk.h" 19 #include "RenderableChunk.h" 20 #include "BlockRenderTask.h" 21 #include "WorldInfo.h" 22 #include "BlockReadWriteLock.h" 27 class RenderableChunk;
28 class CBlockLightGridBase;
29 class BlockRenderTask;
30 struct BlockHeightValue;
31 struct ChunkMaxHeight;
58 ATTRIBUTE_METHOD1(
CBlockWorld, GetBlockRenderMethod_s,
int*) { *p1 = cls->GetBlockRenderMethod();
return S_OK; }
59 ATTRIBUTE_METHOD1(
CBlockWorld, SetBlockRenderMethod_s,
int) { cls->SetBlockRenderMethod((BlockRenderMethod)p1);
return S_OK; }
61 ATTRIBUTE_METHOD(
CBlockWorld, ResumeLightUpdate_s) { cls->ResumeLightUpdate();
return S_OK; }
62 ATTRIBUTE_METHOD(
CBlockWorld, SuspendLightUpdate_s) { cls->SuspendLightUpdate();
return S_OK; }
64 ATTRIBUTE_METHOD(
CBlockWorld, ResetAllLight_s) { cls->ResetAllLight();
return S_OK; }
66 ATTRIBUTE_METHOD(
CBlockWorld, LockWorld_s) { cls->LockWorld();
return S_OK; }
67 ATTRIBUTE_METHOD(
CBlockWorld, UnlockWorld_s) { cls->UnlockWorld();
return S_OK; }
69 ATTRIBUTE_METHOD1(
CBlockWorld, IsLightUpdateSuspended_s,
bool*) { *p1 = cls->IsLightUpdateSuspended();
return S_OK; }
71 ATTRIBUTE_METHOD3(
CBlockWorld, SetChunkColumnTimeStamp_s,
float) { cls->SetChunkColumnTimeStamp((uint16_t)p1, (uint16_t)p2, (uint16_t)p3);
return S_OK; }
73 ATTRIBUTE_METHOD1(
CBlockWorld, GetRenderDist_s,
int*) { *p1 = cls->GetRenderDist();
return S_OK; }
74 ATTRIBUTE_METHOD1(
CBlockWorld, SetRenderDist_s,
int) { cls->SetRenderDist(p1);
return S_OK; }
76 ATTRIBUTE_METHOD1(
CBlockWorld, GetDirtyColumnCount_s,
int*) { *p1 = cls->GetDirtyColumnCount();
return S_OK; }
77 ATTRIBUTE_METHOD1(
CBlockWorld, GetDirtyBlockCount_s,
int*) { *p1 = cls->GetDirtyBlockCount();
return S_OK; }
79 ATTRIBUTE_METHOD1(
CBlockWorld, IsReadOnly_s,
bool*) { *p1 = cls->IsReadOnly();
return S_OK; }
80 ATTRIBUTE_METHOD1(
CBlockWorld, SetReadOnly_s,
bool) { cls->SetReadOnly(p1);
return S_OK; }
82 ATTRIBUTE_METHOD1(
CBlockWorld, IsRemote_s,
bool*) { *p1 = cls->IsRemote();
return S_OK; }
83 ATTRIBUTE_METHOD1(
CBlockWorld, SetIsRemote_s,
bool) { cls->SetIsRemote(p1);
return S_OK; }
85 ATTRIBUTE_METHOD1(
CBlockWorld, IsServerWorld_s,
bool*) { *p1 = cls->IsServerWorld();
return S_OK; }
86 ATTRIBUTE_METHOD1(
CBlockWorld, SetIsServerWorld_s,
bool) { cls->SetIsServerWorld(p1);
return S_OK; }
88 ATTRIBUTE_METHOD1(
CBlockWorld, IsSaveLightMap_s,
bool*) { *p1 = cls->IsSaveLightMap();
return S_OK; }
89 ATTRIBUTE_METHOD1(
CBlockWorld, SetSaveLightMap_s,
bool) { cls->SaveLightMap(p1);
return S_OK; }
91 ATTRIBUTE_METHOD1(
CBlockWorld, IsUseAsyncLoadWorld_s,
bool*) { *p1 = cls->IsUseAsyncLoadWorld();
return S_OK; }
92 ATTRIBUTE_METHOD1(
CBlockWorld, SetUseAsyncLoadWorld_s,
bool) { cls->SetUseAsyncLoadWorld(p1);
return S_OK; }
94 ATTRIBUTE_METHOD1(
CBlockWorld, GetLightCalculationStep_s,
int*) { *p1 = cls->GetLightCalculationStep();
return S_OK; }
95 ATTRIBUTE_METHOD1(
CBlockWorld, SetLightCalculationStep_s,
int) { cls->SetLightCalculationStep(p1);
return S_OK; }
97 ATTRIBUTE_METHOD1(
CBlockWorld, GetMaxCacheRegionCount_s,
int*) { *p1 = cls->GetMaxCacheRegionCount();
return S_OK; }
98 ATTRIBUTE_METHOD1(
CBlockWorld, SetMaxCacheRegionCount_s,
int) { cls->SetMaxCacheRegionCount(p1);
return S_OK; }
100 ATTRIBUTE_METHOD1(
CBlockWorld, GetNumOfLockedBlockRegion_s,
int*) { *p1 = cls->GetNumOfLockedBlockRegion();
return S_OK; }
101 ATTRIBUTE_METHOD1(
CBlockWorld, GetNumOfBlockRegion_s,
int*) { *p1 = cls->GetNumOfBlockRegion();
return S_OK; }
102 ATTRIBUTE_METHOD1(
CBlockWorld, GetTotalNumOfLoadedChunksInLockedBlockRegion_s,
int*) { *p1 = cls->GetTotalNumOfLoadedChunksInLockedBlockRegion();
return S_OK; }
104 ATTRIBUTE_METHOD1(
CBlockWorld, IsRenderBlocks_s,
bool*) { *p1 = cls->IsRenderBlocks();
return S_OK; }
105 ATTRIBUTE_METHOD1(
CBlockWorld, SetRenderBlocks_s,
bool) { cls->SetRenderBlocks(p1);
return S_OK; }
107 ATTRIBUTE_METHOD1(
CBlockWorld, GetSunIntensity_s,
float*) { *p1 = cls->GetSunIntensity();
return S_OK; }
108 ATTRIBUTE_METHOD1(
CBlockWorld, SetSunIntensity_s,
float) { cls->SetSunIntensity(p1);
return S_OK; }
110 ATTRIBUTE_METHOD1(
CBlockWorld, GetMinWorldPos_s,
Vector3*) { *p1 =
Vector3((
float)(cls->GetMinWorldPos().x), (
float)(cls->GetMinWorldPos().y), (
float)(cls->GetMinWorldPos().z));
return S_OK; }
111 ATTRIBUTE_METHOD1(
CBlockWorld, SetMinWorldPos_s,
Vector3) {
Int32x3 v((int32)p1.x, (int32)p1.y, (int32)p1.z); cls->SetMinWorldPos(v);
return S_OK; }
113 ATTRIBUTE_METHOD1(
CBlockWorld, GetMaxWorldPos_s,
Vector3*) { *p1 =
Vector3((
float)(cls->GetMaxWorldPos().x), (
float)(cls->GetMaxWorldPos().y), (
float)(cls->GetMaxWorldPos().z));
return S_OK; }
114 ATTRIBUTE_METHOD1(
CBlockWorld, SetMaxWorldPos_s,
Vector3) {
Int32x3 v((int32)p1.x, (int32)p1.y, (int32)p1.z); cls->SetMaxWorldPos(v);
return S_OK; }
117 ATTRIBUTE_METHOD1(
CBlockWorld, GetTotalChunksInMemory_s,
int*) { *p1 = BlockChunk::GetTotalChunksInMemory();
return S_OK; }
120 ATTRIBUTE_METHOD1(
CBlockWorld, UseLinearTorchBrightness_s,
bool) { cls->GenerateLightBrightnessTable(p1);
return S_OK; }
126 Type_LoadBlockRegion = 0,
127 Type_UnLoadBlockRegion,
128 Type_GeneratorScript,
129 Type_SaveRegionCallbackScript,
130 Type_BeforeLoadBlockRegion,
132 DEFINE_SCRIPT_EVENT(
CBlockWorld, BeforeLoadBlockRegion);
134 DEFINE_SCRIPT_EVENT(
CBlockWorld, UnLoadBlockRegion);
136 DEFINE_SCRIPT_EVENT(
CBlockWorld, SaveRegionCallbackScript);
153 virtual const std::string& GetIdentifier();
154 virtual void SetIdentifier(
const std::string& sID);
157 virtual void EnterWorld(
const string& sWorldDir,
float x,
float y,
float z);
160 virtual void LeaveWorld();
162 void ClearAllBlockTemplates();
167 void UpdateAllActiveChunks();
176 uint16_t GetMaxCacheRegionCount()
const;
177 void SetMaxCacheRegionCount(uint16_t val);
184 virtual uint32 GetLightCalculationStep();
190 BlockRegion*
GetRegion(uint16_t x, uint16_t y, uint16_t z, uint16_t& rs_x, uint16_t& rs_y, uint16_t& rs_z);
193 static float GetVerticalOffset();
195 static void SetVerticalOffset(
float offset);
197 int32_t GetActiveChunkDim();
199 int32_t GetActiveChunkDimY();
201 bool IsInBlockWorld();
211 void SetUseAsyncLoadWorld(
bool val);
221 void SetVisibleChunkDirty(
bool val);
237 void SetGroupByChunkBeforeTexture(
bool val);
260 void SaveLightMap(
bool val);
262 void SaveBlockTemplateData();
264 void LoadBlockTemplateData();
266 void SaveToFile(
bool saveToTemp);
273 BlockTemplate* RegisterTemplate(uint16_t
id, uint32_t attFlag, uint16_t category_id);
281 uint32_t SetBlockId(uint16_t x, uint16_t y, uint16_t z, uint32_t nBlockID);
282 uint32_t GetBlockId(uint16_t x, uint16_t y, uint16_t z);
283 uint32_t SetBlockData(uint16_t x, uint16_t y, uint16_t z, uint32_t nBlockData);
284 uint32_t GetBlockData(uint16_t x, uint16_t y, uint16_t z);
292 BlockTemplate* GetBlockTemplate(uint16_t x, uint16_t y, uint16_t z);
298 bool MatchTemplateAttribute(uint16_t templateId, BlockTemplate::BlockAttrubiteFlag flag);
300 void SetTemplateTexture(uint16_t
id,
const char* textureName);
304 ChunkMaxHeight* GetHighestBlock(uint16_t blockX_ws, uint16_t blockZ_ws);
310 virtual void GetMaxBlockHeightWatchingSky(uint16_t blockX_ws, uint16_t blockZ_ws,
ChunkMaxHeight* pResult);
314 void RefreshAllLightsInColumn(uint16_t chunkX_ws, uint16_t chunkZ_ws);
317 void NotifyBlockHeightMapChanged(uint16_t blockIdX_ws, uint16_t blockIdZ_ws,
ChunkMaxHeight& prevBlockHeight);
323 BlockChunk*
GetChunk(uint16_t x, uint16_t y, uint16_t z,
bool bCreateIfNotExist =
true);
327 void SetBlockTemplateId(
float x,
float y,
float z, uint16_t templateId);
329 void SetBlockTemplateIdByIdx(uint16_t x, uint16_t y, uint16_t z, uint16_t templateId);
331 uint16_t GetBlockTemplateId(
float x,
float y,
float z);
333 uint16_t GetBlockTemplateIdByIdx(uint16_t x, uint16_t y, uint16_t z);
335 void SetBlockUserData(
float x,
float y,
float z, uint32_t data);
337 void SetBlockUserDataByIdx(uint16_t x, uint16_t y, uint16_t z, uint32_t data);
339 uint32_t GetBlockUserData(
float x,
float y,
float z);
341 uint32_t GetBlockUserDataByIdx(uint16_t x, uint16_t y, uint16_t z);
343 bool IsObstructionBlock(uint16_t x, uint16_t y, uint16_t z);
349 Block* GetBlock(uint16_t x, uint16_t y, uint16_t z);
350 Block* GetUnlockBlock(uint16_t x, uint16_t y, uint16_t z);
353 void SetChunkDirty(
Uint16x3& chunkId_ws,
bool isDirty);
354 void SetChunkLightDirty(
Uint16x3& chunkId_ws);
400 void SetCubeModePicking(
bool bIsCubeModePicking);
412 int FindFirstBlock(uint16_t x, uint16_t y, uint16_t z, uint16_t nSide = 4, uint32_t max_dist = 32, uint32_t attrFilter = 0xffffffff,
int nCategoryID = -1);
417 int GetFirstBlock(uint16_t x, uint16_t y, uint16_t z,
int nBlockId, uint16_t nSide = 5, uint32_t max_dist = 32);
448 void SetSunIntensity(
float intensity);
450 float GetSunIntensity();
454 void SetLightBlockDirty(
Uint16x3& blockId_ws,
bool isSunLight);
460 void SuspendLightUpdate();
464 int GetTotalNumOfLoadedChunksInLockedBlockRegion();
465 int GetNumOfBlockRegion();
468 void ResumeLightUpdate();
470 bool IsLightUpdateSuspended();
485 void OnViewCenterMove(
float viewCenterX,
float viewCenterY,
float viewCenterZ);
496 void GetCurrentCenterChunkId(
Int16x3& oResult);
499 void SetEyeBlockId(
const Uint16x3& eyePos);
503 const Int16x3 GetMinActiveChunkId();
506 void OnGenerateTerrain(
int nRegionX,
int nRegionY,
int nChunkX = -1,
int nChunkZ = -1);
511 void SelectBlock(uint16_t x, uint16_t y, uint16_t z,
int nGroupID = 0);
513 void DeselectBlock(uint16_t x, uint16_t y, uint16_t z,
int nGroupID = 0);
532 virtual void OnFrameMove();
541 bool UnloadRegion(uint16_t block_x, uint16_t block_y, uint16_t block_z,
bool bAutoSave =
true);
545 void ResetAllLight();
560 virtual void UpdateVisibleChunks(
bool bIsShadowPass =
false);
563 virtual void UpdateRegionCache();
566 virtual void UpdateActiveChunk();
568 virtual void ClearOutOfRangeActiveChunkData();
571 int32_t m_activeChunkDim;
572 int32_t m_activeChunkDimY;
573 static float g_verticalOffset;
614 std::vector<RenderableChunk*> m_activeChunks;
627 int16_t m_curRegionIdX;
628 int16_t m_curRegionIdZ;
634 Int16x3 m_lastChunkIdW_RegionCache;
648 int m_minRegionX, m_minRegionZ;
649 int m_maxRegionX, m_maxRegionZ;
657 float m_sunIntensity;
663 std::vector<RenderableChunk*> m_visibleChunks;
664 std::vector<RenderableChunk*> m_tempDirtyChunks;
667 uint16_t m_maxCacheRegionCount;
670 BlockRegionPtr* m_pRegions;
671 std::map<int, BlockRegion*> m_regionCache;
674 std::map<uint16_t, BlockTemplate*> m_blockTemplates;
675 std::vector<BlockTemplate*> m_blockTemplatesArray;
681 int32_t lightOpyValue;
684 std::map<uint16_t, BlockTemplateVisibleData> m_blockTemplateVisibleDatas;
693 float m_lightBrightnessLinearTableFloat[17];
695 std::vector<CBlockSelectGroup> m_selectedBlockMap;
int32_t GetBlocksInRegion(Uint16x3 &startChunk_ws, Uint16x3 &endChunk_ws, uint32_t matchType, const luabind::adl::object &result, uint32_t verticalSectionFilter=0)
Definition: BlockWorld.cpp:1322
int FindFirstBlock(uint16_t x, uint16_t y, uint16_t z, uint16_t nSide=4, uint32_t max_dist=32, uint32_t attrFilter=0xffffffff, int nCategoryID=-1)
find a block in the side direction that matched filter from block(x,y,z) this function can be used to...
Definition: BlockWorld.cpp:1672
virtual const char * GetAttributeClassName()
a static string, describing the attribute class object's name
Definition: BlockWorld.h:44
void SelectBlock(uint16_t x, uint16_t y, uint16_t z, int nGroupID=0)
hight light select block
Definition: BlockWorld.cpp:1994
BlockRegion * BlockRegionPtr
array of 64*64 regions.
Definition: BlockWorld.h:669
virtual int GetAttributeClassID()
attribute class ID should be identical, unless one knows how overriding rules work.
Definition: BlockWorld.h:42
an attribute class is a collection of attribute fields.
Definition: AttributeClass.h:10
void SetActiveChunkRadius(int nActiveChunkRadius=12)
how many chunk
Definition: BlockWorld.cpp:269
Int32x3 m_minWorldPos
minimum world position.
Definition: BlockWorld.h:644
BlockChunk * GetChunk(uint16_t x, uint16_t y, uint16_t z, bool bCreateIfNotExist=true)
get chunk by world coordinates
Definition: BlockWorld.cpp:1793
CallBackType
script call back type
Definition: BlockWorld.h:125
void OnGenerateTerrain(int nRegionX, int nRegionY, int nChunkX=-1, int nChunkZ=-1)
this function is called when region does not have matching disk file.
Definition: BlockWorld.cpp:2042
bool CheckChunkColumnsExist(int minX, int minY, int minZ, int maxX, int maxY, int maxZ)
Checks between a min and max all the chunks in between actually exist.
Definition: BlockWorld.cpp:2155
const ParaEngine::Int32x3 & GetMinWorldPos() const
minimum world position.
Definition: BlockWorld.cpp:2329
Providing information about the current game world.
Definition: WorldInfo.h:12
void SetReadOnly(bool bValue)
whether it is readonly
Definition: BlockWorld.cpp:496
bool IsCubeModePicking()
ignore sub-block level physics during Pick() function.
Definition: BlockWorld.cpp:1351
BlockRegion * GetRegion(uint16_t x, uint16_t y, uint16_t z, uint16_t &rs_x, uint16_t &rs_y, uint16_t &rs_z)
get region object
Definition: BlockWorld.cpp:440
bool Pick(const Vector3 &rayOrig, const Vector3 &dir, float length, PickResult &result, uint32_t filter=0xffffffff)
picking in block world
Definition: BlockWorld.cpp:1356
ParaEngine::mutex m_blockworld_mutex
when some thread is accessing the block world.
Definition: BlockWorld.h:624
different physics engine has different winding order.
Definition: EventBinding.h:32
Definition: BlockChunk.h:14
virtual int GetChildAttributeColumnCount()
we support multi-dimensional child object.
Definition: BlockWorld.h:55
Int32x3 m_maxWorldPos
maximum world position.
Definition: BlockWorld.h:646
BlockRenderMethod GetBlockRenderMethod()
get how blocks are preferred to be rendered.
Definition: BlockWorld.cpp:2037
bool UnloadRegion(uint16_t block_x, uint16_t block_y, uint16_t block_z, bool bAutoSave=true)
unload region from memory.
Definition: BlockWorld.cpp:407
void SetRenderDist(int nValue)
max number of blocks to render from eye to farthest one
Definition: BlockWorld.cpp:300
basic block world coordinate
Definition: BlockCoordinate.h:72
virtual const char * GetAttributeClassDescription()
a static string, describing the attribute class object
Definition: BlockWorld.h:46
CBlockLightGridBase & GetLightGrid()
get light grid
Definition: BlockWorld.cpp:346
bool m_bIsServerWorld
a server world.
Definition: BlockWorld.h:585
Definition: RenderableChunk.h:17
virtual void SetBlockRenderMethod(BlockRenderMethod method)
how blocks are preferred to be rendered.
Definition: BlockWorld.cpp:351
int OnSaveBlockRegion(int x, int y)
called when block region has just saved.
Definition: BlockWorld.cpp:2095
bool ReuseActiveChunk(int16_t curChunkWX, int16_t curChunkWY, int16_t curChunkWZ, BlockRegion *pRegion)
force reusing active chunk
Definition: BlockWorld.cpp:741
bool m_isVisibleChunkDirty
if true, it will check dirty bit for all active chunks in the next the render framemove ...
Definition: BlockWorld.h:595
Standard 3-dimensional vector.
Definition: ParaVector3.h:16
static int GetTotalRenderableChunks()
total number of renderable chunks in memory.
Definition: RenderableChunk.cpp:984
int GetFirstBlock(uint16_t x, uint16_t y, uint16_t z, int nBlockId, uint16_t nSide=5, uint32_t max_dist=32)
get the y pos of the first block of nBlockID, start searching from x, y, z in the side direction ...
Definition: BlockWorld.cpp:1732
CWorldInfo & GetWorldInfo()
return world info
Definition: BlockWorld.cpp:2114
bool IsRenderBlocks()
whether it is readonly
Definition: BlockWorld.cpp:2252
void SetRenderBlocks(bool bValue)
whether it is readonly
Definition: BlockWorld.cpp:2243
bool m_isInWorld
whether this world is active
Definition: BlockWorld.h:576
bool IsServerWorld()
whether it is server world
Definition: BlockWorld.cpp:2228
Definition: object.hpp:749
virtual void SetLightCalculationStep(uint32 nTicks)
how many lighting to calculate per tick for the lighting thread.
Definition: BlockWorld.cpp:2233
bool m_bReadOnlyWorld
if true, no auto world saving is done when user moving out of the region cache.
Definition: BlockWorld.h:579
uint8_t GetLightBrightnessInt(uint8_t brightness)
Definition: BlockWorld.cpp:246
void GenerateLightBrightnessTable(bool bUseLinearBrightness=false)
Creates the light to brightness table.
Definition: BlockWorld.cpp:1823
RenderableChunk & GetActiveChunk(uint16_t curChunkWX, uint16_t curChunkWY, uint16_t curChunkWZ)
: world chunk coordinates
Definition: BlockWorld.cpp:731
base class for an instance of block world
Definition: BlockWorld.h:35
float m_lightBrightnessTableFloat[17]
Light to brightness conversion table.
Definition: BlockWorld.h:690
void RefreshBlockTemplate(uint16_t templateId)
refresh light and other attributes for all instances of given block template.
Definition: BlockWorld.cpp:879
bool RefreshChunkColumn(int16_t curChunkWX, int16_t curChunkWZ)
this function is called, when the entire column is loaded
Definition: BlockWorld.cpp:1068
virtual void ClearBlockRenderCache()
clear block render cache
Definition: BlockWorld.cpp:2145
BlockReadWriteLock & GetReadWriteLock()
get read/write locker of this world
Definition: BlockWorld.cpp:2313
int OnBeforeLoadBlockRegion(int x, int y)
called before block region is about to be loaded.
Definition: BlockWorld.cpp:2055
bool m_is_linear_torch_brightness
if true, light value in block shader is linear.
Definition: BlockWorld.h:606
virtual int GetChildAttributeObjectCount(int nColumnIndex=0)
get the number of child objects (row count) in the given column.
Definition: BlockWorld.cpp:2438
void SetIsServerWorld(bool bValue)
whether it is a server world.
Definition: BlockWorld.cpp:2223
Definition: BlockWorld.h:678
BlockIndex GetBlockIndex(uint16_t x, uint16_t y, uint16_t z, bool bCreateIfNotExist=true)
return the BlockChunk and the block index inside the chunk.
Definition: BlockWorld.cpp:1778
float GetBlockBrightnessReal(const Vector3 &vPos, float *pBrightness=NULL)
get the interpolated block brightness at the given position.
Definition: BlockWorld.cpp:1310
bool IsGroupByChunkBeforeTexture() const
if true, when rendering blocks, always group by chunk first and then by texture.
Definition: BlockWorld.cpp:2319
virtual IAttributeFields * GetChildAttributeObject(const std::string &sName)
get attribute by child object.
Definition: BlockWorld.cpp:2417
bool IsReadOnly()
whether it is readonly
Definition: BlockWorld.cpp:501
bool IsChunkColumnInActiveRange(int16_t curChunkWX, int16_t curChunkWZ)
is the chunk column in active chunk region.
Definition: BlockWorld.cpp:1062
bool m_bSaveLightMap
whether to save light map to disk.
Definition: BlockWorld.h:589
Definition: enum_maker.hpp:46
Chunk is a 16*16*16 inside a region.
Definition: BlockChunk.h:138
bool ChunkColumnExists(uint16_t chunkX, uint16_t chunkZ)
Returns whether a chunk exists at chunk coordinates x, y.
Definition: BlockWorld.cpp:2183
Definition: BlockIndex.h:7
block template base class.
Definition: BlockTemplate.h:15
int GetDirtyBlockCount()
get the number of remaining dirty blocks
Definition: BlockWorld.cpp:1818
A common interface for all classes implementing IAttributeFields By implementing this class's virtual...
Definition: IAttributeFields.h:59
bool m_bCubeModePicking
ignore sub-block level physics during Pick() function.
Definition: BlockWorld.h:592
bool IsChunkLocked(uint32 worldX, uint32 worldZ)
whether the chunk at the given world position is locked.
Definition: BlockWorld.cpp:2199
bool IsSaveLightMap() const
whether to save light map to disk.
Definition: BlockWorld.cpp:2119
bool IsUseAsyncLoadWorld() const
whether we will use async world loader.
Definition: BlockWorld.cpp:2257
void SetChunkColumnTimeStamp(uint16_t x, uint16_t z, uint16_t nTimeStamp)
set chunk column time stamp.
Definition: BlockWorld.cpp:1649
Block Light Data.
Definition: BlockChunk.h:110
void UnlockWorld()
Unlock mutex.
Definition: BlockWorld.cpp:2140
multiple shared readers and multiple exclusive writers it favors writers over readers.
Definition: BlockReadWriteLock.h:18
float GetLightBrightnessFloat(uint8_t brightness)
Definition: BlockWorld.cpp:241
Definition: IObjectScriptingInterface.h:6
void DeselectAllBlock(int nGroupID=-1)
Definition: BlockWorld.cpp:2021
const ParaEngine::Int32x3 & GetMaxWorldPos() const
maximum world position.
Definition: BlockWorld.cpp:2341
BlockRenderMethod m_dwBlockRenderMethod
the current block rendering method.
Definition: BlockWorld.h:655
int m_nRenderDistance
max number of blocks to render from eye to farthest one
Definition: BlockWorld.h:652
int32_t GetChunkColumnTimeStamp(uint16_t x, uint16_t z)
get the time stamp of for the given chunk column -1 means region not loaded yet, 0 means not availabl...
Definition: BlockWorld.cpp:1659
bool IsRemote()
whether it is a remote world
Definition: BlockWorld.cpp:2212
int GetNumOfLockedBlockRegion()
get the total number of locked bock regions.
Definition: BlockWorld.cpp:2275
this is used for rendering a super large block world across several frames.
Definition: MultiFrameBlockWorldRenderer.h:19
bool IsVisibleChunkDirty() const
if true, it will check dirty bit for all active chunks in the next the render framemove ...
Definition: BlockWorld.cpp:2303
Definition: BlockRenderTask.h:13
virtual int InstallFields(CAttributeClass *pClass, bool bOverride)
this class should be implemented if one wants to add new attribute.
Definition: BlockWorld.cpp:2453
int OnLoadBlockRegion(int x, int y)
called when block region has just loaded.
Definition: BlockWorld.cpp:2069
for block or chunk location that does not has boundary check.
Definition: BlockCoordinate.h:123
float GetLightBrightnessLinearFloat(uint8_t brightness)
Definition: BlockWorld.cpp:251
cross platform mutex
Definition: mutex.h:95
int GetDirtyColumnCount()
get number of dirty chunk columns for light calculations
Definition: BlockWorld.cpp:1813
bool m_bRenderBlocks
whether to render blocks
Definition: BlockWorld.h:598
ParaEngine::mutex & GetBlockWorldMutex()
when some thread is accessing the block world.
Definition: BlockWorld.cpp:2130
512*512 region
Definition: BlockRegion.h:22
bool m_bUseAsyncLoadWorld
whether we will use async world loader.
Definition: BlockWorld.h:600
int OnUnLoadBlockRegion(int x, int y)
called when block region has just unloaded.
Definition: BlockWorld.cpp:2082
Definition: BlockCommon.h:105
uint8_t m_lightBrightnessTableInt[17]
Light to brightness conversion table.
Definition: BlockWorld.h:692
basic block world coordinate
Definition: BlockCoordinate.h:10
virtual void EnterWorld(const string &sWorldDir, float x, float y, float z)
Definition: BlockWorld.cpp:104
base class for block light grid.
Definition: BlockLightGridBase.h:37
BlockReadWriteLock m_readWriteLock
read-write lock.
Definition: BlockWorld.h:698
LightData * GetLightData(uint16_t x, uint16_t y, uint16_t z, bool bCreateIfNotExist=true)
get block light data by world coordinates
Definition: BlockWorld.cpp:1804
bool SetBlockVisible(uint16_t templateId, bool value, bool bRefreshWorld=true)
return true if refresh world is required.
Definition: BlockWorld.cpp:834
bool m_group_by_chunk_before_texture
if true, when rendering blocks, always group by chunk first and then by texture.
Definition: BlockWorld.h:603
bool GetBlockBrightness(Uint16x3 &blockId_ws, uint8_t *brightness, int nSize=27, int nLightType=-1)
get light brightness of current and 26 nearby block
Definition: BlockWorld.cpp:1255
void SetIsRemote(bool bValue)
whether it is a remote world.
Definition: BlockWorld.cpp:2217
bool GetBlockMeshBrightness(Uint16x3 &blockId_ws, uint8_t *brightness, int nLightType=2)
if the block in not solid, we will simply return the block's brightness.
Definition: BlockWorld.cpp:1260
BlockRegion * CreateGetRegion(uint16_t block_x, uint16_t block_y, uint16_t block_z)
load region at the given position.
Definition: BlockWorld.cpp:356
bool m_bIsRemote
a remote world connected to server.
Definition: BlockWorld.h:582
bool DoChunksNearChunkExist(uint16_t x, uint16_t y, uint16_t z, uint16_t radius)
Checks if any of the chunks within radius blocks of the given block exist.
Definition: BlockWorld.cpp:2150
chunk column's height map data
Definition: ChunkMaxHeight.h:6
void LockWorld()
use scoped_lock where ever possible.
Definition: BlockWorld.cpp:2135