From d407d73c3672b6a6129a0e9dce12eb21639efee4 Mon Sep 17 00:00:00 2001 From: dpjudas Date: Fri, 12 Nov 2021 05:11:19 +0100 Subject: [PATCH] Remove unused code --- src/lightmap/surfaces.h | 171 ---------------------------------------- 1 file changed, 171 deletions(-) diff --git a/src/lightmap/surfaces.h b/src/lightmap/surfaces.h index 79e9cb9..6efeb80 100644 --- a/src/lightmap/surfaces.h +++ b/src/lightmap/surfaces.h @@ -185,174 +185,3 @@ private: static bool IsDegenerate(const Vec3 &v0, const Vec3 &v1, const Vec3 &v2); }; - -///////////////////////////////////////////////////////////////////////////// - -struct ZModelVec2f -{ - float X, Y; -}; - -struct ZModelVec3f -{ - float X, Y, Z; -}; - -struct ZModelVec4ub -{ - uint8_t X, Y, Z, W; -}; - -struct ZModelQuaternionf -{ - float X, Y, Z, W; -}; - -struct ZModelVertex -{ - ZModelVec3f Pos; - ZModelVec4ub BoneWeights; - ZModelVec4ub BoneIndices; - ZModelVec3f Normal; - ZModelVec2f TexCoords; - ZModelVec3f TexCoords2; -}; - -struct ZModelMaterial -{ - std::string Name; - uint32_t Flags = 0; // Two-sided, depth test/write, what else? - uint32_t Renderstyle; - uint32_t StartElement = 0; - uint32_t VertexCount = 0; -}; - -template -struct ZModelTrack -{ - std::vector Timestamps; - std::vector Values; -}; - -struct ZModelBoneAnim -{ - ZModelTrack Translation; - ZModelTrack Rotation; - ZModelTrack Scale; -}; - -struct ZModelMaterialAnim -{ - ZModelTrack Translation; - ZModelTrack Rotation; // Rotation center is texture center (0.5, 0.5) - ZModelTrack Scale; -}; - -struct ZModelAnimation -{ - std::string Name; // Name of animation - float Duration; // Length of this animation sequence in seconds - - ZModelVec3f AabbMin; // Animation bounds (for culling purposes) - ZModelVec3f AabbMax; - - std::vector Bones; // Animation tracks for each bone - std::vector Materials; // Animation tracks for each material -}; - -enum class ZModelBoneType : uint32_t -{ - Normal, - BillboardSpherical, - BillboardCylindricalX, - BillboardCylindricalY, - BillboardCylindricalZ -}; - -struct ZModelBone -{ - std::string Name; - ZModelBoneType Type = ZModelBoneType::Normal; - int32_t ParentBone = -1; - ZModelVec3f Pivot; -}; - -struct ZModelAttachment -{ - std::string Name; - int32_t Bone = -1; - ZModelVec3f Position; -}; - -struct ZModel -{ - // ZMDL chunk - uint32_t Version = 1; - std::vector Materials; - std::vector Bones; - std::vector Animations; - std::vector Attachments; - - // ZDAT chunk - std::vector Vertices; - std::vector Elements; -}; - -struct ZChunkStream -{ - void Uint32(uint32_t v) { Write(v); } - void Float(float v) { Write(v); } - void Vec2f(const ZModelVec2f &v) { Write(v); } - void Vec3f(const ZModelVec3f &v) { Write(v); } - void Vec4ub(const ZModelVec4ub &v) { Write(v); } - void Quaternionf(const ZModelQuaternionf &v) { Write(v); } - - void Uint32Array(const std::vector &v) { WriteArray(v); } - void FloatArray(const std::vector &v) { WriteArray(v); } - void Vec2fArray(const std::vector &v) { WriteArray(v); } - void Vec3fArray(const std::vector &v) { WriteArray(v); } - void Vec4ubArray(const std::vector &v) { WriteArray(v); } - void QuaternionfArray(const std::vector &v) { WriteArray(v); } - void VertexArray(const std::vector &v) { WriteArray(v); } - - void String(const std::string &v) - { - Write(v.c_str(), v.length() + 1); - } - - void StringArray(const std::vector &v) - { - Uint32((uint32_t)v.size()); - for (const std::string &s : v) - String(s); - } - - const void *ChunkData() const { return buffer.data(); } - uint32_t ChunkLength() const { return (uint32_t)pos; } - -private: - template - void Write(const Type &v) - { - Write(&v, sizeof(Type)); - } - - template - void WriteArray(const std::vector &v) - { - Uint32((uint32_t)v.size()); - Write(v.data(), v.size() * sizeof(Type)); - } - - void Write(const void *data, size_t size) - { - if (pos + size > buffer.size()) - buffer.resize(buffer.size() * 2); - - memcpy(buffer.data() + pos, data, size); - pos += size; - } - - std::vector buffer = std::vector(16 * 1024 * 1024); - size_t pos = 0; -};