CSEngine
Loading...
Searching...
No Matches
MeshSurface.h
1#pragma once
2
3#include "RenderInterfaces.h"
4#include "../../Object/SResource.h"
5#include "../Vector.h"
6
7namespace CSE {
8
9 class MeshSurface : public SISurface {
10 public:
11 RESOURCE_DEFINE_CONSTRUCTOR(MeshSurface);
12 MeshSurface(int sizeVert, float* vertices, float* normals);
13 MeshSurface(int sizeVert, float* vertices, float* normals, float* texCoords);
14// MeshSurface(int sizeVert, int sizeIndic, float* vertices, float* normals, float* texCoords, float* indices);
15 ~MeshSurface() override;
16
17 int GetVertexCount() const override;
18 int GetLineIndexCount() const override;
19 int GetTriangleIndexCount() const override;
20 void GenerateVertices(std::vector<float>& vertices, unsigned char flags) const override;
21 void GenerateLineIndices(std::vector<unsigned short>& indices) const override;
22 void GenerateTriangleIndices(std::vector<unsigned short>& indices) const override;
23
24 bool HasJoint() const;
25
26 static vec3 GenerateTopTriangle(const vec3& v0, const vec3& v1, const vec3& v2);
27 static vec3 GenerateBottomTriangle(const vec3& v0, const vec3& v1, const vec3& v2);
28 static vec3 LerpFilter(const vec3& v0, const vec3& v1, float kCoff);
29
30 void Exterminate() override;
31 void Destroy() override;
32
33 bool
34 MakeVertices(int sizeVert, float* vertices, float* normals, float* texCoords, float* weights, short* jointIds);
35 bool MakeIndices(int sizeIndic, int* indices);
36
37 void SetValue(std::string name_str, Arguments value) override;
38
39 std::string PrintValue() const override;
40
41 protected:
42 void Init(const AssetMgr::AssetReference* asset) override;
43
44 private:
45 mutable size_t m_faceSize = 0;
46 mutable size_t m_vertexSize = 0;
47 mutable size_t m_indexSize = 0;
48
49 std::vector<float> m_Verts;
50 std::vector<unsigned short> m_Indics;
51 };
52}
void SetValue(std::string name_str, Arguments value) override