Remove the tumours left by g++ uints and ushorts, as well as Pointer.h
parent
fb0fd13d4a
commit
06bbb0ca5f
|
@ -184,7 +184,6 @@ set(ZEPHA_SRC
|
|||
game/entity/AnimationState.cpp
|
||||
game/entity/AnimationState.h
|
||||
game/entity/AnimationSegment.h
|
||||
util/Pointer.h
|
||||
lua/api/type/cLocalLuaEntity.h
|
||||
StartGame.h
|
||||
game/graph/shader/SSAOShader.cpp
|
||||
|
@ -280,6 +279,6 @@ set(ZEPHA_SRC
|
|||
util/net/Serializer.h
|
||||
util/net/Deserializer.h
|
||||
lua/api/type/ServerLocalLuaEntity.cpp
|
||||
lua/api/type/ServerLocalLuaEntity.h lua/api/modules/register_item.h lua/api/modules/register_biome.h lua/api/modules/delay.h lua/api/modules/register_block.h lua/api/modules/register_blockmodel.h lua/api/modules/register_entity.h game/scene/world/World.cpp game/scene/world/World.h lua/api/modules/set_block.h lua/api/modules/get_block.h lua/api/modules/remove_block.h lua/register/RegisterBiomes.h lua/register/RegisterBlocks.h lua/register/RegisterItems.h lua/register/RegisterKeybinds.h lua/api/type/LocalLuaAnimationManager.cpp lua/api/type/LocalLuaAnimationManager.h lua/api/type/cLocalLuaAnimationManager.h)
|
||||
lua/api/type/ServerLocalLuaEntity.h lua/api/modules/register_item.h lua/api/modules/register_biome.h lua/api/modules/delay.h lua/api/modules/register_block.h lua/api/modules/register_blockmodel.h lua/api/modules/register_entity.h game/scene/world/World.cpp game/scene/world/World.h lua/api/modules/set_block.h lua/api/modules/get_block.h lua/api/modules/remove_block.h lua/register/RegisterBiomes.h lua/register/RegisterBlocks.h lua/register/RegisterItems.h lua/register/RegisterKeybinds.h lua/api/type/LocalLuaAnimationManager.cpp lua/api/type/LocalLuaAnimationManager.h lua/api/type/cLocalLuaAnimationManager.h game/scene/world/Schematic.cpp game/scene/world/Schematic.h)
|
||||
|
||||
add_library (Zepha_Core ${ZEPHA_SRC})
|
|
@ -198,7 +198,7 @@ void MapGen::generateStructures(chunk_partials_map& chunks, chunk_partial& chunk
|
|||
for (unsigned int j = 0; j < 5; j++) {
|
||||
rp.z = p.z - 2 + j;
|
||||
for (unsigned int k = 0; k < 2; k++) {
|
||||
rp.y = p.y + 3 + k;
|
||||
rp.y = p.y + 48 + k;
|
||||
setBlock(rp, cLeaves, chunks);
|
||||
}
|
||||
}
|
||||
|
@ -210,13 +210,13 @@ void MapGen::generateStructures(chunk_partials_map& chunks, chunk_partial& chunk
|
|||
for (unsigned int j = 0; j < 3; j++) {
|
||||
rp.z = p.z - 1 + j;
|
||||
for (unsigned int k = 0; k < 2; k++) {
|
||||
rp.y = p.y + 5 + k;
|
||||
rp.y = p.y + 50 + k;
|
||||
setBlock(rp, cLeaves, chunks);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (unsigned int i = 0; i < 5; i++) {
|
||||
for (unsigned int i = 0; i < 50; i++) {
|
||||
setBlock(p, cWood, chunks);
|
||||
p.y++;
|
||||
}
|
||||
|
@ -235,7 +235,8 @@ void MapGen::setBlock(glm::ivec3 worldPos, unsigned int block, MapGen::chunk_par
|
|||
chunks.insert(std::pair<glm::ivec3, chunk_partial>{chunkPos, {new MapGenJob(), chunk}});
|
||||
}
|
||||
|
||||
chunk->setBlock(Space::Block::relative::toChunk(worldPos), block);
|
||||
unsigned int index = Space::Block::index(worldPos);
|
||||
if (chunk->getBlock(index) <= DefinitionAtlas::AIR) chunk->setBlock(index, block);
|
||||
}
|
||||
|
||||
std::shared_ptr<BlockChunk> MapGen::combinePartials(std::shared_ptr<BlockChunk> a, std::shared_ptr<BlockChunk> b) {
|
||||
|
|
|
@ -20,8 +20,8 @@ BlockDef::BlockDef(const std::string& identifier, unsigned int index, const std:
|
|||
cBoxes(cBoxes) {}
|
||||
|
||||
void BlockDef::createModel() {
|
||||
uptr<EntityMesh> entity = std::make_unique<EntityMesh>();
|
||||
uint indOffset = 0;
|
||||
std::unique_ptr<EntityMesh> entity = std::make_unique<EntityMesh>();
|
||||
unsigned int indOffset = 0;
|
||||
|
||||
std::vector<EntityVertex> entityVertices;
|
||||
std::vector<GuiVertex> guiVertices;
|
||||
|
|
|
@ -31,8 +31,8 @@ public:
|
|||
|
||||
std::vector<SelectionBox> sBoxes;
|
||||
std::vector<SelectionBox> cBoxes;
|
||||
sptr<Model> entityModel = std::make_shared<Model>();
|
||||
sptr<GuiMesh> guiModel = std::make_shared<GuiMesh>();
|
||||
std::shared_ptr<Model> entityModel = std::make_shared<Model>();
|
||||
std::shared_ptr<GuiMesh> guiModel = std::make_shared<GuiMesh>();
|
||||
|
||||
std::unordered_map<Callback, sol::function, Util::EnumClassHash> callbacks {};
|
||||
};
|
||||
|
|
|
@ -5,26 +5,26 @@
|
|||
#include "CraftItemDef.h"
|
||||
|
||||
CraftItemDef::CraftItemDef(const std::string &identifier, const std::string &name, unsigned short maxStackSize,
|
||||
const std::vector<std::string>& textures, const std::vector<sptr<AtlasRef>>& textureRefs) :
|
||||
const std::vector<std::string>& textures, const std::vector<std::shared_ptr<AtlasRef>>& textureRefs) :
|
||||
CraftItemDef(identifier, 0, name, maxStackSize, textures, textureRefs) {}
|
||||
|
||||
CraftItemDef::CraftItemDef(const std::string& identifier, unsigned int index, const std::string& name,
|
||||
unsigned short maxStackSize, const std::vector<std::string>& textures, const std::vector<sptr<AtlasRef>>& textureRefs) :
|
||||
unsigned short maxStackSize, const std::vector<std::string>& textures, const std::vector<std::shared_ptr<AtlasRef>>& textureRefs) :
|
||||
|
||||
ItemDef {identifier, name, index, maxStackSize, ItemDef::Type::CRAFTITEM},
|
||||
textures(textures),
|
||||
textureRefs(textureRefs) {}
|
||||
|
||||
void CraftItemDef::createModel(TextureAtlas& atlas) {
|
||||
uptr<EntityMesh> mesh = std::make_unique<EntityMesh>();
|
||||
std::unique_ptr<EntityMesh> mesh = std::make_unique<EntityMesh>();
|
||||
|
||||
std::vector<EntityVertex> vertices;
|
||||
std::vector<unsigned int> indices {0, 1, 2, 2, 3, 0, 4, 7, 6, 6, 5, 4};
|
||||
|
||||
const sptr<AtlasRef>& ref = textureRefs[0];
|
||||
const std::shared_ptr<AtlasRef>& ref = textureRefs[0];
|
||||
static const float xo = 0.040f;
|
||||
|
||||
for (uint i = 0; i <= 1; i++) {
|
||||
for (unsigned int i = 0; i <= 1; i++) {
|
||||
float xx = xo * (i == 1 ? -1 : 1);
|
||||
std::vector<EntityVertex> myVerts = {
|
||||
{{xx, -0.5, -0.5}, {ref->uv.x, ref->uv.w, 0, 0}, {1, 1, 1}, true, {(i == 1 ? -1 : 1), 0, 0}, {}, {}},
|
||||
|
@ -35,8 +35,8 @@ void CraftItemDef::createModel(TextureAtlas& atlas) {
|
|||
vertices.insert(vertices.end(), myVerts.begin(), myVerts.end());
|
||||
}
|
||||
|
||||
uint indOffset = 8;
|
||||
for (uint i = 0; i < 16*16; i++) {
|
||||
unsigned int indOffset = 8;
|
||||
for (unsigned int i = 0; i < 16*16; i++) {
|
||||
glm::vec2 samplePos = {i % 16, i / 16};
|
||||
glm::vec2 off {samplePos.x / 16.f, samplePos.y / 16.f};
|
||||
glm::vec4 col = atlas.sampleTexturePixel(ref, samplePos);
|
||||
|
@ -50,7 +50,7 @@ void CraftItemDef::createModel(TextureAtlas& atlas) {
|
|||
{{ xo, 0.5 - off.y, -0.5 + off.x + 0.0625}, col, {1, 1, 1}, false, {0, 1, 0}, {}, {}},
|
||||
{{ xo, 0.5 - off.y, -0.5 + off.x }, col, {1, 1, 1}, false, {0, 1, 0}, {}, {}}};
|
||||
vertices.insert(vertices.end(), myVerts.begin(), myVerts.end());
|
||||
std::vector<uint> myInds = {indOffset, indOffset+1, indOffset+2, indOffset+2, indOffset+3, indOffset};
|
||||
std::vector<unsigned int> myInds = {indOffset, indOffset+1, indOffset+2, indOffset+2, indOffset+3, indOffset};
|
||||
indices.insert(indices.end(), myInds.begin(), myInds.end());
|
||||
indOffset += 4;
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ void CraftItemDef::createModel(TextureAtlas& atlas) {
|
|||
{{ xo, 0.5 - off.y - 0.0625, -0.5 + off.x + 0.0625}, col, {1, 1, 1}, false, {0, -1, 0}, {}, {}},
|
||||
{{ xo, 0.5 - off.y - 0.0625, -0.5 + off.x }, col, {1, 1, 1}, false, {0, -1, 0}, {}, {}}};
|
||||
vertices.insert(vertices.end(), myVerts.begin(), myVerts.end());
|
||||
std::vector<uint> myInds = {indOffset, indOffset+3, indOffset+2, indOffset+2, indOffset+1, indOffset};
|
||||
std::vector<unsigned int> myInds = {indOffset, indOffset+3, indOffset+2, indOffset+2, indOffset+1, indOffset};
|
||||
indices.insert(indices.end(), myInds.begin(), myInds.end());
|
||||
indOffset += 4;
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ void CraftItemDef::createModel(TextureAtlas& atlas) {
|
|||
{{ xo, 0.5 - off.y , -0.5 + off.x}, col, {1, 1, 1}, false, {0, 0, 1}, {}, {}},
|
||||
{{ xo, 0.5 - off.y - 0.0625, -0.5 + off.x}, col, {1, 1, 1}, false, {0, 0, 1}, {}, {}}};
|
||||
vertices.insert(vertices.end(), myVerts.begin(), myVerts.end());
|
||||
std::vector<uint> myInds = {indOffset, indOffset+1, indOffset+2, indOffset+2, indOffset+3, indOffset};
|
||||
std::vector<unsigned int> myInds = {indOffset, indOffset+1, indOffset+2, indOffset+2, indOffset+3, indOffset};
|
||||
indices.insert(indices.end(), myInds.begin(), myInds.end());
|
||||
indOffset += 4;
|
||||
}
|
||||
|
@ -86,7 +86,7 @@ void CraftItemDef::createModel(TextureAtlas& atlas) {
|
|||
{{ xo, 0.5 - off.y , -0.5 + off.x + 0.0625}, col, {1, 1, 1}, false, {0, 0, -1}, {}, {}},
|
||||
{{ xo, 0.5 - off.y - 0.0625, -0.5 + off.x + 0.0625}, col, {1, 1, 1}, false, {0, 0, -1}, {}, {}}};
|
||||
vertices.insert(vertices.end(), myVerts.begin(), myVerts.end());
|
||||
std::vector<uint> myInds = {indOffset, indOffset+3, indOffset+2, indOffset+2, indOffset+1, indOffset};
|
||||
std::vector<unsigned int> myInds = {indOffset, indOffset+3, indOffset+2, indOffset+2, indOffset+1, indOffset};
|
||||
indices.insert(indices.end(), myInds.begin(), myInds.end());
|
||||
indOffset += 4;
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
|
||||
#include <vector>
|
||||
#include "../ItemDef.h"
|
||||
#include "../../util/Pointer.h"
|
||||
#include "../texture/AtlasRef.h"
|
||||
#include "../../game/entity/Model.h"
|
||||
|
||||
|
@ -14,15 +13,15 @@ class CraftItemDef : public ItemDef {
|
|||
public:
|
||||
CraftItemDef() = default;
|
||||
CraftItemDef(const std::string& identifier, const std::string& name, unsigned short maxStackSize,
|
||||
const std::vector<std::string>& textures, const std::vector<sptr<AtlasRef>>& textureRefs);
|
||||
const std::vector<std::string>& textures, const std::vector<std::shared_ptr<AtlasRef>>& textureRefs);
|
||||
|
||||
CraftItemDef(const std::string& identifier, unsigned int index, const std::string& name,
|
||||
unsigned short maxStackSize, const std::vector<std::string>& textures, const std::vector<sptr<AtlasRef>>& textureRefs);
|
||||
unsigned short maxStackSize, const std::vector<std::string>& textures, const std::vector<std::shared_ptr<AtlasRef>>& textureRefs);
|
||||
|
||||
void createModel(TextureAtlas& atlas);
|
||||
|
||||
std::vector<std::string> textures {};
|
||||
std::vector<sptr<AtlasRef>> textureRefs {};
|
||||
std::vector<std::shared_ptr<AtlasRef>> textureRefs {};
|
||||
|
||||
sptr<Model> entityModel = std::make_shared<Model>();
|
||||
std::shared_ptr<Model> entityModel = std::make_shared<Model>();
|
||||
};
|
||||
|
|
|
@ -11,8 +11,8 @@ Font::Font(TextureAtlas& atlas, std::shared_ptr<AtlasRef> tex) :
|
|||
getCharWidths(atlas);
|
||||
}
|
||||
|
||||
uint Font::getCharWidth(char c) {
|
||||
uint index = static_cast<uint>(c) - 32;
|
||||
unsigned int Font::getCharWidth(char c) {
|
||||
unsigned int index = static_cast<unsigned int>(c) - 32;
|
||||
if (index >= amountOfChars) {
|
||||
std::cout << Log::err << "Invalid char index!" << std::endl;
|
||||
return 0;
|
||||
|
@ -28,18 +28,18 @@ void Font::getCharWidths(TextureAtlas &atlas) {
|
|||
for (unsigned int i = 1; i < amountOfChars; i++) {
|
||||
glm::vec2 charPos = {i % 18 * charWidth, std::floor(i / 18) * charHeight};
|
||||
|
||||
uint xBase = static_cast<uint>(fontTex->pos.x) + static_cast<uint>(charPos.x);
|
||||
uint yBase = static_cast<uint>(fontTex->pos.y) + static_cast<uint>(charPos.y);
|
||||
unsigned int xBase = static_cast<unsigned int>(fontTex->pos.x) + static_cast<unsigned int>(charPos.x);
|
||||
unsigned int yBase = static_cast<unsigned int>(fontTex->pos.y) + static_cast<unsigned int>(charPos.y);
|
||||
|
||||
unsigned short width = 0;
|
||||
|
||||
for (uint j = 0; j < charWidth; j++) {
|
||||
for (unsigned int j = 0; j < charWidth; j++) {
|
||||
bool empty = true;
|
||||
for (uint k = 0; k < charHeight; k++) {
|
||||
uint xx = xBase + j;
|
||||
uint yy = yBase + k;
|
||||
for (unsigned int k = 0; k < charHeight; k++) {
|
||||
unsigned int xx = xBase + j;
|
||||
unsigned int yy = yBase + k;
|
||||
|
||||
uint offset = yy * static_cast<uint>(atlasSize.x) * 4 + xx * 4 + 3;
|
||||
unsigned int offset = yy * static_cast<unsigned int>(atlasSize.x) * 4 + xx * 4 + 3;
|
||||
|
||||
if (data[offset] != 0) {
|
||||
empty = false;
|
||||
|
@ -54,7 +54,7 @@ void Font::getCharWidths(TextureAtlas &atlas) {
|
|||
}
|
||||
|
||||
glm::vec4 Font::getCharUVs(char c) {
|
||||
uint index = static_cast<uint>(c) - 32;
|
||||
unsigned int index = static_cast<unsigned int>(c) - 32;
|
||||
if (index >= amountOfChars) {
|
||||
std::cout << Log::err << "Invalid char index!" << std::endl;
|
||||
return {};
|
||||
|
|
|
@ -12,7 +12,7 @@ class Font {
|
|||
public:
|
||||
Font() = default;
|
||||
Font(TextureAtlas& atlas, std::shared_ptr<AtlasRef> tex);
|
||||
uint getCharWidth(char c);
|
||||
unsigned int getCharWidth(char c);
|
||||
glm::vec4 getCharUVs(char c);
|
||||
|
||||
const static unsigned int amountOfChars = 95;
|
||||
|
|
|
@ -74,9 +74,9 @@ void TextureAtlas::update() {
|
|||
}
|
||||
}
|
||||
|
||||
glm::vec4 TextureAtlas::sampleTexturePixel(const sptr<AtlasRef> &atlasRef, glm::vec2 pixel) {
|
||||
glm::vec4 TextureAtlas::sampleTexturePixel(const std::shared_ptr<AtlasRef> &atlasRef, glm::vec2 pixel) {
|
||||
glm::vec2 absPos = {atlasRef->pos.x + pixel.x, atlasRef->pos.y + pixel.y};
|
||||
uint index = (static_cast<unsigned int>(absPos.y) * pixelSize.x + static_cast<unsigned int>(absPos.x)) * 4;
|
||||
unsigned int index = (static_cast<unsigned int>(absPos.y) * pixelSize.x + static_cast<unsigned int>(absPos.x)) * 4;
|
||||
|
||||
return {
|
||||
static_cast<float>(atlasData[index]) / 255.f,
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
#include "AtlasRef.h"
|
||||
#include "RawTexData.h"
|
||||
#include "../../util/Log.h"
|
||||
#include "../../util/Pointer.h"
|
||||
#include "../../game/graph/Texture.h"
|
||||
|
||||
class TextureAtlas {
|
||||
|
@ -28,7 +27,7 @@ public:
|
|||
|
||||
void update();
|
||||
|
||||
glm::vec4 sampleTexturePixel(const sptr<AtlasRef>& atlasRef, glm::vec2 pixel);
|
||||
glm::vec4 sampleTexturePixel(const std::shared_ptr<AtlasRef>& atlasRef, glm::vec2 pixel);
|
||||
|
||||
std::shared_ptr<AtlasRef> addImage(unsigned char *data, const std::string& name, bool base, int texWidth, int texHeight);
|
||||
std::shared_ptr<AtlasRef> generateCrackImage(const std::string &name, unsigned short crackLevel);
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
//
|
||||
|
||||
#include "AnimationState.h"
|
||||
typedef unsigned int uint;
|
||||
|
||||
AnimationState::AnimationState(Model &source) {
|
||||
const ModelAnimation& animation = source.getAnimation();
|
||||
|
@ -20,7 +19,7 @@ void AnimationState::setAnimations(const std::vector<AnimationSegment> &anims) {
|
|||
}
|
||||
}
|
||||
|
||||
void AnimationState::defineAnimation(const std::string& animationName, uint startFrame, uint endFrame) {
|
||||
void AnimationState::defineAnimation(const std::string& animationName, unsigned int startFrame, unsigned int endFrame) {
|
||||
animations.emplace(animationName, AnimationSegment {animationName, startFrame, endFrame});
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ public:
|
|||
void update(double delta);
|
||||
|
||||
void setAnimations(const std::vector<AnimationSegment>& anims);
|
||||
void defineAnimation(const std::string& animationName, uint startFrame, uint endFrame);
|
||||
void defineAnimation(const std::string& animationName, unsigned int startFrame, unsigned int endFrame);
|
||||
|
||||
void setAnimNamed(const std::string& animationName, double interpolateTime, bool loop);
|
||||
void setAnimRange(unsigned int startFrame, unsigned int endFrame, double interpolateTime, bool loop);
|
||||
|
@ -38,5 +38,5 @@ private:
|
|||
|
||||
double currentFrame = 0;
|
||||
double ticksPerSecond = 0;
|
||||
uint duration = 0;
|
||||
unsigned int duration = 0;
|
||||
};
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
#include "Model.h"
|
||||
|
||||
void Model::fromMesh(uptr<EntityMesh> mesh) {
|
||||
void Model::fromMesh(std::unique_ptr<EntityMesh> mesh) {
|
||||
meshes.clear();
|
||||
meshes.push_back(std::move(mesh));
|
||||
}
|
||||
|
@ -70,23 +70,23 @@ const ModelAnimation &Model::getAnimation() {
|
|||
}
|
||||
|
||||
void Model::loadModelMeshes(aiNode *node, const aiScene *scene) {
|
||||
for (uint i = 0; i < node->mNumMeshes; i++) {
|
||||
for (unsigned int i = 0; i < node->mNumMeshes; i++) {
|
||||
aiMesh* mesh = scene->mMeshes[node->mMeshes[i]];
|
||||
meshes.emplace_back(std::make_unique<EntityMesh>());
|
||||
loadMeshAndBone(mesh, meshes[i]);
|
||||
}
|
||||
|
||||
for (uint i = 0; i < node->mNumChildren; i++) {
|
||||
for (unsigned int i = 0; i < node->mNumChildren; i++) {
|
||||
loadModelMeshes(node->mChildren[i], scene); //Recurse down
|
||||
}
|
||||
}
|
||||
|
||||
void Model::loadMeshAndBone(aiMesh *mesh, uptr<EntityMesh>& target) {
|
||||
void Model::loadMeshAndBone(aiMesh *mesh, std::unique_ptr<EntityMesh>& target) {
|
||||
std::vector<EntityVertex> vertices;
|
||||
std::vector<unsigned int> indices;
|
||||
|
||||
//Process Vertices
|
||||
for (uint i = 0; i < mesh->mNumVertices; i++) {
|
||||
for (unsigned int i = 0; i < mesh->mNumVertices; i++) {
|
||||
EntityVertex vertex {};
|
||||
|
||||
vertex.position = {mesh->mVertices[i].x, mesh->mVertices[i].y, mesh->mVertices[i].z};
|
||||
|
@ -110,26 +110,26 @@ void Model::loadMeshAndBone(aiMesh *mesh, uptr<EntityMesh>& target) {
|
|||
}
|
||||
|
||||
//Process Indices
|
||||
for (uint i = 0; i < mesh->mNumFaces; i++) {
|
||||
for (unsigned int i = 0; i < mesh->mNumFaces; i++) {
|
||||
aiFace face = mesh->mFaces[i];
|
||||
for (uint j = 0; j < face.mNumIndices; j++) {
|
||||
for (unsigned int j = 0; j < face.mNumIndices; j++) {
|
||||
indices.push_back(face.mIndices[j]);
|
||||
}
|
||||
}
|
||||
|
||||
//Process Mesh Bones and add to bone list
|
||||
bones.resize(mesh->mNumBones);
|
||||
for (uint i = 0; i < mesh->mNumBones; i++) {
|
||||
for (unsigned int i = 0; i < mesh->mNumBones; i++) {
|
||||
aiBone* bone = mesh->mBones[i];
|
||||
|
||||
bones[i] = ModelBone(static_cast<uint>(i), -1, {bone->mName.data});
|
||||
bones[i] = ModelBone(static_cast<unsigned int>(i), -1, {bone->mName.data});
|
||||
bones[i].offsetMatrix = glm::transpose(MatConv::AiToGLMMat4(bone->mOffsetMatrix));
|
||||
|
||||
for (uint j = 0; j < bone->mNumWeights; j++) {
|
||||
for (unsigned int j = 0; j < bone->mNumWeights; j++) {
|
||||
aiVertexWeight* weight = &bone->mWeights[j];
|
||||
if (weight->mVertexId >= vertices.size()) assert(0);
|
||||
|
||||
uint bid = 0;
|
||||
unsigned int bid = 0;
|
||||
while (vertices[weight->mVertexId].boneWeights[bid] != 0) {
|
||||
bid++;
|
||||
assert(bid < 4);
|
||||
|
@ -152,7 +152,7 @@ void Model::loadAnimations(const aiScene *scene) {
|
|||
|
||||
animation = ModelAnimation(aiAnim->mName.data);
|
||||
|
||||
animation.duration = static_cast<uint>(aiAnim->mDuration);
|
||||
animation.duration = static_cast<unsigned int>(aiAnim->mDuration);
|
||||
animation.ticksPerSecond = aiAnim->mTicksPerSecond;
|
||||
|
||||
animation.channels.resize(bones.size());
|
||||
|
@ -214,7 +214,7 @@ void Model::calcBoneHeirarchy(aiNode *node, const aiScene *scene, int parentBone
|
|||
}
|
||||
}
|
||||
|
||||
for (uint i = 0; i < node->mNumChildren; i++) {
|
||||
for (unsigned int i = 0; i < node->mNumChildren; i++) {
|
||||
calcBoneHeirarchy(node->mChildren[i], scene, index);
|
||||
}
|
||||
}
|
||||
|
@ -256,8 +256,8 @@ void Model::calcInterpolatedPosition(glm::vec3 &position, double animTime, Model
|
|||
if (channel.positionKeys.empty()) { position = glm::vec3(0); return; }
|
||||
if (channel.positionKeys.size() == 1) { position = channel.positionKeys[0].second; return; }
|
||||
|
||||
uint index = findPositionIndex(animTime, channel);
|
||||
uint nextIndex = index + 1;
|
||||
unsigned int index = findPositionIndex(animTime, channel);
|
||||
unsigned int nextIndex = index + 1;
|
||||
assert(nextIndex < channel.positionKeys.size());
|
||||
|
||||
double delta = channel.positionKeys[nextIndex].first - channel.positionKeys[index].first;
|
||||
|
@ -275,8 +275,8 @@ void Model::calcInterpolatedRotation(aiQuaternion &rotation, double animTime, Mo
|
|||
if (channel.rotationKeys.empty()) { return; }
|
||||
if (channel.rotationKeys.size() == 1) { rotation = channel.rotationKeys[0].second; return; }
|
||||
|
||||
uint index = findRotationIndex(animTime, channel);
|
||||
uint nextIndex = index + 1;
|
||||
unsigned int index = findRotationIndex(animTime, channel);
|
||||
unsigned int nextIndex = index + 1;
|
||||
assert(nextIndex < channel.rotationKeys.size());
|
||||
|
||||
double delta = channel.rotationKeys[nextIndex].first - channel.rotationKeys[index].first;
|
||||
|
@ -295,8 +295,8 @@ void Model::calcInterpolatedScale(glm::vec3 &scale, double animTime, ModelBone&
|
|||
if (channel.scaleKeys.empty()) { scale = glm::vec3(1); return; }
|
||||
if (channel.scaleKeys.size() == 1) { scale = channel.scaleKeys[0].second; return; }
|
||||
|
||||
uint index = findScaleIndex(animTime, channel);
|
||||
uint nextIndex = index + 1;
|
||||
unsigned int index = findScaleIndex(animTime, channel);
|
||||
unsigned int nextIndex = index + 1;
|
||||
assert(nextIndex < channel.scaleKeys.size());
|
||||
|
||||
double delta = channel.scaleKeys[nextIndex].first - channel.scaleKeys[index].first;
|
||||
|
|
|
@ -18,14 +18,13 @@
|
|||
#include "../graph/meshtypes/EntityMesh.h"
|
||||
#include "../../def/texture/TextureAtlas.h"
|
||||
#include "../../util/Mat4Conv.h"
|
||||
#include "../../util/Pointer.h"
|
||||
#include "../../def/model/SerializedModel.h"
|
||||
|
||||
class Model {
|
||||
public:
|
||||
Model() = default;
|
||||
|
||||
void fromMesh(uptr<EntityMesh> mesh);
|
||||
void fromMesh(std::unique_ptr<EntityMesh> mesh);
|
||||
int fromFile(const std::string &path, const std::vector<std::shared_ptr<AtlasRef>> &texture);
|
||||
int fromSerialized(const SerializedModel &model, const std::vector<std::shared_ptr<AtlasRef>> &texture);
|
||||
|
||||
|
@ -34,10 +33,10 @@ public:
|
|||
|
||||
const ModelAnimation& getAnimation();
|
||||
|
||||
std::vector<uptr<EntityMesh>> meshes;
|
||||
std::vector<std::unique_ptr<EntityMesh>> meshes;
|
||||
private:
|
||||
void loadModelMeshes(aiNode *node, const aiScene *scene);
|
||||
void loadMeshAndBone(aiMesh *mesh, uptr<EntityMesh> &target);
|
||||
void loadMeshAndBone(aiMesh *mesh, std::unique_ptr<EntityMesh> &target);
|
||||
void loadAnimations(const aiScene *scene);
|
||||
|
||||
void calcBoneHeirarchy(aiNode *node, const aiScene *scene, int parentBoneIndex);
|
||||
|
@ -48,21 +47,21 @@ private:
|
|||
void calcInterpolatedScale(glm::vec3& scale, double animTime, ModelBone& bone, AnimChannel& channel, std::tuple<unsigned int, unsigned int> bounds);
|
||||
|
||||
static inline unsigned int findPositionIndex(double animTime, AnimChannel &channel) {
|
||||
for (uint i = 1; i < channel.positionKeys.size(); i++) {
|
||||
for (unsigned int i = 1; i < channel.positionKeys.size(); i++) {
|
||||
if (channel.positionKeys[i].first > animTime) return i - 1;
|
||||
}
|
||||
assert(false);
|
||||
}
|
||||
|
||||
static inline unsigned int findRotationIndex(double animTime, AnimChannel &channel) {
|
||||
for (uint i = 1; i < channel.rotationKeys.size(); i++) {
|
||||
for (unsigned int i = 1; i < channel.rotationKeys.size(); i++) {
|
||||
if (channel.rotationKeys[i].first > animTime) return i - 1;
|
||||
}
|
||||
assert(false);
|
||||
}
|
||||
|
||||
static inline unsigned int findScaleIndex(double animTime, AnimChannel &channel) {
|
||||
for (uint i = 1; i < channel.scaleKeys.size(); i++) {
|
||||
for (unsigned int i = 1; i < channel.scaleKeys.size(); i++) {
|
||||
if (channel.scaleKeys[i].first > animTime) return i - 1;
|
||||
}
|
||||
assert(false);
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
#include <string>
|
||||
#include <vector>
|
||||
#include "AnimChannel.h"
|
||||
typedef unsigned int uint;
|
||||
|
||||
class ModelAnimation {
|
||||
public:
|
||||
|
@ -16,6 +15,6 @@ public:
|
|||
|
||||
std::string name = "";
|
||||
std::vector<AnimChannel> channels {};
|
||||
uint duration = 0;
|
||||
unsigned int duration = 0;
|
||||
double ticksPerSecond = 0;
|
||||
};
|
||||
|
|
|
@ -36,7 +36,7 @@ void BlockCrackEntity::update() {
|
|||
addFaces(indOffset, vertices, indices, model.parts[i]);
|
||||
}
|
||||
|
||||
uptr<EntityMesh> mesh = std::make_unique<EntityMesh>();
|
||||
std::unique_ptr<EntityMesh> mesh = std::make_unique<EntityMesh>();
|
||||
mesh->create(vertices, indices);
|
||||
this->model->fromMesh(std::move(mesh));
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ ParticleEntity::ParticleEntity(glm::vec3 pos, BlockDef &block) {
|
|||
|
||||
setPos(getPos() + glm::vec3(xDir, 0, zDir) / 4.f);
|
||||
|
||||
uptr<EntityMesh> mesh = std::make_unique<EntityMesh>();
|
||||
std::unique_ptr<EntityMesh> mesh = std::make_unique<EntityMesh>();
|
||||
mesh->create(vertices, indices);
|
||||
this->model->fromMesh(std::move(mesh));
|
||||
this->setScale(0.75f + (rand() % 10 / 20.f));
|
||||
|
|
|
@ -47,7 +47,7 @@ void WireframeEntity::buildMesh(const std::vector<SelectionBox>& boxes) {
|
|||
}
|
||||
|
||||
|
||||
uptr<EntityMesh> mesh = std::make_unique<EntityMesh>();
|
||||
std::unique_ptr<EntityMesh> mesh = std::make_unique<EntityMesh>();
|
||||
mesh->create(vertices, indices);
|
||||
this->model->fromMesh(std::move(mesh));
|
||||
}
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
#pragma once
|
||||
|
||||
#include "Shader.h"
|
||||
typedef unsigned int uint;
|
||||
|
||||
class LightingShader : public Shader {
|
||||
public:
|
||||
|
@ -24,11 +23,11 @@ public:
|
|||
|
||||
Uniforms uniforms {};
|
||||
|
||||
uint gBuffer;
|
||||
uint gPosition;
|
||||
uint gNormal;
|
||||
uint gColorSpec;
|
||||
uint rDepth;
|
||||
unsigned int gBuffer;
|
||||
unsigned int gPosition;
|
||||
unsigned int gNormal;
|
||||
unsigned int gColorSpec;
|
||||
unsigned int rDepth;
|
||||
|
||||
private:
|
||||
glm::ivec2 windowSize {};
|
||||
|
|
|
@ -3,9 +3,8 @@
|
|||
//
|
||||
|
||||
#include "SSAOShader.h"
|
||||
typedef unsigned int uint;
|
||||
|
||||
SSAOShader::SSAOShader(glm::ivec2 windowSize, float bufferScale, uint kernelCount) : Shader(),
|
||||
SSAOShader::SSAOShader(glm::ivec2 windowSize, float bufferScale, unsigned int kernelCount) : Shader(),
|
||||
windowSize(windowSize),
|
||||
bufferScale(bufferScale),
|
||||
kernelCount(kernelCount) {}
|
||||
|
@ -26,7 +25,7 @@ void SSAOShader::postCreate() {
|
|||
std::uniform_real_distribution<float> rand(0.0, 1.0);
|
||||
std::default_random_engine generator;
|
||||
|
||||
for (uint i = 0; i < kernelCount; i++) {
|
||||
for (unsigned int i = 0; i < kernelCount; i++) {
|
||||
glm::vec3 sample {
|
||||
rand(generator) * 2.0 - 1.0,
|
||||
rand(generator) * 2.0 - 1.0,
|
||||
|
@ -43,7 +42,7 @@ void SSAOShader::postCreate() {
|
|||
kernels.push_back(sample);
|
||||
}
|
||||
|
||||
for (uint i = 0; i < sampleCount; i++) {
|
||||
for (unsigned int i = 0; i < sampleCount; i++) {
|
||||
noise.emplace_back(rand(generator) * 2.0 - 1.0, rand(generator) * 2.0 - 1.0, 0.0f);
|
||||
}
|
||||
|
||||
|
|
|
@ -6,11 +6,10 @@
|
|||
|
||||
#include "Shader.h"
|
||||
#include <random>
|
||||
typedef unsigned int uint;
|
||||
|
||||
class SSAOShader : public Shader {
|
||||
public:
|
||||
explicit SSAOShader(glm::ivec2 windowSize, float bufferScale, uint kernelCount);
|
||||
explicit SSAOShader(glm::ivec2 windowSize, float bufferScale, unsigned int kernelCount);
|
||||
void postCreate() override;
|
||||
|
||||
void windowResized(glm::ivec2 windowSize);
|
||||
|
@ -24,8 +23,8 @@ public:
|
|||
|
||||
Uniforms uniforms {};
|
||||
|
||||
uint kernelCount = 32;
|
||||
uint sampleCount = 16;
|
||||
unsigned int kernelCount = 32;
|
||||
unsigned int sampleCount = 16;
|
||||
|
||||
std::vector<glm::vec3> kernels {};
|
||||
std::vector<glm::vec3> noise {};
|
||||
|
|
|
@ -55,7 +55,7 @@ GLint Shader::get(const std::string &name) {
|
|||
return glGetUniformLocation(shaderID, name.c_str());
|
||||
}
|
||||
|
||||
void Shader::set(int loc, uint val) {
|
||||
void Shader::set(int loc, unsigned int val) {
|
||||
crashIfInactive();
|
||||
glUniform1ui(loc, val);
|
||||
}
|
||||
|
@ -80,7 +80,7 @@ void Shader::set(int loc, glm::mat4 val) {
|
|||
glUniformMatrix4fv(loc, 1, GL_FALSE, glm::value_ptr(val));
|
||||
}
|
||||
|
||||
void Shader::setArr(int loc, uint count, glm::mat4 &start) {
|
||||
void Shader::setArr(int loc, unsigned int count, glm::mat4 &start) {
|
||||
crashIfInactive();
|
||||
glUniformMatrix4fv(loc, count, GL_FALSE, glm::value_ptr(start));
|
||||
}
|
||||
|
|
|
@ -14,8 +14,6 @@
|
|||
#include <glm/gtc/type_ptr.hpp>
|
||||
#include "../../../util/Log.h"
|
||||
|
||||
typedef unsigned int uint;
|
||||
|
||||
class Shader {
|
||||
public:
|
||||
Shader();
|
||||
|
@ -30,13 +28,13 @@ public:
|
|||
void use();
|
||||
static void clearShader();
|
||||
|
||||
void set(int loc, uint val);
|
||||
void set(int loc, unsigned int val);
|
||||
void set(int loc, int val);
|
||||
void set(int loc, float val);
|
||||
void set(int loc, glm::vec3 val);
|
||||
void set(int loc, glm::mat4 val);
|
||||
|
||||
void setArr(int loc, uint count, glm::mat4 &start);
|
||||
void setArr(int loc, unsigned int count, glm::mat4 &start);
|
||||
|
||||
void cleanup();
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
GUIModel::GUIModel(const std::string &key) : GUIComponent(key) {}
|
||||
|
||||
void GUIModel::create(glm::vec2 scale, sptr<GuiMesh> model) {
|
||||
void GUIModel::create(glm::vec2 scale, std::shared_ptr<GuiMesh> model) {
|
||||
entity.setMesh(model);
|
||||
entity.setScale({scale.x + padding.w + padding.y, scale.y + padding.x + padding.z, scale.x + padding.w + padding.y});
|
||||
}
|
||||
|
|
|
@ -7,18 +7,17 @@
|
|||
#include <string>
|
||||
#include "GUIContainer.h"
|
||||
#include "../../../../def/ItemDef.h"
|
||||
#include "../../../../util/Pointer.h"
|
||||
|
||||
class GUIModel : public GUIComponent {
|
||||
public:
|
||||
GUIModel() = default;
|
||||
GUIModel(const std::string& key);
|
||||
|
||||
void create(glm::vec2 scale, sptr<GuiMesh> model);
|
||||
void create(glm::vec2 scale, std::shared_ptr<GuiMesh> model);
|
||||
|
||||
void setRotation(glm::mat4 rotation);
|
||||
|
||||
void draw(Renderer& renderer) override;
|
||||
|
||||
sptr<GuiMesh> model;
|
||||
std::shared_ptr<GuiMesh> model;
|
||||
};
|
||||
|
|
|
@ -40,6 +40,6 @@ private:
|
|||
|
||||
LocalWorld* world = nullptr;
|
||||
ServerConnection& connection;
|
||||
sptr<Model> playerModel;
|
||||
std::shared_ptr<Model> playerModel;
|
||||
};
|
||||
|
||||
|
|
|
@ -37,8 +37,8 @@ public:
|
|||
std::vector<MeshDetails*> update();
|
||||
|
||||
struct Unit {
|
||||
sptr<BlockChunk> thisChunk = nullptr;
|
||||
std::array<sptr<BlockChunk>, 6> adjacentChunks {};
|
||||
std::shared_ptr<BlockChunk> thisChunk = nullptr;
|
||||
std::array<std::shared_ptr<BlockChunk>, 6> adjacentChunks {};
|
||||
|
||||
MeshDetails* meshDetails = new MeshDetails();
|
||||
|
||||
|
|
|
@ -135,7 +135,7 @@ void Player::updateCamera() {
|
|||
|
||||
void Player::findPointedThing(Input &input) {
|
||||
glm::ivec3 chunkPos = {};
|
||||
sptr<BlockChunk> blockChunk = nullptr;
|
||||
std::shared_ptr<BlockChunk> blockChunk = nullptr;
|
||||
|
||||
for (Ray ray(this); ray.getLength() < LOOK_DISTANCE; ray.step(LOOK_PRECISION)) {
|
||||
glm::vec3 rayEnd = ray.getEnd();
|
||||
|
|
|
@ -24,7 +24,7 @@ public:
|
|||
void setPos(glm::vec3 pos);
|
||||
glm::vec3 getPos() override;
|
||||
private:
|
||||
uptr<ChunkMesh> mesh = nullptr;
|
||||
std::unique_ptr<ChunkMesh> mesh = nullptr;
|
||||
glm::vec3 pos {};
|
||||
};
|
||||
|
||||
|
|
|
@ -7,8 +7,6 @@
|
|||
#include <GLFW/glfw3.h>
|
||||
#include <iostream>
|
||||
|
||||
typedef unsigned short ushort;
|
||||
|
||||
LuaInputManager::LuaInputManager() {
|
||||
for (bool& key : keysDown) key = false;
|
||||
for (bool& key : keysPressed) key = false;
|
||||
|
@ -18,7 +16,7 @@ LuaInputManager::LuaInputManager() {
|
|||
}
|
||||
|
||||
void LuaInputManager::update(bool* keys) {
|
||||
for (ushort i = 0; i < 1024; i++) {
|
||||
for (unsigned short i = 0; i < 1024; i++) {
|
||||
bool key = keys[i];
|
||||
|
||||
if (key) {
|
||||
|
@ -33,7 +31,7 @@ void LuaInputManager::update(bool* keys) {
|
|||
}
|
||||
|
||||
void LuaInputManager::triggerKeybinds() {
|
||||
for (ushort i = 0; i < 1024; i++) {
|
||||
for (unsigned short i = 0; i < 1024; i++) {
|
||||
if (keysPressed[i]) {
|
||||
for (auto& cb : callbacksDown[i]) cb();
|
||||
keysPressed[i] = false;
|
||||
|
@ -45,10 +43,10 @@ void LuaInputManager::triggerKeybinds() {
|
|||
}
|
||||
}
|
||||
|
||||
void LuaInputManager::bindOnDown(ushort key, const sol::function &cb) {
|
||||
void LuaInputManager::bindOnDown(unsigned short key, const sol::function &cb) {
|
||||
callbacksDown[key].push_back(cb);
|
||||
}
|
||||
|
||||
void LuaInputManager::bindOnUp(ushort key, const sol::function &cb) {
|
||||
void LuaInputManager::bindOnUp(unsigned short key, const sol::function &cb) {
|
||||
callbacksUp[key].push_back(cb);
|
||||
}
|
||||
|
|
|
@ -6,8 +6,6 @@
|
|||
|
||||
#include <sol2/sol.hpp>
|
||||
|
||||
typedef unsigned short ushort;
|
||||
|
||||
class LuaInputManager {
|
||||
public:
|
||||
LuaInputManager();
|
||||
|
@ -15,8 +13,8 @@ public:
|
|||
void update(bool* keys);
|
||||
void triggerKeybinds();
|
||||
|
||||
void bindOnDown(ushort key, const sol::function& cb);
|
||||
void bindOnUp(ushort key, const sol::function& cb);
|
||||
void bindOnDown(unsigned short key, const sol::function& cb);
|
||||
void bindOnUp(unsigned short key, const sol::function& cb);
|
||||
private:
|
||||
bool keysDown[1024] {};
|
||||
bool keysPressed[1024] {};
|
||||
|
|
|
@ -12,7 +12,7 @@ namespace Api {
|
|||
core["keys"] = lua.create_table();
|
||||
core["keycodes"] = lua.create_table();
|
||||
|
||||
for (ushort i = 0; i < 350; i++) {
|
||||
for (unsigned short i = 0; i < 350; i++) {
|
||||
auto key = Util::getKeyStr(i);
|
||||
if (!key.empty()) {
|
||||
core["keys"][key] = i;
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace Api {
|
|||
static void remove_entity_c(sol::state& lua, sol::table& core, LocalDefs& defs, LocalWorld& world) {
|
||||
core.set_function("remove_entity", [&](sol::table entity) {
|
||||
|
||||
sptr<LocalLuaEntity> object = entity.get<sptr<LocalLuaEntity>>("object");
|
||||
std::shared_ptr<LocalLuaEntity> object = entity.get<std::shared_ptr<LocalLuaEntity>>("object");
|
||||
sol::optional<sol::table> luaEntTable = core["entities"][object->id];
|
||||
if (!luaEntTable) return;
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ namespace RegisterItems {
|
|||
|
||||
//Convert Textures Table to Vector
|
||||
std::vector<std::string> textures;
|
||||
std::vector<sptr<AtlasRef>> textureRefs;
|
||||
std::vector<std::shared_ptr<AtlasRef>> textureRefs;
|
||||
for (auto pair : *texturesOpt) {
|
||||
if (!pair.second.is<std::string>()) throw "textures table has non-string value";
|
||||
textures.push_back(pair.second.as<std::string>());
|
||||
|
|
|
@ -22,7 +22,7 @@ namespace RegisterKeybinds {
|
|||
throw identifier + "'s definition table is not a table!";
|
||||
sol::table keybindTbl = keybindRef.second.as<sol::table>();
|
||||
|
||||
ushort def = keybindTbl.get<ushort>("default");
|
||||
unsigned short def = keybindTbl.get<unsigned short>("default");
|
||||
|
||||
auto onPress = keybindTbl.get<sol::optional<sol::function>>("on_press");
|
||||
auto onRelease = keybindTbl.get<sol::optional<sol::function>>("on_release");
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
#include <glm/glm.hpp>
|
||||
#include "ServerWorld.h"
|
||||
|
||||
const static int MB_GEN_H = 2;
|
||||
const static int MB_GEN_V = 2;
|
||||
const static int MB_GEN_H = 6;
|
||||
const static int MB_GEN_V = 4;
|
||||
|
||||
ServerWorld::ServerWorld(unsigned int seed, ServerDefs& defs, ServerClients& clients) :
|
||||
clientList(clients),
|
||||
|
@ -143,7 +143,7 @@ bool ServerWorld::generateMapBlock(glm::ivec3 pos) {
|
|||
}
|
||||
|
||||
void ServerWorld::sendChunk(const std::shared_ptr<BlockChunk>& chunk, ServerClient &peer) {
|
||||
assert(chunk != nullptr);
|
||||
if (chunk == nullptr || !chunk->generated) return;
|
||||
|
||||
Packet r = chunk->serialize();
|
||||
r.sendTo(peer.getPeer(), PacketChannel::CHUNK);
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
//
|
||||
// Created by aurailus on 29/08/19.
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
|
||||
#define sptr std::shared_ptr
|
||||
#define uptr std::unique_ptr
|
|
@ -12,8 +12,6 @@
|
|||
#include <iostream>
|
||||
#include "Log.h"
|
||||
|
||||
typedef unsigned short ushort;
|
||||
|
||||
namespace Util {
|
||||
struct EnumClassHash {
|
||||
template <typename T>
|
||||
|
@ -100,7 +98,7 @@ namespace Util {
|
|||
return color;
|
||||
}
|
||||
|
||||
static std::string getKeyStr(ushort key) {
|
||||
static std::string getKeyStr(unsigned short key) {
|
||||
switch (key) {
|
||||
default: return "";
|
||||
case 32: return " ";
|
||||
|
|
|
@ -31,7 +31,7 @@ unsigned int Dimension::getBlock(glm::ivec3 pos) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
bool Dimension::setBlock(glm::ivec3 pos, uint block) {
|
||||
bool Dimension::setBlock(glm::ivec3 pos, unsigned int block) {
|
||||
auto chunk = getChunk(Space::Chunk::world::fromBlock(pos));
|
||||
if (chunk == nullptr) return false;
|
||||
|
||||
|
|
|
@ -88,7 +88,7 @@ void LocalDimension::renderEntities(Renderer &renderer) {
|
|||
for (auto& entity : playerEntities) entity.draw(renderer);
|
||||
}
|
||||
|
||||
void LocalDimension::setChunk(sptr<BlockChunk> chunk) {
|
||||
void LocalDimension::setChunk(std::shared_ptr<BlockChunk> chunk) {
|
||||
Dimension::setChunk(chunk);
|
||||
attemptMeshChunk(chunk);
|
||||
}
|
||||
|
@ -176,7 +176,7 @@ bool LocalDimension::setBlock(glm::ivec3 pos, unsigned int block) {
|
|||
return true;
|
||||
}
|
||||
|
||||
void LocalDimension::attemptMeshChunk(const sptr<BlockChunk>& chunk, bool updateAdjacents) {
|
||||
void LocalDimension::attemptMeshChunk(const std::shared_ptr<BlockChunk>& chunk, bool updateAdjacents) {
|
||||
// if (!chunk->dirty) return; //TODO
|
||||
auto dirs = Vec::cardinalVectors;
|
||||
bool allExists = true;
|
||||
|
|
|
@ -39,25 +39,25 @@ public:
|
|||
int lastMeshUpdates = 0;
|
||||
std::vector<PlayerEntity> playerEntities;
|
||||
private:
|
||||
typedef std::list<sptr<ChunkRenderElem>>::iterator chunk_ref;
|
||||
typedef std::list<sptr<LocalLuaEntity>>::iterator local_ent_ref;
|
||||
typedef std::list<sptr<ServerLocalLuaEntity>>::iterator server_ent_ref;
|
||||
typedef std::list<std::shared_ptr<ChunkRenderElem>>::iterator chunk_ref;
|
||||
typedef std::list<std::shared_ptr<LocalLuaEntity>>::iterator local_ent_ref;
|
||||
typedef std::list<std::shared_ptr<ServerLocalLuaEntity>>::iterator server_ent_ref;
|
||||
|
||||
void finishMeshes();
|
||||
void queueMeshes();
|
||||
|
||||
void attemptMeshChunk(const sptr<BlockChunk>& chunk, bool updateAdjacents = true);
|
||||
void attemptMeshChunk(const std::shared_ptr<BlockChunk>& chunk, bool updateAdjacents = true);
|
||||
bool getAdjacentExists(glm::vec3 pos, bool updateAdjacents);
|
||||
|
||||
LocalDefs& defs;
|
||||
|
||||
uptr<MeshGenStream> meshGenStream = nullptr;
|
||||
std::unique_ptr<MeshGenStream> meshGenStream = nullptr;
|
||||
std::vector<glm::vec3> pendingMesh {};
|
||||
|
||||
std::unordered_map<uint, local_ent_ref> localEntityRefs {};
|
||||
std::unordered_map<unsigned int, local_ent_ref> localEntityRefs {};
|
||||
std::list<std::shared_ptr<LocalLuaEntity>> localEntities {};
|
||||
|
||||
std::unordered_map<uint, server_ent_ref> serverEntityRefs {};
|
||||
std::unordered_map<unsigned int, server_ent_ref> serverEntityRefs {};
|
||||
std::list<std::shared_ptr<ServerLocalLuaEntity>> serverEntities {};
|
||||
|
||||
std::unordered_map<glm::vec3, chunk_ref, Vec::vec3> renderRefs {};
|
||||
|
|
|
@ -21,9 +21,9 @@ public:
|
|||
unsigned long long getMapBlockIntegrity(glm::ivec3 mapBlock);
|
||||
std::list<std::shared_ptr<ServerLuaEntity>>& getLuaEntities();
|
||||
private:
|
||||
typedef std::list<sptr<ServerLuaEntity>>::iterator luaent_ref;
|
||||
typedef std::list<std::shared_ptr<ServerLuaEntity>>::iterator luaent_ref;
|
||||
|
||||
std::unordered_map<uint, luaent_ref> luaEntityRefs {};
|
||||
std::unordered_map<unsigned int, luaent_ref> luaEntityRefs {};
|
||||
std::list<std::shared_ptr<ServerLuaEntity>> luaEntities {};
|
||||
|
||||
std::unordered_map<glm::ivec3, unsigned long long, Vec::ivec3> mapBlockIntegrity {};
|
||||
|
|
Loading…
Reference in New Issue