Initial commit: ROW Client source code
Game client codebase including: - CharacterActionControl: Character and creature management - GlobalScript: Network, items, skills, quests, utilities - RYLClient: Main client application with GUI and event handlers - Engine: 3D rendering engine (RYLGL) - MemoryManager: Custom memory allocation - Library: Third-party dependencies (DirectX, boost, etc.) - Tools: Development utilities 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
BIN
Library/dxx8/samples/Multimedia/Direct3D/Lighting/directx.ico
Normal file
BIN
Library/dxx8/samples/Multimedia/Direct3D/Lighting/directx.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
442
Library/dxx8/samples/Multimedia/Direct3D/Lighting/lighting.cpp
Normal file
442
Library/dxx8/samples/Multimedia/Direct3D/Lighting/lighting.cpp
Normal file
@@ -0,0 +1,442 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// File: Lighting.cpp
|
||||
//
|
||||
// Desc: Example code showing how to use D3D lights.
|
||||
//
|
||||
// Copyright (c) 1995-2001 Microsoft Corporation. All rights reserved.
|
||||
//-----------------------------------------------------------------------------
|
||||
#define STRICT
|
||||
#include <windows.h>
|
||||
#include <basetsd.h>
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
#include <D3DX8.h>
|
||||
#include <tchar.h>
|
||||
#include "D3DApp.h"
|
||||
#include "D3DFont.h"
|
||||
#include "D3DUtil.h"
|
||||
#include "DXUtil.h"
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Defines, constants, and global variables
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// Custom D3D vertex format used by the vertex buffer
|
||||
struct MYVERTEX
|
||||
{
|
||||
D3DXVECTOR3 p; // vertex position
|
||||
D3DXVECTOR3 n; // vertex normal
|
||||
};
|
||||
|
||||
#define D3DFVF_MYVERTEX (D3DFVF_XYZ|D3DFVF_NORMAL)
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name: class CMyD3DApplication
|
||||
// Desc: Application class. The base class (CD3DApplication) provides the
|
||||
// generic functionality needed in all Direct3D samples. CMyD3DApplication
|
||||
// adds functionality specific to this sample program.
|
||||
//-----------------------------------------------------------------------------
|
||||
class CMyD3DApplication : public CD3DApplication
|
||||
{
|
||||
LPDIRECT3DVERTEXBUFFER8 m_pWallVB; // Vertex buffer for the walls and floor
|
||||
LPD3DXMESH m_pSphereMesh; // Representation of point light
|
||||
LPD3DXMESH m_pConeMesh; // Representation of dir/spot light
|
||||
CD3DFont* m_pFont; // Font for drawing text
|
||||
D3DLIGHT8 m_light; // Description of the D3D light
|
||||
UINT m_n; // Number of vertices in the ground grid along X
|
||||
UINT m_m; // Number of vertices in the ground grid along Z
|
||||
UINT m_nTriangles; // Number of triangles in the ground grid
|
||||
|
||||
protected:
|
||||
HRESULT InitDeviceObjects();
|
||||
HRESULT RestoreDeviceObjects();
|
||||
HRESULT InvalidateDeviceObjects();
|
||||
HRESULT DeleteDeviceObjects();
|
||||
HRESULT FrameMove();
|
||||
HRESULT Render();
|
||||
HRESULT FinalCleanup();
|
||||
|
||||
public:
|
||||
CMyD3DApplication();
|
||||
};
|
||||
|
||||
|
||||
CMyD3DApplication g_d3dApp;
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name: WinMain()
|
||||
// Desc: Entry point to the program. Initializes everything, and goes into a
|
||||
// message-processing loop. Idle time is used to render the scene.
|
||||
//-----------------------------------------------------------------------------
|
||||
INT WINAPI WinMain( HINSTANCE hInst, HINSTANCE, LPSTR, INT )
|
||||
{
|
||||
if( FAILED( g_d3dApp.Create( hInst ) ) )
|
||||
return 0;
|
||||
|
||||
return g_d3dApp.Run();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name: CMyD3DApplication()
|
||||
// Desc: Application constructor. Sets attributes for the app.
|
||||
//-----------------------------------------------------------------------------
|
||||
CMyD3DApplication::CMyD3DApplication()
|
||||
{
|
||||
m_strWindowTitle = TEXT( "Lighting" );
|
||||
m_bUseDepthBuffer = FALSE;
|
||||
|
||||
m_pFont = new CD3DFont( _T("Arial"), 12, D3DFONT_BOLD );
|
||||
m_pWallVB = NULL;
|
||||
m_pSphereMesh = NULL;
|
||||
m_pConeMesh = NULL;
|
||||
|
||||
// Set up wall/floor mesh resolution. Try changing m_n and m_m to see
|
||||
// how the lighting is affected.
|
||||
m_n = 32;
|
||||
m_m = 32;
|
||||
m_nTriangles = (m_n-1)*(m_m-1)*2;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name: InitDeviceObjects()
|
||||
// Desc: Initialize scene objects.
|
||||
//-----------------------------------------------------------------------------
|
||||
HRESULT CMyD3DApplication::InitDeviceObjects()
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
if( FAILED( hr = m_pFont->InitDeviceObjects( m_pd3dDevice ) ) )
|
||||
return hr;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name: RestoreDeviceObjects()
|
||||
// Desc: Restores scene objects.
|
||||
//-----------------------------------------------------------------------------
|
||||
HRESULT CMyD3DApplication::RestoreDeviceObjects()
|
||||
{
|
||||
MYVERTEX* v;
|
||||
|
||||
// Create a square grid m_n*m_m for rendering the wall
|
||||
if( FAILED( m_pd3dDevice->CreateVertexBuffer( m_nTriangles*3*sizeof(MYVERTEX),
|
||||
D3DUSAGE_WRITEONLY, D3DFVF_MYVERTEX,
|
||||
D3DPOOL_MANAGED, &m_pWallVB ) ) )
|
||||
{
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
// Fill in the grid vertex data
|
||||
m_pWallVB->Lock( 0, 0, (BYTE**)&v, 0 );
|
||||
float dX = 1.0f/(m_n-1);
|
||||
float dZ = 1.0f/(m_m-1);
|
||||
float dU = 1.0f/(m_n-1);
|
||||
float dV = 1.0f/(m_m-1);
|
||||
UINT k = 0;
|
||||
for (UINT z=0; z < (m_m-1); z++)
|
||||
{
|
||||
for (UINT x=0; x < (m_n-1); x++)
|
||||
{
|
||||
v[k].p = D3DXVECTOR3(10 * x*dX, 0.0f, 10 * z*dZ );
|
||||
v[k].n = D3DXVECTOR3(0.0f, 1.0f, 0.0f);
|
||||
k++;
|
||||
v[k].p = D3DXVECTOR3(10 * x*dX, 0.0f, 10 * (z+1)*dZ );
|
||||
v[k].n = D3DXVECTOR3(0.0f, 1.0f, 0.0f);
|
||||
k++;
|
||||
v[k].p = D3DXVECTOR3(10 * (x+1)*dX, 0.0f, 10 * (z+1)*dZ );
|
||||
v[k].n = D3DXVECTOR3(0.0f, 1.0f, 0.0f);
|
||||
k++;
|
||||
v[k].p = D3DXVECTOR3(10 * x*dX, 0.0f, 10 * z*dZ );
|
||||
v[k].n = D3DXVECTOR3(0.0f, 1.0f, 0.0f);
|
||||
k++;
|
||||
v[k].p = D3DXVECTOR3(10 * (x+1)*dX, 0.0f, 10 * (z+1)*dZ );
|
||||
v[k].n = D3DXVECTOR3(0.0f, 1.0f, 0.0f);
|
||||
k++;
|
||||
v[k].p = D3DXVECTOR3(10 * (x+1)*dX, 0.0f, 10 * z*dZ );
|
||||
v[k].n = D3DXVECTOR3(0.0f, 1.0f, 0.0f);
|
||||
k++;
|
||||
}
|
||||
}
|
||||
m_pWallVB->Unlock();
|
||||
|
||||
// Create sphere and cone meshes to represent the lights
|
||||
if (FAILED( D3DXCreateSphere(m_pd3dDevice, 0.25f, 20, 20, &m_pSphereMesh, NULL) ) )
|
||||
return E_FAIL;
|
||||
|
||||
if (FAILED( D3DXCreateCylinder(m_pd3dDevice, 0.0f, 0.25f, 0.5f, 20, 20, &m_pConeMesh, NULL) ) )
|
||||
return E_FAIL;
|
||||
|
||||
// Set up a material
|
||||
D3DMATERIAL8 mtrl;
|
||||
D3DUtil_InitMaterial( mtrl, 1.0f, 1.0f, 1.0f );
|
||||
m_pd3dDevice->SetMaterial( &mtrl );
|
||||
|
||||
// Set miscellaneous render states
|
||||
m_pd3dDevice->SetRenderState( D3DRS_DITHERENABLE, FALSE );
|
||||
m_pd3dDevice->SetRenderState( D3DRS_SPECULARENABLE, FALSE );
|
||||
|
||||
// Set the world matrix
|
||||
D3DXMATRIX matIdentity;
|
||||
D3DXMatrixIdentity( &matIdentity );
|
||||
m_pd3dDevice->SetTransform( D3DTS_WORLD, &matIdentity );
|
||||
|
||||
// Set the view matrix.
|
||||
D3DXMATRIX matView;
|
||||
D3DXVECTOR3 vFromPt( -10, 10, -10);
|
||||
D3DXVECTOR3 vLookatPt( 0.0f, 0.0f, 0.0f );
|
||||
D3DXVECTOR3 vUpVec( 0.0f, 1.0f, 0.0f );
|
||||
D3DXMatrixLookAtLH( &matView, &vFromPt, &vLookatPt, &vUpVec );
|
||||
m_pd3dDevice->SetTransform( D3DTS_VIEW, &matView );
|
||||
|
||||
// Set the projection matrix
|
||||
D3DXMATRIX matProj;
|
||||
FLOAT fAspect = ((FLOAT)m_d3dsdBackBuffer.Width) / m_d3dsdBackBuffer.Height;
|
||||
D3DXMatrixPerspectiveFovLH( &matProj, D3DX_PI/4, fAspect, 1.0f, 100.0f );
|
||||
m_pd3dDevice->SetTransform( D3DTS_PROJECTION, &matProj );
|
||||
|
||||
// Turn on lighting.
|
||||
m_pd3dDevice->SetRenderState( D3DRS_LIGHTING, TRUE );
|
||||
|
||||
// Enable ambient lighting to a dim, grey light, so objects that
|
||||
// are not lit by the other lights are not completely black
|
||||
m_pd3dDevice->SetRenderState( D3DRS_AMBIENT,
|
||||
D3DCOLOR_COLORVALUE( 0.25, 0.25, 0.25, 1.0 ) );
|
||||
|
||||
// Set light #0 to be a simple, faint grey directional light so
|
||||
// the walls and floor are slightly different shades of grey
|
||||
D3DLIGHT8 light; // Description of the D3D light
|
||||
ZeroMemory( &light, sizeof(light) );
|
||||
light.Type = D3DLIGHT_DIRECTIONAL;
|
||||
light.Direction = D3DXVECTOR3( 0.3f, -0.5f, 0.2f );
|
||||
light.Diffuse.r = light.Diffuse.g = light.Diffuse.b = 0.25f;
|
||||
m_pd3dDevice->SetLight( 0, &light );
|
||||
|
||||
// Set light #1 to be a simple, bright directional light to use
|
||||
// on the mesh representing light #2
|
||||
ZeroMemory( &light, sizeof(light) );
|
||||
light.Type = D3DLIGHT_DIRECTIONAL;
|
||||
light.Direction = D3DXVECTOR3( 0.5f, -0.5f, 0.5f );
|
||||
light.Diffuse.r = light.Diffuse.g = light.Diffuse.b = 1.0f;
|
||||
m_pd3dDevice->SetLight( 1, &light );
|
||||
|
||||
// Light #2 will be the light used to light the floor and walls. It will
|
||||
// be set up in FrameMove() since it changes every frame.
|
||||
|
||||
// Restore the font
|
||||
m_pFont->RestoreDeviceObjects();
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name: FrameMove()
|
||||
// Desc: Called once per frame, the call is the entry point for animating
|
||||
// the scene.
|
||||
//-----------------------------------------------------------------------------
|
||||
HRESULT CMyD3DApplication::FrameMove()
|
||||
{
|
||||
ZeroMemory( &m_light, sizeof(m_light) );
|
||||
|
||||
// Rotate through the various light types
|
||||
m_light.Type = (D3DLIGHTTYPE)(1+(((DWORD)m_fTime)/5)%3);
|
||||
|
||||
// Make sure the light type is supported by the device. If
|
||||
// D3DVTXPCAPS_POSITIONALLIGHTS is not set, the device does not support
|
||||
// point or spot lights, so change light #2's type to a directional light.
|
||||
DWORD dwCaps = m_d3dCaps.VertexProcessingCaps;
|
||||
if( 0 == ( dwCaps & D3DVTXPCAPS_POSITIONALLIGHTS ) )
|
||||
{
|
||||
if( m_light.Type == D3DLIGHT_POINT || m_light.Type == D3DLIGHT_SPOT )
|
||||
m_light.Type = D3DLIGHT_DIRECTIONAL;
|
||||
}
|
||||
|
||||
// Values for the light position, direction, and color
|
||||
FLOAT x = sinf( m_fTime*2.000f );
|
||||
FLOAT y = sinf( m_fTime*2.246f );
|
||||
FLOAT z = sinf( m_fTime*2.640f );
|
||||
|
||||
m_light.Diffuse.r = 0.5f + 0.5f * x;
|
||||
m_light.Diffuse.g = 0.5f + 0.5f * y;
|
||||
m_light.Diffuse.b = 0.5f + 0.5f * z;
|
||||
m_light.Range = 100.0f;
|
||||
|
||||
switch( m_light.Type )
|
||||
{
|
||||
case D3DLIGHT_POINT:
|
||||
m_light.Position = 4.5f * D3DXVECTOR3( x, y, z );
|
||||
m_light.Attenuation1 = 0.4f;
|
||||
break;
|
||||
case D3DLIGHT_DIRECTIONAL:
|
||||
m_light.Direction = D3DXVECTOR3( x, y, z );
|
||||
break;
|
||||
case D3DLIGHT_SPOT:
|
||||
m_light.Position = 2.0f * D3DXVECTOR3( x, y, z );
|
||||
m_light.Direction = D3DXVECTOR3( x, y, z );
|
||||
m_light.Theta = 0.5f;
|
||||
m_light.Phi = 1.0f;
|
||||
m_light.Falloff = 1.0f;
|
||||
m_light.Attenuation0 = 1.0f;
|
||||
}
|
||||
m_pd3dDevice->SetLight( 2, &m_light );
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name: Render()
|
||||
// Desc: Called once per frame, the call is the entry point for 3d
|
||||
// rendering. This function sets up render states, clears the
|
||||
// viewport, and renders the scene.
|
||||
//-----------------------------------------------------------------------------
|
||||
HRESULT CMyD3DApplication::Render()
|
||||
{
|
||||
// Clear the viewport
|
||||
m_pd3dDevice->Clear( 0L, NULL, D3DCLEAR_TARGET, 0x000000ff, 1.0f, 0L );
|
||||
|
||||
// Begin the scene
|
||||
if( SUCCEEDED( m_pd3dDevice->BeginScene() ) )
|
||||
{
|
||||
m_pd3dDevice->SetStreamSource( 0, m_pWallVB, sizeof(MYVERTEX) );
|
||||
m_pd3dDevice->SetVertexShader( D3DFVF_MYVERTEX );
|
||||
|
||||
D3DXMATRIX matWorld;
|
||||
D3DXMATRIX matTrans;
|
||||
D3DXMATRIX matRotate;
|
||||
|
||||
// Turn on light #0 and #2, and turn off light #1
|
||||
m_pd3dDevice->LightEnable( 0, TRUE );
|
||||
m_pd3dDevice->LightEnable( 1, FALSE );
|
||||
m_pd3dDevice->LightEnable( 2, TRUE );
|
||||
|
||||
// Draw the floor
|
||||
D3DXMatrixTranslation( &matTrans, -5.0f, -5.0f, -5.0f );
|
||||
D3DXMatrixRotationZ( &matRotate, 0.0f );
|
||||
matWorld = matRotate * matTrans;
|
||||
m_pd3dDevice->SetTransform( D3DTS_WORLD, &matWorld );
|
||||
m_pd3dDevice->DrawPrimitive( D3DPT_TRIANGLELIST, 0, m_nTriangles );
|
||||
|
||||
// Draw the back wall
|
||||
D3DXMatrixTranslation( &matTrans, 5.0f,-5.0f, -5.0f );
|
||||
D3DXMatrixRotationZ( &matRotate, D3DX_PI/2 );
|
||||
matWorld = matRotate * matTrans;
|
||||
m_pd3dDevice->SetTransform( D3DTS_WORLD, &matWorld );
|
||||
m_pd3dDevice->DrawPrimitive( D3DPT_TRIANGLELIST, 0, m_nTriangles );
|
||||
|
||||
// Draw the side wall
|
||||
D3DXMatrixTranslation( &matTrans, -5.0f, -5.0f, 5.0f );
|
||||
D3DXMatrixRotationX( &matRotate, -D3DX_PI/2 );
|
||||
matWorld = matRotate * matTrans;
|
||||
m_pd3dDevice->SetTransform( D3DTS_WORLD, &matWorld );
|
||||
m_pd3dDevice->DrawPrimitive( D3DPT_TRIANGLELIST, 0, m_nTriangles );
|
||||
|
||||
// Turn on light #1, and turn off light #0 and #2
|
||||
m_pd3dDevice->LightEnable( 0, FALSE );
|
||||
m_pd3dDevice->LightEnable( 1, TRUE );
|
||||
m_pd3dDevice->LightEnable( 2, FALSE );
|
||||
|
||||
// Draw the mesh representing the light
|
||||
if( m_light.Type == D3DLIGHT_POINT )
|
||||
{
|
||||
// Just position the point light -- no need to orient it
|
||||
D3DXMatrixTranslation( &matWorld, m_light.Position.x,
|
||||
m_light.Position.y, m_light.Position.z );
|
||||
m_pd3dDevice->SetTransform( D3DTS_WORLD, &matWorld );
|
||||
m_pSphereMesh->DrawSubset(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Position the light and point it in the light's direction
|
||||
D3DXVECTOR3 vecFrom( m_light.Position.x, m_light.Position.y, m_light.Position.z );
|
||||
D3DXVECTOR3 vecAt( m_light.Position.x + m_light.Direction.x,
|
||||
m_light.Position.y + m_light.Direction.y,
|
||||
m_light.Position.z + m_light.Direction.z );
|
||||
D3DXVECTOR3 vecUp( 0, 1, 0);
|
||||
D3DXMATRIX matWorldInv;
|
||||
D3DXMatrixLookAtLH( &matWorldInv, &vecFrom, &vecAt, &vecUp);
|
||||
D3DXMatrixInverse( &matWorld, NULL, &matWorldInv);
|
||||
m_pd3dDevice->SetTransform( D3DTS_WORLD, &matWorld );
|
||||
m_pConeMesh->DrawSubset(0);
|
||||
}
|
||||
|
||||
// Output statistics
|
||||
m_pFont->DrawText( 2, 0, D3DCOLOR_ARGB(255,255,255,0), m_strFrameStats );
|
||||
m_pFont->DrawText( 2, 20, D3DCOLOR_ARGB(255,255,255,0), m_strDeviceStats );
|
||||
TCHAR* strLight = (m_light.Type == D3DLIGHT_POINT ? TEXT("Point Light") :
|
||||
m_light.Type == D3DLIGHT_SPOT ? TEXT("Spot Light") : TEXT("Directional Light"));
|
||||
m_pFont->DrawText( 2, 40, D3DCOLOR_ARGB(255,255,255,255), strLight);
|
||||
|
||||
// End the scene.
|
||||
m_pd3dDevice->EndScene();
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name: InvalidateDeviceObjects()
|
||||
// Desc: Invalidates device objects.
|
||||
//-----------------------------------------------------------------------------
|
||||
HRESULT CMyD3DApplication::InvalidateDeviceObjects()
|
||||
{
|
||||
SAFE_RELEASE( m_pWallVB );
|
||||
SAFE_RELEASE( m_pSphereMesh );
|
||||
SAFE_RELEASE( m_pConeMesh );
|
||||
m_pFont->InvalidateDeviceObjects();
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name: DeleteDeviceObjects()
|
||||
// Desc: Called when the app is exiting, or the device is being changed,
|
||||
// this function deletes any device dependent objects.
|
||||
//-----------------------------------------------------------------------------
|
||||
HRESULT CMyD3DApplication::DeleteDeviceObjects()
|
||||
{
|
||||
m_pFont->DeleteDeviceObjects();
|
||||
SAFE_RELEASE( m_pWallVB );
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name: FinalCleanup()
|
||||
// Desc: Called before the app exits, this function gives the app the chance
|
||||
// to cleanup after itself.
|
||||
//-----------------------------------------------------------------------------
|
||||
HRESULT CMyD3DApplication::FinalCleanup()
|
||||
{
|
||||
// Cleanup D3D font
|
||||
SAFE_DELETE( m_pFont );
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
151
Library/dxx8/samples/Multimedia/Direct3D/Lighting/lighting.dsp
Normal file
151
Library/dxx8/samples/Multimedia/Direct3D/Lighting/lighting.dsp
Normal file
@@ -0,0 +1,151 @@
|
||||
# Microsoft Developer Studio Project File - Name="Lighting" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Application" 0x0101
|
||||
|
||||
CFG=Lighting - Win32 Release
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "Lighting.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "Lighting.mak" CFG="Lighting - Win32 Release"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "Lighting - Win32 Release" (based on "Win32 (x86) Application")
|
||||
!MESSAGE "Lighting - Win32 Debug" (based on "Win32 (x86) Application")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
MTL=midl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "Lighting - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir ".\Release"
|
||||
# PROP BASE Intermediate_Dir ".\Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir ".\Release"
|
||||
# PROP Intermediate_Dir ".\Release"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c
|
||||
# ADD CPP /nologo /W3 /GX /O2 /I "..\..\common\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /YX /FD /c
|
||||
# ADD BASE MTL /nologo /D "NDEBUG" /win32
|
||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386
|
||||
# ADD LINK32 d3dx8.lib d3d8.lib winmm.lib dxguid.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /stack:0x200000,0x200000 /subsystem:windows /machine:I386 /libpath:"..\..\framework\lib"
|
||||
|
||||
!ELSEIF "$(CFG)" == "Lighting - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir ".\Debug"
|
||||
# PROP BASE Intermediate_Dir ".\Debug"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir ".\Debug"
|
||||
# PROP Intermediate_Dir ".\Debug"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c
|
||||
# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /I "..\..\common\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
|
||||
# ADD BASE MTL /nologo /D "_DEBUG" /win32
|
||||
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386
|
||||
# ADD LINK32 d3dx8dt.lib d3d8.lib winmm.lib dxguid.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /stack:0x200000,0x200000 /subsystem:windows /debug /machine:I386 /libpath:"..\..\framework\lib"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "Lighting - Win32 Release"
|
||||
# Name "Lighting - Win32 Debug"
|
||||
# Begin Group "Resource Files"
|
||||
|
||||
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\DirectX.ico
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\resource.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\winmain.rc
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Common"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\common\src\d3dapp.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\common\include\d3dapp.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\common\src\d3dfont.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\common\include\d3dfont.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\common\src\d3dutil.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\common\include\d3dutil.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\common\src\dxutil.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\common\include\dxutil.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\lighting.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\readme.txt
|
||||
# End Source File
|
||||
# End Target
|
||||
# End Project
|
||||
@@ -0,0 +1,29 @@
|
||||
Microsoft Developer Studio Workspace File, Format Version 6.00
|
||||
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "lighting"=.\Lighting.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Global:
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<3>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
54
Library/dxx8/samples/Multimedia/Direct3D/Lighting/readme.txt
Normal file
54
Library/dxx8/samples/Multimedia/Direct3D/Lighting/readme.txt
Normal file
@@ -0,0 +1,54 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name: Lighting Direct3D Sample
|
||||
//
|
||||
// Copyright (c) 1995-2001 Microsoft Corporation. All rights reserved.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
|
||||
Description
|
||||
===========
|
||||
The Lighting samples shows how to use D3D lights when rendering. It shows
|
||||
the difference between the various types of lights (ambient, point,
|
||||
directional, spot), how to configure these lights, and how to enable and
|
||||
disable them.
|
||||
|
||||
|
||||
Path
|
||||
====
|
||||
Source: DXSDK\Samples\Multimedia\D3D\Lighting
|
||||
Executable: DXSDK\Samples\Multimedia\D3D\Bin
|
||||
|
||||
|
||||
User's Guide
|
||||
============
|
||||
The following keys are implemented. The dropdown menus can be used for the
|
||||
same controls.
|
||||
<Enter> Starts and stops the scene
|
||||
<Space> Advances the scene by a small increment
|
||||
<F2> Prompts user to select a new rendering device or display mode
|
||||
<Alt+Enter> Toggles between fullscreen and windowed modes
|
||||
<Esc> Exits the app.
|
||||
|
||||
|
||||
Programming Notes
|
||||
=================
|
||||
D3D lights can be used to shade and color objects that are rendered. They
|
||||
modify the color at each vertex of the primitives rendered while the lights
|
||||
are active. Note that the walls and floor of this sample contain many
|
||||
vertices, so the lighting is fairly detailed. If the vertices were only at
|
||||
the corners of the walls and floor, the lighting effects would be much
|
||||
rougher because of the reduced number of vertices. You can modify the m_m
|
||||
and m_n member variables in this program to see how the vertex count affects
|
||||
the lighting of the surfaces.
|
||||
|
||||
There are ways to generate lighting effects other than by using D3D lights.
|
||||
Techniques like light mapping can create lighting effects that are not
|
||||
limited to being computed only at each vertex. Vertex shaders can generate
|
||||
more unusual, realistic, or customized lighting at each vertex. Pixel shaders
|
||||
can perform lighting computation at each pixel of the polygons being rendered.
|
||||
|
||||
This sample makes use of common DirectX code (consisting of helper functions,
|
||||
etc.) that is shared with other samples on the DirectX SDK. All common
|
||||
headers and source code can be found in the following directory:
|
||||
DXSDK\Samples\Multimedia\Common
|
||||
|
||||
35
Library/dxx8/samples/Multimedia/Direct3D/Lighting/resource.h
Normal file
35
Library/dxx8/samples/Multimedia/Direct3D/Lighting/resource.h
Normal file
@@ -0,0 +1,35 @@
|
||||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Developer Studio generated include file.
|
||||
// Used by Lights.rc
|
||||
//
|
||||
#define IDI_MAIN_ICON 101
|
||||
#define IDR_MAIN_ACCEL 113
|
||||
#define IDR_MENU 141
|
||||
#define IDR_POPUP 142
|
||||
#define IDD_SELECTDEVICE 144
|
||||
#define IDC_DEVICE_COMBO 1000
|
||||
#define IDC_MODE_COMBO 1001
|
||||
#define IDC_ADAPTER_COMBO 1002
|
||||
#define IDC_FULLSCREENMODES_COMBO 1003
|
||||
#define IDC_MULTISAMPLE_COMBO 1005
|
||||
#define IDC_WINDOWED_CHECKBOX 1012
|
||||
#define IDC_FULLSCREEN_TEXT 1014
|
||||
#define IDC_WINDOW 1016
|
||||
#define IDC_FULLSCREEN 1018
|
||||
#define IDM_CHANGEDEVICE 40002
|
||||
#define IDM_TOGGLEFULLSCREEN 40003
|
||||
#define IDM_TOGGLESTART 40004
|
||||
#define IDM_SINGLESTEP 40005
|
||||
#define IDM_EXIT 40006
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_3D_CONTROLS 1
|
||||
#define _APS_NEXT_RESOURCE_VALUE 146
|
||||
#define _APS_NEXT_COMMAND_VALUE 40011
|
||||
#define _APS_NEXT_CONTROL_VALUE 1027
|
||||
#define _APS_NEXT_SYMED_VALUE 102
|
||||
#endif
|
||||
#endif
|
||||
166
Library/dxx8/samples/Multimedia/Direct3D/Lighting/winmain.rc
Normal file
166
Library/dxx8/samples/Multimedia/Direct3D/Lighting/winmain.rc
Normal file
@@ -0,0 +1,166 @@
|
||||
//Microsoft Developer Studio generated resource script.
|
||||
//
|
||||
#include "resource.h"
|
||||
|
||||
#define APSTUDIO_READONLY_SYMBOLS
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 2 resource.
|
||||
//
|
||||
#define IDC_STATIC -1
|
||||
#include <windows.h>
|
||||
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#undef APSTUDIO_READONLY_SYMBOLS
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// English (U.S.) resources
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
|
||||
#ifdef _WIN32
|
||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
#pragma code_page(1252)
|
||||
#endif //_WIN32
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Icon
|
||||
//
|
||||
|
||||
// Icon with lowest ID value placed first to ensure application icon
|
||||
// remains consistent on all systems.
|
||||
IDI_MAIN_ICON ICON DISCARDABLE "DirectX.ico"
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// TEXTINCLUDE
|
||||
//
|
||||
|
||||
1 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"resource.h\0"
|
||||
END
|
||||
|
||||
2 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"#define IDC_STATIC -1\r\n"
|
||||
"#include <windows.h>\r\n"
|
||||
"\r\n"
|
||||
"\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
3 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Accelerator
|
||||
//
|
||||
|
||||
IDR_MAIN_ACCEL ACCELERATORS DISCARDABLE
|
||||
BEGIN
|
||||
VK_ESCAPE, IDM_EXIT, VIRTKEY, NOINVERT
|
||||
VK_F2, IDM_CHANGEDEVICE, VIRTKEY, NOINVERT
|
||||
VK_RETURN, IDM_TOGGLESTART, VIRTKEY, NOINVERT
|
||||
VK_RETURN, IDM_TOGGLEFULLSCREEN, VIRTKEY, ALT, NOINVERT
|
||||
VK_SPACE, IDM_SINGLESTEP, VIRTKEY, NOINVERT
|
||||
"X", IDM_EXIT, VIRTKEY, ALT, NOINVERT
|
||||
END
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// DESIGNINFO
|
||||
//
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
GUIDELINES DESIGNINFO DISCARDABLE
|
||||
BEGIN
|
||||
IDD_SELECTDEVICE, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 259
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 143
|
||||
END
|
||||
END
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Dialog
|
||||
//
|
||||
|
||||
IDD_SELECTDEVICE DIALOG DISCARDABLE 0, 0, 267, 138
|
||||
STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Select Device"
|
||||
FONT 8, "MS Shell Dlg"
|
||||
BEGIN
|
||||
GROUPBOX "Rendering device",IDC_STATIC,5,5,200,45
|
||||
LTEXT "&Adapter:",IDC_STATIC,22,17,65,10,SS_CENTERIMAGE
|
||||
COMBOBOX IDC_ADAPTER_COMBO,90,15,105,100,CBS_DROPDOWNLIST |
|
||||
WS_VSCROLL | WS_TABSTOP
|
||||
LTEXT "&Device:",IDC_STATIC,22,32,65,10,SS_CENTERIMAGE
|
||||
COMBOBOX IDC_DEVICE_COMBO,90,30,105,100,CBS_DROPDOWNLIST |
|
||||
WS_VSCROLL | WS_TABSTOP
|
||||
GROUPBOX "Rendering mode",IDC_STATIC,5,52,200,45
|
||||
CONTROL "Use desktop &window",IDC_WINDOW,"Button",
|
||||
BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,10,62,85,15
|
||||
CONTROL "&Fullscreen mode:",IDC_FULLSCREEN,"Button",
|
||||
BS_AUTORADIOBUTTON,10,77,75,15
|
||||
COMBOBOX IDC_FULLSCREENMODES_COMBO,90,77,105,204,CBS_DROPDOWNLIST |
|
||||
WS_VSCROLL | WS_GROUP | WS_TABSTOP
|
||||
GROUPBOX "Multisample",IDC_STATIC,5,101,200,28
|
||||
LTEXT "&Multisample Type:",IDC_STATIC,22,113,62,10,
|
||||
SS_CENTERIMAGE
|
||||
COMBOBOX IDC_MULTISAMPLE_COMBO,90,111,105,100,CBS_DROPDOWNLIST |
|
||||
WS_VSCROLL | WS_TABSTOP
|
||||
DEFPUSHBUTTON "OK",IDOK,210,10,50,14
|
||||
PUSHBUTTON "Cancel",IDCANCEL,210,30,50,14
|
||||
END
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Menu
|
||||
//
|
||||
|
||||
IDR_MENU MENU DISCARDABLE
|
||||
BEGIN
|
||||
POPUP "&File"
|
||||
BEGIN
|
||||
MENUITEM "&Go/stop\tEnter", IDM_TOGGLESTART
|
||||
MENUITEM "&Single step\tSpace", IDM_SINGLESTEP
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&Change device...\tF2", IDM_CHANGEDEVICE
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "E&xit\tESC", IDM_EXIT
|
||||
END
|
||||
END
|
||||
|
||||
#endif // English (U.S.) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
#ifndef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 3 resource.
|
||||
//
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#endif // not APSTUDIO_INVOKED
|
||||
|
||||
Reference in New Issue
Block a user