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

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

View File

@@ -0,0 +1,779 @@
#include "defines.h"
#include "ConfigFiles.h"
#include "globals.h"
#include "ShaderFactory.h"
#include "textinfo.h"
#include "intrin.h"
HANDLE g_FileChangeNotification= NULL;
static std::string g_strShaderData;
void StopFileWatch()
{
if (g_FileChangeNotification != INVALID_HANDLE_VALUE && g_FileChangeNotification != NULL)
{
FindCloseChangeNotification(g_FileChangeNotification);
}
g_FileChangeNotification= NULL;
}
void StartFileWatch()
{
StopFileWatch();
std::string strPath= ".\\cfg\\";
g_FileChangeNotification= FindFirstChangeNotification(
strPath.c_str(),
FALSE,
FILE_NOTIFY_CHANGE_LAST_WRITE );
}
bool CheckFileWatch()
{
if (g_FileChangeNotification == INVALID_HANDLE_VALUE || g_FileChangeNotification == NULL)
{
return false;
}
DWORD dwRet= WaitForSingleObject( g_FileChangeNotification, 1 );
if( WAIT_OBJECT_0 == dwRet )
{
FindNextChangeNotification( g_FileChangeNotification );
ReadDataFromDisc();
// Shader neu compilieren
PrepareShaders();
//Texte neu setzen
CreateTextRenderJobs();
return true;
}
return false;
}
int g_iCurSpriptLength;
int g_iCurSpriptParams;
void ReadScriptTxt()
{
/*
g_iCurSpriptLength= 0;
g_iCurSpriptParams= 0;
FrameWork::TextFileReader tfrScript;
tfrScript.read( "cfg/script.txt" );
//#ifdef SCRIPTEDITOR
for( int i= 0; i < (int)tfrScript.getFileLines().size(); ++i )
{
std::string strAct= tfrScript.getFileLines()[ i ];
std::string strCommandFull;
if( FrameWork::StringHelper::splitAt( strAct, "=", strCommandFull ) )
{
}
std::stringstream ss;
ss << strAct;
if( strCommandFull == "SKIP" )
{
#ifdef SCRIPTEDITOR
ss >> g_iSkipTicks;
#endif
}
if( strCommandFull == "CLEAN" )
{
g_iCurSpriptLength= 0;
g_iCurSpriptParams= 0;
}
else if( strCommandFull == "CSPEED" )
{
g_Script[ g_iCurSpriptLength++ ]= CSPEED;
ss >> g_ScriptParamFloat[ g_iCurSpriptParams++ ];
}
else if( strCommandFull == "OSPEED" )
{
g_Script[ g_iCurSpriptLength++ ]= OSPEED;
ss >> g_ScriptParamFloat[ g_iCurSpriptParams++ ];
}
else if( strCommandFull == "CTIME" )
{
g_Script[ g_iCurSpriptLength++ ]= CTIME;
ss >> g_ScriptParamFloat[ g_iCurSpriptParams++ ];
}
else if( strCommandFull == "OTIME" )
{
g_Script[ g_iCurSpriptLength++ ]= OTIME;
ss >> g_ScriptParamFloat[ g_iCurSpriptParams++ ];
}
else if( strCommandFull == "CAM" )
{
g_Script[ g_iCurSpriptLength++ ]= CAM;
int iVal= 0;
ss >> iVal;
g_Script[ g_iCurSpriptLength++ ]= iVal;
}
else if( strCommandFull == "CAM" )
{
g_Script[ g_iCurSpriptLength++ ]= CAM;
int iVal= 0;
ss >> iVal;
g_Script[ g_iCurSpriptLength++ ]= iVal;
}
else if( strCommandFull == "OBJ" )
{
g_Script[ g_iCurSpriptLength++ ]= OBJ;
int iVal= 0;
ss >> iVal;
g_Script[ g_iCurSpriptLength++ ]= iVal;
iVal= 0;
ss >> iVal;
g_Script[ g_iCurSpriptLength++ ]= iVal;
}
else if( strCommandFull == "TICK" )
{
g_Script[ g_iCurSpriptLength++ ]= TICK;
int iVal= 0;
ss >> iVal;
g_Script[ g_iCurSpriptLength++ ]= iVal;
}
else if( strCommandFull == "QUIT" )
{
g_Script[ g_iCurSpriptLength++ ]= QUIT;
}
}
//#endif
*/
}
void ReadParamTxt()
{
/*
FrameWork::TextFileReader tfrSong;
tfrSong.read( "cfg/param.txt" );
tfrSong.append( "cfg/port.txt" );
tfrSong.append( "cfg/cam.txt" );
// tfrSong.append( "cfg/script.txt" );
for( int i= 0; i < (int)tfrSong.getFileLines().size(); ++i )
{
std::string strAct= tfrSong.getFileLines()[ i ];
std::string strCommandFull;
if( FrameWork::StringHelper::splitAt( strAct, "=", strCommandFull ) )
{
}
std::stringstream ss;
ss << strAct;
#ifdef SINGLEEDITMODE
if( strCommandFull == "PCUR" )
{
ss >> g_iCurrentPortrait;
}
else if( strCommandFull == "OCUR" )
{
ss >> g_iCurrentObject;
}
else if( strCommandFull == "OCOUNT" )
{
ss >> g_iCurrentObjectCount;
}
else if( strCommandFull == "CCUR" )
{
ss >> g_iCurrentCamera;
}
#endif
if( strCommandFull.size() < 4 )
{
continue;
}
int iFunc= strCommandFull[ strCommandFull.size() - 1 ] - '0';
iFunc+= 10 * ( strCommandFull[ strCommandFull.size() - 2 ] - '0' );
iFunc+= 100 * ( strCommandFull[ strCommandFull.size() - 3 ] - '0' );
std::string strCommand;
strCommand= strCommandFull.substr( 0, strCommandFull.size() - 3 );
if( strCommand == "BANK" )
{
for( int j= 0; j < 4; ++j )
{
float fVal= 0.0f;
ss >> fVal;
int iVal= (int)( fVal * 64.0f + 0.5f );
fVal= (float)( iVal ) / 64.0f;
SetParamValue( iFunc, j, fVal );
}
}
else if( strCommand == "SIZE" )
{
ss >> g_ObjectData[ iFunc ].m_iSizeX;
ss >> g_ObjectData[ iFunc ].m_iSizeY;
}
else if( strCommand == "BASE" )
{
ss >> g_ObjectData[ iFunc ].m_iBaseMeshType;
ss >> g_ObjectData[ iFunc ].m_iBaseBank;
}
else if( strCommand == "OFFSET" )
{
ss >> g_ObjectData[ iFunc ].m_iOffsetFunc;
ss >> g_ObjectData[ iFunc ].m_iOffsetBank;
}
else if( strCommand == "HEIGHT" )
{
ss >> g_ObjectData[ iFunc ].m_iHeightFunc;
ss >> g_ObjectData[ iFunc ]. m_iHeightBank;
}
else if( strCommand == "MIX" )
{
ss >> g_ObjectData[ iFunc ].m_iMixFunc;
ss >> g_ObjectData[ iFunc ].m_iMixBank;
}
else if( strCommand == "TRANS" )
{
ss >> g_ObjectData[ iFunc ].m_iTransformFunc;
ss >> g_ObjectData[ iFunc ].m_iTransformBank;
}
else if( strCommand == "COLOR" )
{
float fR;
float fG;
float fB;
float fA;
ss >> fR;
ss >> fG;
ss >> fB;
ss >> fA;
fR= min( 255.0f, fR );
fG= min( 255.0f, fG );
fB= min( 255.0f, fB );
fA= min( 255.0f, fA );
DWORD dwColor= ( (int)fR << 16 ) |
( (int)fG << 8 ) |
( (int)fB );
g_ObjectData[ iFunc ].m_dwColor= dwColor;
}
else if( strCommand == "PSCALE" )
{
ss >> g_PortraitData[ iFunc ].m_iScale;
}
else if( strCommand == "PPOS" )
{
ss >> g_PortraitData[ iFunc ].m_iPosX;
ss >> g_PortraitData[ iFunc ].m_iPosY;
ss >> g_PortraitData[ iFunc ].m_iTextPosX;
ss >> g_PortraitData[ iFunc ].m_iTextPosY;
}
else if( strCommand == "PTEX" )
{
ss >> g_PortraitData[ iFunc ].m_iTextureID;
}
else if( strCommand == "PWORD" )
{
std::string strText( strAct );
FrameWork::StringHelper::searchAndRreplace( "<br>", "\n", strText );
strcpy_s( g_PortraitData[ iFunc ].m_pcText, strText.c_str() );
}
else if( strCommand == "PTICK" )
{
ss >> g_PortraitData[ iFunc ].m_iTicks;
}
else if( strCommand == "CTYPE" )
{
ss >> g_CameraData[ iFunc ].m_iType;
ss >> g_CameraData[ iFunc ].m_iBaseBank;
ss >> g_CameraData[ iFunc ].m_fFov;
}
else if( strCommand == "CCOLOR" )
{
float fR;
float fG;
float fB;
float fA;
ss >> fR;
ss >> fG;
ss >> fB;
ss >> fA;
fR= min( 255.0f, fR );
fG= min( 255.0f, fG );
fB= min( 255.0f, fB );
DWORD dwColor= ( (int)fR << 16 ) |
( (int)fG << 8 ) |
( (int)fB );
g_CameraData[ iFunc ].m_dwColor= dwColor;
fA= max( 1.0f, fA );
g_CameraData[ iFunc ].m_fFog= 1.0f / fA;
}
#ifdef SINGLEFUNCEDITOR
if( strCommand == "DRAW" )
{
ss >> g_iCamFunc;
ss >> g_iPaintFunc[ 0 ];
ss >> g_iPaintFunc[ 1 ];
}
if( strCommand == "CAMREPEAT" )
{
ss >> g_iCamRepeat;
}
#endif
}
*/
}
void ReadShader( char* pcTarget, const char* pcVarName, const char* pcFileName )
{
FrameWork::TextFileReader tfrShaderTxt;
tfrShaderTxt.read( pcFileName );
//shorten the data?
int iPos= 0;
for( int i= 0; i < (int)tfrShaderTxt.getFileLines().size(); ++i )
{
std::string strAct= tfrShaderTxt.getFileLines()[ i ];
bool bNonWhiteFound= false;
for( size_t j= 0; j < strAct.size(); ++j )
{
char c= strAct[ j ];
if( c == ' ' && !bNonWhiteFound )
{
continue;
}
if( c == '\t' && !bNonWhiteFound )
{
continue;
}
bNonWhiteFound= true;
if( c == '/' && strAct[ j + 1 ] == '/' )
{
break;
}
pcTarget[ iPos ]= c;
iPos++;
}
// better readability?
pcTarget[ iPos ]= 13;
iPos++;
}
pcTarget[ iPos ]= 0;
std::stringstream ss;
ss << "const char " << pcVarName << "[]=\n";
ss << "\"";
int iCount= 0;
char cPrevious= 0;
while( pcTarget[ iCount ] != 0 )
{
char c= pcTarget[ iCount ];
if( c == 13 )
{
if( 13 != cPrevious && 10 != cPrevious )
{
ss << "\\n\"\n\"";
}
}
else
{
ss << c;
}
cPrevious= c;
iCount++;
}
ss << "\";\n\n";
g_strShaderData+= ss.str();
}
void ReadShaders()
{
ReadShader( g_ShaderVSGeneral, "g_ShaderVSGeneral", "cfg/vsgeneral.txt" );
ReadShader( g_ShaderPSPhong, "g_ShaderPSPhong", "cfg/psphong.txt" );
ReadShader( g_ShaderPSRainbow, "g_ShaderPSRainbow", "cfg/psrainbow.txt" );
ReadShader( g_ShaderPSTarmac, "g_ShaderPSTarmac", "cfg/pstarmac.txt" );
ReadShader( g_ShaderPSWall, "g_ShaderPSWall", "cfg/pswall.txt" );
ReadShader( g_ShaderPSGrass, "g_ShaderPSGrass", "cfg/psgrass.txt" );
ReadShader( g_ShaderPSDepth, "g_ShaderPSDepth", "cfg/psdepth.txt" );
ReadShader( g_ShaderPSText, "g_ShaderPSText", "cfg/pstext.txt" );
ReadShader( g_ShaderVSSky, "g_ShaderVSSky", "cfg/vssky.txt" );
ReadShader( g_ShaderPSSky, "g_ShaderPSSky", "cfg/pssky.txt" );
ReadShader( g_ShaderVSFSQuad, "g_ShaderVSFSQuad", "cfg/vsfsquad.txt" );
ReadShader( g_ShaderPSPSSM, "g_ShaderPSPSSM", "cfg/pspssm.txt" );
ReadShader( g_ShaderPSAmbOcc, "g_ShaderPSAmbOcc", "cfg/psao.txt" );
ReadShader( g_ShaderPSDOF, "g_ShaderPSDOF", "cfg/psdof.txt" );
ReadShader( g_ShaderPSRay, "g_ShaderPSRay", "cfg/psray.txt" );
ReadShader( g_ShaderPSBlur, "g_ShaderPSBlur", "cfg/psblur.txt" );
}
void ReadTextInfos()
{
m_iTextCount= -1;
int iCharPos= 0;
STextInfo* pInfo= m_TextInfos;
FrameWork::TextFileReader tfr;
tfr.read( "cfg/text.txt" );
for( int i= 0; i < (int)tfr.getFileLines().size(); ++i )
{
std::string strAct= tfr.getFileLines()[ i ];
std::string strCommandFull;
if( FrameWork::StringHelper::splitAt( strAct, "=", strCommandFull ) )
{
}
std::stringstream ss;
ss << strAct;
if( strCommandFull == "Text" )
{
if( m_iTextCount < m_iMaxTextCount )
{
m_iTextCount++;
pInfo= m_TextInfos + m_iTextCount;
}
strcpy( m_pcTextData + iCharPos, strAct.c_str() );
iCharPos+= strAct.size() + 1;
if( m_iTextCount == 0 )
{
pInfo->m_v3Pos.x= 0.0f;
pInfo->m_v3Pos.y= 0.0f;
pInfo->m_v3Pos.z= 0.0f;
pInfo->m_v3Rot.x= 0.0f;
pInfo->m_v3Rot.y= 0.0f;
pInfo->m_v3Rot.z= 0.0f;
pInfo->m_v3Scale.x= 1.0f;
pInfo->m_v3Scale.y= 1.0f;
pInfo->m_v3Scale.z= 1.0f;
}
else
{
*pInfo= m_TextInfos[ m_iTextCount - 1 ];
}
pInfo->m_v3Move.x= 0.0f;
pInfo->m_v3Move.y= 0.0f;
pInfo->m_v3Move.z= 0.0f;
pInfo->m_iTimeStart= 0;
pInfo->m_iTimeLength= 0;
}
else if( strCommandFull == "Pos" )
{
ss >> pInfo->m_v3Pos.x;
ss >> pInfo->m_v3Pos.y;
ss >> pInfo->m_v3Pos.z;
}
else if( strCommandFull == "Rot" )
{
ss >> pInfo->m_v3Rot.x;
ss >> pInfo->m_v3Rot.y;
ss >> pInfo->m_v3Rot.z;
pInfo->m_v3Rot.x*= c_PI / 180.0f;
pInfo->m_v3Rot.y*= c_PI / 180.0f;
pInfo->m_v3Rot.z*= c_PI / 180.0f;
}
else if( strCommandFull == "Scale" )
{
ss >> pInfo->m_v3Scale.x;
ss >> pInfo->m_v3Scale.y;
ss >> pInfo->m_v3Scale.z;
}
else if( strCommandFull == "Move" )
{
ss >> pInfo->m_v3Move.x;
ss >> pInfo->m_v3Move.y;
ss >> pInfo->m_v3Move.z;
}
else if( strCommandFull == "Time" )
{
ss >> pInfo->m_iTimeStart;
ss >> pInfo->m_iTimeLength;
}
}
m_iTextCount++;
}
void ReadDataFromDisc()
{
ReadParamTxt();
ReadScriptTxt();
ReadShaders();
ReadTextInfos();
/*static bool bWritten= false;
if( bWritten )
{
return;
}*/
#ifdef CREATE_HEADER
WriteHeader();
#endif
}
void WriteHeaderFunc()
{
/*std::ofstream ofs( "globaldata.h" );
ofs << "const float FloatParamBanks[ 4 * 512 ]=" << "\n";
ofs << "{" << "\n";
for( int i= 0; i < 4 * 512; ++i )
{
char pcSpecial[ 1024 ];
sprintf_s(
pcSpecial,
1024,
"%1.9ff,\n",
FloatParamBanks[ i ] );
ofs << pcSpecial;
}
ofs << "};" << "\n";
ofs << "\n";
{
int iBytes= sizeof( g_CameraData );
ofs << "const unsigned char byteCameraData[ " << iBytes <<" ]=" << "\n";
ofs << "{" << "\n";
int iLine= 0;
for( int i= 0; i < iBytes; ++i )
{
ofs << (int)(((unsigned char*)g_CameraData)[ i ]) << ",";
iLine++;
if( iLine == 8 )
{
ofs << "\n";
iLine= 0;
}
}
ofs << "\n" << "};" << "\n";
ofs << "SCameraDescription* g_CameraData= (SCameraDescription*)byteCameraData;\n\n";
}
{
int iBytes= sizeof( g_ObjectData );
ofs << "const unsigned char byteObjectData[ " << iBytes <<" ]=" << "\n";
ofs << "{" << "\n";
int iLine= 0;
for( int i= 0; i < iBytes; ++i )
{
ofs << (int)(((unsigned char*)g_ObjectData)[ i ]) << ",";
iLine++;
if( iLine == 8 )
{
ofs << "\n";
iLine= 0;
}
}
ofs << "\n" << "};" << "\n";
ofs << "SObjectDescription* g_ObjectData= (SObjectDescription*)byteObjectData;\n\n";
}
{
int iBytes= sizeof( g_PortraitData );
ofs << "const unsigned char bytePortraitData[ " << iBytes <<" ]=" << "\n";
ofs << "{" << "\n";
int iLine= 0;
for( int i= 0; i < iBytes; ++i )
{
ofs << (int)(((unsigned char*)g_PortraitData)[ i ]) << ",";
iLine++;
if( iLine == 8 )
{
ofs << "\n";
iLine= 0;
}
}
ofs << "\n" << "};" << "\n";
ofs << "SPortraitDescription* g_PortraitData= (SPortraitDescription*)bytePortraitData;\n\n";
}
*/
/*
ofs << "const int g_iFuncCount= " << g_iFuncCountWrite << ";\n";
ofs << "const int g_iFuncType[ g_iFuncCount ]=" << "\n";
ofs << "{" << "\n";
for( int i= 0; i < g_iFuncCountWrite; ++i )
{
ofs << g_iFuncType[ i ] << "," << "\n";
}
ofs << "};" << "\n";
ofs << "\n";
ofs << "const DWORD g_dwFuncColor[ 32 ]=" << "\n";
ofs << "{" << "\n";
for( int i= 0; i < 32; ++i )
{
ofs << g_dwFuncColor[ i ] << "," << "\n";
}
ofs << "};" << "\n";
ofs << "\n";
ofs << "const int g_iRanges[ 32 ]=" << "\n";
ofs << "{" << "\n";
for( int i= 0; i < 32; ++i )
{
ofs << g_iRanges[ i ] << "," << "\n";
}
ofs << "};" << "\n";
ofs << "\n";
ofs << "const int g_iDrawObj[ 16 ]=" << "\n";
ofs << "{" << "\n";
for( int i= 0; i < 16; ++i )
{
ofs << g_iDrawObj[ i ] << "," << "\n";
}
ofs << "};" << "\n";
ofs << "\n";
ofs << "const float g_fParameter[ g_iParamCount * g_iFuncCount ]=" << "\n";
ofs << "{" << "\n";
for( int i= 0; i < g_iParamCount; ++i )
{
for( int j= 0; j < g_iFuncCountWrite; ++j )
{
char pcSpecial[ 1024 ];
sprintf_s(
pcSpecial,
1024,
"%1.9ff,\n",
g_fParameter[ j + g_iFuncCount * i] );
ofs << pcSpecial;
}
}
ofs << "};" << "\n";
ofs << "\n";
*/
}
void WriteHeaderScript()
{
/*
std::ofstream ofs( "scriptdata.h" );
ofs << "const int g_iScriptLength= " << g_iCurSpriptLength << ";\n";
ofs << "const unsigned char g_Script[ g_iScriptLength ]=" << "\n";
ofs << "{" << "\n";
for( int i= 0; i < g_iCurSpriptLength; ++i )
{
ofs << (int)g_Script[ i ] << ",\n";
}
ofs << "};" << "\n";
ofs << "const float g_ScriptParamFloat[ " << g_iCurSpriptParams << " ]=" << "\n";
ofs << "{" << "\n";
for( int i= 0; i < g_iCurSpriptParams; ++i )
{
char pcSpecial[ 1024 ];
sprintf_s(
pcSpecial,
1024,
"%1.9ff,\n",
g_ScriptParamFloat[ i ] );
ofs << pcSpecial;
}
ofs << "};" << "\n";
ofs << "\n";
ofs << "\n";
*/
}
void WriterShaderInclude()
{
std::ofstream ofs( "shaderdata.h" );
ofs << g_strShaderData;
}
char m_pcTextData[]= { 64, 64, 0 };
void WriterTextInclude()
{
std::ofstream ofs( "textdata.h" );
ofs << "int m_iTextCount= " << m_iTextCount <<";\n";
ofs << "\n";
ofs << "const char m_pcTextData[]=\n";
ofs << "{\n";
int iZeroCount= 0;
for( int i= 0; i < 65536; ++i )
{
char pcSpecial[ 1024 ];
sprintf_s(
pcSpecial,
1024,
"\t%d,\n",
(int)m_pcTextData[ i ] );
ofs << pcSpecial;
if( m_pcTextData[ i ] == 0 )
{
iZeroCount++;
if( iZeroCount == m_iTextCount )
{
break;
}
}
}
ofs << "};\n";
ofs << "\n";
ofs << "const DWORD c_BinaryText[]= " << "\n";
ofs << "{\n";
for( int i= 0; i < (int)m_iTextCount; ++i )
{
int dwords= m_iTextCount * sizeof( STextInfo ) / 4;
if( dwords > 0 )
{
DWORD* pdwData= (DWORD*)&(m_TextInfos);
for( int j= 0; j < dwords; ++j )
{
char pcSpecial[ 1024 ];
sprintf_s( pcSpecial,
1024,
"\t%d,\n",
pdwData[ j ] );
ofs << pcSpecial;
}
}
}
ofs << "};\n";
ofs << "\n";
ofs << "STextInfo* m_TextInfos= (STextInfo*)c_BinaryText;\n";
ofs << "\n";
}
void WriteHeader()
{
//#ifdef SINGLEEDITMODE
WriteHeaderFunc();
//#endif
//#ifdef SCRIPTEDITOR
WriteHeaderScript();
//#endif
WriterShaderInclude();
WriterTextInclude();
}

View File

@@ -0,0 +1,35 @@
#pragma once
#include "defines.h"
#include <windows.h>
#include <iostream>
#include <sstream>
#include <fstream>
#include <cstdio>
#include "StringHelper.h"
#include "TextFileReader.h"
extern HANDLE g_FileChangeNotification;
void StopFileWatch();
void StartFileWatch();
void ReadDataFromDisc();
bool CheckFileWatch();
void WriteHeader();
extern int g_iCurSpriptLength;
extern int g_iCurSpriptParams;
void ReadTextInfos();
void ReadScriptTxt();
void ReadShader( char* pcTarget, const char* pcFileName );
void ReadShaders();
void WriteHeaderFunc();

View File

@@ -0,0 +1,233 @@
/***********************************************************************************/
/** \file EditorHelp.cpp
** \brief Implementation zur Klasse EditorHelp
*************************************************************************************
** Autor: Christian Roesch
*************************************************************************************
** -tut nichts-
**
*//*********************************************************************************/
// includes
#include "EditorHelp.h"
#include <cmath>
#include <ctime>
#include <cassert>
#include <sstream>
bool EditorHelp::m_KeyPressed[ 256 ]= { false };
bool EditorHelp::m_KeyDown[ 256 ]= { false };
HWND EditorHelp::m_hwnd= NULL;
bool EditorHelp::m_bShowDebugData= true;
LPD3DXFONT EditorHelp::m_pDebugFont= NULL;
extern int c_iScreenSizeY;
extern int c_iScreenSizeX;
extern IDirect3DDevice9 *g_d3d_device;
// Methoden-Definitionen
EditorHelp::EditorHelp()
{
}
EditorHelp::~EditorHelp()
{
}
void EditorHelp::SetHWND( HWND hwnd )
{
m_hwnd= hwnd;
}
void EditorHelp::CheckKeys()
{
if( m_hwnd == NULL )
{
m_hwnd= GetForegroundWindow();
}
if( m_hwnd == GetForegroundWindow() )
{
for( int i= 0; i < 256; i++ )
{
SHORT iKey= GetAsyncKeyState( i );
m_KeyPressed[ i ]= false;
if( iKey & 0x8000 )
{
if( m_KeyDown[ i ] == false )
{
m_KeyPressed[ i ]= true;
}
m_KeyDown[ i ]= true;
}
else
{
m_KeyDown[ i ]= false;
}
}
}
else
{
for( int i= 0; i < 256; i++ )
{
m_KeyPressed[ i ]= false;
m_KeyDown[ i ]= false;
}
}
}
float EditorHelp::GetKeyDownVal( float fCurrent,
int KeyAdd,
int KeySub,
float fDefault,
float fSlow,
float fFast )
{
return GetKeyVal( fCurrent,
m_KeyDown[ KeyAdd ],
m_KeyDown[ KeySub ],
fDefault,
fSlow,
fFast );
}
float EditorHelp::GetKeyPressedVal( float fCurrent,
int KeyAdd,
int KeySub,
float fDefault,
float fSlow,
float fFast )
{
return GetKeyVal( fCurrent,
m_KeyPressed[ KeyAdd ],
m_KeyPressed[ KeySub ],
fDefault,
fSlow,
fFast );
}
float EditorHelp::GetKeyVal( float fCurrent,
bool bAdd,
bool bSub,
float fDefault,
float fSlow,
float fFast )
{
//Konventionen fuer Tastenbelegung eingehalten?
assert( fSlow <= fDefault );
assert( fDefault <= fFast );
float fChange= fDefault;
if( m_KeyDown[ VK_SHIFT ] )
{
fChange= fFast;
}
if( m_KeyDown[ VK_CONTROL ] )
{
fChange= fSlow;
}
int iVal= (int)Round( fCurrent / fChange );
if( bAdd )
{
return (float)(iVal + 1 ) * fChange;
}
if( bSub )
{
return (float)(iVal - 1 ) * fChange;
}
return fCurrent;
}
float EditorHelp::Round(float Val )
{
return floor(Val + 0.5f);
}
void EditorHelp::PrintDebug( int iLine, int iColumn, char* pcData )
{
PrintDebugPos( 2.0f + (float)iLine * 12.0f,
2.0f + (float)iColumn * 9.0f,
pcData );
}
void EditorHelp::PrintDebugPos( float fY, float fX, char* pcData )
{
if( m_bShowDebugData )
{
RECT r= {
0 + (int)fX,
0 + (int)fY,
c_iScreenSizeX + (int)fX,
c_iScreenSizeY + (int)fX };
m_pDebugFont->DrawText(
NULL,
pcData,
strlen(pcData),
&r,
DT_TOP | DT_LEFT,
0xff000000 );
r.top-=1;
r.left-=1;
m_pDebugFont->DrawText(
NULL,
pcData,
strlen(pcData),
&r,
DT_TOP | DT_LEFT,
0xffffffff );
}
}
std::string EditorHelp::GetDateString()
{
time_t t;
struct tm ts;
t = time(NULL);
localtime_s( &ts, &t );
std::stringstream ss;
ss << ts.tm_mon + 1 << "_";
ss << ts.tm_mday << "_";
ss << ts.tm_hour << "_";
ss << ts.tm_min << "_";
ss << ts.tm_sec;
return ss.str();
}
void EditorHelp::PreparePrint()
{
if( m_pDebugFont != NULL )
{
return;
}
static D3DXFONT_DESC FontDescription=
{
50,
20,
0,
8,
FALSE,
0,
0,
5, // CLEARTYPE_QUALITY
0,
"Courier"
};
FontDescription.Height= 12;
FontDescription.Width= 9;
D3DXCreateFontIndirect( g_d3d_device,
&FontDescription,
&m_pDebugFont );
}
/************************************************************************************
** Ende der Datei: EditorHelp.cpp
************************************************************************************/

View File

@@ -0,0 +1,88 @@
/***********************************************************************************/
/** \file EditorHelp.h
** \brief Header File zur Klasse EditorHelp
*************************************************************************************
** Autor: Christian Roesch
*************************************************************************************
** _tut nichts_
**
*//*********************************************************************************/
#ifndef _EditorHelp_H
#define _EditorHelp_H
// includes
#include <windows.h>
#include <string>
#include <d3dx9core.h>
// Klassen-Deklaration
/***********************************************************************************/
/** \brief EditorHelp _tut nichts_
*************************************************************************************
** Genau genommen _tut dies nichts_
**
*//*********************************************************************************/
class EditorHelp
{
public:
EditorHelp();
~EditorHelp();
static float Round(float Val );
static void CheckKeys();
static float GetKeyDownVal( float fCurrent,
int KeyAdd,
int KeySub,
float fDefault,
float fSlow,
float fFast );
static float GetKeyPressedVal( float fCurrent,
int KeyAdd,
int KeySub,
float fDefault,
float fSlow,
float fFast );
static bool m_KeyPressed[ 256 ];
static bool m_KeyDown[ 256 ];
static void PrintDebug( int iLine, int iColumn, char* pcData );
static void PrintDebugPos( float fY, float fX, char* pcData );
static std::string GetDateString();
static void SetHWND( HWND hwnd );
static bool m_bShowDebugData;
static void PreparePrint();
protected:
private:
static HWND m_hwnd;
static LPD3DXFONT m_pDebugFont;
static float GetKeyVal( float fCurrent,
bool bAdd,
bool bSub,
float fDefault,
float fSlow,
float fFast );
};
#endif//_EditorHelp_H
class EditorHelp;
/************************************************************************************
** Ende der Datei: EditorHelp.h
************************************************************************************/

156
evoke-64k/ev10/PSSM.cpp Normal file
View File

@@ -0,0 +1,156 @@
#include "defines.h"
#include "PSSM.h"
#include "shader.h"
#include "globals.h"
#include "intrin.h"
void PSSM::Init()
{
m_iSplitCount = -1;
m_fRange = 0.0f;
}
void PSSM::UpdateSplits(const D3DXVECTOR3 &vLightDir, const D3DXMATRIX &mView, const D3DXMATRIX &mProj)
{
assert( m_iSplitCount >= 0 && m_iSplitCount <= MaxSplitCount );
assert( m_fRange >= 0.0f );
// Extract cam data
D3DXVECTOR3 vCamPos(
-(mView._11 * mView._41 + mView._12 * mView._42 + mView._13 * mView._43),
-(mView._21 * mView._41 + mView._22 * mView._42 + mView._23 * mView._43),
-(mView._31 * mView._41 + mView._32 * mView._42 + mView._33 * mView._43) );
D3DXVECTOR3 vCamRight(mView._11, mView._21, mView._31);
D3DXVECTOR3 vCamUp(mView._12, mView._22, mView._32);
D3DXVECTOR3 vCamLook(mView._13, mView._23, mView._33);
// Extract plane distances
float fNearPlane = mProj._43 / -mProj._33;
float fFarPlane = mProj._43 / (1.0f - mProj._33);
// Extract FOV
float fTanHalfFOVX = 1.0f / mProj._11;
float fTanHalfFOVY = 1.0f / mProj._22;
// Compute maximum shadow split clip plane
float fMaxClipPlane = max( fFarPlane,
max(2.0f * fTanHalfFOVX * fFarPlane, 2.0f * fTanHalfFOVY * fFarPlane) );
// Adjust range
if(fFarPlane - fNearPlane > m_fRange)
fFarPlane = fNearPlane + m_fRange;
// Compute frustum depth
float fFrustumDepth = fFarPlane - fNearPlane;
// Complete light vector set
D3DXVECTOR3 vLightUp(0.0f, 1.0f, 0.0f), vLightRight;
if(abs(D3DXVec3Dot(&vLightUp, &vLightDir)) > 0.95f)
vLightUp = D3DXVECTOR3(0.0f, 0.0f, 1.0f);
D3DXVec3Cross(&vLightRight, &vLightUp, &vLightDir);
D3DXVec3Normalize(&vLightRight, &vLightRight);
D3DXVec3Cross(&vLightUp, &vLightDir, &vLightRight);
D3DXVec3Normalize(&vLightUp, &vLightUp);
// Loop over splits
for(int iSplit = 0; iSplit < m_iSplitCount; iSplit++)
{
// Compute both uniform and logarithmic split distribution
float fUniformSplitNear = fNearPlane + fFrustumDepth * ((float)iSplit / m_iSplitCount);
float fUniformSplitFar = fNearPlane + fFrustumDepth * ((float)(iSplit + 1) / m_iSplitCount);
float fLogSplitNear = fNearPlane * mypow(fFarPlane / fNearPlane, (float)iSplit / m_iSplitCount);
float fLogSplitFar = fNearPlane * mypow(fFarPlane / fNearPlane, (float)(iSplit + 1) / m_iSplitCount);
// Take average of both distributions
float fSplitNear = (fUniformSplitNear + fLogSplitNear) / 2.0f;
float fSplitFar = (fUniformSplitFar + fLogSplitFar) / 2.0f;
// Center
D3DXVECTOR3 vSplitCenter = vCamPos + (fSplitNear + fSplitFar) / 2.0f * vCamLook;
// Compute split view matrix
D3DXMatrixIdentity(&m_ViewMatrices[iSplit]);
memcpy(&m_ViewMatrices[iSplit]._11, &vLightRight, sizeof(float) * 3);
memcpy(&m_ViewMatrices[iSplit]._21, &vLightUp, sizeof(float) * 3);
memcpy(&m_ViewMatrices[iSplit]._31, &vLightDir, sizeof(float) * 3);
D3DXMatrixTranspose(&m_ViewMatrices[iSplit], &m_ViewMatrices[iSplit]);
m_ViewMatrices[iSplit]._41 = -D3DXVec3Dot(&vSplitCenter, &vLightRight);
m_ViewMatrices[iSplit]._42 = -D3DXVec3Dot(&vSplitCenter, &vLightUp);
m_ViewMatrices[iSplit]._43 = -D3DXVec3Dot(&vSplitCenter, &vLightDir);
// Update split view
m_ViewPos[iSplit] = vSplitCenter;
m_ViewDir[iSplit] = vLightDir;
D3DXVECTOR3 splitCorners[8];
// Compute all eight frustum split corner points
ComputeCornerPoints(splitCorners, fSplitNear, fSplitFar, fTanHalfFOVX, fTanHalfFOVY,
vCamPos, vCamRight, vCamUp, vCamLook, 0.1f);
float fMinX = FLT_MAX, fMaxX = FLT_MIN;
float fMinY = FLT_MAX, fMaxY = FLT_MIN;
float fMinZ = FLT_MAX, fMaxZ = FLT_MIN;
// Loop over corner points
for(int i = 0; i < 8; i++)
{
// Transform corner to view space
D3DXVECTOR4 vViewSpaceCorner;
D3DXVec3Transform(&vViewSpaceCorner, &splitCorners[i], &m_ViewMatrices[iSplit]);
// Find min and max values
if(vViewSpaceCorner.x > fMaxX) fMaxX = vViewSpaceCorner.x;
if(vViewSpaceCorner.x < fMinX) fMinX = vViewSpaceCorner.x;
if(vViewSpaceCorner.y > fMaxY) fMaxY = vViewSpaceCorner.y;
if(vViewSpaceCorner.y < fMinY) fMinY = vViewSpaceCorner.y;
if(vViewSpaceCorner.z > fMaxZ) fMaxZ = vViewSpaceCorner.z;
if(vViewSpaceCorner.z < fMinZ) fMinZ = vViewSpaceCorner.z;
}
// Bias
fMinX -= 2.0f; fMinY -= 2.0f; fMinZ -= 2.0f;
fMaxX += 2.0f; fMaxY += 2.0f; fMaxZ += 2.0f;
// Compute split projection matrix
D3DXMatrixOrthoOffCenterLH(&m_ProjMatrices[iSplit],
fMinX, fMaxX,
fMinY, fMaxY,
fMinZ - fMaxClipPlane, fMaxZ + fMaxClipPlane);
}
}
void PSSM::ComputeCornerPoints(D3DXVECTOR3 *pCorners,
float fNear, float fFar, float fTanHalfFOVX, float fTanHalfFOVY,
const D3DXVECTOR3 &vCamPos, const D3DXVECTOR3 &vCamRight,
const D3DXVECTOR3 &vCamUp, const D3DXVECTOR3 &vCamLook,
float fOverlap)
{
float fNearHalfWidth = fTanHalfFOVX * fNear;
float fNearHalfHeight = fTanHalfFOVY * fNear;
float fFarHalfWidth = fTanHalfFOVX * fFar;
float fFarHalfHeight = fTanHalfFOVY * fFar;
D3DXVECTOR3 vNearCenter = vCamPos + fNear * vCamLook;
D3DXVECTOR3 vFarCenter = vCamPos + fFar * vCamLook;
// Compute eight frustum split corner points
pCorners[0] = vNearCenter + fNearHalfWidth * vCamRight + fNearHalfHeight * vCamUp;
pCorners[1] = vNearCenter + fNearHalfWidth * vCamRight - fNearHalfHeight * vCamUp;
pCorners[2] = vNearCenter - fNearHalfWidth * vCamRight + fNearHalfHeight * vCamUp;
pCorners[3] = vNearCenter - fNearHalfWidth * vCamRight - fNearHalfHeight * vCamUp;
pCorners[4] = vFarCenter + fFarHalfWidth * vCamRight + fFarHalfHeight * vCamUp;
pCorners[5] = vFarCenter + fFarHalfWidth * vCamRight - fFarHalfHeight * vCamUp;
pCorners[6] = vFarCenter - fFarHalfWidth * vCamRight + fFarHalfHeight * vCamUp;
pCorners[7] = vFarCenter - fFarHalfWidth * vCamRight - fFarHalfHeight * vCamUp;
D3DXVECTOR3 vCenter = (vNearCenter + vFarCenter) / 2.0f;
// Apply split overlap scaling
for(int i = 0; i < 8; i++)
pCorners[i] += (pCorners[i] - vCenter) * fOverlap;
}

63
evoke-64k/ev10/PSSM.h Normal file
View File

@@ -0,0 +1,63 @@
#pragma once
/***********************************************************************************/
/** \file PSSM.h
** \brief Header File zur Klasse PSSM
*************************************************************************************
** Autor: Christian Roesch
*************************************************************************************
** _tut nichts_
**
*//*********************************************************************************/
#ifndef _PSSM_H
#define _PSSM_H
// includes
#include <d3dx9.h>
#include <cassert>
// Klassen-Deklaration
extern IDirect3DDevice9* g_d3d_device;
/***********************************************************************************/
/** \brief PSSM _tut nichts_
*************************************************************************************
** Genau genommen _tut dies nichts_
**
*//*********************************************************************************/
class PSSM
{
public:
static const int MaxSplitCount = 16;
void Init();
void UpdateSplits(const D3DXVECTOR3 &vLightDir, const D3DXMATRIX &mView, const D3DXMATRIX &mProj);
int m_iSplitCount;
float m_fRange;
D3DXMATRIX m_ViewMatrices[MaxSplitCount];
D3DXMATRIX m_ProjMatrices[MaxSplitCount];
D3DXVECTOR3 m_ViewPos[MaxSplitCount];
D3DXVECTOR3 m_ViewDir[MaxSplitCount];
private:
void ComputeCornerPoints(D3DXVECTOR3 *pCorners,
float fNear, float fFar, float fFTanHalfFOVX, float fTanHalfFOVY,
const D3DXVECTOR3 &vCamPos, const D3DXVECTOR3 &vCamRight,
const D3DXVECTOR3 &vCamUp, const D3DXVECTOR3 &vCamLook,
float fOverlap);
};
#endif//_PSSM_H
class PSSM;
/************************************************************************************
** Ende der Datei: PSSM.h
************************************************************************************/

View File

@@ -0,0 +1,56 @@
#pragma once
/***********************************************************************************/
/** \file Renderpipe.h
** \brief Header File zur Klasse Renderpipe
*************************************************************************************
** Autor: Christian Roesch
*************************************************************************************
** _tut nichts_
**
*//*********************************************************************************/
#ifndef _Renderpipe_H
#define _Renderpipe_H
// includes
#include <d3dx9.h>
#include <cassert>
// Klassen-Deklaration
extern IDirect3DDevice9* g_d3d_device;
/***********************************************************************************/
/** \brief Renderpipe _tut nichts_
*************************************************************************************
** Genau genommen _tut dies nichts_
**
*//*********************************************************************************/
class Renderpipe
{
public:
static void PrepareRenderTargets(UINT nScreenX, UINT nScreenY, UINT nShadowXY,
D3DMULTISAMPLE_TYPE multiSampleType);
static void PrepareDefaultRenderStates();
static void PrepareShadowRenderStates();
static void PreparePreRenderStates();
static void PrepareFullScreenQuadRenderStates();
static void PrepareWithoutPostProcessing();
static void SimpleRenderPass();
static void RenderPassPostProcessing();
};
#endif//_Renderpipe_H
class Renderpipe;
/************************************************************************************
** Ende der Datei: Renderpipe.h
************************************************************************************/

View File

@@ -0,0 +1,611 @@
#include "defines.h"
#include "Renderpipe.h"
#include "shader.h"
#include "globals.h"
void Renderpipe::PrepareDefaultRenderStates()
{
g_d3d_device->SetRenderState( D3DRS_LIGHTING, TRUE );
g_d3d_device->SetRenderState( D3DRS_ZENABLE, TRUE );
g_d3d_device->SetRenderState( D3DRS_ZWRITEENABLE, FALSE );
g_d3d_device->SetRenderState( D3DRS_MULTISAMPLEANTIALIAS, TRUE );
g_d3d_device->SetRenderState( D3DRS_ALPHATESTENABLE, FALSE );
g_d3d_device->SetRenderState( D3DRS_ALPHABLENDENABLE, FALSE );
g_d3d_device->SetRenderState( D3DRS_CULLMODE, D3DCULL_CCW );
// Laptop FFP Fallback
g_d3d_device->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_DIFFUSE );
g_d3d_device->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_SELECTARG1 );
// Default Texturen
for( int i= 0; i < 6; ++i )
{
g_d3d_device->SetSamplerState( i, D3DSAMP_MINFILTER, D3DTEXF_LINEAR );
g_d3d_device->SetSamplerState( i, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR );
g_d3d_device->SetSamplerState( i, D3DSAMP_MIPFILTER, D3DTEXF_LINEAR );
g_d3d_device->SetSamplerState( i, D3DSAMP_ADDRESSU, D3DTADDRESS_WRAP );
g_d3d_device->SetSamplerState( i, D3DSAMP_ADDRESSV, D3DTADDRESS_WRAP );
g_d3d_device->SetSamplerState( i, D3DSAMP_ADDRESSW, D3DTADDRESS_WRAP );
}
// sampler2D shadowSampler : register(s4);
g_d3d_device->SetSamplerState( 4, D3DSAMP_MINFILTER, D3DTEXF_LINEAR );
g_d3d_device->SetSamplerState( 4, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR );
g_d3d_device->SetSamplerState( 4, D3DSAMP_MIPFILTER, D3DTEXF_LINEAR );
g_d3d_device->SetSamplerState( 4, D3DSAMP_ADDRESSU, D3DTADDRESS_CLAMP );
g_d3d_device->SetSamplerState( 4, D3DSAMP_ADDRESSV, D3DTADDRESS_CLAMP );
g_d3d_device->SetTexture( 4, g_pFullScreenRT[ RT_AUX2 ] );
// sampler2D depthSampler : register(s5);
g_d3d_device->SetSamplerState( 5, D3DSAMP_MINFILTER, D3DTEXF_LINEAR );
g_d3d_device->SetSamplerState( 5, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR );
g_d3d_device->SetSamplerState( 5, D3DSAMP_MIPFILTER, D3DTEXF_LINEAR );
g_d3d_device->SetSamplerState( 5, D3DSAMP_ADDRESSU, D3DTADDRESS_CLAMP );
g_d3d_device->SetSamplerState( 5, D3DSAMP_ADDRESSV, D3DTADDRESS_CLAMP );
g_d3d_device->SetTexture( 5, g_pFullScreenRT[ RT_DEPTH ] );
g_d3d_device->SetTexture( 0, NULL );
g_d3d_device->SetTexture( 1, NULL );
g_d3d_device->SetTexture( 2, g_pTextures[ TI_Light1D ].GetPointer() );
g_d3d_device->SetSamplerState( 2, D3DSAMP_ADDRESSU, D3DTADDRESS_CLAMP );
g_d3d_device->SetTexture( 3, g_pTextures[ TI_LightSpec1D ].GetPointer() );
g_d3d_device->SetSamplerState( 3, D3DSAMP_ADDRESSU, D3DTADDRESS_CLAMP );
g_d3d_device->SetRenderTarget( 0, g_pFullScreenRTS[ RTS_COLOR_MS ] );
g_d3d_device->SetDepthStencilSurface( g_pFullScreenRTS[ RTS_DEFAULT_DS ] );
}
void Renderpipe::PrepareWithoutPostProcessing()
{
g_d3d_device->SetRenderTarget( 0, g_pFullScreenRTS[ RTS_AUX2 ] );
g_d3d_device->Clear( 0, NULL, D3DCLEAR_TARGET, 0xffffffff, 1.0f, 0 );
PrepareDefaultRenderStates();
g_d3d_device->SetRenderState( D3DRS_LIGHTING, TRUE );
g_d3d_device->SetRenderState( D3DRS_ZENABLE, TRUE );
g_d3d_device->SetRenderState( D3DRS_ZWRITEENABLE, TRUE );
g_d3d_device->SetRenderTarget( 0, g_pFullScreenRTS[ RTS_COLOR_MS ] );
g_d3d_device->SetDepthStencilSurface( g_pFullScreenRTS[ RTS_DEFAULT_DS ] );
}
void Renderpipe::PrepareShadowRenderStates()
{
g_d3d_device->SetRenderState( D3DRS_LIGHTING, FALSE );
g_d3d_device->SetRenderState( D3DRS_ZENABLE, TRUE );
g_d3d_device->SetRenderState( D3DRS_ZWRITEENABLE, TRUE );
g_d3d_device->SetRenderState( D3DRS_MULTISAMPLEANTIALIAS, FALSE );
g_d3d_device->SetRenderState( D3DRS_ALPHATESTENABLE, FALSE );
g_d3d_device->SetRenderState( D3DRS_ALPHABLENDENABLE, FALSE );
g_d3d_device->SetRenderState( D3DRS_CULLMODE, D3DCULL_CCW );
for( int i= 0; i < 8; ++i )
{
g_d3d_device->SetTexture( i, NULL );
}
g_d3d_device->SetRenderTarget( 0, g_pFullScreenRTS[ RTS_SHADOW ] );
g_d3d_device->SetDepthStencilSurface( g_pFullScreenRTS[ RTS_SHADOW_DS ] );
}
void Renderpipe::PreparePreRenderStates()
{
g_d3d_device->SetRenderState( D3DRS_LIGHTING, FALSE );
g_d3d_device->SetRenderState( D3DRS_ZENABLE, TRUE );
g_d3d_device->SetRenderState( D3DRS_ZWRITEENABLE, TRUE );
g_d3d_device->SetRenderState( D3DRS_MULTISAMPLEANTIALIAS, TRUE );
g_d3d_device->SetRenderState( D3DRS_ALPHATESTENABLE, FALSE );
g_d3d_device->SetRenderState( D3DRS_ALPHABLENDENABLE, FALSE );
g_d3d_device->SetRenderState( D3DRS_CULLMODE, D3DCULL_CCW );
for( int i= 0; i < 8; ++i )
{
g_d3d_device->SetTexture( i, NULL );
}
g_d3d_device->SetRenderTarget( 0, g_pFullScreenRTS[ RTS_DEPTH_MS ] );
g_d3d_device->SetDepthStencilSurface( g_pFullScreenRTS[ RTS_DEFAULT_DS ] );
}
void Renderpipe::PrepareFullScreenQuadRenderStates()
{
g_d3d_device->SetRenderState( D3DRS_LIGHTING, FALSE );
g_d3d_device->SetRenderState( D3DRS_ZENABLE, FALSE );
g_d3d_device->SetRenderState( D3DRS_MULTISAMPLEANTIALIAS, FALSE );
g_d3d_device->SetRenderState( D3DRS_ALPHATESTENABLE, FALSE );
g_d3d_device->SetRenderState( D3DRS_ALPHABLENDENABLE, FALSE );
g_d3d_device->SetRenderState( D3DRS_CULLMODE, D3DCULL_NONE );
g_d3d_device->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE );
g_d3d_device->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_SELECTARG1 );
// sampler2D colorSampler : register(s0);
g_d3d_device->SetSamplerState( 0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR );
g_d3d_device->SetSamplerState( 0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR );
g_d3d_device->SetSamplerState( 0, D3DSAMP_MIPFILTER, D3DTEXF_LINEAR );
g_d3d_device->SetSamplerState( 0, D3DSAMP_ADDRESSU, D3DTADDRESS_CLAMP );
g_d3d_device->SetSamplerState( 0, D3DSAMP_ADDRESSV, D3DTADDRESS_CLAMP );
g_d3d_device->SetTexture( 0, g_pFullScreenRT[ RT_COLOR ] );
// sampler2D depthSampler : register(s1);
g_d3d_device->SetSamplerState( 1, D3DSAMP_MINFILTER, D3DTEXF_LINEAR );
g_d3d_device->SetSamplerState( 1, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR );
g_d3d_device->SetSamplerState( 1, D3DSAMP_MIPFILTER, D3DTEXF_LINEAR );
g_d3d_device->SetSamplerState( 1, D3DSAMP_ADDRESSU, D3DTADDRESS_CLAMP );
g_d3d_device->SetSamplerState( 1, D3DSAMP_ADDRESSV, D3DTADDRESS_CLAMP );
g_d3d_device->SetTexture( 1, g_pFullScreenRT[ RT_DEPTH ] );
// sampler2D ditherSampler : register(s2);
g_d3d_device->SetSamplerState( 2, D3DSAMP_MINFILTER, D3DTEXF_POINT );
g_d3d_device->SetSamplerState( 2, D3DSAMP_MAGFILTER, D3DTEXF_POINT );
g_d3d_device->SetSamplerState( 2, D3DSAMP_MIPFILTER, D3DTEXF_POINT );
g_d3d_device->SetSamplerState( 2, D3DSAMP_ADDRESSU, D3DTADDRESS_WRAP );
g_d3d_device->SetSamplerState( 2, D3DSAMP_ADDRESSV, D3DTADDRESS_WRAP );
g_d3d_device->SetTexture( 2, g_pTextures[ TI_RotMatrix ].GetPointer() );
// sampler2D mySampler1 : register(s3);
g_d3d_device->SetSamplerState( 3, D3DSAMP_MINFILTER, D3DTEXF_LINEAR );
g_d3d_device->SetSamplerState( 3, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR );
g_d3d_device->SetSamplerState( 3, D3DSAMP_MIPFILTER, D3DTEXF_LINEAR );
g_d3d_device->SetSamplerState( 3, D3DSAMP_ADDRESSU, D3DTADDRESS_CLAMP );
g_d3d_device->SetSamplerState( 3, D3DSAMP_ADDRESSV, D3DTADDRESS_CLAMP );
g_d3d_device->SetTexture( 3, NULL );
// sampler2D mySampler2 : register(s4);
g_d3d_device->SetSamplerState( 4, D3DSAMP_MINFILTER, D3DTEXF_LINEAR );
g_d3d_device->SetSamplerState( 4, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR );
g_d3d_device->SetSamplerState( 4, D3DSAMP_MIPFILTER, D3DTEXF_LINEAR );
g_d3d_device->SetSamplerState( 4, D3DSAMP_ADDRESSU, D3DTADDRESS_CLAMP );
g_d3d_device->SetSamplerState( 4, D3DSAMP_ADDRESSV, D3DTADDRESS_CLAMP );
g_d3d_device->SetTexture( 4, NULL );
g_d3d_device->SetRenderTarget( 0, g_pFullScreenRTS[ RTS_COLOR_MS ] );
g_d3d_device->SetDepthStencilSurface( NULL );
}
void Renderpipe::PrepareRenderTargets(UINT nScreenX, UINT nScreenY, UINT nShadowXY, D3DMULTISAMPLE_TYPE multiSampleType)
{
// RTs erzeugen
g_d3d_device->CreateTexture( nScreenX,
nScreenY,
1,
D3DUSAGE_RENDERTARGET,
D3DFMT_R32F,
D3DPOOL_DEFAULT,
&(g_pFullScreenRT[ RT_DEPTH ]),
NULL);
g_d3d_device->CreateTexture( nScreenX,
nScreenY,
1,
D3DUSAGE_RENDERTARGET,
D3DFMT_A8R8G8B8,
D3DPOOL_DEFAULT,
&(g_pFullScreenRT[ RT_COLOR ]),
NULL);
g_d3d_device->CreateTexture( nScreenX,
nScreenY,
0,
D3DUSAGE_RENDERTARGET | D3DUSAGE_AUTOGENMIPMAP,
D3DFMT_A8R8G8B8,
D3DPOOL_DEFAULT,
&(g_pFullScreenRT[ RT_AUX1 ]),
NULL);
g_d3d_device->CreateTexture( nScreenX,
nScreenY,
1,
D3DUSAGE_RENDERTARGET,
D3DFMT_A8R8G8B8,
D3DPOOL_DEFAULT,
&(g_pFullScreenRT[ RT_AUX2 ]),
NULL);
g_d3d_device->CreateTexture( nShadowXY,
nShadowXY,
1,
D3DUSAGE_RENDERTARGET,
D3DFMT_R32F,
D3DPOOL_DEFAULT,
&(g_pFullScreenRT[ RT_SHADOW ]),
NULL);
// Multi-sampled depth surface erzeugen
g_d3d_device->CreateRenderTarget( nScreenX,
nScreenY,
D3DFMT_R32F,
multiSampleType,
0,
FALSE,
&(g_pFullScreenRTS[ RTS_DEPTH_MS ]),
NULL);
// Back Buffer holen
g_d3d_device->GetRenderTarget( 0, &(g_pFullScreenRTS[ RTS_COLOR_MS ]) );
// Depth-stencil Buffer holen
g_d3d_device->GetDepthStencilSurface( &(g_pFullScreenRTS[ RTS_DEFAULT_DS ]) );
// Non-multi-sampled depth-stencil surface erzeugen
g_d3d_device->CreateDepthStencilSurface( nShadowXY,
nShadowXY,
D3DFMT_D24S8,
D3DMULTISAMPLE_NONE,
0,
TRUE,
&(g_pFullScreenRTS[ RTS_SHADOW_DS ]),
NULL);
// Texture Surfaces holen
if( g_pFullScreenRT[ RT_DEPTH ] != NULL )
{
g_pFullScreenRT[ RT_DEPTH ]->GetSurfaceLevel( 0, &(g_pFullScreenRTS[ RTS_DEPTH ]) );
}
if( g_pFullScreenRT[ RT_COLOR ] != NULL )
{
g_pFullScreenRT[ RT_COLOR ]->GetSurfaceLevel( 0, &(g_pFullScreenRTS[ RTS_COLOR ]) );
}
if( g_pFullScreenRT[ RT_AUX1 ] != NULL )
{
g_pFullScreenRT[ RT_AUX1 ]->GetSurfaceLevel( 0, &(g_pFullScreenRTS[ RTS_AUX1 ]) );
}
if( g_pFullScreenRT[ RT_AUX2 ] != NULL )
{
g_pFullScreenRT[ RT_AUX2 ]->GetSurfaceLevel( 0, &(g_pFullScreenRTS[ RTS_AUX2 ]) );
}
if( g_pFullScreenRT[ RT_SHADOW ] != NULL )
{
g_pFullScreenRT[ RT_SHADOW ]->GetSurfaceLevel( 0, &(g_pFullScreenRTS[ RTS_SHADOW ]) );
}
}
void Renderpipe::SimpleRenderPass()
{
/***********************************************************************************/
// Renderdurchlauf ohne Postprocessing
//normale Renderstati
Renderpipe::PrepareWithoutPostProcessing();
// Bildschirm loeschen
g_d3d_device->Clear( 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0xff20b0f0, 1.0f, 0 );
//alle Renderpipes ausfueheren mit normalen Renderstati
for( int i= 0; i < ObjectCount; i++ )
{
g_Objects[ i ].Render();
}
g_SkyBox.RenderSky();
}
void Renderpipe::RenderPassPostProcessing()
{
/***********************************************************************************/
// vorbereitender Renderdurchlauf
//Pre-pass Renderstati
Renderpipe::PreparePreRenderStates();
// Bildschirm loeschen
g_d3d_device->Clear( 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0, 1.0f, 0 );
//alle Renderpipes ausfueheren mit pre-pass Renderstati
for( int i= 0; i < ObjectCount; i++ )
{
g_Objects[ i ].PreRender();
}
g_SkyBox.RenderSkyDepth();
// Tiefe in Textur kopieren
g_d3d_device->StretchRect( g_pFullScreenRTS[ RTS_DEPTH_MS ], NULL,
g_pFullScreenRTS[ RTS_DEPTH ], NULL, D3DTEXF_NONE );
/***********************************************************************************/
// Schatten-Renderdurchlauf
// Schatten löschen
g_d3d_device->SetRenderTarget( 0, g_pFullScreenRTS[ RTS_AUX2 ] );
g_d3d_device->Clear( 0, NULL, D3DCLEAR_TARGET, 0xffffffff, 1.0f, 0 );
// Shadow splits rendern
for(int iSplit = g_PSSM.m_iSplitCount; iSplit-- > 0; )
{
// Backup scene view-proj matrix
D3DXMATRIX matSceneVP;
memcpy( &matSceneVP, &g_matVP, sizeof(D3DXMATRIX) );
D3DXMATRIX matSplitVP;
float float4Vec[4];
//[VS] float4x4 matWVP : register(c0);
D3DXMatrixMultiply( &g_matVP, &g_PSSM.m_ViewMatrices[iSplit], &g_PSSM.m_ProjMatrices[iSplit] );
D3DXMatrixTranspose( &matSplitVP, &g_matVP );
memcpy( &g_matWVP, &matSplitVP, sizeof(D3DXMATRIX) );
g_d3d_device->SetVertexShaderConstantF( 0, (float*)&g_matWVP, 4 );
//[VS] float3 viewPos : register(c4);
//[PS] float3 viewPos : register(c2);
memcpy(float4Vec, &g_PSSM.m_ViewPos[iSplit], sizeof(float)*3);
g_d3d_device->SetVertexShaderConstantF( 4, float4Vec, 1 );
g_d3d_device->SetPixelShaderConstantF( 2, float4Vec, 1 );
//[VS] float3 viewDir : register(c10);
memcpy(float4Vec, &g_PSSM.m_ViewDir[iSplit], sizeof(float)*3);
g_d3d_device->SetVertexShaderConstantF( 10, float4Vec, 1 );
//Shadow-pass Renderstati
Renderpipe::PrepareShadowRenderStates();
// Schattentiefen loeschen
g_d3d_device->Clear( 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0, 1.0f, 0 );
//alle Renderpipes ausfueheren mit pre-pass Renderstati
for( int i= 0; i < ObjectCount; i++ )
{
g_Objects[ i ].PreRender();
}
// Pre-processing beginnen
Renderpipe::PrepareFullScreenQuadRenderStates();
//[VS] float4x4 matWVP : register(c0);
memcpy( &g_matVP, &matSceneVP, sizeof(D3DXMATRIX) );
D3DXMatrixTranspose( &g_matWVP, &g_matVP );
g_d3d_device->SetVertexShaderConstantF( 0, (float*)&g_matWVP, 4 );
//[VS] float3 viewPos : register(c4);
//[PS] float3 viewPos : register(c2);
memcpy(float4Vec, &g_Camera.m_vec3Pos, sizeof(float)*3);
g_d3d_device->SetVertexShaderConstantF( 4, float4Vec, 1 );
g_d3d_device->SetPixelShaderConstantF( 2, float4Vec, 1 );
//[VS] float3 viewDir : register(c10);
memcpy(float4Vec, &g_CamFront, sizeof(float)*3);
g_d3d_device->SetVertexShaderConstantF( 10, float4Vec, 1 );
//[PS] float split : register(c23);
float4Vec[0] = (float)iSplit;
g_d3d_device->SetPixelShaderConstantF( 23, float4Vec, 1 );
//[PS] float4x4 shadowVP : register(c24);
g_d3d_device->SetPixelShaderConstantF( 24, (float*)&matSplitVP, 4 );
//[PS] float2 shadowDepthOffsetScalingInverses : register(c28);
// float4Vec[0] = -g_PSSM.m_ProjMatrices[iSplit]._43;
// float4Vec[1] = 1.0f / g_PSSM.m_ProjMatrices[iSplit]._33;
// g_d3d_device->SetPixelShaderConstantF( 28, float4Vec, 1 );
//[PS] float3 g_vShadowViewPos : register(c28);
memcpy(float4Vec, &g_PSSM.m_ViewPos[iSplit], sizeof(float)*3);
g_d3d_device->SetPixelShaderConstantF( 28, float4Vec, 1 );
//[PS] float3 g_vShadowViewDir : register(c29);
memcpy(float4Vec, &g_PSSM.m_ViewDir[iSplit], sizeof(float)*3);
g_d3d_device->SetPixelShaderConstantF( 29, float4Vec, 1 );
//[PS] float2 shadowMapScaling : register(c30);
float4Vec[0] = g_PSSM.m_ProjMatrices[iSplit]._11 / 2.0f;
float4Vec[1] = g_PSSM.m_ProjMatrices[iSplit]._22 / 2.0f;
float4Vec[2] = (float)g_nShadowResolution;
float4Vec[3] = (float)g_nShadowResolution;
g_d3d_device->SetPixelShaderConstantF( 30, float4Vec, 1 );
// Shadow split auf die Szene projezieren
g_d3d_device->SetRenderTarget( 0, g_pFullScreenRTS[ RTS_AUX2 ] );
g_d3d_device->SetTexture( 0, g_pFullScreenRT[ RT_SHADOW ] );
g_FullScreenQuad.m_iUsedShader[0] = PSSM_Proj;
g_FullScreenQuad.Render();
}
// Pre-processing beginnen
Renderpipe::PrepareFullScreenQuadRenderStates();
g_d3d_device->SetRenderTarget( 0, g_pFullScreenRTS[ RTS_AUX1 ] );
g_d3d_device->SetTexture( 0, g_pFullScreenRT[ RT_AUX2 ] );
g_FullScreenQuad.m_iUsedShader[0] = SSAO_BlurH;
g_FullScreenQuad.Render();
g_d3d_device->SetRenderTarget( 0, g_pFullScreenRTS[ RTS_AUX2 ] );
g_d3d_device->SetTexture( 0, g_pFullScreenRT[ RT_AUX1 ] );
g_FullScreenQuad.m_iUsedShader[0] = SSAO_BlurV;
g_FullScreenQuad.Render();
/***********************************************************************************/
// normaler Renderdurchlauf
//normale Renderstati
Renderpipe::PrepareDefaultRenderStates();
// Bildschirm loeschen
g_d3d_device->Clear( 0, NULL, D3DCLEAR_TARGET , 0xff20b0f0, 1.0f, 0 );
//alle Renderpipes ausfueheren mit normalen Renderstati
for( int i= 0; i < ObjectCount; i++ )
{
g_Objects[ i ].Render();
}
g_SkyBox.RenderSky();
// Farbe in Textur kopieren
g_d3d_device->StretchRect( g_pFullScreenRTS[ RTS_COLOR_MS ], NULL,
g_pFullScreenRTS[ RTS_COLOR ], NULL, D3DTEXF_NONE );
// Post-processing beginnen
Renderpipe::PrepareFullScreenQuadRenderStates();
#ifndef DISABLEDOF
bool bDOFEnabled = (g_Camera.m_fDOF >= 0.0f);
#else
bool bDOFEnabled = false;
#endif
float float4Vec[4];
// SSAO
g_d3d_device->SetRenderTarget( 0, g_pFullScreenRTS[ RTS_AUX1 ] );
g_FullScreenQuad.m_iUsedShader[0] = SSAO;
g_FullScreenQuad.Render();
g_d3d_device->SetRenderTarget( 0, g_pFullScreenRTS[ RTS_AUX2 ] );
g_d3d_device->SetTexture( 0, g_pFullScreenRT[ RT_AUX1 ] );
g_FullScreenQuad.m_iUsedShader[0] = SSAO_BlurH;
g_FullScreenQuad.Render();
g_d3d_device->SetRenderTarget( 0, g_pFullScreenRTS[ bDOFEnabled ? RTS_COLOR : RTS_COLOR_MS ] );
g_d3d_device->SetTexture( 0, g_pFullScreenRT[ RT_AUX2 ] );
g_FullScreenQuad.m_bAlphaEnable[0] = true;
g_FullScreenQuad.m_SrcBlend[0] = D3DBLEND_DESTCOLOR;
g_FullScreenQuad.m_DestBlend[0] = D3DBLEND_ONE;
g_FullScreenQuad.m_BlendOp[0] = D3DBLENDOP_REVSUBTRACT;
g_FullScreenQuad.m_iUsedShader[0] = SSAO_BlurV;
g_FullScreenQuad.Render();
g_FullScreenQuad.m_bAlphaEnable[0] = false;
// Glow
g_d3d_device->SetRenderTarget( 0, g_pFullScreenRTS[ RTS_AUX1 ] );
g_d3d_device->SetTexture( 0, g_pFullScreenRT[ RT_COLOR ] );
g_FullScreenQuad.m_iUsedShader[0] = Extract_InvAlpha;
g_FullScreenQuad.Render();
const int iNumGlowPasses = 3;
const int iGlowDownsampling = max(2 + g_iResolutionFactorExp, 0);
// Blur
{
float4Vec[0] = g_fGlow;
float4Vec[1] = g_fGlow;
float4Vec[2] = g_fGlow;
float4Vec[3] = g_fGlow;
g_d3d_device->SetPixelShaderConstantF( 31, float4Vec, 1 );
}
for(int iPass = 0; iPass < iNumGlowPasses; iPass++)
{
g_d3d_device->SetRenderTarget( 0, g_pFullScreenRTS[ RTS_AUX2 ] );
g_d3d_device->SetTexture( 0, g_pFullScreenRT[ RT_AUX1 ] );
float4Vec[0] = d3dpp.BackBufferWidth / (float)(1 << iGlowDownsampling);
float4Vec[1] = d3dpp.BackBufferHeight / (float)(1 << iGlowDownsampling);
float4Vec[2] = 1.f / float4Vec[0];
float4Vec[3] = 1.f / float4Vec[1];
g_d3d_device->SetPixelShaderConstantF( 0, float4Vec, 1 );
if(iPass == 0)
{
float4Vec[0] = (float)iGlowDownsampling;
g_d3d_device->SetSamplerState( 0, D3DSAMP_MIPMAPLODBIAS, *((DWORD*)float4Vec) );
}
g_FullScreenQuad.m_iUsedShader[0] = BlurH;
g_FullScreenQuad.Render();
float4Vec[0] = 0.0f;
g_d3d_device->SetSamplerState( 0, D3DSAMP_MIPMAPLODBIAS, *((DWORD*)float4Vec) );
// Redirect last pass to screen
if(iPass == iNumGlowPasses - 1)
{
g_d3d_device->SetRenderTarget( 0, g_pFullScreenRTS[ bDOFEnabled ? RTS_COLOR : RTS_COLOR_MS ] );
g_FullScreenQuad.m_bAlphaEnable[0] = true;
g_FullScreenQuad.m_SrcBlend[0] = D3DBLEND_ONE;
g_FullScreenQuad.m_DestBlend[0] = D3DBLEND_ONE;
g_FullScreenQuad.m_BlendOp[0] = D3DBLENDOP_ADD;
}
else
g_d3d_device->SetRenderTarget( 0, g_pFullScreenRTS[ RTS_AUX1 ] );
g_d3d_device->SetTexture( 0, g_pFullScreenRT[ RT_AUX2 ] );
g_FullScreenQuad.m_iUsedShader[0] = BlurV;
g_FullScreenQuad.Render();
g_FullScreenQuad.m_bAlphaEnable[0] = false;
float4Vec[0] = (float)d3dpp.BackBufferWidth;
float4Vec[1] = (float)d3dpp.BackBufferHeight;
float4Vec[2] = 1.f / float4Vec[0];
float4Vec[3] = 1.f / float4Vec[1];
g_d3d_device->SetPixelShaderConstantF( 0, float4Vec, 1 );
}
// Ray
#ifndef DISABLERAY
g_d3d_device->SetRenderTarget( 0, g_pFullScreenRTS[ RTS_AUX1 ] );
g_d3d_device->SetTexture( 0, NULL );
g_FullScreenQuad.m_iUsedShader[0] = Ray_Mask;
g_FullScreenQuad.Render();
const int iNumRayPasses = 4;
// Extrude rays
for(int iPass = 0; iPass < iNumRayPasses; iPass++)
{
//[PS] float passID2exp : register(c23);
float4Vec[0] = (float)iPass;
float4Vec[1] = (float)(1 << iPass);
float4Vec[2] = (float)(iPass == iNumRayPasses - 1);
g_d3d_device->SetPixelShaderConstantF( 23, float4Vec, 1 );
// Redirect last pass to screen
if(iPass == iNumRayPasses - 1)
{
g_d3d_device->SetRenderTarget( 0, g_pFullScreenRTS[ bDOFEnabled ? RTS_COLOR : RTS_COLOR_MS ] );
g_FullScreenQuad.m_bAlphaEnable[0] = true;
g_FullScreenQuad.m_SrcBlend[0] = D3DBLEND_ONE;
g_FullScreenQuad.m_DestBlend[0] = D3DBLEND_ONE;
g_FullScreenQuad.m_BlendOp[0] = D3DBLENDOP_ADD;
}
else
g_d3d_device->SetRenderTarget( 0, g_pFullScreenRTS[ (iPass % 2 == 0) ? RTS_AUX2 : RTS_AUX1 ] );
g_d3d_device->SetTexture( 0, g_pFullScreenRT[ (iPass % 2 == 0) ? RT_AUX1 : RT_AUX2 ] );
g_FullScreenQuad.m_iUsedShader[0] = Ray_Extrude;
g_FullScreenQuad.Render();
g_FullScreenQuad.m_bAlphaEnable[0] = false;
}
#endif
// DOF
if(bDOFEnabled)
{
const int iDOFDownsampling = max(2 + g_iResolutionFactorExp, 0);
g_d3d_device->SetRenderTarget( 0, g_pFullScreenRTS[ RTS_AUX1 ] );
g_d3d_device->SetTexture( 0, g_pFullScreenRT[ RT_COLOR ] );
g_FullScreenQuad.m_iUsedShader[0] = DOF_Intensity;
g_FullScreenQuad.Render();
g_d3d_device->SetRenderTarget( 0, g_pFullScreenRTS[ RTS_AUX2 ] );
g_d3d_device->SetTexture( 0, g_pFullScreenRT[ RT_AUX1 ] );
g_d3d_device->SetTexture( 4, g_pFullScreenRT[ RT_AUX1 ] );
float4Vec[0] = d3dpp.BackBufferWidth / (float)(1 << iDOFDownsampling);
float4Vec[1] = d3dpp.BackBufferHeight / (float)(1 << iDOFDownsampling);
float4Vec[2] = 1.f / float4Vec[0];
float4Vec[3] = 1.f / float4Vec[1];
g_d3d_device->SetPixelShaderConstantF( 0, float4Vec, 1 );
float4Vec[0] = (float)iDOFDownsampling;
g_d3d_device->SetSamplerState( 0, D3DSAMP_MIPMAPLODBIAS, *((DWORD*)float4Vec) );
g_FullScreenQuad.m_iUsedShader[0] = BlurBilH;
g_FullScreenQuad.Render();
float4Vec[0] = 0.0f;
g_d3d_device->SetSamplerState( 0, D3DSAMP_MIPMAPLODBIAS, *((DWORD*)float4Vec) );
g_d3d_device->SetRenderTarget( 0, g_pFullScreenRTS[ RTS_COLOR ] );
g_d3d_device->SetTexture( 0, g_pFullScreenRT[ RT_AUX2 ] );
g_d3d_device->SetTexture( 4, g_pFullScreenRT[ RT_AUX1 ] );
g_FullScreenQuad.m_iUsedShader[0] = BlurBilV;
g_FullScreenQuad.Render();
float4Vec[0] = (float)d3dpp.BackBufferWidth;
float4Vec[1] = (float)d3dpp.BackBufferHeight;
float4Vec[2] = 1.f / float4Vec[0];
float4Vec[3] = 1.f / float4Vec[1];
g_d3d_device->SetPixelShaderConstantF( 0, float4Vec, 1 );
g_d3d_device->SetRenderTarget( 0, g_pFullScreenRTS[ RTS_COLOR_MS ] );
g_d3d_device->SetTexture( 0, g_pFullScreenRT[ RT_AUX1 ] );
g_d3d_device->SetTexture( 4, g_pFullScreenRT[ RT_COLOR ] );
g_FullScreenQuad.m_iUsedShader[0] = DOF;
g_FullScreenQuad.Render();
}
}

252
evoke-64k/ev10/Shader.cpp Normal file
View File

@@ -0,0 +1,252 @@
#include "defines.h"
#include "shader.h"
#include "globals.h"
void Shader::Init()
{
m_pVSShader= NULL;
m_pPSShader= NULL;
// per default Texturen einfach lassen wie sie sind
m_iUsedTextureStageCount= -1;
for( int i= 0; i < m_iMaxTextureStageCount; ++i )
{
m_iTextureIndices[ i ]= TI_IgnoreSetting;
m_iTextureSettings[ i ]= TI_IgnoreSetting;
}
}
void Shader::DeInit()
{
Release();
}
void Shader::Release()
{
if( m_pVSShader != NULL )
{
m_pVSShader->Release();
m_pVSShader= NULL;
}
if( m_pPSShader != NULL )
{
m_pPSShader->Release();
m_pPSShader= NULL;
}
}
void Shader::CompileVS(const char* pShaderCode, const char* pEntryPoint )
{
#ifdef EXTRACODE
std::string strCurrentCode( pShaderCode );
if( strCurrentCode == m_strVSCode )
{
return;
}
m_strVSCode= strCurrentCode;
#endif
ID3DXBuffer* tmp= NULL;
#if LAPTOPMODE == 1
Compile( pShaderCode, pEntryPoint, "vs_2_0", &tmp );
#else
Compile( pShaderCode, pEntryPoint, "vs_3_0", &tmp );
#endif
if( tmp == NULL )
{
return;
}
g_d3d_device->CreateVertexShader( (DWORD*)tmp->GetBufferPointer(), &m_pVSShader );
tmp->Release();
}
void Shader::CompilePS(const char* pShaderCode, const char* pEntryPoint )
{
#ifdef EXTRACODE
std::string strCurrentCode( pShaderCode );
if( strCurrentCode == m_strPSCode )
{
return;
}
m_strPSCode= strCurrentCode;
#endif
ID3DXBuffer* tmp= NULL;
#if LAPTOPMODE == 1
Compile( pShaderCode, pEntryPoint, "ps_2_0", &tmp );
#else
Compile( pShaderCode, pEntryPoint, "ps_3_0", &tmp );
#endif
if( tmp == NULL )
{
return;
}
g_d3d_device->CreatePixelShader( (DWORD*)tmp->GetBufferPointer(), &m_pPSShader );
tmp->Release();
}
void Shader::Compile( const char* pShaderCode, const char* pEntryPoint, const char* ShaderModel, ID3DXBuffer** tmp )
{
int iLength= 0;
while(pShaderCode[ iLength ] != 0 )
{
iLength++;
}
#ifndef _DEBUG
D3DXCompileShader( pShaderCode, iLength, 0, 0, pEntryPoint, ShaderModel, D3DXSHADER_OPTIMIZATION_LEVEL3|D3DXSHADER_PREFER_FLOW_CONTROL, tmp, 0, 0 );
#else
ID3DXBuffer *errors;
if( D3DXCompileShader( pShaderCode, iLength, 0, 0, pEntryPoint, ShaderModel, D3DXSHADER_DEBUG*0+1*(D3DXSHADER_OPTIMIZATION_LEVEL3|D3DXSHADER_PREFER_FLOW_CONTROL), tmp, &errors, 0 ) <0 )
{
OutputDebugString( "Error in D3DXCompileShader:\n" );
OutputDebugString( pShaderCode );
OutputDebugString( "\n" );
OutputDebugString( (char*)errors->GetBufferPointer() );
errors->Release();
//assert( false );
return;
}
OutputDebugString( "Shader compiled.\n" );
#endif
}
void Shader::Activate()
{
g_d3d_device->SetPixelShader( m_pPSShader );
g_d3d_device->SetVertexShader( m_pVSShader );
for( int i= 0; i <= m_iUsedTextureStageCount; ++i )
{
if( m_iTextureIndices[ i ] != TI_IgnoreSetting )
{
g_d3d_device->SetTexture(
i,
g_pTextures[ m_iTextureIndices[ i ] ].GetPointer() );
g_d3d_device->SetSamplerState( i, D3DSAMP_ADDRESSU, D3DTADDRESS_WRAP );
g_d3d_device->SetSamplerState( i, D3DSAMP_ADDRESSV, D3DTADDRESS_WRAP );
if( m_iTextureSettings[ i ] == TI_CLAMP )
{
g_d3d_device->SetSamplerState( i, D3DSAMP_ADDRESSU, D3DTADDRESS_CLAMP );
g_d3d_device->SetSamplerState( i, D3DSAMP_ADDRESSV, D3DTADDRESS_CLAMP );
}
}
}
}
void Shader::Deactivate()
{
g_d3d_device->SetPixelShader( NULL );
g_d3d_device->SetVertexShader( NULL );
}
void Shader::SetShaderTransform(const D3DXMATRIX &mWorld, const D3DXMATRIX &mWorldInverse)
{
/***********************************************************************************/
// Konstanten fuer Shader setzen
D3DXMATRIX float4x4Mat;
//[VS] float4x4 matWVP : register(c0);
D3DXMatrixMultiply( &g_matWVP, &mWorld, &g_matVP );
D3DXMatrixTranspose( &g_matWVP, &g_matWVP );
g_d3d_device->SetVertexShaderConstantF( 0, (float*)&g_matWVP, 4 );
//[VS] float4x4 matWorld : register(c12);
D3DXMatrixTranspose( &float4x4Mat, &mWorld );
g_d3d_device->SetVertexShaderConstantF( 12, (float*)&float4x4Mat, 4 );
//[VS] float4x4 matWorldI : register(c16);
D3DXMatrixTranspose( &float4x4Mat, &mWorldInverse );
g_d3d_device->SetVertexShaderConstantF( 16, (float*)&float4x4Mat, 4 );
}
void Shader::SetShaderConstants()
{
/***********************************************************************************/
// Konstanten fuer Shader setzen
float float4Vec[4];
//[VS] float4x4 matWVP : register(c0);
D3DXMatrixMultiply( &g_matVP, &g_matView, &g_matProjection );
D3DXMatrixTranspose( &g_matWVP, &g_matVP );
g_d3d_device->SetVertexShaderConstantF( 0, (float*)&g_matWVP, 4 );
//[VS] float3x3 viewMatrixRotInv : register(c7);
g_d3d_device->SetVertexShaderConstantF( 7, (float*)&g_matView, 3 );
//[VS] float4 projScaleOffsetInv : register(c11);
float4Vec[0] = 1.0f / g_matProjection._11;
float4Vec[1] = 1.0f / g_matProjection._22;
float4Vec[2] = -(g_matProjection._31 + g_matProjection._41) * float4Vec[0];
float4Vec[3] = -(g_matProjection._32 + g_matProjection._42) * float4Vec[1];
g_d3d_device->SetVertexShaderConstantF( 11, float4Vec, 1 );
//[VS] float3 viewPos : register(c4);
//[PS] float3 viewPos : register(c2);
memcpy(float4Vec, &g_Camera.m_vec3Pos, sizeof(float)*3);
g_d3d_device->SetVertexShaderConstantF( 4, float4Vec, 1 );
g_d3d_device->SetPixelShaderConstantF( 2, float4Vec, 1 );
//[VS] float3 viewDir : register(c10);
//[PS] float3 viewDir : register(c4);
memcpy(float4Vec, &g_CamFront, sizeof(float)*3);
g_d3d_device->SetVertexShaderConstantF( 10, float4Vec, 1 );
g_d3d_device->SetPixelShaderConstantF( 4, float4Vec, 1 );
//[VS] float2 res : register(c5);
//[PS] float2 res : register(c0);
float4Vec[0] = (float)d3dpp.BackBufferWidth;
float4Vec[1] = (float)d3dpp.BackBufferHeight;
float4Vec[2] = 1.f / float4Vec[0];
float4Vec[3] = 1.f / float4Vec[1];
g_d3d_device->SetVertexShaderConstantF( 5, float4Vec, 1 );
g_d3d_device->SetPixelShaderConstantF( 0, float4Vec, 1 );
//[VS] float3 lightDir : register(c6);
//[PS] float3 lightDir : register(c1);
memcpy(float4Vec, &g_LightDir, sizeof(float)*3);
g_d3d_device->SetVertexShaderConstantF( 6, float4Vec, 1 );
g_d3d_device->SetPixelShaderConstantF( 1, float4Vec, 1 );
//[PS] float demoTime : register(c3);
float4Vec[0]= 64.0f * (float)g_Camera.m_iDemoTime / (float)g_iCamTickFactor;
float4Vec[1]= g_Camera.m_fDOF * g_Camera.m_fDOF;
float4Vec[2]= 0.0f;//g_fClouds;
float4Vec[3]= 0.0f;//g_fPlasmaGrid;
g_d3d_device->SetPixelShaderConstantF( 3, float4Vec, 1 );
//[PS] float4 glow : register(c31);
{
float4Vec[0] = g_fGlow;
float4Vec[1] = g_fGlow;
float4Vec[2] = g_fGlow;
float4Vec[3] = g_fGlow;
g_d3d_device->SetPixelShaderConstantF( 31, float4Vec, 1 );
}
}
void Shader::SetTextureStageSettings(
int iTextureStage,
int iTextureIndex,
int iTextureSettings )
{
assert( iTextureStage < m_iMaxTextureStageCount );
if( iTextureStage > m_iUsedTextureStageCount )
{
m_iUsedTextureStageCount= iTextureStage;
}
m_iTextureIndices[ iTextureStage ]= iTextureIndex;
m_iTextureSettings[ iTextureStage ]= iTextureSettings;
}

View File

View File

@@ -0,0 +1,114 @@
#pragma once
#include "globals.h"
#include "shader.h"
// --> Neuen Shader hinzufuegen:
//
// in globals.h und globals.cpp ein neues Char Array fuer den Quellcode des Shader anlegen
// in globals.h das Enum ShaderIndices erweitern
// eine Datei im cfg Verzeichnis anlegen, die diesen Shader enthaelt
// in ConfigFiles.cpp die Funktion ReadShaders() erweitern, damit die Datei in das Array eingelesen wird
// den Shader in PrepareShaders compilieren
void RenderLoading( int iPercent );
void PrepareShaders()
{
//Postprocessing Zeug
g_Shaders[ PreDepth ].CompileVS(g_ShaderVSGeneral, "vs_main" );
g_Shaders[ PreDepth ].CompilePS(g_ShaderPSDepth, "ps_main" );
int iPer= 5;
int iAdd= 5;
RenderLoading( iPer );
g_Shaders[ PSSM_Proj ].CompileVS(g_ShaderVSFSQuad, "vs_main" );
g_Shaders[ PSSM_Proj ].CompilePS(g_ShaderPSPSSM, "ps_main" );
iPer+=iAdd;
RenderLoading( iPer );
g_Shaders[ SSAO ].CompileVS(g_ShaderVSFSQuad, "vs_main" );
g_Shaders[ SSAO ].CompilePS(g_ShaderPSAmbOcc, "ps_main" );
iPer+=iAdd;
RenderLoading( iPer );
g_Shaders[ SSAO_BlurH ].CompileVS(g_ShaderVSFSQuad, "vs_main" );
g_Shaders[ SSAO_BlurH ].CompilePS(g_ShaderPSAmbOcc, "ps_blur_hor" );
g_Shaders[ SSAO_BlurV ].CompileVS(g_ShaderVSFSQuad, "vs_main" );
g_Shaders[ SSAO_BlurV ].CompilePS(g_ShaderPSAmbOcc, "ps_blur_ver" );
iPer+=iAdd;
RenderLoading( iPer );
g_Shaders[ DOF_Intensity ].CompileVS(g_ShaderVSFSQuad, "vs_main" );
g_Shaders[ DOF_Intensity ].CompilePS(g_ShaderPSDOF, "ps_blur_intensity" );
g_Shaders[ DOF ].CompileVS(g_ShaderVSFSQuad, "vs_main" );
g_Shaders[ DOF ].CompilePS(g_ShaderPSDOF, "ps_main" );
g_Shaders[ BlurBilH ].CompileVS(g_ShaderVSFSQuad, "vs_main" );
g_Shaders[ BlurBilH ].CompilePS(g_ShaderPSBlur, "ps_blur_bil_hor" );
g_Shaders[ BlurBilV ].CompileVS(g_ShaderVSFSQuad, "vs_main" );
g_Shaders[ BlurBilV ].CompilePS(g_ShaderPSBlur, "ps_blur_bil_ver" );
iPer+=iAdd;
RenderLoading( iPer );
g_Shaders[ Ray_Mask ].CompileVS(g_ShaderVSFSQuad, "vs_main" );
g_Shaders[ Ray_Mask ].CompilePS(g_ShaderPSRay, "ps_ray_mask" );
g_Shaders[ Ray_Extrude ].CompileVS(g_ShaderVSFSQuad, "vs_main" );
g_Shaders[ Ray_Extrude ].CompilePS(g_ShaderPSRay, "ps_ray_extrude" );
g_Shaders[ Extract_InvAlpha ].CompileVS(g_ShaderVSFSQuad, "vs_main" );
g_Shaders[ Extract_InvAlpha ].CompilePS(g_ShaderPSBlur, "ps_extract_inv_alpha" );
g_Shaders[ BlurH ].CompileVS(g_ShaderVSFSQuad, "vs_main" );
g_Shaders[ BlurH ].CompilePS(g_ShaderPSBlur, "ps_blur_hor" );
g_Shaders[ BlurV ].CompileVS(g_ShaderVSFSQuad, "vs_main" );
g_Shaders[ BlurV ].CompilePS(g_ShaderPSBlur, "ps_blur_ver" );
iPer+=iAdd;
RenderLoading( iPer );
// Shader fuer Objekte
g_Shaders[ Phong ].CompileVS(g_ShaderVSGeneral, "vs_main" );
g_Shaders[ Phong ].CompilePS(g_ShaderPSPhong, "ps_main" );
g_Shaders[ Rainbow ].CompileVS(g_ShaderVSGeneral, "vs_main" );
g_Shaders[ Rainbow ].CompilePS(g_ShaderPSRainbow, "ps_main" );
g_Shaders[ Rainbow ].SetTextureStageSettings( 0, TI_Random, TI_CLAMP );
iPer+=iAdd;
RenderLoading( iPer );
g_Shaders[ Grass ].CompileVS(g_ShaderVSGeneral, "vs_main" );
g_Shaders[ Grass ].CompilePS(g_ShaderPSGrass, "ps_main" );
g_Shaders[ Grass ].SetTextureStageSettings( 0, TI_Random );
g_Shaders[ Tarmac ].CompileVS(g_ShaderVSGeneral, "vs_main" );
g_Shaders[ Tarmac ].CompilePS(g_ShaderPSTarmac, "ps_main" );
g_Shaders[ Tarmac ].SetTextureStageSettings( 0, TI_RandomCube );
iPer+=iAdd;
RenderLoading( iPer );
g_Shaders[ Wall ].CompileVS(g_ShaderVSGeneral, "vs_main" );
g_Shaders[ Wall ].CompilePS(g_ShaderPSWall, "ps_main" );
g_Shaders[ Wall ].SetTextureStageSettings( 0, TI_RandomCube );
g_Shaders[ Wall ].SetTextureStageSettings( 1, TI_Random, TI_CLAMP );
g_Shaders[ Sky ].CompileVS(g_ShaderVSSky, "vs_main" );
g_Shaders[ Sky ].CompilePS(g_ShaderPSSky, "ps_main" );
g_Shaders[ Sky ].SetTextureStageSettings( 0, TI_RandomCube );
iPer+=iAdd;
RenderLoading( iPer );
g_Shaders[ SkyDepth ].CompileVS(g_ShaderVSSky, "vs_main" );
g_Shaders[ SkyDepth ].CompilePS(g_ShaderPSDepth, "ps_main" );
g_Shaders[ Text ].CompileVS(g_ShaderVSGeneral, "vs_main" );
g_Shaders[ Text ].CompilePS(g_ShaderPSText, "ps_main" );
}

View File

@@ -0,0 +1,178 @@
/***********************************************************************************/
/** \file StringHelper.cpp
** \brief Implementation zur Klasse StringHelper
*************************************************************************************
** Autor: Christian Roesch
*************************************************************************************
** -tut nichts-
**
*//*********************************************************************************/
// includes
#ifdef EXTRACODE
#include "StringHelper.h"
#include <cstdio>
std::vector< char > FrameWork::StringHelper::m_SpaceTab;
FrameWork::StringHelper::StringHelperPreparer FrameWork::StringHelper::m_shpDummy;
// Methoden-Definitionen
namespace FrameWork
{
/***********************************************************************************/
/** Schneidet einen String an den Separatoren auseinander. Der vorderste Teil wird
*** abgeschnitten, falls der Separator gefunden wird. Der Eingabestring wird auf den
*** Teil hinter dem Seperator gestutzt
***
*** \param strInput [in\out] Ursprungsstring
*** \param strSeperator Seperator
*** \param der vorne abgeschnittene Teil
***
*** \return true, wenn Seperator gefunden
*//*********************************************************************************/
bool StringHelper::splitAt(
std::string& strInput,
std::string strSeperator,
std::string& strOutput )
{
size_t tStart= strInput.find( strSeperator );
if( tStart == std::string::npos )
{
return false;
}
strOutput= strInput.substr( 0, tStart );
strInput= strInput.substr( tStart + strSeperator.size() );
return true;
}
bool StringHelper::trimFront( std::string& strData, char cWhiteSpace )
{
int i= 0;
if( (int)strData.size() == 0 )
{
return false;
}
while( strData[ i ] == cWhiteSpace )
{
i++;
}
if( i > 0 )
{
strData= strData.substr( i );
return true;
}
return false;
}
bool StringHelper::trimBack( std::string& strData, char cWhiteSpace )
{
int i= (int)strData.size() - 1;
if( i == -1 )
{
return false;
}
while( strData[ i ] == cWhiteSpace )
{
i--;
}
if( i < (int)strData.size() - 1 )
{
strData= strData.substr( 0, i + 1 );
return true;
}
return false;
}
bool StringHelper::trim( std::string& strData, char cWhiteSpace )
{
bool bTrimmed= trimFront( strData, cWhiteSpace );
bTrimmed|= trimBack( strData, cWhiteSpace );
return bTrimmed;
}
bool StringHelper::trimFront( std::string& strData, std::vector< char >& WhiteSpaces )
{
bool bTrimmed;
do
{
bTrimmed= false;
for( int i= 0; i < (int)WhiteSpaces.size(); ++i )
{
bTrimmed|= trimFront( strData, WhiteSpaces[ i ] );
}
} while( bTrimmed );
return bTrimmed;
}
bool StringHelper::trimBack( std::string& strData, std::vector< char >& WhiteSpaces )
{
bool bTrimmed;
do
{
bTrimmed= false;
for( int i= 0; i < (int)WhiteSpaces.size(); ++i )
{
bTrimmed|= trimBack( strData, WhiteSpaces[ i ] );
}
} while( bTrimmed );
return bTrimmed;
}
bool StringHelper::trim( std::string& strData, std::vector< char >& WhiteSpaces )
{
bool bTrimmed= trimFront( strData, WhiteSpaces );
bTrimmed|= trimBack( strData, WhiteSpaces );
return bTrimmed;
}
std::vector< char >& StringHelper::getSpaceTab()
{
return m_SpaceTab;
}
void StringHelper::toUpper( std::string& strData )
{
for( int i= 0; i < (int)strData.size(); ++i )
{
strData[ i ]= toupper( strData[ i ] );
}
}
int StringHelper::searchAndRreplace(
const std::string &strSearchString,
const std::string &strReplaceString,
std::string& strData )
{
int iRet= 0;
std::string::size_type pos = strData.find(strSearchString, 0);
int intLengthSearch = strSearchString.length();
while(std::string::npos != pos)
{
iRet++;
strData.replace(pos, intLengthSearch, strReplaceString);
pos = strData.find(strSearchString, pos + intLengthSearch);
}
return iRet;
}
}
#endif
/************************************************************************************
** Ende der Datei: StringHelper.cpp
************************************************************************************/

View File

@@ -0,0 +1,95 @@
/***********************************************************************************/
/** \file StringHelper.h
** \brief Header File zur Klasse StringHelper
*************************************************************************************
** Autor: Christian Roesch
*************************************************************************************
** _tut nichts_
**
*//*********************************************************************************/
#ifndef _StringHelper_H
#define _StringHelper_H
// includes
#include <string>
#include <vector>
// Klassen-Deklaration
namespace FrameWork
{
/***********************************************************************************/
/** \brief StringHelper _tut nichts_
*************************************************************************************
** Genau genommen _tut dies nichts_
**
*//*********************************************************************************/
class StringHelper
{
public:
static bool splitAt(
std::string& strInput,
std::string strSeperator,
std::string& strOutput );
static bool trim(
std::string& strData,
std::vector< char >& WhiteSpaces );
static bool trim(
std::string& strData,
char cWhiteSpace );
static bool trimFront(
std::string& strData,
std::vector< char >& WhiteSpaces );
static bool trimFront(
std::string& strData,
char cWhiteSpace );
static bool trimBack(
std::string& strData,
std::vector< char >& WhiteSpaces );
static bool trimBack(
std::string& strData,
char cWhiteSpace );
static void toUpper( std::string& strData );
static int searchAndRreplace(
const std::string &strSearchString,
const std::string &strReplaceString,
std::string& strData);
struct StringHelperPreparer
{
StringHelperPreparer()
{
StringHelper::m_SpaceTab.push_back( ' ' );
StringHelper::m_SpaceTab.push_back( '\t' );
}
};
static std::vector< char >& getSpaceTab();
protected:
private:
static StringHelperPreparer m_shpDummy;
static std::vector< char > m_SpaceTab;
};
}
#endif//_StringHelper_H
class FrameWork::StringHelper;
/************************************************************************************
** Ende der Datei: StringHelper.h
************************************************************************************/

View File

@@ -0,0 +1,32 @@
#pragma once
struct STargetValue
{
float m_fValue;
float m_fTarget;
float m_fSpeed;
float m_fAcceleration;
float m_fFriction;
STargetValue
( float fValue,
float fTarget,
float fSpeed,
float fAcceleration,
float fFriction )
{
m_fValue= fValue;
m_fTarget= fTarget;
m_fSpeed= fSpeed;
m_fAcceleration= fAcceleration;
m_fFriction= fFriction;
}
void timeStep()
{
m_fValue+= m_fSpeed;
float fDist= m_fTarget - m_fValue;
m_fSpeed+= fDist * m_fAcceleration;
m_fSpeed*= m_fFriction;
}
};

View File

@@ -0,0 +1,54 @@
/***********************************************************************************/
/** \file TextFileReader.h
** \brief Header File zur Klasse TextFileReader
*************************************************************************************
** Autor: Christian Roesch
*************************************************************************************
** _tut nichts_
**
*//*********************************************************************************/
#ifndef _TextFileReader_H
#define _TextFileReader_H
// includes
#include <vector>
#include <string>
// Klassen-Deklaration
namespace FrameWork
{
/***********************************************************************************/
/** \brief TextFileReader _tut nichts_
*************************************************************************************
** Genau genommen _tut dies nichts_
**
*//*********************************************************************************/
class TextFileReader
{
public:
bool read( std::string strFileName );
bool append( std::string FileName );
std::vector <std::string>& getFileLines();
int getLineCount();
void clear();
protected:
private:
std::vector <std::string> m_vecLines;
};
}
#endif//_TextFileReader_H
class FrameWork::TextFileReader;
/************************************************************************************
** Ende der Datei: TextFileReader.h
************************************************************************************/

362
evoke-64k/ev10/Texture.cpp Normal file
View File

@@ -0,0 +1,362 @@
#include "defines.h"
#include "Texture.h"
#include "Random.h"
#include "globals.h"
#include "rotmat.h"
void Texture::Init()
{
m_iSizeX= -1;
m_iSizeY= -1;
m_iSizeZ= -1;
m_iMipLevel= -1;
m_pTexture= NULL;
m_d3dlb.pBits= NULL;
m_d3dlb.RowPitch= -1;
m_d3dlb.SlicePitch= -1;
}
void Texture::DeInit()
{
Release();
}
void Texture::Create( int iSizeX,
int iSizeY,
int iSizeZ,
int iMipLevel )
{
Release();
m_iSizeX= iSizeX;
m_iSizeY= iSizeY;
m_iSizeZ= iSizeZ;
m_iMipLevel= iMipLevel;
if(m_iSizeZ > 1)
{
g_d3d_device->CreateVolumeTexture(
m_iSizeX,
m_iSizeY,
m_iSizeZ,
m_iMipLevel,
0,
D3DFMT_A8R8G8B8,
D3DPOOL_MANAGED,
(IDirect3DVolumeTexture9**)&m_pTexture,
NULL );
}
else
{
m_iSizeZ = 1;
g_d3d_device->CreateTexture(
m_iSizeX,
m_iSizeY,
m_iMipLevel,
0,
D3DFMT_A8R8G8B8,
D3DPOOL_MANAGED,
(IDirect3DTexture9**)&m_pTexture,
NULL );
}
}
void Texture::Release()
{
Unlock();
if( m_pTexture != NULL )
{
m_pTexture->Release();
m_pTexture= NULL;
}
m_iSizeX= -1;
m_iSizeY= -1;
m_iSizeZ= -1;
m_iMipLevel= -1;
m_d3dlb.pBits= NULL;
m_d3dlb.RowPitch= -1;
m_d3dlb.SlicePitch= -1;
}
void Texture::Lock()
{
if(m_iSizeZ > 1)
{
((IDirect3DVolumeTexture9*)m_pTexture)->LockBox( 0, &m_d3dlb, 0, 0 );
}
else
{
D3DLOCKED_RECT d3dlr;
((IDirect3DTexture9*)m_pTexture)->LockRect( 0, &d3dlr, 0, 0 );
m_d3dlb.pBits = d3dlr.pBits;
m_d3dlb.RowPitch = d3dlr.Pitch;
m_d3dlb.SlicePitch = 0;
}
}
void Texture::Unlock()
{
if( m_d3dlb.pBits == NULL )
{
return;
}
if(m_iSizeZ > 1)
{
((IDirect3DVolumeTexture9*)m_pTexture)->UnlockBox( 0 );
}
else
{
((IDirect3DTexture9*)m_pTexture)->UnlockRect( 0 );
}
m_d3dlb.pBits= NULL;
m_d3dlb.RowPitch= -1;
m_d3dlb.SlicePitch= -1;
}
void Texture::PrepareRandomTexture()
{
RandomGenerator rg;
rg.setSeed( 1024 );
for( int i= 0; i < 1024; ++i )
{
rg.genFloat();
}
Lock();
for( int iZ= 0; iZ < m_iSizeZ; ++iZ )
{
for( int iY= 0; iY < m_iSizeY; ++iY )
{
DWORD* pData= (DWORD*)((BYTE*)m_d3dlb.pBits + iY * m_d3dlb.RowPitch + iZ * m_d3dlb.SlicePitch );
for( int iX= 0; iX < m_iSizeX; ++iX )
{
rg.genFloat();
*pData++ = rg.getLastTempValue();
}
}
}
Unlock();
// Generate mip maps
D3DXFilterTexture(m_pTexture, NULL, 0, D3DX_DEFAULT);
}
#ifdef EXTRACODE
#include <fstream>
#endif
void Texture::PrepareRotMatrixFromFile()
{
#ifdef EXTRACODE
Release();
D3DXCreateTextureFromFile(
g_d3d_device,
"64k_pre/rotationalMatrix32.png",
(IDirect3DTexture9**)&m_pTexture );
m_iSizeX= 32;
m_iSizeY= 32;
m_iSizeZ = 1;
m_iMipLevel= 1;
Lock();
std::ofstream ofs( "64k_pre/rotMat.txt" );
for( int iY= 0; iY < m_iSizeY; ++iY )
{
DWORD* pData= (DWORD*)((BYTE*)m_d3dlb.pBits + iY * m_d3dlb.RowPitch );
for( int iX= 0; iX < m_iSizeX; ++iX )
{
//rg.genFloat();
//*pData++ = rg.getLastTempValue();
DWORD dw= *pData++;
ofs << dw << "," << "\n";
}
}
Unlock();
#endif
}
void Texture::PrepareRotMatrix()
{
Lock();
int iPos= 0;
for( int iY= 0; iY < m_iSizeY; ++iY )
{
DWORD* pData= (DWORD*)((BYTE*)m_d3dlb.pBits + iY * m_d3dlb.RowPitch );
for( int iX= 0; iX < m_iSizeX; ++iX )
{
*pData++ = dwRotMatData[ iPos++ ];
}
}
Unlock();
}
void Texture::PrepareSpecTexture()
{
g_pTextures[ TI_LightSpec1D ].Create( 256, 1, 1, 1 );
g_pTextures[ TI_LightSpec1D ].Lock();
float fVal= 255.0f;
for( int i= 0; i <= 255; ++i )
{
int iV= (int)fVal;
((DWORD*)(g_pTextures[ TI_LightSpec1D ].m_d3dlb.pBits))[ 255 - i ]=
0xff << 24 |
( iV & 0xff ) << 16 |
( iV & 0xff ) << 8 |
( iV & 0xff );
fVal*= 0.925f;
}
//unlock
g_pTextures[ TI_LightSpec1D ].Unlock();
}
void Texture::Prepare1DTextures()
{
PrepareSpecTexture();
int iTexIndex= TI_First1D;
static const unsigned char pucDataTest[]=
{
1, // Groesse == 8
255, 255, 255,
7,
255, 255, 255,
0,
16, // Groesse == 128
32, 32, 64,
64,
120, 120, 128,
63,
255, 251, 208,
0,
16, // Groesse == 128
255, 255, 255,
4,
192, 192, 192,
4,
145, 145, 145,
4,
108, 108, 108,
4,
81, 81, 81,
8,
45, 45, 45,
16,
14, 14, 14,
16,
4, 4, 4,
71,
0, 0, 0,
0,
16, // Groesse == 128
80, 0, 165,
16,
38, 3, 238,
18,
0, 183, 195,
12,
0, 217, 110,
18,
1, 232,0,
18,
152, 216,0,
12,
229, 200,0 ,
18,
255, 62,0 ,
15,
225, 18,0 ,
0,
0
};
const unsigned char* pData= pucDataTest;
int ColorIn[ 3 ];
int ColorOut[ 3 ];
while( *pData != 0 )
{
//create Texture
int iTexSize= *pData * 8;
pData++;
/*int iMips= 1;
while( 2 << iMips <= iTexSize )
{
iMips++;
}*/
g_pTextures[ iTexIndex ].Create( iTexSize, 1, 1, 1 );
g_pTextures[ iTexIndex ].Lock();
int iX= 0;
ColorIn[ 0 ]= *pData++;
ColorIn[ 1 ]= *pData++;
ColorIn[ 2 ]= *pData++;
//set Texture Data
while( true )
{
int iLength= *pData;
pData++;
if( iLength == 0 )
{
break;
}
ColorOut[ 0 ]= *pData++;
ColorOut[ 1 ]= *pData++;
ColorOut[ 2 ]= *pData++;
//lerp colors
for( int i= 0; i <= iLength; ++i )
{
int iA= iLength - i;
int iR= ( ColorOut[ 0 ] * i + ColorIn[ 0 ] * iA ) / iLength;
int iG= ( ColorOut[ 1 ] * i + ColorIn[ 1 ] * iA ) / iLength;
int iB= ( ColorOut[ 2 ] * i + ColorIn[ 2 ] * iA ) / iLength;
assert( iX < g_pTextures[ iTexIndex ].m_iSizeX );
((DWORD*)(g_pTextures[ iTexIndex ].m_d3dlb.pBits))[ iX ]=
0xff << 24 |
( iR & 0xff ) << 16 |
( iG & 0xff ) << 8 |
( iB & 0xff );
++iX;
}
--iX;
ColorIn[ 0 ]= ColorOut[ 0 ];
ColorIn[ 1 ]= ColorOut[ 1 ];
ColorIn[ 2 ]= ColorOut[ 2 ];
}
//unlock
g_pTextures[ iTexIndex ].Unlock();
iTexIndex++;
}
}

79
evoke-64k/ev10/Texture.h Normal file
View File

@@ -0,0 +1,79 @@
#pragma once
/***********************************************************************************/
/** \file Texture.h
** \brief Header File zur Klasse Texture
*************************************************************************************
** Autor: Christian Roesch
*************************************************************************************
** _tut nichts_
**
*//*********************************************************************************/
#ifndef _Texture_H
#define _Texture_H
// includes
#include <d3dx9.h>
#include <cassert>
// Klassen-Deklaration
extern IDirect3DDevice9* g_d3d_device;
/***********************************************************************************/
/** \brief Texture _tut nichts_
*************************************************************************************
** Genau genommen _tut dies nichts_
**
*//*********************************************************************************/
class Texture
{
public:
void Init();
void DeInit();
void Create( int m_iSizeX,
int m_iSizeY,
int m_iSizeZ,
int m_iMipLevel );
void Release();
void Lock();
void Unlock();
IDirect3DBaseTexture9* GetPointer()
{
return m_pTexture;
}
void PrepareRandomTexture();
void PrepareRotMatrixFromFile();
void PrepareRotMatrix();
static void Prepare1DTextures();
private:
static void PrepareSpecTexture();
int m_iSizeX;
int m_iSizeY;
int m_iSizeZ;
int m_iMipLevel;
IDirect3DBaseTexture9* m_pTexture;
D3DLOCKED_BOX m_d3dlb;
};
#endif//_Texture_H
class Texture;
/************************************************************************************
** Ende der Datei: Texture.h
************************************************************************************/

43
evoke-64k/ev10/VUMeter.h Normal file
View File

@@ -0,0 +1,43 @@
#pragma once
struct SVUMeter
{
const static int m_iBufferLength= 441;
float m_fVUData[ m_iBufferLength ];
int m_iLastPos;
SVUMeter()
{
m_iLastPos= 0;
for( int i= 0; i < m_iBufferLength; ++i )
{
m_fVUData[ i ]= 0.0f;
}
}
void Set( int iPos,
float fVal )
{
iPos= iPos % m_iBufferLength;
while( true )
{
m_fVUData[ m_iLastPos ]= fVal;
if( m_iLastPos != iPos )
{
m_iLastPos++;
m_iLastPos= m_iLastPos % m_iBufferLength;
}
else
{
break;
}
}
}
float Get( int iPos )
{
iPos= iPos % m_iBufferLength;
return m_fVUData[ iPos ];
}
};

73
evoke-64k/ev10/bar16To9.h Normal file
View File

@@ -0,0 +1,73 @@
#pragma once
struct SVertexBar
{
FLOAT x, y, z;
DWORD dwColor;
};
const DWORD c_dwFVFBar= D3DFVF_XYZ|D3DFVF_DIFFUSE;
SVertexBar g_VertBar[]=
{
{ -1.0f, -1.0f, 5.0f, 0xff000000 },
{ -1.0f, 1.0f, 5.0f, 0xff000000 },
{ 1.0f, -1.0f, 5.0f, 0xff000000 },
{ 1.0f, 1.0f,5.0f, 0xff000000 },
};
void RenderBars()
{
g_d3d_device->SetRenderState( D3DRS_LIGHTING, FALSE );
g_d3d_device->SetRenderState( D3DRS_ZENABLE, FALSE );
g_d3d_device->SetRenderState( D3DRS_ALPHATESTENABLE, FALSE );
g_d3d_device->SetRenderState( D3DRS_ALPHABLENDENABLE, FALSE );
g_d3d_device->SetRenderState( D3DRS_CULLMODE, D3DCULL_NONE );
g_d3d_device->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_DIFFUSE );
g_d3d_device->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_SELECTARG1 );
g_d3d_device->SetTextureStageState( 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE );
g_d3d_device->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1 );
g_d3d_device->SetTextureStageState( 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE );
D3DXMATRIX mat;
D3DXMatrixOrthoLH(
&mat,
(float)c_iScreenSizeX,
-(float)c_iScreenSizeY,
1.0f,
8.0f );
g_d3d_device->SetTransform( D3DTS_PROJECTION, &mat );
D3DXMatrixIdentity( &mat );
g_d3d_device->SetTransform( D3DTS_VIEW, &mat );
g_d3d_device->SetTransform( D3DTS_WORLD, &mat );
float fBarHeight= (float)( c_iScreenSizeY - c_iRealScreenY ) * 0.5f;
for( int i= -1; i <= 1; i+= 2 )
{
g_VertBar[ 0 ].x= -(float)c_iScreenSizeX * 0.5f - 10.0f;
g_VertBar[ 0 ].y= (float)i * ( (float)c_iScreenSizeY * 0.5f + 10.0f );
g_VertBar[ 1 ].x= -(float)c_iScreenSizeX * 0.5f - 10.0f;
g_VertBar[ 1 ].y= (float)i * ( (float)c_iScreenSizeY * 0.5f - fBarHeight );
g_VertBar[ 2 ].x= (float)c_iScreenSizeX * 0.5f + 10.0f;
g_VertBar[ 2 ].y= (float)i * ( (float)c_iScreenSizeY * 0.5f + 10.0f );
g_VertBar[ 3 ].x= (float)c_iScreenSizeX * 0.5f + 10.0f;
g_VertBar[ 3 ].y= (float)i * ( (float)c_iScreenSizeY * 0.5f - fBarHeight );
g_d3d_device->SetFVF( c_dwFVFBar );
g_d3d_device->DrawPrimitiveUP(
D3DPT_TRIANGLESTRIP,
2,
g_VertBar,
sizeof( SVertexBar )
);
}
}

View File

@@ -0,0 +1,5 @@
K 25
svn:wc:ra_dav:version-url
V 36
/svn/64k/!svn/ver/228/trunk/ev10/cam
END

View File

@@ -0,0 +1,35 @@
9
dir
230
http://svn.xp-dev.com/svn/64k/trunk/ev10/cam
http://svn.xp-dev.com/svn/64k
2010-04-27T20:33:45.185231Z
228
TGGC
svn:special svn:externals svn:needs-lock
e3c53db8-d867-4aff-9ce2-c1b2cf7253df
0

View File

@@ -0,0 +1 @@
9

2589
evoke-64k/ev10/camdata.h Normal file

File diff suppressed because it is too large Load Diff

1531
evoke-64k/ev10/camera.cpp Normal file

File diff suppressed because it is too large Load Diff

160
evoke-64k/ev10/camera.h Normal file
View File

@@ -0,0 +1,160 @@
#pragma once
#include <d3dx9.h>
const int g_iCamTickFactor= 2 << 14;
#ifdef CAMERATESTER
#include "TextFileReader.h"
#include "StringHelper.h"
#include "EditorHelp.h"
#include <fstream>
#include <sstream>
#include <cstdio>
#define CAMERAEDIT
#endif
struct SCameraDefinition
{
D3DXVECTOR3 m_vec3Pos;
D3DXVECTOR3 m_vec3Rot;
float m_fDOF;
float m_fFOV;
int m_iDemoTime;
};
struct SCameraKey
{
int m_dwTime;
int m_dwDemoTimeStart;
int m_dwDemoTimeSpeed;
float m_fPos[ 3 ];
float m_fRot[ 3 ];
float m_fDOF;
float m_fFOV;
float m_fTangentOffset[ 2 ];
#ifdef CAMERATESTER
void ToString( std::string& strData );
void FromString( std::string& strData );
void Reset();
void FromCameraDefinition( SCameraDefinition& camDef );
void ToCameraDefinition( SCameraDefinition& camDef );
#endif CAMERATESTER
};
struct SActCamData
{
SCameraKey* m_pCamData;
int m_iMaxStepCount;
};
void InterpolateCamLocal( SActCamData* pData, int iIndex, int dwLocalTime, SCameraDefinition& Out );
int CalcCamGlobal( SActCamData* pData, int dwTime, SCameraDefinition& Out );
#ifndef CAMERATESTER
void PreparePlayCam();
void PlayCam( int iRealTimePassed, SCameraDefinition& CamData );
#endif
/*
void drawLine( D3DXVECTOR3& pvec3Pos1,
D3DXVECTOR3& pvec3Pos2,
DWORD dwColor )
{
//g_pMatrixStack->LoadIdentity();
//g_d3d_device->SetTransform( D3DTS_WORLD, g_pMatrixStack->GetTop() );
g_d3d_device->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TFACTOR );
g_d3d_device->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_SELECTARG1 );
g_d3d_device->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_DISABLE );
g_d3d_device->SetTextureStageState( 1, D3DTSS_COLOROP, D3DTOP_DISABLE );
g_d3d_device->SetRenderState( D3DRS_FOGENABLE, FALSE );
g_d3d_device->SetRenderState( D3DRS_ZENABLE, FALSE );
g_d3d_device->SetRenderState( D3DRS_LIGHTING, FALSE );
SVertex v[ 3 ];
g_d3d_device->SetRenderState( D3DRS_TEXTUREFACTOR, dwColor );
v[ 0 ].x= pvec3Pos1.x;
v[ 0 ].y= pvec3Pos1.y;
v[ 0 ].z= pvec3Pos1.z;
v[ 1 ].x= pvec3Pos2.x;
v[ 1 ].y= pvec3Pos2.y;
v[ 1 ].z= pvec3Pos2.z;
g_d3d_device->DrawPrimitiveUP( D3DPT_LINESTRIP,
1,
v,
sizeof( SVertex ));
g_d3d_device->SetRenderState( D3DRS_FOGENABLE, TRUE );
g_d3d_device->SetRenderState( D3DRS_ZENABLE, TRUE );
}*/
#ifdef CAMERATESTER
const int c_iCamCount= 64;
int GetCamTrackCount();
std::vector<SCameraKey>& GetCamTrack( int iIndex );
std::vector<SCameraKey>& GetEditTrack();
void ReadCameraTrack( char* pcFileName, int iTrack );
void WriteCameraTrack( char* pcFileName, int iTrack );
void ReadCamera();
void WriteCameraHeader();
void ReadCameraAll();
void WriteCameraAll();
void DrawEditOutput();
void Save();
void Reload();
void MakeTimeContinous();
void DeleteTrack();
void MoveTrack();
void ClearTrack();
void AddTrack();
void LockTrack();
void ChangeTrack();
void ChangeStep();
void EditToStep();
void VerifyStep();
void ChangeTangent( int iCount );
void ChangeStart();
void ChangeSpeed();
void ChangeLength();
void SetStep();
void RemoveStep();
void SetStepCamera();
void HomeCam();
void TickFreeCam( int iTime );
void ChangeStepKeys( int iPrior, int iNext );
void InterpolateCamGlobal( int iRealTimePassed, SCameraDefinition& CamData );
void DrawCameraDebugOutput();
int FillDataFromEdit(SActCamData& data);
int GetCurrentTrackStartTime();
void ResetRealTime();
void CalcCamTrackStarts();
void SetStepFromTime();
int CalculateRealTime();
int CalculateDemoTime();
bool IsFreeCam();
int GetRealTime();
#endif

View File

@@ -0,0 +1,134 @@
#pragma once
/*
void homeCam()
{
g_CamPos.x= 0.0f;
g_CamPos.y= 60.0f;
g_CamPos.z= 75.0f;
g_CamRot.x= 3.14f;
g_CamRot.y= 0.65f;
g_CamRot.z= 0.0f;
#ifdef MESHTESTER
g_CamPos.x= 0.0f;
g_CamPos.y= 1.0f;
g_CamPos.z= -5.0f;
g_CamRot.x= 0.0f;
g_CamRot.y= 0.0f;
g_CamRot.z= 0.0f;
#endif
#ifdef PUPPETTESTER
g_CamPos.x= 0.0f;
g_CamPos.y= 1.0f;
g_CamPos.z= -5.0f;
g_CamRot.x= 0.0f;
g_CamRot.y= 0.0f;
g_CamRot.z= 0.0f;
#endif
#ifdef CURSOR3D
g_CursorPos.x= 0.0f;
g_CursorPos.y= 0.0f;
g_CursorPos.z= 0.0f;
#endif
}
void EditCam()
{
static POINT OldCurPos;
POINT CurPos;
GetCursorPos( &CurPos );
if( GetAsyncKeyState( VK_HOME ) )
{
homeCam();
}
if( GetAsyncKeyState( VK_MBUTTON ) || GetAsyncKeyState( VK_RBUTTON ) )
{
g_CamRot.x+= 0.002f * ( OldCurPos.x - CurPos.x );
g_CamRot.y-= 0.002f * ( OldCurPos.y - CurPos.y );
g_CamRot.y= max( g_CamRot.y, -1.56f );
g_CamRot.y= min( g_CamRot.y, 1.56f );
static float fSpeedA= 0.0f;
if( GetAsyncKeyState( VK_UP ) )
{
fSpeedA= max( fSpeedA, 0.0f );
fSpeedA+= 0.01f;
g_CamPos+= fSpeedA * g_CamFront;
}
else if( GetAsyncKeyState( VK_DOWN ) )
{
fSpeedA= min( fSpeedA, 0.0f );
fSpeedA-= 0.01f;
g_CamPos+= fSpeedA * g_CamFront;
}
else
{
fSpeedA= 0.0f;
}
static float fSpeedB= 0.0f;
if( GetAsyncKeyState( VK_RIGHT ) )
{
fSpeedB= max( fSpeedB, 0.0f );
fSpeedB+= 0.01f;
g_CamPos+= fSpeedB * g_CamRight;
}
else if( GetAsyncKeyState( VK_LEFT ) )
{
fSpeedB= min( fSpeedB, 0.0f );
fSpeedB-= 0.01f;
g_CamPos+= fSpeedB * g_CamRight;
}
else
{
fSpeedB= 0.0f;
}
static float fSpeedC= 0.0f;
if( GetAsyncKeyState( VK_NUMPAD1 ) )
{
fSpeedC= max( fSpeedC, 0.0f );
fSpeedC+= 0.01f;
g_CamPos.y+= fSpeedC;
}
else if( GetAsyncKeyState( VK_NUMPAD0 ) )
{
fSpeedC= min( fSpeedC, 0.0f );
fSpeedC-= 0.01f;
g_CamPos.y+= fSpeedC;
}
else
{
fSpeedC= 0.0f;
}
}
OldCurPos= CurPos;
}*/
void FillCameraMatrix( D3DXVECTOR3 v3Pos, D3DXVECTOR3 v3Rot, D3DXMATRIX* CamMat )
{
float fYLeft= cos( v3Rot.y );
g_CamFront.x= -sin( v3Rot.x ) * fYLeft ;
g_CamFront.y= -sin( v3Rot.y );
g_CamFront.z= cos( v3Rot.x ) * fYLeft ;
D3DXVec3Normalize(&g_CamFront, &g_CamFront);
D3DXMatrixRotationYawPitchRoll( CamMat,
-v3Rot.x,
v3Rot.y,
v3Rot.z );
D3DXMATRIX CamMove;
D3DXMatrixTranslation( &CamMove, v3Pos.x, v3Pos.y, v3Pos.z );
D3DXMatrixMultiply( CamMat, CamMat, &CamMove );
D3DXMatrixInverse(CamMat, NULL, CamMat );
}

View File

@@ -0,0 +1,101 @@
K 25
svn:wc:ra_dav:version-url
V 36
/svn/64k/!svn/ver/228/trunk/ev10/cfg
END
pswall.txt
K 25
svn:wc:ra_dav:version-url
V 47
/svn/64k/!svn/ver/228/trunk/ev10/cfg/pswall.txt
END
psao.txt
K 25
svn:wc:ra_dav:version-url
V 45
/svn/64k/!svn/ver/228/trunk/ev10/cfg/psao.txt
END
psrainbow.txt
K 25
svn:wc:ra_dav:version-url
V 50
/svn/64k/!svn/ver/228/trunk/ev10/cfg/psrainbow.txt
END
psdepth.txt
K 25
svn:wc:ra_dav:version-url
V 48
/svn/64k/!svn/ver/228/trunk/ev10/cfg/psdepth.txt
END
psblur.txt
K 25
svn:wc:ra_dav:version-url
V 47
/svn/64k/!svn/ver/228/trunk/ev10/cfg/psblur.txt
END
pssky.txt
K 25
svn:wc:ra_dav:version-url
V 46
/svn/64k/!svn/ver/228/trunk/ev10/cfg/pssky.txt
END
pstarmac.txt
K 25
svn:wc:ra_dav:version-url
V 49
/svn/64k/!svn/ver/228/trunk/ev10/cfg/pstarmac.txt
END
psdof.txt
K 25
svn:wc:ra_dav:version-url
V 46
/svn/64k/!svn/ver/228/trunk/ev10/cfg/psdof.txt
END
psphong.txt
K 25
svn:wc:ra_dav:version-url
V 48
/svn/64k/!svn/ver/228/trunk/ev10/cfg/psphong.txt
END
vssky.txt
K 25
svn:wc:ra_dav:version-url
V 46
/svn/64k/!svn/ver/228/trunk/ev10/cfg/vssky.txt
END
psgrass.txt
K 25
svn:wc:ra_dav:version-url
V 48
/svn/64k/!svn/ver/228/trunk/ev10/cfg/psgrass.txt
END
pspssm.txt
K 25
svn:wc:ra_dav:version-url
V 47
/svn/64k/!svn/ver/228/trunk/ev10/cfg/pspssm.txt
END
vsgeneral.txt
K 25
svn:wc:ra_dav:version-url
V 50
/svn/64k/!svn/ver/228/trunk/ev10/cfg/vsgeneral.txt
END
pstext.txt
K 25
svn:wc:ra_dav:version-url
V 47
/svn/64k/!svn/ver/228/trunk/ev10/cfg/pstext.txt
END
vsfsquad.txt
K 25
svn:wc:ra_dav:version-url
V 49
/svn/64k/!svn/ver/228/trunk/ev10/cfg/vsfsquad.txt
END
psray.txt
K 25
svn:wc:ra_dav:version-url
V 46
/svn/64k/!svn/ver/228/trunk/ev10/cfg/psray.txt
END

View File

@@ -0,0 +1,579 @@
9
dir
230
http://svn.xp-dev.com/svn/64k/trunk/ev10/cfg
http://svn.xp-dev.com/svn/64k
2010-04-27T20:33:45.185231Z
228
TGGC
svn:special svn:externals svn:needs-lock
e3c53db8-d867-4aff-9ce2-c1b2cf7253df
0
psao.txt
file
2010-03-26T12:17:46.501700Z
a8b7e40883c33edad4ed01a6eaedf9e2
2010-04-27T20:33:45.185231Z
228
TGGC
5220
pswall.txt
file
2010-03-31T15:36:34.908846Z
08899156eed95b0bf5e47371baeeef64
2010-04-27T20:33:45.185231Z
228
TGGC
2970
psrainbow.txt
file
2010-03-26T16:54:29.558855Z
c27c40c388f12562b92f264172b36b70
2010-04-27T20:33:45.185231Z
228
TGGC
1215
psblur.txt
file
2010-03-28T10:43:11.888060Z
221dfd0d72437edef56f2622f6496043
2010-04-27T20:33:45.185231Z
228
TGGC
1763
psdepth.txt
file
2010-03-23T08:43:47.226617Z
714f28018d1af00cf1437d78bfeb4094
2010-04-27T20:33:45.185231Z
228
TGGC
62
pssky.txt
file
2010-04-01T09:57:57.206928Z
404aed7642e4a6f218d775156cb23317
2010-04-27T20:33:45.185231Z
228
TGGC
3026
pstarmac.txt
file
2010-03-23T09:24:52.037003Z
1569e7a92068ae3b8db82034d7ecc519
2010-04-27T20:33:45.185231Z
228
TGGC
3085
psdof.txt
file
2010-03-31T12:36:41.787053Z
d4efc1a62ee9481891ae87dd7f6efd48
2010-04-27T20:33:45.185231Z
228
TGGC
3385
psphong.txt
file
2010-03-26T12:17:46.501700Z
3cd3752906d51653c8f6a16cdb968f9e
2010-04-27T20:33:45.185231Z
228
TGGC
1114
vssky.txt
file
2010-03-31T17:36:07.577578Z
e88d358090811c9ec8d364dd5a48f7ee
2010-04-27T20:33:45.185231Z
228
TGGC
357
psgrass.txt
file
2010-03-26T16:54:29.558855Z
77ac7c3f7d2f5754b334fa5137e38262
2010-04-27T20:33:45.185231Z
228
TGGC
2373
pspssm.txt
file
2010-03-24T12:51:15.250282Z
9128223739d5ff46d278cde4e0efba52
2010-04-27T20:33:45.185231Z
228
TGGC
4034
vsgeneral.txt
file
2010-03-23T09:24:52.037003Z
fb170316c9d94c8d4294433ca8f60348
2010-04-27T20:33:45.185231Z
228
TGGC
1156
pstext.txt
file
2010-03-23T09:24:52.037003Z
b551c1670266314e5b1c1c4398a0b44f
2010-04-27T20:33:45.185231Z
228
TGGC
1147
vsfsquad.txt
file
2010-03-30T16:08:59.911029Z
7bc554de6a5c2682889d5ee85b86a48a
2010-04-27T20:33:45.185231Z
228
TGGC
866
psray.txt
file
2010-03-30T09:57:35.106943Z
b0bfa22a3603a7087cbb19eda2f44491
2010-04-27T20:33:45.185231Z
228
TGGC
1565

View File

@@ -0,0 +1 @@
9

View File

@@ -0,0 +1,147 @@
float4 res : register(c0);
sampler2D colorSampler : register(s0);
sampler2D depthSampler : register(s1);
sampler2D ditherSampler : register(s2);
static float g_fRadiusBase = 0.005f;
static float g_fRadiusScale = 0.25f;
static float g_fFallOff = 0.7f;
static float g_fIntensity = 1.25f;
static float g_fGrain = 0.01f;
static float g_fRange = 1024.0f;
static float g_fBlurSensitivity = 250.f;
static const float3 vSamplePoints[12] = {
float3(0.083333f, 0.000000f, 0.083333f),
float3(-0.144338f, -0.083333f, 0.166667f),
float3(0.125000f, 0.216506f, 0.250000f),
float3(0.000000f, -0.333333f, 0.333333f),
float3(-0.208333f, 0.360844f, 0.416667f),
float3(0.433013f, -0.250000f, 0.500000f),
float3(-0.583333f, -0.000000f, 0.583333f),
float3(0.577350f, 0.333333f, 0.666667f),
float3(-0.375000f, -0.649519f, 0.750000f),
float3(-0.000000f, 0.833333f, 0.833333f),
float3(0.458333f, -0.793857f, 0.916667f),
float3(-0.866025f, 0.500000f, 1.000000f)
};
float4 ps_main(float2 TexCoord : TEXCOORD0) : COLOR0
{
// Sample random 2D matrix
float4 vRotation = tex2D(ditherSampler, TexCoord * res.xy / 32.0f) * 2.0f - 1.0f;
float2x2 mRotation = float2x2(vRotation.xy, vRotation.zw);
// Sample pixel depth
float fDepth = tex2D(depthSampler, TexCoord).x;
// Transform radius to screen space
float3 fScaledRadius = g_fRadiusBase + g_fRadiusScale / ( 8.0f + fDepth );
// Limit radius to reasonable sampling kernels
fScaledRadius = clamp(fScaledRadius, 4.0f * res.z, 64.0f * res.w);
// Transform sampling vector length back to world space
fScaledRadius.z *= fDepth;
float fOcclusion = 0.0f;
float fSampleWeight = 1.f / 18.849556f; // atan version
// float fSampleWeight = 1.f / 12.f;
// Loop over samples
for(int i = 0; i < 12; )
{
float4 fSampleDepth, fSampleRadius;
// Vectorize occlusion code
[unroll] for(int j = 0; j < 4; j++, i++)
{
// Randomly rotate scaled sample points
float3 vSampleOffset = fScaledRadius * vSamplePoints[i];
vSampleOffset.xy = mul(vSampleOffset.xy, mRotation);
// Sample depth texture
fSampleDepth[j] = tex2D(depthSampler, TexCoord + vSampleOffset.xy).x;
fSampleRadius[j] = vSampleOffset.z;
}
// Compute occlusion
float4 fDeltaDepth = (fDepth - fSampleDepth) / fSampleRadius;
float4 fAttenuation = g_fFallOff * fDeltaDepth;
float4 fBlocking = atan(fDeltaDepth) / (1.0f + max(0.0f, fAttenuation)); // atan version
// float4 fBlocking = fDeltaDepth / ( (1.0f + abs(fDeltaDepth)) * (1.0f + max(0.0f, fAttenuation)) );
fOcclusion += dot(fBlocking, fSampleWeight);
}
// Avoid ugly smudge artifacts
float2 fPixelPos = TexCoord * 2.0f - 1.0f;
float fBorderAttenuation = 1.0f - 0.7071f * dot(fPixelPos, fPixelPos);
// Write to intermediate buffer
float fAO = saturate(g_fIntensity * fOcclusion + g_fGrain) * fBorderAttenuation * step(fDepth, g_fRange);
return float4((float3)fAO, 0.f);
}
float4 ps_blur(float2 TexCoord, uniform bool bVertical)
{
float2 fStepSize = float2(1.f, bVertical ? -1.f : 1.f) * res.zw;
float3 fCenterDepths;
// Fetch 3 center depths
fCenterDepths.x = tex2D(depthSampler, TexCoord - fStepSize).x;
fCenterDepths.y = tex2D(depthSampler, TexCoord).x;
fCenterDepths.z = tex2D(depthSampler, TexCoord + fStepSize).x;
float3 fDepthContinuities, fDepthDeltas;
// Compute 3 depth continuity values
fDepthContinuities.x = tex2D(depthSampler, TexCoord - 2.0f * fStepSize).x;
fDepthContinuities.y = fCenterDepths.x;
fDepthContinuities.z = tex2D(depthSampler, TexCoord + 2.0f * fStepSize).x;
fDepthDeltas = fDepthContinuities - fCenterDepths.yzy;
fDepthContinuities += fCenterDepths.yzy - 2.0f * fCenterDepths;
// Correct AA issues
fDepthContinuities = abs(fDepthContinuities);
fDepthDeltas = abs(fDepthDeltas);
fDepthDeltas -= min(min(fDepthDeltas.x, fDepthDeltas.y), fDepthDeltas.z);
// Compute 3 weights
float3 fWeights = 1.0f / (1.0f + g_fBlurSensitivity * (fDepthContinuities + 16.f * fDepthDeltas));
float fOutput = 0.0f;
float3 fSamples;
float3 fSampleWeights = float3(3.0f, 1.5f, 1.0f);
// Blend 5 color samples respecting to the 3 depth continuity weights
fSamples.x = tex2D(colorSampler, TexCoord - 2.0f * fStepSize).x;
fSamples.y = tex2D(colorSampler, TexCoord - fStepSize).x;
fSamples.z = tex2D(colorSampler, TexCoord).x;
fOutput += dot(fSamples, fWeights.x);
fSamples.x = tex2D(colorSampler, TexCoord + fStepSize).x;
fOutput += dot(fSamples, fWeights.y);
fSamples.y = tex2D(colorSampler, TexCoord + 2.0f * fStepSize).x;
fOutput += dot(fSamples, fWeights.z);
// Average output weight
float fOutputWeight = dot(fWeights, 1.0f);
// Average output
fOutput /= 3.0f * fOutputWeight;
// Correction weight
float fCorrectionWeight = saturate(1.0f - fOutputWeight);
// Write to color buffer
fOutput = (1.0f - fCorrectionWeight) * fOutput + fCorrectionWeight * fSamples.z;
return float4((float3)fOutput, 0.f);
}
float4 ps_blur_hor(float2 TexCoord : TEXCOORD0) : COLOR0 { return ps_blur(TexCoord, false); }
float4 ps_blur_ver(float2 TexCoord : TEXCOORD0) : COLOR0 { return ps_blur(TexCoord, true); }

View File

@@ -0,0 +1,59 @@
float4 res : register(c0);
float4 glow : register(c31);
sampler2D colorSampler : register(s0);
sampler2D guideSampler : register(s4);
static float2 fGaussianWeights[] = {
float2(-3.0f, 0.015625f),
float2(-2.0f, 0.09375f),
float2(-1.0f, 0.234375f),
float2(0.0f, 0.3125f),
float2(1.0f, 0.234375f),
float2(2.0f, 0.09375f),
float2(3.0f, 0.015625f)
};
float4 ps_blur(float2 t : TEXCOORD0, uniform float2 vDir) : COLOR0
{
float2 vDelta = vDir * res.zw;
float4 fColor = 0.f;
for(int i = 0; i < 7; i++)
fColor += fGaussianWeights[i].y
* tex2D(colorSampler, t + fGaussianWeights[i].x * vDelta);
return fColor;
}
float4 ps_blur_hor(float2 t : TEXCOORD0) : COLOR0 { return ps_blur(t, float2(1.f, 0.f)); }
float4 ps_blur_ver(float2 t : TEXCOORD0) : COLOR0 { return ps_blur(t, float2(0.f, 1.f)); }
float4 ps_blur_bil(float2 t : TEXCOORD0, uniform float2 vDir) : COLOR0
{
float2 vDelta = vDir * res.zw;
float4 fGuide = tex2D(guideSampler, t);
float4 fColor = 0.f;
float fWeight = 0.f;
for(int i = 0; i < 7; i++)
{
float2 to = t + vDelta * fGaussianWeights[i].x;
float4 fSample = tex2D(colorSampler, to);
float fSampleWeight = (1.f - saturate(4.f * (fGuide.w - fSample.w))) * fGaussianWeights[i].y;
fColor += fSample * fSampleWeight;
fWeight += fSampleWeight;
}
return lerp(fGuide, fColor / fWeight, fWeight);
}
float4 ps_blur_bil_hor(float2 t : TEXCOORD0) : COLOR0 { return ps_blur_bil(t, float2(1.f, 0.f)); }
float4 ps_blur_bil_ver(float2 t : TEXCOORD0) : COLOR0 { return ps_blur_bil(t, float2(0.f, 1.f)); }
float4 ps_extract_inv_alpha(float2 t : TEXCOORD0) : COLOR0
{
float4 c = tex2D(colorSampler, t);
c.a = 1.f - c.a;
c.xyz *= c.a;
return c * glow;
}

View File

@@ -0,0 +1,4 @@
float4 ps_main(float4 s : TEXCOORD3):color
{
return s.z;
}

View File

@@ -0,0 +1,105 @@
float4 res : register(c0);
float2 Dist : register(c3);
sampler2D colorSampler : register(s0);
sampler2D depthSampler : register(s1);
sampler2D blurSampler : register(s4);
// Tweakables
static float g_fRadius = 0.005f;
static float g_fLowRadiusScaling = 0.4f;
static float g_fNearPlane = 1.0f;
static float g_fFocalPlane = Dist.y;
static float g_fDistScale = 1.0f / pow( g_fFocalPlane , 2.5f );
static float g_fFarPlane= 128.0f;
static const float2 vPoissonDisc[] = {
float2(-0.326212f, -0.40581f),
float2(-0.840144f, -0.07358f),
float2(-0.695914f, 0.457137f),
float2(-0.203345f, 0.620716f),
float2(0.96234f, -0.194983f),
float2(0.473434f, -0.480026f),
float2(0.519456f, 0.767022f),
float2(0.185461f, -0.893124f),
float2(0.507431f, 0.064425f),
float2(0.89642f, 0.412458f),
float2(-0.32194f, -0.932615f),
float2(-0.791559f, -0.59771f)
};
float4 ps_blur_intensity(float2 TexCoord : TEXCOORD0) : COLOR0
{
// Sample pixel depth
float fDepth = tex2D(depthSampler, TexCoord).x;
// Anti-aliasing
float4 fDDTexCoords1 = TexCoord.xyxy, fDDTexCoords2 = TexCoord.xyxy;
fDDTexCoords1.zw -= res.zw; fDDTexCoords2.zw += res.zw;
float4 fDDDepth4 = fDepth - float4(
tex2D(depthSampler, fDDTexCoords1.zy).x, tex2D(depthSampler, fDDTexCoords1.xw).x,
tex2D(depthSampler, fDDTexCoords2.zy).x, tex2D(depthSampler, fDDTexCoords2.xw).x );
// fDDDepth4 = lerp(fDDDepth4, abs(fDDDepth4), (fDDDepth4 * fDDDepth4.zwxy) > 0.f);
float2 fDeltaDepth2 = max(fDDDepth4.xy, fDDDepth4.zw);
float fDeltaDepth = max(fDeltaDepth2.x, fDeltaDepth2.y);
float fIntensity;
if(fDepth < g_fFocalPlane)
{
// Close-up blur
fIntensity = (fDepth - g_fFocalPlane) / (g_fFocalPlane - g_fNearPlane);
}
else
{
// Distance blur
float2 fDistances = (fDepth - g_fFocalPlane);
fDistances.y -= max(fDeltaDepth, 0.f);
float2 fIntensities = saturate(fDistances * g_fDistScale );
fIntensity = lerp(fIntensities.y, fIntensities.x, fIntensities.y);
}
// Bias to valid range
return float4(
tex2D(colorSampler, TexCoord).xyz,
saturate(0.5f + 0.5f * fIntensity) );
}
float4 ps_main(float2 TexCoord : TEXCOORD0) : COLOR0
{
// Center pixel depth
float fDepth = tex2D(colorSampler, TexCoord).w;
// Scale sampling radius
float fRadius = abs(2.0f * g_fRadius * fDepth - g_fRadius);
float fLowRadius = fRadius * g_fLowRadiusScaling;
float4 fColor = 0.0f;
float fAmount = 0.0f;
// Loop over samples
for(int i = 0; i < 12; i++)
{
// Sample on poisson disc
float2 fHighSampleTexCoord = TexCoord + fRadius * vPoissonDisc[i];
float2 fLowSampleTexCoord = TexCoord + fLowRadius * vPoissonDisc[i];
// Sample blurred and unblurred texture
float4 fHighSample = tex2D(colorSampler, fHighSampleTexCoord);
float4 fLowSample = tex2D(blurSampler, fLowSampleTexCoord);
// Blend between blurred and unblurred texture
float fSampleBlurIntensity = abs(2.f * fHighSample.w - 1.f);
// * saturate(1.f - 3.f * (fHighSample.w - fLowSample.w));
float4 fSample = lerp(fHighSample, fLowSample, fSampleBlurIntensity);
// Compute smart weight to avoid cross-edge leaking
float fWeight = fSample.w < fDepth ? abs(2.f * fSample.w - 1.f) : 1.f;
// Sum up
fColor += fSample * fWeight;
fAmount += fWeight;
}
return fColor / fAmount;
}

View File

@@ -0,0 +1,80 @@
float4 g_fResolution : register(c0);
float3 g_vLightDir : register(c1);
sampler2D randomSampler : register(s0);
sampler1D diffSampler : register(s2);
sampler2D shadowSampler : register(s4);
sampler2D depthSampler : register(s5);
static float3 g_fColor = float3(0.45f, 0.5f, 0.18f); // float3(.2f, .5f, .1f);
static float g_fTexScale = .25f;
static float g_fDensity = 3.f;
static float2 g_fInnerOuterRadiusSq = float2(240.f * 240.f, 380.f * 380.f);
static float4 g_fHaze = float4(0.765f, 0.808f, 0.871f, -0.3f);
static float2 g_fHazeDensityIntensity = float2(0.25f, 0.6f);
struct psIn
{
float2 t : TEXCOORD0;
float3 n : TEXCOORD1;
float3 v : TEXCOORD2;
float4 s : TEXCOORD3;
float3 w : TEXCOORD4;
};
float noise(float2 t)
{
float4 r = tex2D(randomSampler, .03125f * t);
float lr = dot(r, float4(1.f, 10.f, 100.f, 1000.f));
return lr * 2.f / 1111.f - 1.f;
}
float abs_noise(float2 t) { return abs( noise(t) ); }
float4 ps_main(psIn i):color
{
float2 t = i.w.xz * g_fTexScale;
float fCenterDist = dot(i.w.xz, i.w.xz) - g_fInnerOuterRadiusSq.x;
fCenterDist /= g_fInnerOuterRadiusSq.y - g_fInnerOuterRadiusSq.x;
// Texturing
float4 fColor = abs_noise(t) / 2.f;
fColor.xyz = 0.5f + 0.1f * fColor.xyz;
fColor.zw += noise(2.f * t) / float2(32.f, 4.f);
fColor.xw += noise(4.f * t) / float2(64.f, 8.f);
fColor.yw += noise(8.f * t) / float2(16.f, 16.f);
fColor.xyz += noise(16.f * t) / 16.f;
fColor.xyz += noise(32.f * t) / 32.f;
fColor.xyz += noise(128.f * t) / 32.f;
fColor.xyz += noise(1024.f * t) / 32.f;
// Color
fColor.xyz *= 2.f * fColor.xyz;
fColor.xyz *= g_fColor;
// Density
fColor.w = saturate(g_fDensity * fColor.w + fCenterDist);
// Shadow (AA)
float2 sc = i.s.xy / i.s.w;
float aa = abs( tex2D(depthSampler, sc).x - i.s.z );
float2 ddaa = float2(ddx(aa), ddy(aa));
float2 aaetc = sign(-ddaa) * g_fResolution.zw;
sc += aaetc * saturate(4.f * aa);
float fShadow = 0.2f + 0.8f * (float)tex2D(shadowSampler, sc);
// Diffuse light
fColor.xyz *= tex1D( diffSampler, fShadow * (0.5f + 0.5f * dot(normalize(i.n), -g_vLightDir)) ).xyz;
// Haze
fColor.xyz = lerp( fColor.xyz, g_fHaze,
saturate(g_fHazeDensityIntensity.x * fCenterDist) * g_fHazeDensityIntensity.y );
// Premultiplied alpha
fColor.xyz *= fColor.a;
return fColor;
}

View File

@@ -0,0 +1,43 @@
float4 g_fResolution : register(c0);
float3 g_vLightDir : register(c1);
sampler1D dif : register(s2);
sampler1D spec : register(s3);
sampler2D shadowSampler : register(s4);
sampler2D depthSampler : register(s5);
static float4 g_fSpecularPower = {0.85f, 0.85f, 0.85f, 0.85f};
struct psIn
{
float4 c : COLOR0;
float2 t : TEXCOORD0;
float3 n : TEXCOORD1;
float3 v : TEXCOORD2;
float4 s : TEXCOORD3;
float3 w : TEXCOORD4;
};
float4 ps_main(psIn i):color
{
// Shadow AA
float2 sc = i.s.xy / i.s.w;
float aa = abs( tex2D(depthSampler, sc).x - i.s.z );
float2 ddaa = float2(ddx(aa), ddy(aa));
float2 aaetc = sign(-ddaa) * g_fResolution.zw;
sc += aaetc * saturate(4.f * aa);
float4 fColor = i.c;
float fS= 0.2f + 0.8f * tex2D(shadowSampler, sc);
float3 n = normalize(i.n);
// Lighting
fColor.xyz *= tex1D( dif, fS * ( 0.5f + 0.5f * dot( n, -g_vLightDir) ) );
// Specular highlights
float3 h = normalize( normalize(i.v) + -g_vLightDir );
float s = dot(n, h);
fColor.xyz += g_fSpecularPower * tex1D(spec, fS * ( 0.5f + 0.5f * s ) );
return fColor;
}

View File

@@ -0,0 +1,108 @@
float2 g_fResolution : register(c0);
float3 g_vViewPos : register(c2);
float g_fSplit : register(c23);
float4x4 g_mShadowVP : register(c24);
float3 g_vShadowViewPos : register(c28);
float3 g_vShadowViewDir : register(c29);
float4 g_fShadowMapScalingRes : register(c30);
sampler2D shadowMapSampler : register(s0);
sampler2D depthSampler : register(s1);
sampler2D ditherSampler : register(s2);
static float g_fRadius = 6.0f / 64.0f;
static float g_fBias = 4.0f / 64.0f;
static float g_fDepthBias = 16.0f / 64.0f;
static float g_fBiasFalloff = 1.5f / 64.0f;
static float g_fSharpness = 640.0f / 64.0f;
static float g_fBlurSharpness = 640.0f / 64.0f;
static float g_fDepthBlurSharpness = 16.0f / 64.0f;
static const float2 s_vShadowDisc[] = {
float2(-0.326212f, -0.40581f),
float2(-0.840144f, -0.07358f),
float2(-0.695914f, 0.457137f),
float2(-0.203345f, 0.620716f),
float2(0.96234f, -0.194983f),
float2(0.473434f, -0.480026f),
float2(0.519456f, 0.767022f),
float2(0.185461f, -0.893124f),
float2(0.507431f, 0.064425f),
float2(0.89642f, 0.412458f),
float2(-0.32194f, -0.932615f),
float2(-0.791559f, -0.59771f)
};
float4 ps_main(float2 TexCoord : TEXCOORD0, float3 EyeDir : TEXCOORD1) : COLOR0
{
// Compute eye space position
float fEyeDepth = tex2D(depthSampler, TexCoord).x;
float4 vEyePoint = float4(g_vViewPos + fEyeDepth * EyeDir, 1.0f);
// Transform eye point to shadow space
float4 vShadowCoord = mul(vEyePoint, g_mShadowVP);
vShadowCoord.z = dot(vEyePoint.xyz - g_vShadowViewPos, g_vShadowViewDir);
vShadowCoord.xy = vShadowCoord.xy * float2(.5f, -.5f)
+ vShadowCoord.w * (.5f + .5f / g_fShadowMapScalingRes.zw);
// Scale radius
float2 fScaledRadius = g_fRadius * g_fShadowMapScalingRes.xy;
// Transform to shadow map
float2 vShadowCoordProj = vShadowCoord.xy / vShadowCoord.w;
// Clip pixels outside shadow map
clip( float4(vShadowCoordProj, 1.0f - vShadowCoordProj) - fScaledRadius.xyxy );
// Compute sampling plane
float4 vShadowCoordDDX = ddx(vShadowCoord), vShadowCoordDDY = ddy(vShadowCoord);
float2 vShadowCoordDeltaDepth = float2(
vShadowCoordDDX.y * vShadowCoordDDY.z - vShadowCoordDDY.y * vShadowCoordDDX.z,
vShadowCoordDDY.x * vShadowCoordDDX.z - vShadowCoordDDX.x * vShadowCoordDDY.z )
/ (vShadowCoordDDY.x * vShadowCoordDDX.y - vShadowCoordDDX.x * vShadowCoordDDY.y);
vShadowCoordDeltaDepth = vShadowCoord.w * clamp(vShadowCoordDeltaDepth, -16.f, 16.f);
// Compute bias
float fAdaption = 1.f / (1.0f + g_fBiasFalloff * fEyeDepth);
float fAdaptedBias = g_fBias; // lerp(g_fDepthBias, g_fBias, fAdaption);
float fAdaptedBlurSharpness = lerp(g_fDepthBlurSharpness, g_fBlurSharpness, fAdaption);
// Apply bias
float fReferenceDepth = vShadowCoord.z - fAdaptedBias;
// Sample random 2D matrix
float4 vRotation = tex2D(ditherSampler, TexCoord * g_fResolution / 32.0f) * 2.0f - 1.0f;
float2x2 mRotation = float2x2(vRotation.xy, vRotation.zw);
float fShadow = -1.f;
float fSampleWeight = 1.f / 6;
// Sample
for(int i = 0; i < 12; )
{
float4 fSampleDepth;
// Vectorize occlusion code
[unroll] for(int j = 0; j < 4; j++, i++)
{
// Compute some point around this pixel
float2 vSampleOffset = fScaledRadius * mul(s_vShadowDisc[i], mRotation);
// Compute depth delta
float fSampleDeltaDepth = dot(vSampleOffset * vShadowCoordDeltaDepth, 1.f);
// Sample shadow map
fSampleDepth[j] = tex2D(shadowMapSampler, vShadowCoordProj + vSampleOffset).x - fSampleDeltaDepth;
}
// Compare shadow map depth with pixel depth
// (fSampleDepth < fReferenceDepth)
float4 fOcclusion = saturate(fAdaptedBlurSharpness * (fReferenceDepth - fSampleDepth));
// Sum up samples
fShadow += dot(fOcclusion, fSampleWeight);
}
// Write to intermediate buffer
return (1.0f - fShadow); // * float4(g_fSplit == float3(0, 1, 2) || g_fSplit == float3(3, 4, 5), 1.0f);
}

View File

@@ -0,0 +1,46 @@
float4 g_fResolution : register(c0);
float3 g_vLightDir : register(c1);
sampler2D tex : register(s0);
sampler1D dif : register(s2);
sampler1D spec : register(s3);
sampler2D shadowSampler : register(s4);
sampler2D depthSampler : register(s5);
static float4 g_fSpecularPower = {0.85f, 0.85f, 0.85f, 0.85f};
struct psIn
{
float4 c : COLOR0;
float2 t : TEXCOORD0;
float3 n : TEXCOORD1;
float3 v : TEXCOORD2;
float4 s : TEXCOORD3;
float3 w : TEXCOORD4;
};
float4 ps_main(psIn i):color
{
// Shadow AA
float2 sc = i.s.xy / i.s.w;
float aa = abs( tex2D(depthSampler, sc).x - i.s.z );
float2 ddaa = float2(ddx(aa), ddy(aa));
float2 aaetc = sign(-ddaa) * g_fResolution.zw;
sc += aaetc * saturate(4.f * aa);
float4 fColor = i.c * tex2D( tex, i.t );
float fS= 0.125f + 0.875f * tex2D(shadowSampler, sc);
// Lighting
fColor.xyz *= tex1D(dif, fS * ( 0.5f + 0.5f * dot( i.n, -g_vLightDir) ));
// Specular highlights
float3 h = normalize( normalize(i.v) + -g_vLightDir );
float s = dot(i.n, h);
fColor.xyz += g_fSpecularPower * tex1D(spec, fS * ( 0.5f + 0.5f * s ) );
// Red-only glow
// fColor.a = saturate(fColor.a + 1.f - fColor.r);
return fColor;
}

View File

@@ -0,0 +1,56 @@
float3 lightDir : register(c1);
float3 viewDir : register(c4);
float3 passID2expIsLast : register(c23);
sampler2D colorSampler : register(s0);
sampler2D depthSampler : register(s1);
// Tweakables
static float4 g_fRayColor = float4(0.9f, 0.8f, 0.7f, 1.0f);
static float g_fRayNearPlane = 10.0f;
static float g_fRayFarPlane = 500.0f;
static float g_fRayDensity = 0.25f;
static float g_fRayDecay = 0.9125f;
static float g_fRayAnglePersistence = 4.f;
float4 ps_ray_mask(float2 TexCoord : TEXCOORD0, float2 LightPos : TEXCOORD2) : COLOR0
{
float2 d = LightPos - TexCoord;
float r = saturate( 1.f - dot(d, d) );
r *= saturate( g_fRayAnglePersistence * dot(-lightDir, viewDir) );
float m = tex2D(depthSampler, TexCoord).x;
m = saturate( (m - g_fRayNearPlane) / (g_fRayFarPlane - g_fRayNearPlane) );
// m = saturate(1.f - m);
// float2 p = TexCoord * 2.0f - 1.0f;
// float b = saturate( 1.0f - 0.7071f * dot(p, p) );
return /* b */ m * r * g_fRayColor;
}
// Pixel shader
float4 ps_ray_extrude(float2 TexCoord : TEXCOORD0, float2 LightPos : TEXCOORD2) : COLOR0
{
float2 s = g_fRayDensity / (passID2expIsLast.y) * (LightPos - TexCoord) / 8.f;
float4 r = 0.f, ro = 0.f, rm = 0.f, rd = .125f;
float2 c = TexCoord;
for(int i = 0; i < 8; i++)
{
float4 rs = tex2D(colorSampler, c);
ro = (i == 0) ? rs : ro;
rm = max(rs, rm);
rs.xyz = rm.xyz;
r += rs * rd;
rd.xyz *= (float3)g_fRayDecay;
c += s;
}
r.a = min(ro.a, r.a);
return r * saturate(1.f - passID2expIsLast.z * r.a);
}

View File

@@ -0,0 +1,80 @@
float3 g_vLightDir : register(c1); // = normalize( float3(1.f,-3.f,-2.f) );
float3 g_fTime : register(c3);
sampler3D randomSampler : register(s0);
static float4 g_fSky = float4(0.392f, 0.502f, 0.702f, 0.7f);
static float4 g_fHaze = float4(0.765f, 0.808f, 0.871f, -0.3f);
//static float4 g_fAbyss = float4(0.01f, 0.01f, 0.04f, -1.0f);
static float g_fSunSize = .0025f;
static float g_fCoronaSize = .005f;
static float4 g_fSunColor = float4(0.925f, 1.0f, 0.75f, 1.f);
float4 clouds(float3 d, float4 color)
{
float3 t = float3(g_fTime.x*0.001, 0, 0);
float3 bumpOffset = float3(0.f, .07f, 0.f);
float3 d1 = normalize(d + bumpOffset), d2 = normalize(d + cross(bumpOffset, d));
float4 cloud = tex3D(randomSampler, float3(0.2,0.6,0.2) * d);
float4 cloud1 = tex3D(randomSampler, float3(0.2,0.6,0.2) * d1);
float4 cloud2 = tex3D(randomSampler, float3(0.2,0.6,0.2) * d2);
float cover = g_fTime.z;
float3 smoothAlpha = float3(cloud.a, cloud1.a, cloud2.a);
smoothAlpha = saturate( smoothAlpha - max(cover - smoothAlpha, 0.f) * .25f );
float bumpDepth = .5f;
float3 cloudel = d + d * (bumpDepth - bumpDepth * smoothAlpha.x);
float3 cloudel1 = d1 + d1 * (bumpDepth - bumpDepth * smoothAlpha.y);
float3 cloudel2 = d2 + d2 * (bumpDepth - bumpDepth * smoothAlpha.z);
float3 normal = normalize( cross(cloudel1 - cloudel, cloudel2 - cloudel) );
cloud *= 0.5;
cloud += tex3D(randomSampler, float3(0.4,1.2,0.4) * (d + t)) * 0.25;
cloud += tex3D(randomSampler, float3(0.8,2.4,0.8) * d) * 0.125;
cloud += tex3D(randomSampler, float3(1.6,4.8,1.6) * (d + t)) * 0.0625;
cloud.a = saturate( saturate( cloud.a * 2.5f ) - max(cover - cloud.a, 0.f) * 25.f );
float3 sdd = d + g_vLightDir;
float sd = dot(sdd, sdd);
float s = g_fCoronaSize / ( g_fCoronaSize + saturate(sd - g_fSunSize) );
float light = 0.5f + 0.7f * dot(normal, -g_vLightDir);
float3 stormNormal = normalize(cloud.xyz * 2 - 1);
float stormLight = 0.5f + 0.5f * dot(stormNormal, g_vLightDir);
cloud.xyz = lerp(cloud.xyz, stormLight, 0.3f * saturate(1.f - cover));
cloud.xyz = dot(cloud.xyz, .3f) + 0.1f * cloud.xyz;
cloud.xyz = 1.f - .65f * cloud.xyz * (1.f - 0.2f * cover);
cloud.xyz += 0.4f * light * saturate(cover);
cloud.xyz = cloud.a * cloud.xyz + (1 - cloud.a) * color.xyz;
cloud.xyz += (1 - 0.5f * cloud.a) * g_fSunColor.xyz * s;
float3 riseColor = float3(0.9,0.8,0) * (1 - g_fTime.z * 0.5);
float a = pow( max(0, dot(g_vLightDir, -d)), 2 ) * 0.7 * (1.f - .9f * abs(g_vLightDir.y));
float risefac = -1.f - g_vLightDir.y;
if (sign(dot(g_vLightDir, d)) > 0)
risefac = -1.0;
cloud.xyz += max( 0, a * lerp( riseColor, 1, min(1.0, risefac*1.5) + risefac ) );
cloud.a = 1.f;
return cloud;
}
float4 ps_main(float3 w : TEXCOORD4):color
{
float4 fColor = g_fSky;
float3 d = normalize(w);
float g1 = saturate( (d.y - g_fSky.w) / (g_fHaze.w - g_fSky.w) );
fColor.xyz = lerp(g_fSky.xyz, g_fHaze.xyz, g1);
return clouds(d, fColor);
}

View File

@@ -0,0 +1,115 @@
float4 g_fResolution : register(c0);
float3 g_vLightDir : register(c1);
sampler3D randomSampler : register(s0);
sampler1D diffSampler : register(s2);
sampler1D specSampler : register(s3);
sampler2D shadowSampler : register(s4);
sampler2D depthSampler : register(s5);
static float g_fTileHardness = .6f;
static float g_fTileDepth = 8.f;
static float g_fBumpDepth = .75f;
static float g_fTexScale = 1.f;
static float g_fSpecularPower = 0.5f;
static float g_fSpecularHardness = 32.f;
struct psIn
{
float2 t : TEXCOORD0;
float3 n : TEXCOORD1;
float3 v : TEXCOORD2;
float4 s : TEXCOORD3;
float3 w : TEXCOORD4;
};
float rand_val(float4 r)
{
float lr = dot(r, float4(10.f, 100.f, 1000.f, 1.f));
return lr / 1111.f;
}
float noise(float3 t)
{
float4 r = tex3D(randomSampler, .03125f * t);
return rand_val(r)* 2.f - 1.f;
}
float noise_grad(float3 t, float3 dtX, float3 dtY)
{
float4 r = tex3Dgrad(randomSampler, .03125f * t, .0625f * dtX, .0625f * dtY);
return rand_val(r)* 2.f - 1.f;
}
float abs_noise(float3 t)
{
return abs( noise(t) );
}
float abs_noise_grad(float3 t, float3 dtX, float3 dtY)
{
return abs( noise_grad(t, dtX, dtY) );
}
float4 ps_main(psIn i) : COLOR0
{
float3 t = i.w * g_fTexScale;
float3 pw = i.w.xxz; pw.y = 0.0f; // i.w - i.n * dot(i.w, i.n);
float3 pt = pw * g_fTexScale + .5f;
float3 tt = floor(pt);
float3 dttX = ddx(pt);
float3 dttY = ddy(pt);
// Texturing
float3 fColor = 0.15f * saturate( dot(1.f, abs(dttX) + abs(dttY)) );
fColor += abs_noise_grad(tt, dttX, dttY);
fColor += abs_noise(2.f * t) / 8.f;
fColor += noise(4.f * t) / 8.f;
float fDetail = noise(8.f * t) / 16.f;
fDetail += noise(16.f * t) / 16.f;
fDetail += noise(32.f * t) / 32.f;
fDetail += noise(128.f * t) / 32.f;
fDetail += noise(1024.f * t) / 32.f;
fColor += fDetail;
// Contrast
fColor = 1.0f - saturate(fColor);
fColor *= fColor;
fColor = 1.0f - fColor;
// Super tile
float3 tb = 2.f * frac(pt) - 1.f;
float3 te = tb * tb; // ^2
te *= te; // ^4
te *= te; // ^8
float tdd = saturate(1.f - 2.f * fwidth(pt));
float td = saturate( dot(tdd, te) );
float3 tc = 1.f - td;
float3 ti = saturate(td - g_fTileHardness);
// Bump mapping
float3 n = normalize(i.n + g_fBumpDepth * g_fTileDepth * ti * tb);
// Shadow (AA)
float2 sc = i.s.xy / i.s.w;
float aa = abs( tex2D(depthSampler, sc).x - i.s.z );
float2 ddaa = float2(ddx(aa), ddy(aa));
float2 aaetc = sign(-ddaa) * g_fResolution.zw;
sc += aaetc * saturate(4.f * aa);
float fShadow = 0.2f + 0.8f * (float)tex2D(shadowSampler, sc);
// Diffuse light
fColor *= tex1D( diffSampler, fShadow * (0.5f + 0.5f * dot(n, -g_vLightDir)) ).xyz;
// Specular highlights
float3 h = normalize( normalize(i.v) + -g_vLightDir );
float s = 0.5f + 0.5f * dot(n, h);
s *= saturate(1.f + g_fBumpDepth * fDetail);
fColor += g_fSpecularPower * tex1D(specSampler, fShadow * s).xyz; // pow(s, g_fSpecularHardness)
// Tile borders
fColor *= tc;
return float4(fColor, 1.0f);
}

View File

@@ -0,0 +1,43 @@
float4 g_fResolution : register(c0);
float3 g_vLightDir : register(c1);
sampler1D dif : register(s2);
sampler1D spec : register(s3);
sampler2D shadowSampler : register(s4);
sampler2D depthSampler : register(s5);
static float4 g_fSpecularPower = {1.15f, 1.05f, 1.0f, 1.25f};
struct psIn
{
float4 c : COLOR0;
float2 t : TEXCOORD0;
float3 n : TEXCOORD1;
float3 v : TEXCOORD2;
float4 s : TEXCOORD3;
float3 w : TEXCOORD4;
};
float4 ps_main(psIn i):color
{
// Shadow AA
float2 sc = i.s.xy / i.s.w;
float aa = abs( tex2D(depthSampler, sc).x - i.s.z );
float2 ddaa = float2(ddx(aa), ddy(aa));
float2 aaetc = sign(-ddaa) * g_fResolution.zw;
sc += aaetc * saturate(4.f * aa);
float3 fColor = float3( 0.25f, 0.3f, 0.4f );
float fS= 0.2f + 0.8f * tex2D(shadowSampler, sc);
float3 n = normalize(i.n);
// Lighting
fColor.xyz *= tex1D( dif, fS * ( 0.5f + 0.5f * dot( n, -g_vLightDir) ) );
// Specular highlights
float3 h = normalize( normalize(i.v) + -g_vLightDir );
float s = dot( n, h);
fColor += g_fSpecularPower * tex1D(spec, fS * ( 0.5f + 0.5f * s ) );
return float4(fColor, 1.0f);
}

View File

@@ -0,0 +1,99 @@
float4 g_fResolution : register(c0);
float3 g_vLightDir : register(c1);
float4 g_fTime : register(c3);
sampler3D randomSampler : register(s0);
sampler2D tex : register(s1);
sampler1D diffSampler : register(s2);
sampler1D specSampler : register(s3);
sampler2D shadowSampler : register(s4);
sampler2D depthSampler : register(s5);
static float g_fVariation = .1f;
static float g_fBumpDepth = .02f;
static float g_fBumpFalloff = 256.f;
static float g_fTexScale = 1.f;
static float g_fSpecularPower = 0.2f;
static float g_fSpecularHardness = 32.f;
struct psIn
{
float4 c : COLOR0;
float2 t : TEXCOORD0;
float3 n : TEXCOORD1;
float3 v : TEXCOORD2;
float4 s : TEXCOORD3;
float3 w : TEXCOORD4;
};
float noise(float3 t)
{
float4 r = tex3D(randomSampler, .03125f * t);
float lr = dot(r, float4(1.f, 10.f, 100.f, 1000.f));
return lr * 2.f / 1111.f - 1.f;
}
float abs_noise(float3 t) { return abs( noise(t) ); }
float4 ps_main(psIn i) : COLOR0
{
float3 t = i.w * g_fTexScale;
float4 fColor = i.c;
float fStruct = noise(t) / 2.f;
fStruct += noise(4.f * t) / 4.f;
fStruct += noise(8.f * t) / 8.f;
fStruct += noise(16.f * t) / 16.f;
fStruct += noise(32.f * t) / 32.f;
fColor.xyz *= (1.f - g_fVariation) + g_fVariation * fStruct;
float fDetail = noise(81.f * t) / 2.f;
fDetail += noise(243.f * t) / 4.f;
fDetail += noise(729.f * t) / 8.f;
// Bump mapping
// float ddf = g_fBumpFalloff * dot(fwidth(i.w), 1.f);
float3 pp = i.w + i.n * g_fBumpDepth * (fStruct + fDetail / 16.f); // (1.f + ddf)
float3 ddppx = ddx(pp);
float3 ddppy = ddy(pp);
float3 n = normalize( cross(ddppx, ddppy) );
// calculate coloration (hypno toad commands you!)
float3 wrd= float3(
round( i.w.x / g_fTime.w ) * g_fTime.w,
round( i.w.y / g_fTime.w ) * g_fTime.w,
round( i.w.z / g_fTime.w ) * g_fTime.w );
float fOffset= 33.0f - wrd.z / 8.0f - g_fTime / 56.0f;
if( fOffset < 0.0f )
{
fOffset= 0.0f;
}
float plasmaVal =
sin( sin ( 0.021f * g_fTime + wrd.y * 0.23f ) * 0.7f + wrd.x * 0.09f )
+ sin( 0.009f * g_fTime + sin ( wrd.z * 0.35f ) * 0.9f + wrd.y * 0.47f )
+ sin( sin ( 0.013f * g_fTime + wrd.x * 0.17f ) * 1.3f + wrd.z * 0.13f )
+ fOffset;
if( plasmaVal > 0.0f && plasmaVal < 1.0f )
{
fColor.xyz= tex2D( tex, plasmaVal ).xyz;
}
// Shadow (AA)
float2 sc = i.s.xy / i.s.w;
float aa = abs( tex2D(depthSampler, sc).x - i.s.z );
float2 ddaa = float2(ddx(aa), ddy(aa));
float2 aaetc = sign(-ddaa) * g_fResolution.zw;
sc += aaetc * saturate(4.f * aa);
float fShadow = 0.2f + 0.8f * (float)tex2D(shadowSampler, sc);
// Diffuse light
fColor.xyz *= tex1D( diffSampler, fShadow * (0.5f + 0.5f * dot(n, -g_vLightDir)) ).xyz;
// Specular highlights
float3 h = normalize( normalize(i.v) + -g_vLightDir );
float s = saturate( dot(n, h) );
fColor.xyz += g_fSpecularPower * tex1D(specSampler, fShadow * s).xyz;
return fColor;
}

View File

@@ -0,0 +1,29 @@
float4x4 matWVP : register(c0);
float4 res : register(c5);
float3 viewPos : register(c4);
float3 lightDir : register(c6);
float3x3 viewMatrixRotInv : register(c7);
float4 projScaleOffsetInv : register(c11);
struct vsOut
{
float4 p : POSITION;
float2 t : TEXCOORD0;
float3 e : TEXCOORD1;
float2 l : TEXCOORD2;
};
vsOut vs_main(float4 p : POSITION)
{
vsOut o = { p, p.xy, p.xyw, (float2)0.f };
o.p.xy += float2(-1.f, 1.f) * res.zw;
o.t = o.t * float2(.5f, -.5f) + .5f;
o.e.xy = o.e.xy * projScaleOffsetInv.xy + projScaleOffsetInv.zw;
o.e = mul(o.e, viewMatrixRotInv);
o.e.xy += float2(-1.f, 1.f) * res.zw;
// Compute light position
float4 lightPos = mul( float4(viewPos - lightDir, 1.0f), matWVP );
o.l = clamp( lightPos.xy / abs(lightPos.w), -1.f, 1.f );
o.l = o.l * float2(.5f, -.5f) + .5f;
return o;
};

View File

@@ -0,0 +1,51 @@
float4x4 matWVP : register(c0);
float4x4 matWorld : register(c12);
float4x4 matWorldI : register(c16);
float3 viewPos : register(c4);
float3 viewDir : register(c10);
float4 res : register(c5);
struct vsIn
{
float4 p : POSITION;
float3 n : NORMAL;
float4 c : COLOR;
float2 t : TEXCOORD;
};
struct vsOut
{
float4 p : POSITION;
float4 c : COLOR0;
float2 t : TEXCOORD0;
float3 n : TEXCOORD1;
float3 v : TEXCOORD2;
float4 s : TEXCOORD3;
float3 w : TEXCOORD4;
};
vsOut vs_main(vsIn i)
{
vsOut o;
// Basic transformation of untransformed vertex into clip-space
o.p= mul(i.p, matWVP);
// No scaling or translation is done, simply assign them and let the GPU interpolate
o.c = i.c;
o.t = i.t;
// Trasform to world space
o.w= mul(i.p, matWorld).xyz;
o.n= mul(i.n, transpose((float3x3)matWorldI));
//OUT.normal = mul(matWorldIT, IN.normal);
// Calculate the view vector
o.v= viewPos - o.w;
// (Pre-proj biased screen texcoords, unscaled z, w)
o.s = o.p;
o.s.xy = o.s.xy * float2(.5f, -.5f) + o.s.w * (.5f + .5f * res.zw);
o.s.z = dot(o.w - viewPos, viewDir);
return o;
};

View File

@@ -0,0 +1,25 @@
float4x4 matWVP : register(c0);
float3 viewPos : register(c4);
struct vsOut
{
float4 p : POSITION;
float4 s : TEXCOORD3;
float3 w : TEXCOORD4;
};
vsOut vs_main(float4 p : POSITION)
{
vsOut o;
o.p = p;
o.p.xyz += viewPos;
o.p= mul(o.p, matWVP);
o.p.z= (1.f - 4.8e-6f) * o.p.w;
o.w= p.xyz;
o.s= 4.e3f;
return o;
};

147
evoke-64k/ev10/cfg/psao.txt Normal file
View File

@@ -0,0 +1,147 @@
float4 res : register(c0);
sampler2D colorSampler : register(s0);
sampler2D depthSampler : register(s1);
sampler2D ditherSampler : register(s2);
static float g_fRadiusBase = 0.005f;
static float g_fRadiusScale = 0.25f;
static float g_fFallOff = 0.7f;
static float g_fIntensity = 1.25f;
static float g_fGrain = 0.01f;
static float g_fRange = 1024.0f;
static float g_fBlurSensitivity = 250.f;
static const float3 vSamplePoints[12] = {
float3(0.083333f, 0.000000f, 0.083333f),
float3(-0.144338f, -0.083333f, 0.166667f),
float3(0.125000f, 0.216506f, 0.250000f),
float3(0.000000f, -0.333333f, 0.333333f),
float3(-0.208333f, 0.360844f, 0.416667f),
float3(0.433013f, -0.250000f, 0.500000f),
float3(-0.583333f, -0.000000f, 0.583333f),
float3(0.577350f, 0.333333f, 0.666667f),
float3(-0.375000f, -0.649519f, 0.750000f),
float3(-0.000000f, 0.833333f, 0.833333f),
float3(0.458333f, -0.793857f, 0.916667f),
float3(-0.866025f, 0.500000f, 1.000000f)
};
float4 ps_main(float2 TexCoord : TEXCOORD0) : COLOR0
{
// Sample random 2D matrix
float4 vRotation = tex2D(ditherSampler, TexCoord * res.xy / 32.0f) * 2.0f - 1.0f;
float2x2 mRotation = float2x2(vRotation.xy, vRotation.zw);
// Sample pixel depth
float fDepth = tex2D(depthSampler, TexCoord).x;
// Transform radius to screen space
float3 fScaledRadius = g_fRadiusBase + g_fRadiusScale / ( 8.0f + fDepth );
// Limit radius to reasonable sampling kernels
fScaledRadius = clamp(fScaledRadius, 4.0f * res.z, 64.0f * res.w);
// Transform sampling vector length back to world space
fScaledRadius.z *= fDepth;
float fOcclusion = 0.0f;
float fSampleWeight = 1.f / 18.849556f; // atan version
// float fSampleWeight = 1.f / 12.f;
// Loop over samples
for(int i = 0; i < 12; )
{
float4 fSampleDepth, fSampleRadius;
// Vectorize occlusion code
[unroll] for(int j = 0; j < 4; j++, i++)
{
// Randomly rotate scaled sample points
float3 vSampleOffset = fScaledRadius * vSamplePoints[i];
vSampleOffset.xy = mul(vSampleOffset.xy, mRotation);
// Sample depth texture
fSampleDepth[j] = tex2D(depthSampler, TexCoord + vSampleOffset.xy).x;
fSampleRadius[j] = vSampleOffset.z;
}
// Compute occlusion
float4 fDeltaDepth = (fDepth - fSampleDepth) / fSampleRadius;
float4 fAttenuation = g_fFallOff * fDeltaDepth;
float4 fBlocking = atan(fDeltaDepth) / (1.0f + max(0.0f, fAttenuation)); // atan version
// float4 fBlocking = fDeltaDepth / ( (1.0f + abs(fDeltaDepth)) * (1.0f + max(0.0f, fAttenuation)) );
fOcclusion += dot(fBlocking, fSampleWeight);
}
// Avoid ugly smudge artifacts
float2 fPixelPos = TexCoord * 2.0f - 1.0f;
float fBorderAttenuation = 1.0f - 0.7071f * dot(fPixelPos, fPixelPos);
// Write to intermediate buffer
float fAO = saturate(g_fIntensity * fOcclusion + g_fGrain) * fBorderAttenuation * step(fDepth, g_fRange);
return float4((float3)fAO, 0.f);
}
float4 ps_blur(float2 TexCoord, uniform bool bVertical)
{
float2 fStepSize = float2(1.f, bVertical ? -1.f : 1.f) * res.zw;
float3 fCenterDepths;
// Fetch 3 center depths
fCenterDepths.x = tex2D(depthSampler, TexCoord - fStepSize).x;
fCenterDepths.y = tex2D(depthSampler, TexCoord).x;
fCenterDepths.z = tex2D(depthSampler, TexCoord + fStepSize).x;
float3 fDepthContinuities, fDepthDeltas;
// Compute 3 depth continuity values
fDepthContinuities.x = tex2D(depthSampler, TexCoord - 2.0f * fStepSize).x;
fDepthContinuities.y = fCenterDepths.x;
fDepthContinuities.z = tex2D(depthSampler, TexCoord + 2.0f * fStepSize).x;
fDepthDeltas = fDepthContinuities - fCenterDepths.yzy;
fDepthContinuities += fCenterDepths.yzy - 2.0f * fCenterDepths;
// Correct AA issues
fDepthContinuities = abs(fDepthContinuities);
fDepthDeltas = abs(fDepthDeltas);
fDepthDeltas -= min(min(fDepthDeltas.x, fDepthDeltas.y), fDepthDeltas.z);
// Compute 3 weights
float3 fWeights = 1.0f / (1.0f + g_fBlurSensitivity * (fDepthContinuities + 16.f * fDepthDeltas));
float fOutput = 0.0f;
float3 fSamples;
float3 fSampleWeights = float3(3.0f, 1.5f, 1.0f);
// Blend 5 color samples respecting to the 3 depth continuity weights
fSamples.x = tex2D(colorSampler, TexCoord - 2.0f * fStepSize).x;
fSamples.y = tex2D(colorSampler, TexCoord - fStepSize).x;
fSamples.z = tex2D(colorSampler, TexCoord).x;
fOutput += dot(fSamples, fWeights.x);
fSamples.x = tex2D(colorSampler, TexCoord + fStepSize).x;
fOutput += dot(fSamples, fWeights.y);
fSamples.y = tex2D(colorSampler, TexCoord + 2.0f * fStepSize).x;
fOutput += dot(fSamples, fWeights.z);
// Average output weight
float fOutputWeight = dot(fWeights, 1.0f);
// Average output
fOutput /= 3.0f * fOutputWeight;
// Correction weight
float fCorrectionWeight = saturate(1.0f - fOutputWeight);
// Write to color buffer
fOutput = (1.0f - fCorrectionWeight) * fOutput + fCorrectionWeight * fSamples.z;
return float4((float3)fOutput, 0.f);
}
float4 ps_blur_hor(float2 TexCoord : TEXCOORD0) : COLOR0 { return ps_blur(TexCoord, false); }
float4 ps_blur_ver(float2 TexCoord : TEXCOORD0) : COLOR0 { return ps_blur(TexCoord, true); }

View File

@@ -0,0 +1,59 @@
float4 res : register(c0);
float4 glow : register(c31);
sampler2D colorSampler : register(s0);
sampler2D guideSampler : register(s4);
static float2 fGaussianWeights[] = {
float2(-3.0f, 0.015625f),
float2(-2.0f, 0.09375f),
float2(-1.0f, 0.234375f),
float2(0.0f, 0.3125f),
float2(1.0f, 0.234375f),
float2(2.0f, 0.09375f),
float2(3.0f, 0.015625f)
};
float4 ps_blur(float2 t : TEXCOORD0, uniform float2 vDir) : COLOR0
{
float2 vDelta = vDir * res.zw;
float4 fColor = 0.f;
for(int i = 0; i < 7; i++)
fColor += fGaussianWeights[i].y
* tex2D(colorSampler, t + fGaussianWeights[i].x * vDelta);
return fColor;
}
float4 ps_blur_hor(float2 t : TEXCOORD0) : COLOR0 { return ps_blur(t, float2(1.f, 0.f)); }
float4 ps_blur_ver(float2 t : TEXCOORD0) : COLOR0 { return ps_blur(t, float2(0.f, 1.f)); }
float4 ps_blur_bil(float2 t : TEXCOORD0, uniform float2 vDir) : COLOR0
{
float2 vDelta = vDir * res.zw;
float4 fGuide = tex2D(guideSampler, t);
float4 fColor = 0.f;
float fWeight = 0.f;
for(int i = 0; i < 7; i++)
{
float2 to = t + vDelta * fGaussianWeights[i].x;
float4 fSample = tex2D(colorSampler, to);
float fSampleWeight = (1.f - saturate(4.f * (fGuide.w - fSample.w))) * fGaussianWeights[i].y;
fColor += fSample * fSampleWeight;
fWeight += fSampleWeight;
}
return lerp(fGuide, fColor / fWeight, fWeight);
}
float4 ps_blur_bil_hor(float2 t : TEXCOORD0) : COLOR0 { return ps_blur_bil(t, float2(1.f, 0.f)); }
float4 ps_blur_bil_ver(float2 t : TEXCOORD0) : COLOR0 { return ps_blur_bil(t, float2(0.f, 1.f)); }
float4 ps_extract_inv_alpha(float2 t : TEXCOORD0) : COLOR0
{
float4 c = tex2D(colorSampler, t);
c.a = 1.f - c.a;
c.xyz *= c.a;
return c * glow;
}

View File

@@ -0,0 +1,4 @@
float4 ps_main(float4 s : TEXCOORD3):color
{
return s.z;
}

View File

@@ -0,0 +1,105 @@
float4 res : register(c0);
float2 Dist : register(c3);
sampler2D colorSampler : register(s0);
sampler2D depthSampler : register(s1);
sampler2D blurSampler : register(s4);
// Tweakables
static float g_fRadius = 0.005f;
static float g_fLowRadiusScaling = 0.4f;
static float g_fNearPlane = 1.0f;
static float g_fFocalPlane = Dist.y;
static float g_fDistScale = 1.0f / pow( g_fFocalPlane , 2.5f );
static float g_fFarPlane= 128.0f;
static const float2 vPoissonDisc[] = {
float2(-0.326212f, -0.40581f),
float2(-0.840144f, -0.07358f),
float2(-0.695914f, 0.457137f),
float2(-0.203345f, 0.620716f),
float2(0.96234f, -0.194983f),
float2(0.473434f, -0.480026f),
float2(0.519456f, 0.767022f),
float2(0.185461f, -0.893124f),
float2(0.507431f, 0.064425f),
float2(0.89642f, 0.412458f),
float2(-0.32194f, -0.932615f),
float2(-0.791559f, -0.59771f)
};
float4 ps_blur_intensity(float2 TexCoord : TEXCOORD0) : COLOR0
{
// Sample pixel depth
float fDepth = tex2D(depthSampler, TexCoord).x;
// Anti-aliasing
float4 fDDTexCoords1 = TexCoord.xyxy, fDDTexCoords2 = TexCoord.xyxy;
fDDTexCoords1.zw -= res.zw; fDDTexCoords2.zw += res.zw;
float4 fDDDepth4 = fDepth - float4(
tex2D(depthSampler, fDDTexCoords1.zy).x, tex2D(depthSampler, fDDTexCoords1.xw).x,
tex2D(depthSampler, fDDTexCoords2.zy).x, tex2D(depthSampler, fDDTexCoords2.xw).x );
// fDDDepth4 = lerp(fDDDepth4, abs(fDDDepth4), (fDDDepth4 * fDDDepth4.zwxy) > 0.f);
float2 fDeltaDepth2 = max(fDDDepth4.xy, fDDDepth4.zw);
float fDeltaDepth = max(fDeltaDepth2.x, fDeltaDepth2.y);
float fIntensity;
if(fDepth < g_fFocalPlane)
{
// Close-up blur
fIntensity = (fDepth - g_fFocalPlane) / (g_fFocalPlane - g_fNearPlane);
}
else
{
// Distance blur
float2 fDistances = (fDepth - g_fFocalPlane);
fDistances.y -= max(fDeltaDepth, 0.f);
float2 fIntensities = saturate(fDistances * g_fDistScale );
fIntensity = lerp(fIntensities.y, fIntensities.x, fIntensities.y);
}
// Bias to valid range
return float4(
tex2D(colorSampler, TexCoord).xyz,
saturate(0.5f + 0.5f * fIntensity) );
}
float4 ps_main(float2 TexCoord : TEXCOORD0) : COLOR0
{
// Center pixel depth
float fDepth = tex2D(colorSampler, TexCoord).w;
// Scale sampling radius
float fRadius = abs(2.0f * g_fRadius * fDepth - g_fRadius);
float fLowRadius = fRadius * g_fLowRadiusScaling;
float4 fColor = 0.0f;
float fAmount = 0.0f;
// Loop over samples
for(int i = 0; i < 12; i++)
{
// Sample on poisson disc
float2 fHighSampleTexCoord = TexCoord + fRadius * vPoissonDisc[i];
float2 fLowSampleTexCoord = TexCoord + fLowRadius * vPoissonDisc[i];
// Sample blurred and unblurred texture
float4 fHighSample = tex2D(colorSampler, fHighSampleTexCoord);
float4 fLowSample = tex2D(blurSampler, fLowSampleTexCoord);
// Blend between blurred and unblurred texture
float fSampleBlurIntensity = abs(2.f * fHighSample.w - 1.f);
// * saturate(1.f - 3.f * (fHighSample.w - fLowSample.w));
float4 fSample = lerp(fHighSample, fLowSample, fSampleBlurIntensity);
// Compute smart weight to avoid cross-edge leaking
float fWeight = fSample.w < fDepth ? abs(2.f * fSample.w - 1.f) : 1.f;
// Sum up
fColor += fSample * fWeight;
fAmount += fWeight;
}
return fColor / fAmount;
}

View File

@@ -0,0 +1,80 @@
float4 g_fResolution : register(c0);
float3 g_vLightDir : register(c1);
sampler2D randomSampler : register(s0);
sampler1D diffSampler : register(s2);
sampler2D shadowSampler : register(s4);
sampler2D depthSampler : register(s5);
static float3 g_fColor = float3(0.45f, 0.5f, 0.18f); // float3(.2f, .5f, .1f);
static float g_fTexScale = .25f;
static float g_fDensity = 3.f;
static float2 g_fInnerOuterRadiusSq = float2(240.f * 240.f, 380.f * 380.f);
static float4 g_fHaze = float4(0.765f, 0.808f, 0.871f, -0.3f);
static float2 g_fHazeDensityIntensity = float2(0.25f, 0.6f);
struct psIn
{
float2 t : TEXCOORD0;
float3 n : TEXCOORD1;
float3 v : TEXCOORD2;
float4 s : TEXCOORD3;
float3 w : TEXCOORD4;
};
float noise(float2 t)
{
float4 r = tex2D(randomSampler, .03125f * t);
float lr = dot(r, float4(1.f, 10.f, 100.f, 1000.f));
return lr * 2.f / 1111.f - 1.f;
}
float abs_noise(float2 t) { return abs( noise(t) ); }
float4 ps_main(psIn i):color
{
float2 t = i.w.xz * g_fTexScale;
float fCenterDist = dot(i.w.xz, i.w.xz) - g_fInnerOuterRadiusSq.x;
fCenterDist /= g_fInnerOuterRadiusSq.y - g_fInnerOuterRadiusSq.x;
// Texturing
float4 fColor = abs_noise(t) / 2.f;
fColor.xyz = 0.5f + 0.1f * fColor.xyz;
fColor.zw += noise(2.f * t) / float2(32.f, 4.f);
fColor.xw += noise(4.f * t) / float2(64.f, 8.f);
fColor.yw += noise(8.f * t) / float2(16.f, 16.f);
fColor.xyz += noise(16.f * t) / 16.f;
fColor.xyz += noise(32.f * t) / 32.f;
fColor.xyz += noise(128.f * t) / 32.f;
fColor.xyz += noise(1024.f * t) / 32.f;
// Color
fColor.xyz *= 2.f * fColor.xyz;
fColor.xyz *= g_fColor;
// Density
fColor.w = saturate(g_fDensity * fColor.w + fCenterDist);
// Shadow (AA)
float2 sc = i.s.xy / i.s.w;
float aa = abs( tex2D(depthSampler, sc).x - i.s.z );
float2 ddaa = float2(ddx(aa), ddy(aa));
float2 aaetc = sign(-ddaa) * g_fResolution.zw;
sc += aaetc * saturate(4.f * aa);
float fShadow = 0.2f + 0.8f * (float)tex2D(shadowSampler, sc);
// Diffuse light
fColor.xyz *= tex1D( diffSampler, fShadow * (0.5f + 0.5f * dot(normalize(i.n), -g_vLightDir)) ).xyz;
// Haze
fColor.xyz = lerp( fColor.xyz, g_fHaze,
saturate(g_fHazeDensityIntensity.x * fCenterDist) * g_fHazeDensityIntensity.y );
// Premultiplied alpha
fColor.xyz *= fColor.a;
return fColor;
}

View File

@@ -0,0 +1,43 @@
float4 g_fResolution : register(c0);
float3 g_vLightDir : register(c1);
sampler1D dif : register(s2);
sampler1D spec : register(s3);
sampler2D shadowSampler : register(s4);
sampler2D depthSampler : register(s5);
static float4 g_fSpecularPower = {0.85f, 0.85f, 0.85f, 0.85f};
struct psIn
{
float4 c : COLOR0;
float2 t : TEXCOORD0;
float3 n : TEXCOORD1;
float3 v : TEXCOORD2;
float4 s : TEXCOORD3;
float3 w : TEXCOORD4;
};
float4 ps_main(psIn i):color
{
// Shadow AA
float2 sc = i.s.xy / i.s.w;
float aa = abs( tex2D(depthSampler, sc).x - i.s.z );
float2 ddaa = float2(ddx(aa), ddy(aa));
float2 aaetc = sign(-ddaa) * g_fResolution.zw;
sc += aaetc * saturate(4.f * aa);
float4 fColor = i.c;
float fS= 0.2f + 0.8f * tex2D(shadowSampler, sc);
float3 n = normalize(i.n);
// Lighting
fColor.xyz *= tex1D( dif, fS * ( 0.5f + 0.5f * dot( n, -g_vLightDir) ) );
// Specular highlights
float3 h = normalize( normalize(i.v) + -g_vLightDir );
float s = dot(n, h);
fColor.xyz += g_fSpecularPower * tex1D(spec, fS * ( 0.5f + 0.5f * s ) );
return fColor;
}

View File

@@ -0,0 +1,108 @@
float2 g_fResolution : register(c0);
float3 g_vViewPos : register(c2);
float g_fSplit : register(c23);
float4x4 g_mShadowVP : register(c24);
float3 g_vShadowViewPos : register(c28);
float3 g_vShadowViewDir : register(c29);
float4 g_fShadowMapScalingRes : register(c30);
sampler2D shadowMapSampler : register(s0);
sampler2D depthSampler : register(s1);
sampler2D ditherSampler : register(s2);
static float g_fRadius = 6.0f / 64.0f;
static float g_fBias = 4.0f / 64.0f;
static float g_fDepthBias = 16.0f / 64.0f;
static float g_fBiasFalloff = 1.5f / 64.0f;
static float g_fSharpness = 640.0f / 64.0f;
static float g_fBlurSharpness = 640.0f / 64.0f;
static float g_fDepthBlurSharpness = 16.0f / 64.0f;
static const float2 s_vShadowDisc[] = {
float2(-0.326212f, -0.40581f),
float2(-0.840144f, -0.07358f),
float2(-0.695914f, 0.457137f),
float2(-0.203345f, 0.620716f),
float2(0.96234f, -0.194983f),
float2(0.473434f, -0.480026f),
float2(0.519456f, 0.767022f),
float2(0.185461f, -0.893124f),
float2(0.507431f, 0.064425f),
float2(0.89642f, 0.412458f),
float2(-0.32194f, -0.932615f),
float2(-0.791559f, -0.59771f)
};
float4 ps_main(float2 TexCoord : TEXCOORD0, float3 EyeDir : TEXCOORD1) : COLOR0
{
// Compute eye space position
float fEyeDepth = tex2D(depthSampler, TexCoord).x;
float4 vEyePoint = float4(g_vViewPos + fEyeDepth * EyeDir, 1.0f);
// Transform eye point to shadow space
float4 vShadowCoord = mul(vEyePoint, g_mShadowVP);
vShadowCoord.z = dot(vEyePoint.xyz - g_vShadowViewPos, g_vShadowViewDir);
vShadowCoord.xy = vShadowCoord.xy * float2(.5f, -.5f)
+ vShadowCoord.w * (.5f + .5f / g_fShadowMapScalingRes.zw);
// Scale radius
float2 fScaledRadius = g_fRadius * g_fShadowMapScalingRes.xy;
// Transform to shadow map
float2 vShadowCoordProj = vShadowCoord.xy / vShadowCoord.w;
// Clip pixels outside shadow map
clip( float4(vShadowCoordProj, 1.0f - vShadowCoordProj) - fScaledRadius.xyxy );
// Compute sampling plane
float4 vShadowCoordDDX = ddx(vShadowCoord), vShadowCoordDDY = ddy(vShadowCoord);
float2 vShadowCoordDeltaDepth = float2(
vShadowCoordDDX.y * vShadowCoordDDY.z - vShadowCoordDDY.y * vShadowCoordDDX.z,
vShadowCoordDDY.x * vShadowCoordDDX.z - vShadowCoordDDX.x * vShadowCoordDDY.z )
/ (vShadowCoordDDY.x * vShadowCoordDDX.y - vShadowCoordDDX.x * vShadowCoordDDY.y);
vShadowCoordDeltaDepth = vShadowCoord.w * clamp(vShadowCoordDeltaDepth, -16.f, 16.f);
// Compute bias
float fAdaption = 1.f / (1.0f + g_fBiasFalloff * fEyeDepth);
float fAdaptedBias = g_fBias; // lerp(g_fDepthBias, g_fBias, fAdaption);
float fAdaptedBlurSharpness = lerp(g_fDepthBlurSharpness, g_fBlurSharpness, fAdaption);
// Apply bias
float fReferenceDepth = vShadowCoord.z - fAdaptedBias;
// Sample random 2D matrix
float4 vRotation = tex2D(ditherSampler, TexCoord * g_fResolution / 32.0f) * 2.0f - 1.0f;
float2x2 mRotation = float2x2(vRotation.xy, vRotation.zw);
float fShadow = -1.f;
float fSampleWeight = 1.f / 6;
// Sample
for(int i = 0; i < 12; )
{
float4 fSampleDepth;
// Vectorize occlusion code
[unroll] for(int j = 0; j < 4; j++, i++)
{
// Compute some point around this pixel
float2 vSampleOffset = fScaledRadius * mul(s_vShadowDisc[i], mRotation);
// Compute depth delta
float fSampleDeltaDepth = dot(vSampleOffset * vShadowCoordDeltaDepth, 1.f);
// Sample shadow map
fSampleDepth[j] = tex2D(shadowMapSampler, vShadowCoordProj + vSampleOffset).x - fSampleDeltaDepth;
}
// Compare shadow map depth with pixel depth
// (fSampleDepth < fReferenceDepth)
float4 fOcclusion = saturate(fAdaptedBlurSharpness * (fReferenceDepth - fSampleDepth));
// Sum up samples
fShadow += dot(fOcclusion, fSampleWeight);
}
// Write to intermediate buffer
return (1.0f - fShadow); // * float4(g_fSplit == float3(0, 1, 2) || g_fSplit == float3(3, 4, 5), 1.0f);
}

View File

@@ -0,0 +1,46 @@
float4 g_fResolution : register(c0);
float3 g_vLightDir : register(c1);
sampler2D tex : register(s0);
sampler1D dif : register(s2);
sampler1D spec : register(s3);
sampler2D shadowSampler : register(s4);
sampler2D depthSampler : register(s5);
static float4 g_fSpecularPower = {0.85f, 0.85f, 0.85f, 0.85f};
struct psIn
{
float4 c : COLOR0;
float2 t : TEXCOORD0;
float3 n : TEXCOORD1;
float3 v : TEXCOORD2;
float4 s : TEXCOORD3;
float3 w : TEXCOORD4;
};
float4 ps_main(psIn i):color
{
// Shadow AA
float2 sc = i.s.xy / i.s.w;
float aa = abs( tex2D(depthSampler, sc).x - i.s.z );
float2 ddaa = float2(ddx(aa), ddy(aa));
float2 aaetc = sign(-ddaa) * g_fResolution.zw;
sc += aaetc * saturate(4.f * aa);
float4 fColor = i.c * tex2D( tex, i.t );
float fS= 0.125f + 0.875f * tex2D(shadowSampler, sc);
// Lighting
fColor.xyz *= tex1D(dif, fS * ( 0.5f + 0.5f * dot( i.n, -g_vLightDir) ));
// Specular highlights
float3 h = normalize( normalize(i.v) + -g_vLightDir );
float s = dot(i.n, h);
fColor.xyz += g_fSpecularPower * tex1D(spec, fS * ( 0.5f + 0.5f * s ) );
// Red-only glow
// fColor.a = saturate(fColor.a + 1.f - fColor.r);
return fColor;
}

View File

@@ -0,0 +1,56 @@
float3 lightDir : register(c1);
float3 viewDir : register(c4);
float3 passID2expIsLast : register(c23);
sampler2D colorSampler : register(s0);
sampler2D depthSampler : register(s1);
// Tweakables
static float4 g_fRayColor = float4(0.9f, 0.8f, 0.7f, 1.0f);
static float g_fRayNearPlane = 10.0f;
static float g_fRayFarPlane = 500.0f;
static float g_fRayDensity = 0.25f;
static float g_fRayDecay = 0.9125f;
static float g_fRayAnglePersistence = 4.f;
float4 ps_ray_mask(float2 TexCoord : TEXCOORD0, float2 LightPos : TEXCOORD2) : COLOR0
{
float2 d = LightPos - TexCoord;
float r = saturate( 1.f - dot(d, d) );
r *= saturate( g_fRayAnglePersistence * dot(-lightDir, viewDir) );
float m = tex2D(depthSampler, TexCoord).x;
m = saturate( (m - g_fRayNearPlane) / (g_fRayFarPlane - g_fRayNearPlane) );
// m = saturate(1.f - m);
// float2 p = TexCoord * 2.0f - 1.0f;
// float b = saturate( 1.0f - 0.7071f * dot(p, p) );
return /* b */ m * r * g_fRayColor;
}
// Pixel shader
float4 ps_ray_extrude(float2 TexCoord : TEXCOORD0, float2 LightPos : TEXCOORD2) : COLOR0
{
float2 s = g_fRayDensity / (passID2expIsLast.y) * (LightPos - TexCoord) / 8.f;
float4 r = 0.f, ro = 0.f, rm = 0.f, rd = .125f;
float2 c = TexCoord;
for(int i = 0; i < 8; i++)
{
float4 rs = tex2D(colorSampler, c);
ro = (i == 0) ? rs : ro;
rm = max(rs, rm);
rs.xyz = rm.xyz;
r += rs * rd;
rd.xyz *= (float3)g_fRayDecay;
c += s;
}
r.a = min(ro.a, r.a);
return r * saturate(1.f - passID2expIsLast.z * r.a);
}

View File

@@ -0,0 +1,80 @@
float3 g_vLightDir : register(c1); // = normalize( float3(1.f,-3.f,-2.f) );
float3 g_fTime : register(c3);
sampler3D randomSampler : register(s0);
static float4 g_fSky = float4(0.392f, 0.502f, 0.702f, 0.7f);
static float4 g_fHaze = float4(0.765f, 0.808f, 0.871f, -0.3f);
//static float4 g_fAbyss = float4(0.01f, 0.01f, 0.04f, -1.0f);
static float g_fSunSize = .0025f;
static float g_fCoronaSize = .005f;
static float4 g_fSunColor = float4(0.925f, 1.0f, 0.75f, 1.f);
float4 clouds(float3 d, float4 color)
{
float3 t = float3(g_fTime.x*0.001, 0, 0);
float3 bumpOffset = float3(0.f, .07f, 0.f);
float3 d1 = normalize(d + bumpOffset), d2 = normalize(d + cross(bumpOffset, d));
float4 cloud = tex3D(randomSampler, float3(0.2,0.6,0.2) * d);
float4 cloud1 = tex3D(randomSampler, float3(0.2,0.6,0.2) * d1);
float4 cloud2 = tex3D(randomSampler, float3(0.2,0.6,0.2) * d2);
float cover = g_fTime.z;
float3 smoothAlpha = float3(cloud.a, cloud1.a, cloud2.a);
smoothAlpha = saturate( smoothAlpha - max(cover - smoothAlpha, 0.f) * .25f );
float bumpDepth = .5f;
float3 cloudel = d + d * (bumpDepth - bumpDepth * smoothAlpha.x);
float3 cloudel1 = d1 + d1 * (bumpDepth - bumpDepth * smoothAlpha.y);
float3 cloudel2 = d2 + d2 * (bumpDepth - bumpDepth * smoothAlpha.z);
float3 normal = normalize( cross(cloudel1 - cloudel, cloudel2 - cloudel) );
cloud *= 0.5;
cloud += tex3D(randomSampler, float3(0.4,1.2,0.4) * (d + t)) * 0.25;
cloud += tex3D(randomSampler, float3(0.8,2.4,0.8) * d) * 0.125;
cloud += tex3D(randomSampler, float3(1.6,4.8,1.6) * (d + t)) * 0.0625;
cloud.a = saturate( saturate( cloud.a * 2.5f ) - max(cover - cloud.a, 0.f) * 25.f );
float3 sdd = d + g_vLightDir;
float sd = dot(sdd, sdd);
float s = g_fCoronaSize / ( g_fCoronaSize + saturate(sd - g_fSunSize) );
float light = 0.5f + 0.7f * dot(normal, -g_vLightDir);
float3 stormNormal = normalize(cloud.xyz * 2 - 1);
float stormLight = 0.5f + 0.5f * dot(stormNormal, g_vLightDir);
cloud.xyz = lerp(cloud.xyz, stormLight, 0.3f * saturate(1.f - cover));
cloud.xyz = dot(cloud.xyz, .3f) + 0.1f * cloud.xyz;
cloud.xyz = 1.f - .65f * cloud.xyz * (1.f - 0.2f * cover);
cloud.xyz += 0.4f * light * saturate(cover);
cloud.xyz = cloud.a * cloud.xyz + (1 - cloud.a) * color.xyz;
cloud.xyz += (1 - 0.5f * cloud.a) * g_fSunColor.xyz * s;
float3 riseColor = float3(0.9,0.8,0) * (1 - g_fTime.z * 0.5);
float a = pow( max(0, dot(g_vLightDir, -d)), 2 ) * 0.7 * (1.f - .9f * abs(g_vLightDir.y));
float risefac = -1.f - g_vLightDir.y;
if (sign(dot(g_vLightDir, d)) > 0)
risefac = -1.0;
cloud.xyz += max( 0, a * lerp( riseColor, 1, min(1.0, risefac*1.5) + risefac ) );
cloud.a = 1.f;
return cloud;
}
float4 ps_main(float3 w : TEXCOORD4):color
{
float4 fColor = g_fSky;
float3 d = normalize(w);
float g1 = saturate( (d.y - g_fSky.w) / (g_fHaze.w - g_fSky.w) );
fColor.xyz = lerp(g_fSky.xyz, g_fHaze.xyz, g1);
return clouds(d, fColor);
}

View File

@@ -0,0 +1,115 @@
float4 g_fResolution : register(c0);
float3 g_vLightDir : register(c1);
sampler3D randomSampler : register(s0);
sampler1D diffSampler : register(s2);
sampler1D specSampler : register(s3);
sampler2D shadowSampler : register(s4);
sampler2D depthSampler : register(s5);
static float g_fTileHardness = .6f;
static float g_fTileDepth = 8.f;
static float g_fBumpDepth = .75f;
static float g_fTexScale = 1.f;
static float g_fSpecularPower = 0.5f;
static float g_fSpecularHardness = 32.f;
struct psIn
{
float2 t : TEXCOORD0;
float3 n : TEXCOORD1;
float3 v : TEXCOORD2;
float4 s : TEXCOORD3;
float3 w : TEXCOORD4;
};
float rand_val(float4 r)
{
float lr = dot(r, float4(10.f, 100.f, 1000.f, 1.f));
return lr / 1111.f;
}
float noise(float3 t)
{
float4 r = tex3D(randomSampler, .03125f * t);
return rand_val(r)* 2.f - 1.f;
}
float noise_grad(float3 t, float3 dtX, float3 dtY)
{
float4 r = tex3Dgrad(randomSampler, .03125f * t, .0625f * dtX, .0625f * dtY);
return rand_val(r)* 2.f - 1.f;
}
float abs_noise(float3 t)
{
return abs( noise(t) );
}
float abs_noise_grad(float3 t, float3 dtX, float3 dtY)
{
return abs( noise_grad(t, dtX, dtY) );
}
float4 ps_main(psIn i) : COLOR0
{
float3 t = i.w * g_fTexScale;
float3 pw = i.w.xxz; pw.y = 0.0f; // i.w - i.n * dot(i.w, i.n);
float3 pt = pw * g_fTexScale + .5f;
float3 tt = floor(pt);
float3 dttX = ddx(pt);
float3 dttY = ddy(pt);
// Texturing
float3 fColor = 0.15f * saturate( dot(1.f, abs(dttX) + abs(dttY)) );
fColor += abs_noise_grad(tt, dttX, dttY);
fColor += abs_noise(2.f * t) / 8.f;
fColor += noise(4.f * t) / 8.f;
float fDetail = noise(8.f * t) / 16.f;
fDetail += noise(16.f * t) / 16.f;
fDetail += noise(32.f * t) / 32.f;
fDetail += noise(128.f * t) / 32.f;
fDetail += noise(1024.f * t) / 32.f;
fColor += fDetail;
// Contrast
fColor = 1.0f - saturate(fColor);
fColor *= fColor;
fColor = 1.0f - fColor;
// Super tile
float3 tb = 2.f * frac(pt) - 1.f;
float3 te = tb * tb; // ^2
te *= te; // ^4
te *= te; // ^8
float tdd = saturate(1.f - 2.f * fwidth(pt));
float td = saturate( dot(tdd, te) );
float3 tc = 1.f - td;
float3 ti = saturate(td - g_fTileHardness);
// Bump mapping
float3 n = normalize(i.n + g_fBumpDepth * g_fTileDepth * ti * tb);
// Shadow (AA)
float2 sc = i.s.xy / i.s.w;
float aa = abs( tex2D(depthSampler, sc).x - i.s.z );
float2 ddaa = float2(ddx(aa), ddy(aa));
float2 aaetc = sign(-ddaa) * g_fResolution.zw;
sc += aaetc * saturate(4.f * aa);
float fShadow = 0.2f + 0.8f * (float)tex2D(shadowSampler, sc);
// Diffuse light
fColor *= tex1D( diffSampler, fShadow * (0.5f + 0.5f * dot(n, -g_vLightDir)) ).xyz;
// Specular highlights
float3 h = normalize( normalize(i.v) + -g_vLightDir );
float s = 0.5f + 0.5f * dot(n, h);
s *= saturate(1.f + g_fBumpDepth * fDetail);
fColor += g_fSpecularPower * tex1D(specSampler, fShadow * s).xyz; // pow(s, g_fSpecularHardness)
// Tile borders
fColor *= tc;
return float4(fColor, 1.0f);
}

View File

@@ -0,0 +1,43 @@
float4 g_fResolution : register(c0);
float3 g_vLightDir : register(c1);
sampler1D dif : register(s2);
sampler1D spec : register(s3);
sampler2D shadowSampler : register(s4);
sampler2D depthSampler : register(s5);
static float4 g_fSpecularPower = {1.15f, 1.05f, 1.0f, 1.25f};
struct psIn
{
float4 c : COLOR0;
float2 t : TEXCOORD0;
float3 n : TEXCOORD1;
float3 v : TEXCOORD2;
float4 s : TEXCOORD3;
float3 w : TEXCOORD4;
};
float4 ps_main(psIn i):color
{
// Shadow AA
float2 sc = i.s.xy / i.s.w;
float aa = abs( tex2D(depthSampler, sc).x - i.s.z );
float2 ddaa = float2(ddx(aa), ddy(aa));
float2 aaetc = sign(-ddaa) * g_fResolution.zw;
sc += aaetc * saturate(4.f * aa);
float3 fColor = float3( 0.25f, 0.3f, 0.4f );
float fS= 0.2f + 0.8f * tex2D(shadowSampler, sc);
float3 n = normalize(i.n);
// Lighting
fColor.xyz *= tex1D( dif, fS * ( 0.5f + 0.5f * dot( n, -g_vLightDir) ) );
// Specular highlights
float3 h = normalize( normalize(i.v) + -g_vLightDir );
float s = dot( n, h);
fColor += g_fSpecularPower * tex1D(spec, fS * ( 0.5f + 0.5f * s ) );
return float4(fColor, 1.0f);
}

View File

@@ -0,0 +1,99 @@
float4 g_fResolution : register(c0);
float3 g_vLightDir : register(c1);
float4 g_fTime : register(c3);
sampler3D randomSampler : register(s0);
sampler2D tex : register(s1);
sampler1D diffSampler : register(s2);
sampler1D specSampler : register(s3);
sampler2D shadowSampler : register(s4);
sampler2D depthSampler : register(s5);
static float g_fVariation = .1f;
static float g_fBumpDepth = .02f;
static float g_fBumpFalloff = 256.f;
static float g_fTexScale = 1.f;
static float g_fSpecularPower = 0.2f;
static float g_fSpecularHardness = 32.f;
struct psIn
{
float4 c : COLOR0;
float2 t : TEXCOORD0;
float3 n : TEXCOORD1;
float3 v : TEXCOORD2;
float4 s : TEXCOORD3;
float3 w : TEXCOORD4;
};
float noise(float3 t)
{
float4 r = tex3D(randomSampler, .03125f * t);
float lr = dot(r, float4(1.f, 10.f, 100.f, 1000.f));
return lr * 2.f / 1111.f - 1.f;
}
float abs_noise(float3 t) { return abs( noise(t) ); }
float4 ps_main(psIn i) : COLOR0
{
float3 t = i.w * g_fTexScale;
float4 fColor = i.c;
float fStruct = noise(t) / 2.f;
fStruct += noise(4.f * t) / 4.f;
fStruct += noise(8.f * t) / 8.f;
fStruct += noise(16.f * t) / 16.f;
fStruct += noise(32.f * t) / 32.f;
fColor.xyz *= (1.f - g_fVariation) + g_fVariation * fStruct;
float fDetail = noise(81.f * t) / 2.f;
fDetail += noise(243.f * t) / 4.f;
fDetail += noise(729.f * t) / 8.f;
// Bump mapping
// float ddf = g_fBumpFalloff * dot(fwidth(i.w), 1.f);
float3 pp = i.w + i.n * g_fBumpDepth * (fStruct + fDetail / 16.f); // (1.f + ddf)
float3 ddppx = ddx(pp);
float3 ddppy = ddy(pp);
float3 n = normalize( cross(ddppx, ddppy) );
// calculate coloration (hypno toad commands you!)
float3 wrd= float3(
round( i.w.x / g_fTime.w ) * g_fTime.w,
round( i.w.y / g_fTime.w ) * g_fTime.w,
round( i.w.z / g_fTime.w ) * g_fTime.w );
float fOffset= 33.0f - wrd.z / 8.0f - g_fTime / 56.0f;
if( fOffset < 0.0f )
{
fOffset= 0.0f;
}
float plasmaVal =
sin( sin ( 0.021f * g_fTime + wrd.y * 0.23f ) * 0.7f + wrd.x * 0.09f )
+ sin( 0.009f * g_fTime + sin ( wrd.z * 0.35f ) * 0.9f + wrd.y * 0.47f )
+ sin( sin ( 0.013f * g_fTime + wrd.x * 0.17f ) * 1.3f + wrd.z * 0.13f )
+ fOffset;
if( plasmaVal > 0.0f && plasmaVal < 1.0f )
{
fColor.xyz= tex2D( tex, plasmaVal ).xyz;
}
// Shadow (AA)
float2 sc = i.s.xy / i.s.w;
float aa = abs( tex2D(depthSampler, sc).x - i.s.z );
float2 ddaa = float2(ddx(aa), ddy(aa));
float2 aaetc = sign(-ddaa) * g_fResolution.zw;
sc += aaetc * saturate(4.f * aa);
float fShadow = 0.2f + 0.8f * (float)tex2D(shadowSampler, sc);
// Diffuse light
fColor.xyz *= tex1D( diffSampler, fShadow * (0.5f + 0.5f * dot(n, -g_vLightDir)) ).xyz;
// Specular highlights
float3 h = normalize( normalize(i.v) + -g_vLightDir );
float s = saturate( dot(n, h) );
fColor.xyz += g_fSpecularPower * tex1D(specSampler, fShadow * s).xyz;
return fColor;
}

View File

@@ -0,0 +1,29 @@
float4x4 matWVP : register(c0);
float4 res : register(c5);
float3 viewPos : register(c4);
float3 lightDir : register(c6);
float3x3 viewMatrixRotInv : register(c7);
float4 projScaleOffsetInv : register(c11);
struct vsOut
{
float4 p : POSITION;
float2 t : TEXCOORD0;
float3 e : TEXCOORD1;
float2 l : TEXCOORD2;
};
vsOut vs_main(float4 p : POSITION)
{
vsOut o = { p, p.xy, p.xyw, (float2)0.f };
o.p.xy += float2(-1.f, 1.f) * res.zw;
o.t = o.t * float2(.5f, -.5f) + .5f;
o.e.xy = o.e.xy * projScaleOffsetInv.xy + projScaleOffsetInv.zw;
o.e = mul(o.e, viewMatrixRotInv);
o.e.xy += float2(-1.f, 1.f) * res.zw;
// Compute light position
float4 lightPos = mul( float4(viewPos - lightDir, 1.0f), matWVP );
o.l = clamp( lightPos.xy / abs(lightPos.w), -1.f, 1.f );
o.l = o.l * float2(.5f, -.5f) + .5f;
return o;
};

View File

@@ -0,0 +1,51 @@
float4x4 matWVP : register(c0);
float4x4 matWorld : register(c12);
float4x4 matWorldI : register(c16);
float3 viewPos : register(c4);
float3 viewDir : register(c10);
float4 res : register(c5);
struct vsIn
{
float4 p : POSITION;
float3 n : NORMAL;
float4 c : COLOR;
float2 t : TEXCOORD;
};
struct vsOut
{
float4 p : POSITION;
float4 c : COLOR0;
float2 t : TEXCOORD0;
float3 n : TEXCOORD1;
float3 v : TEXCOORD2;
float4 s : TEXCOORD3;
float3 w : TEXCOORD4;
};
vsOut vs_main(vsIn i)
{
vsOut o;
// Basic transformation of untransformed vertex into clip-space
o.p= mul(i.p, matWVP);
// No scaling or translation is done, simply assign them and let the GPU interpolate
o.c = i.c;
o.t = i.t;
// Trasform to world space
o.w= mul(i.p, matWorld).xyz;
o.n= mul(i.n, transpose((float3x3)matWorldI));
//OUT.normal = mul(matWorldIT, IN.normal);
// Calculate the view vector
o.v= viewPos - o.w;
// (Pre-proj biased screen texcoords, unscaled z, w)
o.s = o.p;
o.s.xy = o.s.xy * float2(.5f, -.5f) + o.s.w * (.5f + .5f * res.zw);
o.s.z = dot(o.w - viewPos, viewDir);
return o;
};

View File

@@ -0,0 +1,25 @@
float4x4 matWVP : register(c0);
float3 viewPos : register(c4);
struct vsOut
{
float4 p : POSITION;
float4 s : TEXCOORD3;
float3 w : TEXCOORD4;
};
vsOut vs_main(float4 p : POSITION)
{
vsOut o;
o.p = p;
o.p.xyz += viewPos;
o.p= mul(o.p, matWVP);
o.p.z= (1.f - 4.8e-6f) * o.p.w;
o.w= p.xyz;
o.s= 4.e3f;
return o;
};

23
evoke-64k/ev10/cmath.sln Normal file
View File

@@ -0,0 +1,23 @@
Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cmath", "cmath.vcproj", "{432C01B6-F6CA-4701-B6BC-EC00C4F8CB30}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug_Ex|Win32 = Debug_Ex|Win32
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{432C01B6-F6CA-4701-B6BC-EC00C4F8CB30}.Debug_Ex|Win32.ActiveCfg = Debug_Ex|Win32
{432C01B6-F6CA-4701-B6BC-EC00C4F8CB30}.Debug_Ex|Win32.Build.0 = Debug_Ex|Win32
{432C01B6-F6CA-4701-B6BC-EC00C4F8CB30}.Debug|Win32.ActiveCfg = Debug|Win32
{432C01B6-F6CA-4701-B6BC-EC00C4F8CB30}.Debug|Win32.Build.0 = Debug|Win32
{432C01B6-F6CA-4701-B6BC-EC00C4F8CB30}.Release|Win32.ActiveCfg = Release|Win32
{432C01B6-F6CA-4701-B6BC-EC00C4F8CB30}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

637
evoke-64k/ev10/cmath.vcproj Normal file
View File

@@ -0,0 +1,637 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8,00"
Name="cmath"
ProjectGUID="{432C01B6-F6CA-4701-B6BC-EC00C4F8CB30}"
RootNamespace="cmath"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Release|Win32"
OutputDirectory=".\Release"
IntermediateDirectory=".\Release"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC70.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="2"
WholeProgramOptimization="0"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="NDEBUG"
MkTypLibCompatible="true"
SuppressStartupBanner="true"
TargetEnvironment="1"
TypeLibraryName=".\Release/cmath.tlb"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="/GA /fp:fast /QIfist"
Optimization="1"
InlineFunctionExpansion="2"
EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="2"
OmitFramePointers="true"
WholeProgramOptimization="false"
PreprocessorDefinitions="WIN32,NDEBUG,_WINDOWS,SUPERSMALL"
StringPooling="true"
ExceptionHandling="0"
RuntimeLibrary="2"
StructMemberAlignment="0"
BufferSecurityCheck="false"
EnableFunctionLevelLinking="true"
EnableEnhancedInstructionSet="0"
FloatingPointModel="2"
RuntimeTypeInfo="false"
PrecompiledHeaderFile=".\Release/cmath.pch"
AssemblerOutput="4"
AssemblerListingLocation=".\Release/"
ObjectFile=".\Release/"
ProgramDataBaseFileName=".\Release/"
BrowseInformation="1"
WarningLevel="3"
SuppressStartupBanner="true"
DebugInformationFormat="1"
CallingConvention="0"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1031"
/>
<Tool
Name="VCPreLinkEventTool"
CommandLine=""
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="gdi32.lib user32.lib libv2.lib dsound.lib d3d9.lib d3dx9.lib winmm.lib"
ShowProgress="0"
OutputFile=".\Release/cmath_blubb.exe"
LinkIncremental="1"
SuppressStartupBanner="true"
GenerateManifest="false"
IgnoreAllDefaultLibraries="true"
GenerateDebugInformation="false"
ProgramDatabaseFile=".\Release/cmath.pdb"
SubSystem="2"
OptimizeForWindows98="1"
EntryPointSymbol="WinEntry"
TurnOffAssemblyGeneration="false"
MergeSections=""
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
EmbedManifest="false"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
CommandLine=""
/>
</Configuration>
<Configuration
Name="Debug|Win32"
OutputDirectory=".\Debug"
IntermediateDirectory=".\Debug"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC70.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="_DEBUG"
MkTypLibCompatible="true"
SuppressStartupBanner="true"
TargetEnvironment="1"
TypeLibraryName=".\Debug/cmath.tlb"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32,_DEBUG,_WINDOWS,SUPERSMALL"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
FloatingPointModel="2"
UsePrecompiledHeader="0"
PrecompiledHeaderFile=".\Debug/cmath.pch"
AssemblerListingLocation=".\Debug/"
ObjectFile=".\Debug/"
ProgramDataBaseFileName=".\Debug/"
WarningLevel="3"
SuppressStartupBanner="true"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="1031"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalOptions="/force:multiple"
AdditionalDependencies="libv2.lib dsound.lib d3d9.lib d3dx9.lib winmm.lib user32.lib"
OutputFile=".\Debug/cmath.exe"
LinkIncremental="2"
SuppressStartupBanner="true"
GenerateDebugInformation="true"
ProgramDatabaseFile=".\Debug/cmath.pdb"
SubSystem="2"
EntryPointSymbol="WinEntry"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Debug_Ex|Win32"
OutputDirectory="$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC70.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="_DEBUG"
MkTypLibCompatible="true"
SuppressStartupBanner="true"
TargetEnvironment="1"
TypeLibraryName=".\Debug/cmath.tlb"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="/GA /fp:fast /QIfist"
Optimization="0"
InlineFunctionExpansion="2"
EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="2"
OmitFramePointers="true"
PreprocessorDefinitions="WIN32,_DEBUG,_WINDOWS,SUPERSMALL; EXTRACODE;DEBUG_VS;DEBUG_PS"
StringPooling="true"
ExceptionHandling="1"
BasicRuntimeChecks="0"
RuntimeLibrary="1"
BufferSecurityCheck="false"
EnableEnhancedInstructionSet="0"
FloatingPointModel="2"
RuntimeTypeInfo="false"
UsePrecompiledHeader="0"
PrecompiledHeaderFile=".\Debug/cmath.pch"
AssemblerListingLocation=".\Debug_ex/"
ObjectFile=".\Debug_ex/"
ProgramDataBaseFileName=".\Debug_ex/"
WarningLevel="3"
SuppressStartupBanner="true"
DebugInformationFormat="1"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="1031"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalOptions="/force:multiple"
AdditionalDependencies="libv2.lib dsound.lib d3d9.lib d3dx9.lib winmm.lib user32.lib Gdi32.lib"
OutputFile=".\Debug_ex/cmath.exe"
LinkIncremental="2"
SuppressStartupBanner="true"
IgnoreAllDefaultLibraries="false"
GenerateDebugInformation="true"
ProgramDatabaseFile=".\Debug_ex/cmath.pdb"
SubSystem="2"
EntryPointSymbol=""
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Quellcodedateien"
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
>
<File
RelativePath=".\camera.cpp"
>
</File>
<File
RelativePath=".\ConfigFiles.cpp"
>
<FileConfiguration
Name="Release|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
</File>
<File
RelativePath=".\EditorHelp.cpp"
>
<FileConfiguration
Name="Release|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
</File>
<File
RelativePath=".\flockspline.cpp"
>
</File>
<File
RelativePath=".\globals.cpp"
>
</File>
<File
RelativePath=".\intrin.cpp"
>
</File>
<File
RelativePath=".\main.cpp"
>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
FloatingPointModel="0"
/>
</FileConfiguration>
</File>
<File
RelativePath=".\PSSM.cpp"
>
</File>
<File
RelativePath=".\renderjob.cpp"
>
</File>
<File
RelativePath=".\Renderpipe.cpp"
>
</File>
<File
RelativePath=".\Shader.cpp"
>
</File>
<File
RelativePath=".\ShaderFactory.cpp"
>
</File>
<File
RelativePath=".\StringHelper.cpp"
>
</File>
<File
RelativePath=".\TextFileReader.cpp"
>
</File>
<File
RelativePath=".\textinfo.cpp"
>
</File>
<File
RelativePath=".\Texture.cpp"
>
</File>
<File
RelativePath=".\v2mplayer.cpp"
>
</File>
</Filter>
<Filter
Name="Header-Dateien"
Filter="h;hpp;hxx;hm;inl"
>
<File
RelativePath=".\bar16To9.h"
>
</File>
<File
RelativePath=".\camdata.h"
>
</File>
<File
RelativePath=".\camera.h"
>
</File>
<File
RelativePath=".\camerahelper.h"
>
</File>
<File
RelativePath=".\ConfigFiles.h"
>
</File>
<File
RelativePath=".\defines.h"
>
</File>
<File
RelativePath=".\EditorHelp.h"
>
</File>
<File
RelativePath=".\flockspline.h"
>
</File>
<File
RelativePath=".\globals.h"
>
</File>
<File
RelativePath=".\intrin.h"
>
</File>
<File
RelativePath=".\mesher.h"
>
</File>
<File
RelativePath=".\music.h"
>
</File>
<File
RelativePath=".\oldhelpercode.h"
>
</File>
<File
RelativePath=".\picstuff.h"
>
</File>
<File
RelativePath=".\PSSM.h"
>
</File>
<File
RelativePath=".\random.h"
>
</File>
<File
RelativePath=".\renderjob.h"
>
</File>
<File
RelativePath=".\RenderPipe.h"
>
</File>
<File
RelativePath=".\shader.h"
>
</File>
<File
RelativePath=".\shaderdata.h"
>
</File>
<File
RelativePath=".\ShaderFactory.h"
>
</File>
<File
RelativePath=".\TargetValue.h"
>
</File>
<File
RelativePath=".\textdata.h"
>
</File>
<File
RelativePath=".\textinfo.h"
>
</File>
<File
RelativePath=".\textout.h"
>
</File>
<File
RelativePath=".\Texture.h"
>
</File>
<File
RelativePath=".\v2mplayer.h"
>
</File>
<File
RelativePath=".\VUMeter.h"
>
</File>
</Filter>
<Filter
Name="Ressourcendateien"
Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
>
</Filter>
<Filter
Name="cfg"
Filter="txt"
>
<File
RelativePath=".\cfg\psao.txt"
>
</File>
<File
RelativePath=".\cfg\psblur.txt"
>
</File>
<File
RelativePath=".\cfg\psdepth.txt"
>
</File>
<File
RelativePath=".\cfg\psdof.txt"
>
</File>
<File
RelativePath=".\cfg\psgrass.txt"
>
</File>
<File
RelativePath=".\cfg\psphong.txt"
>
</File>
<File
RelativePath=".\cfg\pspssm.txt"
>
</File>
<File
RelativePath=".\cfg\psrainbow.txt"
>
</File>
<File
RelativePath=".\cfg\psray.txt"
>
</File>
<File
RelativePath=".\cfg\pssky.txt"
>
</File>
<File
RelativePath=".\cfg\pstarmac.txt"
>
</File>
<File
RelativePath=".\cfg\pstext.txt"
>
</File>
<File
RelativePath=".\cfg\pswall.txt"
>
</File>
<File
RelativePath=".\cfg\vsfsquad.txt"
>
</File>
<File
RelativePath=".\cfg\vsgeneral.txt"
>
</File>
<File
RelativePath=".\cfg\vssky.txt"
>
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@@ -0,0 +1,93 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioUserFile
ProjectType="Visual C++"
Version="8,00"
ShowAllFiles="false"
>
<Configurations>
<Configuration
Name="Release|Win32"
>
<DebugSettings
Command="$(TargetPath)"
WorkingDirectory=""
CommandArguments=""
Attach="false"
DebuggerType="3"
Remote="1"
RemoteMachine="DC3GB"
RemoteCommand=""
HttpUrl=""
PDBPath=""
SQLDebugging=""
Environment=""
EnvironmentMerge="true"
DebuggerFlavor=""
MPIRunCommand=""
MPIRunArguments=""
MPIRunWorkingDirectory=""
ApplicationCommand=""
ApplicationArguments=""
ShimCommand=""
MPIAcceptMode=""
MPIAcceptFilter=""
/>
</Configuration>
<Configuration
Name="Debug|Win32"
>
<DebugSettings
Command="$(TargetPath)"
WorkingDirectory=""
CommandArguments=""
Attach="false"
DebuggerType="3"
Remote="1"
RemoteMachine="DC3GB"
RemoteCommand=""
HttpUrl=""
PDBPath=""
SQLDebugging=""
Environment=""
EnvironmentMerge="true"
DebuggerFlavor=""
MPIRunCommand=""
MPIRunArguments=""
MPIRunWorkingDirectory=""
ApplicationCommand=""
ApplicationArguments=""
ShimCommand=""
MPIAcceptMode=""
MPIAcceptFilter=""
/>
</Configuration>
<Configuration
Name="Debug_Ex|Win32"
>
<DebugSettings
Command="$(TargetPath)"
WorkingDirectory=""
CommandArguments=""
Attach="false"
DebuggerType="3"
Remote="1"
RemoteMachine="DC3GB"
RemoteCommand=""
HttpUrl=""
PDBPath=""
SQLDebugging=""
Environment=""
EnvironmentMerge="true"
DebuggerFlavor=""
MPIRunCommand=""
MPIRunArguments=""
MPIRunWorkingDirectory=""
ApplicationCommand=""
ApplicationArguments=""
ShimCommand=""
MPIAcceptMode=""
MPIAcceptFilter=""
/>
</Configuration>
</Configurations>
</VisualStudioUserFile>

View File

@@ -0,0 +1,93 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioUserFile
ProjectType="Visual C++"
Version="8,00"
ShowAllFiles="false"
>
<Configurations>
<Configuration
Name="Release|Win32"
>
<DebugSettings
Command="$(TargetPath)"
WorkingDirectory=""
CommandArguments=""
Attach="false"
DebuggerType="3"
Remote="1"
RemoteMachine="RDS-ROESCH"
RemoteCommand=""
HttpUrl=""
PDBPath=""
SQLDebugging=""
Environment=""
EnvironmentMerge="true"
DebuggerFlavor=""
MPIRunCommand=""
MPIRunArguments=""
MPIRunWorkingDirectory=""
ApplicationCommand=""
ApplicationArguments=""
ShimCommand=""
MPIAcceptMode=""
MPIAcceptFilter=""
/>
</Configuration>
<Configuration
Name="Debug|Win32"
>
<DebugSettings
Command="$(TargetPath)"
WorkingDirectory=""
CommandArguments=""
Attach="false"
DebuggerType="3"
Remote="1"
RemoteMachine="RDS-ROESCH"
RemoteCommand=""
HttpUrl=""
PDBPath=""
SQLDebugging=""
Environment=""
EnvironmentMerge="true"
DebuggerFlavor=""
MPIRunCommand=""
MPIRunArguments=""
MPIRunWorkingDirectory=""
ApplicationCommand=""
ApplicationArguments=""
ShimCommand=""
MPIAcceptMode=""
MPIAcceptFilter=""
/>
</Configuration>
<Configuration
Name="Debug_Ex|Win32"
>
<DebugSettings
Command="$(TargetPath)"
WorkingDirectory=""
CommandArguments=""
Attach="false"
DebuggerType="3"
Remote="1"
RemoteMachine="RDS-ROESCH"
RemoteCommand=""
HttpUrl=""
PDBPath=""
SQLDebugging=""
Environment=""
EnvironmentMerge="true"
DebuggerFlavor=""
MPIRunCommand=""
MPIRunArguments=""
MPIRunWorkingDirectory=""
ApplicationCommand=""
ApplicationArguments=""
ShimCommand=""
MPIAcceptMode=""
MPIAcceptFilter=""
/>
</Configuration>
</Configurations>
</VisualStudioUserFile>

103
evoke-64k/ev10/defines.h Normal file
View File

@@ -0,0 +1,103 @@
#ifndef NDEBUG
# define USERSETTING
#else
# define FINALRELEASE
#endif
#ifdef USERSETTING
# define WindowTitle "Evoke 2010 64k Intro"
# define WindowClassName "Evoke 2010 64k Intro"
// default screen setup
# define WINDOWED
# define DEFAULTSCREENX 1024
# define DEFAULTSCREENY 576
//enables low detail setting
//# define LOW_DETAIL
//disable Rays
//# define DISABLERAY
//disable DOF
//# define DISABLEDOF
//disable Post processing
//# define DISABLEPOSTPROCESSING
//laptop mode (1 == GM905; 2== GF6600 Go)
//# define LAPTOPMODE 2
//create and write Headers from cfg Files
# define CREATE_HEADER
// disables Autosetup from Desktop Screensize
# define DISABLEAUTOSCREEN
// disables automatic quitting when time limit or ESC is hit
# define DISABLEAUTOQUIT
//enables music
//# define STARTMUSIC
// loads music from file "song.v2m"
//# define MUSICLOAD
//enables Tool "Cameratester
#ifdef EXTRACODE
# define CAMERATESTER
# define ULTRASHOT
# define ULTRASHOT_TILES 1
#endif
#endif
#ifdef FINALRELEASE
# define WindowTitle "Evoke 2010 64k Intro"
# define WindowClassName "Evoke 2010 64k Intro"
// default screen setup
//# define WINDOWED
# define DEFAULTSCREENX 1024
# define DEFAULTSCREENY 768
//# define DEFAULTSCREENX 1280
//# define DEFAULTSCREENY 720
//enables low detail setting
//# define LOW_DETAIL
//disable Post processing
//# define DISABLEPOSTPROCESSING
//laptop mode (1 == GM905; 2== GF6600 Go)
//# define LAPTOPMODE 1
//create and write Headers from cfg Files
//# define CREATE_HEADER
// disables Autosetup from Desktop Screensize
//# define DISABLEAUTOSCREEN
// disables automatic quitting when time limit or ESC is hit
//# define DISABLEAUTOQUIT
//enables music
# define STARTMUSIC
// loads music from file "song.v2m"
//# define MUSICLOAD
//enables Tool "Cameratester
//# define CAMERATESTER
#endif
// some default defines
#define WIN32_LEAN_AND_MEAN
#define VC_EXTRALEAN
#define STRICT

View File

@@ -0,0 +1,27 @@
\-/ returns ! - http://www.games-net.de/hosted/tggc
___________________________________________________
imagine :-: an introduction in 48k
Code :-: CodingCat
Hel
TGGC
Music :-: Turri
packer :-: kkrunchy by ryg/farbrausch
synthesizer :-: libv2 by kb/farbrausch
greets ASD, Calodox, Conspiracy, Fairlight,
Farbrausch, Fuzzion, Kakiarts, Loonies,
Nuance, RGBA, Speckdrumm, Still, TBC,
TBC, TBL, Titan, Traction
atla, BlueCobold, mcdeck, matt|6s, pro, rapso,
rip, TomasRiker
anyone else from #gamedev.ger, #sppro and #cpp
Think about tommorow.

View File

@@ -0,0 +1 @@
imagine 1024x 768y -l -w

View File

@@ -0,0 +1 @@
imagine 1280x 1024y -l -w

View File

@@ -0,0 +1 @@
imagine 1280x 720y -l -w

View File

@@ -0,0 +1 @@
imagine 1280x 800y -l -w

View File

@@ -0,0 +1 @@
imagine 1400x 1050y -l -w

View File

@@ -0,0 +1 @@
imagine 1600x 1200y -l -w

View File

@@ -0,0 +1 @@
imagine 1680x 1050y -l -w

View File

@@ -0,0 +1 @@
imagine 1920x 1080y -l -w

View File

@@ -0,0 +1 @@
imagine 1920x 1200y -l -w

View File

@@ -0,0 +1 @@
imagine 1280x 720y -l +w

View File

@@ -0,0 +1 @@
imagine 800x 600y -l +w

View File

@@ -0,0 +1 @@
imagine 960x 510y -l +w

View File

@@ -0,0 +1,685 @@
#include "flockspline.h"
#include "globals.h"
#include "intrin.h"
static const int m_iMaxSplineLength= 128 * Flock::m_iTimeResolution * 30;
static D3DXVECTOR3 g_vecSplineData[ m_iMaxSplineLength ];
static D3DXVECTOR3 g_vecSplineDataUp[ m_iMaxSplineLength ];
static D3DXVECTOR3 g_vecSplineDataRight[ m_iMaxSplineLength ];
int g_iSplineDataUsed= 0;
Flock g_Flocks[ g_iFlockCount ];
static const int m_iMaxPreSplineLength= 2048;
static D3DXVECTOR3 g_vecSplinePreData[ m_iMaxPreSplineLength ];
static D3DXVECTOR3 g_vecSplinePreUpData[ m_iMaxPreSplineLength ];
static int g_iPreSplineCount;
void Flock::Init()
{
m_iSplineLength= -1;
m_iBoidCount= -1;
m_fTimeOffset= 0.0f;
m_fMaxTimeAdd= -666666.0f;
m_fColorIncrement= 1.0f / 128.0f;
m_iTesselation= 4;
}
void Flock::GeneratePreSpline( D3DXVECTOR3* pBase,
int iCountpoints,
float fDistStep,
float fMaxOffset)
{
g_iPreSplineCount= 0;
for( int i= 1; i < iCountpoints; ++i )
{
D3DXVECTOR3 vDir= pBase[ i ] - pBase[ i - 1 ];
D3DXVECTOR3 vUp;
D3DXVECTOR3 vRight;
CreateBaseUpVector( vDir, vUp );
D3DXVec3Cross( &vRight, &vUp, &vDir );
D3DXVec3Cross( &vUp, &vRight, &vDir );
D3DXVec3Normalize( &vUp, &vUp );
D3DXVec3Normalize( &vRight, &vRight );
float fDist= D3DXVec3Length( &vDir );
int iSteps= max( 1, (int)(fDist / fDistStep) );
for( int j= 0; j < iSteps; ++j )
{
float fAntiFac= (float)j / (float)iSteps;
float fFac= 1.0f - fAntiFac;
D3DXVECTOR3 vec3Pos= pBase[ i - 1 ] * fFac + pBase[ i ] * fAntiFac;
if( j > 0 )
{
float fRad= g_Random.genFloat( 0.0f, fMaxOffset );
float fDir= g_Random.genFloat( 0.0f, c_2PI );
vec3Pos+= vUp * fRad * sin( fDir );
vec3Pos+= vRight * fRad * cos( fDir );
}
g_vecSplinePreData[ g_iPreSplineCount ]= vec3Pos;
g_iPreSplineCount++;
}
}
}
int Flock::GenerateSplineBands()
{
return 0;
}
/*const int iBaseFlock= 48;
int iFlockCount= 0;
D3DXVECTOR3 vMidStart;
vMidStart.x= 2.5f;
vMidStart.z= 36.0f;
D3DXVECTOR3 vX;
vX.x= -0.9f / 128.0f;
vX.y= 0.0f;
vX.z= 0.15f / 128.0f;
D3DXVECTOR3 vY;
vY.x= 0.0f;
vY.y= 1.0f / 128.0f;
vY.z= 0.0f;
//static D3DXVECTOR3 g_vecSplinePreData[ m_iMaxPreSplineLength ];
//static D3DXVECTOR3 g_vecSplinePreUpData[ m_iMaxPreSplineLength ];
int StartOffset= 0;
float fTimeOffset= 256.0f;
for( int i= 0; i < 17; ++i )
{
D3DXVECTOR3 vMid;
vMid.x= vMidStart.x + sinf( (float)i * -2.0f ) * 1.0f;
vMid.z= vMidStart.z + cosf( (float)i * -2.0f ) * 1.0f;
vMid.y= 64.0f;// + g_fYSpecialBandOffset[ i - 10 ];
if( i == 14 )
{
vMid.x= -5.0f;
}
const signed char* g_pData= g_PointData + StartOffset;
while( true )
{
g_iPreSplineCount= 1;
Flock* pF= g_Flocks + iBaseFlock + iFlockCount;
int startx= *((short int*)g_pData);
g_pData+= 2;
if( startx == 0x7fff )
{
break;
}
int starty= *((short int*)g_pData);
g_pData+= 2;
D3DXVECTOR2 g_vecActPoint;
g_vecActPoint.x= (float)startx;
g_vecActPoint.y= (float)starty;
{
D3DXVECTOR3 vAct;
vAct= vMid;
vAct+= g_vecActPoint.x * vX;
vAct+= g_vecActPoint.y * vY;
g_vecSplinePreData[ g_iPreSplineCount ]= vAct;
g_iPreSplineCount++;
}
while( true )
{
int x= *g_pData;
g_pData++;
int y= *g_pData;
g_pData++;
if( x == 0 && y == 0 )
{
break;
}
g_vecActPoint.x+= x;
g_vecActPoint.y+= y;
{
D3DXVECTOR3 vAct;
vAct= vMid;
vAct+= g_vecActPoint.x * vX;
vAct+= g_vecActPoint.y * vY;
g_vecSplinePreData[ g_iPreSplineCount ]= vAct;
g_iPreSplineCount++;
}
}
assert( g_iPreSplineCount > 3 );
g_vecSplinePreData[ 0 ]= 2 * g_vecSplinePreData[ 1 ] - g_vecSplinePreData[ 2 ];
g_vecSplinePreData[ g_iPreSplineCount ]= 2 * g_vecSplinePreData[ g_iPreSplineCount - 1 ] - g_vecSplinePreData[ g_iPreSplineCount - 2 ];
g_iPreSplineCount++;
pF->GenerateUpVectors();
pF->GenerateSplinePoints( 1 );
pF->GenerateBoidsText( 24 );
pF->m_iTesselation= 1;
pF->m_fTimeOffset= fTimeOffset;
fTimeOffset+= 0.06f * (float)pF->m_iSplineLength / (float)m_iTimeResolution;
iFlockCount++;
}
fTimeOffset+= 0.6f;
StartOffset= g_pData -g_PointData;
StartOffset+= 4;
}
return iFlockCount;
}*/
void Flock::CreateBaseUpVector( D3DXVECTOR3& vec3In, D3DXVECTOR3& vec3Out )
{
vec3Out= D3DXVECTOR3( 0.0f, 1.0f, 1.0f );
if( fabs( D3DXVec3Dot( &vec3In, &vec3Out ) ) > 0.9f )
{
vec3Out= D3DXVECTOR3( 1.0f, 0.0f, 1.0f );
}
}
void Flock::GenerateUpVectors()
{
D3DXVECTOR3 vec3PrevUp;
CreateBaseUpVector( g_vecSplinePreData[ 1 ] - g_vecSplinePreData[ 0 ], vec3PrevUp );
for( int i= 0; i < g_iPreSplineCount - 1; ++i )
{
D3DXVECTOR3 vec3Along= g_vecSplinePreData[ i + 1 ] - g_vecSplinePreData[ max( 0, i - 1 ) ];
D3DXVECTOR3 vec3NextRight;
D3DXVec3Cross( &vec3NextRight, &vec3PrevUp, &vec3Along );
D3DXVec3Cross( &(g_vecSplinePreUpData[ i ]), &vec3Along, &vec3NextRight );
D3DXVec3Normalize( &(g_vecSplinePreUpData[ i ]), &(g_vecSplinePreUpData[ i ]) );
vec3PrevUp= g_vecSplinePreUpData[ i ];
}
g_vecSplinePreUpData[ g_iPreSplineCount - 1 ]= g_vecSplinePreUpData[ g_iPreSplineCount - 2 ];
}
void Flock::GenerateSplinePoints( int iTicksPerPrePoint )
{
m_iSplineLength= iTicksPerPrePoint * ( g_iPreSplineCount - 3 );
m_vecSplineData= g_vecSplineData + g_iSplineDataUsed;
m_vecSplineDataUp= g_vecSplineDataUp + g_iSplineDataUsed;
m_vecSplineDataRight= g_vecSplineDataRight + g_iSplineDataUsed;
g_iSplineDataUsed+= m_iSplineLength;
for( int i= 0; i < g_iPreSplineCount - 3; ++i )
{
for( int j= 0; j < iTicksPerPrePoint; ++j )
{
D3DXVECTOR3& vecPos= m_vecSplineData[ i * iTicksPerPrePoint + j ];
D3DXVECTOR3& vecUp= m_vecSplineDataUp[ i * iTicksPerPrePoint + j ];
float fWeight= (float)j / (float)iTicksPerPrePoint;
D3DXVec3CatmullRom(
&vecPos,
g_vecSplinePreData + i,
g_vecSplinePreData + i + 1,
g_vecSplinePreData + i + 2,
g_vecSplinePreData + i + 3,
fWeight );
D3DXVec3Lerp(
&vecUp,
g_vecSplinePreUpData + i + 1,
g_vecSplinePreUpData + i + 2,
fWeight );
}
}
D3DXVECTOR3 vecLast= m_vecSplineData[ 0 ] + m_vecSplineData[ 0 ] - m_vecSplineData[ 1 ];
for( int i= 0; i < m_iSplineLength; ++i )
{
D3DXVECTOR3 vecFront= vecLast - m_vecSplineData[ i ];
D3DXVec3Cross( m_vecSplineDataRight + i, m_vecSplineDataUp + i, &vecFront );
D3DXVec3Normalize( m_vecSplineDataRight + i, m_vecSplineDataRight + i );
D3DXVec3Cross( m_vecSplineDataUp + i, &vecFront, m_vecSplineDataRight + i );
D3DXVec3Normalize( m_vecSplineDataUp + i, m_vecSplineDataUp + i );
vecLast= m_vecSplineData[ i ];
}
}
void Flock::GenerateBoids01( int iCount )
{
m_iBoidCount= min( iCount, m_iMaxBoidCount );
int iTimeStep= 2 * m_iTimeResolution / m_iBoidCount;
for( int i= 0; i < m_iBoidCount; ++i )
{
Boid& b= m_BoidData[ i ];
b.m_iTimeOffset= i * iTimeStep;
b.m_iLength= g_Random.genInteger( 24, 36 );
m_fMaxTimeAdd= max( m_fMaxTimeAdd, 0.1f + (float)(b.m_iLength + b.m_iTimeOffset) / (float)m_iTimeResolution );
b.m_fRotOffset= g_Random.genFloat( -0.5f, 0.5f );
b.m_RotFunc.x= g_Random.genFloat( 0.0f, c_2PI );
b.m_RotFunc.y= g_Random.genFloat( 0.5f * c_PI, c_PI );
b.m_RotFunc.z= g_Random.genFloat( 0.25f, 1.0f );
b.m_DistFunc.x= sqrtf( g_Random.genFloat( 1.0f / 4.0f, 4.0f ) );
b.m_DistFunc.y= g_Random.genFloat( 0.5f * b.m_DistFunc.x, b.m_DistFunc.x * 1.5f );
b.m_DistFunc.z= g_Random.genFloat( 0.5f, 2.0f );
b.m_fWidth= g_Random.genFloat( 1.0f / 6.0f, 1.0f / 4.0f );
b.m_fColor= 0.7f * (float)i / (float)m_iBoidCount + g_Random.genFloat( 0.05f, 0.25f );
}
}
void Flock::GenerateBoids02( int iCount )
{
m_iBoidCount= min( iCount, m_iMaxBoidCount );
int iTimeStep= 3 * m_iTimeResolution / m_iBoidCount;
for( int i= 0; i < m_iBoidCount; ++i )
{
Boid& b= m_BoidData[ i ];
b.m_iTimeOffset= i * iTimeStep;
b.m_iLength= g_Random.genInteger( 48, 80 );
m_fMaxTimeAdd= max( m_fMaxTimeAdd, 0.1f + (float)(b.m_iLength + b.m_iTimeOffset) / (float)m_iTimeResolution );
b.m_fRotOffset= g_Random.genFloat( -0.5f, 0.5f );
b.m_RotFunc.x= g_Random.genFloat( 0.0f, c_2PI );
b.m_RotFunc.y= g_Random.genFloat( 0.5f * c_PI, c_PI );
b.m_RotFunc.z= g_Random.genFloat( 0.25f, 1.0f );
b.m_DistFunc.x= sqrtf( g_Random.genFloat( 1.0f / 4.0f, 16.0f ) );
b.m_DistFunc.y= g_Random.genFloat( 0.5f * b.m_DistFunc.x, b.m_DistFunc.x * 1.5f );
b.m_DistFunc.z= g_Random.genFloat( 0.5f, 2.0f );
b.m_fWidth= g_Random.genFloat( 1.0f / 6.0f, 1.0f / 4.0f );
b.m_fColor= 0.7f * (float)i / (float)m_iBoidCount + g_Random.genFloat( 0.05f, 0.25f );
}
}
void Flock::GenerateBoids03( int iCount )
{
m_iBoidCount= min( iCount, m_iMaxBoidCount );
int iTimeStep= 2 * m_iTimeResolution / m_iBoidCount;
for( int i= 0; i < m_iBoidCount; ++i )
{
Boid& b= m_BoidData[ i ];
b.m_iTimeOffset= i * iTimeStep;
b.m_iLength= g_Random.genInteger( 16, 32 );
m_fMaxTimeAdd= max( m_fMaxTimeAdd, 0.1f + (float)(b.m_iLength + b.m_iTimeOffset) / (float)m_iTimeResolution );
b.m_fRotOffset= g_Random.genFloat( -0.5f, 0.5f );
b.m_RotFunc.x= g_Random.genFloat( 0.0f, c_2PI );
b.m_RotFunc.y= g_Random.genFloat( 0.5f * c_PI, c_PI );
b.m_RotFunc.z= g_Random.genFloat( 0.75f, 1.5f );
b.m_DistFunc.x= sqrtf( g_Random.genFloat( 1.0f / 4.0f, 2.0f ) );
b.m_DistFunc.y= g_Random.genFloat( 0.5f * b.m_DistFunc.x, b.m_DistFunc.x * 1.5f );
b.m_DistFunc.z= g_Random.genFloat( 0.5f, 2.0f );
b.m_fWidth= g_Random.genFloat( 1.0f / 6.0f, 1.0f / 4.0f );
b.m_fColor= 0.7f * (float)i / (float)m_iBoidCount + g_Random.genFloat( 0.05f, 0.25f );
}
}
void Flock::GenerateBoidsText( int iCount )
{
m_iBoidCount= min( iCount, m_iMaxBoidCount );
int iTimeStep= 13 * m_iTimeResolution / m_iBoidCount / 15;
for( int i= 0; i < m_iBoidCount; ++i )
{
Boid& b= m_BoidData[ i ];
b.m_iTimeOffset= i * iTimeStep;
b.m_iLength= g_Random.genInteger( 8, 12 );
m_fMaxTimeAdd= max( m_fMaxTimeAdd, 0.1f + (float)(b.m_iLength + b.m_iTimeOffset) / (float)m_iTimeResolution );
b.m_fRotOffset= g_Random.genFloat( -0.5f, 0.5f );
b.m_RotFunc.x= g_Random.genFloat( 0.0f, c_2PI );
b.m_RotFunc.y= g_Random.genFloat( 0.5f * c_PI, c_PI );
b.m_RotFunc.z= g_Random.genFloat( 2.0f, 6.0f );
b.m_DistFunc.x= sqrtf( g_Random.genFloat( 1.0f / 64.0f, 1 / 24.0f ) );
b.m_DistFunc.y= g_Random.genFloat( 0.25f * b.m_DistFunc.x, b.m_DistFunc.x * 0.5f );
b.m_DistFunc.z= g_Random.genFloat( 0.5f, 0.75f );
b.m_fWidth= g_Random.genFloat( 1.0f / 6.0f, 1.0f / 8.0f );
b.m_fColor= 0.7f * (float)i / (float)m_iBoidCount + g_Random.genFloat( 0.05f, 0.25f );
}
}
bool Flock::IsActive( float fTime )
{
if( m_iSplineLength < 0 )
{
return false;
}
fTime-= m_fTimeOffset;
if( fTime > 0 && fTime < (float)m_iSplineLength / (float)m_iTimeResolution + m_fMaxTimeAdd )
{
return true;
}
return false;
}
static D3DXVECTOR3 vecFinalData[ 2048 ];
static D3DXVECTOR3 vecFinalNorm[ 1024 ];
void Flock::AddToScene( float fTime, int iObject )
{
assert( iObject < OI_FlockLast );
fTime-= m_fTimeOffset;
g_Objects[ iObject ].Lock();
for( int i= 0; i < m_iBoidCount; ++i )
{
int iPos= 0;
Boid& b= m_BoidData[ i ];
int iStart= (int)(fTime * (float)m_iTimeResolution) - b.m_iTimeOffset;
int iEnd= iStart - b.m_iLength;
iStart= min( iStart, m_iSplineLength - 1 );
iEnd= max( iEnd, 0 );
if( iStart <= iEnd )
{
continue;
}
int iSplinePos= iStart;
int iSteps= ( iStart - iEnd ) / m_iTesselation;
assert( iSteps < 1000 );
while( iSteps >= 0 )
{
D3DXVECTOR3& SplinePos= m_vecSplineData[ iSplinePos ];
D3DXVECTOR3& vecUp= m_vecSplineDataUp[ iSplinePos ];
D3DXVECTOR3& vecRight= m_vecSplineDataRight[ iSplinePos ];
float fVal= (float)iSplinePos / (float)m_iTimeResolution + 128.0f;
float fDir= b.m_RotFunc.x + b.m_RotFunc.y * sin( fVal * b.m_RotFunc.z );
float fNorm= fDir + b.m_fRotOffset;
D3DXVECTOR3 vBase= vecUp * sin( fDir ) + vecRight * cos( fDir );
D3DXVECTOR3 vNorm= vecUp * sin( fDir ) + vecRight * cos( fDir );
D3DXVECTOR3 vRight= vecUp * cos( fDir ) - vecRight * sin( fDir );
float fDist= b.m_DistFunc.x + b.m_DistFunc.y * sin( fVal * b.m_DistFunc.z );
vecFinalData[ iPos * 2 ]= SplinePos + vBase * fDist - vRight * b.m_fWidth;
vecFinalData[ iPos * 2 + 1 ]= SplinePos + vBase * fDist + vRight * b.m_fWidth;
vecFinalNorm[ iPos ]= vNorm;
iPos++;
iSplinePos= iEnd + iSteps * m_iTesselation;
iSteps--;
}
for( int i= 0; i < iPos; ++i )
{
}
float fColor= b.m_fColor - m_fColorIncrement * iPos / 2;
Renderjob::SVertex* pV= g_Objects[ iObject ].m_pLockVertex + g_Objects[ iObject ].m_iVertCount;
for( int i= 0; i < iPos; ++i )
{
pV->x= vecFinalData[ i * 2 ].x;
pV->y= vecFinalData[ i * 2 ].y;
pV->z= vecFinalData[ i * 2 ].z;
pV->nx= vecFinalNorm[ i ].x;
pV->ny= vecFinalNorm[ i ].y;
pV->nz= vecFinalNorm[ i ].z;
pV->dwColor= 0x00ffffff;
pV->tu= fColor;
pV->tv= 0.0f;
pV++;
pV->x= vecFinalData[ i * 2 + 1 ].x;
pV->y= vecFinalData[ i * 2 + 1 ].y;
pV->z= vecFinalData[ i * 2 + 1 ].z;
pV->nx= vecFinalNorm[ i ].x;
pV->ny= vecFinalNorm[ i ].y;
pV->nz= vecFinalNorm[ i ].z;
pV->dwColor= 0x00ffffff;
pV->tu= fColor;
pV->tv= 1.0f;
pV++;
pV->x= vecFinalData[ i * 2 + 1 ].x;
pV->y= vecFinalData[ i * 2 + 1 ].y;
pV->z= vecFinalData[ i * 2 + 1 ].z;
pV->nx= -vecFinalNorm[ i ].x;
pV->ny= -vecFinalNorm[ i ].y;
pV->nz= -vecFinalNorm[ i ].z;
pV->dwColor= 0x00ffffff;
pV->tu= fColor;
pV->tv= 1.0f;
pV++;
pV->x= vecFinalData[ i * 2 ].x;
pV->y= vecFinalData[ i * 2 ].y;
pV->z= vecFinalData[ i * 2 ].z;
pV->nx= -vecFinalNorm[ i ].x;
pV->ny= -vecFinalNorm[ i ].y;
pV->nz= -vecFinalNorm[ i ].z;
pV->dwColor= 0x00ffffff;
pV->tu= fColor;
pV->tv= 0.0f;
pV++;
fColor+= m_fColorIncrement;
}
WORD* pW= g_Objects[ iObject ].m_pLockIndex + g_Objects[ iObject ].m_iIndexCount;
int iBase= g_Objects[ iObject ].m_iVertCount;
for( int i= 0; i < 2 * iPos - 1; ++i )
{
*pW++= iBase;
*pW++= iBase + 1;
*pW++= iBase + 4;
*pW++= iBase + 4;
*pW++= iBase + 1;
*pW++= iBase + 5;
iBase+= 2;
}
g_Objects[ iObject ].m_iVertCount+= 4 * iPos;
g_Objects[ iObject ].m_iIndexCount+= 12 * ( iPos - 1 );
}
g_Objects[ iObject ].Unlock();
}
static D3DXVECTOR3 Test[128];
static D3DXVECTOR3 FinalFly[4]=
{
D3DXVECTOR3( -8.0f, 50.0f, 39.0f ),
D3DXVECTOR3( -8.0f, 58.0f, 39.0f ),
D3DXVECTOR3( 16.0f, 192.0f, 0.0f ),
D3DXVECTOR3( 16.0f, 198.0f, 0.0f ),
};
void PrepareFlockObjects()
{
for( int i= OI_FlockFirst; i < OI_FlockLast; ++i )
{
g_Objects[ i ].Create( 40000, 60000 );
g_Objects[ i ].m_iUsedShader[ 0 ]= Rainbow;
g_Objects[ i ].m_iUsedPreShader= PreDepth;
}
for( int i= 0; i < g_iFlockCount; ++i )
{
g_Flocks[ i ].Init();
}
for( int i= 0; i < 8; ++i )
{
int iLast= 0;
Test[ iLast ].x= -8.0f;
Test[ iLast ].y= 4.0f;
Test[ iLast ].z= 39.0f;
iLast++;
float fHeight= g_Random.genFloat( 4.0f, 16.0f );
int iModeXZ= g_Random.genInteger( 0, 1 );
int iRow= g_Random.genInteger( 0, 1 );
float fPos;
if( iModeXZ == 0 )
{
fPos= g_Random.genFloat( -32.0f, 52.0f );
Test[ iLast ].x= iRow * 5.0f;
Test[ iLast ].y= fHeight;
Test[ iLast ].z= fPos;
iLast++;
}
else
{
fPos= g_Random.genFloat( -24.0f, 24.0f );
Test[ iLast ].x= fPos;
Test[ iLast ].y= fHeight;
Test[ iLast ].z= iRow * 5.0f;
iLast++;
}
int iLength= g_Random.genInteger( 3, 6 );
for( int iTurn= 0; iTurn < iLength; ++iTurn )
{
float fDist= g_Random.genFloat( 24.0f, 64.0f );
float fMinDist= 10000.0f;
iModeXZ= 1 - iModeXZ;
if( iModeXZ == 0 )
{
for( int iStreet= 0; iStreet < 5; ++iStreet )
{
float fCurDist= fabs( fabs( Test[ iLast - 1 ].x - iStreet * 5.0f) - fDist );
if( fabs( iStreet * 5.0f ) > fabs( Test[ iLast - 1 ].x ) )
{
fCurDist*= 0.55f;
}
if( fCurDist < fMinDist )
{
fMinDist= fCurDist;
iRow= iStreet;
}
}
Test[ iLast ].x= iRow * 5.0f;
Test[ iLast ].y= fHeight;
Test[ iLast ].z= Test[ iLast - 1 ].z;
iLast++;
}
else
{
for( int iStreet= 0; iStreet < 5; ++iStreet )
{
float fCurDist= fabs( fabs( Test[ iLast - 1 ].z - iStreet * 5.0f) - fDist );
if( fabs( iStreet * 5.0f ) > fabs( Test[ iLast - 1 ].z ) )
{
fCurDist*= 0.55f;
}
if( fCurDist < fMinDist )
{
fMinDist= fCurDist;
iRow= iStreet;
}
}
Test[ iLast ].x=Test[ iLast - 1 ].x;
Test[ iLast ].y= fHeight;
Test[ iLast ].z= iRow * 5.0f;
iLast++;
}
if( g_Random.genInteger( 0, 1 ) == 1 )
{
Test[ iLast ]=Test[ iLast - 1 ];
iLast++;
Test[ iLast ]=Test[ iLast - 1 ];
iLast++;
float fChange= g_Random.genFloat( 3.5f, 7.0f );
float fNewHeight= fHeight;
if( g_Random.genInteger( 0, 1 ) )
{
fNewHeight+= fChange;
}
else
{
fNewHeight-= fChange;
}
fNewHeight= minimum( fNewHeight, 16.0f );
fNewHeight= maximum( fNewHeight, 4.0f );
fHeight= fNewHeight;
float fPercent= g_Random.genFloat( 0.35f, 0.65f );
float fPercentMod= g_Random.genFloat( 0.05f, 0.15f );
D3DXVec3Lerp( Test + iLast - 3, Test + iLast - 4, Test + iLast - 1, fPercent - fPercentMod );
D3DXVec3Lerp( Test + iLast - 2, Test + iLast - 4, Test + iLast - 1, fPercent + fPercentMod );
Test[ iLast - 2 ].y= fHeight;
Test[ iLast - 1 ].y= fHeight;
}
}
if( iModeXZ == 0 )
{
Test[ iLast ].x= iRow * 5.0f + Test[ iLast - 1 ].z * 0.25f;
Test[ iLast - 1].x= iRow * 5.0f + Test[ iLast - 1 ].z * 0.125f;
Test[ iLast ].y= -16.0f;
Test[ iLast ].z= Test[ iLast - 1 ].z;
iLast++;
}
else
{
Test[ iLast ].x=Test[ iLast - 1 ].x;
Test[ iLast ].y= -16.0f;
Test[ iLast ].z= iRow * 5.0f + Test[ iLast - 1 ].x * 0.25f;
Test[ iLast - 1].z= iRow * 5.0f + Test[ iLast - 1 ].x * 0.125f;
iLast++;
}
g_Flocks[ i ].GeneratePreSpline(
Test,
iLast,
4.0f,
4.0f );
g_Flocks[ i ].GenerateUpVectors();
g_Flocks[ i ].GenerateSplinePoints( 24 );
g_Flocks[ i ].GenerateBoids01( 96 );
g_Flocks[ i ].m_iTesselation= 2;
g_Flocks[ i ].m_fTimeOffset= 0.0f;
}
for( int i= 0; i < 3; ++i )
{
g_Flocks[ 24 + i ].GeneratePreSpline(
FinalFly,
4,
8.0f,
12.0f );
g_Flocks[ 24 + i ].GenerateUpVectors();
g_Flocks[ 24 + i ].GenerateSplinePoints( 64 );
g_Flocks[ 24 + i ].GenerateBoids02( 64 );
g_Flocks[ 24 + i ].m_iTesselation= 1;
g_Flocks[ 24 + i ].m_fTimeOffset= 320.0f;
}
Flock::GenerateSplineBands();
}
void AddFlockObjectsToScene( float fTime )
{
for( int i= OI_FlockFirst; i < OI_FlockLast; ++i )
{
g_Objects[ i ].HideVertexData();
}
int iObjectID= OI_FlockFirst;
for( int i= 0; i < g_iFlockCount; ++i )
{
assert( iObjectID < OI_FlockLast );
if( g_Flocks[ i ].IsActive( fTime ) )
{
g_Flocks[ i ].AddToScene( fTime, iObjectID );
iObjectID++;
}
}
}
//-8, 39

View File

@@ -0,0 +1,61 @@
#pragma once
#include "defines.h"
#include <d3d9.h>
#include <d3dx9math.h>
struct Boid
{
int m_iTimeOffset;
int m_iLength;
float m_fRotOffset;
D3DXVECTOR3 m_RotFunc;
D3DXVECTOR3 m_DistFunc;
float m_fWidth;
float m_fColor;
};
struct Flock
{
static const int m_iTimeResolution= 128;
D3DXVECTOR3* m_vecSplineData;
D3DXVECTOR3* m_vecSplineDataUp;
D3DXVECTOR3* m_vecSplineDataRight;
int m_iSplineLength;
static const int m_iMaxBoidCount= 256;
Boid m_BoidData[ m_iMaxBoidCount ];
int m_iBoidCount;
float m_fTimeOffset;
float m_fMaxTimeAdd;
float m_fColorIncrement;
int m_iTesselation;
void Init();
void GeneratePreSpline( D3DXVECTOR3* pBase,
int iCountpoints,
float fDistStep,
float fMaxOffset);
void GenerateUpVectors();
void GenerateSplinePoints( int iTicksPerPrePoint );
void GenerateBoids01( int iCount );
void GenerateBoids02( int iCount );
void GenerateBoids03( int iCount );
void GenerateBoidsText( int iCount );
bool IsActive( float fTime );
void AddToScene( float fTime, int iObject );
static int GenerateSplineBands();
static void CreateBaseUpVector( D3DXVECTOR3& vec3In, D3DXVECTOR3& vec3Out );
};
static const int g_iFlockCount= 1024;
extern Flock g_Flocks[ g_iFlockCount ];
void PrepareFlockObjects();
void AddFlockObjectsToScene( float fTime );

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 );
}

188
evoke-64k/ev10/globals.h Normal file
View File

@@ -0,0 +1,188 @@
#pragma once
#include "defines.h"
#include <windows.h>
#include <mmsystem.h>
#include <d3d9.h>
#include <d3dx9math.h>
#include "VUMeter.h"
//#include "ScriptState.h"
#include "Renderjob.h"
#include "Texture.h"
#include "Shader.h"
#include "PSSM.h"
#include "random.h"
#include "camera.h"
/////////////////////////////////////////////////////////////////////////////
// Globale Daten
/////////////////////////////////////////////////////////////////////////////
extern LPDIRECT3D9 g_D3D;
extern IDirect3DDevice9 *g_d3d_device;
extern D3DPRESENT_PARAMETERS d3dpp;
extern UINT g_nShadowResolution;
extern float g_fResolutionFactor;
extern int g_iResolutionFactorExp;
extern D3DLIGHT9 d3dLight[3];
extern D3DMATERIAL9 d3dMaterial;
extern D3DXMATRIX g_matView;
extern D3DXMATRIX g_matProjection;
extern D3DXMATRIX g_matVP;
extern D3DXMATRIX g_matWVP;
enum TextureIndices
{
TI_RotMatrix= 0,
TI_Random= 1,
TI_RandomCube= 2,
TI_LightSpec1D= 7,
TI_First1D= 8,
TI_White= 8,
TI_Light1D= 9,
TI_LightTest= 10,
TextureCount= 32,
TI_IgnoreSetting= -1,
TI_CLAMP= -2,
};
extern Texture g_pTextures[ TextureCount ];
enum RenderTargetIndices
{
RT_DEPTH,
RT_COLOR,
RT_AUX1,
RT_AUX2,
RT_SHADOW,
RT_COUNT
};
extern IDirect3DTexture9* g_pFullScreenRT[ RT_COUNT ];
enum RenderTargetSurfaceIndices
{
RTS_DEFAULT_DS,
RTS_DEPTH,
RTS_DEPTH_MS,
RTS_COLOR,
RTS_COLOR_MS,
RTS_AUX1,
RTS_AUX2,
RTS_SHADOW,
RTS_SHADOW_DS,
RTS_COUNT
};
extern IDirect3DSurface9* g_pFullScreenRTS[ RTS_COUNT ];
extern SCameraDefinition g_Camera;
extern D3DXVECTOR3 g_CamFront;
extern D3DXVECTOR3 g_LightDir;
extern float g_fGlow;
extern PSSM g_PSSM;
enum ObjectIndices
{
OI_Test= 0,
OI_TextFirst= 0,
OI_TextLast= 63,
OI_FlockFirst= 64,
OI_FlockLast= 127,
ObjectCount= 1024
};
extern Renderjob g_Objects[ ObjectCount ];
extern Renderjob* g_pEditObject;
extern Renderjob g_SkyBox;
extern Renderjob g_FullScreenQuad;
const int g_iShaderCount= 64;
extern Shader g_Shaders[ g_iShaderCount ];
#ifndef STARTMUSIC
extern DWORD g_dwTimeReplaceStart;
#endif
extern int g_iTempo;
const int g_iSampleOffsetGeneral= 2205;
extern int g_iSampleOffset;
extern int g_dwSamplesPassed;
extern int g_dwSamples;
extern SVUMeter g_vuLightBeat;
extern SVUMeter g_vuOffBeat;
extern RandomGenerator g_Random;
enum ShaderIndices
{
PreDepth,
PSSM_Proj,
SSAO,
SSAO_BlurH,
SSAO_BlurV,
DOF_Intensity,
DOF,
BlurBilH,
BlurBilV,
Ray_Mask,
Ray_Extrude,
BlurH,
BlurV,
Extract_InvAlpha,
Phong,
Rainbow,
Tarmac,
Grass,
Wall,
Sky,
SkyDepth,
Text,
};
#ifdef EXTRACODE
extern char g_ShaderVSGeneral[ 65536 ];
extern char g_ShaderPSPhong[ 65536 ];
extern char g_ShaderPSRainbow[ 65536 ];
extern char g_ShaderPSTarmac[ 65536 ];
extern char g_ShaderPSGrass[ 65536 ];
extern char g_ShaderPSWall[ 65536 ];
extern char g_ShaderPSDepth[ 65536 ];
extern char g_ShaderPSText[ 65536 ];
extern char g_ShaderVSSky[ 65536 ];
extern char g_ShaderPSSky[ 65536 ];
extern char g_ShaderVSFSQuad[ 65536 ];
extern char g_ShaderPSPSSM[ 65536 ];
extern char g_ShaderPSAmbOcc[ 65536 ];
extern char g_ShaderPSDOF[ 65536 ];
extern char g_ShaderPSRay[ 65536 ];
extern char g_ShaderPSBlur[ 65536 ];
#else
#include "shaderdata.h"
#endif
void InitGlobals();

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet type='text/xsl' href='_UpgradeReport_Files/UpgradeReport.xslt'?><UpgradeLog>
<Properties><Property Name="Solution" Value="ice">
</Property><Property Name="Solution File" Value="E:\programmierung\64k\ev10\ice\ice.sln">
</Property><Property Name="Date" Value="Samstag, 1. Mai 2010">
</Property><Property Name="Time" Value="22:16:47">
</Property></Properties><Event ErrorLevel="2" Project="ice" Source="src\ice.vcproj" Description="The following error has occurred during XML parsing:&#xA;&#xA;File: E:\programmierung\64k\ev10\ice\src\ice.vcproj&#xA;Line: 10&#xA;Column: 2&#xA;Error Message:&#xA;'9,00' verstößt gegen enumeration-Einschränkung von '7.00 7,00 7.10 7,10 8.00 8,00'.&#xA;Analyse des Attributs 'Version' mit dem Wert '9,00' fehlgeschlagen.&#xA;&#xA;The file 'E:\programmierung\64k\ev10\ice\src\ice.vcproj' has failed to load.">
</Event><Event ErrorLevel="2" Project="ice" Source="src\ice.vcproj" Description="Project upgrade failed.">
</Event><Event ErrorLevel="3" Project="ice" Source="src\ice.vcproj" Description="Not Converted">
</Event></UpgradeLog>

View File

@@ -0,0 +1,207 @@
BODY
{
BACKGROUND-COLOR: white;
FONT-FAMILY: "Verdana", sans-serif;
FONT-SIZE: 100%;
MARGIN-LEFT: 0px;
MARGIN-TOP: 0px
}
P
{
FONT-FAMILY: "Verdana", sans-serif;
FONT-SIZE: 70%;
LINE-HEIGHT: 12pt;
MARGIN-BOTTOM: 0px;
MARGIN-LEFT: 10px;
MARGIN-TOP: 10px
}
.note
{
BACKGROUND-COLOR: #ffffff;
COLOR: #336699;
FONT-FAMILY: "Verdana", sans-serif;
FONT-SIZE: 100%;
MARGIN-BOTTOM: 0px;
MARGIN-LEFT: 0px;
MARGIN-TOP: 0px;
PADDING-RIGHT: 10px
}
.infotable
{
BACKGROUND-COLOR: #f0f0e0;
BORDER-BOTTOM: #ffffff 0px solid;
BORDER-COLLAPSE: collapse;
BORDER-LEFT: #ffffff 0px solid;
BORDER-RIGHT: #ffffff 0px solid;
BORDER-TOP: #ffffff 0px solid;
FONT-SIZE: 70%;
MARGIN-LEFT: 10px
}
.issuetable
{
BACKGROUND-COLOR: #ffffe8;
BORDER-COLLAPSE: collapse;
COLOR: #000000;
FONT-SIZE: 100%;
MARGIN-BOTTOM: 10px;
MARGIN-LEFT: 13px;
MARGIN-TOP: 0px
}
.issuetitle
{
BACKGROUND-COLOR: #ffffff;
BORDER-BOTTOM: #dcdcdc 1px solid;
BORDER-TOP: #dcdcdc 1px;
COLOR: #003366;
FONT-WEIGHT: normal
}
.header
{
BACKGROUND-COLOR: #cecf9c;
BORDER-BOTTOM: #ffffff 1px solid;
BORDER-LEFT: #ffffff 1px solid;
BORDER-RIGHT: #ffffff 1px solid;
BORDER-TOP: #ffffff 1px solid;
COLOR: #000000;
FONT-WEIGHT: bold
}
.issuehdr
{
BACKGROUND-COLOR: #E0EBF5;
BORDER-BOTTOM: #dcdcdc 1px solid;
BORDER-TOP: #dcdcdc 1px solid;
COLOR: #000000;
FONT-WEIGHT: normal
}
.issuenone
{
BACKGROUND-COLOR: #ffffff;
BORDER-BOTTOM: 0px;
BORDER-LEFT: 0px;
BORDER-RIGHT: 0px;
BORDER-TOP: 0px;
COLOR: #000000;
FONT-WEIGHT: normal
}
.content
{
BACKGROUND-COLOR: #e7e7ce;
BORDER-BOTTOM: #ffffff 1px solid;
BORDER-LEFT: #ffffff 1px solid;
BORDER-RIGHT: #ffffff 1px solid;
BORDER-TOP: #ffffff 1px solid;
PADDING-LEFT: 3px
}
.issuecontent
{
BACKGROUND-COLOR: #ffffff;
BORDER-BOTTOM: #dcdcdc 1px solid;
BORDER-TOP: #dcdcdc 1px solid;
PADDING-LEFT: 3px
}
A:link
{
COLOR: #cc6633;
TEXT-DECORATION: underline
}
A:visited
{
COLOR: #cc6633;
}
A:active
{
COLOR: #cc6633;
}
A:hover
{
COLOR: #cc3300;
TEXT-DECORATION: underline
}
H1
{
BACKGROUND-COLOR: #003366;
BORDER-BOTTOM: #336699 6px solid;
COLOR: #ffffff;
FONT-SIZE: 130%;
FONT-WEIGHT: normal;
MARGIN: 0em 0em 0em -20px;
PADDING-BOTTOM: 8px;
PADDING-LEFT: 30px;
PADDING-TOP: 16px
}
H2
{
COLOR: #000000;
FONT-SIZE: 80%;
FONT-WEIGHT: bold;
MARGIN-BOTTOM: 3px;
MARGIN-LEFT: 10px;
MARGIN-TOP: 20px;
PADDING-LEFT: 0px
}
H3
{
COLOR: #000000;
FONT-SIZE: 80%;
FONT-WEIGHT: bold;
MARGIN-BOTTOM: -5px;
MARGIN-LEFT: 10px;
MARGIN-TOP: 20px
}
H4
{
COLOR: #000000;
FONT-SIZE: 70%;
FONT-WEIGHT: bold;
MARGIN-BOTTOM: 0px;
MARGIN-TOP: 15px;
PADDING-BOTTOM: 0px
}
UL
{
COLOR: #000000;
FONT-SIZE: 70%;
LIST-STYLE: square;
MARGIN-BOTTOM: 0pt;
MARGIN-TOP: 0pt
}
OL
{
COLOR: #000000;
FONT-SIZE: 70%;
LIST-STYLE: square;
MARGIN-BOTTOM: 0pt;
MARGIN-TOP: 0pt
}
LI
{
LIST-STYLE: square;
MARGIN-LEFT: 0px
}
.expandable
{
CURSOR: hand
}
.expanded
{
color: black
}
.collapsed
{
DISPLAY: none
}
.foot
{
BACKGROUND-COLOR: #ffffff;
BORDER-BOTTOM: #cecf9c 1px solid;
BORDER-TOP: #cecf9c 2px solid
}
.settings
{
MARGIN-LEFT: 25PX;
}
.help
{
TEXT-ALIGN: right;
margin-right: 10px;
}

View File

@@ -0,0 +1,232 @@
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl='urn:schemas-microsoft-com:xslt'>
<xsl:key name="ProjectKey" match="Event" use="@Project" />
<xsl:template match="Events" mode="createProjects">
<projects>
<xsl:for-each select="Event">
<!--xsl:sort select="@Project" order="descending"/-->
<xsl:if test="(1=position()) or (preceding-sibling::*[1]/@Project != @Project)">
<xsl:variable name="ProjectName" select="@Project"/>
<project>
<xsl:attribute name="name">
<xsl:value-of select="@Project"/>
</xsl:attribute>
<xsl:if test="@Project=''">
<xsl:attribute name="solution">
<xsl:value-of select="@Solution"/>
</xsl:attribute>
</xsl:if>
<xsl:for-each select="key('ProjectKey', $ProjectName)">
<!--xsl:sort select="@Source" /-->
<xsl:if test="(1=position()) or (preceding-sibling::*[1]/@Source != @Source)">
<source>
<xsl:attribute name="name">
<xsl:value-of select="@Source"/>
</xsl:attribute>
<xsl:variable name="Source">
<xsl:value-of select="@Source"/>
</xsl:variable>
<xsl:for-each select="key('ProjectKey', $ProjectName)[ @Source = $Source ]">
<event>
<xsl:attribute name="error-level">
<xsl:value-of select="@ErrorLevel"/>
</xsl:attribute>
<xsl:attribute name="description">
<xsl:value-of select="@Description"/>
</xsl:attribute>
</event>
</xsl:for-each>
</source>
</xsl:if>
</xsl:for-each>
</project>
</xsl:if>
</xsl:for-each>
</projects>
</xsl:template>
<xsl:template match="projects">
<xsl:for-each select="project">
<xsl:sort select="@Name" order="ascending"/>
<h2>
<xsl:if test="@solution">Solution: <xsl:value-of select="@solution"/></xsl:if>
<xsl:if test="not(@solution)">Project: <xsl:value-of select="@name"/>
<xsl:for-each select="source">
<xsl:variable name="Hyperlink" select="@name"/>
<xsl:for-each select="event[@error-level='4']">
&#32;<A class="note"><xsl:attribute name="HREF"><xsl:value-of select="$Hyperlink"/></xsl:attribute><xsl:value-of select="@description"/></A>
</xsl:for-each>
</xsl:for-each>
</xsl:if>
</h2>
<table cellpadding="2" cellspacing="0" width="98%" border="1" bordercolor="white" class="infotable">
<tr>
<td nowrap="1" class="header" _locID="Filename">Filename</td>
<td nowrap="1" class="header" _locID="Status">Status</td>
<td nowrap="1" class="header" _locID="Errors">Errors</td>
<td nowrap="1" class="header" _locID="Warnings">Warnings</td>
</tr>
<xsl:for-each select="source">
<xsl:sort select="@name" order="ascending"/>
<xsl:variable name="source-id" select="generate-id(.)"/>
<xsl:if test="count(event)!=count(event[@error-level='4'])">
<tr class="row">
<td class="content">
<A HREF="javascript:"><xsl:attribute name="onClick">javascript:document.images['<xsl:value-of select="$source-id"/>'].click()</xsl:attribute><IMG border="0" alt="expand/collapse section" class="expandable" height="11" onclick="changepic()" src="_UpgradeReport_Files/UpgradeReport_Plus.gif" width="9" ><xsl:attribute name="name"><xsl:value-of select="$source-id"/></xsl:attribute><xsl:attribute name="child">src<xsl:value-of select="$source-id"/></xsl:attribute></IMG></A>&#32;<xsl:value-of select="@name"/>
</td>
<td class="content">
<xsl:if test="count(event[@error-level='3'])=1">
<xsl:for-each select="event[@error-level='3']">
<xsl:if test="@description='Converted'">Converted</xsl:if>
<xsl:if test="@description!='Converted'"><xsl:value-of select="@description"/></xsl:if>
</xsl:for-each>
</xsl:if>
<xsl:if test="count(event[@error-level='3'])!=1 and count(event[@error-level='3' and @description='Converted'])!=0">Converted
</xsl:if>
</td>
<td class="content"><xsl:value-of select="count(event[@error-level='2'])"/></td>
<td class="content"><xsl:value-of select="count(event[@error-level='1'])"/></td>
</tr>
<tr class="collapsed" bgcolor="#ffffff">
<xsl:attribute name="id">src<xsl:value-of select="$source-id"/></xsl:attribute>
<td colspan="7">
<table width="97%" border="1" bordercolor="#dcdcdc" rules="cols" class="issuetable">
<tr>
<td colspan="7" class="issuetitle" _locID="ConversionIssues">Conversion Issues - <xsl:value-of select="@name"/>:</td>
</tr>
<xsl:for-each select="event[@error-level!='3']">
<xsl:if test="@error-level!='4'">
<tr>
<td class="issuenone" style="border-bottom:solid 1 lightgray">
<xsl:value-of select="@description"/>
</td>
</tr>
</xsl:if>
</xsl:for-each>
</table>
</td>
</tr>
</xsl:if>
</xsl:for-each>
<tr valign="top">
<td class="foot">
<xsl:if test="count(source)!=1">
<xsl:value-of select="count(source)"/> files
</xsl:if>
<xsl:if test="count(source)=1">
1 file
</xsl:if>
</td>
<td class="foot">
Converted: <xsl:value-of select="count(source/event[@error-level='3' and @description='Converted'])"/><BR />
Not converted <xsl:value-of select="count(source) - count(source/event[@error-level='3' and @description='Converted'])"/>
</td>
<td class="foot"><xsl:value-of select="count(source/event[@error-level='2'])"/></td>
<td class="foot"><xsl:value-of select="count(source/event[@error-level='1'])"/></td>
</tr>
</table>
</xsl:for-each>
</xsl:template>
<xsl:template match="Property">
<xsl:if test="@Name!='Date' and @Name!='Time' and @Name!='LogNumber' and @Name!='Solution'">
<tr><td nowrap="1"><b><xsl:value-of select="@Name"/>: </b><xsl:value-of select="@Value"/></td></tr>
</xsl:if>
</xsl:template>
<xsl:template match="UpgradeLog">
<html>
<head>
<META HTTP-EQUIV="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="_UpgradeReport_Files\UpgradeReport.css" />
<title>Conversion Report&#32;
<xsl:if test="Properties/Property[@Name='LogNumber']">
<xsl:value-of select="Properties/Property[@Name='LogNumber']/@Value"/>
</xsl:if>
</title>
<script language="javascript">
function outliner () {
oMe = window.event.srcElement
//get child element
var child = document.all[event.srcElement.getAttribute("child",false)];
//if child element exists, expand or collapse it.
if (null != child)
child.className = child.className == "collapsed" ? "expanded" : "collapsed";
}
function changepic() {
uMe = window.event.srcElement;
var check = uMe.src.toLowerCase();
if (check.lastIndexOf("upgradereport_plus.gif") != -1)
{
uMe.src = "_UpgradeReport_Files/UpgradeReport_Minus.gif"
}
else
{
uMe.src = "_UpgradeReport_Files/UpgradeReport_Plus.gif"
}
}
</script>
</head>
<body topmargin="0" leftmargin="0" rightmargin="0" onclick="outliner();">
<h1 _locID="ConversionReport">Conversion Report - <xsl:value-of select="Properties/Property[@Name='Solution']/@Value"/></h1>
<p><span class="note">
<b>Time of Conversion:</b>&#32;&#32;<xsl:value-of select="Properties/Property[@Name='Date']/@Value"/>&#32;&#32;<xsl:value-of select="Properties/Property[@Name='Time']/@Value"/><br/>
</span></p>
<xsl:variable name="SortedEvents">
<Events>
<xsl:for-each select="Event">
<xsl:sort select="@Project" order="ascending"/>
<xsl:sort select="@Source" order="ascending"/>
<xsl:sort select="@ErrorLevel" order="ascending"/>
<Event>
<xsl:attribute name="Project"><xsl:value-of select="@Project"/> </xsl:attribute>
<xsl:attribute name="Solution"><xsl:value-of select="/UpgradeLog/Properties/Property[@Name='Solution']/@Value"/> </xsl:attribute>
<xsl:attribute name="Source"><xsl:value-of select="@Source"/> </xsl:attribute>
<xsl:attribute name="ErrorLevel"><xsl:value-of select="@ErrorLevel"/> </xsl:attribute>
<xsl:attribute name="Description"><xsl:value-of select="@Description"/> </xsl:attribute>
</Event>
</xsl:for-each>
</Events>
</xsl:variable>
<xsl:variable name="Projects">
<xsl:apply-templates select="msxsl:node-set($SortedEvents)/*" mode="createProjects"/>
</xsl:variable>
<xsl:apply-templates select="msxsl:node-set($Projects)/*"/>
<p></p><p>
<table class="note">
<tr>
<td nowrap="1">
<b>Conversion Settings</b>
</td>
</tr>
<xsl:apply-templates select="Properties"/>
</table></p>
</body>
</html>
</xsl:template>
</xsl:stylesheet>

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 71 B

View File

@@ -0,0 +1,11 @@
K 25
svn:wc:ra_dav:version-url
V 36
/svn/64k/!svn/ver/230/trunk/ev10/ice
END
ice.sln
K 25
svn:wc:ra_dav:version-url
V 44
/svn/64k/!svn/ver/229/trunk/ev10/ice/ice.sln
END

View File

@@ -0,0 +1,65 @@
9
dir
230
http://svn.xp-dev.com/svn/64k/trunk/ev10/ice
http://svn.xp-dev.com/svn/64k
2010-05-01T12:07:04.322967Z
230
dermark
svn:special svn:externals svn:needs-lock
e3c53db8-d867-4aff-9ce2-c1b2cf7253df
src
dir
ice.sln
file
2010-05-01T09:49:20.841204Z
9e27572d8e0bcdd2d9754b1dee7e9880
2010-05-01T09:49:20.841204Z
229
dermark
875

View File

@@ -0,0 +1 @@
9

View File

@@ -0,0 +1,20 @@
Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ice", "src/ice.vcproj", "{D91DFF9F-B3F5-4F75-AD44-19AD5F1DEB00}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{D91DFF9F-B3F5-4F75-AD44-19AD5F1DEB00}.Debug|Win32.ActiveCfg = Debug|Win32
{D91DFF9F-B3F5-4F75-AD44-19AD5F1DEB00}.Debug|Win32.Build.0 = Debug|Win32
{D91DFF9F-B3F5-4F75-AD44-19AD5F1DEB00}.Release|Win32.ActiveCfg = Release|Win32
{D91DFF9F-B3F5-4F75-AD44-19AD5F1DEB00}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,8 @@
Microsoft Visual Studio Solution File, Format Version 9.00
# Visual C++ Express 2005
Global
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

Binary file not shown.

After

Width:  |  Height:  |  Size: 548 KiB

View File

@@ -0,0 +1,47 @@
K 25
svn:wc:ra_dav:version-url
V 40
/svn/64k/!svn/ver/230/trunk/ev10/ice/src
END
ice.cpp
K 25
svn:wc:ra_dav:version-url
V 48
/svn/64k/!svn/ver/230/trunk/ev10/ice/src/ice.cpp
END
grass.png
K 25
svn:wc:ra_dav:version-url
V 50
/svn/64k/!svn/ver/229/trunk/ev10/ice/src/grass.png
END
ice.vcproj
K 25
svn:wc:ra_dav:version-url
V 51
/svn/64k/!svn/ver/229/trunk/ev10/ice/src/ice.vcproj
END
shader.hlsl
K 25
svn:wc:ra_dav:version-url
V 52
/svn/64k/!svn/ver/230/trunk/ev10/ice/src/shader.hlsl
END
Lighthouse.jpg
K 25
svn:wc:ra_dav:version-url
V 55
/svn/64k/!svn/ver/229/trunk/ev10/ice/src/Lighthouse.jpg
END
debug.h
K 25
svn:wc:ra_dav:version-url
V 48
/svn/64k/!svn/ver/229/trunk/ev10/ice/src/debug.h
END
variables.h
K 25
svn:wc:ra_dav:version-url
V 52
/svn/64k/!svn/ver/229/trunk/ev10/ice/src/variables.h
END

View File

@@ -0,0 +1,266 @@
9
dir
230
http://svn.xp-dev.com/svn/64k/trunk/ev10/ice/src
http://svn.xp-dev.com/svn/64k
2010-05-01T12:07:04.322967Z
230
dermark
svn:special svn:externals svn:needs-lock
e3c53db8-d867-4aff-9ce2-c1b2cf7253df
ice.cpp
file
2010-05-01T12:07:04.322967Z
85279668b7959ecc10c428fc61703c58
2010-05-01T12:07:04.322967Z
230
dermark
11159
grass.png
file
2010-05-01T09:49:20.841204Z
bba7ccf74476748f9ad17a05563db4fb
2010-05-01T09:49:20.841204Z
229
dermark
has-props
781196
ice.vcproj
file
2010-05-01T09:49:20.841204Z
450a4a58cd0d664d77ad2d6e3bfaaa0b
2010-05-01T09:49:20.841204Z
229
dermark
5103
shader.hlsl
file
2010-05-01T12:07:04.322967Z
f1584e18b9f929c091ddd0719b6c589c
2010-05-01T12:07:04.322967Z
230
dermark
6954
Lighthouse.jpg
file
2010-05-01T09:49:20.841204Z
8969288f4245120e7c3870287cce0ff3
2010-05-01T09:49:20.841204Z
229
dermark
has-props
561276
debug.h
file
2010-05-01T09:49:20.841204Z
0f332f6f8582a1b44b809cf95b871113
2010-05-01T09:49:20.841204Z
229
dermark
504
variables.h
file
2010-05-01T09:49:20.841204Z
bd36b833b97fb613f946193aebac404a
2010-05-01T09:49:20.841204Z
229
dermark
954

View File

@@ -0,0 +1 @@
9

View File

@@ -0,0 +1,5 @@
K 13
svn:mime-type
V 24
application/octet-stream
END

Some files were not shown because too many files have changed in this diff Show More