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:
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 protected:
38 void Init(const AssetMgr::AssetReference* asset) override;
39
40 private:
41 mutable size_t m_faceSize;
42 mutable size_t m_vertexSize;
43 mutable size_t m_indexSize;
44
45 std::vector<float> m_Verts;
46 std::vector<unsigned short> m_Indics;
47 };
48}