Logo
Material.h
1#pragma once
2
3namespace XXSharpKmyGfx
4{
5 private ref class Material
6 {
7 public:
8 Material(bool skinned, System::String^ shadername, System::Guid guid);
9 Material(kmyGfx::Material* mtl, bool addref);
10 Material(System::String^ defimage, System::Guid guid, System::String^ name);
11 ~Material();
12
13 System::String^ getName();
14 void setName(System::String^ name);
15 Shader^ getShader();
16 void setShader(System::String^ shadername);
17 void setParameterF(System::String^ slotname, float x, float y, float z, float w);
18 void setParameterI(System::String^ slotname, int x, int y, int z, int w);
19 void setParameterB(System::String^ slotname, bool b);
20 void setTextureFileName(System::String^ slotname, System::String^ texfilename);
21 void setTexture(System::String^ slotname, Texture^ tex);
22 Texture^ getTexture(System::String^ slotname);
23 Texture^ getTexture(int index);
24 int getEnumCount(System::String^ slotname);
25 System::String^ getEnumString(System::String^ slotname, int index);
26 static int getMaterialTextureNumMax() { return USER_FP_TEXTURE_NUM_MAX; }
27
28 System::String^ getShaderName();
29 //System::String^ getShaderDescription();
30 bool getSlotName(int idx, UNIFORMPARAMTYPE %paramtype,
31 bool %hideInEditor,
32 [Runtime::InteropServices::Out] System::String ^%name);
33 UNIFORMPARAMTYPE getSlotType(System::String^ name);
34 float getParameterF(System::String^ slotname, int channel);
35 int getParameterI(System::String^ slotname, int channel);
36 float getParameterMin(System::String^ slotname, int channel);
37 float getParameterMax(System::String^ slotname, int channel);
38 bool getParameterB(System::String^ slotname);
39 System::String^ getTextureFileName(System::String^ slotname);
40 //System::String^ getDescription(System::String^ slotname);
41 float getUScrollSpeed();
42 float getVScrollSpeed();
43 void setUScrollSpeed(float v);
44 void setVScrollSpeed(float v);
45 unsigned int getUDiv();
46 unsigned int getVDiv();
47 void setUDiv(unsigned int v);
48 void setVDiv(unsigned int v);
49 float getUVStepInterval();
50 void setUVStepInterval(float v);
51 bool getUVStepUseModelUVOrigin();
52 void setUVStepUseModelUVOrigin(bool v);
53 unsigned int getUVStepFrameCount();
54 void setUVStepFrameCount(unsigned int v);
55 void enableUScrollAnim(bool flg);
56 void enableVScrollAnim(bool flg);
57 void enableUVStepAnim(bool flg);
58 bool isEnableUScrollAnim();
59 bool isEnableVScrollAnim();
60 bool isEnableUVStepAnim();
61 void enableEmissiveBlink(bool flg);
62 bool isEnableEmissiveBlink();
63 void setEmissiveBlinkSpeed(float v);
64 float getEmissiveBlinkSpeed();
65 void enableEmissiveLinkBuildingLight(bool flg);
66 bool isEmissiveLinkBuildingLight();
67 void setCastShadow(bool flg);
68 bool getCastShadow();
69 bool isEnableSetSortIndex();
70 int getSortIndex() { return obj!=nullptr ? obj->getSortIdx() : 0; }
71 void setSortIndex(int val) { if (obj)obj->setSortIdx(val); }
72 void setUVOffset(XXSharpKmyMath::Vector2 v);
73 XXSharpKmyMath::Vector2 getUVOffset();
74 void setUVScale(XXSharpKmyMath::Vector2 v);
75 XXSharpKmyMath::Vector2 getUVScale();
76 CULLTYPE getCullType() { return (CULLTYPE)obj->getPolygonState().m_cullType; }
77 void setCullType(CULLTYPE t) {
78 auto ps = obj->getPolygonState();
79 ps.m_cullType = (kmyGfx::CULLTYPE)t;
80 obj->setPolygonState(ps);
81 }
82 void setDrawOutlineEnable(bool flg)
83 {
84 if (obj)obj->setDrawOutlineEnable(flg);
85 }
86 bool getDrawOutlineEnable()
87 {
88 if (obj)return obj->getDrawOutlineEnable();
89 return false;
90 }
91 void setOutlineWidth(float w)
92 {
93 if (obj)obj->setOutlineWidth(w);
94 }
95 float getOutlineWidth()
96 {
97 if (obj)return obj->getOutlineWidth();
98 return 0;
99 }
100 void setOutlineColor(Color color)
101 {
102 if (obj)obj->setOutlineColor(kmyGfx::Color(color.r, color.g, color.b, color.a));
103 }
104 Color getOutlineColor()
105 {
106 kmyGfx::Color c = kmyGfx::Color::black();
107 if(obj)c = obj->getOutlineColor();
108 return Color(c.r, c.g, c.b, c.a);
109 }
110 void setOverrideOutlineSetting(bool flg)
111 {
112 if (obj)obj->setOverrideOutlineSetting(flg);
113 }
114 bool getOverrideOutlineSetting()
115 {
116 if (obj)return obj->getOverrideOutlineSetting();
117 return false;
118 }
119 void setDistanceFadeEnable(bool flg) { if (obj)obj->setDistanceFadeEnable(flg); }
120 bool getDistanceFadeEnable() { return obj ? obj->getDistanceFadeEnable() : false; }
121 void setReceiveDecal(bool flg) { if (obj)obj->setReceiveDecal(flg); }
122 bool getReceiveDecal() { return obj ? obj->getReceiveDecal() : false; }
123
124 static bool getCommonDrawOutlineEnable()
125 {
126 return kmyGfx::Material::getCommonDrawOutlineEnable();
127 }
128 static void setCommonDrawOutlineEnable(bool flg)
129 {
130 return kmyGfx::Material::setCommonDrawOutlineEnable(flg);
131 }
132 static float getCommonOutlineWidth()
133 {
134 return kmyGfx::Material::getCommonOutlineWidth();
135 }
136 static void setCommonOutlineWidth(float w)
137 {
138 kmyGfx::Material::setCommonOutlineWidth(w);
139 }
140 static Color getCommonOutlineColor()
141 {
142 kmyGfx::Color c = kmyGfx::Material::getCommonOutlineColor();
143 return Color(c.r, c.g, c.b, c.a);
144 }
145 static void setCommonOutlineColor(Color color)
146 {
147 kmyGfx::Color c(color.r, color.g, color.b, color.a);
148 kmyGfx::Material::setCommonOutlineColor(c);
149 }
150
151 bool isEnableSetCastShadow() { return obj->isEnableSetCastShadow(); }
152
153 System::String^ getDefText();
154 void setDefByText(System::String^ text);
155
156 kmyGfx::Material *obj = nullptr;
157
158 void addRef();
159 void removeRef();
160 };
161
162}
UNIFORMPARAMTYPE
Definition: GfxTypes.cs:90
CULLTYPE
Definition: GfxTypes.cs:82