Commit 6adfcfac authored by D-AIRY's avatar D-AIRY

Merge branch 'dev' of https://dev.ds-servers.com/sip/engine into dev

parents f5bb8a6e 4c62a310
......@@ -96,7 +96,7 @@ static const half g_fUnit256 = 1.0/255.0;
//##########################################################################
//! значение для альфа теста растительности
#define GREEN_ALPHATEST_VALUE 0.5
#define GREEN_ALPHATEST_VALUE 0.7
//! значение альфа теста при построении глубины, нужно учитывать что растительность будет отсекаться именно по этому значению, а не по #GREEN_ALPHATEST_VALUE
#define SHADOW_DEPTH_ALPHATEST_VALUE 0.5
......
......@@ -25,7 +25,8 @@ half4 main(VSO_PP IN):COLOR0
half fLayer = NormalDecodeLayer(vNormal.xyz);
//цвет приводим к sRGB
half4 vColor = pow(tex2D(g_sColor,IN.vTexUV), 2.2);
half4 vColor = tex2D(g_sColor,IN.vTexUV);
vColor.rgb = pow(vColor.rgb, 2.2);
half4 vParameters = tex2D(g_sParameters,IN.vTexUV);
half4 vAmbient = tex2D(g_sAmbient,IN.vTexUV);
......@@ -33,7 +34,7 @@ half4 main(VSO_PP IN):COLOR0
/* расчет фонового цвета
1) интерполяция от чернобелого до цветного, на основании затенения, то есть чем больше тень тем меньше там фонового цвета
*/
half3 vAmbientColor = lerp((vAmbient.x + vAmbient.y + vAmbient.z)/3.0, vAmbient.xyz, vAmbient.w*2);
half3 vAmbientColor = lerp((vAmbient.x + vAmbient.y + vAmbient.z)/3.0, vAmbient.xyz, saturate(vAmbient.w+0.5));
/* 2) интерполяция приема цвета материалом, чем больше отражательная способность (f0) тем меньше примет цвета материал*/
vAmbientColor = lerp(vAmbientColor.xyz, 1.0, clamp(vParameters.y, F0_MIN_4_DEST_AMBIENT, vParameters.y));
......@@ -54,5 +55,5 @@ half4 main(VSO_PP IN):COLOR0
vColor.rgb /= (fAdaptedLum + vColor.rgb);
//приводим цвет к линейному пространству
return pow(vColor, 1.0/2.2);
return half4(pow(vColor.rgb, 1.0/2.2), vColor.a);
}
\ No newline at end of file
......@@ -10,7 +10,7 @@ lighting_blend.ps
//##########################################################################
half4 g_vLightPos;
half2 g_vLightPowerDist;
half3 g_vLightPowerDistShadow;
half4 g_vViewPos;
half4 g_vLightColor;
......@@ -84,7 +84,7 @@ PSO_Lbuffer main(VSO_ResPos IN)
half4 vPosition = half4(g_vViewPos.xyz + IN.vWorldRay * fDepth, 1.0);
half fDistance = distance(vPosition.xyz, g_vLightPos.xyz);
half fInvDistance = 1.f - (fDistance/g_vLightPowerDist.y);
half fInvDistance = 1.f - (fDistance/g_vLightPowerDistShadow.y);
[branch]if(fInvDistance < 0.0)
fInvDistance = 0.0;
......@@ -128,10 +128,12 @@ PSO_Lbuffer main(VSO_ResPos IN)
fDiffuse *= max(fShadow, lerp(0.01, 0.09, g_vLightColor.w));
#endif
OUT.vAmdient.xyz = g_vLightColor.xyz * g_vLightColor.xyz * g_vLightPowerDist.x * fAttenuation;
OUT.vAmdient.w = fDiffuse * fMdiffuse * vParam.w * g_vLightPowerDist.x * 2.0 * fAttenuation;
fDiffuse = lerp(fDiffuse, 1.0, g_vLightPowerDistShadow.z);
OUT.vSpecular = fSpecular * fAbsDiffuse * fAttenuation * g_vLightPowerDist.x;
OUT.vAmdient.xyz = g_vLightColor.xyz * g_vLightColor.xyz * g_vLightPowerDistShadow.x * fAttenuation;
OUT.vAmdient.w = fDiffuse * fMdiffuse * vParam.w * g_vLightPowerDistShadow.x * 2.0 * fAttenuation;
OUT.vSpecular = fSpecular * fAbsDiffuse * fAttenuation * g_vLightPowerDistShadow.x;
return OUT;
}
\ No newline at end of file
......@@ -71,10 +71,10 @@ PSO_UnionAlpha main(VSO_PP IN):COLOR0
aIdLayer[2] = int(NormalDecodeLayer(aNormal[2].xyz) * LAYERS_COUNT_MAX);
aIdLayer[3] = int(NormalDecodeLayer(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;
aIsTransparency[2] = aNormal[2].w >= MTLTYPE_LAYER_TRANSPARENT_UNLIT ? 1 : 0;
aIsTransparency[3] = aNormal[3].w >= MTLTYPE_LAYER_TRANSPARENT_UNLIT ? 1 : 0;
aIsTransparency[0] = (aNormal[0].w >= MTLTYPE_LAYER_TRANSPARENT_UNLIT) ? 1 : 0;
aIsTransparency[1] = (aNormal[1].w >= MTLTYPE_LAYER_TRANSPARENT_UNLIT) ? 1 : 0;
aIsTransparency[2] = (aNormal[2].w >= MTLTYPE_LAYER_TRANSPARENT_UNLIT) ? 1 : 0;
aIsTransparency[3] = (aNormal[3].w >= MTLTYPE_LAYER_TRANSPARENT_UNLIT) ? 1 : 0;
//в случае если у нас нет ппрозрачных слоев то возвращаем текущий цвет
[branch] if((aIsTransparency[0] == 0 && aIsTransparency[1] == 0 && aIsTransparency[2] == 0 && aIsTransparency[3] == 0))
......@@ -124,7 +124,7 @@ PSO_UnionAlpha main(VSO_PP IN):COLOR0
{
fAlpha2 = aColor[aSort2[2]].a;
vCountColor = aColor[aSort2[2]] * fAlpha2 + vCountColor * (1.f - fAlpha2);
vCountColor.a = max(fAlpha2,fAlpha);
vCountColor.a = max(fAlpha2,fAlpha) * 1.1;
fAlpha = vCountColor.a;
g_aExistsIDs[1] = aIdLayer[aSort2[2]];
}
......@@ -133,7 +133,7 @@ PSO_UnionAlpha main(VSO_PP IN):COLOR0
{
fAlpha2 = aColor[aSort2[1]].a;
vCountColor = aColor[aSort2[1]] * fAlpha2 + vCountColor.rgba * (1.f - fAlpha2);
vCountColor.a = max(fAlpha2,fAlpha);
vCountColor.a = max(fAlpha2,fAlpha) * 1.1;
fAlpha = vCountColor.a;
g_aExistsIDs[2] = aIdLayer[aSort2[1]];
}
......@@ -142,7 +142,7 @@ PSO_UnionAlpha main(VSO_PP IN):COLOR0
{
fAlpha2 = aColor[aSort2[0]].a;
vCountColor = aColor[aSort2[0]] * fAlpha2 + vCountColor * (1.f - fAlpha2);
vCountColor.a = max(fAlpha2,fAlpha);
vCountColor.a = max(fAlpha2,fAlpha) * 1.1;
}
OUT.vColor = vCountColor;
......@@ -150,8 +150,8 @@ PSO_UnionAlpha main(VSO_PP IN):COLOR0
OUT.vDepth1 = aDepth[aSort2[0]];
//если есть хотя бы один не прозрачный материал
[branch] if(!aIsTransparency[0] || !aIsTransparency[1] || !aIsTransparency[2] || !aIsTransparency[3])
OUT.vColor.a = 1;
/*[branch] if((!aIsTransparency[0] && aDepth[0] > 0.0) || (!aIsTransparency[1] && aDepth[1] > 0.0) || (!aIsTransparency[2] && aDepth[2] > 0.0) || (!aIsTransparency[3] && aDepth[3] > 0.0))
OUT.vColor.a = 1;*/
//если хотя бы один слой полупрозрачный
[branch] if(aIsTransparency[0] || aIsTransparency[1] || aIsTransparency[2] || aIsTransparency[3])
......
......@@ -27,7 +27,7 @@ samplerCUBE g_sDepthShadow:register(s1);
half4 main(VSO_ResPos IN):COLOR0
{
half fShadow = 0.0;
//g_vSizeMapBias.y = -0.05;
half fDepth = tex2Dlod2(g_sDepthView, IN.vTexUV, 0).r;
half4 vPosition = half4(g_vPosCam + IN.vWorldRay * fDepth, 1.0);
......@@ -36,6 +36,7 @@ half4 main(VSO_ResPos IN):COLOR0
half fDistance = length(vDir);
half fDivDist = 1.0/fDistance;
//vDir = normalize(vDir);
half3 vTexUV = vDir.xyz;
//fShadow = (texCUBE(g_sDepthShadow , -(vTexUV) * fDivDist ).x + g_vSizeMapBias.y) > fDistance ? 1 : 0;
......
......@@ -12,10 +12,8 @@
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\..\source\common\string.cpp" />
<ClCompile Include="..\..\..\source\geom\static_geom.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\..\source\common\string_utils.cpp" />
<ClCompile Include="..\..\..\source\geom\models.cpp" />
<ClCompile Include="..\..\..\source\geom\sxgeom.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</ExcludedFromBuild>
......@@ -24,7 +22,8 @@
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\..\source\common\string.h" />
<ClInclude Include="..\..\..\source\geom\static_geom.h" />
<ClInclude Include="..\..\..\source\common\string_utils.h" />
<ClInclude Include="..\..\..\source\geom\models.h" />
<ClInclude Include="..\..\..\source\geom\sxgeom.h" />
</ItemGroup>
<PropertyGroup Label="Globals">
......
......@@ -2,15 +2,18 @@
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<ClCompile Include="..\..\..\source\geom\sxgeom_dll.cpp" />
<ClCompile Include="..\..\..\source\geom\static_geom.cpp">
<Filter>Source</Filter>
</ClCompile>
<ClCompile Include="..\..\..\source\geom\sxgeom.cpp">
<Filter>Source</Filter>
</ClCompile>
<ClCompile Include="..\..\..\source\common\string.cpp">
<Filter>Source</Filter>
</ClCompile>
<ClCompile Include="..\..\..\source\geom\models.cpp">
<Filter>Source</Filter>
</ClCompile>
<ClCompile Include="..\..\..\source\common\string_utils.cpp">
<Filter>Source</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<Filter Include="Source">
......@@ -21,14 +24,17 @@
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\..\source\geom\static_geom.h">
<Filter>Header</Filter>
</ClInclude>
<ClInclude Include="..\..\..\source\geom\sxgeom.h">
<Filter>Header</Filter>
</ClInclude>
<ClInclude Include="..\..\..\source\common\string.h">
<Filter>Header</Filter>
</ClInclude>
<ClInclude Include="..\..\..\source\geom\models.h">
<Filter>Header</Filter>
</ClInclude>
<ClInclude Include="..\..\..\source\common\string_utils.h">
<Filter>Header</Filter>
</ClInclude>
</ItemGroup>
</Project>
\ No newline at end of file
......@@ -113,6 +113,7 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\..\source\sxmaterialeditor\models.cpp" />
<ClCompile Include="..\..\..\source\sxmaterialeditor\paraml_kit.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</ExcludedFromBuild>
</ClCompile>
......@@ -142,6 +143,7 @@
<ClInclude Include="..\..\..\source\sxmaterialeditor\common_callback.h" />
<ClInclude Include="..\..\..\source\sxmaterialeditor\edits_callback.h" />
<ClInclude Include="..\..\..\source\sxmaterialeditor\material_editor.h" />
<ClInclude Include="..\..\..\source\sxmaterialeditor\models.h" />
<ClInclude Include="..\..\..\source\sxmaterialeditor\paraml_kit.h" />
<ClInclude Include="..\..\..\source\sxmaterialeditor\resource.h" />
<ClInclude Include="..\..\..\source\sxmaterialeditor\shaders_kit.h" />
......
......@@ -51,6 +51,9 @@
<ClCompile Include="..\..\..\source\common\string_utils.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\..\source\sxmaterialeditor\models.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="..\..\..\source\sxmaterialeditor\SXMaterialEditor.rc">
......@@ -103,6 +106,9 @@
<ClInclude Include="..\..\..\source\common\string_utils.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\..\source\sxmaterialeditor\models.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<Image Include="resource\save.bmp">
......
/***********************************************************
Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018
Copyright Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018
See the license in LICENSE
***********************************************************/
......@@ -72,14 +72,45 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLin
SSCore_SndInstancePlay2d(tmpidsnd);
//SSCore_SndInstancePlay2d(tmpidsnd);*/
SLevel_AmbientSndPlay();
SLevel_WeatherSndPlay();
//SGeom_ModelsAddModel("tt.dse", "tt.dse", 0, false);
/*SGeom_ModelsAddModel("stalker_atp.dse", "stalker_atp.dse", "stalker_atp.dse", "stalker_atp.dse", true);
SGeom_ModelsMsetScale(0, &float3(0.1, 0.1, 0.1));
SGeom_ModelsMsetRotation(0, &float3(0, 1, 0));
SGeom_ModelsMsetPosition(0, &float3(10, -11, 10));
ID idModel = SGeom_ModelsCopy(0);
SGeom_ModelsMsetScale(idModel, &float3(0.1, 0.1, 0.1));
SGeom_ModelsMsetRotation(idModel, &float3(0, 1, 0));
SGeom_ModelsMsetPosition(idModel, &float3(50, 11, 50));
//SGeom_ModelsReComBound(0);
ID idGlobal = SLight_CreatePoint(
&float3(60, 60, 0),
0,
&float3(1, 1, 1),
true,
true);
//SGeom_ModelsDelModel(0);
SXPhysics_LoadGeom();
//SXGame_OnLevelLoad("stalker_atp");
Core_0ConsoleExecCmd("ent_load_level \"%s\" \"%s\"", "D:\\project\\engine\\build\\gamesource\\levels\\stalker_atp\\stalker_atp.ent", "stalker_atp");
SLevel_Save("new_test");
SLight_SetEnable(idGlobal, true);
//SLevel_Load("new_test", false);*/
SGCore_ShaderAllLoad();
SGCore_LoadTexAllLoad();
SetWindowPos(SGCore_GetHWND(), HWND_TOP, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE);
SLevel_AmbientSndPlay();
SLevel_WeatherSndPlay();
int result = SkyXEngine_CycleMain();
SkyXEngine_Kill();
return result;
......
common @ b4c0ba21
Subproject commit 3906bd53a1ae5cd132120ef680fd16c106b6fa7e
Subproject commit b4c0ba21be293cf576b0b2d0d90ded3bf5acc3a8
......@@ -121,7 +121,7 @@ void CBaseTool::primaryAction(BOOL st)
playAnimation("shoot1");
if(ID_VALID(m_iMuzzleFlash))
{
SPE_EffectEnableSet(m_iMuzzleFlash, true);
SPE_EffectSetEnable(m_iMuzzleFlash, true);
}
if(ID_VALID(m_iSoundAction1))
{
......@@ -224,9 +224,9 @@ void CBaseTool::onSync()
{
//SPE_EffectPlayByID
float3 pos = m_pAnimPlayer->getBoneTransformPos(m_pAnimPlayer->getBone("muzzle_rifle1"));
SPE_EffectPosSet(m_iMuzzleFlash, &pos);
SPE_EffectSetPos(m_iMuzzleFlash, &pos);
//pos = m_vOrientation * float3(0, 0, 1);
SPE_EffectRotSetQ(m_iMuzzleFlash, m_vOrientation);
SPE_EffectSetRotQ(m_iMuzzleFlash, m_vOrientation);
}
}
......
......@@ -466,7 +466,7 @@ void CBaseWeapon::taskShoot(float dt)
playAnimation("shoot1");
if(ID_VALID(m_iMuzzleFlash))
{
SPE_EffectEnableSet(m_iMuzzleFlash, true);
SPE_EffectSetEnable(m_iMuzzleFlash, true);
}
if(ID_VALID(m_idSndShoot))
{
......
......@@ -63,7 +63,7 @@ void CHUDcontroller::loadMap(const char *szName)
{
// /hud/levels/stalker_atp.png
float3 vMin, vMax;
SGeom_ModelsGetMinMax(&vMin, &vMax);
SGeom_GetMinMax(&vMin, &vMax);
m_vLevelMin = vMin;
m_vLevelMax = vMax;
......
......@@ -19,6 +19,8 @@ BEGIN_PROPTABLE(CLightDirectional)
DEFINE_FIELD_FLOAT(m_fDist, 0, "dist", "Distance", EDITOR_TEXTFIELD)
//! Дальность дальняя
DEFINE_FIELD_FLOAT(m_fShadowDist, 0, "shadow_dist", "Shadow distance", EDITOR_TEXTFIELD)
//! Коэффициент теней - на сколько тень черная
DEFINE_FIELD_FLOAT(m_fShadowCoef, 0, "shadow_coef", "Shadow coefficient", EDITOR_TEXTFIELD)
//! Тип тени
DEFINE_FIELD_INT(m_iShadowType, 0, "shadow_type", "Shadow type", EDITOR_COMBOBOX)
......@@ -44,6 +46,7 @@ BaseClass(pMgr)
m_fDist = 10;
m_fShadowDist = m_fDist;
m_iShadowType = 1;
m_fShadowCoef = 0;
m_fAngle = SM_PI * 0.4f;
m_fRadiusTop = 0.01f;
m_idLight = SLight_CreateDirection(&float3(0, 0, 0), m_fDist, &(float3)m_vColor, &SMQuaternion(-SM_PI, 'z'), m_fRadiusTop, m_fAngle, true);
......@@ -93,6 +96,7 @@ void CLightDirectional::onSync()
if (SLight_GetTypeShadowed(m_idLight) != m_iShadowType)
SLight_SetTypeShadowed(m_idLight, (LTYPE_SHADOW)m_iShadowType);
SLight_SetShadowCoef(m_idLight, m_fShadowCoef);
static SMQuaternion curr_rot;
SLight_GetOrient(m_idLight, &curr_rot);
......
......@@ -39,6 +39,9 @@ public:
void setShadowType(int iShadowType) { m_iShadowType = iShadowType; };
int getShadowType() const { return m_iShadowType; };
void setShadowCoef(float fShadowCoef) { m_fShadowCoef = fShadowCoef; };
float getShadowCoef() const { return m_fShadowCoef; };
void setEnable(bool isEnable) { m_isEnable = isEnable; };
bool getEnable() const { return m_isEnable; };
......@@ -58,6 +61,7 @@ protected:
float m_fDist;
float m_fShadowDist;
int m_iShadowType;
float m_fShadowCoef;
bool m_isEnable;
......
......@@ -19,6 +19,8 @@ BEGIN_PROPTABLE(CLightPoint)
DEFINE_FIELD_FLOAT(m_fDist, 0, "dist", "Distance", EDITOR_TEXTFIELD)
//! Дальность дальняя
DEFINE_FIELD_FLOAT(m_fShadowDist, 0, "light_far", "Shadow far plane", EDITOR_TEXTFIELD)
//! Коэффициент теней - на сколько тень черная
DEFINE_FIELD_FLOAT(m_fShadowCoef, 0, "shadow_coef", "Shadow coefficient", EDITOR_TEXTFIELD)
//! Тип тени
DEFINE_FIELD_INT(m_iShadowType, 0, "type_shadow", "Type shadow", EDITOR_COMBOBOX)
......@@ -50,6 +52,7 @@ BaseClass(pMgr)
m_fDist = 10;
m_fShadowDist = m_fDist;
m_iShadowType = 1;
m_fShadowCoef = 0;
m_idLight = SLight_CreatePoint(&float3(0, 0, 0), m_fDist, &(float3)m_vColor, false, true);
}
......@@ -85,6 +88,8 @@ void CLightPoint::onSync()
m_fShadowDist = m_fDist;
}
SLight_SetShadowCoef(m_idLight, m_fShadowCoef);
if (SLight_GetShadowLocalFar(m_idLight) != m_fShadowDist)
SLight_SetShadowLocalFar(m_idLight, m_fShadowDist);
......
......@@ -38,6 +38,9 @@ public:
void setShadowDist(float fShadowDist) { m_fShadowDist = fShadowDist; };
float getShadowDist() const { return m_fShadowDist; };
void setShadowCoef(float fShadowCoef) { m_fShadowCoef = fShadowCoef; };
float getShadowCoef() const { return m_fShadowCoef; };
void setShadowType(int iShadowType) { m_iShadowType = iShadowType; };
int getShadowType() const { return m_iShadowType; };
......@@ -54,6 +57,7 @@ protected:
float m_fShadowDist;
int m_iShadowType;
bool m_isEnable;
float m_fShadowCoef;
void onSync();
......
......@@ -17,7 +17,10 @@ See the license in LICENSE
#ifndef __MODEL_FILE_H
#define __MODEL_FILE_H
#define SX_MODEL_VERSION_OLD 6 /*!< Старая версия файла модели (для совместимости) */
/*! Старая версия формата
\todo убрать поддержку старой версии формата моделей
*/
#define SX_MODEL_VERSION_OLD 6
#define SX_MODEL_VERSION 7 /*!< Актуальная версия файла модели */
#define SX_MODEL_MAGICK 30510779525321540 /*!< Магическая константа для определения файла */
......@@ -43,6 +46,11 @@ struct vertex_static: public model_vertex
*/
struct vertex_static_ex: public model_vertex
{
vertex_static_ex(){}
vertex_static_ex(float3_t vPos, float2_t vTex, float3_t vNormal, float3_t vTangent, float3_t vBinormal)
{
Pos = vPos; Tex = vTex; Norm = vNormal; Tangent = vTangent; Binorm = vBinormal;
}
float3_t Pos; /*!< Позиция */
float2_t Tex; /*!< Текстурные координаты */
float3_t Norm; /*!< Нормаль */
......
This diff is collapsed.
......@@ -37,16 +37,32 @@ void CreateBoundingBoxMesh(const float3* min, const float3* max, ID3DXMesh** bbm
//
// // CalculateWorld
struct CSXTransObject : public virtual ISXTransObject
class CTransObject : public virtual ITransObject
{
CSXTransObject(){};
~CSXTransObject(){};
public:
CTransObject();
~CTransObject(){};
void Release(){ mem_del(this); };
SX_ALIGNED_OP_MEM
float4x4* calcWorld();
const float4x4* calcWorld();
void setPosition(const float3 *pPos);
void setRotation(const float3 *pRot);
void setScale(const float3 *pScale);
const float3* getPosition(float3 *pPos = 0);
const float3* getRotation(float3 *pRot = 0);
const float3* getScale(float3 *pScale = 0);
protected:
float3 m_vPosition; //!<
float3 m_vRotation; //!<
float3 m_vScale; //!<
float4x4 m_mWorld; //!<
};
#define TRANSFORM_COORD_SCREEN2(point,sizemapdepth)\
......@@ -62,22 +78,25 @@ struct CSXTransObject : public virtual ISXTransObject
// CalculateBound
//SetMinMax, GetMinMax CalculateWorldAndTrans
// Bound Object CalculateWorldAndTrans
class CSXBound : public CSXTransObject, public virtual ISXBound
class CBound : public CTransObject, public virtual ISXBound
{
public:
CSXBound(){};
~CSXBound(){};
CBound() :CTransObject(){};
~CBound(){};
void Release(){ mem_del(this); };
SX_ALIGNED_OP_MEM
void calcBound(IDirect3DVertexBuffer9* vertex_buffer, DWORD count_vert, DWORD bytepervert);
void calcBound(IDirect3DVertexBuffer9 *pVertexBuffer, int iCountVertex, int iBytePerVertex);
void calcBoundIndex(IDirect3DVertexBuffer9 *pVertexBuffer, uint32_t **ppArrIndex, uint32_t *pCountIndex, int iCountSubset, int iBytePerVertex);
//
float4x4* calcWorldAndTrans();
//float4x4* calcWorldAndTrans();
void resetTransform();
void getPosBBScreen(SXPosBBScreen *res, float3* campos, float3* sizemapdepth, float4x4* mat);
//void getPosBBScreen(SXPosBBScreen *res, float3* campos, float3* sizemapdepth, float4x4* mat);
void setMinMax(const float3* min, const float3* max);
void getMinMax(float3* min, float3* max) const;
......@@ -89,11 +108,17 @@ public:
bool isPointInBox(const float3* point) const;
protected:
float3 m_vMin;
float3 m_vMax;
float3 m_vMinTransform;
float3 m_vMaxTransform;
float3 m_vCenterTransform;
float m_fRadiusTransform;
float3 m_vMinOrigin;
float3 m_vMaxOrigin;
float3 m_vCenter;
float m_fRadius;
float3 m_vCenterOrigin;
float m_fRadiusOrigin;
};
#endif
\ No newline at end of file
This diff is collapsed.
......@@ -41,56 +41,54 @@ struct DataStaticModel : public ISXDataStaticModel
ISXDataStaticModel* getCopy()
{
ISXDataStaticModel* nm = new DataStaticModel();
nm->m_ppTextures = new char*[m_uiSubsetCount];
for (DWORD i = 0; i < m_uiSubsetCount; i++)
{
nm->m_ppTextures[i] = new char[strlen(m_ppTextures[i]) + 1];
sprintf(nm->m_ppTextures[i], "%s", m_ppTextures[i]);
}
nm->m_uiSubsetCount = m_uiSubsetCount;
nm->m_pStartIndex = new UINT[m_uiSubsetCount];
memcpy(nm->m_pStartIndex, m_pStartIndex, sizeof(UINT)*m_uiSubsetCount);
nm->m_pIndexCount = new UINT[m_uiSubsetCount];
memcpy(nm->m_pIndexCount, m_pIndexCount, sizeof(UINT)*m_uiSubsetCount);
nm->m_pStartVertex = new UINT[m_uiSubsetCount];
memcpy(nm->m_pStartVertex, m_pStartVertex, sizeof(UINT)*m_uiSubsetCount);
nm->m_pVertexCount = new UINT[m_uiSubsetCount];
memcpy(nm->m_pVertexCount, m_pVertexCount, sizeof(UINT)*m_uiSubsetCount);
DWORD tmpvert = 0;
DWORD tmpind = 0;
for (DWORD i = 0; i < m_uiSubsetCount; i++)
ISXDataStaticModel *pModelCopy = new DataStaticModel();
// !!!!!!!!!!!!!
pModelCopy->m_uiAllVertexCount = m_uiAllVertexCount;
pModelCopy->m_uiAllIndexCount = m_uiAllIndexCount;
pModelCopy->m_vBBMax = m_vBBMax;
pModelCopy->m_vBBMin = m_vBBMin;
pModelCopy->m_vBSphere = m_vBSphere;
pModelCopy->m_ppTextures = new char*[m_uiSubsetCount];
for (int i = 0; i < m_uiSubsetCount; ++i)
{
tmpvert += nm->m_pVertexCount[i];
tmpind += nm->m_pIndexCount[i];
pModelCopy->m_ppTextures[i] = new char[strlen(m_ppTextures[i]) + 1];
sprintf(pModelCopy->m_ppTextures[i], "%s", m_ppTextures[i]);
}
g_pDXDevice->CreateVertexBuffer(sizeof(vertex_static)* tmpvert, NULL, NULL, D3DPOOL_MANAGED, &nm->m_pVertexBuffer, 0);
//nm->ArrVertBuf = new vertex_static[tmpvert];
vertex_static * dstData, *srcData;
nm->m_pVertexBuffer->Lock(0, 0, (void**)&dstData, 0);
m_pVertexBuffer->Lock(0, 0, (void**)&srcData, 0);
pModelCopy->m_uiSubsetCount = m_uiSubsetCount;
pModelCopy->m_pStartIndex = new UINT[m_uiSubsetCount];
memcpy(pModelCopy->m_pStartIndex, m_pStartIndex, sizeof(UINT)*m_uiSubsetCount);
pModelCopy->m_pIndexCount = new UINT[m_uiSubsetCount];
memcpy(pModelCopy->m_pIndexCount, m_pIndexCount, sizeof(UINT)*m_uiSubsetCount);
pModelCopy->m_pStartVertex = new UINT[m_uiSubsetCount];
memcpy(pModelCopy->m_pStartVertex, m_pStartVertex, sizeof(UINT)*m_uiSubsetCount);
pModelCopy->m_pVertexCount = new UINT[m_uiSubsetCount];
memcpy(pModelCopy->m_pVertexCount, m_pVertexCount, sizeof(UINT)*m_uiSubsetCount);
g_pDXDevice->CreateVertexBuffer(sizeof(vertex_static_ex)* m_uiAllVertexCount, NULL, NULL, D3DPOOL_MANAGED, &pModelCopy->m_pVertexBuffer, 0);
BYTE *pDestData, *pSrcData;
pModelCopy->m_pVertexBuffer->Lock(0, 0, (void**)&pDestData, 0);
m_pVertexBuffer->Lock(0, 0, (void**)&pSrcData, 0);
memcpy(dstData, srcData, sizeof(vertex_static)* tmpvert);
//memcpy(nm->ArrVertBuf, srcData, sizeof(vertex_static)* tmpvert);
memcpy(pDestData, pSrcData, sizeof(vertex_static_ex)* m_uiAllVertexCount);
nm->m_pVertexBuffer->Unlock();
pModelCopy->m_pVertexBuffer->Unlock();
m_pVertexBuffer->Unlock();
g_pDXDevice->CreateIndexBuffer(sizeof(UINT)* tmpind, NULL, D3DFMT_INDEX32, D3DPOOL_MANAGED, &nm->m_pIndexBuffer, 0);
//nm->ArrIndBuf = new UINT[tmpind];
nm->m_pIndexBuffer->Lock(0, 0, (void**)&dstData, 0);
m_pIndexBuffer->Lock(0, 0, (void**)&srcData, 0);
g_pDXDevice->CreateIndexBuffer(sizeof(UINT)* m_uiAllIndexCount, NULL, D3DFMT_INDEX32, D3DPOOL_MANAGED, &pModelCopy->m_pIndexBuffer, 0);
pModelCopy->m_pIndexBuffer->Lock(0, 0, (void**)&pDestData, 0);
m_pIndexBuffer->Lock(0, 0, (void**)&pSrcData, 0);
memcpy(dstData, srcData, sizeof(UINT)* tmpind);
//memcpy(nm->ArrIndBuf, srcData, sizeof(UINT)* tmpind);
memcpy(pDestData, pSrcData, sizeof(UINT)* m_uiAllIndexCount);
nm->m_pIndexBuffer->Unlock();
pModelCopy->m_pIndexBuffer->Unlock();
m_pIndexBuffer->Unlock();
return nm;
return pModelCopy;
}
DataStaticModel::~DataStaticModel()
......@@ -98,7 +96,7 @@ struct DataStaticModel : public ISXDataStaticModel
mem_release_del(m_pVertexBuffer);
mem_release_del(m_pIndexBuffer);
for (DWORD i = 0; i < m_uiSubsetCount; ++i)
for (int i = 0; i < m_uiSubsetCount; ++i)
{
mem_delete_a(m_ppTextures[i]);
}
......
......@@ -40,15 +40,15 @@ CSkyBox::CSkyBox()
&m_pIndeces,
0);
float X = 1.0f * 200;
float Y = 1.0f * 200;
float Z = 1.0f * 200;
float tmpy = 45;
float X = SXGC_SKYBOX_SIZE * 0.5;
float Y = SXGC_SKYBOX_SIZE * 0.5;
float Z = SXGC_SKYBOX_SIZE * 0.5;
//float tmpy = 45;
CSkyBoxVertex* tmpVertices;
m_pVertices->Lock(0, 0, (void**)&tmpVertices, 0);
tmpVertices[0] = CSkyBoxVertex( X, Y-tmpy, Z, 1.0f, 1.0f, 1.0f);
/*tmpVertices[0] = CSkyBoxVertex( X, Y-tmpy, Z, 1.0f, 1.0f, 1.0f);
tmpVertices[1] = CSkyBoxVertex(-X, Y-tmpy, Z,-1.0f, 1.0f, 1.0f);
tmpVertices[2] = CSkyBoxVertex( X, -tmpy, Z, 1.0f,-1.0f, 1.0f);
......@@ -57,7 +57,18 @@ CSkyBox::CSkyBox()
tmpVertices[5] = CSkyBoxVertex( X, -tmpy,-Z, 1.0f,-1.0f,-1.0f);
tmpVertices[6] = CSkyBoxVertex(-X, Y-tmpy,-Z,-1.0f, 1.0f,-1.0f);
tmpVertices[7] = CSkyBoxVertex(-X, -tmpy,-Z,-1.0f,-1.0f,-1.0f);
tmpVertices[7] = CSkyBoxVertex(-X, -tmpy,-Z,-1.0f,-1.0f,-1.0f);*/
tmpVertices[0] = CSkyBoxVertex( X, Y, Z, 1.0f, 1.0f, 1.0f);
tmpVertices[1] = CSkyBoxVertex(-X, Y, Z, -1.0f, 1.0f, 1.0f);
tmpVertices[2] = CSkyBoxVertex( X, -Y, Z, 1.0f, -1.0f, 1.0f);
tmpVertices[3] = CSkyBoxVertex( X, Y, -Z, 1.0f, 1.0f, -1.0f);
tmpVertices[4] = CSkyBoxVertex(-X, -Y, Z, -1.0f, -1.0f, 1.0f);
tmpVertices[5] = CSkyBoxVertex( X, -Y, -Z, 1.0f, -1.0f, -1.0f);
tmpVertices[6] = CSkyBoxVertex(-X, Y, -Z, -1.0f, 1.0f, -1.0f);
tmpVertices[7] = CSkyBoxVertex(-X, -Y, -Z, -1.0f, -1.0f, -1.0f);
m_pVertices->Unlock();
......
......@@ -66,9 +66,9 @@ ID StdMtlLoad(const char *szName, int iMtlType)
return SGCore_LoadTexAddName(szName, LOAD_TEXTURE_TYPE_LOAD);
}
int StdMtlGetSort(ID id)
bool StdMtlIsTransparency(ID id)
{
return 0;