mirror of
https://github.com/ZDoom/ZDRay.git
synced 2024-11-29 07:02:18 +00:00
Remove unused code
This commit is contained in:
parent
f44e73d8d0
commit
d407d73c36
1 changed files with 0 additions and 171 deletions
|
@ -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<typename Value>
|
||||
struct ZModelTrack
|
||||
{
|
||||
std::vector<float> Timestamps;
|
||||
std::vector<Value> Values;
|
||||
};
|
||||
|
||||
struct ZModelBoneAnim
|
||||
{
|
||||
ZModelTrack<ZModelVec3f> Translation;
|
||||
ZModelTrack<ZModelQuaternionf> Rotation;
|
||||
ZModelTrack<ZModelVec3f> Scale;
|
||||
};
|
||||
|
||||
struct ZModelMaterialAnim
|
||||
{
|
||||
ZModelTrack<ZModelVec3f> Translation;
|
||||
ZModelTrack<ZModelQuaternionf> Rotation; // Rotation center is texture center (0.5, 0.5)
|
||||
ZModelTrack<ZModelVec3f> 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<ZModelBoneAnim> Bones; // Animation tracks for each bone
|
||||
std::vector<ZModelMaterialAnim> 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<ZModelMaterial> Materials;
|
||||
std::vector<ZModelBone> Bones;
|
||||
std::vector<ZModelAnimation> Animations;
|
||||
std::vector<ZModelAttachment> Attachments;
|
||||
|
||||
// ZDAT chunk
|
||||
std::vector<ZModelVertex> Vertices;
|
||||
std::vector<uint32_t> Elements;
|
||||
};
|
||||
|
||||
struct ZChunkStream
|
||||
{
|
||||
void Uint32(uint32_t v) { Write<uint32_t>(v); }
|
||||
void Float(float v) { Write<float>(v); }
|
||||
void Vec2f(const ZModelVec2f &v) { Write<ZModelVec2f>(v); }
|
||||
void Vec3f(const ZModelVec3f &v) { Write<ZModelVec3f>(v); }
|
||||
void Vec4ub(const ZModelVec4ub &v) { Write<ZModelVec4ub>(v); }
|
||||
void Quaternionf(const ZModelQuaternionf &v) { Write<ZModelQuaternionf>(v); }
|
||||
|
||||
void Uint32Array(const std::vector<uint32_t> &v) { WriteArray<uint32_t>(v); }
|
||||
void FloatArray(const std::vector<float> &v) { WriteArray<float>(v); }
|
||||
void Vec2fArray(const std::vector<ZModelVec2f> &v) { WriteArray<ZModelVec2f>(v); }
|
||||
void Vec3fArray(const std::vector<ZModelVec3f> &v) { WriteArray<ZModelVec3f>(v); }
|
||||
void Vec4ubArray(const std::vector<ZModelVec4ub> &v) { WriteArray<ZModelVec4ub>(v); }
|
||||
void QuaternionfArray(const std::vector<ZModelQuaternionf> &v) { WriteArray<ZModelQuaternionf>(v); }
|
||||
void VertexArray(const std::vector<ZModelVertex> &v) { WriteArray<ZModelVertex>(v); }
|
||||
|
||||
void String(const std::string &v)
|
||||
{
|
||||
Write(v.c_str(), v.length() + 1);
|
||||
}
|
||||
|
||||
void StringArray(const std::vector<std::string> &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<typename Type>
|
||||
void Write(const Type &v)
|
||||
{
|
||||
Write(&v, sizeof(Type));
|
||||
}
|
||||
|
||||
template<typename Type>
|
||||
void WriteArray(const std::vector<Type> &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<uint8_t> buffer = std::vector<uint8_t>(16 * 1024 * 1024);
|
||||
size_t pos = 0;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue