Skip to content

Commit a8d2bea

Browse files
authored
Merge pull request #15 from OpenXRay/xd_dev
Big merge directly from xd_dev
2 parents 29348f1 + 43ef63a commit a8d2bea

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+870
-673
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ X-Ray Engine 1.6 expansion [![Codacy Badge](https://api.codacy.com/project/badge
33

44
### Build Status:
55

6-
|Platform|Build Status|
7-
|--------|------|
8-
| Linux (GCC)(Release)(x64/x86) |[![Build Status](https://api.travis-ci.org/q4a/xray-16.svg?branch=linux)](https://travis-ci.org/q4a/xray-16)|
9-
| Windows (MSVC)(Debug/Mixed/Release)(x64/x86) |[![Build status](https://ci.appveyor.com/api/projects/status/beb4c2xtyru4galx/branch/linux?svg=true)](https://ci.appveyor.com/project/q4a/xray-16)|
6+
|Platform|Build status: [xd_dev branch](https://github.com/OpenXRay/xray-16)|Build status: [linux branch](https://github.com/q4a/xray-16)|
7+
|--------|--------|--------|
8+
| Linux (GCC)(Release)(x64/x86) |[![Build Status](https://api.travis-ci.org/OpenXRay/xray-16.svg?branch=xd_dev)](https://travis-ci.org/OpenXRay/xray-16)|[![Build Status](https://api.travis-ci.org/q4a/xray-16.svg?branch=linux)](https://travis-ci.org/q4a/xray-16)|
9+
| Windows (MSVC)(Debug/Mixed/Release)(x64/x86) |[![Build status](https://ci.appveyor.com/api/projects/status/16mp39v0d7fts6yf?svg=true)](https://ci.appveyor.com/project/OpenXRay/xray-16)|[![Build status](https://ci.appveyor.com/api/projects/status/beb4c2xtyru4galx/branch/linux?svg=true)](https://ci.appveyor.com/project/q4a/xray-16)|
1010

1111
This repository contains X-Ray Engine sources based on version 1.6.02.
1212
The original engine is used in S.T.A.L.K.E.R. Call of Pripyat game released by GSC Game World.

appveyor.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,9 @@ deploy:
6868
release: OpenXRay (build $(appveyor_build_version))
6969
description: $(APPVEYOR_REPO_COMMIT_MESSAGE)
7070
auth_token:
71-
secure: EwMP7ob9Q7cE1EvW72ybDSYjbD44IQRDFhbCQcdOuBSSz9PbO/Pq2ZUNuMqPuvsV
71+
secure: kGVniXDR926BfVcA97y25BzALbijvgboBsozZzY9yc8RPz15Q4YG474h7vl14/J1
7272
artifact:
7373
OpenXRay.Dx86.7z, OpenXRay.Dx64.7z, OpenXRay.Mx86.7z, OpenXRay.Mx64.7z, OpenXRay.Rx86.7z, OpenXRay.Rx64.7z,
7474
Symbols.Dx86.7z, Symbols.Dx64.7z, Symbols.Mx86.7z, Symbols.Mx64.7z, Symbols.Rx86.7z, Symbols.Rx64.7z
7575
draft: true
76-
force_update: true
76+
force_update: true

res/gamedata/shaders/r3/editor.vs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#include "common.h"
2+
3+
struct vf
4+
{
5+
float4 C : COLOR0;
6+
float4 P : POSITION;
7+
};
8+
9+
struct v2p
10+
{
11+
float4 C : COLOR0;
12+
float4 P : SV_Position;
13+
};
14+
15+
uniform float4 tfactor;
16+
v2p main (vf i)
17+
{
18+
v2p o;
19+
20+
o.P = mul (m_WVP, i.P); // xform, input in world coords
21+
o.C = tfactor*unpack_D3DCOLOR(i.C);
22+
23+
return o;
24+
}

src/Layers/xrRender/Blender_Particle.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ void CBlender_Particle::Compile(CBlender_Compile& C)
201201
C.r_dx10Texture("s_base", C.L_textures[0]);
202202
u32 hSampler = C.r_dx10Sampler("smp_base");
203203
if (oClamp.value && (hSampler != (u32)-1))
204-
C.i_dx10Address(hSampler, D3DTADDRESS_CLAMP);
204+
C.i_Address(hSampler, D3DTADDRESS_CLAMP);
205205
// Igor: soft particles
206206
// C.r_Sampler ("s_position", "$user$position");
207207
C.r_dx10Texture("s_position", "$user$position");
@@ -243,7 +243,7 @@ void CBlender_Particle::Compile(CBlender_Compile& C)
243243
C.r_dx10Texture("s_base", C.L_textures[0]);
244244
u32 hSampler = C.r_dx10Sampler("smp_base");
245245
if (oClamp.value && (hSampler != (u32)-1))
246-
C.i_dx10Address(hSampler, D3DTADDRESS_CLAMP);
246+
C.i_Address(hSampler, D3DTADDRESS_CLAMP);
247247
// Igor: soft particles
248248
//C.r_Sampler ("s_position", "$user$position");
249249
C.r_dx10Texture("s_position", "$user$position");

src/Layers/xrRender/Blender_Recorder_R2.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,8 @@ void CBlender_Compile::i_Projective(u32 s, bool b)
102102
else
103103
RS.SetTSS(s, D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_DISABLE);
104104
}
105+
#endif // USE_DX10
106+
105107
void CBlender_Compile::i_Address(u32 s, u32 address)
106108
{
107109
RS.SetSAMP(s, D3DSAMP_ADDRESSU, address);
@@ -118,6 +120,8 @@ void CBlender_Compile::i_Filter(u32 s, u32 _min, u32 _mip, u32 _mag)
118120
i_Filter_Mip(s, _mip);
119121
i_Filter_Mag(s, _mag);
120122
}
123+
124+
#if !defined(USE_DX10) && !defined(USE_DX11)
121125
u32 CBlender_Compile::r_Sampler(
122126
LPCSTR _name, LPCSTR texture, bool b_ps1x_ProjectiveDivide, u32 address, u32 fmin, u32 fmip, u32 fmag)
123127
{
@@ -185,4 +189,4 @@ void CBlender_Compile::r_End()
185189
#endif
186190
SH->passes.push_back(RImplementation.Resources->_CreatePass(dest));
187191
}
188-
#endif // USE_DX10
192+
#endif // USE_DX10

src/Layers/xrRender/Blender_Screen_SET.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ void CBlender_Screen_SET::Compile(CBlender_Compile& C)
129129
C.r_dx10Texture("s_base", C.L_textures[0]);
130130
int iSmp = C.r_dx10Sampler("smp_base");
131131
if (oClamp.value)
132-
C.i_dx10Address(iSmp, D3DTADDRESS_CLAMP);
132+
C.i_Address(iSmp, D3DTADDRESS_CLAMP);
133133
}
134134
else
135135
{
@@ -165,7 +165,7 @@ void CBlender_Screen_SET::Compile(CBlender_Compile& C)
165165
C.r_dx10Texture("s_base", C.L_textures[0]);
166166
int iSmp = C.r_dx10Sampler("smp_base");
167167
if ((oClamp.value) && (iSmp != u32(-1)))
168-
C.i_dx10Address(iSmp, D3DTADDRESS_CLAMP);
168+
C.i_Address(iSmp, D3DTADDRESS_CLAMP);
169169
}
170170

171171
C.PassSET_ZB(oZTest.value, oZWrite.value);

src/Layers/xrRender/FVisual.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,12 @@ void Fvisual::Load(const char* N, IReader* data, u32 dwFlags)
6060
p_rm_Indices->AddRef();
6161
#endif
6262
#endif
63-
#if (RENDER == R_R2) || (RENDER == R_R3) || (RENDER == R_R4) || (RENDER == R_GL)
6463
// check for fast-vertices
64+
#if RENDER == R_R1
65+
if (data->find_chunk(OGF_FASTPATH) && ps_r1_force_geomx)
66+
#else
6567
if (data->find_chunk(OGF_FASTPATH))
68+
#endif
6669
{
6770
destructor<IReader> geomdef(data->open_chunk(OGF_FASTPATH));
6871
destructor<IReader> def(geomdef().open_chunk(OGF_GCONTAINER));
@@ -97,7 +100,6 @@ void Fvisual::Load(const char* N, IReader* data, u32 dwFlags)
97100
// geom
98101
m_fast->rm_geom.create(fmt, m_fast->p_rm_Vertices, m_fast->p_rm_Indices);
99102
}
100-
#endif // (RENDER==R_R2) || (RENDER==R_R3) || (RENDER==R_R4) || (RENDER==R_GL)
101103
}
102104

103105
// read vertices
@@ -222,8 +224,11 @@ void Fvisual::Load(const char* N, IReader* data, u32 dwFlags)
222224

223225
void Fvisual::Render(float)
224226
{
225-
#if (RENDER == R_R2) || (RENDER == R_R3) || (RENDER == R_R4) || (RENDER==R_GL)
226-
if (m_fast && RImplementation.phase == CRender::PHASE_SMAP && !RCache.is_TessEnabled())
227+
#if RENDER == R_R1
228+
if (m_fast && ps_r1_force_geomx)
229+
#else
230+
if (m_fast && (ps_r1_force_geomx || RImplementation.phase == CRender::PHASE_SMAP && !RCache.is_TessEnabled()))
231+
#endif
227232
{
228233
RCache.set_Geometry(m_fast->rm_geom);
229234
RCache.Render(D3DPT_TRIANGLELIST, m_fast->vBase, 0, m_fast->vCount, m_fast->iBase, m_fast->dwPrimitives);
@@ -235,11 +240,6 @@ void Fvisual::Render(float)
235240
RCache.Render(D3DPT_TRIANGLELIST, vBase, 0, vCount, iBase, dwPrimitives);
236241
RCache.stat.r.s_static.add(vCount);
237242
}
238-
#else // (RENDER==R_R2) || (RENDER==R_R3) || (RENDER==R_R4) || (RENDER==R_GL)
239-
RCache.set_Geometry(rm_geom);
240-
RCache.Render(D3DPT_TRIANGLELIST, vBase, 0, vCount, iBase, dwPrimitives);
241-
RCache.stat.r.s_static.add(vCount);
242-
#endif // (RENDER==R_R2) || (RENDER==R_R3) || (RENDER==R_R4) || (RENDER==R_GL)
243243
}
244244

245245
#define PCOPY(a) a = pFrom->a

src/Layers/xrRender/HW.h

Lines changed: 24 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -38,21 +38,20 @@ class CHW
3838
BOOL support(D3DFORMAT fmt, DWORD type, DWORD usage);
3939
#endif // !USE_OGL
4040

41-
#ifdef DEBUG
42-
#if defined(USE_DX10) || defined(USE_DX11) || defined(USE_OGL)
43-
void Validate(void){};
44-
#else // USE_DX10
45-
void Validate(void)
41+
#if defined(DEBUG) && defined(USE_DX9)
42+
void Validate()
4643
{
4744
VERIFY(pDevice);
4845
VERIFY(pD3D);
4946
};
50-
#endif // USE_DX10
5147
#else
52-
void Validate(void){};
48+
void Validate() {}
5349
#endif
5450

55-
// Variables section
51+
// Variables section
52+
public:
53+
CHWCaps Caps;
54+
5655
#if defined(USE_OGL)
5756
CHW* pDevice;
5857
CHW* pContext;
@@ -63,62 +62,40 @@ class CHW
6362
GLuint pFB;
6463
GLuint pCFB;
6564

66-
CHWCaps Caps;
67-
6865
SDL_Window* m_hWnd;
6966
HDC m_hDC;
7067
SDL_GLContext m_hRC;
71-
#elif defined(USE_DX11)
72-
public:
73-
IDXGIFactory1* m_pFactory = nullptr;
74-
IDXGIAdapter1* m_pAdapter = nullptr; // pD3D equivalent
75-
ID3D11Device* pDevice = nullptr; // combine with DX9 pDevice via typedef
76-
ID3D11DeviceContext* pContext = nullptr; // combine with DX9 pDevice via typedef
77-
IDXGISwapChain* m_pSwapChain = nullptr;
78-
ID3D11RenderTargetView* pBaseRT = nullptr; // combine with DX9 pBaseRT via typedef
79-
ID3D11DepthStencilView* pBaseZB = nullptr;
80-
81-
CHWCaps Caps;
68+
#else // General DirectX
69+
ID3DDevice* pDevice = nullptr; // render device
70+
ID3DRenderTargetView* pBaseRT = nullptr; // base render target
71+
ID3DDepthStencilView* pBaseZB = nullptr; // base depth-stencil buffer
8272

8373
D3D_DRIVER_TYPE m_DriverType;
84-
DXGI_SWAP_CHAIN_DESC m_ChainDesc; // DevPP equivalent
85-
D3D_FEATURE_LEVEL FeatureLevel;
86-
#elif defined(USE_DX10)
87-
public:
74+
#ifndef USE_DX9
8875
IDXGIFactory1* m_pFactory = nullptr;
89-
IDXGIAdapter1* m_pAdapter = nullptr; // pD3D equivalent
90-
ID3D10Device1* pDevice1 = nullptr; // combine with DX9 pDevice via typedef
91-
ID3D10Device* pDevice = nullptr; // combine with DX9 pDevice via typedef
92-
ID3D10Device1* pContext1 = nullptr; // combine with DX9 pDevice via typedef
93-
ID3D10Device* pContext = nullptr; // combine with DX9 pDevice via typedef
76+
IDXGIAdapter1* m_pAdapter = nullptr; // pD3D equivalent
77+
ID3DDeviceContext* pContext = nullptr;
9478
IDXGISwapChain* m_pSwapChain = nullptr;
95-
ID3D10RenderTargetView* pBaseRT = nullptr; // combine with DX9 pBaseRT via typedef
96-
ID3D10DepthStencilView* pBaseZB = nullptr;
97-
98-
CHWCaps Caps;
99-
100-
D3D10_DRIVER_TYPE m_DriverType;
101-
DXGI_SWAP_CHAIN_DESC m_ChainDesc; // DevPP equivalent
79+
DXGI_SWAP_CHAIN_DESC m_ChainDesc; // DevPP equivalent
10280
D3D_FEATURE_LEVEL FeatureLevel;
103-
#else
104-
private:
81+
#if defined(USE_DX10)
82+
ID3D10Device1* pDevice1 = nullptr;
83+
ID3D10Device1* pContext1 = nullptr;
84+
#endif
85+
#else // USE_DX9
10586
#ifdef DEBUG
10687
IDirect3DStateBlock9* dwDebugSB = nullptr;
10788
#endif
89+
private:
10890
XRay::Module hD3D = nullptr;
10991

11092
public:
11193
IDirect3D9* pD3D = nullptr; // D3D
112-
IDirect3DDevice9* pDevice = nullptr; // render device
113-
IDirect3DSurface9* pBaseRT = nullptr;
114-
IDirect3DSurface9* pBaseZB = nullptr;
115-
116-
CHWCaps Caps;
11794

11895
UINT DevAdapter;
119-
D3DDEVTYPE m_DriverType;
12096
D3DPRESENT_PARAMETERS DevPP;
121-
#endif // USE_DX10
97+
#endif // USE_DX9
98+
#endif // USE_OGL
12299

123100
#if !defined(_MAYA_EXPORT) && !defined(USE_OGL)
124101
stats_manager stats_manager;
@@ -128,7 +105,7 @@ class CHW
128105
void UpdateViews();
129106
#endif
130107
#if defined(USE_DX10) || defined(USE_DX11)
131-
bool CheckFormatSupport(DXGI_FORMAT format, D3D_FORMAT_SUPPORT feature) const;
108+
bool CheckFormatSupport(DXGI_FORMAT format, UINT feature) const;
132109
DXGI_FORMAT SelectFormat(D3D_FORMAT_SUPPORT feature, const DXGI_FORMAT formats[], size_t count) const;
133110
virtual void OnAppActivate();
134111
virtual void OnAppDeactivate();

src/Layers/xrRender/LightTrack.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -365,11 +365,8 @@ void CROS_impl::update_smooth(IRenderable* O)
365365

366366
void CROS_impl::calc_sun_value(Fvector& position, IGameObject* _object)
367367
{
368-
#if RENDER == R_R1
369-
light* sun = (light*)RImplementation.L_DB->sun._get();
370-
#else
371368
light* sun = (light*)RImplementation.Lights.sun._get();
372-
#endif
369+
373370
if (MODE & IRender_ObjectSpecific::TRACE_SUN)
374371
{
375372
if (--result_sun < 0)
@@ -530,7 +527,7 @@ void CROS_impl::prepare_lights(Fvector& position, IRenderable* O)
530527
}
531528

532529
#if RENDER == R_R1
533-
light* sun = (light*)RImplementation.L_DB->sun._get();
530+
light* sun = (light*)RImplementation.Lights.sun._get();
534531

535532
// Sun
536533
float E = sun_smooth * sun->color.intensity();

src/Layers/xrRender/ResourceManager_Resources.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ void CResourceManager::DBG_VerifyGeoms()
286286
*/
287287
}
288288

289-
SGeometry* CResourceManager::CreateGeom(D3DVERTEXELEMENT9* decl, IDirect3DVertexBuffer9* vb, IDirect3DIndexBuffer9* ib)
289+
SGeometry* CResourceManager::CreateGeom(D3DVERTEXELEMENT9* decl, ID3DVertexBuffer* vb, ID3DIndexBuffer* ib)
290290
{
291291
R_ASSERT(decl && vb);
292292

@@ -310,7 +310,7 @@ SGeometry* CResourceManager::CreateGeom(D3DVERTEXELEMENT9* decl, IDirect3DVertex
310310
v_geoms.push_back(Geom);
311311
return Geom;
312312
}
313-
SGeometry* CResourceManager::CreateGeom(u32 FVF, IDirect3DVertexBuffer9* vb, IDirect3DIndexBuffer9* ib)
313+
SGeometry* CResourceManager::CreateGeom(u32 FVF, ID3DVertexBuffer* vb, ID3DIndexBuffer* ib)
314314
{
315315
D3DVERTEXELEMENT9 dcl[MAX_FVF_DECL_SIZE];
316316
CHK_DX(D3DXDeclaratorFromFVF(FVF, dcl));

0 commit comments

Comments
 (0)