-
大小: 18.92MB文件类型: .rar金币: 1下载: 0 次发布日期: 2023-07-03
- 语言: 其他
- 标签: 游戏编程 net_assassin
资源简介
本资源对应 net_assassin 的博客专栏中的源代码。
简单易懂
敬请阅读
代码片段和文件信息
/*
D3DXSprite Test Program
By John Doe Uber Coder Supreme
Don‘t mess with my code!
*/
#include
#include
#include
const bool wireframe = false;
const char *APPtitle = “Lighting Example“;
const int SCREENW = 1024;
const int SCREENH = 768;
HWND window;
bool gameover = false;
//Direct3D objects
LPDIRECT3D9 d3d = NULL;
LPDIRECT3DDEVICE9 d3ddev = NULL;
//define the 2D rendering objects
LPD3DXSPRITE d3dxsprite = NULL;
LPD3DXMESH sphere;
//void CreateCube(double width double height double depth)
//{
// D3DXCreateBox(g_engine->getDevice() (float)width (float)height (float)depth &mesh NULL);
//}
//
//void CreateTeapot()
//{
// D3DXCreateTeapot(g_engine->getDevice() &mesh NULL);
//}
void Create_Point_Light(int lightNum D3DXVECTOR3 position double range)
{
D3DLIGHT9 p_light;
//D3DCOLORVALUE p_color;
ZeroMemory( &p_light sizeof(D3DLIGHT9) );
p_light.Diffuse.r = p_light.Ambient.r = 1.0f;
p_light.Diffuse.g = p_light.Ambient.g = 1.0f;
p_light.Diffuse.b = p_light.Ambient.b = 1.0f;
p_light.Diffuse.a = p_light.Ambient.a = 1.0f;
p_light.Range = (float)range;
p_light.Type = D3DLIGHT_POINT;
p_light.Position = position;
p_light.Attenuation0 = 0.1f;
d3ddev->SetLight(lightNum &p_light);
d3ddev->LightEnable(lightNumTRUE);
}
void Set_Camera(float xfloat yfloat z)
{
D3DXMATRIX p_matrixProj;
D3DXMATRIX p_matrixView;
D3DXMATRIX p_matrixRot;
D3DXVECTOR3 p_updir;
double p_nearRange;
double p_farRange;
double p_aspectRatio;
double p_fov;
D3DXVECTOR3 p_position;
D3DXVECTOR3 p_rotation;
D3DXVECTOR3 p_target;
p_position = D3DXVECTOR3(x y z);
p_target = D3DXVECTOR3(0.0f0.0f0.0f);
p_updir = D3DXVECTOR3(0.0f1.0f0.0f);
//hard coded to 1.3333 by default
p_fov = D3DX_PI / 4.0;
p_aspectRatio = 1024 / 768;
p_nearRange = 1.0;
p_farRange = 2000.0;
//set the camera‘s perspective matrix
D3DXMatrixPerspectiveFovLH(&p_matrixProj (float)p_fov (float)p_aspectRatio (float)p_nearRange (float)p_farRange);
d3ddev->SetTransform(D3DTS_PROJECTION &p_matrixProj);
//set the camera‘s view matrix
D3DXMatrixLookAtLH(&p_matrixView &p_position &p_target &p_updir);
d3ddev->SetTransform(D3DTS_VIEW &p_matrixView );
}
void Create_Directional_Light(int lightNum D3DXVECTOR3 direction double range)
{
D3DLIGHT9 p_light;
ZeroMemory( &p_light sizeof(D3DLIGHT9) );
p_light.Diffuse.r = p_light.Ambient.r = 1.0f;
p_light.Diffuse.g = p_light.Ambient.g = 1.0f;
p_light.Diffuse.b = p_light.Ambient.b = 1.0f;
p_light.Diffuse.a = p_light.Ambient.a = 1.0f;
p_light.Range = (float)range;
p_light.Type = D3DLIGHT_DIRECTIONAL;
D3DXVec3Normalize( (D3DXVECTOR3*)&p_light.Direction &direction );
d3ddev->SetLight(lightNum &p_light);
d3ddev->LightEnable(lightNumTRUE);
}
//void Create_Spot_Light(int lightNum D3DLIGHTTYPE type D3DXVECTOR3 position D3DXVECTOR3 dir
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 112 2009-06-09 21:54 Begin Game Programming\software\Anim8or Web Site.url
文件 1818678 2007-04-02 21:46 Begin Game Programming\software\Anim8or.exe
文件 848182 2009-06-09 21:55 Begin Game Programming\software\animv095c.zip
文件 4051 2009-06-09 21:31 Begin Game Programming\source\APPEND\Lighting Stock Sphere\Direct3DTest\D3DXSpriteTest.vcproj
文件 1409 2009-06-09 21:31 Begin Game Programming\source\APPEND\Lighting Stock Sphere\Direct3DTest\D3DXSpriteTest.vcproj.HAL.jonathan.user
文件 10240 2009-06-09 21:31 Begin Game Programming\source\APPEND\Lighting Stock Sphere\Direct3DTest\LightingExample.exe
文件 10079 2009-06-09 00:53 Begin Game Programming\source\APPEND\Lighting Stock Sphere\Direct3DTest\main.cpp
文件 906 2009-02-03 07:27 Begin Game Programming\source\APPEND\Lighting Stock Sphere\LightingExample.sln
文件 9216 2009-06-09 21:31 Begin Game Programming\source\APPEND\Lighting Stock Sphere\LightingExample.suo
文件 900 2009-04-15 21:01 Begin Game Programming\source\APPEND\Shader--Color\ColorShader.sln
文件 49664 2009-06-09 21:31 Begin Game Programming\source\APPEND\Shader--Color\ColorShader.suo
文件 1648 2009-04-16 02:06 Begin Game Programming\source\APPEND\Shader--Color\Direct3DTest\ambientdiffuse.fx
文件 196664 2001-01-30 02:58 Begin Game Programming\source\APPEND\Shader--Color\Direct3DTest\apache.bmp
文件 148209 2003-06-23 01:57 Begin Game Programming\source\APPEND\Shader--Color\Direct3DTest\Apache.X
文件 75776 2009-06-09 21:31 Begin Game Programming\source\APPEND\Shader--Color\Direct3DTest\ColorShader.exe
文件 4234 2009-06-09 21:31 Begin Game Programming\source\APPEND\Shader--Color\Direct3DTest\ColorShader.vcproj
文件 1409 2009-06-09 21:31 Begin Game Programming\source\APPEND\Shader--Color\Direct3DTest\ColorShader.vcproj.HAL.jonathan.user
文件 7471 2009-06-09 01:02 Begin Game Programming\source\APPEND\Shader--Color\Direct3DTest\main.cpp
文件 5220 2009-04-16 02:09 Begin Game Programming\source\APPEND\Shader--Color\Direct3DTest\Mesh.cpp
文件 2467 2009-04-16 01:40 Begin Game Programming\source\APPEND\Shader--Color\Direct3DTest\Mesh.h
文件 10752 2009-04-17 03:46 Begin Game Programming\source\APPEND\Shader--Color\Direct3DTest\Thumbs.db
文件 5192 2009-06-09 01:20 Begin Game Programming\source\APPEND\Shader--Wirefr
文件 1288 2009-06-09 01:20 Begin Game Programming\source\APPEND\Shader--Wirefr
文件 4112 2009-06-09 21:32 Begin Game Programming\source\APPEND\Shader--Wirefr
文件 1409 2009-06-09 21:33 Begin Game Programming\source\APPEND\Shader--Wirefr
文件 57856 2009-06-09 21:33 Begin Game Programming\source\APPEND\Shader--Wirefr
文件 15117312 2009-06-09 21:33 Begin Game Programming\source\APPEND\Shader--Wirefr
文件 902 2009-04-01 22:41 Begin Game Programming\source\APPEND\Shader--Wirefr
文件 18432 2009-06-09 21:33 Begin Game Programming\source\APPEND\Shader--Wirefr
文件 7680 2009-06-09 21:35 Begin Game Programming\source\chapter01\Hello World Demo\HelloWorld.exe
............此处省略386个文件信息
相关资源
- directx_API
- 任天堂游戏编程探密.PDF
- Direct3D游戏编程入门教程2
- 游戏编程模式 Game.Programming.Patterns 英
- 游戏编程入门第四版Jonathan S.harbour随
- MUD游戏编程.part4(无水印版本)
- 全套完整Flash游戏编程基础教程和源码
- [pdf文件] 游戏编程精粹7(中文版)
- 游戏编程精粹8--随书光盘源代码(p
- scratch研究论文
- 游戏脚本高级编程 高清珍藏版PDF带书
- BOX2D 物理游戏编程初学者指南 陈文登
- 游戏编程中的寻路算法研究
- 网络中国象棋对弈程序
- 可编程机器人,一个FLASH小游戏
- 《快乐成语》益智游戏完全源程序
- 一个漂亮的打地鼠游戏源码
- Exactly like the classic etch-a-sketch game yo
- 《DirectX 11游戏编程入门》中文版+英文
- 逐梦旅程 WINDOWS游戏编程之从零开始
- 用win32API编的飞机游戏
- 2分钟flash动画制作
- coco2dx游戏源码 50多种
- 实现读取高度图,设置点光源设置材
- 游戏编程笔记-起步3-贪吃蛇游戏源代
- scratch游戏编程:星际飞行躲避碰撞
- MFC游戏编程
- PC 游戏编程续人机博弈源码.rar
- 汉诺塔游戏算法递归简单算法
- PC游戏编程人机对弈
评论
共有 条评论