Commit e2317b53 authored by Byurrrer's avatar Byurrrer

изменил хранение нормалей в gбуфере, порефакторил sxpp, редактор материалов,...

изменил хранение нормалей в gбуфере, порефакторил sxpp, редактор материалов, симуляционную модель, исправил баг в загрузчике шейдеров, перенес блюр ссао на pp шейдер, уменьшил радиус dlaa small
parent bea6234d
[level]
geometry = stalker_atp.geom
green = stalker_atp.green
--green = stalker_atp.green
type = outdoor
entity = stalker_atp.ent
aigrid = stalker_atp.aigrid
......
......@@ -5,6 +5,7 @@ Cмешивание всех текстур для финального изоб
*/
#include <../struct.h>
#include <../mtrl.h>
//##########################################################################
......@@ -21,7 +22,7 @@ half4 main(VSO_PP IN):COLOR0
{
half4 vNormal = tex2D(g_sNormals,IN.vTexUV);
half fSort = vNormal.w;
half fLayer = vNormal.z;
half fLayer = NormalEncodeLayer(vNormal.xyz);
//цвет приводим к sRGB
half4 vColor = pow(tex2D(g_sColor,IN.vTexUV), 2.2);
......
......@@ -93,7 +93,7 @@ PSO_Lbuffer main(VSO_ResPos IN)
half4 vParam = tex2D(g_sParameters, IN.vTexUV);
half3 vNormalPixel = normalize(NormalDecode(vNormals.xy));
half3 vNormalPixel = normalize(/*vNormals.xyz * 2 - 1*/NormalDecode(vNormals.xyz).xyz);
half3 vLigth = normalize(g_vLightPos.xyz - vPosition.xyz);
half3 vVertexToEye = normalize(g_vViewPos.xyz - vPosition.xyz);
half3 vHalfVector = normalize(vVertexToEye + vLigth.xyz);
......
......@@ -78,23 +78,42 @@ half GetTextureLod4Scene(half2 vTexUV)
//##########################################################################
//! кодирование xyz нормали в xy
half3 NormalEncode(half3 n)
half3 NormalEncode(half3 vNormal, half fLayer)
{
half2 enc = normalize(n.xy) * (sqrt(-n.z*0.5+0.5));
/*half2 enc = normalize(n.xy) * (sqrt(-n.z*0.5+0.5));
enc = enc*0.5+0.5;
return half3(enc, 0);
return half3(enc, 0);*/
vNormal.xy = vNormal.xy * 0.5 + 0.5;
vNormal.z = (sign(vNormal.z) * 0.5 + 0.5) * 0.5 + fLayer;
return vNormal;
}
//! декодирование нормали xy в xyz
half3 NormalDecode(half2 enc)
half4 NormalDecode(half3 vNormal)
{
half4 nn = half4(enc, enc)*half4(2,2,0,0) + half4(-1,-1,1,-1);
/*half4 nn = half4(enc, enc)*half4(2,2,0,0) + half4(-1,-1,1,-1);
half l = dot(nn.xyz,-nn.xyw);
nn.z = l;
nn.xy *= sqrt(l);
return nn.xyz * 2 + half3(0,0,-1);
return nn.xyz * 2 + half3(0,0,-1);*/
vNormal.xy = vNormal.xy * 2.0 - 1.0;
half fValue = vNormal.z;
vNormal.z = sign(fValue * 2.0 - 1.0);
vNormal.z = sqrt(1 - pow(vNormal.x, 2) - pow(vNormal.y, 2)) * vNormal.z;
half fLayer;
if(vNormal.z > 0.0)
fLayer = fValue - 0.5;
else
fLayer = fValue;
return half4(vNormal, fLayer);
}
#define NormalEncodeLayer(vNormal)(NormalDecode(vNormal).w)
//! преобразвоание цвета в нормаль (если конечно цвет содержит нормаль)
half3 Color2Normal(half3 vColor)
{
......@@ -111,10 +130,10 @@ PSO_Gbuffer CreateGbuffer(half4 vColor, half3 vNormal, half4 vParam, half4 vPosi
OUT.vColor = vColor;
vNormal = normalize(vNormal);
//OUT.vNormal.xyz = vNormal;
OUT.vNormal.xy = NormalEncode(vNormal);
//OUT.vNormal.xyz = vNormal * 0.5 + 0.5;
OUT.vNormal.xyz = NormalEncode(vNormal, vNearFarLayers.w);
OUT.vNormal.w = vNearFarLayers.z;
OUT.vNormal.z = vNearFarLayers.w;
//OUT.vNormal.z = vNearFarLayers.w;
OUT.vParam = vParam;
......
......@@ -7,10 +7,17 @@ pp_blur_depth_based.ps
#include <../struct.h>
#include <../mtrl.h>
#ifdef SAMPLES_25
#define COUNT_PIXELS 2
#else
#define COUNT_PIXELS 1
#endif
//##########################################################################
sampler2D g_sDepth:register(s0);
sampler2D g_sBlur:register(s1);
sampler2D g_sColor:register(s2);
//##########################################################################
......@@ -23,27 +30,33 @@ half4 main(VSO_PP IN) : COLOR0
{
half2 vCenterTC = IN.vTexUV;
half fSumWeight = 0.125f;
half4 vColor = tex2D(g_sBlur, vCenterTC) * fSumWeight;
half fSumWeight = 0.125;
half4 vBlurColor = tex2D(g_sBlur, vCenterTC) * fSumWeight;
half vCenterDepth = tex2D(g_sDepth, vCenterTC).r * g_vNearFar.y;
[unroll]
for(half x=-1; x<=1; x++)
for(half x=-COUNT_PIXELS; x<=COUNT_PIXELS; x++)
{
[unroll]
for(half y=-1; y<=1; y++)
for(half y=-COUNT_PIXELS; y<=COUNT_PIXELS; y++)
{
half2 vSampleTC = vCenterTC + half2(x * g_vPixelSize.x,y * g_vPixelSize.y);
half fDepth = tex2D(g_sDepth, vSampleTC).r;
fDepth *= g_vNearFar.y;
half fDiff = 9.0f*(1.0f - fDepth/vCenterDepth);
half fWeight = saturate(0.5 - 0.75f*abs(fDiff) - 0.25f*(fDiff));
vColor += tex2D(g_sBlur, vSampleTC) * fWeight;
half fDiff = 9.0*(1.0 - fDepth/vCenterDepth);
half fWeight = saturate(0.5 - 0.75 * abs(fDiff) - 0.25 * (fDiff));
vBlurColor += tex2D(g_sBlur, vSampleTC) * fWeight;
fSumWeight += fWeight;
}
}
vColor /= fSumWeight;
return vColor;
vBlurColor /= fSumWeight;
#if defined(BLEND_COLOR)
half4 vColor = tex2D(g_sColor, IN.vTexUV);
return vColor * saturate(vBlurColor);
#else
return saturate(vBlurColor);
#endif
}
\ No newline at end of file
......@@ -5,6 +5,7 @@ pp_union_alpha.ps
*/
#include <../struct.h>
#include <../mtrl.h>
//##########################################################################
......@@ -65,10 +66,10 @@ PSO_UnionAlpha main(VSO_PP IN):COLOR0
aNormal[2] = tex2Dlod(g_sNormal, aTexUV[2]);
aNormal[3] = tex2Dlod(g_sNormal, aTexUV[3]);
aIdLayer[0] = int(aNormal[0].z * LAYERS_COUNT_MAX);
aIdLayer[1] = int(aNormal[1].z * LAYERS_COUNT_MAX);
aIdLayer[2] = int(aNormal[2].z * LAYERS_COUNT_MAX);
aIdLayer[3] = int(aNormal[3].z * LAYERS_COUNT_MAX);
aIdLayer[0] = int(NormalEncodeLayer(aNormal[0].xyz) * LAYERS_COUNT_MAX);
aIdLayer[1] = int(NormalEncodeLayer(aNormal[1].xyz) * LAYERS_COUNT_MAX);
aIdLayer[2] = int(NormalEncodeLayer(aNormal[2].xyz) * LAYERS_COUNT_MAX);
aIdLayer[3] = int(NormalEncodeLayer(aNormal[3].xyz) * LAYERS_COUNT_MAX);
aIsTransparency[0] = aNormal[0].w >= MTLTYPE_LAYER_TRANSPARENT_UNLIT ? 1 : 0;
aIsTransparency[1] = aNormal[1].w >= MTLTYPE_LAYER_TRANSPARENT_UNLIT ? 1 : 0;
......
......@@ -25,10 +25,10 @@ half4 main(VSO_PP IN) : COLOR0
{
half4 vColorCenter = tex2Dlod2(g_sColor, IN.vTexUV, 0.0);
half4 vHorizNeg0 = tex2Dlod2(g_sColor, IN.vTexUV + half2(-1.5, 0.0) * g_vPixelSize, 0.0);
half4 vHorizPos0 = tex2Dlod2(g_sColor, IN.vTexUV + half2( 1.5, 0.0) * g_vPixelSize, 0.0);
half4 vVertNeg0 = tex2Dlod2(g_sColor, IN.vTexUV + half2(0.0, -1.5) * g_vPixelSize, 0.0);
half4 vVertPos0 = tex2Dlod2(g_sColor, IN.vTexUV + half2(0.0, 1.5) * g_vPixelSize, 0.0);
half4 vHorizNeg0 = tex2Dlod2(g_sColor, IN.vTexUV + half2(-1.0, 0.0) * g_vPixelSize, 0.0);
half4 vHorizPos0 = tex2Dlod2(g_sColor, IN.vTexUV + half2( 1.0, 0.0) * g_vPixelSize, 0.0);
half4 vVertNeg0 = tex2Dlod2(g_sColor, IN.vTexUV + half2(0.0, -1.0) * g_vPixelSize, 0.0);
half4 vVertPos0 = tex2Dlod2(g_sColor, IN.vTexUV + half2(0.0, 1.0) * g_vPixelSize, 0.0);
half4 vSumHoriz = vHorizNeg0 + vHorizPos0;
half4 vSumVert = vVertNeg0 + vVertPos0;
......
......@@ -47,8 +47,8 @@ half4 main(VSO_ResPos IN):COLOR0
else
{
half3 vPosition = half3(g_vViewPos + IN.vWorldRay * fDepth);
half3 vNormal = normalize(NormalDecode(tex2Dlod(g_sNormals, half4(IN.vTexUV, 0, 0)).xy));
half3 vNormal = normalize(NormalDecode(tex2Dlod(g_sNormals, half4(IN.vTexUV, 0, 0)).xyz).xyz);
//return half4(vNormal /** 0.5 + 0.5*/, 1);
half fOcclusion = 0.0;
for(int i=0; i < g_fNumSam; i++)
{
......@@ -77,6 +77,6 @@ half4 main(VSO_ResPos IN):COLOR0
fOcclusion = pow(fOcclusion, 2);
fOcclusion = lerp(1.0, fOcclusion, saturate((fDepth * g_vNearFar.y)/PP_SSAO_DIST_EMERSION));
//fOcclusion = pow(fOcclusion, 2);
return half4(fOcclusion,fOcclusion,fOcclusion,1.0);
return half4(fOcclusion, fOcclusion, fOcclusion, 1);
}
}
\ No newline at end of file
/*
ppe_ssao_blur.ps
Размытие ssao (результата просчета) и повторное размытие со смешиванием со сценой.
Размытие с учетом линейной глубины.
*/
#include <../struct.h>
#include <../mtrl.h>
//##########################################################################
half4 g_vPixelSize;
half2 g_vNearFar;
//##########################################################################
sampler2D g_sDepth:register(s0);
sampler2D g_sBlur:register(s1);
sampler2D g_sColor:register(s2);
//##########################################################################
half4 main(VSO_PP IN) : COLOR0
{
half2 vCenterTC = IN.vTexUV;
half fSumWeight = 0.125f;
half4 vColor = tex2D(g_sBlur, vCenterTC) * fSumWeight;
half fCenterDepth = tex2D(g_sDepth, vCenterTC).r * g_vNearFar.y;
[unroll]
for(half x=-2;x<=2;x++)
{
[unroll]
for(half y=-2;y<=2;y++)
{
half2 SampleTC = vCenterTC + half2(x * g_vPixelSize.x,y * g_vPixelSize.y);
half fDepth = tex2D(g_sDepth, SampleTC).r;
fDepth *= g_vNearFar.y;
half fDiff = 9.0 * (1.0 - fDepth/fCenterDepth);
half Weight = saturate(0.5 - 0.75 * abs(fDiff) - 0.25 * (fDiff));
vColor += tex2D(g_sBlur,SampleTC) * Weight;
fSumWeight += Weight;
}
}
vColor /= fSumWeight;
#if defined(_BLEND_COLOR_)
half4 ScreenColor = tex2D(g_sColor,IN.vTexUV);
return ScreenColor * saturate(vColor.r);
#else
return saturate(vColor);
#endif
}
\ No newline at end of file
......@@ -1143,7 +1143,4 @@ Global
{3A214E06-B95E-4D61-A291-1F8DF2EC10FD} = {BE976610-EE71-4D57-8733-2FE43BF602F5}
{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B} = {2D039A6D-B874-4AA7-8F89-E86DD70B21ED}
EndGlobalSection
GlobalSection(Performance) = preSolution
HasPerformanceSessions = true
EndGlobalSection
EndGlobal
......@@ -103,8 +103,8 @@
<ClInclude Include="..\..\..\source\render\editor\axes_static.h" />
<ClInclude Include="..\..\..\source\render\editor\grid.h" />
<ClInclude Include="..\..\..\source\render\gdata.h" />
<ClInclude Include="..\..\..\source\render\model_sim.h" />
<ClInclude Include="..\..\..\source\render\render_func.h" />
<ClInclude Include="..\..\..\source\render\simulation_model.h" />
<ClInclude Include="..\..\..\source\render\sxrender.h" />
</ItemGroup>
<ItemGroup>
......@@ -115,8 +115,8 @@
<ClCompile Include="..\..\..\source\render\editor\axes_static.cpp" />
<ClCompile Include="..\..\..\source\render\editor\grid.cpp" />
<ClCompile Include="..\..\..\source\render\gdata.cpp" />
<ClCompile Include="..\..\..\source\render\model_sim.cpp" />
<ClCompile Include="..\..\..\source\render\render_func.cpp" />
<ClCompile Include="..\..\..\source\render\simulation_model.cpp" />
<ClCompile Include="..\..\..\source\render\sxrender.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
......
......@@ -21,9 +21,6 @@
<ClInclude Include="..\..\..\source\render\gdata.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\..\source\render\model_sim.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\..\source\render\render_func.h">
<Filter>Header Files</Filter>
</ClInclude>
......@@ -45,6 +42,9 @@
<ClInclude Include="..\..\..\source\common\string_utils.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\..\source\render\simulation_model.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\..\source\render\camera_update.cpp">
......@@ -53,9 +53,6 @@
<ClCompile Include="..\..\..\source\render\gdata.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\..\source\render\model_sim.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\..\source\render\render_func.cpp">
<Filter>Source Files</Filter>
</ClCompile>
......@@ -77,5 +74,8 @@
<ClCompile Include="..\..\..\source\common\string_utils.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\..\source\render\simulation_model.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>
\ No newline at end of file
......@@ -652,12 +652,16 @@ ID CShaderManager::preLoad(SHADER_TYPE type, const char *szPath, const char *szN
}
ID id = -1;
bool isUnic = true;
if (check_double == SHADER_CHECKDOUBLE_PATH)
id = existsPath(type, szPath);
else if (check_double == SHADER_CHECKDOUBLE_NAME)
id = existsName(type, szName);
if (id >= 0)
isUnic = false;
CShader *pShader = 0;
if (type == SHADER_TYPE_VERTEX)
......@@ -687,7 +691,7 @@ ID CShaderManager::preLoad(SHADER_TYPE type, const char *szPath, const char *szN
}
}
if (aMacros)
if (aMacros && isUnic)
{
int iCountMacros = 0;
for (int i = 0; i < SXGC_SHADER_COUNT_MACRO; i++)
......
This diff is collapsed.
......@@ -81,7 +81,7 @@ namespace GData
namespace Editors
{
bool MoveCamera = true;
ModelSim* SimModel = 0;
CSimulationModel* SimModel = 0;
CGrid* ObjGrid = 0;
CAxesStatic* ObjAxesStatic = 0;
......
......@@ -15,12 +15,12 @@ See the license in LICENSE
#ifndef __GDATA_H
#define __GDATA_H
class ModelSim;
class CSimulationModel;
class CAxesStatic;
class CGrid;
#include <input/sxinput.h>
#include <render/model_sim.h>
#include <render/simulation_model.h>
#include <render/editor/grid.h>
#include <render/editor/axes_static.h>
#include <render/sxrender.h>
......@@ -141,7 +141,7 @@ namespace GData
extern bool MoveCamera;
//! указатель симуляционной модели
extern ModelSim* SimModel;
extern CSimulationModel* SimModel;
//! сетка дял редакторов
extern CGrid* ObjGrid;
......
......@@ -822,10 +822,10 @@ void SXRenderFunc::BuildMRT(DWORD timeDelta, bool isRenderSimulation)
}
else
{
if (SML_MtlGetSort(GData::Editors::SimModel->GetIDMtl()) != MTLSORT_OPAQUE)
if (SML_MtlGetSort(GData::Editors::SimModel->getIdMtl()) != MTLSORT_OPAQUE)
SML_MtlSetForceblyAlphaTest(true);
GData::Editors::SimModel->Render(timeDelta);
if (SML_MtlGetSort(GData::Editors::SimModel->GetIDMtl()) != MTLSORT_OPAQUE)
GData::Editors::SimModel->render(timeDelta);
if (SML_MtlGetSort(GData::Editors::SimModel->getIdMtl()) != MTLSORT_OPAQUE)
SML_MtlSetForceblyAlphaTest(false);
}
......@@ -1685,16 +1685,16 @@ void SXRenderFunc::UpdateReflectionScene(DWORD timeDelta)
void SXRenderFunc::UpdateReflectionSimModel(DWORD timeDelta)
{
ID idmat = GData::Editors::SimModel->GetIDMtl();
ID idmat = GData::Editors::SimModel->getIdMtl();
MTLTYPE_REFLECT typeref = SML_MtlGetTypeReflection(idmat);
D3DXPLANE plane;
float3_t center;
GData::Editors::SimModel->GetCenter(&center);
GData::Editors::SimModel->getCenter(&center);
SGCore_ShaderUnBind();
if (typeref == MTLTYPE_REFLECT_PLANE)
{
GData::Editors::SimModel->GetPlane(&plane);
GData::Editors::SimModel->getPlane(&plane);
SML_MtlRefPreRenderPlane(idmat, &plane);
SetSamplerFilter(0, 16, D3DTEXF_LINEAR);
SetSamplerAddress(0, 16, D3DTADDRESS_WRAP);
......
......@@ -13,78 +13,68 @@ See the license in LICENSE
\ingroup managed_render
@{*/
#ifndef __MODELSIM_H
#define __MODELSIM_H
#ifndef __SIMULATION_MODEL_H
#define __SIMULATION_MODEL_H
#include <common/array.h>
#define SM_D3D_CONVERSIONS
#include <common/SXMath.h>
#include <geom/sxgeom.h>
#include <mtllight/sxmtllight.h>
#include <anim/sxanim.h>
#include <render/gdata.h>
//! симуляционная модель всех возможных моделей материалов для редактора материалов
class ModelSim
class CSimulationModel
{
public:
ModelSim();
~ModelSim();
CSimulationModel();
~CSimulationModel();
SX_ALIGNED_OP_MEM
void Add(const char* path);
void add(const char *szPath);
void Render(DWORD timeDelta);
void render(DWORD timeDelta);
MTLTYPE_MODEL TypeModel;
int CurrRenderModel;
float3 Rotation;
MTLTYPE_MODEL m_type_model;
int m_iCurrRenderModel;
float3 m_vRotation;
ID GetIDMtl();
void GetPlane(D3DXPLANE* plane);
void GetCenter(float3_t* center);
ID getIdMtl();
void getPlane(D3DXPLANE *pPlane);
void getCenter(float3_t *pCenter);
protected:
void RenderStatic(DWORD timeDelta);
void RenderGreen(DWORD timeDelta);
void RenderSkin(DWORD timeDelta);
void renderStatic(DWORD timeDelta);
void renderGreen(DWORD timeDelta);
void renderSkin(DWORD timeDelta);
//структура трансформаций растительности
struct DataVertex
{
float3_t Position; //позици¤
float3_t TexCoord; //x - общий масштаб,y - поворот по оси y, z -
float2_t SinCosRot;
};
IDirect3DVertexDeclaration9* VertexDeclarationStatic;
IDirect3DVertexDeclaration9* VertexDeclarationGreen;
IDirect3DVertexDeclaration9* VertexDeclarationSkin;
IDirect3DVertexDeclaration9 *m_pVertexDeclarationStatic;
IDirect3DVertexDeclaration9 *m_pVertexDeclarationGreen;
IDirect3DVertexDeclaration9 *m_pVertexDeclarationSkin;
struct DataModel
struct CModel
{
DataModel(){ Model = 0; }
DataModel(ISXDataStaticModel* _model, float3_t* _center, float3_t* _max, float3_t* _min, D3DXPLANE* _plane)
CModel(){ m_pModel = 0; }
CModel(ISXDataStaticModel *pModel, float3_t *pCenter, float3_t *pMax, float3_t *pMin, D3DXPLANE *pPlane)
{
Model = _model; Center = *_center; Max = *_max; Min = *_min; Plane = *_plane;
m_pModel = pModel; m_vCenter = *pCenter; m_vMax = *pMax; m_vMin = *pMin; m_oPlane = *pPlane;
}
ISXDataStaticModel* Model;
IDirect3DVertexBuffer9* Anim;
float3_t Min, Max, Center;
D3DXPLANE Plane;
ISXDataStaticModel *m_pModel;
IDirect3DVertexBuffer9 *m_pAnim;
float3_t m_vMin, m_vMax, m_vCenter;
D3DXPLANE m_oPlane;
};
Array<DataModel*> ArrStaticModel;
IDirect3DVertexBuffer9* TransVertBufGreen;
DataVertex DVGreen;
ID IDsMat;
float4x4 WorldMat;
Array<CModel*> m_aModels;
IDirect3DVertexBuffer9 *m_pTransVertBufGreen;
CGreenDataVertex m_oGreen;
ID m_idMtrl;
float4x4 m_mWorld;
};
#endif
......
......@@ -61,7 +61,7 @@ SX_LIB_API void SRender_0Create(const char *szName, HWND hWnd3D, HWND hWndParent
//**********************
GData::Editors::SimModel = new ModelSim();
GData::Editors::SimModel = new CSimulationModel();
GData::Editors::ObjGrid = new CGrid();
GData::Editors::ObjGrid->create(100, 100, D3DCOLOR_ARGB(255, 200, 200, 200));
......@@ -173,42 +173,42 @@ SX_LIB_API bool SRender_EditorCameraGetMove()
SX_LIB_API void SRender_SimModelAdd(const char *szName)
{
GData::Editors::SimModel->Add(szName);
GData::Editors::SimModel->add(szName);
}
SX_LIB_API ID SRender_SimModelGetIDMtl()
{
return GData::Editors::SimModel->GetIDMtl();
return GData::Editors::SimModel->getIdMtl();
}
SX_LIB_API MTLTYPE_MODEL SRender_SimModelGetType()
{
return GData::Editors::SimModel->TypeModel;
return GData::Editors::SimModel->m_type_model;
}
SX_LIB_API void SRender_SimModelSetType(MTLTYPE_MODEL type)
{
GData::Editors::SimModel->TypeModel = type;
GData::Editors::SimModel->m_type_model = type;
}
SX_LIB_API void SRender_SimModelSetNumCurrModel(int iCurrNumModel)
{
GData::Editors::SimModel->CurrRenderModel = iCurrNumModel;
GData::Editors::SimModel->m_iCurrRenderModel = iCurrNumModel;
}
SX_LIB_API int SRender_SimModelGetNumCurrModel()
{
return GData::Editors::SimModel->CurrRenderModel;
return GData::Editors::SimModel->m_iCurrRenderModel;
}
SX_LIB_API void SRender_SimModelSetRotationY(float Rotation)
{
GData::Editors::SimModel->Rotation.y = Rotation;
GData::Editors::SimModel->m_vRotation.y = Rotation;
}
SX_LIB_API float SRender_SimModelGetRotationY()
{
return GData::Editors::SimModel->Rotation.y;
return GData::Editors::SimModel->m_vRotation.y;
}
//##########################################################################
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
#include "paraml_kit.h"
ParamLKit::ParamLKit()
CParamLigthKit::CParamLigthKit()
{
}
ParamLKit::~ParamLKit()
CParamLigthKit::~CParamLigthKit()
{
}
void ParamLKit::Load(const char* path)
void CParamLigthKit::load(const char *szPath)
{
ISXConfig* config = Core_OpConfig(path);
ISXConfig* config = Core_OpConfig(szPath);
if (!config)
return;
......@@ -43,58 +43,58 @@ void ParamLKit::Load(const char* path)
if (!(config->keyExists(section_name, "name") && config->keyExists(section_name, "thickness") && config->keyExists(section_name, "roughness") && config->keyExists(section_name, "f0")))
continue;
paraml* tmpparaml = new paraml();
tmpparaml->name = config->getKey(section_name, "name");
tmpparaml->thickness = String(config->getKey(section_name, "thickness")).toDouble();
tmpparaml->roughness = String(config->getKey(section_name, "roughness")).toDouble();
tmpparaml->f0 = String(config->getKey(section_name, "f0")).toDouble();
CParamLigth* tmpparaml = new CParamLigth();
tmpparaml->m_sName = config->getKey(section_name, "name");
tmpparaml->m_fThickness = String(config->getKey(section_name, "thickness")).toDouble();
tmpparaml->m_fRoughness = String(config->getKey(section_name, "roughness")).toDouble();
tmpparaml->m_fF0 = String(config->getKey(section_name, "f0")).toDouble();
Arr.push_back(tmpparaml);
m_aParameters.push_back(tmpparaml);
}
}
UINT ParamLKit::GetCount() const
UINT CParamLigthKit::getCount() const
{
return Arr.size();
return m_aParameters.size();
}
const char* ParamLKit::GetName(ID id) const
const char* CParamLigthKit::getName(ID id) const
{
if (id >= 0 && Arr.size() > id && Arr[id])
return Arr[id]->name.c_str();
if (id >= 0 && m_aParameters.size() > id && m_aParameters[id])
return m_aParameters[id]->m_sName.c_str();
return 0;
}
float ParamLKit::GetThickness(ID id) const
float CParamLigthKit::getThickness(ID id) const
{
if (id >= 0 && Arr.size() > id && Arr[id])
return Arr[id]->thickness;
if (id >= 0 && m_aParameters.size() > id && m_aParameters[id])
return m_aParameters[id]->m_fThickness;
return 0;
}
float ParamLKit::GetRoughness(ID id) const
float CParamLigthKit::getRoughness(ID id) const
{
if (id >= 0 && Arr.size() > id && Arr[id])
return Arr[id]->roughness;
if (id >= 0 && m_aParameters.size() > id && m_aParameters[id])
return m_aParameters[id]->m_fRoughness;
return 0;
}
float ParamLKit::GetF0(ID id) const
float CParamLigthKit::getF0(ID id) const
{
if (id >= 0 && Arr.size() > id && Arr[id])
return Arr[id]->f0;
if (id >= 0 && m_aParameters.size() > id && m_aParameters[id])
return m_aParameters[id]->m_fF0;
return 0;
}