91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 296KB
    文件類型: .zip
    金幣: 2
    下載: 0 次
    發布日期: 2021-06-03
  • 語言: 其他
  • 標簽: D3D11??紋理??

資源簡介

該示例用于演示D3D11中紋理的基礎使用,包括完整的框架源代碼及可執行程序。如果可執行程序運行有問題,請自行手動編譯程序,有關操作請參考附帶的使用說明。程序有任何問題或不解之處,歡迎提出~

資源截圖

代碼片段和文件信息

#include?
#include?
#include?
#include?
#include?
#include?
#include?
#include?
#include?

using?namespace?std;

//定義頂點結構:
//?1.?位置
//?2.?法線
//?3.?紋理坐標
struct?Vertex
{
XMFLOAT3 pos;
XMFLOAT3 normal;
XMFLOAT2 tex;
};

class?TextureDemo:?public?WinApp
{
public:
TextureDemo(HINSTANCE?hInst?std::wstring?title?=?L“D3D11學習?紋理使用“?int?width?=?640?int?height?=?480);
~TextureDemo();

bool?Init();
bool?Update(float?delta);
bool?Render();

//鼠標控制
void?onmousedown(WPARAM?btnState?int?x?int?y);
void?onmouseup(WPARAM?btnState?int?x?int?y);
void?onmousemove(WPARAM?btnState?int?x?int?y);

private:
bool?BuildFX();
bool?BuildInputLayout();
bool?BuildBuffers();
bool?BuildTexture();

private:
ID3D11InputLayout *m_inputLayout;

ID3D11Buffer *m_VB;
ID3D11Buffer *m_IB;

ID3DX11Effect *m_fx;
//針對Effect中的全局變量,在C++中的一對一相應的變量,用于修改Effect變量
ID3DX11EffectShaderResourceVariable *m_fxTex;
ID3DX11EffectMatrixVariable *m_fxWorldViewProj;
ID3DX11EffectMatrixVariable *m_fxWorldInvTranspose;
ID3DX11EffectMatrixVariable *m_fxWorld;
ID3DX11EffectVariable *m_fxSpotLight;
ID3DX11EffectVariable *m_fxMaterial;
ID3DX11EffectVariable *m_fxEyePos;

ID3D11ShaderResourceView *m_texView;
GeoGen::MeshData m_box;
Lights::SpotLight m_spotLight;
Lights::Material m_material;
XMFLOAT3 m_eyePos;

//是否使用光照(聚光燈)
bool m_useLight;

//鼠標控制參數
float m_theta?m_phy;
float m_radius;
POINT m_lastPos;
};

TextureDemo::TextureDemo(HINSTANCE?hInst?std::wstring?title?int?width?int?height):WinApp(hInsttitlewidthheight)
m_inputLayout(NULL)
m_VB(NULL)
m_IB(NULL)
m_fx(NULL)
m_fxTex(NULL)
m_fxWorldViewProj(NULL)
m_texView(NULL)
m_useLight(false)
m_theta(XM_PI*1.5f)
m_phy(XM_PI*0.5f)
m_radius(6.f)
{
m_spotLight.ambient?=?XMFLOAT4(0.f0.f0.f1.f);
m_spotLight.diffuse?=?XMFLOAT4(0.5f0.5f0.5f1.f);
m_spotLight.specular?=?XMFLOAT4(0.3f0.3f0.3f1.f);
m_spotLight.pos?=?XMFLOAT3(m_radius*sin(m_phy)*cos(m_theta)m_radius*cos(m_phy)m_radius*sin(m_phy)*sin(m_theta));
m_spotLight.range?=?100.f;
m_spotLight.theta?=?XMConvertToRadians(30.f);
XMStoreFloat3(&m_spotLight.dir
XMVector3Normalize(XMVectorSet(-m_radius*sin(m_phy)*cos(m_theta)
-m_radius*cos(m_phy)
-m_radius*sin(m_phy)*sin(m_theta)0.f)));
m_spotLight.att?=?XMFLOAT3(0.2f0.f0.f);
m_spotLight.spot?=60.f;

m_material.ambient?=?XMFLOAT4(0.f0.f0.f1.f);
m_material.diffuse?=?XMFLOAT4(0.6f0.6f0.6f1.f);
m_material.specular?=?XMFLOAT4(0.3f0.3f0.3f60.f);
}

TextureDemo::~TextureDemo()
{
SafeRelease(m_texView);
SafeRelease(m_fx);
SafeRelease(m_inputLayout);
SafeRelease(m_IB);
SafeRelease(m_VB);
}

bool?TextureDemo::BuildFX()
{
ifstream?fxFile(“FX/BasicTex.fxo“ios::binary);
if(!fxFile)
{
return?false;
}

fxFi

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2012-12-26?08:16??D3D11紋理基礎\
?????目錄???????????0??2012-12-26?08:11??D3D11紋理基礎\Common\
?????文件??????????24??2012-12-22?20:53??D3D11紋理基礎\Common\AppUtil.cpp
?????文件????????1004??2012-12-24?07:29??D3D11紋理基礎\Common\AppUtil.h
?????文件???????14007??2012-12-24?23:00??D3D11紋理基礎\Common\GeometryGens.cpp
?????文件????????1529??2012-12-23?03:08??D3D11紋理基礎\Common\GeometryGens.h
?????文件????????1148??2012-12-24?23:57??D3D11紋理基礎\Common\Lights.h
?????文件????????2458??2012-12-13?22:20??D3D11紋理基礎\Common\Timer.cpp
?????文件?????????908??2012-12-13?21:41??D3D11紋理基礎\Common\Timer.h
?????文件???????11395??2012-12-23?07:32??D3D11紋理基礎\Common\WinApp.cpp
?????文件????????2337??2012-12-23?07:36??D3D11紋理基礎\Common\WinApp.h
?????目錄???????????0??2012-12-26?08:03??D3D11紋理基礎\FX\
?????文件????????2100??2012-12-26?08:00??D3D11紋理基礎\FX\Basic.fx
?????文件?????????575??2012-12-23?08:29??D3D11紋理基礎\FX\BasicColor.fx
?????文件???????37159??2012-12-24?23:36??D3D11紋理基礎\FX\BasicLight.cod
?????文件???????14603??2012-12-24?23:37??D3D11紋理基礎\FX\BasicLight.fxo
?????文件???????21214??2012-12-26?00:56??D3D11紋理基礎\FX\BasicTex.cod
?????文件????????1990??2012-12-26?07:57??D3D11紋理基礎\FX\BasicTex.fx
?????文件??????113889??2012-12-26?00:56??D3D11紋理基礎\FX\BasicTex.fxo
?????文件????????4587??2012-12-26?08:01??D3D11紋理基礎\FX\Light.fx
?????文件???????10374??2012-12-26?07:50??D3D11紋理基礎\Main.cpp
?????文件?????????880??2012-12-25?19:39??D3D11紋理基礎\Texture.sln
?????文件????????6402??2012-12-26?08:14??D3D11紋理基礎\Texture.vcxproj
?????文件????????2421??2012-12-26?08:14??D3D11紋理基礎\Texture.vcxproj.filters
?????文件??????269312??2012-12-26?07:52??D3D11紋理基礎\TextureDemo.exe
?????目錄???????????0??2012-12-26?08:03??D3D11紋理基礎\texture\
?????文件??????349680??2007-11-23?18:14??D3D11紋理基礎\texture\Wood.dds
?????文件?????????551??2012-12-26?08:15??D3D11紋理基礎\操作說明.txt

評論

共有 條評論