Logo
Material.h
1#pragma once
2
3namespace SharpKmyGfx
4{
5 public ref class Material
6 {
7 public:
8 Material(bool skinned, System::String^ shadername, System::Guid guid);
9 Material(kmyGfx::Material* mtl);
10 Material(System::String^ defimage, System::Guid guid, System::String^ name);
11 ~Material();
12
13 System::String^ getName();
14 void setName(System::String^ name);
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);
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);
60 bool isEnableUVStepAnim();
61 void enableEmissiveBlink(bool flg);
63 void setEmissiveBlinkSpeed(float v);
67 void setCastShadow(bool flg);
68 bool getCastShadow();
70 int getSortIndex() { return obj!=nullptr ? obj->getSortIdx() : 0; }
71 void setSortIndex(int val) { if (obj)obj->setSortIdx(val); }
76 CULLTYPE getCullType() { return (CULLTYPE)obj->getPolygonState().m_cullType; }
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 }
87 {
88 if (obj)return obj->getDrawOutlineEnable();
89 return false;
90 }
91 void setOutlineWidth(float w)
92 {
93 if (obj)obj->setOutlineWidth(w);
94 }
96 {
97 if (obj)return obj->getOutlineWidth();
98 return 0;
99 }
101 {
102 if (obj)obj->setOutlineColor(kmyGfx::Color(color.r, color.g, color.b, color.a));
103 }
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 }
111 {
112 if (obj)obj->setOverrideOutlineSetting(flg);
113 }
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
125 {
126 return kmyGfx::Material::getCommonDrawOutlineEnable();
127 }
128 static void setCommonDrawOutlineEnable(bool flg)
129 {
130 return kmyGfx::Material::setCommonDrawOutlineEnable(flg);
131 }
133 {
134 return kmyGfx::Material::getCommonOutlineWidth();
135 }
136 static void setCommonOutlineWidth(float w)
137 {
138 kmyGfx::Material::setCommonOutlineWidth(w);
139 }
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 bool owning = true;
157 kmyGfx::Material *obj = nullptr;
158
159 void addRef();
160 void removeRef();
161 };
162
163}
Definition: Color.h:5
float r
Definition: Color.h:7
float b
Definition: Color.h:7
float a
Definition: Color.h:7
float g
Definition: Color.h:7
Definition: Material.h:6
bool isEnableSetCastShadow()
Definition: Material.h:151
int getSortIndex()
Definition: Material.h:70
SharpKmyMath::Vector2 getUVScale()
Definition: Material.cpp:540
bool getUVStepUseModelUVOrigin()
Definition: Material.cpp:529
bool getOverrideOutlineSetting()
Definition: Material.h:114
void setUVOffset(SharpKmyMath::Vector2 v)
Definition: Material.cpp:556
bool getSlotName(int idx, UNIFORMPARAMTYPE %paramtype, bool %hideInEditor, [Runtime::InteropServices::Out] System::String ^%name)
Definition: Material.cpp:278
System::String getDefText()
Definition: Material.cpp:469
float getUVStepInterval()
Definition: Material.cpp:528
static bool getCommonDrawOutlineEnable()
Definition: Material.h:124
void setCastShadow(bool flg)
Definition: Material.cpp:555
void setParameterB(System::String^ slotname, bool b)
Definition: Material.cpp:115
void setUVScale(SharpKmyMath::Vector2 v)
Definition: Material.cpp:557
unsigned int getVDiv()
Definition: Material.cpp:526
void setEmissiveBlinkSpeed(float v)
Definition: Material.cpp:553
void setDrawOutlineEnable(bool flg)
Definition: Material.h:82
bool owning
Definition: Material.h:156
unsigned int getUVStepFrameCount()
Definition: Material.cpp:527
bool getCastShadow()
Definition: Material.cpp:533
Texture getTexture(System::String^ slotname)
Definition: Material.cpp:139
void setVScrollSpeed(float v)
Definition: Material.cpp:545
~Material()
Definition: Material.cpp:42
Color getOutlineColor()
Definition: Material.h:104
float getOutlineWidth()
Definition: Material.h:95
void enableUScrollAnim(bool flg)
Definition: Material.cpp:542
void setVDiv(unsigned int v)
Definition: Material.cpp:548
void setUVStepInterval(float v)
Definition: Material.cpp:550
void enableVScrollAnim(bool flg)
Definition: Material.cpp:544
float getParameterMin(System::String^ slotname, int channel)
Definition: Material.cpp:392
UNIFORMPARAMTYPE getSlotType(System::String^ name)
Definition: Material.cpp:320
void setTextureFileName(System::String^ slotname, System::String^ texfilename)
Definition: Material.cpp:215
void setDefByText(System::String^ text)
Definition: Material.cpp:495
bool isEmissiveLinkBuildingLight()
Definition: Material.cpp:532
void setUVStepUseModelUVOrigin(bool v)
Definition: Material.cpp:551
Material(bool skinned, System::String^ shadername, System::Guid guid)
Definition: Material.cpp:5
static float getCommonOutlineWidth()
Definition: Material.h:132
System::String getTextureFileName(System::String^ slotname)
Definition: Material.cpp:432
void setOutlineColor(Color color)
Definition: Material.h:100
float getParameterF(System::String^ slotname, int channel)
Definition: Material.cpp:338
void setParameterI(System::String^ slotname, int x, int y, int z, int w)
Definition: Material.cpp:100
System::String getName()
Definition: Material.cpp:58
System::String getShaderName()
Definition: Material.cpp:233
void removeRef()
Definition: Material.cpp:560
float getEmissiveBlinkSpeed()
Definition: Material.cpp:531
void setReceiveDecal(bool flg)
Definition: Material.h:121
void setParameterF(System::String^ slotname, float x, float y, float z, float w)
Definition: Material.cpp:85
bool isEnableVScrollAnim()
Definition: Material.cpp:522
void setUVStepFrameCount(unsigned int v)
Definition: Material.cpp:549
int getParameterI(System::String^ slotname, int channel)
Definition: Material.cpp:357
int getEnumCount(System::String^ slotname)
Definition: Material.cpp:171
SharpKmyMath::Vector2 getUVOffset()
Definition: Material.cpp:539
bool getParameterB(System::String^ slotname)
Definition: Material.cpp:376
float getParameterMax(System::String^ slotname, int channel)
Definition: Material.cpp:412
void setName(System::String^ name)
Definition: Material.cpp:49
void enableEmissiveBlink(bool flg)
Definition: Material.cpp:552
void setShader(System::String^ shadername)
Definition: Material.cpp:75
static void setCommonDrawOutlineEnable(bool flg)
Definition: Material.h:128
bool isEnableUScrollAnim()
Definition: Material.cpp:520
static int getMaterialTextureNumMax()
Definition: Material.h:26
void setSortIndex(int val)
Definition: Material.h:71
bool getReceiveDecal()
Definition: Material.h:122
static void setCommonOutlineWidth(float w)
Definition: Material.h:136
bool isEnableUVStepAnim()
Definition: Material.cpp:524
void setOutlineWidth(float w)
Definition: Material.h:91
Shader getShader()
Definition: Material.cpp:68
static void setCommonOutlineColor(Color color)
Definition: Material.h:145
void setUDiv(unsigned int v)
Definition: Material.cpp:547
void setDistanceFadeEnable(bool flg)
Definition: Material.h:119
bool isEnableEmissiveBlink()
Definition: Material.cpp:530
void setTexture(System::String^ slotname, Texture^ tex)
Definition: Material.cpp:130
void setOverrideOutlineSetting(bool flg)
Definition: Material.h:110
void addRef()
Definition: Material.cpp:559
unsigned int getUDiv()
Definition: Material.cpp:525
void setUScrollSpeed(float v)
Definition: Material.cpp:543
System::String getEnumString(System::String^ slotname, int index)
Definition: Material.cpp:192
bool getDrawOutlineEnable()
Definition: Material.h:86
float getVScrollSpeed()
Definition: Material.cpp:523
bool getDistanceFadeEnable()
Definition: Material.h:120
void setCullType(CULLTYPE t)
Definition: Material.h:77
void enableUVStepAnim(bool flg)
Definition: Material.cpp:546
float getUScrollSpeed()
Definition: Material.cpp:521
kmyGfx::Material * obj
Definition: Material.h:157
void enableEmissiveLinkBuildingLight(bool flg)
Definition: Material.cpp:554
CULLTYPE getCullType()
Definition: Material.h:76
static Color getCommonOutlineColor()
Definition: Material.h:140
bool isEnableSetSortIndex()
Definition: Material.cpp:534
Definition: Shader.h:8
Definition: Texture.h:12
Definition: Asset.h:4
UNIFORMPARAMTYPE
Definition: GfxTypes.h:125
CULLTYPE
Definition: GfxTypes.h:26
Definition: Vector2.h:5