Skip to content

Commit 3fc104d

Browse files
committed
Renamed some voxel defs for clarity.
1 parent a6d331f commit 3fc104d

17 files changed

+128
-128
lines changed

OpenTESArena/CMakeLists.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -560,12 +560,10 @@ SET(TES_VOXELS
560560
"${SRC_ROOT}/Voxels/ArenaChasmUtils.h"
561561
"${SRC_ROOT}/Voxels/ArenaVoxelUtils.cpp"
562562
"${SRC_ROOT}/Voxels/ArenaVoxelUtils.h"
563-
"${SRC_ROOT}/Voxels/ChasmDefinition.cpp"
564-
"${SRC_ROOT}/Voxels/ChasmDefinition.h"
565-
"${SRC_ROOT}/Voxels/DoorDefinition.cpp"
566-
"${SRC_ROOT}/Voxels/DoorDefinition.h"
567563
"${SRC_ROOT}/Voxels/DoorUtils.cpp"
568564
"${SRC_ROOT}/Voxels/DoorUtils.h"
565+
"${SRC_ROOT}/Voxels/VoxelChasmDefinition.cpp"
566+
"${SRC_ROOT}/Voxels/VoxelChasmDefinition.h"
569567
"${SRC_ROOT}/Voxels/VoxelChasmWallInstance.cpp"
570568
"${SRC_ROOT}/Voxels/VoxelChasmWallInstance.h"
571569
"${SRC_ROOT}/Voxels/VoxelChunk.cpp"
@@ -575,6 +573,8 @@ SET(TES_VOXELS
575573
"${SRC_ROOT}/Voxels/VoxelDirtyType.h"
576574
"${SRC_ROOT}/Voxels/VoxelDoorAnimationInstance.cpp"
577575
"${SRC_ROOT}/Voxels/VoxelDoorAnimationInstance.h"
576+
"${SRC_ROOT}/Voxels/VoxelDoorDefinition.cpp"
577+
"${SRC_ROOT}/Voxels/VoxelDoorDefinition.h"
578578
"${SRC_ROOT}/Voxels/VoxelDoorVisibilityInstance.cpp"
579579
"${SRC_ROOT}/Voxels/VoxelDoorVisibilityInstance.h"
580580
"${SRC_ROOT}/Voxels/VoxelFacing2D.h"

OpenTESArena/src/Player/PlayerLogicController.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -668,8 +668,8 @@ void PlayerLogicController::handleScreenToWorldInteraction(Game &game, const Int
668668
DebugCrash("Expected door def ID to exist.");
669669
}
670670

671-
const DoorDefinition &doorDef = chunk.getDoorDef(doorDefID);
672-
const DoorDefinition::OpenSoundDef &openSoundDef = doorDef.getOpenSound();
671+
const VoxelDoorDefinition &doorDef = chunk.getDoorDef(doorDefID);
672+
const VoxelDoorDefinition::OpenSoundDef &openSoundDef = doorDef.getOpenSound();
673673

674674
auto &audioManager = game.audioManager;
675675
const std::string &soundFilename = openSoundDef.soundFilename;

OpenTESArena/src/Rendering/RenderVoxelChunkManager.cpp

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -64,21 +64,21 @@ namespace
6464
}
6565
}
6666

67-
bool LoadedChasmFloorComparer(const RenderVoxelChunkManager::LoadedChasmFloorTextureList &textureList, const ChasmDefinition &chasmDef)
67+
bool LoadedChasmFloorComparer(const RenderVoxelChunkManager::LoadedChasmFloorTextureList &textureList, const VoxelChasmDefinition &chasmDef)
6868
{
6969
if (textureList.animType != chasmDef.animType)
7070
{
7171
return false;
7272
}
7373

74-
if (textureList.animType == ChasmDefinition::AnimationType::SolidColor)
74+
if (textureList.animType == VoxelChasmDefinition::AnimationType::SolidColor)
7575
{
7676
return textureList.paletteIndex == chasmDef.solidColor.paletteIndex;
7777
}
78-
else if (textureList.animType == ChasmDefinition::AnimationType::Animated)
78+
else if (textureList.animType == VoxelChasmDefinition::AnimationType::Animated)
7979
{
8080
const int textureAssetCount = static_cast<int>(textureList.textureAssets.size());
81-
const ChasmDefinition::Animated &chasmDefAnimated = chasmDef.animated;
81+
const VoxelChasmDefinition::Animated &chasmDefAnimated = chasmDef.animated;
8282

8383
if (textureAssetCount != chasmDefAnimated.textureAssets.getCount())
8484
{
@@ -108,7 +108,7 @@ namespace
108108
TextureManager &textureManager, Renderer &renderer)
109109
{
110110
const ChunkInt2 chunkPos = voxelChunk.getPosition();
111-
const ChasmDefinition &chasmDef = voxelChunk.getChasmDef(chasmDefID);
111+
const VoxelChasmDefinition &chasmDef = voxelChunk.getChasmDef(chasmDefID);
112112

113113
// Check if this chasm already has a mapping (i.e. have we seen this chunk before?).
114114
const auto keyIter = std::find_if(chasmTextureKeys.begin(), chasmTextureKeys.end(),
@@ -138,7 +138,7 @@ namespace
138138
{
139139
// Load the required textures and add a key for them.
140140
RenderVoxelChunkManager::LoadedChasmFloorTextureList newTextureList;
141-
if (chasmDef.animType == ChasmDefinition::AnimationType::SolidColor)
141+
if (chasmDef.animType == VoxelChasmDefinition::AnimationType::SolidColor)
142142
{
143143
// Dry chasms are a single color, no texture asset.
144144
ObjectTextureID dryChasmTextureID;
@@ -166,7 +166,7 @@ namespace
166166
newTextureList.initColor(paletteIndex, std::move(dryChasmTextureRef));
167167
chasmFloorTextureLists.emplace_back(std::move(newTextureList));
168168
}
169-
else if (chasmDef.animType == ChasmDefinition::AnimationType::Animated)
169+
else if (chasmDef.animType == VoxelChasmDefinition::AnimationType::Animated)
170170
{
171171
std::vector<TextureAsset> newTextureAssets;
172172
std::vector<ScopedObjectTextureRef> newObjectTextureRefs;
@@ -289,22 +289,22 @@ void RenderVoxelChunkManager::LoadedTexture::init(const TextureAsset &textureAss
289289

290290
RenderVoxelChunkManager::LoadedChasmFloorTextureList::LoadedChasmFloorTextureList()
291291
{
292-
this->animType = static_cast<ChasmDefinition::AnimationType>(-1);
292+
this->animType = static_cast<VoxelChasmDefinition::AnimationType>(-1);
293293
this->paletteIndex = 0;
294294
}
295295

296296
void RenderVoxelChunkManager::LoadedChasmFloorTextureList::initColor(uint8_t paletteIndex,
297297
ScopedObjectTextureRef &&objectTextureRef)
298298
{
299-
this->animType = ChasmDefinition::AnimationType::SolidColor;
299+
this->animType = VoxelChasmDefinition::AnimationType::SolidColor;
300300
this->paletteIndex = paletteIndex;
301301
this->objectTextureRefs.emplace_back(std::move(objectTextureRef));
302302
}
303303

304304
void RenderVoxelChunkManager::LoadedChasmFloorTextureList::initTextured(std::vector<TextureAsset> &&textureAssets,
305305
std::vector<ScopedObjectTextureRef> &&objectTextureRefs)
306306
{
307-
this->animType = ChasmDefinition::AnimationType::Animated;
307+
this->animType = VoxelChasmDefinition::AnimationType::Animated;
308308
this->textureAssets = std::move(textureAssets);
309309
this->objectTextureRefs = std::move(objectTextureRefs);
310310
}
@@ -314,11 +314,11 @@ int RenderVoxelChunkManager::LoadedChasmFloorTextureList::getTextureIndex(double
314314
const int textureCount = static_cast<int>(this->objectTextureRefs.size());
315315
DebugAssert(textureCount >= 1);
316316

317-
if (this->animType == ChasmDefinition::AnimationType::SolidColor)
317+
if (this->animType == VoxelChasmDefinition::AnimationType::SolidColor)
318318
{
319319
return 0;
320320
}
321-
else if (this->animType == ChasmDefinition::AnimationType::Animated)
321+
else if (this->animType == VoxelChasmDefinition::AnimationType::Animated)
322322
{
323323
const int index = std::clamp(static_cast<int>(static_cast<double>(textureCount) * chasmAnimPercent), 0, textureCount - 1);
324324
return index;
@@ -684,7 +684,7 @@ void RenderVoxelChunkManager::loadTransforms(RenderVoxelChunk &renderChunk, cons
684684
if (voxelChunk.tryGetDoorDefID(x, y, z, &doorDefID))
685685
{
686686
// Door transform uniform buffers. These are separate because each voxel has a RenderTransform per door face.
687-
const DoorDefinition &doorDef = voxelChunk.getDoorDef(doorDefID);
687+
const VoxelDoorDefinition &doorDef = voxelChunk.getDoorDef(doorDefID);
688688
const ArenaTypes::DoorType doorType = doorDef.getType();
689689
DebugAssert(renderChunk.doorTransformBuffers.find(voxel) == renderChunk.doorTransformBuffers.end());
690690

@@ -758,7 +758,7 @@ void RenderVoxelChunkManager::updateChunkDrawCalls(RenderVoxelChunk &renderChunk
758758

759759
VoxelChunk::DoorDefID doorDefID;
760760
const bool isDoor = voxelChunk.tryGetDoorDefID(voxel.x, voxel.y, voxel.z, &doorDefID);
761-
const DoorDefinition *doorDef = isDoor ? &voxelChunk.getDoorDef(doorDefID) : nullptr;
761+
const VoxelDoorDefinition *doorDef = isDoor ? &voxelChunk.getDoorDef(doorDefID) : nullptr;
762762

763763
double doorAnimPercent = 0.0;
764764
if (isDoor)
@@ -775,15 +775,15 @@ void RenderVoxelChunkManager::updateChunkDrawCalls(RenderVoxelChunk &renderChunk
775775
VoxelChunk::ChasmDefID chasmDefID;
776776
const bool isChasm = voxelChunk.tryGetChasmDefID(voxel.x, voxel.y, voxel.z, &chasmDefID);
777777

778-
const ChasmDefinition *chasmDef = nullptr;
778+
const VoxelChasmDefinition *chasmDef = nullptr;
779779
bool isAnimatingChasm = false;
780780
bool isEmissiveChasm = false;
781781
bool hasChasmWall = false;
782782
IndexBufferID chasmWallIndexBufferID = -1;
783783
if (isChasm)
784784
{
785785
chasmDef = &voxelChunk.getChasmDef(chasmDefID);
786-
isAnimatingChasm = chasmDef->animType == ChasmDefinition::AnimationType::Animated;
786+
isAnimatingChasm = chasmDef->animType == VoxelChasmDefinition::AnimationType::Animated;
787787
isEmissiveChasm = chasmDef->isEmissive;
788788

789789
const auto chasmWallIndexBufferIdIter = renderChunk.chasmWallIndexBufferIDsMap.find(voxel);
@@ -1374,7 +1374,7 @@ void RenderVoxelChunkManager::update(BufferView<const ChunkInt2> activeChunkPosi
13741374
continue;
13751375
}
13761376

1377-
const DoorDefinition &doorDef = voxelChunk.getDoorDef(doorDefID);
1377+
const VoxelDoorDefinition &doorDef = voxelChunk.getDoorDef(doorDefID);
13781378
const ArenaTypes::DoorType doorType = doorDef.getType();
13791379
const WorldDouble3 worldPosition = MakeVoxelWorldPosition(voxelChunk.getPosition(), doorVoxel, ceilingScale);
13801380
const double doorAnimPercent = DoorUtils::getAnimPercentOrZero(doorVoxel.x, doorVoxel.y, doorVoxel.z, voxelChunk);

OpenTESArena/src/Rendering/RenderVoxelChunkManager.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class RenderVoxelChunkManager final : public SpecializedChunkManager<RenderVoxel
4040
// The draw call and pixel shader need two textures in order to support chasm wall rendering.
4141
struct LoadedChasmFloorTextureList
4242
{
43-
ChasmDefinition::AnimationType animType;
43+
VoxelChasmDefinition::AnimationType animType;
4444

4545
uint8_t paletteIndex;
4646
std::vector<TextureAsset> textureAssets;

OpenTESArena/src/Voxels/DoorDefinition.cpp

Lines changed: 0 additions & 40 deletions
This file was deleted.

OpenTESArena/src/Voxels/ChasmDefinition.cpp renamed to OpenTESArena/src/Voxels/VoxelChasmDefinition.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,33 @@
11
#include <algorithm>
22

33
#include "ArenaChasmUtils.h"
4-
#include "ChasmDefinition.h"
4+
#include "VoxelChasmDefinition.h"
55
#include "../Rendering/ArenaRenderUtils.h"
66

7-
ChasmDefinition::SolidColor::SolidColor()
7+
VoxelChasmDefinition::SolidColor::SolidColor()
88
{
99
this->paletteIndex = 0;
1010
}
1111

12-
void ChasmDefinition::SolidColor::init(uint8_t paletteIndex)
12+
void VoxelChasmDefinition::SolidColor::init(uint8_t paletteIndex)
1313
{
1414
this->paletteIndex = paletteIndex;
1515
}
1616

17-
void ChasmDefinition::Animated::init(Buffer<TextureAsset> &&textureAssets)
17+
void VoxelChasmDefinition::Animated::init(Buffer<TextureAsset> &&textureAssets)
1818
{
1919
this->textureAssets = std::move(textureAssets);
2020
}
2121

22-
ChasmDefinition::ChasmDefinition()
22+
VoxelChasmDefinition::VoxelChasmDefinition()
2323
{
2424
this->allowsSwimming = false;
2525
this->isDamaging = false;
2626
this->isEmissive = false;
2727
this->animType = static_cast<AnimationType>(-1);
2828
}
2929

30-
ChasmDefinition::ChasmDefinition(const ChasmDefinition &other)
30+
VoxelChasmDefinition::VoxelChasmDefinition(const VoxelChasmDefinition &other)
3131
{
3232
this->allowsSwimming = other.allowsSwimming;
3333
this->isDamaging = other.isDamaging;
@@ -52,7 +52,7 @@ ChasmDefinition::ChasmDefinition(const ChasmDefinition &other)
5252
}
5353
}
5454

55-
void ChasmDefinition::initClassic(ArenaTypes::ChasmType chasmType, const TextureAsset &wallTextureAsset,
55+
void VoxelChasmDefinition::initClassic(ArenaTypes::ChasmType chasmType, const TextureAsset &wallTextureAsset,
5656
TextureManager &textureManager)
5757
{
5858
this->allowsSwimming = ArenaChasmUtils::allowsSwimming(chasmType);

OpenTESArena/src/Voxels/ChasmDefinition.h renamed to OpenTESArena/src/Voxels/VoxelChasmDefinition.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
class TextureManager;
1212

13-
struct ChasmDefinition
13+
struct VoxelChasmDefinition
1414
{
1515
enum class AnimationType
1616
{
@@ -43,8 +43,8 @@ struct ChasmDefinition
4343
SolidColor solidColor;
4444
Animated animated;
4545

46-
ChasmDefinition();
47-
ChasmDefinition(const ChasmDefinition &other);
46+
VoxelChasmDefinition();
47+
VoxelChasmDefinition(const VoxelChasmDefinition &other);
4848

4949
void initClassic(ArenaTypes::ChasmType chasmType, const TextureAsset &wallTextureAsset, TextureManager &textureManager);
5050
};

OpenTESArena/src/Voxels/VoxelChunk.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -143,13 +143,13 @@ const std::string &VoxelChunk::getBuildingName(BuildingNameID id) const
143143
return this->buildingNames[id];
144144
}
145145

146-
const DoorDefinition &VoxelChunk::getDoorDef(DoorDefID id) const
146+
const VoxelDoorDefinition &VoxelChunk::getDoorDef(DoorDefID id) const
147147
{
148148
DebugAssertIndex(this->doorDefs, id);
149149
return this->doorDefs[id];
150150
}
151151

152-
const ChasmDefinition &VoxelChunk::getChasmDef(ChasmDefID id) const
152+
const VoxelChasmDefinition &VoxelChunk::getChasmDef(ChasmDefID id) const
153153
{
154154
DebugAssertIndex(this->chasmDefs, id);
155155
return this->chasmDefs[id];
@@ -502,14 +502,14 @@ VoxelChunk::BuildingNameID VoxelChunk::addBuildingName(std::string &&buildingNam
502502
return id;
503503
}
504504

505-
VoxelChunk::DoorDefID VoxelChunk::addDoorDef(DoorDefinition &&door)
505+
VoxelChunk::DoorDefID VoxelChunk::addDoorDef(VoxelDoorDefinition &&door)
506506
{
507507
const DoorDefID id = static_cast<int>(this->doorDefs.size());
508508
this->doorDefs.emplace_back(std::move(door));
509509
return id;
510510
}
511511

512-
VoxelChunk::ChasmDefID VoxelChunk::addChasmDef(ChasmDefinition &&chasm)
512+
VoxelChunk::ChasmDefID VoxelChunk::addChasmDef(VoxelChasmDefinition &&chasm)
513513
{
514514
const ChasmDefID id = static_cast<int>(this->chasmDefs.size());
515515
this->chasmDefs.emplace_back(std::move(chasm));
@@ -676,9 +676,9 @@ void VoxelChunk::update(double dt, const CoordDouble3 &playerCoord, double ceili
676676
DebugCrash("Expected door def ID to exist.");
677677
}
678678

679-
const DoorDefinition &doorDef = this->getDoorDef(doorDefID);
680-
const DoorDefinition::CloseSoundDef &closeSoundDef = doorDef.getCloseSound();
681-
if (closeSoundDef.closeType == DoorDefinition::CloseType::OnClosing)
679+
const VoxelDoorDefinition &doorDef = this->getDoorDef(doorDefID);
680+
const VoxelDoorDefinition::CloseSoundDef &closeSoundDef = doorDef.getCloseSound();
681+
if (closeSoundDef.closeType == VoxelDoorDefinition::CloseType::OnClosing)
682682
{
683683
const WorldDouble3 absoluteSoundPosition = VoxelUtils::coordToWorldPoint(voxelCoord);
684684
audioManager.playSound(closeSoundDef.soundFilename.c_str(), absoluteSoundPosition);
@@ -695,9 +695,9 @@ void VoxelChunk::update(double dt, const CoordDouble3 &playerCoord, double ceili
695695
DebugCrash("Expected door def ID to exist.");
696696
}
697697

698-
const DoorDefinition &doorDef = this->getDoorDef(doorDefID);
699-
const DoorDefinition::CloseSoundDef &closeSoundDef = doorDef.getCloseSound();
700-
if (closeSoundDef.closeType == DoorDefinition::CloseType::OnClosed)
698+
const VoxelDoorDefinition &doorDef = this->getDoorDef(doorDefID);
699+
const VoxelDoorDefinition::CloseSoundDef &closeSoundDef = doorDef.getCloseSound();
700+
if (closeSoundDef.closeType == VoxelDoorDefinition::CloseType::OnClosed)
701701
{
702702
const CoordDouble3 soundCoord(chunkPos, VoxelUtils::getVoxelCenter(voxel, ceilingScale));
703703
const WorldDouble3 absoluteSoundPosition = VoxelUtils::coordToWorldPoint(soundCoord);

OpenTESArena/src/Voxels/VoxelChunk.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99
#include <unordered_map>
1010
#include <vector>
1111

12-
#include "ChasmDefinition.h"
13-
#include "DoorDefinition.h"
12+
#include "VoxelChasmDefinition.h"
1413
#include "VoxelChasmWallInstance.h"
1514
#include "VoxelDirtyType.h"
1615
#include "VoxelDoorAnimationInstance.h"
16+
#include "VoxelDoorDefinition.h"
1717
#include "VoxelDoorVisibilityInstance.h"
1818
#include "VoxelFadeAnimationInstance.h"
1919
#include "VoxelShapeDefinition.h"
@@ -55,8 +55,8 @@ class VoxelChunk final : public Chunk
5555
std::vector<VoxelTriggerDefinition> triggerDefs;
5656
std::vector<LockDefinition> lockDefs;
5757
std::vector<std::string> buildingNames;
58-
std::vector<DoorDefinition> doorDefs;
59-
std::vector<ChasmDefinition> chasmDefs;
58+
std::vector<VoxelDoorDefinition> doorDefs;
59+
std::vector<VoxelChasmDefinition> chasmDefs;
6060

6161
// Indices into definitions for actual voxels in-game.
6262
Buffer3D<VoxelShapeDefID> shapeDefIDs;
@@ -141,8 +141,8 @@ class VoxelChunk final : public Chunk
141141
const VoxelTriggerDefinition &getTriggerDef(TriggerDefID id) const;
142142
const LockDefinition &getLockDef(LockDefID id) const;
143143
const std::string &getBuildingName(BuildingNameID id) const;
144-
const DoorDefinition &getDoorDef(DoorDefID id) const;
145-
const ChasmDefinition &getChasmDef(ChasmDefID id) const;
144+
const VoxelDoorDefinition &getDoorDef(DoorDefID id) const;
145+
const VoxelChasmDefinition &getChasmDef(ChasmDefID id) const;
146146

147147
VoxelShapeDefID getShapeDefID(SNInt x, int y, WEInt z) const;
148148
VoxelTextureDefID getTextureDefID(SNInt x, int y, WEInt z) const;
@@ -192,8 +192,8 @@ class VoxelChunk final : public Chunk
192192
TriggerDefID addTriggerDef(VoxelTriggerDefinition &&trigger);
193193
LockDefID addLockDef(LockDefinition &&lock);
194194
BuildingNameID addBuildingName(std::string &&buildingName);
195-
DoorDefID addDoorDef(DoorDefinition &&door);
196-
ChasmDefID addChasmDef(ChasmDefinition &&chasm);
195+
DoorDefID addDoorDef(VoxelDoorDefinition &&door);
196+
ChasmDefID addChasmDef(VoxelChasmDefinition &&chasm);
197197

198198
void addTransitionDefPosition(TransitionDefID id, const VoxelInt3 &voxel);
199199
void addTriggerDefPosition(TriggerDefID id, const VoxelInt3 &voxel);

0 commit comments

Comments
 (0)