mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-14 02:27:40 -04:00
@ -2129,78 +2129,6 @@ void plClient::IAddRenderRequest(plRenderRequest* req)
|
||||
}
|
||||
}
|
||||
|
||||
hsG3DDeviceModeRecord plClient::ILoadDevMode(const char* devModeFile)
|
||||
{
|
||||
hsStatusMessage("Load DevMode client\n");
|
||||
HWND hWnd = fWindowHndl;
|
||||
|
||||
hsUNIXStream stream;
|
||||
hsBool gottaCreate = false;
|
||||
|
||||
// If DevModeFind is specified, use the old method
|
||||
// if ((GetGameFlags() & kDevModeFind))
|
||||
// FindAndSaveDevMode(hWnd, devModeFile);
|
||||
// Otherwise, use the new method
|
||||
hsG3DDeviceModeRecord dmr;
|
||||
if (stream.Open(devModeFile, "rb"))
|
||||
{
|
||||
/// It's there, but is the device record valid?
|
||||
hsG3DDeviceRecord selRec;
|
||||
hsG3DDeviceMode selMode;
|
||||
|
||||
selRec.Read(&stream);
|
||||
if( selRec.IsInvalid() )
|
||||
{
|
||||
hsStatusMessage( "WARNING: Old DeviceRecord found on file. Setting defaults..." );
|
||||
gottaCreate = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
/// Read the rest in
|
||||
selMode.Read(&stream);
|
||||
|
||||
UInt16 performance = stream.ReadSwap16();
|
||||
|
||||
if( performance < 25 )
|
||||
plBitmap::SetGlobalLevelChopCount( 2 );
|
||||
else if( performance < 75 )
|
||||
plBitmap::SetGlobalLevelChopCount( 1 );
|
||||
else
|
||||
plBitmap::SetGlobalLevelChopCount( 0 );
|
||||
}
|
||||
stream.Close();
|
||||
|
||||
dmr = hsG3DDeviceModeRecord(selRec, selMode);
|
||||
}
|
||||
else
|
||||
gottaCreate = true;
|
||||
|
||||
if( gottaCreate )
|
||||
{
|
||||
|
||||
hsG3DDeviceSelector devSel;
|
||||
devSel.Enumerate(hWnd);
|
||||
devSel.RemoveUnusableDevModes(true);
|
||||
|
||||
if (!devSel.GetDefault(&dmr))
|
||||
{
|
||||
//hsAssert(0, "plGame::LoadDevMode - No acceptable hardware found");
|
||||
hsMessageBox("No suitable rendering devices found.","realMYST",hsMessageBoxNormal);
|
||||
return dmr;
|
||||
}
|
||||
|
||||
if (stream.Open(devModeFile, "wb"))
|
||||
{
|
||||
dmr.GetDevice()->Write(&stream);
|
||||
dmr.GetMode()->Write(&stream);
|
||||
stream.WriteSwap16((UInt16)(0*100));
|
||||
stream.Close();
|
||||
}
|
||||
|
||||
}
|
||||
return dmr;
|
||||
}
|
||||
|
||||
void plClient::ResetDisplayDevice(int Width, int Height, int ColorDepth, hsBool Windowed, int NumAASamples, int MaxAnisotropicSamples, hsBool VSync)
|
||||
{
|
||||
if(!fPipeline) return;
|
||||
@ -2296,9 +2224,6 @@ void plClient::IDetectAudioVideoSettings()
|
||||
hsBool pixelshaders = rec->GetCap(hsG3DDeviceSelector::kCapsPixelShader);
|
||||
int psMajor = 0, psMinor = 0;
|
||||
rec->GetPixelShaderVersion(psMajor, psMinor);
|
||||
hsBool refDevice = false;
|
||||
if(rec->GetG3DHALorHEL() == hsG3DDeviceSelector::kHHD3DRefDev)
|
||||
refDevice = true;
|
||||
|
||||
plPipeline::fDefaultPipeParams.ColorDepth = hsG3DDeviceSelector::kDefaultDepth;
|
||||
#if defined(HS_DEBUGGING) || defined(DEBUG)
|
||||
@ -2325,17 +2250,10 @@ void plClient::IDetectAudioVideoSettings()
|
||||
plPipeline::fDefaultPipeParams.Shadows = 1;
|
||||
|
||||
// enable planar reflections if pixelshaders are available
|
||||
if(pixelshaders && !refDevice)
|
||||
{
|
||||
plPipeline::fDefaultPipeParams.PlanarReflections = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
plPipeline::fDefaultPipeParams.PlanarReflections = 0;
|
||||
}
|
||||
|
||||
// enable 2x antialiasing and anisotropic to 2 samples if pixelshader version is greater that 2.0
|
||||
if(psMajor >= 2 && !refDevice)
|
||||
if(psMajor >= 2)
|
||||
{
|
||||
plPipeline::fDefaultPipeParams.AntiAliasingAmount = rec->GetMaxAnisotropicSamples() ? 2 : 0;
|
||||
plPipeline::fDefaultPipeParams.AnisotropicLevel = mode->GetNumFSAATypes() ? 2 : 0;
|
||||
@ -2346,26 +2264,10 @@ void plClient::IDetectAudioVideoSettings()
|
||||
plPipeline::fDefaultPipeParams.AnisotropicLevel = 0;
|
||||
}
|
||||
|
||||
if(refDevice)
|
||||
{
|
||||
plPipeline::fDefaultPipeParams.TextureQuality = 0;
|
||||
plPipeline::fDefaultPipeParams.VideoQuality = 0;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
plPipeline::fDefaultPipeParams.TextureQuality = psMajor >= 2 ? 2 : 1;
|
||||
plPipeline::fDefaultPipeParams.VideoQuality = pixelshaders ? 2 : 1;
|
||||
}
|
||||
plPipeline::fDefaultPipeParams.TextureQuality = psMajor >= 2 ? 2 : 1;
|
||||
plPipeline::fDefaultPipeParams.VideoQuality = pixelshaders ? 2 : 1;
|
||||
plPipeline::fDefaultPipeParams.VSync = false;
|
||||
|
||||
// card specific overrides
|
||||
if(strstr(rec->GetDriverDesc(), "FX 5200"))
|
||||
{
|
||||
plPipeline::fDefaultPipeParams.AntiAliasingAmount = 0;
|
||||
}
|
||||
|
||||
|
||||
int val = 0;
|
||||
hsStream *stream = nil;
|
||||
hsUNIXStream s;
|
||||
|
@ -135,8 +135,6 @@ protected:
|
||||
|
||||
pfGameGUIMgr *fGameGUIMgr;
|
||||
|
||||
virtual hsG3DDeviceModeRecord ILoadDevMode(const char* devModeFile);
|
||||
|
||||
hsBool IUpdate();
|
||||
hsBool IDraw();
|
||||
hsBool IDrawProgress();
|
||||
|
@ -54,6 +54,9 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
#include "hsConfig.h"
|
||||
#include "hsWindows.h"
|
||||
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
|
||||
#include <ddraw.h>
|
||||
#include <d3d9.h>
|
||||
|
||||
@ -61,7 +64,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
#include "hsDXTDirectXCodec.h"
|
||||
#include "plMipmap.h"
|
||||
#include "hsCodecManager.h"
|
||||
#include "../plPipeline/hsGDDrawDllLoad.h"
|
||||
|
||||
namespace {
|
||||
typedef HRESULT(WINAPI * DIRECTDRAWCREATEEX)( GUID*, VOID**, REFIID, IUnknown* );
|
||||
@ -138,26 +140,20 @@ hsBool hsDXTDirectXCodec::IInitialize()
|
||||
{
|
||||
fFlags |= kInitialized;
|
||||
|
||||
// if( hsGDDrawDllLoad::GetDDrawDll() == nil )
|
||||
// return false;
|
||||
|
||||
DIRECTDRAWCREATEEX DirectDrawCreateEx = 0;
|
||||
DIRECTDRAWCREATEEX DirectDrawCreateEx = nil;
|
||||
|
||||
// Initialize DirectDraw
|
||||
HRESULT hr;
|
||||
DirectDrawCreateEx = (DIRECTDRAWCREATEEX)GetProcAddress( hsGDDrawDllLoad::GetD3DDll(), "DirectDrawCreateEx" );
|
||||
if( DirectDrawCreateEx == nil )
|
||||
std::unique_ptr<HINSTANCE__, std::function<BOOL(HMODULE)>> ddraw(LoadLibraryA("ddraw.dll"), FreeLibrary);
|
||||
DirectDrawCreateEx = (DIRECTDRAWCREATEEX)GetProcAddress(ddraw.get(), "DirectDrawCreateEx");
|
||||
if (!DirectDrawCreateEx)
|
||||
return false;
|
||||
|
||||
/// Using EMULATIONONLY here usually fails--using NULL forces the
|
||||
/// use of the standard display driver, which DOES work.
|
||||
if (FAILED(hr = DirectDrawCreateEx((GUID FAR *)NULL/*DDCREATE_EMULATIONONLY*/, (VOID**)&fDirectDraw, IID_IDirectDraw7, NULL)))
|
||||
if (FAILED(DirectDrawCreateEx((GUID FAR *)NULL/*DDCREATE_EMULATIONONLY*/, (VOID**)&fDirectDraw, IID_IDirectDraw7, NULL)))
|
||||
return false;
|
||||
|
||||
if (FAILED(hr = fDirectDraw->SetCooperativeLevel(NULL, DDSCL_NORMAL)))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
return SUCCEEDED(fDirectDraw->SetCooperativeLevel(NULL, DDSCL_NORMAL));
|
||||
}
|
||||
|
||||
//// CreateCompressedMipmap ///////////////////////////////////////////////////
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -69,9 +69,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
#define DYNAHEADER 1
|
||||
#endif // HS_BUILD_FOR_WIN32
|
||||
|
||||
/// #define the following to allow selection of the D3D reference driver
|
||||
#define HS_ALLOW_D3D_REF_DRIVER 1
|
||||
|
||||
|
||||
class hsStream;
|
||||
struct D3DEnum_DeviceInfo;
|
||||
@ -127,9 +124,6 @@ public:
|
||||
void AddFSAAType( UInt8 type ) { fFSAATypes.Append( type ); }
|
||||
|
||||
void SetCanRenderToCubics( hsBool can ) { fCanRenderToCubics = can; }
|
||||
|
||||
void Read(hsStream* s);
|
||||
void Write(hsStream* s) const;
|
||||
};
|
||||
|
||||
class hsG3DDeviceRecord
|
||||
@ -149,24 +143,6 @@ public:
|
||||
|
||||
protected:
|
||||
|
||||
UInt32 fRecordVersion; /// Version starts at 2 (see .cpp for explanation)
|
||||
enum {
|
||||
kCurrRecordVersion = 0x0b
|
||||
/// Version history:
|
||||
/// 1 - Initial version (had no version #)
|
||||
/// 2 - Added Z and LOD bias
|
||||
/// 3 - Changed Z and LOD bias to floats, added fog tweaks
|
||||
/// 4 - Changed values for fog tweaks; force reload through version #
|
||||
/// 5 - Same as #4, updated fog end bias to be based solely on fog quantization/bit depth
|
||||
/// 6 - Updated values for the ATI boards, Matrox, and i810
|
||||
/// 7 - Added fog knee tweaks
|
||||
/// 8 - Added support for multiple depth/stencil formats per mode
|
||||
/// 9 - Added multisample types to the mode record
|
||||
/// A - Added anisotropic sample field
|
||||
/// B - Added flag for cubic textures support
|
||||
};
|
||||
|
||||
/// Version < 2 Data
|
||||
UInt32 fFlags;
|
||||
|
||||
UInt32 fG3DDeviceType;
|
||||
@ -184,7 +160,6 @@ protected:
|
||||
|
||||
hsTArray<hsG3DDeviceMode> fModes;
|
||||
|
||||
/// New to Version 3
|
||||
float fZBiasRating;
|
||||
float fLODBiasRating;
|
||||
float fFogExpApproxStart;
|
||||
@ -193,14 +168,11 @@ protected:
|
||||
// (i.e. for Z fog, it's a percentage of 1 to add on,
|
||||
// for W fog, it's a percentage of the yon)
|
||||
|
||||
/// Version 7 - Fog Knee values
|
||||
float fFogKnees[ kNumFogTypes ];
|
||||
float fFogKneeVals[ kNumFogTypes ];
|
||||
|
||||
/// Version 9 - The actual AA setting we use
|
||||
UInt8 fAASetting;
|
||||
|
||||
/// Version A - the anisotropic level we use
|
||||
UInt8 fMaxAnisotropicSamples; // 1 to disable, up to max allowed in hardware
|
||||
int fPixelShaderMajorVer;
|
||||
int fPixelShaderMinorVer;
|
||||
@ -275,16 +247,8 @@ public:
|
||||
void Clear();
|
||||
void RemoveDiscarded();
|
||||
|
||||
// PlaceHolder - Whether a mode can window is restricted by the current setup
|
||||
// of the PC. E.g. if the user changes from 16 bit to TrueColor, the Modes that
|
||||
// can window are pretty much flipped. So we'll have to pass in enough info (like
|
||||
// the hWnd?) to find out what the current setup is to make sure it's compatible.
|
||||
hsBool ModeCanWindow(void* ctx, hsG3DDeviceMode* mode) { return false; }
|
||||
void SetPixelShaderVersion(int major, int minor) { fPixelShaderMajorVer = major; fPixelShaderMinorVer = minor; }
|
||||
void GetPixelShaderVersion(int &major, int &minor) { major = fPixelShaderMajorVer; minor = fPixelShaderMinorVer; }
|
||||
|
||||
void Read(hsStream* s);
|
||||
void Write(hsStream* s) const;
|
||||
};
|
||||
|
||||
class hsG3DDeviceModeRecord
|
||||
@ -309,47 +273,34 @@ class hsG3DDeviceSelector : public hsRefCnt
|
||||
public:
|
||||
enum {
|
||||
kDevTypeUnknown = 0,
|
||||
kDevTypeGlide,
|
||||
kDevTypeDirect3D,
|
||||
kDevTypeOpenGL,
|
||||
kDevTypeDirect3DTnL,
|
||||
|
||||
kNumDevTypes
|
||||
};
|
||||
enum {
|
||||
kHHTypeUnknown = 0,
|
||||
kHHD3DNullDev,
|
||||
kHHD3DRampDev,
|
||||
kHHD3DRGBDev,
|
||||
kHHD3DHALDev,
|
||||
kHHD3DMMXDev,
|
||||
kHHD3DTnLHalDev,
|
||||
kHHD3DRefDev,
|
||||
kHHD3D3dfxDev,
|
||||
kHHD3D3dfxVoodoo5Dev,
|
||||
|
||||
kNumHHTypes
|
||||
};
|
||||
enum {
|
||||
kCapsNone = 0,
|
||||
kCapsNoWindow,
|
||||
kCapsMipmap,
|
||||
kCapsPerspective,
|
||||
kCapsHardware,
|
||||
kCapsWBuffer,
|
||||
kCapsCompressTextures,
|
||||
kCapsHWTransform,
|
||||
kCapsDither,
|
||||
kCapsFogLinear,
|
||||
kCapsFogExp,
|
||||
kCapsFogExp2,
|
||||
kCapsFogRange,
|
||||
kCapsLODWatch,
|
||||
kCapsUNUSED,
|
||||
kCapsDoesSmallTextures,
|
||||
kCapsPixelFog,
|
||||
kCapsBadYonStuff,
|
||||
kCapsNoKindaSmallTexs,
|
||||
kCapsCubicTextures,
|
||||
kCapsCubicMipmap,
|
||||
kCapsZBias,
|
||||
@ -360,7 +311,6 @@ public:
|
||||
kCapsCantShadow,
|
||||
kCapsMaxUVWSrc2,
|
||||
kCapsCantProj,
|
||||
kCapsLimitedProj,
|
||||
kCapsShareDepth,
|
||||
kCapsBadManaged,
|
||||
kCapsNoAniso,
|
||||
@ -381,37 +331,19 @@ protected:
|
||||
|
||||
char fErrorString[ 128 ];
|
||||
|
||||
void IClear();
|
||||
void IRemoveDiscarded();
|
||||
|
||||
void ITryDirect3DTnLDevice(D3DEnum_DeviceInfo* devInfo, hsG3DDeviceRecord& srcDevRec);
|
||||
void ITryDirect3DTnLDriver(D3DEnum_DriverInfo* drivInfo);
|
||||
void ITryDirect3DTnL(hsWinRef winRef);
|
||||
hsBool IInitDirect3D( void );
|
||||
|
||||
#ifdef HS_SELECT_DX7
|
||||
void ITryDirect3DDevice(D3DEnum_DeviceInfo* devInfo, hsG3DDeviceRecord& srcDevRec);
|
||||
void ITryDirect3DDriver(D3DEnum_DriverInfo* drivInfo);
|
||||
void ITryDirect3D(hsWinRef winRef);
|
||||
#endif // HS_SELECT_DX7
|
||||
void IFudgeDirectXDevice( hsG3DDeviceRecord &record,
|
||||
D3DEnum_DriverInfo *driverInfo, D3DEnum_DeviceInfo *deviceInfo );
|
||||
UInt32 IAdjustDirectXMemory( UInt32 cardMem );
|
||||
|
||||
hsBool IGetD3DCardInfo( hsG3DDeviceRecord &record, void *driverInfo, void *deviceInfo,
|
||||
DWORD *vendorID, DWORD *deviceID, char **driverString, char **descString );
|
||||
#ifdef HS_SELECT_DX7
|
||||
hsBool IGetD3D7CardInfo( hsG3DDeviceRecord &record, void *driverInfo, void *deviceInfo,
|
||||
DWORD *vendorID, DWORD *deviceID, char **driverString, char **descString );
|
||||
#endif // HS_SELECT_DX7
|
||||
|
||||
void ITryOpenGL( hsWinRef winRef );
|
||||
void IGetExtOpenGLInfo( hsG3DDeviceRecord &devRec );
|
||||
void IGetOpenGLModes( hsG3DDeviceRecord &devRec, char *driverName );
|
||||
hsBool ITestOpenGLRes( int width, int height, int bitDepth,
|
||||
hsG3DDeviceRecord &devRec, char *driverName );
|
||||
#ifdef HS_OPEN_GL
|
||||
#if HS_BUILD_FOR_WIN32
|
||||
UInt32 ICreateTempOpenGLContext( HDC hDC, hsBool makeItFull );
|
||||
#endif
|
||||
#endif
|
||||
|
||||
void ISetFudgeFactors( UInt8 chipsetID, hsG3DDeviceRecord &record );
|
||||
|
||||
@ -419,66 +351,12 @@ public:
|
||||
hsG3DDeviceSelector();
|
||||
virtual ~hsG3DDeviceSelector();
|
||||
|
||||
void Clear();
|
||||
void RemoveDiscarded();
|
||||
void RemoveUnusableDevModes(hsBool bTough); // Removes modes and devices not allowed supported in release
|
||||
|
||||
hsBool Init( void ); // Returns false if couldn't init
|
||||
const char *GetErrorString( void ) { return fErrorString; }
|
||||
|
||||
void Enumerate(hsWinRef winRef);
|
||||
hsTArray<hsG3DDeviceRecord>& GetDeviceRecords() { return fRecords; }
|
||||
|
||||
hsBool GetDefault(hsG3DDeviceModeRecord *dmr);
|
||||
|
||||
hsG3DDeviceRecord* GetRecord(int i) { return &fRecords[i]; }
|
||||
|
||||
void Read(hsStream* s);
|
||||
void Write(hsStream* s);
|
||||
};
|
||||
|
||||
|
||||
#define M3DDEMOINFO 1 /// Always compiled now, but only enabled if
|
||||
/// WIN_INIT has DemoInfoOutput in it
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Demo Debug File header file stuff
|
||||
// Created 10.10.2000 by Mathew Burrack @ Cyan, Inc.
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <stdio.h>
|
||||
#include "headspin.h"
|
||||
|
||||
class plDemoDebugFile
|
||||
{
|
||||
public:
|
||||
plDemoDebugFile() { fDemoDebugFP = nil; fIsOpen = false; fEnabled = false; }
|
||||
~plDemoDebugFile() { IDDFClose(); }
|
||||
|
||||
// Static function to write a string to the DDF
|
||||
static void Write( char *string );
|
||||
|
||||
// Static function to write two strings to the DDF
|
||||
static void Write( char *string1, char *string2 );
|
||||
|
||||
// Static function to write a string and a signed integer value to the DDF
|
||||
static void Write( char *string1, Int32 value );
|
||||
|
||||
// Enables or disables the DDF class
|
||||
static void Enable( hsBool yes ) { fEnabled = yes; }
|
||||
|
||||
protected:
|
||||
static hsBool fIsOpen;
|
||||
static FILE *fDemoDebugFP;
|
||||
static hsBool fEnabled;
|
||||
|
||||
// Opens the DDF for writing
|
||||
static hsBool IDDFOpen( void );
|
||||
|
||||
// Closes the DDF
|
||||
static void IDDFClose( void );
|
||||
};
|
||||
|
||||
|
||||
#endif // hsG3DDeviceSelector_inc
|
||||
|
@ -1,73 +0,0 @@
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Additional permissions under GNU GPL version 3 section 7
|
||||
|
||||
If you modify this Program, or any covered work, by linking or
|
||||
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
|
||||
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
|
||||
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
|
||||
(or a modified version of those libraries),
|
||||
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
|
||||
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
|
||||
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
|
||||
licensors of this Program grant you additional
|
||||
permission to convey the resulting work. Corresponding Source for a
|
||||
non-source form of such a combination shall include the source code for
|
||||
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
|
||||
work.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
#include "hsTypes.h"
|
||||
|
||||
#include <ddraw.h>
|
||||
|
||||
#include "hsGDDrawDllLoad.h"
|
||||
|
||||
static hsGDDrawDllLoad staticDllLoad;
|
||||
|
||||
hsGDDrawDllLoad::hsGDDrawDllLoad()
|
||||
{
|
||||
hsAssert(!staticDllLoad.fD3DDll, "Don't make instances of this class, just use GetDDrawDll func");
|
||||
|
||||
fD3DDll = LoadLibrary( "D3D9.DLL" );
|
||||
if (fD3DDll)
|
||||
hsStatusMessage( "--- D3D9.DLL loaded successfully.\n" );
|
||||
else
|
||||
hsStatusMessage( "--- Unable to load D3D9.DLL successfully.\n" );
|
||||
}
|
||||
|
||||
hsGDDrawDllLoad::~hsGDDrawDllLoad()
|
||||
{
|
||||
if (fD3DDll != nil)
|
||||
{
|
||||
hsStatusMessage( "--- Unloading D3D.DLL.\n" );
|
||||
FreeLibrary(fD3DDll);
|
||||
}
|
||||
}
|
||||
|
||||
HMODULE hsGDDrawDllLoad::GetD3DDll()
|
||||
{
|
||||
return staticDllLoad.fD3DDll;
|
||||
}
|
@ -1,59 +0,0 @@
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Additional permissions under GNU GPL version 3 section 7
|
||||
|
||||
If you modify this Program, or any covered work, by linking or
|
||||
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
|
||||
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
|
||||
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
|
||||
(or a modified version of those libraries),
|
||||
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
|
||||
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
|
||||
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
|
||||
licensors of this Program grant you additional
|
||||
permission to convey the resulting work. Corresponding Source for a
|
||||
non-source form of such a combination shall include the source code for
|
||||
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
|
||||
work.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
|
||||
#ifndef hsGDDrawDllLoad_inc
|
||||
#define hsGDDrawDllLoad_inc
|
||||
|
||||
|
||||
class hsGDDrawDllLoad
|
||||
{
|
||||
private:
|
||||
HMODULE fD3DDll;
|
||||
|
||||
public:
|
||||
hsGDDrawDllLoad();
|
||||
~hsGDDrawDllLoad();
|
||||
|
||||
static HMODULE GetD3DDll();
|
||||
};
|
||||
|
||||
#endif hsGDDrawDllLoad_inc
|
@ -40,9 +40,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
|
||||
*==LICENSE==*/
|
||||
#include "plDXEnumerate.h"
|
||||
#include <ddraw.h>
|
||||
|
||||
#include "hsGDDrawDllLoad.h"
|
||||
#include "hsG3DDeviceSelector.h"
|
||||
#include "hsUtils.h"
|
||||
|
||||
@ -102,9 +99,6 @@ HRESULT hsGDirect3DTnLEnumerate::SelectFromDevMode(const hsG3DDeviceRecord* devR
|
||||
if( !colorDepth )
|
||||
enumFlags |= D3DENUM_CANWINDOW;
|
||||
enumFlags |= D3DENUM_TNLHAL;
|
||||
#ifdef HS_ALLOW_D3D_REF_DRIVER
|
||||
enumFlags |= D3DENUM_REFERENCERAST;
|
||||
#endif
|
||||
|
||||
D3DEnum_SelectDefaultDriver(enumFlags);
|
||||
|
||||
@ -217,11 +211,9 @@ HRESULT hsGDirect3DTnLEnumerate::D3DEnum_SelectDefaultDriver( DWORD dwFlags )
|
||||
}
|
||||
else
|
||||
{
|
||||
#if !HS_BUILD_FOR_XBOX
|
||||
if( dwFlags & D3DENUM_CANWINDOW )
|
||||
{
|
||||
if( (pDriver == &fDrivers[0])
|
||||
&&( pDevice->fDDCaps.Caps2 & DDCAPS2_CANRENDERWINDOWED ) )
|
||||
if( (pDriver == &fDrivers[0]) )
|
||||
{
|
||||
if( ( pDevice->fDDCaps.DevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT )
|
||||
^ !(dwFlags & D3DENUM_TNLHAL) )
|
||||
@ -229,7 +221,6 @@ HRESULT hsGDirect3DTnLEnumerate::D3DEnum_SelectDefaultDriver( DWORD dwFlags )
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif
|
||||
if( dwFlags & D3DENUM_PRIMARYHAL )
|
||||
{
|
||||
if( pDriver == &fDrivers[0] )
|
||||
@ -289,29 +280,8 @@ hsGDirect3DTnLEnumerate::hsGDirect3DTnLEnumerate()
|
||||
fDrivers.Reset(); // List of DD drivers
|
||||
|
||||
|
||||
/// New DX Enumeration
|
||||
|
||||
// Get a pointer to the creation function
|
||||
#if !HS_BUILD_FOR_XBOX
|
||||
if( hsGDDrawDllLoad::GetD3DDll() == nil )
|
||||
{
|
||||
strcpy( fEnumeErrorStr, "Cannot load Direct3D driver!" );
|
||||
return;
|
||||
}
|
||||
|
||||
Direct3DCreateProc procPtr;
|
||||
procPtr = (Direct3DCreateProc)GetProcAddress( hsGDDrawDllLoad::GetD3DDll(), "Direct3DCreate9" );
|
||||
if( procPtr == nil )
|
||||
{
|
||||
strcpy( fEnumeErrorStr, "Cannot load D3D Create Proc!" );
|
||||
return;
|
||||
}
|
||||
|
||||
// Create a D3D object to use
|
||||
IDirect3D9 *pD3D = procPtr( D3D_SDK_VERSION );
|
||||
#else
|
||||
IDirect3D9 *pD3D = Direct3DCreate9( D3D_SDK_VERSION );
|
||||
#endif
|
||||
if( pD3D == nil )
|
||||
{
|
||||
strcpy( fEnumeErrorStr, "Cannot load DirectX!" );
|
||||
@ -397,12 +367,7 @@ void hsGDirect3DTnLEnumerate::IEnumAdapterDevices( IDirect3D9 *pD3D, UINT iAdapt
|
||||
/// Confirm that HW vertex processing works on this device
|
||||
if (deviceInfo->fDDCaps.DevCaps & D3DDEVCAPS_PUREDEVICE)
|
||||
{
|
||||
#if 0
|
||||
behavior[iFormat] = D3DCREATE_HARDWARE_VERTEXPROCESSING |
|
||||
D3DCREATE_PUREDEVICE;
|
||||
#else
|
||||
behavior[iFormat] = D3DCREATE_HARDWARE_VERTEXPROCESSING;
|
||||
#endif
|
||||
if (SUCCEEDED(IConfirmDevice(&deviceInfo->fDDCaps, behavior[iFormat],
|
||||
currFormat)))
|
||||
{
|
||||
@ -672,16 +637,6 @@ hsBool hsG3DDeviceSelector::IGetD3DCardInfo( hsG3DDeviceRecord &record, // In
|
||||
|
||||
adapterInfo = &driverD3DInfo->fAdapterInfo;
|
||||
|
||||
/// Print out to our demo data file
|
||||
plDemoDebugFile::Write( "DeviceSelector detected DX Direct3D device. Info:" );
|
||||
plDemoDebugFile::Write( " Driver Description", (char *)adapterInfo->Description );
|
||||
plDemoDebugFile::Write( " Driver Name", (char *)adapterInfo->Driver );
|
||||
plDemoDebugFile::Write( " Vendor ID", (Int32)adapterInfo->VendorId );
|
||||
plDemoDebugFile::Write( " Device ID", (Int32)adapterInfo->DeviceId );
|
||||
plDemoDebugFile::Write( " Version", (char *)record.GetDriverVersion() );
|
||||
plDemoDebugFile::Write( " Memory size (in MB)", record.GetMemoryBytes() / ( 1024 * 1024 ) );
|
||||
plDemoDebugFile::Write( " Memory size (in bytes)", record.GetMemoryBytes() );
|
||||
|
||||
*vendorID = adapterInfo->VendorId;
|
||||
*deviceID = adapterInfo->DeviceId;
|
||||
*driverString = adapterInfo->Driver;
|
||||
@ -690,37 +645,6 @@ hsBool hsG3DDeviceSelector::IGetD3DCardInfo( hsG3DDeviceRecord &record, // In
|
||||
return true;
|
||||
}
|
||||
|
||||
//// IInitDirect3D ////////////////////////////////////////////////////////////
|
||||
|
||||
hsBool hsG3DDeviceSelector::IInitDirect3D( void )
|
||||
{
|
||||
if( hsGDDrawDllLoad::GetD3DDll() == nil )
|
||||
{
|
||||
strcpy( fErrorString, "Cannot load Direct3D driver!" );
|
||||
return false;
|
||||
}
|
||||
|
||||
Direct3DCreateProc procPtr;
|
||||
procPtr = (Direct3DCreateProc)GetProcAddress( hsGDDrawDllLoad::GetD3DDll(), "Direct3DCreate9" );
|
||||
if( procPtr == nil )
|
||||
{
|
||||
strcpy( fErrorString, "Cannot load D3D Create Proc!" );
|
||||
return false;
|
||||
}
|
||||
|
||||
// Create a D3D object to use
|
||||
IDirect3D9 *pD3D = procPtr( D3D_SDK_VERSION );
|
||||
if( pD3D == nil )
|
||||
{
|
||||
strcpy( fErrorString, "Cannot load DirectX!" );
|
||||
return false;
|
||||
}
|
||||
pD3D->Release();
|
||||
|
||||
fErrorString[ 0 ] = 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
//// ITryDirect3DTnL //////////////////////////////////////////////////////////
|
||||
|
||||
void hsG3DDeviceSelector::ITryDirect3DTnL(hsWinRef winRef)
|
||||
@ -742,7 +666,7 @@ void hsG3DDeviceSelector::ITryDirect3DTnLDriver(D3DEnum_DriverInfo* drivInfo)
|
||||
{
|
||||
hsG3DDeviceRecord devRec;
|
||||
devRec.Clear();
|
||||
devRec.SetG3DDeviceType( kDevTypeDirect3DTnL );
|
||||
devRec.SetG3DDeviceType( kDevTypeDirect3D );
|
||||
|
||||
devRec.SetDriverName( drivInfo->fAdapterInfo.Driver );
|
||||
devRec.SetDriverDesc( drivInfo->fAdapterInfo.Description );
|
||||
@ -768,29 +692,6 @@ void hsG3DDeviceSelector::ITryDirect3DTnLDriver(D3DEnum_DriverInfo* drivInfo)
|
||||
|
||||
/// Done first now, so we can alter the D3D type later
|
||||
ITryDirect3DTnLDevice( &drivInfo->fDevices[i], currDevRec );
|
||||
|
||||
/// Check the vendor ID to see if it's 3dfx (#0x121a). If it is, don't add it.
|
||||
/// (we don't support 3dfx D3D devices) -mcn
|
||||
/// 11.25.2000 mcn - Knew this was going to come back and bite me. Now we just
|
||||
/// append (3dfx) to the end of the device description, so that our latter test
|
||||
/// can throw it out or not, depending on whether we're "strong".
|
||||
|
||||
if( drivInfo->fAdapterInfo.VendorId == 0x121a &&
|
||||
( currDevRec.GetG3DHALorHEL() == hsG3DDeviceSelector::kHHD3DHALDev ||
|
||||
currDevRec.GetG3DHALorHEL() == hsG3DDeviceSelector::kHHD3DTnLHalDev ) )
|
||||
{
|
||||
if( drivInfo->fAdapterInfo.DeviceId >= 0x00000009 )
|
||||
{
|
||||
currDevRec.SetG3DHALorHEL( kHHD3D3dfxVoodoo5Dev );
|
||||
plDemoDebugFile::Write( " Tagging device as a 3dfx Voodoo5 or above" );
|
||||
}
|
||||
else
|
||||
{
|
||||
currDevRec.SetG3DHALorHEL( kHHD3D3dfxDev );
|
||||
plDemoDebugFile::Write( " Tagging device as a non-V5 3dfx card" );
|
||||
}
|
||||
}
|
||||
|
||||
IFudgeDirectXDevice( currDevRec, (D3DEnum_DriverInfo *)drivInfo, (D3DEnum_DeviceInfo *)&drivInfo->fDevices[ i ] );
|
||||
|
||||
if( currDevRec.GetModes().GetCount() )
|
||||
@ -832,10 +733,6 @@ void hsG3DDeviceSelector::ITryDirect3DTnLDevice(D3DEnum_DeviceInfo* devInfo, hsG
|
||||
devRec.SetCap(kCapsPerspective);
|
||||
if( devInfo->fIsHardware )
|
||||
devRec.SetCap( kCapsHardware );
|
||||
if( devInfo->fDDCaps.RasterCaps & D3DPRASTERCAPS_DITHER )
|
||||
devRec.SetCap(kCapsDither);
|
||||
if( devInfo->fDDCaps.RasterCaps & D3DPRASTERCAPS_WBUFFER )
|
||||
devRec.SetCap(kCapsWBuffer);
|
||||
if( devInfo->fDDCaps.RasterCaps & D3DPRASTERCAPS_FOGTABLE )
|
||||
{
|
||||
devRec.SetCap( kCapsFogLinear );
|
||||
|
@ -55,7 +55,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
#include "hsWindows.h"
|
||||
|
||||
#include <d3d9.h>
|
||||
#include <ddraw.h>
|
||||
#include <d3dx9mesh.h>
|
||||
#include <dxerr.h>
|
||||
|
||||
@ -67,7 +66,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
#include "plDebugText.h"
|
||||
#include "plDXEnumerate.h"
|
||||
#include "hsG3DDeviceSelector.h"
|
||||
#include "hsGDDrawDllLoad.h"
|
||||
#include "hsResMgr.h"
|
||||
#include "plStatusLogDrawer.h"
|
||||
#include "plQuality.h"
|
||||
@ -857,7 +855,6 @@ void plDXGeneralSettings::Reset()
|
||||
fNoGammaCorrect = false;
|
||||
fMaxUVWSrc = 8;
|
||||
fCantProj = false;
|
||||
fLimitedProj = false;
|
||||
fBadManaged = false;
|
||||
fShareDepth = false;
|
||||
fCurrAnisotropy = false;
|
||||
@ -896,7 +893,7 @@ void plDXPipeline::IInitDeviceState()
|
||||
|
||||
fD3DDevice->SetRenderState( D3DRS_ZFUNC, D3DCMP_LESSEQUAL );
|
||||
fD3DDevice->SetRenderState( D3DRS_ZWRITEENABLE, TRUE );
|
||||
fD3DDevice->SetRenderState( D3DRS_ZENABLE, ( fSettings.fD3DCaps & kCapsWBuffer ) ? D3DZB_USEW : D3DZB_TRUE );
|
||||
fD3DDevice->SetRenderState( D3DRS_ZENABLE, D3DZB_TRUE );
|
||||
fD3DDevice->SetRenderState( D3DRS_CLIPPING, TRUE );
|
||||
fD3DDevice->SetRenderState( D3DRS_CULLMODE, fCurrCullMode );
|
||||
ISetCullMode();
|
||||
@ -908,7 +905,7 @@ void plDXPipeline::IInitDeviceState()
|
||||
fD3DDevice->SetRenderState( D3DRS_MULTISAMPLEANTIALIAS, ( fSettings.fD3DCaps & kCapsFSAntiAlias ) ? TRUE : FALSE );
|
||||
fD3DDevice->SetRenderState( D3DRS_ANTIALIASEDLINEENABLE, FALSE );
|
||||
|
||||
fD3DDevice->SetRenderState( D3DRS_DITHERENABLE, ( fSettings.fD3DCaps & kCapsDither ) ? TRUE : FALSE );
|
||||
fD3DDevice->SetRenderState( D3DRS_DITHERENABLE, FALSE );
|
||||
fD3DDevice->SetRenderState( D3DRS_SPECULARENABLE, FALSE );
|
||||
fD3DDevice->SetRenderState( D3DRS_LIGHTING, FALSE );
|
||||
fCurrD3DLiteState = false;
|
||||
@ -1005,10 +1002,6 @@ void plDXPipeline::ISetCaps()
|
||||
fSettings.fD3DCaps |= kCapsMipmap;
|
||||
if( fCurrentDevice->fDDCaps.TextureCaps & D3DPTEXTURECAPS_MIPCUBEMAP )
|
||||
fSettings.fD3DCaps |= kCapsCubicMipmap;
|
||||
if( fCurrentDevice->fDDCaps.RasterCaps & D3DPRASTERCAPS_WBUFFER )
|
||||
fSettings.fD3DCaps |= kCapsWBuffer;
|
||||
if( fCurrentDevice->fDDCaps.RasterCaps & D3DPRASTERCAPS_DITHER )
|
||||
fSettings.fD3DCaps |= kCapsDither;
|
||||
if( fSettings.fNumAASamples > 0 )
|
||||
fSettings.fD3DCaps |= kCapsFSAntiAlias;
|
||||
if( fCurrentDevice->fDDCaps.RasterCaps & D3DPRASTERCAPS_WFOG )
|
||||
@ -1017,8 +1010,8 @@ void plDXPipeline::ISetCaps()
|
||||
fSettings.fD3DCaps |= kCapsCubicTextures;
|
||||
|
||||
/// New 1.5.2000 - cull out mixed vertex processing
|
||||
if( fCurrentDevice->fDDCaps.DevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT
|
||||
&& fCurrentMode->fDDBehavior == D3DCREATE_HARDWARE_VERTEXPROCESSING
|
||||
if( (fCurrentDevice->fDDCaps.DevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT)
|
||||
&& (fCurrentMode->fDDBehavior == D3DCREATE_HARDWARE_VERTEXPROCESSING)
|
||||
)
|
||||
fSettings.fD3DCaps |= kCapsHWTransform;
|
||||
|
||||
@ -1115,16 +1108,8 @@ void plDXPipeline::IRestrictCaps( const hsG3DDeviceRecord& devRec )
|
||||
fSettings.fD3DCaps &= ~kCapsMipmap;
|
||||
if( !devRec.GetCap( hsG3DDeviceSelector::kCapsCubicMipmap ) )
|
||||
fSettings.fD3DCaps &= ~kCapsCubicMipmap;
|
||||
if( !devRec.GetCap( hsG3DDeviceSelector::kCapsWBuffer ) )
|
||||
fSettings.fD3DCaps &= ~kCapsWBuffer;
|
||||
if( !devRec.GetCap( hsG3DDeviceSelector::kCapsZBias ) )
|
||||
fSettings.fD3DCaps &= ~kCapsZBias;
|
||||
// if( !devRec.GetCap( hsG3DDeviceSelector::kCapsHWTransform ) )
|
||||
// fSettings.fD3DCaps &= ~kCapsHWTransform;
|
||||
if( !devRec.GetCap( hsG3DDeviceSelector::kCapsDither ) )
|
||||
fSettings.fD3DCaps &= ~kCapsDither;
|
||||
// if( devRec.GetAASetting() == 0 )
|
||||
// fSettings.fD3DCaps &= ~kCapsFSAntiAlias;
|
||||
if( !devRec.GetCap( hsG3DDeviceSelector::kCapsFogExp ) )
|
||||
fSettings.fD3DCaps &= ~kCapsExpFog;
|
||||
if( !devRec.GetCap( hsG3DDeviceSelector::kCapsCubicTextures ) )
|
||||
@ -1135,8 +1120,6 @@ void plDXPipeline::IRestrictCaps( const hsG3DDeviceRecord& devRec )
|
||||
|
||||
if( devRec.GetCap(hsG3DDeviceSelector::kCapsCantProj) )
|
||||
fSettings.fCantProj = true;
|
||||
if( devRec.GetCap(hsG3DDeviceSelector::kCapsLimitedProj) )
|
||||
fSettings.fLimitedProj = true;
|
||||
if( devRec.GetCap(hsG3DDeviceSelector::kCapsBadManaged) )
|
||||
fSettings.fBadManaged = true;
|
||||
if( devRec.GetCap(hsG3DDeviceSelector::kCapsShareDepth) )
|
||||
@ -1152,11 +1135,6 @@ void plDXPipeline::IRestrictCaps( const hsG3DDeviceRecord& devRec )
|
||||
if( devRec.GetCap( hsG3DDeviceSelector::kCapsBadYonStuff ) )
|
||||
fSettings.fD3DCaps |= kCapsHasBadYonStuff;
|
||||
|
||||
/// 10.31.2000 mcn - Flag for can't-handle-under-8-pixel-dimensions-on-textures
|
||||
/// (see, isn't the name flag actually better in retrospect? :)
|
||||
if( devRec.GetCap( hsG3DDeviceSelector::kCapsNoKindaSmallTexs ) )
|
||||
fSettings.fD3DCaps |= kCapsNoKindaSmallTexs;
|
||||
|
||||
/// Note: the following SHOULD be here, but we later detect for texture
|
||||
/// formats and reset this flag. It should only be set if it is set already,
|
||||
/// but that means ensuring it's set beforehand, which it might not be.
|
||||
@ -1218,15 +1196,8 @@ void plDXPipeline::IRestrictCaps( const hsG3DDeviceRecord& devRec )
|
||||
fManagedCutoff = 1;
|
||||
}
|
||||
|
||||
//// Our temp debug flag to force z-buffering...
|
||||
if( !( fDbgSetupInitFlags & 0x00000001 ) )
|
||||
fSettings.fD3DCaps &= ~kCapsWBuffer;
|
||||
|
||||
/// Set up the z-bias scale values, based on z- or w-buffering
|
||||
if( fSettings.fD3DCaps & kCapsWBuffer )
|
||||
fTweaks.fDefaultPerspLayerScale = kPerspLayerScaleW;
|
||||
else
|
||||
fTweaks.fDefaultPerspLayerScale = kPerspLayerScale;
|
||||
/// Set up the z-bias scale values
|
||||
fTweaks.fDefaultPerspLayerScale = kPerspLayerScale;
|
||||
|
||||
|
||||
// Less than 4 layers at once means we have to fallback on uv bumpmapping
|
||||
@ -1541,16 +1512,7 @@ hsBool plDXPipeline::ICreateMaster()
|
||||
hsAssert( !fD3DObject, "ICreateMaster() should only be called for Master Direct3DDevice" );
|
||||
|
||||
/// The new DirectX Way: Create a Direct3D object, out of which everything else springs
|
||||
if( hsGDDrawDllLoad::GetD3DDll() == nil )
|
||||
return ICreateFail( "Cannot load Direct3D driver!" );
|
||||
|
||||
Direct3DCreateProc procPtr;
|
||||
procPtr = (Direct3DCreateProc)GetProcAddress( hsGDDrawDllLoad::GetD3DDll(), "Direct3DCreate9" );
|
||||
if( procPtr == nil )
|
||||
return ICreateFail( "Cannot load D3D Create Proc!" );
|
||||
|
||||
// Create a D3D object to use
|
||||
fD3DObject = procPtr( D3D_SDK_VERSION );
|
||||
fD3DObject = Direct3DCreate9( D3D_SDK_VERSION );
|
||||
|
||||
if( fD3DObject == nil )
|
||||
return ICreateFail( "Cannot create Direct3D object" );
|
||||
@ -3869,9 +3831,7 @@ hsBool plDXPipeline::BeginRender()
|
||||
}
|
||||
|
||||
// Superfluous setting of Z state.
|
||||
fD3DDevice->SetRenderState( D3DRS_ZENABLE,
|
||||
( fView.IsPerspective() && ( fSettings.fD3DCaps & kCapsWBuffer ) )
|
||||
? D3DZB_USEW : D3DZB_TRUE );
|
||||
fD3DDevice->SetRenderState( D3DRS_ZENABLE, D3DZB_TRUE );
|
||||
|
||||
/// If we have a renderTarget active, use its viewport
|
||||
ISetViewport();
|
||||
@ -8651,11 +8611,6 @@ hsBool plDXPipeline::IProcessMipmapLevels( plMipmap *mipmap, UInt32 &numLevels,
|
||||
{
|
||||
UInt32 sizeMask = 0x03;
|
||||
|
||||
/// 10.31.2000 - If we have this flag set, we really have to cut out
|
||||
/// sizes under 8x8. So far only true on the KYRO...
|
||||
if( fSettings.fD3DCaps & kCapsNoKindaSmallTexs )
|
||||
sizeMask = 0x07;
|
||||
|
||||
int maxLevel = mipmap->GetNumLevels() - 1;
|
||||
|
||||
/// 9.7.2000 - Also do this test if the card doesn't support
|
||||
@ -9668,34 +9623,14 @@ hsMatrix44 plDXPipeline::IGetCameraToNDC()
|
||||
// is [x/w, y/w, z/w + t/s, 1/sw]
|
||||
|
||||
|
||||
if( fSettings.fD3DCaps & kCapsWBuffer )
|
||||
{
|
||||
// W-buffering is only true w-buffering on 3dfx cards. On everything else,
|
||||
// they REALLY base it off the Z value. So we want to scale (but NOT translate)
|
||||
// the Z...
|
||||
// Note: the base value for perspLayerScale should be 0.001 for w-buffering,
|
||||
// not the normal 0.00001
|
||||
float scale = 1.f - float(fCurrRenderLayer) * fTweaks.fPerspLayerScale;
|
||||
float scale = 1.f - float(fCurrRenderLayer) * fTweaks.fPerspLayerScale;
|
||||
float zTrans = -scale * float(fCurrRenderLayer) * fTweaks.fPerspLayerTrans;
|
||||
|
||||
cam2ndc.fMap[0][0] *= scale;
|
||||
cam2ndc.fMap[1][1] *= scale;
|
||||
cam2ndc.fMap[2][2] *= scale;
|
||||
cam2ndc.fMap[3][2] *= scale;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Z-buffering, so do it the traditional way
|
||||
float scale = 1.f - float(fCurrRenderLayer) * fTweaks.fPerspLayerScale;
|
||||
// scale = -1.f;
|
||||
float zTrans = -scale * float(fCurrRenderLayer) * fTweaks.fPerspLayerTrans;
|
||||
|
||||
cam2ndc.fMap[0][0] *= scale;
|
||||
cam2ndc.fMap[1][1] *= scale;
|
||||
|
||||
cam2ndc.fMap[2][2] *= scale;
|
||||
cam2ndc.fMap[2][2] += zTrans * cam2ndc.fMap[3][2];
|
||||
cam2ndc.fMap[3][2] *= scale;
|
||||
}
|
||||
cam2ndc.fMap[0][0] *= scale;
|
||||
cam2ndc.fMap[1][1] *= scale;
|
||||
cam2ndc.fMap[2][2] *= scale;
|
||||
cam2ndc.fMap[2][2] += zTrans * cam2ndc.fMap[3][2];
|
||||
cam2ndc.fMap[3][2] *= scale;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -11387,9 +11322,6 @@ void plDXPipeline::IRenderProjectionEach(const plRenderPrimFunc& render, hsGMate
|
||||
|
||||
int iNextPass = iPass + fCurrNumLayers;
|
||||
|
||||
if( fSettings.fLimitedProj && (material->GetLayer(iPass)->GetUVWSrc() & ~plLayerInterface::kUVWIdxMask) )
|
||||
return;
|
||||
|
||||
// For each projector:
|
||||
int k;
|
||||
for( k = 0; k < fLights.fProjEach.GetCount(); k++ )
|
||||
@ -12216,12 +12148,6 @@ void plDXPipeline::SubmitShadowSlave(plShadowSlave* slave)
|
||||
if( !(slave && slave->fCaster && slave->fCaster->GetKey()) )
|
||||
return;
|
||||
|
||||
// A board with limited projection capability (i.e. GeForce1) can't
|
||||
// do perspective shadows (from point source lights) because it
|
||||
// requires a count3 uvw on 2 texture units (0,1) simultaneously. Just skip.
|
||||
if( (fSettings.fLimitedProj || fSettings.fCantProj) && slave->fView.GetPerspective() )
|
||||
return;
|
||||
|
||||
// Ref the shadow caster so we're sure it will still be around when we go to
|
||||
// render it.
|
||||
slave->fCaster->GetKey()->RefObject();
|
||||
|
@ -177,30 +177,27 @@ class plDXPipeline : public plPipeline
|
||||
{
|
||||
protected:
|
||||
enum {
|
||||
kCapsNone = 0x0,
|
||||
kCapsCompressTextures = 0x1,
|
||||
kCapsMipmap = 0x2,
|
||||
kCapsHWTransform = 0x4,
|
||||
kCapsHWLighting = 0x8,
|
||||
kCapsZBias = 0x10,
|
||||
kCapsLinearFog = 0x20,
|
||||
kCapsExpFog = 0x40,
|
||||
kCapsExp2Fog = 0x80,
|
||||
kCapsRangeFog = 0x100,
|
||||
kCapsWBuffer = 0x200,
|
||||
kCapsTexBoundToStage = 0x400,
|
||||
kCapsDither = 0x800,
|
||||
kCapsLODWatch = 0x1000,
|
||||
kCapsFSAntiAlias = 0x2000,
|
||||
kCapsLuminanceTextures = 0x4000,
|
||||
kCapsDoesSmallTextures = 0x8000,
|
||||
kCapsDoesWFog = 0x10000,
|
||||
kCapsPixelFog = 0x20000,
|
||||
kCapsHasBadYonStuff = 0x40000,
|
||||
kCapsNoKindaSmallTexs = 0x80000,
|
||||
|
||||
kCapsCubicTextures = 0x200000,
|
||||
kCapsCubicMipmap = 0x400000
|
||||
kCapsNone = 0x00000000,
|
||||
kCapsCompressTextures = 0x00000001,
|
||||
kCapsMipmap = 0x00000002,
|
||||
kCapsHWTransform = 0x00000004,
|
||||
kCapsHWLighting = 0x00000008,
|
||||
kCapsZBias = 0x00000010,
|
||||
kCapsLinearFog = 0x00000020,
|
||||
kCapsExpFog = 0x00000040,
|
||||
kCapsExp2Fog = 0x00000080,
|
||||
kCapsRangeFog = 0x00000100,
|
||||
kCapsTexBoundToStage = 0x00000200,
|
||||
kCapsLODWatch = 0x00000400,
|
||||
kCapsFSAntiAlias = 0x00000800,
|
||||
kCapsLuminanceTextures = 0x00001000,
|
||||
kCapsDoesSmallTextures = 0x00002000,
|
||||
kCapsDoesWFog = 0x00004000,
|
||||
kCapsPixelFog = 0x00008000,
|
||||
kCapsHasBadYonStuff = 0x00010000,
|
||||
kCapsNpotTextures = 0x00020000,
|
||||
kCapsCubicTextures = 0x00040000,
|
||||
kCapsCubicMipmap = 0x00080000
|
||||
};
|
||||
enum {
|
||||
kKNone = 0x0,
|
||||
|
Reference in New Issue
Block a user