#include "Chaser.hpp"
#include "RandomWalk.hpp"
-#include "../model/CompositeModel.hpp"
+#include "../model/Model.hpp"
#include "../model/Skeletons.hpp"
#include "../rand/GaloisLFSR.hpp"
#include "../world/BlockLookup.hpp"
controllers.emplace_back(ctrl);
}
-CompositeModel &Spawner::RandomSkeleton() noexcept {
+Model &Spawner::RandomSkeleton() noexcept {
std::size_t offset = (random.Next<std::size_t>() % skeletons_length) + skeletons_offset;
return skeletons[offset];
}
namespace blank {
-class CompositeModel;
class Controller;
class Entity;
class GaloisLFSR;
+class Model;
class Skeletons;
class World;
void TrySpawn();
void Spawn(Entity &reference, const glm::ivec3 &, const glm::vec3 &);
- CompositeModel &RandomSkeleton() noexcept;
+ Model &RandomSkeleton() noexcept;
private:
World &world;
#include "../app/Environment.hpp"
#include "../app/init.hpp"
#include "../app/TextureIndex.hpp"
-#include "../model/CompositeModel.hpp"
+#include "../model/Model.hpp"
#include "../io/WorldSave.hpp"
#include "../world/ChunkIndex.hpp"
#include "../world/ChunkStore.hpp"
pack.ReadEntity(entity);
uint32_t skel_id;
pack.ReadSkeletonID(skel_id);
- CompositeModel *skel = state->GetSkeletons().ByID(skel_id);
+ Model *skel = state->GetSkeletons().ByID(skel_id);
if (skel) {
skel->Instantiate(entity.GetModel());
}
+++ /dev/null
-#ifndef BLANK_MODEL_COMPOSITEINSTANCE_HPP_
-#define BLANK_MODEL_COMPOSITEINSTANCE_HPP_
-
-#include <vector>
-#include <glm/glm.hpp>
-#include <glm/gtc/quaternion.hpp>
-
-
-namespace blank {
-
-class CompositeModel;
-class DirectionalLighting;
-
-// TODO: this doesn't have to be a tree, actually
-// linearizing might be a good opportunity to optimize
-class CompositeInstance {
-
- friend class CompositeModel;
-
-public:
- CompositeInstance();
-
- operator bool() const noexcept { return part_model; }
- const CompositeModel &GetModel() const noexcept { return *part_model; }
-
- const glm::vec3 &Position() const noexcept { return position; }
- void Position(const glm::vec3 &p) noexcept { position = p; }
-
- const glm::quat &Orientation() const noexcept { return orientation; }
- void Orientation(const glm::quat &o) noexcept { orientation = o; }
-
- glm::mat4 LocalTransform() const noexcept;
- glm::mat4 GlobalTransform() const noexcept;
-
- void Render(const glm::mat4 &, DirectionalLighting &) const;
-
-private:
- CompositeInstance &AddPart();
- bool HasParent() const noexcept { return parent; }
- CompositeInstance &Parent() const noexcept { return *parent; }
- bool IsRoot() const noexcept { return !HasParent(); }
-
-private:
- const CompositeModel *part_model;
- CompositeInstance *parent;
-
- glm::vec3 position;
- glm::quat orientation;
-
- std::vector<CompositeInstance> parts;
-
-};
-
-}
-
-#endif
+++ /dev/null
-#ifndef BLANK_MODEL_COMPOSITEMODEL_HPP_
-#define BLANK_MODEL_COMPOSITEMODEL_HPP_
-
-#include "geometry.hpp"
-
-#include <cstdint>
-#include <list>
-#include <glm/glm.hpp>
-#include <glm/gtc/quaternion.hpp>
-
-
-namespace blank {
-
-class CompositeInstance;
-class EntityMesh;
-
-class CompositeModel {
-
-public:
- CompositeModel();
-
- CompositeModel(const CompositeModel &) = delete;
- CompositeModel &operator =(const CompositeModel &) = delete;
-
- std::uint32_t ID() const noexcept { return id; }
- void ID(std::uint32_t i) noexcept { id = i; }
-
- const AABB &Bounds() const noexcept { return bounds; }
- void Bounds(const AABB &b) noexcept { bounds = b; }
-
- const glm::vec3 &Position() const noexcept { return position; }
- void Position(const glm::vec3 &p) noexcept { position = p; }
-
- const glm::quat &Orientation() const noexcept { return orientation; }
- void Orientation(const glm::quat &o) noexcept { orientation = o; }
-
- bool HasNodeMesh() const noexcept { return node_mesh; }
- void SetNodeMesh(const EntityMesh *m) noexcept { node_mesh = m; }
-
- const EntityMesh &NodeMesh() const noexcept { return *node_mesh; }
-
- CompositeModel &AddPart();
- bool HasParent() const noexcept { return parent; }
- CompositeModel &Parent() const noexcept { return *parent; }
- bool IsRoot() const noexcept { return !HasParent(); }
-
- glm::mat4 LocalTransform() const noexcept;
- glm::mat4 GlobalTransform() const noexcept;
-
- void Instantiate(CompositeInstance &) const;
-
-private:
- CompositeModel *parent;
- const EntityMesh *node_mesh;
-
- std::uint32_t id;
-
- AABB bounds;
-
- glm::vec3 position;
- glm::quat orientation;
-
- std::list<CompositeModel> parts;
-
-};
-
-}
-
-#endif
--- /dev/null
+#ifndef BLANK_MODEL_INSTANCE_HPP_
+#define BLANK_MODEL_INSTANCE_HPP_
+
+#include <vector>
+#include <glm/glm.hpp>
+#include <glm/gtc/quaternion.hpp>
+
+
+namespace blank {
+
+class Model;
+class DirectionalLighting;
+
+// TODO: this doesn't have to be a tree, actually
+// linearizing might be a good opportunity to optimize
+class Instance {
+
+ friend class Model;
+
+public:
+ Instance();
+
+ operator bool() const noexcept { return part_model; }
+ const Model &GetModel() const noexcept { return *part_model; }
+
+ const glm::vec3 &Position() const noexcept { return position; }
+ void Position(const glm::vec3 &p) noexcept { position = p; }
+
+ const glm::quat &Orientation() const noexcept { return orientation; }
+ void Orientation(const glm::quat &o) noexcept { orientation = o; }
+
+ glm::mat4 LocalTransform() const noexcept;
+ glm::mat4 GlobalTransform() const noexcept;
+
+ void Render(const glm::mat4 &, DirectionalLighting &) const;
+
+private:
+ Instance &AddPart();
+ bool HasParent() const noexcept { return parent; }
+ Instance &Parent() const noexcept { return *parent; }
+ bool IsRoot() const noexcept { return !HasParent(); }
+
+private:
+ const Model *part_model;
+ Instance *parent;
+
+ glm::vec3 position;
+ glm::quat orientation;
+
+ std::vector<Instance> parts;
+
+};
+
+}
+
+#endif
--- /dev/null
+#ifndef BLANK_MODEL_MODEL_HPP_
+#define BLANK_MODEL_MODEL_HPP_
+
+#include "geometry.hpp"
+
+#include <cstdint>
+#include <list>
+#include <glm/glm.hpp>
+#include <glm/gtc/quaternion.hpp>
+
+
+namespace blank {
+
+class Instance;
+class EntityMesh;
+
+class Model {
+
+public:
+ Model();
+
+ Model(const Model &) = delete;
+ Model &operator =(const Model &) = delete;
+
+ std::uint32_t ID() const noexcept { return id; }
+ void ID(std::uint32_t i) noexcept { id = i; }
+
+ const AABB &Bounds() const noexcept { return bounds; }
+ void Bounds(const AABB &b) noexcept { bounds = b; }
+
+ const glm::vec3 &Position() const noexcept { return position; }
+ void Position(const glm::vec3 &p) noexcept { position = p; }
+
+ const glm::quat &Orientation() const noexcept { return orientation; }
+ void Orientation(const glm::quat &o) noexcept { orientation = o; }
+
+ bool HasNodeMesh() const noexcept { return node_mesh; }
+ void SetNodeMesh(const EntityMesh *m) noexcept { node_mesh = m; }
+
+ const EntityMesh &NodeMesh() const noexcept { return *node_mesh; }
+
+ Model &AddPart();
+ bool HasParent() const noexcept { return parent; }
+ Model &Parent() const noexcept { return *parent; }
+ bool IsRoot() const noexcept { return !HasParent(); }
+
+ glm::mat4 LocalTransform() const noexcept;
+ glm::mat4 GlobalTransform() const noexcept;
+
+ void Instantiate(Instance &) const;
+
+private:
+ Model *parent;
+ const EntityMesh *node_mesh;
+
+ std::uint32_t id;
+
+ AABB bounds;
+
+ glm::vec3 position;
+ glm::quat orientation;
+
+ std::list<Model> parts;
+
+};
+
+}
+
+#endif
namespace blank {
-class CompositeModel;
+class Model;
class EntityMesh;
class Skeletons {
public:
using size_type = std::size_t;
- using reference = CompositeModel &;
- using const_reference = const CompositeModel &;
+ using reference = Model &;
+ using const_reference = const Model &;
public:
Skeletons();
reference operator[](size_type i) noexcept { return *skeletons[i]; }
const_reference operator[](size_type i) const noexcept { return *skeletons[i]; }
- CompositeModel *ByID(std::uint16_t) noexcept;
- const CompositeModel *ByID(std::uint16_t) const noexcept;
+ Model *ByID(std::uint16_t) noexcept;
+ const Model *ByID(std::uint16_t) const noexcept;
private:
- std::vector<std::unique_ptr<CompositeModel>> skeletons;
+ std::vector<std::unique_ptr<Model>> skeletons;
std::vector<EntityMesh> meshes;
};
+++ /dev/null
-#include "CompositeModel.hpp"
-#include "CompositeInstance.hpp"
-#include "Skeletons.hpp"
-
-#include "shapes.hpp"
-#include "../graphics/DirectionalLighting.hpp"
-#include "../graphics/EntityMesh.hpp"
-
-#include <glm/gtx/quaternion.hpp>
-
-
-namespace blank {
-
-CompositeModel::CompositeModel()
-: parent(nullptr)
-, node_mesh(nullptr)
-, id(0)
-, bounds{{ 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }}
-, position(0.0f)
-, orientation(1.0f, 0.0f, 0.0f, 0.0f)
-, parts() {
-
-}
-
-
-CompositeModel &CompositeModel::AddPart() {
- parts.emplace_back();
- parts.back().parent = this;
- return parts.back();
-}
-
-
-glm::mat4 CompositeModel::LocalTransform() const noexcept {
- glm::mat4 transform(toMat4(orientation));
- transform[3].x = position.x;
- transform[3].y = position.y;
- transform[3].z = position.z;
- return transform;
-}
-
-glm::mat4 CompositeModel::GlobalTransform() const noexcept {
- if (HasParent()) {
- return Parent().GlobalTransform() * LocalTransform();
- } else {
- return LocalTransform();
- }
-}
-
-
-void CompositeModel::Instantiate(CompositeInstance &inst) const {
- inst.part_model = this;
- inst.position = position;
- inst.orientation = orientation;
- inst.parts.clear();
- inst.parts.reserve(parts.size());
- for (const CompositeModel &part : parts) {
- part.Instantiate(inst.AddPart());
- }
-}
-
-
-CompositeInstance::CompositeInstance()
-: part_model(nullptr)
-, parent(nullptr)
-, position(0.0f)
-, orientation(1.0f, 0.0f, 0.0f, 0.0f)
-, parts() {
-
-}
-
-
-CompositeInstance &CompositeInstance::AddPart() {
- parts.emplace_back();
- parts.back().parent = this;
- return parts.back();
-}
-
-
-glm::mat4 CompositeInstance::LocalTransform() const noexcept {
- glm::mat4 transform(toMat4(orientation));
- transform[3].x = position.x;
- transform[3].y = position.y;
- transform[3].z = position.z;
- return transform;
-}
-
-glm::mat4 CompositeInstance::GlobalTransform() const noexcept {
- if (HasParent()) {
- return Parent().GlobalTransform() * LocalTransform();
- } else {
- return LocalTransform();
- }
-}
-
-
-void CompositeInstance::Render(const glm::mat4 &M, DirectionalLighting &prog) const {
- glm::mat4 transform(M * LocalTransform());
- if (part_model->HasNodeMesh()) {
- prog.SetM(transform);
- part_model->NodeMesh().Draw();
- }
- for (const CompositeInstance &part : parts) {
- part.Render(transform, prog);
- }
-}
-
-
-Skeletons::Skeletons()
-: skeletons()
-, meshes() {
-
-}
-
-Skeletons::~Skeletons() {
-
-}
-
-void Skeletons::LoadHeadless() {
- skeletons.clear();
- skeletons.reserve(4);
- {
- AABB bounds{{ -0.5f, -0.5f, -0.5f }, { 0.5f, 0.5f, 0.5f }};
- skeletons.emplace_back(new CompositeModel);
- skeletons[0]->ID(1);
- skeletons[0]->Bounds(bounds);
- }
- {
- AABB bounds{{ -0.5f, -0.25f, -0.5f }, { 0.5f, 0.25f, 0.5f }};
- skeletons.emplace_back(new CompositeModel);
- skeletons[1]->ID(2);
- skeletons[1]->Bounds(bounds);
- }
- {
- AABB bounds{{ -0.25f, -0.5f, -0.25f }, { 0.25f, 0.5f, 0.25f }};
- skeletons.emplace_back(new CompositeModel);
- skeletons[2]->ID(3);
- skeletons[2]->Bounds(bounds);
- }
- {
- AABB bounds{{ -0.25f, -0.5f, -0.35f }, { 0.25f, 0.5f, 0.35f }};
- skeletons.emplace_back(new CompositeModel);
- skeletons[3]->ID(4);
- skeletons[3]->Bounds(bounds);
- }
-}
-
-void Skeletons::Load() {
- LoadHeadless();
- meshes.resize(4);
- EntityMesh::Buffer buf;
- {
- CuboidShape shape(skeletons[0]->Bounds());
- shape.Vertices(buf, 3.0f);
- buf.hsl_mods.resize(shape.VertexCount(), { 0.0f, 1.0f, 1.0f });
- buf.rgb_mods.resize(shape.VertexCount(), { 1.0f, 1.0f, 0.0f });
- meshes[0].Update(buf);
- skeletons[0]->SetNodeMesh(&meshes[0]);
- }
- {
- CuboidShape shape(skeletons[1]->Bounds());
- buf.Clear();
- shape.Vertices(buf, 0.0f);
- buf.hsl_mods.resize(shape.VertexCount(), { 0.0f, 1.0f, 1.0f });
- buf.rgb_mods.resize(shape.VertexCount(), { 0.0f, 1.0f, 1.0f });
- meshes[1].Update(buf);
- skeletons[1]->SetNodeMesh(&meshes[1]);
- }
- {
- StairShape shape(skeletons[2]->Bounds(), { 0.4f, 0.4f });
- buf.Clear();
- shape.Vertices(buf, 1.0f);
- buf.hsl_mods.resize(shape.VertexCount(), { 0.0f, 1.0f, 1.0f });
- buf.rgb_mods.resize(shape.VertexCount(), { 1.0f, 0.0f, 1.0f });
- meshes[2].Update(buf);
- skeletons[2]->SetNodeMesh(&meshes[2]);
- }
- {
- CuboidShape shape(skeletons[3]->Bounds());
- buf.Clear();
- shape.Vertices(buf, 2.0f);
- buf.hsl_mods.resize(shape.VertexCount(), { 0.0f, 1.0f, 1.0f });
- buf.rgb_mods.resize(shape.VertexCount(), { 1.0f, 0.25f, 0.5f });
- meshes[3].Update(buf);
- skeletons[3]->SetNodeMesh(&meshes[3]);
- }
-}
-
-CompositeModel *Skeletons::ByID(std::uint16_t id) noexcept {
- if (id == 0 || id > skeletons.size()) {
- return nullptr;
- } else {
- return skeletons[id - 1].get();
- }
-}
-
-const CompositeModel *Skeletons::ByID(std::uint16_t id) const noexcept {
- if (id == 0 || id > skeletons.size()) {
- return nullptr;
- } else {
- return skeletons[id - 1].get();
- }
-}
-
-}
--- /dev/null
+#include "Model.hpp"
+#include "Instance.hpp"
+#include "Skeletons.hpp"
+
+#include "shapes.hpp"
+#include "../graphics/DirectionalLighting.hpp"
+#include "../graphics/EntityMesh.hpp"
+
+#include <glm/gtx/quaternion.hpp>
+
+
+namespace blank {
+
+Model::Model()
+: parent(nullptr)
+, node_mesh(nullptr)
+, id(0)
+, bounds{{ 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }}
+, position(0.0f)
+, orientation(1.0f, 0.0f, 0.0f, 0.0f)
+, parts() {
+
+}
+
+
+Model &Model::AddPart() {
+ parts.emplace_back();
+ parts.back().parent = this;
+ return parts.back();
+}
+
+
+glm::mat4 Model::LocalTransform() const noexcept {
+ glm::mat4 transform(toMat4(orientation));
+ transform[3].x = position.x;
+ transform[3].y = position.y;
+ transform[3].z = position.z;
+ return transform;
+}
+
+glm::mat4 Model::GlobalTransform() const noexcept {
+ if (HasParent()) {
+ return Parent().GlobalTransform() * LocalTransform();
+ } else {
+ return LocalTransform();
+ }
+}
+
+
+void Model::Instantiate(Instance &inst) const {
+ inst.part_model = this;
+ inst.position = position;
+ inst.orientation = orientation;
+ inst.parts.clear();
+ inst.parts.reserve(parts.size());
+ for (const Model &part : parts) {
+ part.Instantiate(inst.AddPart());
+ }
+}
+
+
+Instance::Instance()
+: part_model(nullptr)
+, parent(nullptr)
+, position(0.0f)
+, orientation(1.0f, 0.0f, 0.0f, 0.0f)
+, parts() {
+
+}
+
+
+Instance &Instance::AddPart() {
+ parts.emplace_back();
+ parts.back().parent = this;
+ return parts.back();
+}
+
+
+glm::mat4 Instance::LocalTransform() const noexcept {
+ glm::mat4 transform(toMat4(orientation));
+ transform[3].x = position.x;
+ transform[3].y = position.y;
+ transform[3].z = position.z;
+ return transform;
+}
+
+glm::mat4 Instance::GlobalTransform() const noexcept {
+ if (HasParent()) {
+ return Parent().GlobalTransform() * LocalTransform();
+ } else {
+ return LocalTransform();
+ }
+}
+
+
+void Instance::Render(const glm::mat4 &M, DirectionalLighting &prog) const {
+ glm::mat4 transform(M * LocalTransform());
+ if (part_model->HasNodeMesh()) {
+ prog.SetM(transform);
+ part_model->NodeMesh().Draw();
+ }
+ for (const Instance &part : parts) {
+ part.Render(transform, prog);
+ }
+}
+
+
+Skeletons::Skeletons()
+: skeletons()
+, meshes() {
+
+}
+
+Skeletons::~Skeletons() {
+
+}
+
+void Skeletons::LoadHeadless() {
+ skeletons.clear();
+ skeletons.reserve(4);
+ {
+ AABB bounds{{ -0.5f, -0.5f, -0.5f }, { 0.5f, 0.5f, 0.5f }};
+ skeletons.emplace_back(new Model);
+ skeletons[0]->ID(1);
+ skeletons[0]->Bounds(bounds);
+ }
+ {
+ AABB bounds{{ -0.5f, -0.25f, -0.5f }, { 0.5f, 0.25f, 0.5f }};
+ skeletons.emplace_back(new Model);
+ skeletons[1]->ID(2);
+ skeletons[1]->Bounds(bounds);
+ }
+ {
+ AABB bounds{{ -0.25f, -0.5f, -0.25f }, { 0.25f, 0.5f, 0.25f }};
+ skeletons.emplace_back(new Model);
+ skeletons[2]->ID(3);
+ skeletons[2]->Bounds(bounds);
+ }
+ {
+ AABB bounds{{ -0.25f, -0.5f, -0.35f }, { 0.25f, 0.5f, 0.35f }};
+ skeletons.emplace_back(new Model);
+ skeletons[3]->ID(4);
+ skeletons[3]->Bounds(bounds);
+ }
+}
+
+void Skeletons::Load() {
+ LoadHeadless();
+ meshes.resize(4);
+ EntityMesh::Buffer buf;
+ {
+ CuboidShape shape(skeletons[0]->Bounds());
+ shape.Vertices(buf, 3.0f);
+ buf.hsl_mods.resize(shape.VertexCount(), { 0.0f, 1.0f, 1.0f });
+ buf.rgb_mods.resize(shape.VertexCount(), { 1.0f, 1.0f, 0.0f });
+ meshes[0].Update(buf);
+ skeletons[0]->SetNodeMesh(&meshes[0]);
+ }
+ {
+ CuboidShape shape(skeletons[1]->Bounds());
+ buf.Clear();
+ shape.Vertices(buf, 0.0f);
+ buf.hsl_mods.resize(shape.VertexCount(), { 0.0f, 1.0f, 1.0f });
+ buf.rgb_mods.resize(shape.VertexCount(), { 0.0f, 1.0f, 1.0f });
+ meshes[1].Update(buf);
+ skeletons[1]->SetNodeMesh(&meshes[1]);
+ }
+ {
+ StairShape shape(skeletons[2]->Bounds(), { 0.4f, 0.4f });
+ buf.Clear();
+ shape.Vertices(buf, 1.0f);
+ buf.hsl_mods.resize(shape.VertexCount(), { 0.0f, 1.0f, 1.0f });
+ buf.rgb_mods.resize(shape.VertexCount(), { 1.0f, 0.0f, 1.0f });
+ meshes[2].Update(buf);
+ skeletons[2]->SetNodeMesh(&meshes[2]);
+ }
+ {
+ CuboidShape shape(skeletons[3]->Bounds());
+ buf.Clear();
+ shape.Vertices(buf, 2.0f);
+ buf.hsl_mods.resize(shape.VertexCount(), { 0.0f, 1.0f, 1.0f });
+ buf.rgb_mods.resize(shape.VertexCount(), { 1.0f, 0.25f, 0.5f });
+ meshes[3].Update(buf);
+ skeletons[3]->SetNodeMesh(&meshes[3]);
+ }
+}
+
+Model *Skeletons::ByID(std::uint16_t id) noexcept {
+ if (id == 0 || id > skeletons.size()) {
+ return nullptr;
+ } else {
+ return skeletons[id - 1].get();
+ }
+}
+
+const Model *Skeletons::ByID(std::uint16_t id) const noexcept {
+ if (id == 0 || id > skeletons.size()) {
+ return nullptr;
+ } else {
+ return skeletons[id - 1].get();
+ }
+}
+
+}
#include "Packet.hpp"
#include "../app/init.hpp"
-#include "../model/CompositeModel.hpp"
+#include "../model/Model.hpp"
#include "../world/Entity.hpp"
#include "../world/EntityState.hpp"
namespace blank {
-class CompositeModel;
+class Model;
namespace server {
ChunkIndex &PlayerChunks() noexcept { return input->GetPlayer().GetChunks(); }
const ChunkIndex &PlayerChunks() const noexcept { return input->GetPlayer().GetChunks(); }
- void SetPlayerModel(const CompositeModel &) noexcept;
+ void SetPlayerModel(const Model &) noexcept;
bool HasPlayerModel() const noexcept;
- const CompositeModel &GetPlayerModel() const noexcept;
+ const Model &GetPlayerModel() const noexcept;
bool ChunkInRange(const glm::ivec3 &) const noexcept;
Server &server;
Connection conn;
std::unique_ptr<DirectInput> input;
- const CompositeModel *player_model;
+ const Model *player_model;
std::list<SpawnStatus> spawns;
unsigned int confirm_wait;
namespace blank {
class ChunkIndex;
-class CompositeModel;
+class Model;
class Player;
class WorldSave;
World &GetWorld() noexcept { return world; }
const WorldSave &GetWorldSave() noexcept { return save; }
- void SetPlayerModel(const CompositeModel &) noexcept;
+ void SetPlayerModel(const Model &) noexcept;
bool HasPlayerModel() const noexcept;
- const CompositeModel &GetPlayerModel() const noexcept;
+ const Model &GetPlayerModel() const noexcept;
Player *JoinPlayer(const std::string &name);
World &world;
ChunkIndex &spawn_index;
const WorldSave &save;
- const CompositeModel *player_model;
+ const Model *player_model;
};
#include "../app/init.hpp"
#include "../io/WorldSave.hpp"
-#include "../model/CompositeModel.hpp"
+#include "../model/Model.hpp"
#include "../world/ChunkIndex.hpp"
#include "../world/Entity.hpp"
#include "../world/World.hpp"
old_actions = 0;
}
-void ClientConnection::SetPlayerModel(const CompositeModel &m) noexcept {
+void ClientConnection::SetPlayerModel(const Model &m) noexcept {
player_model = &m;
if (HasPlayer()) {
m.Instantiate(PlayerEntity().GetModel());
return player_model;
}
-const CompositeModel &ClientConnection::GetPlayerModel() const noexcept {
+const Model &ClientConnection::GetPlayerModel() const noexcept {
return *player_model;
}
}
}
-void Server::SetPlayerModel(const CompositeModel &m) noexcept {
+void Server::SetPlayerModel(const Model &m) noexcept {
player_model = &m;
for (ClientConnection &client : clients) {
client.SetPlayerModel(m);
return player_model;
}
-const CompositeModel &Server::GetPlayerModel() const noexcept {
+const Model &Server::GetPlayerModel() const noexcept {
return *player_model;
}
#include "Chunk.hpp"
#include "EntityState.hpp"
-#include "../model/CompositeInstance.hpp"
+#include "../model/Instance.hpp"
#include "../model/geometry.hpp"
#include <cstdint>
public:
Entity() noexcept;
- CompositeInstance &GetModel() noexcept { return model; }
- const CompositeInstance &GetModel() const noexcept { return model; }
+ Instance &GetModel() noexcept { return model; }
+ const Instance &GetModel() const noexcept { return model; }
std::uint32_t ID() const noexcept { return id; }
void ID(std::uint32_t i) noexcept { id = i; }
}
private:
- CompositeInstance model;
+ Instance model;
std::uint32_t id;
std::string name;
#include "PacketTest.hpp"
-#include "model/CompositeModel.hpp"
+#include "model/Model.hpp"
#include "world/Entity.hpp"
CPPUNIT_TEST_SUITE_REGISTRATION(blank::test::PacketTest);
Entity write_entity;
write_entity.ID(534574);
- CompositeModel model;
+ Model model;
model.ID(23);
model.Instantiate(write_entity.GetModel());
write_entity.GetState().chunk_pos = { 7, 2, -3 };