Commit d0e31166 authored by Byurrrer's avatar Byurrrer

Добавил точечный источник света в игровую либу, немного навел порядка в либе...

Добавил точечный источник света в игровую либу, немного навел порядка в либе света (свет), небольшие правки редактора уровней (игровые объекты)
parent 27406442
......@@ -105,6 +105,7 @@
<ClCompile Include="..\..\..\source\game\SXbaseTool.cpp" />
<ClCompile Include="..\..\..\source\game\SXbaseWeapon.cpp" />
<ClCompile Include="..\..\..\source\game\sxgame_dll.cpp" />
<ClCompile Include="..\..\..\source\game\SXLightDirectional.cpp" />
<ClCompile Include="..\..\..\source\game\SXLightPoint.cpp" />
<ClCompile Include="..\..\..\source\game\SXplayer.cpp" />
<ClCompile Include="..\..\..\source\game\SXplayerSpawn.cpp" />
......@@ -130,6 +131,7 @@
<ClInclude Include="..\..\..\source\game\SXbaseTool.h" />
<ClInclude Include="..\..\..\source\game\SXbaseWeapon.h" />
<ClInclude Include="..\..\..\source\game\sxgame.h" />
<ClInclude Include="..\..\..\source\game\SXLightDirectional.h" />
<ClInclude Include="..\..\..\source\game\SXLightPoint.h" />
<ClInclude Include="..\..\..\source\game\SXplayer.h" />
<ClInclude Include="..\..\..\source\game\SXplayerSpawn.h" />
......
......@@ -102,6 +102,9 @@
<ClCompile Include="..\..\..\source\game\SXLightPoint.cpp">
<Filter>Source Files\ents</Filter>
</ClCompile>
<ClCompile Include="..\..\..\source\game\SXLightDirectional.cpp">
<Filter>Source Files\ents</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\..\source\game\sxgame.h">
......@@ -173,5 +176,8 @@
<ClInclude Include="..\..\..\source\game\SXLightPoint.h">
<Filter>Header Files\ents</Filter>
</ClInclude>
<ClInclude Include="..\..\..\source\game\SXLightDirectional.h">
<Filter>Header Files\ents</Filter>
</ClInclude>
</ItemGroup>
</Project>
\ No newline at end of file
......@@ -711,7 +711,7 @@ struct ISXGUIListView : public virtual ISXGUIComponent
virtual void DeleteColumn(int col) = 0; //!< удалить столбец по индексу
virtual int GetCountColumns() = 0; //!< количество столбцов
virtual int AddString(long data = -1) = 0; //!< добавить строку
virtual int AddString(long data = -1) = 0; //!< добавить строку
virtual void DeleteString(int str) = 0; //!< удалить строку
virtual int GetCountString() = 0; //!< количество строк
......
#include "SXLightDirectional.h"
#include <mtllight/sxmtllight.h>
BEGIN_PROPTABLE(SXLightDirectional)
DEFINE_FIELD_VECTOR(m_color, 0, "color", "Color", EDITOR_TEXTFIELD)
DEFINE_FIELD_FLOAT(m_power, 0, "power", "Power", EDITOR_TEXTFIELD)
DEFINE_FIELD_FLOAT(m_dist, 0, "dist", "Distance", EDITOR_TEXTFIELD)
DEFINE_FIELD_FLOAT(m_light_far, 0, "light_far", "Light far", EDITOR_TEXTFIELD)
DEFINE_FIELD_INT(m_typeshadow, 0, "type_shadow", "Type shadow", EDITOR_COMBOBOX)
COMBO_OPTION("None", "-1")
COMBO_OPTION("Static", "0")
COMBO_OPTION("Dynamic", "1")
EDITOR_COMBO_END()
DEFINE_FIELD_FLOAT(m_angle, 0, "angle", "Angle", EDITOR_TEXTFIELD)
DEFINE_FIELD_FLOAT(m_topradius, 0, "topradius", "Top radius", EDITOR_TEXTFIELD)
END_PROPTABLE()
REGISTER_ENTITY(SXLightDirectional, light_directional);
SXLightDirectional::SXLightDirectional(EntityManager * pMgr) :
BaseClass(pMgr)
{
m_color = float3(1, 1, 1);
m_vPosition = float3_t(0, 0, 0);
m_power = 10;
m_dist = 10;
m_light_far = m_dist;
m_typeshadow = 1;
m_angle = SM_PI * 0.4f;
m_topradius = 0.01f;
IDLight = SML_LigthsCreateDirection(&float3(0, 0, 0), m_power, m_dist, &m_color, &float3(0, -1, 0), m_topradius, m_angle, true);
float3 f = LIGHTS_DIR_BASE;
float3 a = SMVector3Cross(f, f);
float ang = acosf(SMVector3Dot(f, f));
m_vOrientation = SMQuaternion(a, ang);
}
SXLightDirectional::~SXLightDirectional()
{
SML_LigthsDeleteLight(IDLight);
}
void SXLightDirectional::OnSync()
{
BaseClass::OnSync();
static float3 vec;
SML_LigthsGetPos(IDLight, &vec, false);
if (vec.x != m_vPosition.x || vec.y != m_vPosition.y || vec.z != m_vPosition.z)
SML_LigthsSetPos(IDLight, &(float3)m_vPosition, false);
SML_LigthsSetColor(IDLight, &m_color);
SML_LigthsSetPower(IDLight, m_power);
if (SML_LigthsGetDist(IDLight) != m_dist)
{
SML_LigthsSetDist(IDLight, m_dist, true);
m_light_far = m_dist;
}
if (SML_LigthsGetShadowLocalFar(IDLight) != m_light_far)
SML_LigthsSetShadowLocalFar(IDLight, m_light_far);
if (SML_LigthsGetTypeShadowed(IDLight) != m_typeshadow)
SML_LigthsSetTypeShadowed(IDLight, (LightsTypeShadow)m_typeshadow);
static float3 curr_rot;
curr_rot = SMMatrixToEuler(m_vOrientation.GetMatrix());
SML_LigthsGetRot(IDLight, &vec);
if (vec.x != curr_rot.x || vec.y != curr_rot.y || vec.z != curr_rot.z)
SML_LigthsSetRot(IDLight, &curr_rot);
if (SML_LigthsGetAngle(IDLight) != m_angle)
SML_LigthsSetAngle(IDLight, m_angle);
if (SML_LigthsGetTopRadius(IDLight) != m_topradius)
SML_LigthsSetTopRadius(IDLight, m_topradius);
}
#ifndef __sxlightpoint_h
#define __sxlightpoint_h
#include "SXpointEntity.h"
class SXLightDirectional : public SXpointEntity
{
DECLARE_CLASS(SXLightDirectional, SXpointEntity);
DECLARE_PROPTABLE();
public:
SXLightDirectional(EntityManager * pMgr);
~SXLightDirectional();
protected:
ID IDLight;
float3 m_color;
float m_power;
float m_dist;
float m_light_far;
int m_typeshadow;
float m_angle;
float m_topradius;
void OnSync();
};
#endif
......@@ -274,8 +274,8 @@ void SXRenderFunc::ComVisibleForLight()
{
for (int i = 0; i<SML_LigthsGetCount(); i++)
{
long tmpid = SML_LigthsGetIDOfKey(i);
if (SML_LigthsIsShadow(tmpid) && (SML_LigthsComVisibleForFrustum(tmpid, GData::ObjCamera->ObjFrustum) && SML_LigthsIsEnable(tmpid)) /*|| (Data::Level::LightManager->Arr[i]->ShadowCube && Data::Level::LightManager->Arr[i]->ShadowCube->GetStatic() && !Data::Level::LightManager->Arr[i]->ShadowCube->GetUpdate())*/)
long tmpid = SML_LigthsGetIDByKey(i);
if (SML_LigthsGetShadowed(tmpid) && (SML_LigthsComVisibleForFrustum(tmpid, GData::ObjCamera->ObjFrustum) && SML_LigthsGetEnable(tmpid)) /*|| (Data::Level::LightManager->Arr[i]->ShadowCube && Data::Level::LightManager->Arr[i]->ShadowCube->GetStatic() && !Data::Level::LightManager->Arr[i]->ShadowCube->GetUpdate())*/)
{
if (SML_LigthsGetType(tmpid) == LightsTypeLight::ltl_global)
{
......@@ -290,9 +290,9 @@ void SXRenderFunc::ComVisibleForLight()
if(SML_LigthsGetIDArr(tmpid, RENDER_IDARRCOM_ANIM, k) <= -1)
SML_LigthsSetIDArr(tmpid, RENDER_IDARRCOM_ANIM, k, SXAnim_ModelsAddArrForCom());
if (SML_LigthsUpdateCountUpdate(tmpid, &GData::ConstCurrCamPos, k))
if (SML_LigthsCountUpdateUpdate(tmpid, &GData::ConstCurrCamPos, k))
{
SML_LigthsUpdateFrustumsG(tmpid, k, &GData::ConstCurrCamPos, &GData::ConstCurrCamDir);
SML_LigthsUpdateGFrustums(tmpid, k, &GData::ConstCurrCamPos, &GData::ConstCurrCamDir);
SGeom_ModelsComVisible(SML_LigthsGetFrustum(tmpid, k), &GData::ConstCurrCamPos, SML_LigthsGetIDArr(tmpid, RENDER_IDARRCOM_GEOM, k));
SGeom_GreenComVisible(SML_LigthsGetFrustum(tmpid, k), &GData::ConstCurrCamPos, SML_LigthsGetIDArr(tmpid, RENDER_IDARRCOM_GREEN, k));
SXAnim_ModelsComVisible(SML_LigthsGetFrustum(tmpid, k), &GData::ConstCurrCamPos, SML_LigthsGetIDArr(tmpid, RENDER_IDARRCOM_ANIM, k));
......@@ -332,7 +332,7 @@ void SXRenderFunc::ComVisibleForLight()
if(SML_LigthsGetIDArr(tmpid, RENDER_IDARRCOM_ANIM, k) <= -1)
SML_LigthsSetIDArr(tmpid, RENDER_IDARRCOM_ANIM, k, SXAnim_ModelsAddArrForCom());
if (SML_LigthsGetEnableCubeEdge(tmpid, k))
if (SML_LigthsGetCubeEdgeEnable(tmpid, k))
{
SGeom_ModelsComVisible(SML_LigthsGetFrustum(tmpid, k), &GData::ConstCurrCamPos, SML_LigthsGetIDArr(tmpid, RENDER_IDARRCOM_GEOM, k));
SGeom_GreenComVisible(SML_LigthsGetFrustum(tmpid, k), &GData::ConstCurrCamPos, SML_LigthsGetIDArr(tmpid, RENDER_IDARRCOM_GREEN, k));
......@@ -879,19 +879,19 @@ void SXRenderFunc::UpdateShadow(DWORD timeDelta)
for (int i = 0; i<SML_LigthsGetCount(); i++)
{
long tmpid = SML_LigthsGetIDOfKey(i);
long tmpid = SML_LigthsGetIDByKey(i);
Core_RIntSet(G_RI_INT_CURRIDLIGHT, tmpid);
if (SML_LigthsIsShadow(tmpid) && (SML_LigthsComVisibleForFrustum(tmpid, GData::ObjCamera->ObjFrustum) && SML_LigthsIsEnable(tmpid)) /*|| (Data::Level::LightManager->Arr[i]->ShadowCube && Data::Level::LightManager->Arr[i]->ShadowCube->GetStatic() && !Data::Level::LightManager->Arr[i]->ShadowCube->GetUpdate())*/)
if (SML_LigthsGetShadowed(tmpid) && (SML_LigthsComVisibleForFrustum(tmpid, GData::ObjCamera->ObjFrustum) && SML_LigthsGetEnable(tmpid)) /*|| (Data::Level::LightManager->Arr[i]->ShadowCube && Data::Level::LightManager->Arr[i]->ShadowCube->GetStatic() && !Data::Level::LightManager->Arr[i]->ShadowCube->GetUpdate())*/)
{
if (SML_LigthsGetType(tmpid) == LightsTypeLight::ltl_global)
{
SML_LigthsInRenderBegin(tmpid);
SML_LigthsShadowRenderBegin(tmpid);
int countsplits = (SML_LigthsGet4Or3SplitsG(tmpid) ? 4 : 3);
for (int k = 0; k<countsplits; k++)
{
if (SML_LigthsAllowedRender(tmpid, k))
if (SML_LigthsCountUpdateAllowed(tmpid, k))
{
SML_LigthsInRenderPre(tmpid, k);
SML_LigthsShadowRenderPre(tmpid, k);
if (SML_LigthsGetIDArr(tmpid, RENDER_IDARRCOM_GEOM, k) > -1)
SGeom_ModelsRender(timeDelta, MtlTypeTransparency::mtt_none, SML_LigthsGetIDArr(tmpid, RENDER_IDARRCOM_GEOM, k));
......@@ -906,8 +906,8 @@ void SXRenderFunc::UpdateShadow(DWORD timeDelta)
//КОГДА ИСТОЧНИК БЛИЗОК К ГОРИЗОНТУ ИЗ-ЗА ОБЛАКОВ ВОЗНИКАЕТ БАГ С ТЕНЯМИ В ВИДЕ ФЕЙКОВЫХ ТЕНЕЙ
if (SGCore_SkyCloudsIsCr() && SGCore_SkyCloudsIsLoadTex())
{
SML_LigthsUpdateFrustumsG(tmpid, 4, &GData::ConstCurrCamPos, &GData::ConstCurrCamDir);
SML_LigthsInRenderPre(tmpid, 4);
SML_LigthsUpdateGFrustums(tmpid, 4, &GData::ConstCurrCamPos, &GData::ConstCurrCamDir);
SML_LigthsShadowRenderPre(tmpid, 4);
GData::DXDevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
GData::DXDevice->SetRenderState(D3DRS_ALPHATESTENABLE, FALSE);
SetSamplerFilter(0, D3DTEXF_LINEAR);
......@@ -920,13 +920,13 @@ void SXRenderFunc::UpdateShadow(DWORD timeDelta)
SetSamplerAddress(0, D3DTADDRESS_WRAP);
SetSamplerAddress(1, D3DTADDRESS_WRAP);
}
SML_LigthsInRenderEnd(tmpid);
SML_LigthsShadowRenderEnd(tmpid);
}
else if (SML_LigthsGetType(tmpid) == LightsTypeLight::ltl_direction)
{
if (SML_LigthsUpdateCountUpdate(tmpid, &GData::ConstCurrCamPos))
if (SML_LigthsCountUpdateUpdate(tmpid, &GData::ConstCurrCamPos))
{
SML_LigthsInRenderBegin(tmpid);
SML_LigthsShadowRenderBegin(tmpid);
if (SML_LigthsGetTypeShadowed(tmpid) == LightsTypeShadow::lts_dynamic)
{
......@@ -946,20 +946,20 @@ void SXRenderFunc::UpdateShadow(DWORD timeDelta)
SGeom_GreenRender(timeDelta, &GData::ConstCurrCamPos, GeomGreenType::ggt_tree, GData::DefaultGreenIDArr);
}
SML_LigthsInRenderEnd(tmpid);
SML_LigthsShadowRenderEnd(tmpid);
}
}
else if (SML_LigthsGetType(tmpid) == LightsTypeLight::ltl_point)
{
if (SML_LigthsGetTypeShadowed(tmpid) != LightsTypeShadow::lts_none && SML_LigthsUpdateCountUpdate(tmpid, &GData::ConstCurrCamPos))
if (SML_LigthsGetTypeShadowed(tmpid) != LightsTypeShadow::lts_none && SML_LigthsCountUpdateUpdate(tmpid, &GData::ConstCurrCamPos))
{
SML_LigthsInRenderBegin(tmpid);
SML_LigthsShadowRenderBegin(tmpid);
for (int k = 0; k < 6; k++)
{
if (SML_LigthsGetEnableCubeEdge(tmpid, k))
if (SML_LigthsGetCubeEdgeEnable(tmpid, k))
{
SML_LigthsInRenderPre(tmpid, k);
SML_LigthsShadowRenderPre(tmpid, k);
if (SML_LigthsGetTypeShadowed(tmpid) == LightsTypeShadow::lts_dynamic)
{
......@@ -979,11 +979,11 @@ void SXRenderFunc::UpdateShadow(DWORD timeDelta)
SGeom_GreenRender(timeDelta, &GData::ConstCurrCamPos, GeomGreenType::ggt_tree, GData::DefaultGreenIDArr);
}
SML_LigthsInRenderPost(tmpid, k);
SML_LigthsShadowRenderPost(tmpid, k);
}
}
SML_LigthsInRenderEnd(tmpid);
SML_LigthsShadowRenderEnd(tmpid);
}
}
}
......@@ -1075,10 +1075,10 @@ void SXRenderFunc::ComLighting(DWORD timeDelta, bool render_sky)
for (int i = 0; i<SML_LigthsGetCount(); i++)
{
//поулчаем идентификатор света по ключу
ID tmpid = SML_LigthsGetIDOfKey(i);
ID tmpid = SML_LigthsGetIDByKey(i);
//если свет виден фрустуму камеры (это надо было заранее просчитать) и если свет включен
if (SML_LigthsGetVisibleForFrustum(tmpid) && SML_LigthsIsEnable(tmpid))
if (SML_LigthsGetVisibleForFrustum(tmpid) && SML_LigthsGetEnable(tmpid))
{
//пока что назначаем шейдер без теней
ID idshader = GData::IDsShaders::PS::ComLightingNonShadow;
......@@ -1150,7 +1150,7 @@ void SXRenderFunc::ComLighting(DWORD timeDelta, bool render_sky)
GData::DXDevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_CCW);
//если свет отбрасывает тени
if (SML_LigthsIsShadow(tmpid))
if (SML_LigthsGetShadowed(tmpid))
{
//генерация теней для текущего света
//{{
......@@ -1163,19 +1163,19 @@ void SXRenderFunc::ComLighting(DWORD timeDelta, bool render_sky)
GData::DXDevice->SetRenderState(D3DRS_ALPHATESTENABLE, FALSE);
GData::DXDevice->SetRenderState(D3DRS_COLORWRITEENABLE, D3DCOLORWRITEENABLE_RED);
SML_LigthsNullingShadow(); //очищаем рт генерации теней
SML_LigthsGenShadow(tmpid); //генерируем тень для света
SML_LigthsShadowNull(); //очищаем рт генерации теней
SML_LigthsShadowGen(tmpid); //генерируем тень для света
static const int * shadow_soft = GET_PCVAR_INT("shadow_soft");
if (shadow_soft)
{
if ((*shadow_soft) == 1)
SML_LigthsSoftShadow(false, 2);
SML_LigthsShadowSoft(false, 2);
else if ((*shadow_soft) == 2)
{
SML_LigthsSoftShadow(false, 2);
SML_LigthsSoftShadow(false, 2);
SML_LigthsShadowSoft(false, 2);
SML_LigthsShadowSoft(false, 2);
}
}
......@@ -1260,7 +1260,7 @@ void SXRenderFunc::ComLighting(DWORD timeDelta, bool render_sky)
//обработка tone mapping
static const float * hdr_adapted_coef = GET_PCVAR_FLOAT("hdr_adapted_coef");
SML_LigthsComToneMapping(timeDelta, (hdr_adapted_coef ? (*hdr_adapted_coef) : 0.03f));
SML_LigthsToneMappingCom(timeDelta, (hdr_adapted_coef ? (*hdr_adapted_coef) : 0.03f));
//теперь необходимо все смешать чтобы получить итоговую освещенную картинку
//{{
......
This diff is collapsed.
......@@ -34,102 +34,141 @@ public:
void Save(const char* path);
void Load(const char* path);
inline long GetCountLights();
inline int GetCountLights() const;
void Clear();
ID CreatePoint(ID id, float3* center, float power, float dist, float3* color, bool isglobal, bool is_shadowed, const char* bound_volume);
ID CreateDirection(ID id, float3* pos, float power, float dist, float3* color, float3* dir, float top_radius, float angle, bool is_shadow, const char* bound_volume);
ID CreatePoint(ID id, const float3* center, float power, float dist, const float3* color, bool isglobal, bool is_shadow, const char* bound_volume);
ID CreateDirection(ID id, const float3* pos, float power, float dist, const float3* color, const float3* dir, float top_radius, float angle, bool is_shadow, const char* bound_volume);
void DeleteLight(ID id);
ID GetIdByKey(int key);
void Render(ID id, DWORD timeDelta);
ID GetLightGlobal();
ID GetLightGlobal() const;
//-----------------------------------------------------------------------------
char* GetLightName(ID id);
void SetLightName(ID id, const char* name);
void GetLightColor(ID id, float3* vec);
void SetLightColor(ID id, float3* vec);
void GetLightColor(ID id, float3* vec) const;
void SetLightColor(ID id, const float3* vec);
void GetLightPos(ID id, float3* vec, bool greal = false);
void SetLightPos(ID id, float3* vec, bool greal = false);
void GetLightPos(ID id, float3* vec, bool greal = false) const;
void SetLightPos(ID id, const float3* vec, bool greal = false);
void SetLightPower(ID id, float power);
float GetLightPower(ID id);
float GetLightPowerDiv(ID id);
float GetLightDist(ID id);
void GetLightRot(ID id, float3* vec);
void SetLightRot(ID id, float3* vec);
void GetLightDir(ID id, float3* vec);
void SetLightDir(ID id, float3* vec);
float GetLightPower(ID id) const;
float GetLightPowerDiv(ID id) const;
float GetLightDist(ID id) const;
void SetLightDist(ID id, float radius_height, bool is_create);
//-----------------------------------------------------------------------------
void GetLightRot(ID id, float3* vec) const;
void SetLightRot(ID id, const float3* vec);
void GetLightDir(ID id, float3* vec) const;
void SetLightDir(ID id, const float3* vec);
float GetLightTopRadius(ID id) const;
void SetLightTopRadius(ID id, float top_radius);
float GetLightAngle(ID id) const;
void SetLightAngle(ID id, float angle, bool is_create);
void SetLightCubeEdgeEnable(ID id, int edge, bool enable);
bool GetLightCubeEdgeEnable(ID id, int edge) const;
//-----------------------------------------------------------------------------
void SetShadowBias(ID id, float val);
float GetShadowBias(ID id) const;
void SetShadowBlurPixel(ID id, float blur_pixel);
float GetShadowBlurPixel(ID id) const;
void SetLightBias(ID id, float val);
float GetLightBias(ID id);
float GetLightTopRadius(ID id);
float GetLightAngle(ID id);
void ChangeAngle(ID id, float angle, bool is_create);
void ChangeTopRadius(ID id, float top_radius);
void ChangeRadiusHeight(ID id, float radius_height, bool is_create);
//void ChangeShadow(ID id, bool is_shadow);
void SetBlurPixel(ID id, float blur_pixel);
float GetBlurPixel(ID id);
void SetShadowLocalNear(ID id, float slnear);
float GetShadowLocalNear(ID id);
float GetShadowLocalNear(ID id) const;
void SetShadowLocalFar(ID id, float slfar);
float GetShadowLocalFar(ID id);
void SetEnableCubeEdge(ID id, int edge, bool enable);
bool GetEnableCubeEdge(ID id, int edge);
float GetShadowLocalFar(ID id) const;
bool ComVisibleForFrustum(ID id, ISXFrustum* frustum);
//-----------------------------------------------------------------------------
bool ComVisibleForFrustum(ID id, const ISXFrustum* frustum);
bool GetVisibleForFrustum(ID id);
float ComDistFor(ID id, float3* vec);
float ComDistFor(ID id, const float3* vec);
float GetDistFor(ID id);
void ComVisibleFrustumDistFor(ISXFrustum* frustum, float3* vec);
void ComVisibleFrustumDistFor(const ISXFrustum* frustum, const float3* vec);
bool IsEnable(ID id);
void SetEnable(ID id, bool val);
bool IsShadow(ID id);
LightsTypeLight GetType(ID id);
//-----------------------------------------------------------------------------
inline bool GetLightEnable(ID id) const;
void SetLightEnable(ID id, bool val);
inline bool GetLightShadowed(ID id) const;
LightsTypeLight GetLightType(ID id) const;
void SetLightTypeShadowed(ID id, LightsTypeShadow type);
inline LightsTypeShadow GetLightTypeShadowed(ID id) const;
//-----------------------------------------------------------------------------
IDirect3DTexture9* GetShadow2();
void InRenderBegin(ID id);
void InRenderEnd(ID id);
void InRenderPre(ID id, int cube);
void InRenderPost(ID id, int cube);
void ShadowRenderBegin(ID id);
void ShadowRenderEnd(ID id);
void ShadowRenderPre(ID id, int cube);
void ShadowRenderPost(ID id, int cube);
//-----------------------------------------------------------------------------
void InitShaderOfTypeMaterial(ID id, int typemat, float4x4* wmat);
ISXFrustum* GetFrustum(ID id, int how);
ISXFrustum* GetFrustumG(ID id, int split);
//-----------------------------------------------------------------------------
void UpdateFrustumsG(ID id, int split, float3* pos, float3* dir);
ISXFrustum* GetLightFrustum(ID id, int how) const;
ISXFrustum* GetLightFrustumG(ID id, int split) const;
void GenShadow(ID id);
inline void NullingShadow();
void GenShadow2(ID id);
void SoftShadow(bool randomsam, float size, bool isfirst = false);
void UpdateLightGFrustums(ID id, int split, const float3* pos, const float3* dir);
//-----------------------------------------------------------------------------
ID GetLightIDArr(ID id, ID inid, int how);
void SetLightIDArr(ID id, ID inid, int how, ID id_arr);
void SetLightTypeShadowed(ID id, LightsTypeShadow type);
inline LightsTypeShadow GetLightTypeShadowed(ID id);
//-----------------------------------------------------------------------------
bool LightCountUpdateUpdate(ID id, const float3* viewpos, int ghow = -1);
inline bool LightCountUpdateAllowed(ID id, int ghow = -1) const;
inline void LightCountUpdateNull(ID id);
bool UpdateLightCountUpdate(ID id, float3* viewpos, int ghow = -1);
bool AllowedRenderLight(ID id, int ghow = -1);
inline void SetNullLightCountUpdate(ID id);
//-----------------------------------------------------------------------------
void ComToneMapping(DWORD timeDelta, float factor_adapted = 10);
void ToneMappingCom(DWORD timeDelta, float factor_adapted = 10);
//-----------------------------------------------------------------------------
inline void Set4Or3Splits(ID id, bool is4);
inline bool Get4Or3Splits(ID id);
//-----------------------------------------------------------------------------
void ShadowGen(ID id);
inline void ShadowNull();
void ShadowGen2(ID id);
void ShadowSoft(bool randomsam, float size, bool isfirst = false);
//-----------------------------------------------------------------------------
int DelGetCount();
LightsTypeLight DelGetType(ID key);
void DelDel(ID key);
ID DelGetIDArr(ID key, ID inid, int how);
//-----------------------------------------------------------------------------
struct Light
{
Light();
......@@ -138,18 +177,17 @@ public:
SX_ALIGNED_OP_MEM;
ID Id;
long Key;
int Key;
LightsTypeLight TypeLight;
char Name[OBJECT_NAME_MAX_LEN];
bool IsVisible;
bool IsEnable;
//bool IsShadow;
bool IsGlobal;
LightsTypeShadow TypeShadowed;
long CountUpdate;
int CountUpdate;
ID3DXMesh* Mesh;
......@@ -177,13 +215,6 @@ public:
ShadowMapCubeTech* ShadowCube;
};
ID GetIdOfKey(long key);
long DelGetCount();
LightsTypeLight DelGetType(ID key);
void DelDel(ID key);
ID DelGetIDArr(ID key, ID inid, int how);
protected:
inline ID AddLight(Light* obj);
......
......@@ -187,7 +187,7 @@ void PSSM::Init()
}
void PSSM::UpdateFrustums(int split, float3* poscam, float3* dircam)
void PSSM::UpdateFrustums(int split, const float3* poscam, const float3* dircam)
{
Frustums[split]->Update(&(Views[split]), &(Projs[split]));
......@@ -512,7 +512,7 @@ ShadowMapTech::~ShadowMapTech()
mem_release_del(OldColorSurface);
}
void ShadowMapTech::SetPosition(float3* pos)
void ShadowMapTech::SetPosition(const float3* pos)
{
Position = *pos;
}
......@@ -522,7 +522,7 @@ void ShadowMapTech::GetPosition(float3* pos)
*pos = Position;
}
void ShadowMapTech::SetDirection(float3* dir)
void ShadowMapTech::SetDirection(const float3* dir)
{
Direction = *dir;
}
......@@ -532,7 +532,7 @@ void ShadowMapTech::GetDirection(float3* dir)
*dir = Direction;
}
void ShadowMapTech::SetAngleNearFar(float3* anf)
void ShadowMapTech::SetAngleNearFar(const float3* anf)
{
AngleNearFar = *anf;
}
......
......@@ -14,7 +14,7 @@ public:
void Init();
void UpdateFrustums(int split, float3* poscam, float3* dircam);
void UpdateFrustums(int split, const float3* poscam, const float3* dircam);
void PreRender(int spilt);
void Begin();
void End();
......@@ -93,13 +93,13 @@ public:
void GenShadow2(IDirect3DTexture9* shadowmap);
void SetPosition(float3* pos);
void SetPosition(const float3* pos);
void GetPosition(float3* pos);
void SetDirection(float3* dir);
void SetDirection(const float3* dir);
void GetDirection(float3* dir);
inline void SetAngleNearFar(float3* anf);
inline void SetAngleNearFar(const float3* anf);
inline void GetAngleNearFar(float3* anf);
inline void SetFar(float sfar);
......
This diff is collapsed.
This diff is collapsed.
......@@ -173,10 +173,10 @@ void Emitter::ComputeLighting()
for (int k = 0; k<SML_LigthsGetCount(); ++k)
{
//поулчаем идентификатор света по ключу
ID tmpid = SML_LigthsGetIDOfKey(k);
ID tmpid = SML_LigthsGetIDByKey(k);
//если свет виден фрустуму камеры (это надо было заранее просчитать) и если свет включен
if (SML_LigthsGetVisibleForFrustum(tmpid) && SML_LigthsIsEnable(tmpid))
if (SML_LigthsGetVisibleForFrustum(tmpid) && SML_LigthsGetEnable(tmpid))
{
SML_LigthsGetColor(tmpid, &tmpColor);
......
......@@ -169,14 +169,18 @@ LRESULT SXLevelEditor_ListViewGameClass_Click()
break;
}
char tval[256];
static char tval[256];
tval[0] = 0;
SXLevelEditor::ListViewGameClass->GetTextItem(tval, 1, str, 256);
const char* tval2;
char tval3[256];
bool isfound = false;
//
for (int i = 0; i < SXLevelEditor::ComboBoxGameValue->GetCount(); ++i)
{
// ( )
tval2 = (const char*)SXLevelEditor::ComboBoxGameValue->GetItemData(i);
if (strcmp(tval, tval2) == 0)
......@@ -185,11 +189,24 @@ LRESULT SXLevelEditor_ListViewGameClass_Click()
isfound = true;
break;
}
//
SXLevelEditor::ComboBoxGameValue->GetItemText(i, tval3);
if (strcmp(tval, tval3) == 0)
{
SXLevelEditor::ComboBoxGameValue->SetSel(i);
isfound = true;
break;
}
}
//
if (!isfound)
{
MessageBox(0,"SXLevelEditor_ListViewGameClass_Click data not found",0,0);
SXLevelEditor::ComboBoxGameValue->AddItem(tval);
SXLevelEditor::ComboBoxGameValue->SetItemData(SXLevelEditor::ComboBoxGameValue->GetCount() - 1, (LPARAM)tval);
SXLevelEditor::ComboBoxGameValue->SetSel(SXLevelEditor::ComboBoxGameValue->GetCount()-1);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment