draw light positions again
This commit is contained in:
parent
8d438ed178
commit
48b1c3b8d4
6
Makefile
6
Makefile
@ -4,12 +4,13 @@ all: $(BUILD_TYPE)/d3d10.exe
|
|||||||
$(BUILD_TYPE)/d3d10.exe
|
$(BUILD_TYPE)/d3d10.exe
|
||||||
|
|
||||||
%.fxo: %.fx
|
%.fxo: %.fx
|
||||||
fxc /Od /Zi /T fx_4_0 /nologo /Fo $@ $<
|
fxc.exe @"shader_$(BUILD_TYPE).rsp" /T fx_4_0 /nologo /Fo $@ $<
|
||||||
|
|
||||||
SHADERS = \
|
SHADERS = \
|
||||||
main.fxo \
|
main.fxo \
|
||||||
font.fxo \
|
font.fxo \
|
||||||
bloom.fxo
|
bloom.fxo \
|
||||||
|
static.fxo
|
||||||
|
|
||||||
$(BUILD_TYPE)/%.res: %.rc $(SHADERS)
|
$(BUILD_TYPE)/%.res: %.rc $(SHADERS)
|
||||||
rc.exe /d "_UNICODE" /d "UNICODE" /fo $@ $<
|
rc.exe /d "_UNICODE" /d "UNICODE" /fo $@ $<
|
||||||
@ -19,6 +20,7 @@ $(BUILD_TYPE)/%.obj: src/%.cpp
|
|||||||
|
|
||||||
OBJS = \
|
OBJS = \
|
||||||
$(BUILD_TYPE)/robot_player.obj \
|
$(BUILD_TYPE)/robot_player.obj \
|
||||||
|
$(BUILD_TYPE)/cube.obj \
|
||||||
$(BUILD_TYPE)/main.obj \
|
$(BUILD_TYPE)/main.obj \
|
||||||
$(BUILD_TYPE)/print.obj \
|
$(BUILD_TYPE)/print.obj \
|
||||||
$(BUILD_TYPE)/render_state.obj \
|
$(BUILD_TYPE)/render_state.obj \
|
||||||
|
|||||||
29
include/cube.hpp
Normal file
29
include/cube.hpp
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
#ifndef _CUBE_HPP_
|
||||||
|
#define _CUBE_HPP_
|
||||||
|
namespace cube {
|
||||||
|
extern const D3DXVECTOR3 accessor_0[];
|
||||||
|
const int accessor_0__length = 24;
|
||||||
|
|
||||||
|
const int accessor_0__size = (sizeof (D3DXVECTOR3)) * 24;
|
||||||
|
|
||||||
|
extern const D3DXVECTOR3 accessor_1[];
|
||||||
|
const int accessor_1__length = 24;
|
||||||
|
|
||||||
|
const int accessor_1__size = (sizeof (D3DXVECTOR3)) * 24;
|
||||||
|
|
||||||
|
extern const D3DXVECTOR2 accessor_2[];
|
||||||
|
const int accessor_2__length = 24;
|
||||||
|
|
||||||
|
const int accessor_2__size = (sizeof (D3DXVECTOR2)) * 24;
|
||||||
|
|
||||||
|
extern const DWORD accessor_3[];
|
||||||
|
const int accessor_3__length = 36;
|
||||||
|
|
||||||
|
const int accessor_3__size = (sizeof (DWORD)) * 36;
|
||||||
|
|
||||||
|
extern const Node node_0;
|
||||||
|
extern const Node * nodes[];
|
||||||
|
const int nodes__length = 1;
|
||||||
|
|
||||||
|
}
|
||||||
|
#endif
|
||||||
9
main.fx
9
main.fx
@ -6,7 +6,6 @@ matrix mJoint[39];
|
|||||||
|
|
||||||
float4 vLightDir[2];
|
float4 vLightDir[2];
|
||||||
float4 vLightColor[2];
|
float4 vLightColor[2];
|
||||||
float4 vOutputColor;
|
|
||||||
|
|
||||||
Texture2D txDiffuse;
|
Texture2D txDiffuse;
|
||||||
SamplerState samLinear {
|
SamplerState samLinear {
|
||||||
@ -35,7 +34,7 @@ struct PS_INPUT
|
|||||||
|
|
||||||
PS_INPUT VS(VS_INPUT input)
|
PS_INPUT VS(VS_INPUT input)
|
||||||
{
|
{
|
||||||
PS_INPUT output = (PS_INPUT)0;
|
PS_INPUT output;
|
||||||
|
|
||||||
matrix mSkin
|
matrix mSkin
|
||||||
= input.Weight.x * mJoint[int(input.Joint.x)]
|
= input.Weight.x * mJoint[int(input.Joint.x)]
|
||||||
@ -63,7 +62,7 @@ float4 PS(PS_INPUT input) : SV_Target
|
|||||||
{
|
{
|
||||||
float4 texColor = txDiffuse.Sample(samLinear, input.Tex);
|
float4 texColor = txDiffuse.Sample(samLinear, input.Tex);
|
||||||
|
|
||||||
float4 intensityColor = float4(0.2, 0.2, 0.2, 0.0);
|
float4 intensityColor = float4(0.1, 0.1, 0.1, 0.1);
|
||||||
for (int i = 0; i < 2; i++) {
|
for (int i = 0; i < 2; i++) {
|
||||||
intensityColor += saturate(dot((float3)vLightDir[i], input.Normal) * vLightColor[i]);
|
intensityColor += saturate(dot((float3)vLightDir[i], input.Normal) * vLightColor[i]);
|
||||||
}
|
}
|
||||||
@ -72,7 +71,7 @@ float4 PS(PS_INPUT input) : SV_Target
|
|||||||
return texColor * intensityColor;
|
return texColor * intensityColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
BlendState Blending
|
BlendState DisableBlending
|
||||||
{
|
{
|
||||||
BlendEnable[0] = FALSE;
|
BlendEnable[0] = FALSE;
|
||||||
};
|
};
|
||||||
@ -90,7 +89,7 @@ technique10 Render
|
|||||||
SetVertexShader(CompileShader(vs_4_0, VS()));
|
SetVertexShader(CompileShader(vs_4_0, VS()));
|
||||||
SetGeometryShader(NULL);
|
SetGeometryShader(NULL);
|
||||||
SetPixelShader(CompileShader(ps_4_0, PS()));
|
SetPixelShader(CompileShader(ps_4_0, PS()));
|
||||||
SetBlendState(Blending, float4(0.0, 0.0, 0.0, 0.0), 0xffffffff);
|
SetBlendState(DisableBlending, float4(0.0, 0.0, 0.0, 0.0), 0xffffffff);
|
||||||
SetDepthStencilState(EnableDepth, 0);
|
SetDepthStencilState(EnableDepth, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
3
main.rc
3
main.rc
@ -1,5 +1,6 @@
|
|||||||
RES_MAIN_FXO RCDATA "main.fxo"
|
RES_MAIN_FXO RCDATA "main.fxo"
|
||||||
RES_FONT_FXO RCDATA "font.fxo"
|
RES_FONT_FXO RCDATA "font.fxo"
|
||||||
RES_BLOOM_FXO RCDATA "bloom.fxo"
|
RES_BLOOM_FXO RCDATA "bloom.fxo"
|
||||||
RES_ROBOT_PLAYER RCDATA "robot_player.data"
|
RES_STATIC_FXO RCDATA "static.fxo"
|
||||||
|
RES_ROBOT_PLAYER RCDATA "models/robot_player/robot_player.data"
|
||||||
RES_FONT_TERMINUS_6X12 RCDATA "font/terminus_128x64_6x12.data"
|
RES_FONT_TERMINUS_6X12 RCDATA "font/terminus_128x64_6x12.data"
|
||||||
BIN
models/cube/cube.glb
Normal file
BIN
models/cube/cube.glb
Normal file
Binary file not shown.
2
shader_debug.rsp
Normal file
2
shader_debug.rsp
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
/Od
|
||||||
|
/Zi
|
||||||
0
shader_release.rsp
Normal file
0
shader_release.rsp
Normal file
153
src/cube.cpp
Normal file
153
src/cube.cpp
Normal file
@ -0,0 +1,153 @@
|
|||||||
|
#include <d3dx10.h>
|
||||||
|
#include "gltf.hpp"
|
||||||
|
#include "cube.hpp"
|
||||||
|
namespace cube {
|
||||||
|
const D3DXVECTOR3 accessor_0[] = {
|
||||||
|
D3DXVECTOR3(-1.0000000f, -1.0000000f, 1.0000000f),
|
||||||
|
D3DXVECTOR3(-1.0000000f, -1.0000000f, 1.0000000f),
|
||||||
|
D3DXVECTOR3(-1.0000000f, -1.0000000f, 1.0000000f),
|
||||||
|
D3DXVECTOR3(-1.0000000f, 1.0000000f, 1.0000000f),
|
||||||
|
D3DXVECTOR3(-1.0000000f, 1.0000000f, 1.0000000f),
|
||||||
|
D3DXVECTOR3(-1.0000000f, 1.0000000f, 1.0000000f),
|
||||||
|
D3DXVECTOR3(-1.0000000f, -1.0000000f, -1.0000000f),
|
||||||
|
D3DXVECTOR3(-1.0000000f, -1.0000000f, -1.0000000f),
|
||||||
|
D3DXVECTOR3(-1.0000000f, -1.0000000f, -1.0000000f),
|
||||||
|
D3DXVECTOR3(-1.0000000f, 1.0000000f, -1.0000000f),
|
||||||
|
D3DXVECTOR3(-1.0000000f, 1.0000000f, -1.0000000f),
|
||||||
|
D3DXVECTOR3(-1.0000000f, 1.0000000f, -1.0000000f),
|
||||||
|
D3DXVECTOR3( 1.0000000f, -1.0000000f, 1.0000000f),
|
||||||
|
D3DXVECTOR3( 1.0000000f, -1.0000000f, 1.0000000f),
|
||||||
|
D3DXVECTOR3( 1.0000000f, -1.0000000f, 1.0000000f),
|
||||||
|
D3DXVECTOR3( 1.0000000f, 1.0000000f, 1.0000000f),
|
||||||
|
D3DXVECTOR3( 1.0000000f, 1.0000000f, 1.0000000f),
|
||||||
|
D3DXVECTOR3( 1.0000000f, 1.0000000f, 1.0000000f),
|
||||||
|
D3DXVECTOR3( 1.0000000f, -1.0000000f, -1.0000000f),
|
||||||
|
D3DXVECTOR3( 1.0000000f, -1.0000000f, -1.0000000f),
|
||||||
|
D3DXVECTOR3( 1.0000000f, -1.0000000f, -1.0000000f),
|
||||||
|
D3DXVECTOR3( 1.0000000f, 1.0000000f, -1.0000000f),
|
||||||
|
D3DXVECTOR3( 1.0000000f, 1.0000000f, -1.0000000f),
|
||||||
|
D3DXVECTOR3( 1.0000000f, 1.0000000f, -1.0000000f),
|
||||||
|
};
|
||||||
|
|
||||||
|
const D3DXVECTOR3 accessor_1[] = {
|
||||||
|
D3DXVECTOR3( 0.0000000f, 0.0000000f, 1.0000000f),
|
||||||
|
D3DXVECTOR3( 0.0000000f, -1.0000000f, 0.0000000f),
|
||||||
|
D3DXVECTOR3(-1.0000000f, 0.0000000f, 0.0000000f),
|
||||||
|
D3DXVECTOR3( 0.0000000f, 0.0000000f, 1.0000000f),
|
||||||
|
D3DXVECTOR3( 0.0000000f, 1.0000000f, 0.0000000f),
|
||||||
|
D3DXVECTOR3(-1.0000000f, 0.0000000f, 0.0000000f),
|
||||||
|
D3DXVECTOR3( 0.0000000f, 0.0000000f, -1.0000000f),
|
||||||
|
D3DXVECTOR3( 0.0000000f, -1.0000000f, 0.0000000f),
|
||||||
|
D3DXVECTOR3(-1.0000000f, 0.0000000f, 0.0000000f),
|
||||||
|
D3DXVECTOR3( 0.0000000f, 0.0000000f, -1.0000000f),
|
||||||
|
D3DXVECTOR3( 0.0000000f, 1.0000000f, 0.0000000f),
|
||||||
|
D3DXVECTOR3(-1.0000000f, 0.0000000f, 0.0000000f),
|
||||||
|
D3DXVECTOR3( 0.0000000f, 0.0000000f, 1.0000000f),
|
||||||
|
D3DXVECTOR3( 0.0000000f, -1.0000000f, 0.0000000f),
|
||||||
|
D3DXVECTOR3( 1.0000000f, 0.0000000f, 0.0000000f),
|
||||||
|
D3DXVECTOR3( 0.0000000f, 0.0000000f, 1.0000000f),
|
||||||
|
D3DXVECTOR3( 0.0000000f, 1.0000000f, 0.0000000f),
|
||||||
|
D3DXVECTOR3( 1.0000000f, 0.0000000f, 0.0000000f),
|
||||||
|
D3DXVECTOR3( 0.0000000f, 0.0000000f, -1.0000000f),
|
||||||
|
D3DXVECTOR3( 0.0000000f, -1.0000000f, 0.0000000f),
|
||||||
|
D3DXVECTOR3( 1.0000000f, 0.0000000f, 0.0000000f),
|
||||||
|
D3DXVECTOR3( 0.0000000f, 0.0000000f, -1.0000000f),
|
||||||
|
D3DXVECTOR3( 0.0000000f, 1.0000000f, 0.0000000f),
|
||||||
|
D3DXVECTOR3( 1.0000000f, 0.0000000f, 0.0000000f),
|
||||||
|
};
|
||||||
|
|
||||||
|
const D3DXVECTOR2 accessor_2[] = {
|
||||||
|
D3DXVECTOR2( 0.3750000f, 0.0000000f),
|
||||||
|
D3DXVECTOR2( 0.1250000f, 0.2500000f),
|
||||||
|
D3DXVECTOR2( 0.3750000f, 1.0000000f),
|
||||||
|
D3DXVECTOR2( 0.6250000f, 0.0000000f),
|
||||||
|
D3DXVECTOR2( 0.8750000f, 0.2500000f),
|
||||||
|
D3DXVECTOR2( 0.6250000f, 1.0000000f),
|
||||||
|
D3DXVECTOR2( 0.3750000f, 0.7500000f),
|
||||||
|
D3DXVECTOR2( 0.1250000f, 0.5000000f),
|
||||||
|
D3DXVECTOR2( 0.3750000f, 0.7500000f),
|
||||||
|
D3DXVECTOR2( 0.6250000f, 0.7500000f),
|
||||||
|
D3DXVECTOR2( 0.8750000f, 0.5000000f),
|
||||||
|
D3DXVECTOR2( 0.6250000f, 0.7500000f),
|
||||||
|
D3DXVECTOR2( 0.3750000f, 0.2500000f),
|
||||||
|
D3DXVECTOR2( 0.3750000f, 0.2500000f),
|
||||||
|
D3DXVECTOR2( 0.3750000f, 0.2500000f),
|
||||||
|
D3DXVECTOR2( 0.6250000f, 0.2500000f),
|
||||||
|
D3DXVECTOR2( 0.6250000f, 0.2500000f),
|
||||||
|
D3DXVECTOR2( 0.6250000f, 0.2500000f),
|
||||||
|
D3DXVECTOR2( 0.3750000f, 0.5000000f),
|
||||||
|
D3DXVECTOR2( 0.3750000f, 0.5000000f),
|
||||||
|
D3DXVECTOR2( 0.3750000f, 0.5000000f),
|
||||||
|
D3DXVECTOR2( 0.6250000f, 0.5000000f),
|
||||||
|
D3DXVECTOR2( 0.6250000f, 0.5000000f),
|
||||||
|
D3DXVECTOR2( 0.6250000f, 0.5000000f),
|
||||||
|
};
|
||||||
|
|
||||||
|
const DWORD accessor_3[] = {
|
||||||
|
2,
|
||||||
|
5,
|
||||||
|
11,
|
||||||
|
2,
|
||||||
|
11,
|
||||||
|
8,
|
||||||
|
6,
|
||||||
|
9,
|
||||||
|
21,
|
||||||
|
6,
|
||||||
|
21,
|
||||||
|
18,
|
||||||
|
20,
|
||||||
|
23,
|
||||||
|
17,
|
||||||
|
20,
|
||||||
|
17,
|
||||||
|
14,
|
||||||
|
12,
|
||||||
|
15,
|
||||||
|
3,
|
||||||
|
12,
|
||||||
|
3,
|
||||||
|
0,
|
||||||
|
7,
|
||||||
|
19,
|
||||||
|
13,
|
||||||
|
7,
|
||||||
|
13,
|
||||||
|
1,
|
||||||
|
22,
|
||||||
|
10,
|
||||||
|
4,
|
||||||
|
22,
|
||||||
|
4,
|
||||||
|
16,
|
||||||
|
};
|
||||||
|
|
||||||
|
const Mesh mesh_0 = {
|
||||||
|
accessor_0, // position
|
||||||
|
accessor_0__size,
|
||||||
|
accessor_1, // normal
|
||||||
|
accessor_1__size,
|
||||||
|
accessor_2, // texcoord_0
|
||||||
|
accessor_2__size,
|
||||||
|
NULL, // weights_0
|
||||||
|
0,
|
||||||
|
NULL, // joints_0
|
||||||
|
0,
|
||||||
|
accessor_3, // indices
|
||||||
|
accessor_3__size,
|
||||||
|
};
|
||||||
|
|
||||||
|
const Node node_0 = {
|
||||||
|
-1, // parent_ix
|
||||||
|
NULL, // skin
|
||||||
|
&mesh_0, // mesh
|
||||||
|
D3DXVECTOR3( 0.0000000f, 0.0000000f, 0.0000000f), // translation
|
||||||
|
D3DXVECTOR4( 0.0000000f, 0.0000000f, 0.0000000f, 1.0000000f), // rotation
|
||||||
|
D3DXVECTOR3( 1.0000000f, 1.0000000f, 1.0000000f), // scale
|
||||||
|
};
|
||||||
|
|
||||||
|
const Node * nodes[] = {
|
||||||
|
&node_0,
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
280
src/main.cpp
280
src/main.cpp
@ -12,6 +12,7 @@
|
|||||||
|
|
||||||
#include "robot_player.hpp"
|
#include "robot_player.hpp"
|
||||||
#define ROOT_MESH_NODE node_39
|
#define ROOT_MESH_NODE node_39
|
||||||
|
#include "cube.hpp"
|
||||||
|
|
||||||
HINSTANCE g_hInstance = NULL;
|
HINSTANCE g_hInstance = NULL;
|
||||||
HWND g_hWnd = NULL;
|
HWND g_hWnd = NULL;
|
||||||
@ -25,7 +26,6 @@ ID3D10DepthStencilView * g_pDepthStencilView = NULL;
|
|||||||
|
|
||||||
ID3D10Effect * g_pEffect = NULL;
|
ID3D10Effect * g_pEffect = NULL;
|
||||||
ID3D10EffectTechnique * g_pTechniqueRender = NULL;
|
ID3D10EffectTechnique * g_pTechniqueRender = NULL;
|
||||||
ID3D10EffectTechnique * g_pTechniqueRenderLight = NULL;
|
|
||||||
ID3D10InputLayout * g_pVertexLayout = NULL;
|
ID3D10InputLayout * g_pVertexLayout = NULL;
|
||||||
ID3D10Buffer * g_pIndexBuffer = NULL;
|
ID3D10Buffer * g_pIndexBuffer = NULL;
|
||||||
const DWORD g_dwVertexBufferCount = 5;
|
const DWORD g_dwVertexBufferCount = 5;
|
||||||
@ -38,7 +38,6 @@ ID3D10EffectMatrixVariable * g_pProjectionVariable = NULL;
|
|||||||
ID3D10EffectMatrixVariable * g_pJointVariable = NULL;
|
ID3D10EffectMatrixVariable * g_pJointVariable = NULL;
|
||||||
ID3D10EffectVectorVariable * g_pLightDirVariable = NULL;
|
ID3D10EffectVectorVariable * g_pLightDirVariable = NULL;
|
||||||
ID3D10EffectVectorVariable * g_pLightColorVariable = NULL;
|
ID3D10EffectVectorVariable * g_pLightColorVariable = NULL;
|
||||||
ID3D10EffectVectorVariable * g_pOutputColorVariable = NULL;
|
|
||||||
ID3D10EffectShaderResourceVariable * g_pDiffuseVariable = NULL;
|
ID3D10EffectShaderResourceVariable * g_pDiffuseVariable = NULL;
|
||||||
D3DXMATRIX g_World1;
|
D3DXMATRIX g_World1;
|
||||||
D3DXMATRIX g_World2;
|
D3DXMATRIX g_World2;
|
||||||
@ -61,7 +60,6 @@ ID3D10EffectVectorVariable * g_pDirVariableBloom = NULL;
|
|||||||
typedef D3DXVECTOR2 BloomVertex;
|
typedef D3DXVECTOR2 BloomVertex;
|
||||||
|
|
||||||
// font
|
// font
|
||||||
|
|
||||||
ID3D10Effect * g_pEffectFont = NULL;
|
ID3D10Effect * g_pEffectFont = NULL;
|
||||||
ID3D10EffectTechnique * g_pTechniqueFont = NULL;
|
ID3D10EffectTechnique * g_pTechniqueFont = NULL;
|
||||||
ID3D10InputLayout * g_pVertexLayoutFont = NULL;
|
ID3D10InputLayout * g_pVertexLayoutFont = NULL;
|
||||||
@ -76,6 +74,28 @@ ID3D10EffectShaderResourceVariable * g_pDiffuseVariableFont = NULL;
|
|||||||
const int g_iFontBufferLength = 512;
|
const int g_iFontBufferLength = 512;
|
||||||
typedef D3DXVECTOR4 FontVertex;
|
typedef D3DXVECTOR4 FontVertex;
|
||||||
|
|
||||||
|
// static
|
||||||
|
ID3D10Effect * g_pEffectStatic = NULL;
|
||||||
|
ID3D10EffectTechnique * g_pTechniqueStatic = NULL;
|
||||||
|
ID3D10InputLayout * g_pVertexLayoutStatic = NULL;
|
||||||
|
|
||||||
|
ID3D10EffectMatrixVariable * g_pWorldVariableStatic = NULL;
|
||||||
|
ID3D10EffectMatrixVariable * g_pViewVariableStatic = NULL;
|
||||||
|
ID3D10EffectMatrixVariable * g_pProjectionVariableStatic = NULL;
|
||||||
|
ID3D10EffectVectorVariable * g_pOutputColorVariableStatic = NULL;
|
||||||
|
|
||||||
|
// cube
|
||||||
|
const DWORD g_dwVertexBufferCountCube = 3;
|
||||||
|
ID3D10Buffer * g_pVertexBufferCube[g_dwVertexBufferCountCube];
|
||||||
|
ID3D10Buffer * g_pIndexBufferCube = NULL;
|
||||||
|
|
||||||
|
// lights
|
||||||
|
D3DXVECTOR4 g_vLightDirs[2];
|
||||||
|
D3DXVECTOR4 g_vLightColors[2] = {
|
||||||
|
D3DXVECTOR4(0.0f, 0.9f, 0.9f, 1.0f),
|
||||||
|
D3DXVECTOR4(0.9f, 0.0f, 0.0f, 1.0f)
|
||||||
|
};
|
||||||
|
|
||||||
// forward declarations
|
// forward declarations
|
||||||
|
|
||||||
HRESULT InitWindow(HINSTANCE hInstance, int nCmdShow);
|
HRESULT InitWindow(HINSTANCE hInstance, int nCmdShow);
|
||||||
@ -562,6 +582,140 @@ HRESULT InitBloomBuffers()
|
|||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HRESULT InitStaticEffect()
|
||||||
|
{
|
||||||
|
HRESULT hr;
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
// effect
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
HRSRC hRes = FindResource(NULL, L"RES_STATIC_FXO", RT_RCDATA);
|
||||||
|
if (hRes == NULL) {
|
||||||
|
print("FindResource RES_STATIC_FXO\n");
|
||||||
|
return E_FAIL;
|
||||||
|
}
|
||||||
|
DWORD dwResSize = SizeofResource(NULL, hRes);
|
||||||
|
HGLOBAL hData = LoadResource(NULL, hRes);
|
||||||
|
void * pData = LockResource(hData);
|
||||||
|
hr = D3D10CreateEffectFromMemory(pData,
|
||||||
|
dwResSize,
|
||||||
|
0,
|
||||||
|
g_pd3dDevice,
|
||||||
|
NULL,
|
||||||
|
&g_pEffectStatic
|
||||||
|
);
|
||||||
|
if (FAILED(hr)) {
|
||||||
|
print("D3D10CreateEffectFromMemory\n");
|
||||||
|
return hr;
|
||||||
|
}
|
||||||
|
|
||||||
|
g_pTechniqueStatic = g_pEffectStatic->GetTechniqueByName("Static");
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
// layout
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
D3D10_INPUT_ELEMENT_DESC layout[] = {
|
||||||
|
{"POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0 , D3D10_INPUT_PER_VERTEX_DATA, 0},
|
||||||
|
{"NORMAL", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0 , D3D10_INPUT_PER_VERTEX_DATA, 0},
|
||||||
|
{"TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 0 , D3D10_INPUT_PER_VERTEX_DATA, 0},
|
||||||
|
};
|
||||||
|
UINT numElements = (sizeof (layout)) / (sizeof (layout[0]));
|
||||||
|
|
||||||
|
D3D10_PASS_DESC passDesc;
|
||||||
|
g_pTechniqueStatic->GetPassByIndex(0)->GetDesc(&passDesc);
|
||||||
|
|
||||||
|
hr = g_pd3dDevice->CreateInputLayout(layout, numElements,
|
||||||
|
passDesc.pIAInputSignature,
|
||||||
|
passDesc.IAInputSignatureSize,
|
||||||
|
&g_pVertexLayoutStatic);
|
||||||
|
if (FAILED(hr)) {
|
||||||
|
print("CreateInputLayout\n");
|
||||||
|
return hr;
|
||||||
|
}
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
// variables
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
g_pWorldVariableStatic = g_pEffectStatic->GetVariableByName("World")->AsMatrix();
|
||||||
|
g_pViewVariableStatic = g_pEffectStatic->GetVariableByName("View")->AsMatrix();
|
||||||
|
g_pProjectionVariableStatic = g_pEffectStatic->GetVariableByName("Projection")->AsMatrix();
|
||||||
|
g_pOutputColorVariableStatic = g_pEffectStatic->GetVariableByName("vOutputColor")->AsVector();
|
||||||
|
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
HRESULT LoadMeshStatic(const Mesh * mesh)
|
||||||
|
{
|
||||||
|
HRESULT hr;
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
// vertex buffers
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
D3D10_BUFFER_DESC bd;
|
||||||
|
D3D10_SUBRESOURCE_DATA initData;
|
||||||
|
|
||||||
|
// position
|
||||||
|
bd.Usage = D3D10_USAGE_IMMUTABLE;
|
||||||
|
bd.ByteWidth = mesh->position_size;
|
||||||
|
bd.BindFlags = D3D10_BIND_VERTEX_BUFFER;
|
||||||
|
bd.CPUAccessFlags = 0;
|
||||||
|
bd.MiscFlags = 0;
|
||||||
|
initData.pSysMem = mesh->position;
|
||||||
|
hr = g_pd3dDevice->CreateBuffer(&bd, &initData, &g_pVertexBufferCube[0]);
|
||||||
|
if (FAILED(hr)) {
|
||||||
|
print("CreateBuffer\n");
|
||||||
|
return hr;
|
||||||
|
}
|
||||||
|
|
||||||
|
// normals
|
||||||
|
bd.Usage = D3D10_USAGE_IMMUTABLE;
|
||||||
|
bd.ByteWidth = mesh->normal_size;
|
||||||
|
bd.BindFlags = D3D10_BIND_VERTEX_BUFFER;
|
||||||
|
bd.CPUAccessFlags = 0;
|
||||||
|
bd.MiscFlags = 0;
|
||||||
|
initData.pSysMem = mesh->normal;
|
||||||
|
hr = g_pd3dDevice->CreateBuffer(&bd, &initData, &g_pVertexBufferCube[1]);
|
||||||
|
if (FAILED(hr)) {
|
||||||
|
print("CreateBuffer\n");
|
||||||
|
return hr;
|
||||||
|
}
|
||||||
|
|
||||||
|
// texcoords
|
||||||
|
bd.Usage = D3D10_USAGE_IMMUTABLE;
|
||||||
|
bd.ByteWidth = mesh->texcoord_0_size;
|
||||||
|
bd.BindFlags = D3D10_BIND_VERTEX_BUFFER;
|
||||||
|
bd.CPUAccessFlags = 0;
|
||||||
|
bd.MiscFlags = 0;
|
||||||
|
initData.pSysMem = mesh->texcoord_0;
|
||||||
|
hr = g_pd3dDevice->CreateBuffer(&bd, &initData, &g_pVertexBufferCube[2]);
|
||||||
|
if (FAILED(hr)) {
|
||||||
|
print("CreateBuffer\n");
|
||||||
|
return hr;
|
||||||
|
}
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
// index buffer
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
bd.Usage = D3D10_USAGE_IMMUTABLE;
|
||||||
|
bd.ByteWidth = mesh->indices_size;
|
||||||
|
bd.BindFlags = D3D10_BIND_INDEX_BUFFER;
|
||||||
|
bd.CPUAccessFlags = 0;
|
||||||
|
bd.MiscFlags = 0;
|
||||||
|
initData.pSysMem = mesh->indices;
|
||||||
|
hr = g_pd3dDevice->CreateBuffer(&bd, &initData, &g_pIndexBufferCube);
|
||||||
|
if (FAILED(hr)) {
|
||||||
|
print("CreateBuffer\n");
|
||||||
|
return hr;
|
||||||
|
}
|
||||||
|
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
HRESULT InitDirect3DDevice()
|
HRESULT InitDirect3DDevice()
|
||||||
{
|
{
|
||||||
RECT rc;
|
RECT rc;
|
||||||
@ -614,8 +768,11 @@ HRESULT InitDirect3DDevice()
|
|||||||
|
|
||||||
D3D10_RASTERIZER_DESC RSDesc;
|
D3D10_RASTERIZER_DESC RSDesc;
|
||||||
RSDesc.FillMode = D3D10_FILL_SOLID;
|
RSDesc.FillMode = D3D10_FILL_SOLID;
|
||||||
|
#ifdef _DEBUG
|
||||||
RSDesc.CullMode = D3D10_CULL_BACK;
|
RSDesc.CullMode = D3D10_CULL_BACK;
|
||||||
//RSDesc.CullMode = D3D10_CULL_NONE;
|
#else
|
||||||
|
RSDesc.CullMode = D3D10_CULL_NONE;
|
||||||
|
#endif
|
||||||
RSDesc.FrontCounterClockwise = FALSE;
|
RSDesc.FrontCounterClockwise = FALSE;
|
||||||
RSDesc.DepthBias = 0;
|
RSDesc.DepthBias = 0;
|
||||||
RSDesc.SlopeScaledDepthBias = 0.0f;
|
RSDesc.SlopeScaledDepthBias = 0.0f;
|
||||||
@ -663,7 +820,6 @@ HRESULT InitDirect3DDevice()
|
|||||||
}
|
}
|
||||||
|
|
||||||
g_pTechniqueRender = g_pEffect->GetTechniqueByName("Render");
|
g_pTechniqueRender = g_pEffect->GetTechniqueByName("Render");
|
||||||
g_pTechniqueRenderLight = g_pEffect->GetTechniqueByName("RenderLight");
|
|
||||||
|
|
||||||
// variables
|
// variables
|
||||||
g_pWorldVariable = g_pEffect->GetVariableByName("World")->AsMatrix();
|
g_pWorldVariable = g_pEffect->GetVariableByName("World")->AsMatrix();
|
||||||
@ -672,7 +828,6 @@ HRESULT InitDirect3DDevice()
|
|||||||
g_pJointVariable = g_pEffect->GetVariableByName("mJoint")->AsMatrix();
|
g_pJointVariable = g_pEffect->GetVariableByName("mJoint")->AsMatrix();
|
||||||
g_pLightDirVariable = g_pEffect->GetVariableByName("vLightDir")->AsVector();
|
g_pLightDirVariable = g_pEffect->GetVariableByName("vLightDir")->AsVector();
|
||||||
g_pLightColorVariable = g_pEffect->GetVariableByName("vLightColor")->AsVector();
|
g_pLightColorVariable = g_pEffect->GetVariableByName("vLightColor")->AsVector();
|
||||||
g_pOutputColorVariable = g_pEffect->GetVariableByName("vOutputColor")->AsVector();
|
|
||||||
g_pDiffuseVariable = g_pEffect->GetVariableByName("txDiffuse")->AsShaderResource();
|
g_pDiffuseVariable = g_pEffect->GetVariableByName("txDiffuse")->AsShaderResource();
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
@ -722,6 +877,18 @@ HRESULT InitDirect3DDevice()
|
|||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hr = InitStaticEffect();
|
||||||
|
if (FAILED(hr)) {
|
||||||
|
print("InitStaticEffect\n");
|
||||||
|
return hr;
|
||||||
|
}
|
||||||
|
|
||||||
|
hr = LoadMeshStatic(cube::node_0.mesh);
|
||||||
|
if (FAILED(hr)) {
|
||||||
|
print("LoadMeshStatic\n");
|
||||||
|
return hr;
|
||||||
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
// transform matrices
|
// transform matrices
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
@ -729,7 +896,7 @@ HRESULT InitDirect3DDevice()
|
|||||||
D3DXMatrixIdentity(&g_World1);
|
D3DXMatrixIdentity(&g_World1);
|
||||||
D3DXMatrixIdentity(&g_World2);
|
D3DXMatrixIdentity(&g_World2);
|
||||||
|
|
||||||
D3DXVECTOR3 Eye(0.0f, 1.0f, -1.5f);
|
D3DXVECTOR3 Eye(0.0f, 1.0f, -2.0f);
|
||||||
D3DXVECTOR3 At(0.0f, 1.0f, 0.0f);
|
D3DXVECTOR3 At(0.0f, 1.0f, 0.0f);
|
||||||
D3DXVECTOR3 Up(0.0f, 1.0f, 0.0f);
|
D3DXVECTOR3 Up(0.0f, 1.0f, 0.0f);
|
||||||
D3DXMatrixLookAtLH(&g_View, &Eye, &At, &Up);
|
D3DXMatrixLookAtLH(&g_View, &Eye, &At, &Up);
|
||||||
@ -869,7 +1036,7 @@ void Animate(float t)
|
|||||||
const AnimationChannel * channels = animation_1__channels;
|
const AnimationChannel * channels = animation_1__channels;
|
||||||
const int channels_length = animation_1__channels__length;
|
const int channels_length = animation_1__channels__length;
|
||||||
|
|
||||||
t = loop(t, 4.166666030883789);
|
t = loop(t, 3.75);
|
||||||
|
|
||||||
// sample all channels
|
// sample all channels
|
||||||
for (int i = 0; i < channels_length; i++) {
|
for (int i = 0; i < channels_length; i++) {
|
||||||
@ -934,8 +1101,6 @@ void RenderModel(float t)
|
|||||||
}
|
}
|
||||||
Animate(t);
|
Animate(t);
|
||||||
|
|
||||||
// first cube
|
|
||||||
|
|
||||||
D3DXMATRIX rx;
|
D3DXMATRIX rx;
|
||||||
D3DXMATRIX ry;
|
D3DXMATRIX ry;
|
||||||
D3DXMatrixRotationY(&ry, (float)D3DX_PI * -1.0f + t);
|
D3DXMatrixRotationY(&ry, (float)D3DX_PI * -1.0f + t);
|
||||||
@ -944,25 +1109,6 @@ void RenderModel(float t)
|
|||||||
&rx,
|
&rx,
|
||||||
&ry);
|
&ry);
|
||||||
|
|
||||||
// lights
|
|
||||||
D3DXVECTOR4 vLightDirs[2] = {
|
|
||||||
D3DXVECTOR4(-0.577f, 0.577f, -0.577f, 1.0f),
|
|
||||||
D3DXVECTOR4(0.0f, 0.0f, -1.0f, 1.0f),
|
|
||||||
};
|
|
||||||
D3DXVECTOR4 vLightColors[2] = {
|
|
||||||
D3DXVECTOR4(0.0f, 0.5f, 0.5f, 1.0f),
|
|
||||||
D3DXVECTOR4(0.5f, 0.0f, 0.0f, 1.0f)
|
|
||||||
};
|
|
||||||
|
|
||||||
// rotate the second light around the origin
|
|
||||||
D3DXMATRIX mRotate;
|
|
||||||
D3DXVECTOR4 vOutDir;
|
|
||||||
D3DXMatrixRotationY(&mRotate, -2.0f * t);
|
|
||||||
D3DXVec3Transform(&vLightDirs[1], (D3DXVECTOR3 *)&vLightDirs[1], &mRotate);
|
|
||||||
|
|
||||||
D3DXMatrixRotationY(&mRotate, 0.4f * t);
|
|
||||||
D3DXVec3Transform(&vLightDirs[0], (D3DXVECTOR3 *)&vLightDirs[0], &mRotate);
|
|
||||||
|
|
||||||
// matrices
|
// matrices
|
||||||
g_pViewVariable->SetMatrix((float *)&g_View);
|
g_pViewVariable->SetMatrix((float *)&g_View);
|
||||||
g_pProjectionVariable->SetMatrix((float *)&g_Projection);
|
g_pProjectionVariable->SetMatrix((float *)&g_Projection);
|
||||||
@ -971,12 +1117,9 @@ void RenderModel(float t)
|
|||||||
|
|
||||||
g_pJointVariable->SetMatrixArray((float *)mJoints, 0, joints_length);
|
g_pJointVariable->SetMatrixArray((float *)mJoints, 0, joints_length);
|
||||||
|
|
||||||
// color
|
|
||||||
g_pOutputColorVariable->SetFloatVector((float *)&vLightColors[0]);
|
|
||||||
|
|
||||||
// lights
|
// lights
|
||||||
g_pLightDirVariable->SetFloatVectorArray((float *)vLightDirs, 0, 2);
|
g_pLightDirVariable->SetFloatVectorArray((float *)g_vLightDirs, 0, 2);
|
||||||
g_pLightColorVariable->SetFloatVectorArray((float *)vLightColors, 0, 2);
|
g_pLightColorVariable->SetFloatVectorArray((float *)g_vLightColors, 0, 2);
|
||||||
|
|
||||||
// render first cube
|
// render first cube
|
||||||
const Mesh * mesh = ROOT_MESH_NODE.mesh;
|
const Mesh * mesh = ROOT_MESH_NODE.mesh;
|
||||||
@ -1004,6 +1147,44 @@ void RenderModel(float t)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RenderMeshStatic(const Mesh * mesh)
|
||||||
|
{
|
||||||
|
g_pViewVariableStatic->SetMatrix((float *)&g_View);
|
||||||
|
g_pProjectionVariableStatic->SetMatrix((float *)&g_Projection);
|
||||||
|
|
||||||
|
UINT stride[] = {
|
||||||
|
(sizeof (mesh->position[0])),
|
||||||
|
(sizeof (mesh->normal[0])),
|
||||||
|
(sizeof (mesh->texcoord_0[0])),
|
||||||
|
};
|
||||||
|
UINT offset[] = { 0, 0, 0 };
|
||||||
|
g_pd3dDevice->IASetInputLayout(g_pVertexLayoutStatic);
|
||||||
|
g_pd3dDevice->IASetVertexBuffers(0, g_dwVertexBufferCountCube, g_pVertexBufferCube, stride, offset);
|
||||||
|
g_pd3dDevice->IASetIndexBuffer(g_pIndexBufferCube, DXGI_FORMAT_R32_UINT, 0);
|
||||||
|
g_pd3dDevice->IASetPrimitiveTopology(D3D10_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
|
||||||
|
|
||||||
|
D3D10_TECHNIQUE_DESC techDesc;
|
||||||
|
g_pTechniqueStatic->GetDesc(&techDesc);
|
||||||
|
int indices_length = mesh->indices_size / (sizeof (DWORD));
|
||||||
|
|
||||||
|
for (int m = 0; m < 2; m++) {
|
||||||
|
D3DXMATRIX mLight;
|
||||||
|
D3DXMATRIX mLightScale;
|
||||||
|
D3DXVECTOR3 vLightPos = g_vLightDirs[m] * (1.25f * (m + 1));
|
||||||
|
D3DXMatrixTranslation(&mLight, vLightPos.x, vLightPos.y, vLightPos.z);
|
||||||
|
D3DXMatrixScaling(&mLightScale, 0.05f, 0.05f, 0.05f);
|
||||||
|
mLight = mLightScale * mLight;
|
||||||
|
|
||||||
|
g_pWorldVariableStatic->SetMatrix((float *)&mLight);
|
||||||
|
g_pOutputColorVariableStatic->SetFloatVector((float *)&g_vLightColors[m]);
|
||||||
|
|
||||||
|
for (UINT p = 0; p < techDesc.Passes; p++) {
|
||||||
|
g_pTechniqueStatic->GetPassByIndex(p)->Apply(0);
|
||||||
|
g_pd3dDevice->DrawIndexed(indices_length, 0, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void RenderFont()
|
void RenderFont()
|
||||||
{
|
{
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
@ -1130,6 +1311,24 @@ void RenderBloom()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Update(float t)
|
||||||
|
{
|
||||||
|
D3DXVECTOR4 vLightDirs[2] = {
|
||||||
|
D3DXVECTOR4(-0.577f, 0.577f, 0.0, 1.0f),
|
||||||
|
D3DXVECTOR4(1.0f, 1.5f, 0.0f, 1.0f),
|
||||||
|
};
|
||||||
|
D3DXVec4Normalize(&vLightDirs[0], &vLightDirs[0]);
|
||||||
|
D3DXVec4Normalize(&vLightDirs[1], &vLightDirs[1]);
|
||||||
|
|
||||||
|
D3DXMATRIX mRotate;
|
||||||
|
D3DXVECTOR4 vOutDir;
|
||||||
|
D3DXMatrixRotationY(&mRotate, -1.0f * t);
|
||||||
|
D3DXVec3Transform(&g_vLightDirs[1], (D3DXVECTOR3 *)&vLightDirs[1], &mRotate);
|
||||||
|
|
||||||
|
D3DXMatrixRotationY(&mRotate, 0.4f * t);
|
||||||
|
D3DXVec3Transform(&g_vLightDirs[0], (D3DXVECTOR3 *)&vLightDirs[0], &mRotate);
|
||||||
|
}
|
||||||
|
|
||||||
void Render()
|
void Render()
|
||||||
{
|
{
|
||||||
static float t = 0.0f;
|
static float t = 0.0f;
|
||||||
@ -1143,18 +1342,23 @@ void Render()
|
|||||||
t = (dwTimeCur - dwTimeStart) / 1000.0f;
|
t = (dwTimeCur - dwTimeStart) / 1000.0f;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Update(t);
|
||||||
|
|
||||||
// clear
|
// clear
|
||||||
|
|
||||||
g_pd3dDevice->OMSetRenderTargets(1, &g_pRenderTargetViewTexture[0], g_pDepthStencilView);
|
const float ClearColor[4] = { 0.0f, 0.125f, 0.6f, 1.0f };
|
||||||
float ClearColor[4] = { 0.0f, 0.125f, 0.6f, 1.0f };
|
//g_pd3dDevice->OMSetRenderTargets(1, &g_pRenderTargetViewTexture[0], g_pDepthStencilView);
|
||||||
g_pd3dDevice->ClearRenderTargetView(g_pRenderTargetViewTexture[0], ClearColor);
|
//g_pd3dDevice->ClearRenderTargetView(g_pRenderTargetViewTexture[0], ClearColor);
|
||||||
|
g_pd3dDevice->OMSetRenderTargets(1, &g_pRenderTargetView, g_pDepthStencilView);
|
||||||
|
g_pd3dDevice->ClearRenderTargetView(g_pRenderTargetView, ClearColor);
|
||||||
g_pd3dDevice->ClearDepthStencilView(g_pDepthStencilView, D3D10_CLEAR_DEPTH, 1.0f, 0);
|
g_pd3dDevice->ClearDepthStencilView(g_pDepthStencilView, D3D10_CLEAR_DEPTH, 1.0f, 0);
|
||||||
|
|
||||||
// render
|
// render
|
||||||
RenderModel(t);
|
RenderModel(t);
|
||||||
RenderFont();
|
RenderFont();
|
||||||
|
RenderMeshStatic(cube::node_0.mesh);
|
||||||
|
|
||||||
RenderBloom();
|
//RenderBloom();
|
||||||
|
|
||||||
// present
|
// present
|
||||||
g_pSwapChain->Present(0, 0);
|
g_pSwapChain->Present(0, 0);
|
||||||
|
|||||||
62
static.fx
Normal file
62
static.fx
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
matrix World;
|
||||||
|
matrix View;
|
||||||
|
matrix Projection;
|
||||||
|
|
||||||
|
float3 vOutputColor;
|
||||||
|
|
||||||
|
struct VS_INPUT
|
||||||
|
{
|
||||||
|
float4 Pos : POSITION;
|
||||||
|
float3 Normal : NORMAL;
|
||||||
|
float2 Tex : TEXCOORD0;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct PS_INPUT
|
||||||
|
{
|
||||||
|
float4 Pos : SV_POSITION;
|
||||||
|
float3 Normal : NORMAL;
|
||||||
|
float2 Tex : TEXCOORD0;
|
||||||
|
};
|
||||||
|
|
||||||
|
PS_INPUT VS(VS_INPUT input)
|
||||||
|
{
|
||||||
|
PS_INPUT output = (PS_INPUT)0;
|
||||||
|
|
||||||
|
output.Pos = mul(input.Pos, World);
|
||||||
|
output.Pos = mul(output.Pos, View);
|
||||||
|
output.Pos = mul(output.Pos, Projection);
|
||||||
|
|
||||||
|
output.Normal = mul(output.Normal, World).xyz;
|
||||||
|
|
||||||
|
output.Tex = input.Tex;
|
||||||
|
|
||||||
|
return output;
|
||||||
|
}
|
||||||
|
|
||||||
|
float4 PS(PS_INPUT input) : SV_Target
|
||||||
|
{
|
||||||
|
return float4(vOutputColor, 1.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
BlendState DisableBlending
|
||||||
|
{
|
||||||
|
BlendEnable[0] = FALSE;
|
||||||
|
};
|
||||||
|
|
||||||
|
DepthStencilState EnableDepth
|
||||||
|
{
|
||||||
|
DepthEnable = TRUE;
|
||||||
|
DepthWriteMask = ALL;
|
||||||
|
};
|
||||||
|
|
||||||
|
technique10 Static
|
||||||
|
{
|
||||||
|
pass P0
|
||||||
|
{
|
||||||
|
SetVertexShader(CompileShader(vs_4_0, VS()));
|
||||||
|
SetGeometryShader(NULL);
|
||||||
|
SetPixelShader(CompileShader(ps_4_0, PS()));
|
||||||
|
SetBlendState(DisableBlending, float4(0.0, 0.0, 0.0, 0.0), 0xffffffff);
|
||||||
|
SetDepthStencilState(EnableDepth, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user