-
Notifications
You must be signed in to change notification settings - Fork 0
/
ModelResource.h
45 lines (44 loc) · 1.7 KB
/
ModelResource.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
//单个FBX加载多个Mesh,并且每个Mesh有独立的Material
#pragma once
#include "Falcor.h"
#include "MaterialInstance.h"
using namespace Falcor;
class ModelResource {
public:
ModelResource();
~ModelResource() = default;
explicit ModelResource(const Model::SharedPtr& pModel);
public:
std::string mModelString;
uint64_t mResId;
Model::SharedPtr mpModel = nullptr;
glm::vec3 Translation;
glm::vec3 Rotation;
glm::vec3 Scale;
bool mAnimate = false;
bool mUseTriLinearFiltering = false;
std::map<std::string, MaterialInstance::SharedPtr> sharedMaterials;
std::string getModelDesc(bool isAfterCull, float loadTime);
void setProgram(const std::string& materialName, const std::string& programName);
uint32_t getProgramIndex(const GraphicsProgram::SharedPtr&);
std::vector<std::string> getMaterialsName();
static const std::map<std::string, std::function<void(MaterialInstance::SharedPtr&)>>& getProgramMapFunc();
size_t getMaterialCount();
MaterialInstance::SharedPtr& getMaterialInstance(uint32_t meshID);
void resetMaterialGui();
static bool hasInitGui;
void init(const std::string& default_shader="Diffuse");
void onGui(Gui* p);
void setTRS(const glm::vec3& translation, const glm::vec3& rotation, const glm::vec3& scale);
std::string getModelResName();
void setSelected(bool selected);
bool getSelected() { return mSelected; }
private:
bool mSelected;
void initMaterials(const std::string& default_shader = "");
std::map<std::string,uint32_t> programDropDownIndex;
static Gui::DropdownList programDropDownList;
static uint64_t count;
public:
static uint64_t getModelCount() { return count; };
};