Skip to content

Commit

Permalink
1.7.5
Browse files Browse the repository at this point in the history
  • Loading branch information
ehsankamrani committed Jul 2, 2021
1 parent 84b4e63 commit 7a13f21
Show file tree
Hide file tree
Showing 41 changed files with 3,100 additions and 297 deletions.
Binary file modified editor/VandaEngine1.v12.suo
Binary file not shown.
Binary file not shown.
9 changes: 9 additions & 0 deletions editor/VandaEngine1/Common/Prefab.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,15 @@ CInstancePrefab::CInstancePrefab()
m_castShadow = CTrue;
m_isTransformable = CFalse;
m_isSelectable = CFalse;

m_fAmbientColor[0] = m_fAmbientColor[1] = m_fAmbientColor[2] = 0.5f; m_fAmbientColor[3] = 1.0f;
m_fDiffuseColor[0] = m_fDiffuseColor[1] = m_fDiffuseColor[2] = 0.5f; m_fDiffuseColor[3] = 1.0f;
m_fSpecularColor[0] = m_fSpecularColor[1] = m_fSpecularColor[2] = 0.5f; m_fSpecularColor[3] = 1.0f;
m_fEmissionColor[0] = m_fEmissionColor[1] = m_fEmissionColor[2] = 0.5f; m_fEmissionColor[3] = 1.0f;
m_fShininess = 50.0f;
m_fTransparency = 1.0f;
m_enableMaterial = CFalse;

m_lua = LuaNewState();
LuaOpenLibs(m_lua);
LuaRegisterFunctions(m_lua);
Expand Down
44 changes: 44 additions & 0 deletions editor/VandaEngine1/Common/Prefab.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,14 @@ class CInstancePrefab
CBool m_isTransformable;
CBool m_isSelectable;
lua_State* m_lua;
//Material Colors
CFloat m_fAmbientColor[4];
CFloat m_fDiffuseColor[4];
CFloat m_fSpecularColor[4];
CFloat m_fEmissionColor[4];
CFloat m_fShininess, m_fTransparency;
CBool m_enableMaterial;

public:
CVoid SetName(CChar* name);
CVoid SetNameIndex();
Expand Down Expand Up @@ -163,6 +171,42 @@ class CInstancePrefab
CVoid OnSelectScript();
CBool GetHasScript() { return m_hasScript; }
CVoid SetHasScript(CBool set) { m_hasScript = set; }

//Material
CFloat* GetAmbient() { return m_fAmbientColor; }
CFloat* GetDiffuse() { return m_fDiffuseColor; }
CFloat* GetSpecular() { return m_fSpecularColor; }
CFloat* GetEmission() { return m_fEmissionColor; }
CFloat GetShininess() { return m_fShininess; }
CFloat GetTransparency() { return m_fTransparency; }
CBool IsMaterialEnabled() { return m_enableMaterial; }
CVoid EnableMaterial() { m_enableMaterial = CTrue; }
CVoid DisableMaterial() { m_enableMaterial = CFalse; }

CVoid SetAmbient(CFloat* ambient)
{
for (CUInt i = 0; i < 4; i++)
m_fAmbientColor[i] = ambient[i];
}
CVoid SetDiffuse(CFloat* diffuse)
{
for (CUInt i = 0; i < 4; i++)
m_fDiffuseColor[i] = diffuse[i];
}
CVoid SetSpecular(CFloat* specular)
{
for (CUInt i = 0; i < 4; i++)
m_fSpecularColor[i] = specular[i];
}
CVoid SetEmission(CFloat* emission)
{
for (CUInt i = 0; i < 4; i++)
m_fEmissionColor[i] = emission[i];
}
CVoid SetShininess(CFloat shininess) { m_fShininess = shininess; }
CVoid SetTransparency(CFloat transparency) { m_fTransparency = transparency; }
//////////////////

};

class CPrefab
Expand Down
11 changes: 11 additions & 0 deletions editor/VandaEngine1/EditMaterial.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -746,6 +746,17 @@ void CEditMaterial::OnOK()
MessageBox("Please Fill In Transparency Filed", "Vanda Engine Error", MB_OK | MB_ICONERROR);
return;
}
if (!m_strShininess.IsEmpty() && m_fShininess < 0.0f)
{
MessageBox("Shininess must be 0.0 or higher", "Error", MB_OK | MB_ICONERROR);
return;
}
if (!m_strTransparency.IsEmpty() && (m_fTransparency < 0.0f || m_fTransparency > 1.0f))
{
MessageBox("Transparency must be between 0.0 and 1.0", "Error", MB_OK | MB_ICONERROR);
return;
}

//Material Colors
if (m_geometry)
{
Expand Down
Loading

0 comments on commit 7a13f21

Please sign in to comment.