Commit 210c29e2 authored by D-AIRY's avatar D-AIRY

Light (continue)

parent 04fe1297
......@@ -4,8 +4,8 @@ mtrlgeom_base.vs
Базовый рендер геометрии
*/
#include "../struct.h"
#include "../const.h"
#include <struct.h>
#include <const.h>
//##########################################################################
......@@ -14,11 +14,11 @@ VSO_SceneCommon main(VSI_Geometry IN)
VSO_SceneCommon OUT = (VSO_SceneCommon)0;
// OUT.vPosition = mul(half4(IN.vPosition, 1.f), g_mWVP);
OUT.vPosition = mul(half4(IN.vPosition, 1.f), g_mW);
OUT.vPosition = mul(float4(IN.vPosition, 1.f), g_mW);
OUT.vPosition = mul(OUT.vPosition, g_mVP);
OUT.vNormal = mul(IN.vNormal,g_mW);
OUT.vTexUV = IN.vTexUV;
OUT.vPos = OUT.vPosition;
return OUT;
}
\ No newline at end of file
}
......@@ -7,6 +7,7 @@ XMaterial MainGBuffer(PSI_XMaterial IN)
// float4 fColor = IN.vPos;
#ifdef HAS_ALPHATEST
clip(fColor.a - g_xMaterialConstants.pbr_alphatest_threshold);
// clip(fColor.a - 0.03);
#endif
OUT.vBaseColor = fColor.xyz/* * g_xMaterialConstants.vColor.xyz*/;
......
......@@ -22,8 +22,8 @@ Texture2D g_txParameters:register(t5);
float4 main(VSO_PP IN):COLOR0
{
float4 vNormal = g_txNormals.Sample(g_sSampler,IN.vTexUV);
float2 vLayerType = LayerDecode(vNormal.w);
// float4 vNormal = g_txNormals.Sample(g_sSampler,IN.vTexUV);
// float2 vLayerType = LayerDecode(vNormal.w);
//vLayerType.x *= LAYERS_COUNT_MAX;
//return float4(vLayerType.x, vLayerType.x, vLayerType.x, 1);
//float fSort = LayerDecodeType(vNormal.w);
......@@ -33,7 +33,7 @@ float4 main(VSO_PP IN):COLOR0
float4 vColor = g_txColor.Sample(g_sSampler,IN.vTexUV);
vColor.rgb = pow(vColor.rgb, 2.2);
float4 vColorOriginal = vColor;
float4 vParameters = g_txParameters.Sample(g_sSampler,IN.vTexUV);
// float4 vParameters = g_txParameters.Sample(g_sSampler,IN.vTexUV);
float4 vAmbient = g_txAmbient.Sample(g_sSampler,IN.vTexUV);
// vAmbient += 0.1;
......@@ -65,5 +65,5 @@ float4 main(VSO_PP IN):COLOR0
vColor.rgb /= (fAdaptedLum + vColor.rgb);
//приводим цвет к линейному пространству
return float4(pow(lerp(vColor.rgb, vColorOriginal.xyz, vColorOriginal.a), 1.0/2.2), 1.0f);
return(float4(pow(lerp(vColorOriginal.xyz, vColor.rgb, vColorOriginal.a), 1.0/2.2), 1.0f));
}
......@@ -4,23 +4,23 @@ lighting_bound.vs
Шейдер для отрисовки объемов света
*/
#include <../struct.h>
#include <struct.h>
//##########################################################################
half4x4 g_mWVP;
// half4x4 g_mWVP;
cbuffer perLight: register(b0)
{
half4x4 g_mW;
float4x4 g_mW;
};
cbuffer perFrame: register(b1)
{
half4x4 g_mVP;
half4x4 g_mViewInv;
half2 g_vNearFar;
half3 g_vParamProj;
float4x4 g_mVP;
float4x4 g_mViewInv;
float2 g_vNearFar;
float3 g_vParamProj;
};
//##########################################################################
......@@ -28,6 +28,6 @@ cbuffer perFrame: register(b1)
VSO_LightBound main(VSI_LightBound IN)
{
VSO_LightBound OUT = (VSO_LightBound)0;
OUT.vPosition = mul(half4(IN.vPosition, 1), mul(g_mW, g_mVP));
OUT.vPosition = mul(float4(IN.vPosition, 1.0), mul(g_mW, g_mVP));
return(OUT);
}
#include <struct.h>
//##########################################################################
float4 main(VSO_LightBound IN):COLOR0
{
return(float4(0.0, 1.0, 0.0, 0.5));
}
......@@ -18,20 +18,21 @@ PSO_RSMbuffer main(PSI_XMaterial IN)
// ClipFar(IN.vPos.z, g_vNearFarLayers.y);
IN.vNormal = normalize(IN.vNormal);
XMaterial mtrl = XMATERIAL_MAIN(IN);
PSO_RSMbuffer OUT;
#ifdef IS_CUBEMAP
// IN.vPos /= IN.vPos.w;
OUT.vDepth = dot(IN.vPos.xyz, IN.vPos.xyz);
// OUT.vDepth = 4.0;
#else
float fDepth = IN.vPos.z / IN.vPos.w;
float fBias = ShadowSlopeBias(fDepth);
OUT.vDepth = fDepth/* + fBias */;
#endif
XMaterial mtrl = XMATERIAL_MAIN(IN);
#ifdef ENABLE_RSM
OUT.vNormal = float4(NormalEncode(normalize(mtrl.vNormal)), 1.0);
OUT.vFlux = mtrl.vBaseColor;
#endif
return(OUT);
}
......@@ -4,16 +4,16 @@ pp_res_pos.vs
Восстановление позиции по глубине
*/
#include <../struct.h>
#include <struct.h>
//##########################################################################
cbuffer perFrame: register(b1)
{
half4x4 g_mVP;
half4x4 g_mViewInv;
half4 g_vNearFar;
half3 g_vParamProj;
float4x4 g_mVP;
float4x4 g_mViewInv;
float4 g_vNearFar;
float3 g_vParamProj;
};
//##########################################################################
......@@ -21,16 +21,16 @@ cbuffer perFrame: register(b1)
VSO_ResPos main(VSI_PP IN)
{
VSO_ResPos OUT;
OUT.vPosition = half4(IN.vPosition, 1.0);
OUT.vPosition = float4(IN.vPosition, 1.0);
OUT.vTexUV = IN.vTexUV.xy;
half fTanHalfFOV = tan(g_vParamProj.z * 0.5) ;
half aspectRatio = g_vParamProj.x / g_vParamProj.y;
half fFarY = fTanHalfFOV * g_vNearFar.y;
half fFarX = fFarY * aspectRatio;
float fTanHalfFOV = tan(g_vParamProj.z * 0.5) ;
float aspectRatio = g_vParamProj.x / g_vParamProj.y;
float fFarY = fTanHalfFOV * g_vNearFar.y;
float fFarX = fFarY * aspectRatio;
OUT.vEyeRay = half3(sign(OUT.vPosition.x) * fFarX, sign(OUT.vPosition.y) * fFarY, g_vNearFar.y);
OUT.vWorldRay = mul(half4(OUT.vEyeRay, 0.0), g_mViewInv).xyz;
OUT.vEyeRay = float3(sign(OUT.vPosition.x) * fFarX, sign(OUT.vPosition.y) * fFarY, g_vNearFar.y);
OUT.vWorldRay = mul(float4(OUT.vEyeRay, 0.0), g_mViewInv).xyz;
return OUT;
}
\ No newline at end of file
......@@ -4,33 +4,33 @@ ppgensm_direct.ps
Генерация теней для локального направленного света
*/
#include "../struct.h"
#include "../shadow.h"
#include "../mtrl.h"
#include "../ps.h"
#include <struct.h>
#include <shadow.h>
#include <mtrl.h>
#include <ps.h>
//##########################################################################
cbuffer perFrame: register(b1)
{
half3 g_vPosCam;
float3 g_vPosCam;
};
cbuffer perShadow: register(b6)
{
half4x4 g_mMatrixTexture;
float4x4 g_mMatrixTexture;
// half4 g_vPixelSize;
// half3 g_vSizeMapBias;
half3 vPixelMapSizeBias;
float3 vPixelMapSizeBias;
};
cbuffer perLight: register(b0)
{
half4 g_vLightColorPower;
half4 g_vLightPosShadow;
float4 g_vLightColorPower;
float4 g_vLightPosShadow;
#ifdef IS_SPOT
half4 g_vLightSpotDirection;
half2 g_vLightSpotInnerOuterAngles;
float4 g_vLightSpotDirection;
float2 g_vLightSpotInnerOuterAngles;
#endif
};
......@@ -50,7 +50,7 @@ Texture2D g_txNormals: register(t3);
//##########################################################################
half4 main(VSO_ResPos IN):COLOR0
float4 main(VSO_ResPos IN):COLOR0
{
float fShadow = 0.0f;
half3 vNormal = normalize(NormalDecode(g_txNormals.Sample(g_sPointClamp, IN.vTexUV).xyz).xyz);
......@@ -69,7 +69,7 @@ half4 main(VSO_ResPos IN):COLOR0
float cosTheta = saturate(dot(vNormal, normalize(g_vLightPosShadow.xyz - vPixelPos.xyz)));
// float fBias = clamp(vPixelMapSizeBias.z * tan(acos(cosTheta)), 0,0.01) / vTexCoord.w;
// float fBias = clamp(0.001f * tan(acos(cosTheta)), 0,0.001f) / vTexCoord.w;
float fBias = clamp(0.0001f * tan(acos(cosTheta)), 0.0001,0.001f) / vTexCoord.w;
float fBias = clamp(0.0001f / (vPixelMapSizeBias.x * 0.0009765625) * tan(acos(cosTheta)), 0.0001,0.001f) / vTexCoord.w;
// float fBias = 0.001f / vTexCoord.w;
// #undef GSD_9
......@@ -113,4 +113,5 @@ half4 main(VSO_ResPos IN):COLOR0
// #endif
return saturate(fShadow);
// return float4(vNormal, 1);
}
\ No newline at end of file
......@@ -13,21 +13,21 @@ ppgensm_point.ps
cbuffer perFrame: register(b1)
{
half3 g_vPosCam;
float3 g_vPosCam;
};
cbuffer perShadow: register(b6)
{
half2 g_vPixelSizeBias;
float2 g_vPixelSizeBias;
};
cbuffer perLight: register(b0)
{
half4 g_vLightColorPower;
half4 g_vLightPosShadow;
float4 g_vLightColorPower;
float4 g_vLightPosShadow;
#ifdef IS_SPOT
half4 g_vLightSpotDirection;
half2 g_vLightSpotInnerOuterAngles;
float4 g_vLightSpotDirection;
float2 g_vLightSpotInnerOuterAngles;
#endif
};
......@@ -49,30 +49,35 @@ Texture2D g_txNormals: register(t3);
//##########################################################################
half4 main(VSO_ResPos IN):COLOR0
float4 main(VSO_ResPos IN):COLOR0
{
half fShadow = 0.0;
float fShadow = 0.0;
//g_vPixelSizeBias.y = -0.05;
// half fDepth = tex2Dlod2(g_sDepthView, IN.vTexUV, 0).r;
half fDepth = g_txDepthView.Sample(g_sPointClamp, IN.vTexUV).r;
half3 vNormal = normalize(NormalDecode(g_txNormals.Sample(g_sPointClamp, IN.vTexUV).xyz).xyz);
float fDepth = g_txDepthView.Sample(g_sPointClamp, IN.vTexUV).r;
float3 vNormal = normalize(NormalDecode(g_txNormals.Sample(g_sPointClamp, IN.vTexUV).xyz).xyz);
// return(1);
half4 vPosition = half4(g_vPosCam + IN.vWorldRay * fDepth, 1.0);
float4 vPosition = float4(g_vPosCam + IN.vWorldRay * fDepth, 1.0);
half3 vDir = vPosition.xyz - g_vLightPosShadow.xyz;
half fDistance = dot(vDir, vDir);
float3 vDir = vPosition.xyz - g_vLightPosShadow.xyz;
float fDistance = dot(vDir, vDir);
// return(fDistance);
// half fDistance = length(vDir);
// half fDivDist = 1.0/fDistance;
vDir = normalize(vDir);
half3 vTexUV = vDir;
float3 vTexUV = vDir;
float cosTheta = saturate(dot(vNormal, -vDir));
float fBias = clamp(0.2f * tan(acos(cosTheta)), 0.1f,0.4f);
// / (g_vPixelSizeBias.x * 0.0009765625 / 8.0)
// float fBias = clamp(0.2f / (g_vPixelSizeBias.x * 0.0009765625 * 4) * tan(acos(cosTheta)), 0.1f,0.4f / (g_vPixelSizeBias.x * 0.0009765625 * 4));
// float fBias = clamp(0.2f * tan(acos(cosTheta)), 0.1f, 0.4f);
float fBias = 0.0;
// float fBias = clamp(0.2f / (g_vPixelSizeBias.x * 0.0009765625 / 2.0) * tan(acos(cosTheta)), 0.1f,2.0f);
float fCompareTo = fDistance - fBias;
// float fCompareTo = fDistance - 0.2;
......@@ -88,7 +93,7 @@ half4 main(VSO_ResPos IN):COLOR0
{
for(int z=0;z<=1;++z)
{
vTexUV = vDir + half3(fOffset * x, fOffset * y, fOffset * z);
vTexUV = vDir + float3(fOffset * x, fOffset * y, fOffset * z);
fShadow += g_txDepthShadow.SampleCmpLevelZero(g_sComparisonLinearClamp, vTexUV, fCompareTo);
}
}
......
......@@ -27,16 +27,16 @@ cbuffer perLight: register(b1)
struct XVSO_SceneCommon
{
float4 vPosition :POSITION0;
float4 vPos :TEXCOORD2;
//float4 vPosition :POSITION0;
XMAT_GS_STRUCT();
//float4 vPos :TEXCOORD2;
};
struct XGSO_SceneShadows
{
float4 vPosition :POSITION0;
float4 vPos :TEXCOORD2;
//float4 vPosition :POSITION0;
XMAT_GS_STRUCT();
//float4 vPos :TEXCOORD2;
uint uRTIndex :SV_RenderTargetArrayIndex;
};
......@@ -55,11 +55,11 @@ void main(triangle XVSO_SceneCommon input[3], inout TriangleStream<XGSO_SceneSha
[unroll]
for(int v = 0; v < 3; ++v)
{
XMAT_GS_PASS(OUT, input[v]);
OUT.vPosition = mul(float4(input[v].vPosition.xyz, 1.f), g_mVP[f]);
OUT.vPos = float4(g_vLightPosShadow.xyz - input[v].vPosition.xyz, 1.0);
XMAT_GS_PASS(OUT, input[v]);
OutputStream.Append(OUT);
}
OutputStream.RestartStrip();
......
/*
terrax_colored.vs
*/
#include "../struct.h"
//##########################################################################
cbuffer perCamera: register(b2)
{
float4x4 g_mVP[6];
};
cbuffer perLight: register(b1)
{
float4 g_vLightColorPower;
float4 g_vLightPosShadow;
#ifdef IS_SPOT
float4 g_vLightSpotDirection;
float2 g_vLightSpotInnerOuterAngles;
#endif
};
//##########################################################################
[maxvertexcount(18)]
void main(triangle VSO_SceneCommon input[3], inout TriangleStream<GSO_SceneShadows> OutputStream)
{
[unroll]
for(int f = 0; f < 6; ++f)
{
GSO_SceneShadows OUT;
OUT.uRTIndex = f;
[unroll]
for(int v = 0; v < 3; ++v)
{
OUT.VSO.vPosition = mul(float4(input[v].vPosition.xyz, 1.f), g_mVP[f]);
OUT.VSO.vNormal = input[v].vNormal;
OUT.VSO.vTexUV = input[v].vTexUV;
// OUT.VSO.vPos = OUT.VSO.vPosition;
OUT.VSO.vPos = float4(g_vLightPosShadow.xyz - input[v].vPosition.xyz, 1.0);
// OUT.VSO.vPos = float4(float3(-0.13445021, -0.55678467, -0.0801237256), 1.0);
// OUT.VSO.vPos = float4(float3(-4.89091921, 2.32815933, -0.0218197256) - float3(-4.756469, 2.884944, 0.058304), 1.0);
OutputStream.Append(OUT);
}
OutputStream.RestartStrip();
}
}
/*
sm_depth_geom_pssm_direct.ps
Рендер глубины сцены (геометрии) с позиции позиции направленного/глобального источника света
*/
#include "../struct.h"
#include "../shadow.h"
#include "../mtrl.h"
//##########################################################################
SamplerState g_sScene: register(s0);
Texture2D g_txColor: register(t0); // basetexture
/* cbuffer perLight: register(b5)
{
float4 g_vLightColorPower;
float4 g_vLightPosShadow;
#ifdef IS_SPOT
float4 g_vLightSpotDirection;
float2 g_vLightSpotInnerOuterAngles;
#endif
}; */
//##########################################################################
PSO_RSMbuffer main(VSO_SceneCommon IN)
{
PSO_RSMbuffer OUT;
float4 vColor = g_txColor.Sample(g_sScene, IN.vTexUV);
ShadowDepthAlphaTest(vColor);
#ifdef IS_CUBEMAP
// OUT.vDepth = dot(float3(-0.13445021, -0.55678467, -0.0801237256), float3(-0.13445021, -0.55678467, -0.0801237256))/* / (g_vLightColorPower.w * g_vLightColorPower.w) */;
OUT.vDepth = dot(IN.vPos.xyz, IN.vPos.xyz)/* / (g_vLightColorPower.w * g_vLightColorPower.w) */;
// OUT.vDepth = 2 * 2/* / (g_vLightColorPower.w * g_vLightColorPower.w) */;
// OUT.vDepth = 0.3345058;
#else
float fDepth = IN.vPos.z / IN.vPos.w;
float fBias = ShadowSlopeBias(fDepth);
OUT.vDepth = fDepth/* + fBias */;
#endif
/* float fAttenuation = 1.0;
#ifdef IS_SPOT
float3 vLigth = normalize(g_vLightPosShadow.xyz - IN.vPos.xyz);
float fNdotD = dot(-vLigth, g_vLightSpotDirection.xyz);
fAttenuation *= saturate(fNdotD - g_vLightSpotInnerOuterAngles.y) / (g_vLightSpotInnerOuterAngles.x - g_vLightSpotInnerOuterAngles.y);
#endif */
OUT.vNormal = float4(NormalEncode(normalize(IN.vNormal)), 1.0);
OUT.vFlux = vColor/* * float4(g_vLightColorPower.xyz, 1.0) * fAttenuation */;
return(OUT);
}
......@@ -149,8 +149,10 @@ struct PSO_Lbuffer
struct PSO_RSMbuffer
{
float4 vDepth :COLOR0;
#ifdef ENABLE_RSM
float4 vNormal :COLOR1;
float4 vFlux :COLOR2;
#endif
};
/*! \name SkyBox
......
......@@ -95,8 +95,10 @@ void CSkyBox::setTexture(const char *szTexture)
assert(m_pMaterialSystem);
assert(szTexture);
IXMaterial *pSky = NULL;
m_pMaterialSystem->loadMaterial(szTexture, &pSky, "Sky");
mem_release(m_pSky1);
m_pMaterialSystem->loadMaterial(szTexture, &m_pSky1, "Sky");
m_pSky1 = pSky;
if(!m_pSky1)
{
......@@ -166,6 +168,7 @@ void CSkyBox::render()
{
return;
}
m_pSky1->AddRef();
float4x4 World = SMMatrixTranspose(m_mMatRotation/* * SMMatrixTranslation(pos->x, pos->y, pos->z)*/);
m_pMaterialSystem->bindVS(m_pVertexShaderHandler);
......@@ -197,6 +200,7 @@ void CSkyBox::render()
pCtx->setPrimitiveTopology(GXPT_TRIANGLELIST);
pCtx->drawIndexed(8, 12, 0, 0);
mem_release(m_pSky1);
//SGCore_ShaderUnBind();
};
......
......@@ -1532,6 +1532,11 @@ void CShaderPreprocessor::reset()
m_sError = "";
}
void CShaderPreprocessor::clearIncludeCache()
{
m_mIncludes.clear();
}
UINT CShaderPreprocessor::getIncludesCount()
{
UINT u = 0;
......
......@@ -56,6 +56,7 @@ public:
UINT getIncludesCount();
void getIncludes(const char **pszIncludes);
void clearIncludeCache();
void reset();
const char* getError();
......
......@@ -430,6 +430,11 @@ static int LoadShader(CShaderPreprocessor *pPreprocessor, IFileSystem *pFileSyst
mem_release(pFile);
}
if(!pGXShader)
{
pPreprocessor->clearIncludeCache();
}
}
while(!pGXShader && MessageBoxA(NULL, "Unable to compile shader. Want to retry?", "Shader error", MB_OKCANCEL | MB_ICONSTOP) == IDOK);
......@@ -527,6 +532,7 @@ void CShaderManager::reloadAll()
mem_delete(m_pPreprocessor);
m_pPreprocessor = new CShaderPreprocessor(Core_GetIXCore()->getFileSystem());
m_pPreprocessor->addIncPath("shaders/");
allLoad(true);
}
......
......@@ -67,11 +67,19 @@ public:
virtual void setShadowDynamic(bool isDynamic) = 0;
//@TODO: Remove this method
virtual void drawShape(IGXContext *pDevice) = 0;
virtual void drawShape(IGXDevice *pDevice) = 0;
//@TODO: Remove this method
virtual IGXConstantBuffer* getConstants(IGXContext *pDevice) = 0;
virtual IGXConstantBuffer* getConstants(IGXDevice *pDevice) = 0;
//@TODO: Remove this method
virtual LIGHT_RENDER_TYPE getRenderType() = 0;
//@TODO: Remove this method
virtual bool isDirty()
{
return(true);
}
//@TODO: Remove this method
virtual void markClean()
{}
virtual IXLightSpot *asSpot() = 0;
virtual IXLightSun *asSun() = 0;
......
......@@ -37,6 +37,7 @@ ID CLights::createCopy(ID id)
{
LIGHTS_PRE_COND_ID(id,-1);
#if 0
CLight* tmplight = m_aLights[id];
CLight* tmplight2 = new CLight();
tmplight2->m_fAngle = tmplight->m_fAngle;
......@@ -62,7 +63,6 @@ ID CLights::createCopy(ID id)
tmplight2->m_typeShadowed = tmplight->m_typeShadowed;
tmplight2->m_iCountUpdate = tmplight->m_iCountUpdate;
#if 0
if (tmplight->m_pShadowPSSM)
{
tmplight2->m_pShadowPSSM = new PSSM();
......@@ -110,12 +110,14 @@ ID CLights::createCopy(ID id)
}
else
tmplight2->m_pShadowCube = 0;
#endif
tmplight2->m_pMesh = tmplight->m_pMesh;
tmplight2->m_pMesh->AddRef();
return addLight(tmplight);
#endif
return(-1);
}
CLights::CLight::CLight()
......@@ -154,7 +156,9 @@ CLights::CLight::CLight()
CLights::CLight::~CLight()
{
mem_release_del(m_pMesh);
#if 0
mem_release_del(m_pBoundVolume);
#endif
//mem_delete(m_pShadowPSSM);
//mem_delete(m_pShadowSM);
......@@ -413,8 +417,10 @@ ID CLights::createPoint(ID id, const float3* center, float dist, const float3* c
tmplight->m_vColor = *color;
tmplight->m_isEnable = true;
#if 0
tmplight->m_pBoundVolume = SGCore_CrBound();
tmplight->m_pBoundVolume->cloneFrom(tmplight->m_pMesh->getBound());
#endif
if (tmplight->m_isGlobal)
m_idGlobalLight = tmpid;
......@@ -479,9 +485,10 @@ ID CLights::createDirection(ID id, const float3* pos, float dist, const float3*
tmplight->m_typeShadowed = LTYPE_SHADOW_DYNAMIC;
else
tmplight->m_typeShadowed = LTYPE_SHADOW_STATIC;
#if 0
tmplight->m_pBoundVolume = SGCore_CrBound();
tmplight->m_pBoundVolume->cloneFrom(tmplight->m_pMesh->getBound());
#endif
ID tmpid = id;
......@@ -501,7 +508,9 @@ void CLights::render(ID id, DWORD timeDelta)
m_aLights[id]->m_isVSDataDirty = false;
}
light_data::pDXDevice->setVertexShaderConstant(m_aLights[id]->m_pVSData);
IGXContext *pCtx = light_data::pDXDevice->getThreadContext();
pCtx->setVSConstant(m_aLights[id]->m_pVSData);
SGCore_ShaderBind(light_data::shader_id::kit::idLightBound);
// light_data::pDXDevice->SetTransform(D3DTS_WORLD, &(m_aLights[id]->m_mWorldMat.operator D3DXMATRIX()));
......@@ -613,10 +622,12 @@ void CLights::setLightDist(ID id, float radius_height, bool is_create)
m_aLights[id]->m_pShadowCube->setNearFar(&float2(LIGHTS_LOCAL_STD_NEAR, m_aLights[id]->m_fDist));
#endif
#if 0
if (m_aLights[id]->m_pMesh)
{
m_aLights[id]->m_pBoundVolume->cloneFrom(m_aLights[id]->m_pMesh->getBound());
}
#endif
lightCountUpdateNull(id);
}
......@@ -769,7 +780,9 @@ bool CLights::comVisibleForFrustum(ID id, const IFrustum* frustum)
float3 tmpcenter;
float tmpradius;
#if 0
m_aLights[id]->m_pBoundVolume->getSphere(&tmpcenter, &tmpradius);
#endif
tmpcenter = SMVector3Transform(tmpcenter, m_aLights[id]->m_mWorldMat);
return frustum->sphereInFrustum(&tmpcenter, tmpradius);
......@@ -1057,11 +1070,12 @@ void CLights::setLightAngle(ID id, float angle, bool is_create)
m_aLights[id]->m_fAngle = angle;
SGCore_FCreateCone(m_aLights[id]->m_vTopBottomRadius.x, m_aLights[id]->m_vTopBottomRadius.y, m_aLights[id]->m_fDist, &m_aLights[id]->m_pMesh, 32);
}
#if 0
if (m_aLights[id]->m_pMesh)
{
m_aLights[id]->m_pBoundVolume->cloneFrom(m_aLights[id]->m_pMesh->getBound());
}
#endif
#if 0
if (m_aLights[id]->m_typeLight == LTYPE_LIGHT_DIR && m_aLights[id]->m_pShadowSM)
......@@ -1082,10 +1096,12 @@ void CLights::setLightTopRadius(ID id, float top_radius)
SGCore_FCreateCone(top_radius, m_aLights[id]->m_vTopBottomRadius.y, m_aLights[id]->m_fDist, &m_aLights[id]->m_pMesh,