port from perforce

This commit is contained in:
2026-04-18 22:31:51 +02:00
commit 8d0ab5b7cc
8409 changed files with 3972376 additions and 0 deletions

187
evoke-64k/ev10/globals.cpp Normal file
View File

@@ -0,0 +1,187 @@
#include "globals.h"
LPDIRECT3D9 g_D3D;
IDirect3DDevice9 *g_d3d_device;
D3DPRESENT_PARAMETERS d3dpp=
{
1024,//UINT BackBufferWidth;
768,//UINT BackBufferHeight;
D3DFMT_A8R8G8B8,//D3DFORMAT BackBufferFormat;
2,//UINT BackBufferCount;
D3DMULTISAMPLE_16_SAMPLES,//D3DMULTISAMPLE_TYPE MultiSampleType;
0,//DWORD MultiSampleQuality;
D3DSWAPEFFECT_DISCARD,//D3DSWAPEFFECT SwapEffect;
0,//HWND hDeviceWindow;
FALSE,//BOOL Windowed;
TRUE,//BOOL EnableAutoDepthStencil;
D3DFMT_D24S8,//D3DFORMAT AutoDepthStencilFormat;
0,//DWORD Flags;
/* FullScreen_RefreshRateInHz must be zero for Windowed mode */
0,//UINT FullScreen_RefreshRateInHz;
D3DPRESENT_INTERVAL_ONE, //UINT PresentationInterval;
};
UINT g_nShadowResolution = 1024;
float g_fResolutionFactor = 1.0f;
int g_iResolutionFactorExp = 0;
D3DLIGHT9 d3dLight[3]=
{
{
D3DLIGHT_POINT,// D3DLIGHTTYPE Type; /* Type of light source */
{ 1.0f, 1.0f, 0.85f, 0.0f },// D3DCOLORVALUE Diffuse; /* Diffuse color of light */
{ 1.0f, 1.0f, 1.0f, 0.0f },// D3DCOLORVALUE Specular; /* Specular color of light */
{ 0.0625f, 0.0625f, 0.0625f, 0.0f },// D3DCOLORVALUE Ambient; /* Ambient color of light */
{ 48.0f, 96.0f, -48.0f },// D3DVECTOR Position; /* Position in world space */
{ 0.0f, 0.0f, 0.0f },// D3DVECTOR Direction; /* Direction in world space */
1024.0f, //float Range; /* Cutoff range */
0.0f, //float Falloff; /* Falloff */
1.0f / 4096.0f, //float Attenuation0; /* Constant attenuation */
1.0f / 4096.0f, //float Attenuation1; /* Linear attenuation */
1.0f / 4096.0f, //float Attenuation2; /* Quadratic attenuation */
0.0f, //float Theta; /* Inner angle of spotlight cone */
0.0f, //float Phi; /* Outer angle of spotlight cone */
},
{
D3DLIGHT_POINT,// D3DLIGHTTYPE Type; /* Type of light source */
{ 0.6f, 0.6f, 0.8f, 0.0f },// D3DCOLORVALUE Diffuse; /* Diffuse color of light */
{ 0.0f, 0.0f, 0.0f, 0.0f },// D3DCOLORVALUE Specular; /* Specular color of light */
{ 0.0f, 0.0f, 0.0f, 0.0f },// D3DCOLORVALUE Ambient; /* Ambient color of light */
{ -16.0f, -32.0f, 64.0f },// D3DVECTOR Position; /* Position in world space */
{ 0.0f, 0.0f, 0.0f },// D3DVECTOR Direction; /* Direction in world space */
1024.0f, //float Range; /* Cutoff range */
0.0f, //float Falloff; /* Falloff */
1.0f / 4096.0f, //float Attenuation0; /* Constant attenuation */
1.0f / 4096.0f, //float Attenuation1; /* Linear attenuation */
1.0f / 4096.0f, //float Attenuation2; /* Quadratic attenuation */
0.0f, //float Theta; /* Inner angle of spotlight cone */
0.0f, //float Phi; /* Outer angle of spotlight cone */
},
{
D3DLIGHT_POINT,// D3DLIGHTTYPE Type; /* Type of light source */
{ 141.0f / 255.0f, 122.0f / 255.0f, 57.0f / 255.0f, 0.0f },// D3DCOLORVALUE Diffuse; /* Diffuse color of light */
{ 205.0f / 255.0f, 186.0f / 255.0f, 121.0f / 255.0f, 0.0f },// D3DCOLORVALUE Specular; /* Specular color of light */
{ 0.0f, 0.0f, 0.0f, 0.0f },// D3DCOLORVALUE Ambient; /* Ambient color of light */
{ -48.0f, 64.0f, 48.0f },// D3DVECTOR Position; /* Position in world space */
{ 0.0f, 0.0f, 0.0f },// D3DVECTOR Direction; /* Direction in world space */
1024.0f, //float Range; /* Cutoff range */
0.0f, //float Falloff; /* Falloff */
1.0f / 4096.0f, //float Attenuation0; /* Constant attenuation */
1.0f / 4096.0f, //float Attenuation1; /* Linear attenuation */
1.0f / 4096.0f, //float Attenuation2; /* Quadratic attenuation */
0.0f, //float Theta; /* Inner angle of spotlight cone */
0.0f, //float Phi; /* Outer angle of spotlight cone */
}
};
D3DMATERIAL9 d3dMaterial=
{
{ 1.0f, 1.0f, 1.0f, 1.0f },// D3DCOLORVALUE Diffuse; /* Diffuse color RGBA */
{ 1.0f, 1.0f, 1.0f, 1.0f },// D3DCOLORVALUE Ambient; /* Ambient color RGB */
{ 1.0f, 1.0f, 1.0f, 0.0f },// Specular; /* Specular 'shininess' */
{ 0.0f, 0.0f, 0.0f, 0.0f },// Emissive; /* Emissive color RGB */
32.0f //float Power; /* Sharpness if specular highlight */
};
D3DXMATRIX g_matView;
D3DXMATRIX g_matProjection;
D3DXMATRIX g_matVP;
D3DXMATRIX g_matWVP;
Texture g_pTextures[ TextureCount ];
IDirect3DTexture9* g_pFullScreenRT[ RT_COUNT ];
IDirect3DSurface9* g_pFullScreenRTS[ RTS_COUNT ];
SCameraDefinition g_Camera;
D3DXVECTOR3 g_CamFront;
D3DXVECTOR3 g_LightDir;
float g_fGlow;
float g_fClouds;
float g_fPlasmaGrid;
PSSM g_PSSM;
Renderjob g_Objects[ ObjectCount ];
Renderjob* g_pEditObject;
Renderjob g_SkyBox;
Renderjob g_FullScreenQuad;
Shader g_Shaders[ g_iShaderCount ];
#ifndef STARTMUSIC
DWORD g_dwTimeReplaceStart;
#endif
int g_iTempo= ( 44100 * 60 * 2 ) / 145;
int g_iSampleOffset= g_iSampleOffsetGeneral;
int g_dwSamplesPassed= 0;
int g_dwSamples= 0;
SVUMeter g_vuLightBeat;
SVUMeter g_vuOffBeat;
//ScriptState g_ScriptState;
RandomGenerator g_Random;
#ifdef EXTRACODE
unsigned char g_Script[ 2048 ];
float g_ScriptParamFloat[ 512 ];
#endif
#ifdef EXTRACODE
char g_ShaderVSGeneral[ 65536 ];
char g_ShaderPSPhong[ 65536 ];
char g_ShaderPSRainbow[ 65536 ];
char g_ShaderPSTarmac[ 65536 ];
char g_ShaderPSGrass[ 65536 ];
char g_ShaderPSWall[ 65536 ];
char g_ShaderPSDepth[ 65536 ];
char g_ShaderPSText[ 65536 ];
char g_ShaderVSSky[ 65536 ];
char g_ShaderPSSky[ 65536 ];
char g_ShaderVSFSQuad[ 65536 ];
char g_ShaderPSPSSM[ 65536 ];
char g_ShaderPSAmbOcc[ 65536 ];
char g_ShaderPSDOF[ 65536 ];
char g_ShaderPSRay[ 65536 ];
char g_ShaderPSBlur[ 65536 ];
#endif
void InitGlobals()
{
for( int i= 0; i < TextureCount; ++i )
{
g_pTextures[ i ].Init();
}
for( int i= 0; i < ObjectCount; i++ )
{
g_Objects[ i ].Init();
}
g_SkyBox.Init();
g_FullScreenQuad.Init();
g_PSSM.Init();
for( int i= 0; i < g_iShaderCount; i++ )
{
g_Shaders[ i ].Init();
}
g_Random.setSeed( 0 );
}