LosaDev source snapshot 2019

This commit is contained in:
LosaDev committed 2026-11-07 13:30:45 +07:00
commit c198676e97
20588 files changed
+8812878

No files matched your search

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
Binary file not shown.

After

Width:  |  Height:  |  Size: 65 KiB

File diff suppressed because it is too large. Load diff
Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 384 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 192 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 192 KiB

+187
View File
@@ -0,0 +1,187 @@
xof 0303txt 0032
template VertexDuplicationIndices {
<b8d65549-d7c9-4995-89cf-53a9a8b031e3>
DWORD nIndices;
DWORD nOriginalVertices;
array DWORD indices[nIndices];
}
template FVFData {
<b6e70a0e-8ef9-4e83-94ad-ecc8b0c04897>
DWORD dwFVF;
DWORD nDWords;
array DWORD data[nDWords];
}
template VertexElement {
<f752461c-1e23-48f6-b9f8-8350850f336f>
DWORD Type;
DWORD Method;
DWORD Usage;
DWORD UsageIndex;
}
template DeclData {
<bf22e553-292c-4781-9fea-62bd554bdd93>
DWORD nElements;
array VertexElement Elements[nElements];
DWORD nDWords;
array DWORD data[nDWords];
}
template EffectParamFloats {
<3014b9a0-62f5-478c-9b86-e4ac9f4e418b>
STRING ParamName;
DWORD nFloats;
array FLOAT Floats[nFloats];
}
template EffectParamString {
<1dbc4c88-94c1-46ee-9076-2c28818c9481>
STRING ParamName;
STRING Value;
}
template EffectParamDWord {
<e13963bc-ae51-4c5d-b00f-cfa3a9d97ce5>
STRING ParamName;
DWORD Value;
}
template EffectInstance {
<e331f7e4-0559-4cc2-8e99-1cec1657928f>
STRING EffectFilename;
[...]
}
Mesh {
24;
-0.800000;-0.500000;-0.100000;,
-0.800000;-0.500000;0.100000;,
-0.800000;0.500000;0.100000;,
-0.800000;0.500000;-0.100000;,
-0.800000;0.500000;-0.100000;,
-0.800000;0.500000;0.100000;,
0.800000;0.500000;0.100000;,
0.800000;0.500000;-0.100000;,
0.800000;0.500000;-0.100000;,
0.800000;0.500000;0.100000;,
0.800000;-0.500000;0.100000;,
0.800000;-0.500000;-0.100000;,
-0.800000;-0.500000;0.100000;,
-0.800000;-0.500000;-0.100000;,
0.800000;-0.500000;-0.100000;,
0.800000;-0.500000;0.100000;,
-0.800000;-0.500000;0.100000;,
0.800000;-0.500000;0.100000;,
0.800000;0.500000;0.100000;,
-0.800000;0.500000;0.100000;,
-0.800000;-0.500000;-0.100000;,
-0.800000;0.500000;-0.100000;,
0.800000;0.500000;-0.100000;,
0.800000;-0.500000;-0.100000;;
12;
3;0,1,2;,
3;2,3,0;,
3;4,5,6;,
3;6,7,4;,
3;8,9,10;,
3;10,11,8;,
3;12,13,14;,
3;14,15,12;,
3;16,17,18;,
3;18,19,16;,
3;20,21,22;,
3;22,23,20;;
MeshTextureCoords {
24;
0.000000;1.000000;,
0.000000;0.000000;,
1.000000;0.000000;,
1.000000;1.000000;,
0.000000;1.000000;,
0.000000;0.000000;,
1.000000;0.000000;,
1.000000;1.000000;,
0.000000;1.000000;,
0.000000;0.000000;,
1.000000;0.000000;,
1.000000;1.000000;,
0.000000;1.000000;,
0.000000;0.000000;,
1.000000;0.000000;,
1.000000;1.000000;,
0.000000;1.000000;,
0.000000;0.000000;,
1.000000;0.000000;,
1.000000;1.000000;,
0.000000;1.000000;,
0.000000;0.000000;,
1.000000;0.000000;,
1.000000;1.000000;;
}
MeshMaterialList {
4;
12;
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
2,
2;
Material {
1.000000;1.000000;1.000000;1.000000;;
1.000000;
1.000000;1.000000;1.000000;;
0.000000;0.000000;0.000000;;
TextureFilename {
"ground2.bmp";
}
}
Material {
1.000000;1.000000;1.000000;1.000000;;
1.000000;
1.000000;1.000000;1.000000;;
0.000000;0.000000;0.000000;;
TextureFilename {
"env2.bmp";
}
}
Material {
1.000000;1.000000;1.000000;1.000000;;
1.000000;
1.000000;1.000000;1.000000;;
0.000000;0.000000;0.000000;;
TextureFilename {
"ground2.bmp";
}
}
Material {
1.000000;1.000000;1.000000;1.000000;;
1.000000;
1.000000;1.000000;1.000000;;
0.000000;0.000000;0.000000;;
TextureFilename {
"env2.bmp";
}
}
}
}
File diff suppressed because it is too large. Load diff
+282
View File
@@ -0,0 +1,282 @@
xof 0303txt 0032
template VertexDuplicationIndices {
<b8d65549-d7c9-4995-89cf-53a9a8b031e3>
DWORD nIndices;
DWORD nOriginalVertices;
array DWORD indices[nIndices];
}
template FVFData {
<b6e70a0e-8ef9-4e83-94ad-ecc8b0c04897>
DWORD dwFVF;
DWORD nDWords;
array DWORD data[nDWords];
}
template VertexElement {
<f752461c-1e23-48f6-b9f8-8350850f336f>
DWORD Type;
DWORD Method;
DWORD Usage;
DWORD UsageIndex;
}
template DeclData {
<bf22e553-292c-4781-9fea-62bd554bdd93>
DWORD nElements;
array VertexElement Elements[nElements];
DWORD nDWords;
array DWORD data[nDWords];
}
template EffectParamFloats {
<3014b9a0-62f5-478c-9b86-e4ac9f4e418b>
STRING ParamName;
DWORD nFloats;
array FLOAT Floats[nFloats];
}
template EffectParamString {
<1dbc4c88-94c1-46ee-9076-2c28818c9481>
STRING ParamName;
STRING Value;
}
template EffectParamDWord {
<e13963bc-ae51-4c5d-b00f-cfa3a9d97ce5>
STRING ParamName;
DWORD Value;
}
template EffectInstance {
<e331f7e4-0559-4cc2-8e99-1cec1657928f>
STRING EffectFilename;
[...]
}
Mesh {
34;
-6.000000;-3.000000;-6.000000;,
6.000000;-3.000000;-6.000000;,
-6.000000;-3.000000;6.000000;,
6.000000;-3.000000;6.000000;,
-6.000000;-3.000000;-6.000000;,
6.000000;-3.000000;-6.000000;,
-6.000000;2.500000;-6.000000;,
-4.000000;2.500000;-6.000000;,
4.000000;2.500000;-6.000000;,
6.000000;2.500000;-6.000000;,
-4.000000;3.000000;-6.000000;,
4.000000;3.000000;-6.000000;,
-6.000000;-3.000000;6.000000;,
6.000000;-3.000000;6.000000;,
-6.000000;2.500000;6.000000;,
-4.000000;2.500000;6.000000;,
4.000000;2.500000;6.000000;,
6.000000;2.500000;6.000000;,
-4.000000;3.000000;6.000000;,
4.000000;3.000000;6.000000;,
-6.000000;-3.000000;-6.000000;,
-6.000000;2.500000;-6.000000;,
-6.000000;2.500000;-6.000000;,
-4.000000;2.500000;-6.000000;,
4.000000;2.500000;-6.000000;,
6.000000;2.500000;-6.000000;,
-4.000000;3.000000;-6.000000;,
4.000000;3.000000;-6.000000;,
-6.000000;2.500000;6.000000;,
-4.000000;2.500000;6.000000;,
4.000000;2.500000;6.000000;,
6.000000;2.500000;6.000000;,
-4.000000;3.000000;6.000000;,
4.000000;3.000000;6.000000;;
24;
3;0,2,1;,
3;1,2,3;,
3;20,5,21;,
3;21,5,9;,
3;7,8,10;,
3;10,8,11;,
3;4,6,12;,
3;12,6,14;,
3;12,14,13;,
3;13,14,17;,
3;15,18,16;,
3;16,18,19;,
3;13,17,5;,
3;5,17,9;,
3;22,23,28;,
3;28,23,29;,
3;23,26,29;,
3;29,26,32;,
3;26,27,32;,
3;32,27,33;,
3;27,24,33;,
3;33,24,30;,
3;24,25,30;,
3;30,25,31;;
MeshNormals {
34;
0.000000;1.000000;0.000000;,
0.000000;1.000000;0.000000;,
0.000000;1.000000;0.000000;,
0.000000;1.000000;0.000000;,
1.000000;0.000000;0.000000;,
-0.707107;0.000000;0.707107;,
1.000000;0.000000;0.000000;,
0.000000;0.000000;1.000000;,
0.000000;0.000000;1.000000;,
-0.707107;0.000000;0.707107;,
0.000000;0.000000;1.000000;,
0.000000;0.000000;1.000000;,
0.894427;0.000000;-0.447214;,
-0.447214;0.000000;-0.894427;,
0.447214;0.000000;-0.894427;,
0.000000;0.000000;-1.000000;,
0.000000;0.000000;-1.000000;,
-0.894427;0.000000;-0.447214;,
0.000000;0.000000;-1.000000;,
0.000000;0.000000;-1.000000;,
0.000000;0.000000;1.000000;,
0.000000;0.000000;1.000000;,
0.000000;-1.000000;0.000000;,
0.124035;-0.992278;0.000000;,
-0.447214;-0.894427;0.000000;,
0.000000;-1.000000;0.000000;,
0.124035;-0.992278;0.000000;,
-0.031235;-0.999512;0.000000;,
0.000000;-1.000000;0.000000;,
0.447214;-0.894427;0.000000;,
-0.124035;-0.992278;0.000000;,
0.000000;-1.000000;0.000000;,
0.031235;-0.999512;0.000000;,
-0.124035;-0.992278;0.000000;;
24;
3;0,2,1;,
3;1,2,3;,
3;20,5,21;,
3;21,5,9;,
3;7,8,10;,
3;10,8,11;,
3;4,6,12;,
3;12,6,14;,
3;12,14,13;,
3;13,14,17;,
3;15,18,16;,
3;16,18,19;,
3;13,17,5;,
3;5,17,9;,
3;22,23,28;,
3;28,23,29;,
3;23,26,29;,
3;29,26,32;,
3;26,27,32;,
3;32,27,33;,
3;27,24,33;,
3;33,24,30;,
3;24,25,30;,
3;30,25,31;;
}
MeshTextureCoords {
34;
0.000000;0.000000;,
0.000000;2.000000;,
2.000000;0.000000;,
2.000000;2.000000;,
0.000000;1.000000;,
6.000000;1.000000;,
0.000000;0.083333;,
7.666667;0.083333;,
6.333333;0.083333;,
6.000000;0.083333;,
7.666667;0.000000;,
6.333333;0.000000;,
2.000000;1.000000;,
4.000000;1.000000;,
2.000000;0.083333;,
2.333333;0.083333;,
3.666667;0.083333;,
4.000000;0.083333;,
2.333333;0.000000;,
3.666667;0.000000;,
8.000000;1.000000;,
8.000000;0.083333;,
0.000000;0.000000;,
0.333333;0.000000;,
1.833333;0.000000;,
2.166667;0.000000;,
0.416667;0.000000;,
1.750000;0.000000;,
0.000000;2.000000;,
0.333333;2.000000;,
1.833333;2.000000;,
2.166667;2.000000;,
0.416667;2.000000;,
1.750000;2.000000;;
}
MeshMaterialList {
3;
24;
0,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2;
Material {
1.000000;1.000000;1.000000;1.000000;;
1.000000;
1.000000;1.000000;1.000000;;
0.000000;0.000000;0.000000;;
TextureFilename {
"ground2.bmp";
}
}
Material {
1.000000;1.000000;1.000000;1.000000;;
1.000000;
1.000000;1.000000;1.000000;;
0.000000;0.000000;0.000000;;
TextureFilename {
"env2.bmp";
}
}
Material {
1.000000;1.000000;1.000000;1.000000;;
1.000000;
1.000000;1.000000;1.000000;;
0.000000;0.000000;0.000000;;
TextureFilename {
"seafloor.bmp";
}
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 65 KiB

+280
View File
@@ -0,0 +1,280 @@
//-----------------------------------------------------------------------------
// File: ShadowMap.fx
//
// Desc: Effect file for high dynamic range cube mapping sample.
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------------------------
#define SMAP_SIZE 512
#define SHADOW_EPSILON 0.00005f
float4x4 g_mWorldView;
float4x4 g_mProj;
float4x4 g_mViewToLightProj; // Transform from view space to light projection space
float4 g_vMaterial;
texture g_txScene;
texture g_txShadow;
float3 g_vLightPos; // Light position in view space
float3 g_vLightDir; // Light direction in view space
float4 g_vLightDiffuse = float4( 1.0f, 1.0f, 1.0f, 1.0f ); // Light diffuse color
float4 g_vLightAmbient = float4( 0.3f, 0.3f, 0.3f, 1.0f ); // Use an ambient light of 0.3
float g_fCosTheta; // Cosine of theta of the spot light
sampler2D g_samScene =
sampler_state
{
Texture = <g_txScene>;
MinFilter = Point;
MagFilter = Linear;
MipFilter = Linear;
};
sampler2D g_samShadow =
sampler_state
{
Texture = <g_txShadow>;
MinFilter = Point;
MagFilter = Point;
MipFilter = Point;
AddressU = Clamp;
AddressV = Clamp;
};
//-----------------------------------------------------------------------------
// Vertex Shader: VertScene
// Desc: Process vertex for scene
//-----------------------------------------------------------------------------
void VertScene( float4 iPos : POSITION,
float3 iNormal : NORMAL,
float2 iTex : TEXCOORD0,
out float4 oPos : POSITION,
out float2 Tex : TEXCOORD0,
out float4 vPos : TEXCOORD1,
out float3 vNormal : TEXCOORD2,
out float4 vPosLight : TEXCOORD3 )
{
//
// Transform position to view space
//
vPos = mul( iPos, g_mWorldView );
//
// Transform to screen coord
//
oPos = mul( vPos, g_mProj );
//
// Compute view space normal
//
vNormal = mul( iNormal, (float3x3)g_mWorldView );
//
// Propagate texture coord
//
Tex = iTex;
//
// Transform the position to light projection space, or the
// projection space as if the camera is looking out from
// the spotlight.
//
vPosLight = mul( vPos, g_mViewToLightProj );
}
//-----------------------------------------------------------------------------
// Pixel Shader: PixScene
// Desc: Process pixel (do per-pixel lighting) for enabled scene
//-----------------------------------------------------------------------------
float4 PixScene( float2 Tex : TEXCOORD0,
float4 vPos : TEXCOORD1,
float3 vNormal : TEXCOORD2,
float4 vPosLight : TEXCOORD3 ) : COLOR
{
float4 Diffuse;
// vLight is the unit vector from the light to this pixel
float3 vLight = normalize( float3( vPos - g_vLightPos ) );
// Compute diffuse from the light
if( dot( vLight, g_vLightDir ) > g_fCosTheta ) // Light must face the pixel (within Theta)
{
// Pixel is in lit area. Find out if it's
// in shadow using 2x2 percentage closest filtering
//transform from RT space to texture space.
float2 ShadowTexC = 0.5 * vPosLight.xy / vPosLight.w + float2( 0.5, 0.5 );
ShadowTexC.y = 1.0f - ShadowTexC.y;
// transform to texel space
float2 texelpos = SMAP_SIZE * ShadowTexC;
// Determine the lerp amounts
float2 lerps = frac( texelpos );
//read in bilerp stamp, doing the shadow checks
float sourcevals[4];
sourcevals[0] = (tex2D( g_samShadow, ShadowTexC ) + SHADOW_EPSILON < vPosLight.z / vPosLight.w)? 0.0f: 1.0f;
sourcevals[1] = (tex2D( g_samShadow, ShadowTexC + float2(1.0/SMAP_SIZE, 0) ) + SHADOW_EPSILON < vPosLight.z / vPosLight.w)? 0.0f: 1.0f;
sourcevals[2] = (tex2D( g_samShadow, ShadowTexC + float2(0, 1.0/SMAP_SIZE) ) + SHADOW_EPSILON < vPosLight.z / vPosLight.w)? 0.0f: 1.0f;
sourcevals[3] = (tex2D( g_samShadow, ShadowTexC + float2(1.0/SMAP_SIZE, 1.0/SMAP_SIZE) ) + SHADOW_EPSILON < vPosLight.z / vPosLight.w)? 0.0f: 1.0f;
// lerp between the shadow values to calculate our light amount
float LightAmount = lerp( lerp( sourcevals[0], sourcevals[1], lerps.x ),
lerp( sourcevals[2], sourcevals[3], lerps.x ),
lerps.y );
// Light it
Diffuse = ( saturate( dot( -vLight, normalize( vNormal ) ) ) * LightAmount * ( 1 - g_vLightAmbient ) + g_vLightAmbient )
* g_vMaterial;
} else
{
Diffuse = g_vLightAmbient * g_vMaterial;
}
return tex2D( g_samScene, Tex ) * Diffuse;
}
//-----------------------------------------------------------------------------
// Vertex Shader: VertLight
// Desc: Process vertex for the light object
//-----------------------------------------------------------------------------
void VertLight( float4 iPos : POSITION,
float3 iNormal : NORMAL,
float2 iTex : TEXCOORD0,
out float4 oPos : POSITION,
out float2 Tex : TEXCOORD0 )
{
//
// Transform position to view space
//
oPos = mul( iPos, g_mWorldView );
//
// Transform to screen coord
//
oPos = mul( oPos, g_mProj );
//
// Propagate texture coord
//
Tex = iTex;
}
//-----------------------------------------------------------------------------
// Pixel Shader: PixLight
// Desc: Process pixel for the light object
//-----------------------------------------------------------------------------
float4 PixLight( float2 Tex : TEXCOORD0,
float4 vPos : TEXCOORD1 ) : COLOR
{
return tex2D( g_samScene, Tex );
}
//-----------------------------------------------------------------------------
// Vertex Shader: VertShadow
// Desc: Process vertex for the shadow map
//-----------------------------------------------------------------------------
void VertShadow( float4 Pos : POSITION,
float3 Normal : NORMAL,
out float4 oPos : POSITION,
out float2 Depth : TEXCOORD0 )
{
//
// Compute the projected coordinates
//
oPos = mul( Pos, g_mWorldView );
oPos = mul( oPos, g_mProj );
//
// Store z and w in our spare texcoord
//
Depth.xy = oPos.zw;
}
//-----------------------------------------------------------------------------
// Pixel Shader: PixShadow
// Desc: Process pixel for the shadow map
//-----------------------------------------------------------------------------
void PixShadow( float2 Depth : TEXCOORD0,
out float4 Color : COLOR )
{
//
// Depth is z / w
//
Color = Depth.x / Depth.y;
}
//-----------------------------------------------------------------------------
// Technique: RenderScene
// Desc: Renders scene objects
//-----------------------------------------------------------------------------
technique RenderScene
{
pass p0
{
VertexShader = compile vs_1_1 VertScene();
PixelShader = compile ps_2_0 PixScene();
}
}
//-----------------------------------------------------------------------------
// Technique: RenderLight
// Desc: Renders the light object
//-----------------------------------------------------------------------------
technique RenderLight
{
pass p0
{
VertexShader = compile vs_1_1 VertLight();
PixelShader = compile ps_1_1 PixLight();
}
}
//-----------------------------------------------------------------------------
// Technique: RenderShadow
// Desc: Renders the shadow map
//-----------------------------------------------------------------------------
technique RenderShadow
{
pass p0
{
VertexShader = compile vs_1_1 VertShadow();
PixelShader = compile ps_2_0 PixShadow();
}
}
+280
View File
@@ -0,0 +1,280 @@
//-----------------------------------------------------------------------------
// File: ShadowMap.fx
//
// Desc: Effect file for high dynamic range cube mapping sample.
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------------------------
#define SMAP_SIZE 512
#define SHADOW_EPSILON 0.00005f
float4x4 g_mWorldView;
float4x4 g_mProj;
float4x4 g_mViewToLightProj; // Transform from view space to light projection space
float4 g_vMaterial;
texture g_txScene;
texture g_txShadow;
float3 g_vLightPos; // Light position in view space
float3 g_vLightDir; // Light direction in view space
float4 g_vLightDiffuse = float4( 1.0f, 1.0f, 1.0f, 1.0f ); // Light diffuse color
float4 g_vLightAmbient = float4( 0.3f, 0.3f, 0.3f, 1.0f ); // Use an ambient light of 0.3
float g_fCosTheta; // Cosine of theta of the spot light
sampler2D g_samScene =
sampler_state
{
Texture = <g_txScene>;
MinFilter = Point;
MagFilter = Linear;
MipFilter = Linear;
};
sampler2D g_samShadow =
sampler_state
{
Texture = <g_txShadow>;
MinFilter = Point;
MagFilter = Point;
MipFilter = Point;
AddressU = Clamp;
AddressV = Clamp;
};
//-----------------------------------------------------------------------------
// Vertex Shader: VertScene
// Desc: Process vertex for scene
//-----------------------------------------------------------------------------
void VertScene( float4 iPos : POSITION,
float3 iNormal : NORMAL,
float2 iTex : TEXCOORD0,
out float4 oPos : POSITION,
out float2 Tex : TEXCOORD0,
out float4 vPos : TEXCOORD1,
out float3 vNormal : TEXCOORD2,
out float4 vPosLight : TEXCOORD3 )
{
//
// Transform position to view space
//
vPos = mul( iPos, g_mWorldView );
//
// Transform to screen coord
//
oPos = mul( vPos, g_mProj );
//
// Compute view space normal
//
vNormal = mul( iNormal, (float3x3)g_mWorldView );
//
// Propagate texture coord
//
Tex = iTex;
//
// Transform the position to light projection space, or the
// projection space as if the camera is looking out from
// the spotlight.
//
vPosLight = mul( vPos, g_mViewToLightProj );
}
//-----------------------------------------------------------------------------
// Pixel Shader: PixScene
// Desc: Process pixel (do per-pixel lighting) for enabled scene
//-----------------------------------------------------------------------------
float4 PixScene( float2 Tex : TEXCOORD0,
float4 vPos : TEXCOORD1,
float3 vNormal : TEXCOORD2,
float4 vPosLight : TEXCOORD3 ) : COLOR
{
float4 Diffuse;
// vLight is the unit vector from the light to this pixel
float3 vLight = normalize( float3( vPos - g_vLightPos ) );
// Compute diffuse from the light
if( dot( vLight, g_vLightDir ) > g_fCosTheta ) // Light must face the pixel (within Theta)
{
// Pixel is in lit area. Find out if it's
// in shadow using 2x2 percentage closest filtering
//transform from RT space to texture space.
float2 ShadowTexC = 0.5 * vPosLight.xy / vPosLight.w + float2( 0.5, 0.5 );
ShadowTexC.y = 1.0f - ShadowTexC.y;
// transform to texel space
float2 texelpos = SMAP_SIZE * ShadowTexC;
// Determine the lerp amounts
float2 lerps = frac( texelpos );
//read in bilerp stamp, doing the shadow checks
float sourcevals[4];
sourcevals[0] = (tex2D( g_samShadow, ShadowTexC ) + SHADOW_EPSILON < vPosLight.z / vPosLight.w)? 0.0f: 1.0f;
sourcevals[1] = (tex2D( g_samShadow, ShadowTexC + float2(1.0/SMAP_SIZE, 0) ) + SHADOW_EPSILON < vPosLight.z / vPosLight.w)? 0.0f: 1.0f;
sourcevals[2] = (tex2D( g_samShadow, ShadowTexC + float2(0, 1.0/SMAP_SIZE) ) + SHADOW_EPSILON < vPosLight.z / vPosLight.w)? 0.0f: 1.0f;
sourcevals[3] = (tex2D( g_samShadow, ShadowTexC + float2(1.0/SMAP_SIZE, 1.0/SMAP_SIZE) ) + SHADOW_EPSILON < vPosLight.z / vPosLight.w)? 0.0f: 1.0f;
// lerp between the shadow values to calculate our light amount
float LightAmount = lerp( lerp( sourcevals[0], sourcevals[1], lerps.x ),
lerp( sourcevals[2], sourcevals[3], lerps.x ),
lerps.y );
// Light it
Diffuse = ( saturate( dot( -vLight, normalize( vNormal ) ) ) * LightAmount * ( 1 - g_vLightAmbient ) + g_vLightAmbient )
* g_vMaterial;
} else
{
Diffuse = g_vLightAmbient * g_vMaterial;
}
return tex2D( g_samScene, Tex ) * Diffuse;
}
//-----------------------------------------------------------------------------
// Vertex Shader: VertLight
// Desc: Process vertex for the light object
//-----------------------------------------------------------------------------
void VertLight( float4 iPos : POSITION,
float3 iNormal : NORMAL,
float2 iTex : TEXCOORD0,
out float4 oPos : POSITION,
out float2 Tex : TEXCOORD0 )
{
//
// Transform position to view space
//
oPos = mul( iPos, g_mWorldView );
//
// Transform to screen coord
//
oPos = mul( oPos, g_mProj );
//
// Propagate texture coord
//
Tex = iTex;
}
//-----------------------------------------------------------------------------
// Pixel Shader: PixLight
// Desc: Process pixel for the light object
//-----------------------------------------------------------------------------
float4 PixLight( float2 Tex : TEXCOORD0,
float4 vPos : TEXCOORD1 ) : COLOR
{
return tex2D( g_samScene, Tex );
}
//-----------------------------------------------------------------------------
// Vertex Shader: VertShadow
// Desc: Process vertex for the shadow map
//-----------------------------------------------------------------------------
void VertShadow( float4 Pos : POSITION,
float3 Normal : NORMAL,
out float4 oPos : POSITION,
out float2 Depth : TEXCOORD0 )
{
//
// Compute the projected coordinates
//
oPos = mul( Pos, g_mWorldView );
oPos = mul( oPos, g_mProj );
//
// Store z and w in our spare texcoord
//
Depth.xy = oPos.zw;
}
//-----------------------------------------------------------------------------
// Pixel Shader: PixShadow
// Desc: Process pixel for the shadow map
//-----------------------------------------------------------------------------
void PixShadow( float2 Depth : TEXCOORD0,
out float4 Color : COLOR )
{
//
// Depth is z / w
//
Color = Depth.x / Depth.y;
}
//-----------------------------------------------------------------------------
// Technique: RenderScene
// Desc: Renders scene objects
//-----------------------------------------------------------------------------
technique RenderScene
{
pass p0
{
VertexShader = compile vs_2_0 VertScene();
PixelShader = compile ps_2_0 PixScene();
}
}
//-----------------------------------------------------------------------------
// Technique: RenderLight
// Desc: Renders the light object
//-----------------------------------------------------------------------------
technique RenderLight
{
pass p0
{
VertexShader = compile vs_2_0 VertLight();
PixelShader = compile ps_2_0 PixLight();
}
}
//-----------------------------------------------------------------------------
// Technique: RenderShadow
// Desc: Renders the shadow map
//-----------------------------------------------------------------------------
technique RenderShadow
{
pass p0
{
VertexShader = compile vs_2_0 VertShadow();
PixelShader = compile ps_2_0 PixShadow();
}
}
File diff suppressed because it is too large. Load diff
Binary file not shown.

After

Width:  |  Height:  |  Size: 161 KiB

+437
View File
@@ -0,0 +1,437 @@
xof 0303txt 0032
template VertexDuplicationIndices {
<b8d65549-d7c9-4995-89cf-53a9a8b031e3>
DWORD nIndices;
DWORD nOriginalVertices;
array DWORD indices[nIndices];
}
template FVFData {
<b6e70a0e-8ef9-4e83-94ad-ecc8b0c04897>
DWORD dwFVF;
DWORD nDWords;
array DWORD data[nDWords];
}
template VertexElement {
<f752461c-1e23-48f6-b9f8-8350850f336f>
DWORD Type;
DWORD Method;
DWORD Usage;
DWORD UsageIndex;
}
template DeclData {
<bf22e553-292c-4781-9fea-62bd554bdd93>
DWORD nElements;
array VertexElement Elements[nElements];
DWORD nDWords;
array DWORD data[nDWords];
}
template EffectParamFloats {
<3014b9a0-62f5-478c-9b86-e4ac9f4e418b>
STRING ParamName;
DWORD nFloats;
array FLOAT Floats[nFloats];
}
template EffectParamString {
<1dbc4c88-94c1-46ee-9076-2c28818c9481>
STRING ParamName;
STRING Value;
}
template EffectParamDWord {
<e13963bc-ae51-4c5d-b00f-cfa3a9d97ce5>
STRING ParamName;
DWORD Value;
}
template EffectInstance {
<e331f7e4-0559-4cc2-8e99-1cec1657928f>
STRING EffectFilename;
[...]
}
Mesh {
53;
0.000000;0.000000;-0.500000;,
0.000000;0.200000;-0.500000;,
0.076537;0.184776;-0.500000;,
0.141421;0.141421;-0.500000;,
0.184776;0.076537;-0.500000;,
0.200000;-0.000000;-0.500000;,
0.184776;-0.076537;-0.500000;,
0.141421;-0.141421;-0.500000;,
0.076537;-0.184776;-0.500000;,
-0.000000;-0.200000;-0.500000;,
-0.076537;-0.184776;-0.500000;,
-0.141421;-0.141421;-0.500000;,
-0.184776;-0.076537;-0.500000;,
-0.200000;0.000000;-0.500000;,
-0.184776;0.076537;-0.500000;,
-0.141421;0.141421;-0.500000;,
-0.076537;0.184776;-0.500000;,
0.000000;0.200000;-0.500000;,
0.097545;0.490393;0.500000;,
0.277785;0.415735;0.500000;,
0.415735;0.277785;0.500000;,
0.490393;0.097545;0.500000;,
0.490393;-0.097545;0.500000;,
0.415735;-0.277785;0.500000;,
0.277785;-0.415735;0.500000;,
0.097545;-0.490393;0.500000;,
-0.097545;-0.490393;0.500000;,
-0.277785;-0.415735;0.500000;,
-0.415735;-0.277785;0.500000;,
-0.490393;-0.097545;0.500000;,
-0.490393;0.097545;0.500000;,
-0.415735;0.277785;0.500000;,
-0.277785;0.415735;0.500000;,
-0.097545;0.490393;0.500000;,
0.097545;0.490393;0.500000;,
0.097545;0.490393;0.500000;,
0.277785;0.415735;0.500000;,
0.415735;0.277785;0.500000;,
0.490393;0.097545;0.500000;,
0.490393;-0.097545;0.500000;,
0.415735;-0.277785;0.500000;,
0.277785;-0.415735;0.500000;,
0.097545;-0.490393;0.500000;,
-0.097545;-0.490393;0.500000;,
-0.277785;-0.415735;0.500000;,
-0.415735;-0.277785;0.500000;,
-0.490393;-0.097545;0.500000;,
-0.490393;0.097545;0.500000;,
-0.415735;0.277785;0.500000;,
-0.277785;0.415735;0.500000;,
-0.097545;0.490393;0.500000;,
0.097545;0.490393;0.500000;,
0.000000;0.000000;0.500000;;
64;
3;0,1,2;,
3;0,2,3;,
3;0,3,4;,
3;0,4,5;,
3;0,5,6;,
3;0,6,7;,
3;0,7,8;,
3;0,8,9;,
3;0,9,10;,
3;0,10,11;,
3;0,11,12;,
3;0,12,13;,
3;0,13,14;,
3;0,14,15;,
3;0,15,16;,
3;0,16,17;,
3;1,18,2;,
3;2,18,19;,
3;2,19,3;,
3;3,19,20;,
3;3,20,4;,
3;4,20,21;,
3;4,21,5;,
3;5,21,22;,
3;5,22,6;,
3;6,22,23;,
3;6,23,7;,
3;7,23,24;,
3;7,24,8;,
3;8,24,25;,
3;8,25,9;,
3;9,25,26;,
3;9,26,10;,
3;10,26,27;,
3;10,27,11;,
3;11,27,28;,
3;11,28,12;,
3;12,28,29;,
3;12,29,13;,
3;13,29,30;,
3;13,30,14;,
3;14,30,31;,
3;14,31,15;,
3;15,31,32;,
3;15,32,16;,
3;16,32,33;,
3;16,33,17;,
3;17,33,34;,
3;52,36,35;,
3;52,37,36;,
3;52,38,37;,
3;52,39,38;,
3;52,40,39;,
3;52,41,40;,
3;52,42,41;,
3;52,43,42;,
3;52,44,43;,
3;52,45,44;,
3;52,46,45;,
3;52,47,46;,
3;52,48,47;,
3;52,49,48;,
3;52,50,49;,
3;52,51,50;;
MeshNormals {
53;
0.000000;0.000000;-1.000000;,
0.174494;0.877241;-0.447214;,
0.356907;0.861651;-0.360798;,
0.659479;0.659479;-0.360798;,
0.861651;0.356907;-0.360798;,
0.932644;0.000000;-0.360798;,
0.861651;-0.356907;-0.360798;,
0.659479;-0.659479;-0.360798;,
0.356907;-0.861651;-0.360798;,
-0.000000;-0.932644;-0.360798;,
-0.356908;-0.861651;-0.360798;,
-0.659479;-0.659479;-0.360798;,
-0.861651;-0.356907;-0.360798;,
-0.932644;0.000000;-0.360798;,
-0.861651;0.356908;-0.360798;,
-0.659479;0.659479;-0.360798;,
-0.356907;0.861651;-0.360798;,
-0.052791;0.941890;-0.331747;,
0.316849;0.905180;-0.283295;,
0.532520;0.796972;-0.285057;,
0.796972;0.532520;-0.285057;,
0.940093;0.186996;-0.285058;,
0.940093;-0.186996;-0.285057;,
0.796972;-0.532520;-0.285058;,
0.532520;-0.796972;-0.285057;,
0.186996;-0.940093;-0.285057;,
-0.186996;-0.940093;-0.285057;,
-0.532520;-0.796972;-0.285057;,
-0.796972;-0.532520;-0.285057;,
-0.940093;-0.186996;-0.285057;,
-0.940093;0.186996;-0.285058;,
-0.796972;0.532520;-0.285057;,
-0.532520;0.796972;-0.285057;,
-0.186996;0.940093;-0.285057;,
0.000000;0.960328;-0.278872;,
0.000000;0.000000;1.000000;,
0.000000;0.000000;1.000000;,
0.000000;0.000000;1.000000;,
0.000000;0.000000;1.000000;,
0.000000;0.000000;1.000000;,
0.000000;0.000000;1.000000;,
0.000000;0.000000;1.000000;,
0.000000;0.000000;1.000000;,
0.000000;0.000000;1.000000;,
0.000000;0.000000;1.000000;,
0.000000;0.000000;1.000000;,
0.000000;0.000000;1.000000;,
0.000000;0.000000;1.000000;,
0.000000;0.000000;1.000000;,
0.000000;0.000000;1.000000;,
0.000000;0.000000;1.000000;,
0.000000;0.000000;1.000000;,
0.000000;0.000000;1.000000;;
64;
3;0,1,2;,
3;0,2,3;,
3;0,3,4;,
3;0,4,5;,
3;0,5,6;,
3;0,6,7;,
3;0,7,8;,
3;0,8,9;,
3;0,9,10;,
3;0,10,11;,
3;0,11,12;,
3;0,12,13;,
3;0,13,14;,
3;0,14,15;,
3;0,15,16;,
3;0,16,17;,
3;1,18,2;,
3;2,18,19;,
3;2,19,3;,
3;3,19,20;,
3;3,20,4;,
3;4,20,21;,
3;4,21,5;,
3;5,21,22;,
3;5,22,6;,
3;6,22,23;,
3;6,23,7;,
3;7,23,24;,
3;7,24,8;,
3;8,24,25;,
3;8,25,9;,
3;9,25,26;,
3;9,26,10;,
3;10,26,27;,
3;10,27,11;,
3;11,27,28;,
3;11,28,12;,
3;12,28,29;,
3;12,29,13;,
3;13,29,30;,
3;13,30,14;,
3;14,30,31;,
3;14,31,15;,
3;15,31,32;,
3;15,32,16;,
3;16,32,33;,
3;16,33,17;,
3;17,33,34;,
3;52,36,35;,
3;52,37,36;,
3;52,38,37;,
3;52,39,38;,
3;52,40,39;,
3;52,41,40;,
3;52,42,41;,
3;52,43,42;,
3;52,44,43;,
3;52,45,44;,
3;52,46,45;,
3;52,47,46;,
3;52,48,47;,
3;52,49,48;,
3;52,50,49;,
3;52,51,50;;
}
MeshTextureCoords {
53;
0.500000;0.000000;,
0.000000;0.300000;,
0.062500;0.300000;,
0.125000;0.300000;,
0.187500;0.300000;,
0.250000;0.300000;,
0.312500;0.300000;,
0.375000;0.300000;,
0.437500;0.300000;,
0.500000;0.300000;,
0.562500;0.300000;,
0.625000;0.300000;,
0.687500;0.300000;,
0.750000;0.300000;,
0.812500;0.300000;,
0.875000;0.300000;,
0.937500;0.300000;,
1.000000;0.300000;,
0.000000;0.992990;,
0.062500;0.992990;,
0.125000;0.992990;,
0.187500;0.992990;,
0.250000;0.992990;,
0.312500;0.992990;,
0.375000;0.992990;,
0.437500;0.992990;,
0.500000;0.992990;,
0.562500;0.992990;,
0.625000;0.992990;,
0.687500;0.992990;,
0.750000;0.992990;,
0.812500;0.992990;,
0.875000;0.992990;,
0.937500;0.992990;,
1.000000;0.992990;,
0.000000;0.992990;,
0.000000;0.992990;,
0.000000;0.992990;,
0.000000;0.992990;,
0.000000;0.992990;,
0.000000;0.992990;,
0.000000;0.992990;,
0.000000;0.992990;,
0.000000;0.992990;,
0.000000;0.992990;,
0.000000;0.992990;,
0.000000;0.992990;,
0.000000;0.992990;,
0.000000;0.992990;,
0.000000;0.992990;,
0.000000;0.992990;,
0.000000;0.992990;,
0.000000;0.992990;;
}
MeshMaterialList {
1;
64;
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0;
Material {
1.000000;1.000000;1.000000;1.000000;;
1.000000;
1.000000;1.000000;1.000000;;
1.000000;1.000000;1.000000;;
TextureFilename {
"spotlight.bmp";
}
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+195
View File
@@ -0,0 +1,195 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
///
/// BandiVideoLibrary 2.1
///
/// Copyright(C) 2008-2012 BandiSoft.com All rights reserved.
///
/// Author: denny
///
/// Visit http://www.bandisoft.com for more information.
///
////////////////////////////////////////////////////////////////////////////////////////////////////
#ifndef _BANDIVID_H
#define _BANDIVID_H
#include <windows.h>
#include <unknwn.h>
#ifndef ASSERT
# include "assert.h"
# define ASSERT(x) assert(x)
#endif
#ifndef _INC_TCHAR
# ifdef _UNICODE
# define _T(x) L##x
# define _stprintf swprintf
# define _stprintf_s swprintf_s
# else
# define _T(x) x
# define _stprintf sprintf
# define _stprintf_s sprintf_s
# endif
#endif
#define _BVL_MAKE_VER(a,b,c,d) ((a<<24)+(b<<16)+(c<<8)+d)
#define BVL_VERSION _BVL_MAKE_VER(2,1,5,20) // 2.1.4.17
// 이미지의 픽셀 포맷(타입)
enum BVL_PIXEL_FORMAT
{
BVLPF_NULL,
BVLPF_X8R8G8B8, // D3DFMT_X8R8G8B8 사용
BVLPF_R8G8B8, // D3DFMT_R8G8B8 사용
BVLPF_R5G6B5, // D3DFMT_R5G6B5 사용
BVLPF_R5G5B5, // D3DFMT_X1R5G5B5 사용
BVLPF_A8R8G8B8, // D3DFMT_A8R8G8B8 사용
};
// Seeking flags
enum BVL_SEEK_FLAG
{
BVL_SEEK_TIME, // time in 100-nanosecond
BVL_SEEK_FRAME, // video frame number
};
// 비디오의 현재 상태
enum BVL_STATUS
{
BVL_STATUS_ERROR = -1,
BVL_STATUS_CLOSED = 0,
BVL_STATUS_OPENING,
BVL_STATUS_READY,
BVL_STATUS_PLAYING,
BVL_STATUS_PAUSED,
BVL_STATUS_PLAYEND
};
// 프레임 데이터 구조체
struct BVL_FRAME
{
void* frame_buf; // Pointer to the frame buffer
INT frame_buf_size; // Number of bytes in a frame
INT pitch; // Number of bytes in one row of the surface.
INT width; // Frame width
INT height; // Frame height
BVL_PIXEL_FORMAT pixel_format; // Pixel format
INT64 frame_time; // 100nsec
INT64 frame_number;
};
// 비디오 정보 구조체
struct BVL_VIDEO_INFO
{
INT width;
INT height;
INT fps_rate;
INT fps_scale;
INT samplerate;
INT channels;
INT64 total_time; // 100nsec
INT64 total_frames;
};
// IBandiVideoFileReader 인터페이스
struct IBandiVideoFileReader : public IUnknown
{
virtual HRESULT Open(LPCWSTR path_name) PURE;
virtual void Close() PURE;
virtual INT Read(BYTE* buf, INT bytes_to_read) PURE;
virtual INT64 SetPosition(INT64 pos) PURE;
virtual INT64 GetPosition() PURE;
virtual INT64 GetFileSize() PURE;
};
// IBandiVideoSoundCB 인터페이스
struct IBandiVideoSoundCB : public IUnknown
{
virtual INT GetPcmData(INT16* pcm_buf, INT req_samples) PURE;
};
// IBandiVideoSound 인터페이스
struct IBandiVideoSound : public IUnknown
{
virtual HRESULT Open(INT channels, INT samplerate, IBandiVideoSoundCB *callback) PURE;
virtual void Close() PURE;
virtual HRESULT Start() PURE;
virtual HRESULT Stop() PURE;
virtual HRESULT Pause(BOOL pause) PURE;
virtual HRESULT GetTime(INT64 &time) PURE;
virtual HRESULT SetVolume(INT volume) PURE; // 0 ~ 255
};
////////////////////////////////////////////////////////////////////////////////////////////////////
// IBandiVideo2 인터페이스
////////////////////////////////////////////////////////////////////////////////////////////////////
struct IBandiVideo2 : public IUnknown
{
virtual HRESULT Verify(LPCSTR id, LPCSTR key) PURE; // 인증하기
virtual INT GetVersion() PURE; // 버전 정보
// playback
virtual HRESULT Open(LPCWSTR path_name, BOOL async) PURE;
virtual HRESULT Close() PURE;
virtual HRESULT Play() PURE;
virtual HRESULT Stop() PURE;
virtual HRESULT Seek(INT64 value, BVL_SEEK_FLAG seek_flag) PURE;
virtual HRESULT Pause(BOOL pause) PURE;
virtual BOOL IsNextFrame() PURE;
virtual HRESULT GetFrame(BVL_FRAME &frame, BOOL can_skip) PURE;
virtual HRESULT GetVideoInfo(BVL_VIDEO_INFO &info) PURE;
virtual HRESULT GetStatus(BVL_STATUS &status) PURE;
virtual HRESULT SetVolume(INT volume) PURE; // 0 ~ 255
};
// IBandiVideo2 인터페이스 생성 함수
typedef HRESULT (*LPCREATEBANDIVIDEO2)(UINT sdk_version, void** pp, IBandiVideoFileReader* reader, IBandiVideoSound *sound);
////////////////////////////////////////////////////////////////////////////////////////////////////
// 반디비디오 에러 코드
////////////////////////////////////////////////////////////////////////////////////////////////////
#define _FACBV 0x586
#define MAKE_BVHRESULT( code ) MAKE_HRESULT( 1, _FACBV, code )
#define MAKE_BVSTATUS( code ) MAKE_HRESULT( 0, _FACBV, code )
#define BV_OK S_OK
#define BV_FALSE S_FALSE
#define BVERR_FAIL E_FAIL // 함수의 정해진 명령을 처리하는데 실패하였음
#define BVERR_LOAD_LIBRARY_FAIL MAKE_BVHRESULT(0x1020) // LoadLibrary 함수 실행중 에러
#define BVERR_ALREADY_CREATED MAKE_BVHRESULT(0x1021) // 비디오 라이브러리의 인스턴스가 이미 생성되었음
#define BVERR_GET_PROC_ADDRESS_FAIL MAKE_BVHRESULT(0x1022) // 비디오 라이브러리의 CreateBandiVideo 함수의 주소를 얻는데 실패하였음
#define BVERR_LIBRARY_NOT_LOADED MAKE_BVHRESULT(0x1023) // 라이브러리가 로드되지 않았음
#define BVERR_UNSUPPORTED_OS MAKE_BVHRESULT(0x1024) // 지원되지 않는 운영체제임
#define BVERR_INVALID_VERSION MAKE_BVHRESULT(0x1030) // 비디오 라이브러리의 헤더와 DLL 의 버젼이 안맞음
#define BVERR_OUT_OF_MEMORY MAKE_BVHRESULT(0x1031) // 메모리가 부족하여 비디오라이브러리의 인스턴스를 생성할수 없음
#define BVERR_OPEN_FAILED MAKE_BVHRESULT(0x1040) // 파일이 없거나 지원되지 않는 컨테이너 형식임
#define BVERR_NOT_OPENED MAKE_BVHRESULT(0x1041) // Open 되지 않은 파일에서 재생시도
#endif // _BANDIVID_H
@@ -0,0 +1,247 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
///
/// BandiVideoLibrary 2.1 Sample
///
/// Copyright(C) 2008-2011 BandiSoft.com All rights reserved.
///
/// Visit http://www.bandisoft.com for more information.
///
////////////////////////////////////////////////////////////////////////////////////////////////////
#include <windows.h>
#include <stdio.h>
#include "BandiVideoLibrary.h"
#include "BandiVideoTexture_DX9.h"
#pragma warning (disable:4996)
#define WINDOW_TEXT "BandiVideo Async Playback"
#define MV_WIDTH 1024
#define MV_HEIGHT 768
LRESULT WINAPI WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch(uMsg)
{
case WM_PAINT:
{
// 검은색으로 배경 칠하기
PAINTSTRUCT ps;
HDC dc;
dc = BeginPaint(hwnd, &ps);
PatBlt(dc, 0, 0, 4096, 4096, BLACKNESS);
EndPaint(hwnd, &ps);
}
return 0;
case WM_ERASEBKGND:
return 1;
case WM_DESTROY:
PostQuitMessage(0);
return 0;
}
return DefWindowProc(hwnd, uMsg, wParam, lParam);
}
// 윈도우 생성
static HWND CreatePlayerWindow(HINSTANCE hInstance, HINSTANCE hPrevInstance)
{
if(!hPrevInstance)
{
WNDCLASS wc;
wc.style = 0;
wc.lpfnWndProc = WindowProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = hInstance;
wc.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(101));
wc.hCursor = LoadCursor(0, IDC_ARROW);;
wc.hbrBackground = 0;
wc.lpszMenuName = 0;
wc.lpszClassName = "AsyncPlayback";
if(!RegisterClass(&wc))
{
return( 0 );
}
}
return CreateWindow("AsyncPlayback", WINDOW_TEXT,
WS_CAPTION | WS_POPUP| WS_CLIPCHILDREN |
WS_SYSMENU | WS_MINIMIZEBOX | WS_SIZEBOX,
64, 64,
64, 64,
0, 0, hInstance,0);
}
// 윈도우 보더 크기 계산
static void CalcWindowBorder(HWND hwnd, int &extra_width, int &extra_height)
{
RECT r, c;
GetWindowRect(hwnd, &r);
GetClientRect(hwnd, &c);
extra_width = ( r.right - r.left ) - ( c.right - c.left );
extra_height = ( r.bottom - r.top ) - ( c.bottom - c.top );
}
int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
HWND hwnd;
MSG msg;
int extra_width, extra_height;
// 재생창 생성하기
hwnd = CreatePlayerWindow(hInstance, hPrevInstance);
if(!hwnd)
{
MessageBox(NULL, "Error creating window.", WINDOW_TEXT, MB_OK | MB_ICONSTOP);
return 1;
}
CalcWindowBorder(hwnd, extra_width, extra_height);
CBandiVideoLibrary bvl;
CBandiVideoDevice* bvd = NULL;
CBandiVideoTexture* bvt = NULL;
BVL_VIDEO_INFO info;
if(FAILED(bvl.Create(BANDIVIDEO_DLL_FILE_NAME, NULL, NULL)))
{
MessageBox(NULL, "Error creating BandiVideoLibrary.", WINDOW_TEXT, MB_OK | MB_ICONSTOP);
DestroyWindow(hwnd);
return 2;
}
/* // verify
if(FAILED(bvl.Verify("BANDISOFT-TRIAL-200909", "ea92bc5b")))
{
// trial expired!!
ASSERT(0);
}*/
if(FAILED(bvl.Open(lpCmdLine, TRUE)))
{
MessageBox(NULL, "Error opening file....", WINDOW_TEXT, MB_OK | MB_ICONSTOP);
DestroyWindow(hwnd);
return 3;
}
// 비디오 크기에 맞춰 창크기 변경
SetWindowPos(hwnd, 0, 0, 0, MV_WIDTH+extra_width, MV_HEIGHT+extra_height, SWP_NOMOVE);
bvd = new CBandiVideoDevice_DX9();
if(!bvd || FAILED(bvd->Open(hwnd)))
{
MessageBox(NULL, "Error opening device...", WINDOW_TEXT, MB_OK | MB_ICONSTOP);
DestroyWindow(hwnd);
if(bvd) delete bvd;
return -1;
}
ShowWindow(hwnd, nCmdShow);
do
{
if(PeekMessage(&msg, 0, 0, 0, PM_REMOVE))
{
if(msg.message == WM_QUIT)
break;
TranslateMessage(&msg);
DispatchMessage(&msg);
}
else
{
BVL_STATUS status;
bvl.GetStatus(status);
if(status == BVL_STATUS_READY)
{
// 재생할 준비가 완료되었다면, 재생 시작
bvl.GetVideoInfo(info);
bvl.Play();
if(bvt == NULL)
{
bvt = new CBandiVideoTexture_DX9((CBandiVideoDevice_DX9*)bvd);
if(!bvt || FAILED(bvt->Open(info.width , info.height)))
{
if(bvt) delete bvt;
bvt = NULL;
}
}
}
else if(status == BVL_STATUS_PLAYEND)
{
// 끝까지 재생이 완료되었으면, 다시 열기
bvl.Close();
bvl.Open(lpCmdLine, TRUE);
}
else if(status == BVL_STATUS_ERROR)
{
MessageBox(NULL, "Error playing file...", WINDOW_TEXT, MB_OK | MB_ICONSTOP);
break;
}
// 새 프레임을 출력할 시간인가?
if(bvl.IsNextFrame())
{
INT pitch;
BYTE* buf = bvt->Lock(pitch);
if(buf)
{
// Get frame
BVL_FRAME frame;
frame.frame_buf = buf;
frame.frame_buf_size = info.height*pitch;
frame.pitch = pitch;
frame.width = info.width;
frame.height = info.height;
frame.pixel_format = bvt->GetFormat();
bvl.GetFrame(frame, TRUE);
bvt->Unlock();
// Show frame
bvd->StartFrame();
bvt->Draw(0, 0, MV_WIDTH, MV_HEIGHT);
bvd->EndFrame();
}
}
else
{
Sleep(1);
}
}
}
while(1);
bvl.Destroy();
if(bvd)
{
bvd->Close();
delete bvd;
}
if(bvt)
{
bvt->Close();
delete bvt;
}
return 0;
}
@@ -0,0 +1,365 @@
<?xml version="1.0" encoding="ks_c_5601-1987"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Name="AsyncPlayback"
ProjectGUID="{9905918E-5CD9-4698-B0C3-8CA1FD84CC13}"
RootNamespace="AsyncPlayback"
Keyword="Win32Proj"
TargetFrameworkVersion="196613"
>
<Platforms>
<Platform
Name="Win32"
/>
<Platform
Name="x64"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../../include, ../../source"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="d3d9.lib dsound.lib"
OutputFile="..\..\bin\$(ProjectName)_d.exe"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Debug|x64"
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../../include, ../../source"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="d3d9.lib dsound.lib"
OutputFile="..\..\bin\$(ProjectName)64_d.exe"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="2"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="2"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
EnableIntrinsicFunctions="true"
AdditionalIncludeDirectories="../../include, ../../source"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
RuntimeLibrary="0"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="d3d9.lib dsound.lib"
OutputFile="..\..\bin\$(ProjectName).exe"
LinkIncremental="1"
GenerateDebugInformation="true"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|x64"
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="2"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
EnableIntrinsicFunctions="true"
AdditionalIncludeDirectories="../../include, ../../source"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
RuntimeLibrary="0"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="d3d9.lib dsound.lib"
OutputFile="..\..\bin\$(ProjectName)64.exe"
LinkIncremental="1"
GenerateDebugInformation="true"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="main"
>
<File
RelativePath=".\AsyncPlayback.cpp"
>
</File>
</Filter>
<Filter
Name="bvl"
>
<File
RelativePath="..\..\source\BandiVideoLibrary.cpp"
>
</File>
<File
RelativePath="..\..\source\BandiVideoLibrary.h"
>
</File>
<File
RelativePath="..\..\source\BandiVideoTexture.h"
>
</File>
<File
RelativePath="..\..\source\BandiVideoTexture_DX9.cpp"
>
</File>
<File
RelativePath="..\..\source\BandiVideoTexture_DX9.h"
>
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>
@@ -0,0 +1,183 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{9905918E-5CD9-4698-B0C3-8CA1FD84CC13}</ProjectGuid>
<RootNamespace>AsyncPlayback</RootNamespace>
<Keyword>Win32Proj</Keyword>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Platform)\$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(Platform)\$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>../../include; ../../source;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
</ClCompile>
<Link>
<AdditionalDependencies>d3d9.lib;dsound.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>..\..\bin\$(ProjectName)_d.exe</OutputFile>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<TargetMachine>MachineX86</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Midl>
<TargetEnvironment>X64</TargetEnvironment>
</Midl>
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>../../include; ../../source;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Link>
<AdditionalDependencies>d3d9.lib;dsound.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>..\..\bin\$(ProjectName)64_d.exe</OutputFile>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<TargetMachine>MachineX64</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<Optimization>MaxSpeed</Optimization>
<IntrinsicFunctions>true</IntrinsicFunctions>
<AdditionalIncludeDirectories>../../include; ../../source;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Link>
<AdditionalDependencies>d3d9.lib;dsound.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>..\..\bin\$(ProjectName).exe</OutputFile>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<TargetMachine>MachineX86</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Midl>
<TargetEnvironment>X64</TargetEnvironment>
</Midl>
<ClCompile>
<Optimization>MaxSpeed</Optimization>
<IntrinsicFunctions>true</IntrinsicFunctions>
<AdditionalIncludeDirectories>../../include; ../../source;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Link>
<AdditionalDependencies>d3d9.lib;dsound.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>..\..\bin\$(ProjectName)64.exe</OutputFile>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<TargetMachine>MachineX64</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="AsyncPlayback.cpp" />
<ClCompile Include="..\..\source\BandiVideoLibrary.cpp" />
<ClCompile Include="..\..\source\BandiVideoTexture_DX9.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\source\BandiVideoLibrary.h" />
<ClInclude Include="..\..\source\BandiVideoTexture.h" />
<ClInclude Include="..\..\source\BandiVideoTexture_DX9.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="main">
<UniqueIdentifier>{79a6d450-f470-40a4-aacb-dab5f073d9fe}</UniqueIdentifier>
</Filter>
<Filter Include="bvl">
<UniqueIdentifier>{171483cd-ad35-4957-af45-d2505e55cc64}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="AsyncPlayback.cpp">
<Filter>main</Filter>
</ClCompile>
<ClCompile Include="..\..\source\BandiVideoLibrary.cpp">
<Filter>bvl</Filter>
</ClCompile>
<ClCompile Include="..\..\source\BandiVideoTexture_DX9.cpp">
<Filter>bvl</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\source\BandiVideoLibrary.h">
<Filter>bvl</Filter>
</ClInclude>
<ClInclude Include="..\..\source\BandiVideoTexture.h">
<Filter>bvl</Filter>
</ClInclude>
<ClInclude Include="..\..\source\BandiVideoTexture_DX9.h">
<Filter>bvl</Filter>
</ClInclude>
</ItemGroup>
</Project>
@@ -0,0 +1,365 @@
<?xml version="1.0" encoding="ks_c_5601-1987"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="AsyncPlayback"
ProjectGUID="{9905918E-5CD9-4698-B0C3-8CA1FD84CC13}"
RootNamespace="AsyncPlayback"
Keyword="Win32Proj"
TargetFrameworkVersion="196613"
>
<Platforms>
<Platform
Name="Win32"
/>
<Platform
Name="x64"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../../include, ../../source"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="d3d9.lib dsound.lib"
OutputFile="..\..\bin\$(ProjectName)_d.exe"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Debug|x64"
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../../include, ../../source"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="d3d9.lib dsound.lib"
OutputFile="..\..\bin\$(ProjectName)64_d.exe"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="2"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="2"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
EnableIntrinsicFunctions="true"
AdditionalIncludeDirectories="../../include, ../../source"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
RuntimeLibrary="0"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="d3d9.lib dsound.lib"
OutputFile="..\..\bin\$(ProjectName).exe"
LinkIncremental="1"
GenerateDebugInformation="true"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|x64"
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="2"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
EnableIntrinsicFunctions="true"
AdditionalIncludeDirectories="../../include, ../../source"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
RuntimeLibrary="0"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="d3d9.lib dsound.lib"
OutputFile="..\..\bin\$(ProjectName)64.exe"
LinkIncremental="1"
GenerateDebugInformation="true"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="main"
>
<File
RelativePath=".\AsyncPlayback.cpp"
>
</File>
</Filter>
<Filter
Name="bvl"
>
<File
RelativePath="..\..\source\BandiVideoLibrary.cpp"
>
</File>
<File
RelativePath="..\..\source\BandiVideoLibrary.h"
>
</File>
<File
RelativePath="..\..\source\BandiVideoTexture.h"
>
</File>
<File
RelativePath="..\..\source\BandiVideoTexture_DX9.cpp"
>
</File>
<File
RelativePath="..\..\source\BandiVideoTexture_DX9.h"
>
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>
File diff suppressed because it is too large. Load diff
Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

@@ -0,0 +1,150 @@
//Microsoft Visual C++ generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#ifndef APSTUDIO_INVOKED
#include "targetver.h"
#endif
#define APSTUDIO_HIDDEN_SYMBOLS
#include "windows.h"
#undef APSTUDIO_HIDDEN_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
LANGUAGE 9, 1
#pragma code_page(949)
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_BANDIVIDSAMPLE ICON "BandiVidSample.ico"
IDI_SMALL ICON "small.ico"
/////////////////////////////////////////////////////////////////////////////
//
// Menu
//
IDC_BANDIVIDSAMPLE MENU
BEGIN
POPUP "&File"
BEGIN
MENUITEM "E&xit", IDM_EXIT
END
POPUP "&Help"
BEGIN
MENUITEM "&About ...", IDM_ABOUT
END
END
/////////////////////////////////////////////////////////////////////////////
//
// Accelerator
//
IDC_BANDIVIDSAMPLE ACCELERATORS
BEGIN
"?", IDM_ABOUT, ASCII, ALT
"/", IDM_ABOUT, ASCII, ALT
END
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_ABOUTBOX DIALOGEX 0, 0, 170, 62
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "About BandiVidSample"
FONT 8, "MS Shell Dlg"
BEGIN
ICON IDR_MAINFRAME,IDC_STATIC,14,14,21,20
LTEXT "BandiVidSample, Version 1.0",IDC_STATIC,42,14,114,8,SS_NOPREFIX
LTEXT "Copyright (C) 2009",IDC_STATIC,42,26,114,8
DEFPUSHBUTTON "OK",IDOK,113,41,50,14,WS_GROUP
END
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO
BEGIN
IDD_ABOUTBOX, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 163
TOPMARGIN, 7
BOTTOMMARGIN, 55
END
END
#endif // APSTUDIO_INVOKED
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE
BEGIN
"#ifndef APSTUDIO_INVOKED\r\n"
"#include ""targetver.h""\r\n"
"#endif\r\n"
"#define APSTUDIO_HIDDEN_SYMBOLS\r\n"
"#include ""windows.h""\r\n"
"#undef APSTUDIO_HIDDEN_SYMBOLS\r\n"
"\0"
END
3 TEXTINCLUDE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// String Table
//
STRINGTABLE
BEGIN
IDC_BANDIVIDSAMPLE "BANDIVIDSAMPLE"
IDS_APP_TITLE "BandiVidSample"
END
#endif
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED
@@ -0,0 +1,26 @@
Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BandiVidSample", "BandiVidSample.vcxproj", "{4E71EE8D-57F4-4400-9109-E0C4A1F273D0}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Debug|x64 = Debug|x64
Release|Win32 = Release|Win32
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{4E71EE8D-57F4-4400-9109-E0C4A1F273D0}.Debug|Win32.ActiveCfg = Debug|Win32
{4E71EE8D-57F4-4400-9109-E0C4A1F273D0}.Debug|Win32.Build.0 = Debug|Win32
{4E71EE8D-57F4-4400-9109-E0C4A1F273D0}.Debug|x64.ActiveCfg = Debug|x64
{4E71EE8D-57F4-4400-9109-E0C4A1F273D0}.Debug|x64.Build.0 = Debug|x64
{4E71EE8D-57F4-4400-9109-E0C4A1F273D0}.Release|Win32.ActiveCfg = Release|Win32
{4E71EE8D-57F4-4400-9109-E0C4A1F273D0}.Release|Win32.Build.0 = Release|Win32
{4E71EE8D-57F4-4400-9109-E0C4A1F273D0}.Release|x64.ActiveCfg = Release|x64
{4E71EE8D-57F4-4400-9109-E0C4A1F273D0}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
@@ -0,0 +1,599 @@
<?xml version="1.0" encoding="ks_c_5601-1987"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Name="BandiVidSample"
ProjectGUID="{4E71EE8D-57F4-4400-9109-E0C4A1F273D0}"
RootNamespace="BandiVidSample"
Keyword="Win32Proj"
TargetFrameworkVersion="196613"
>
<Platforms>
<Platform
Name="Win32"
/>
<Platform
Name="x64"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
UseOfATL="1"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=".;./dxut;../../include,../../source"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="2"
WarningLevel="3"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
OutputFile="..\..\bin\$(ProjectName)_d.exe"
LinkIncremental="2"
AdditionalLibraryDirectories=""
GenerateDebugInformation="true"
SubSystem="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Debug|x64"
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="1"
UseOfATL="1"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=".;./dxut;../../include,../../source"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="2"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
OutputFile="..\..\bin\$(ProjectName)64_d.exe"
LinkIncremental="2"
AdditionalLibraryDirectories=""
GenerateDebugInformation="true"
SubSystem="2"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
UseOfATL="1"
CharacterSet="1"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
EnableIntrinsicFunctions="true"
AdditionalIncludeDirectories=".;./dxut;../../include,../../source"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
RuntimeLibrary="0"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="2"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
OutputFile="..\..\bin\$(ProjectName).exe"
LinkIncremental="1"
AdditionalLibraryDirectories=""
GenerateDebugInformation="true"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|x64"
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="1"
UseOfATL="1"
CharacterSet="1"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
EnableIntrinsicFunctions="true"
AdditionalIncludeDirectories=".;./dxut;../../include,../../source"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
RuntimeLibrary="0"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="2"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
OutputFile="..\..\bin\$(ProjectName)64.exe"
LinkIncremental="1"
AdditionalLibraryDirectories=""
GenerateDebugInformation="true"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
<File
RelativePath=".\BandiVidSample.ico"
>
</File>
<File
RelativePath=".\BandiVidSample.rc"
>
</File>
<File
RelativePath=".\Resource.h"
>
</File>
<File
RelativePath=".\small.ico"
>
</File>
</Filter>
<Filter
Name="default"
>
<File
RelativePath=".\stdafx.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="1"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="1"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="1"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="1"
/>
</FileConfiguration>
</File>
<File
RelativePath=".\stdafx.h"
>
</File>
<File
RelativePath=".\targetver.h"
>
</File>
</Filter>
<Filter
Name="main"
>
<File
RelativePath=".\BandiVidSample.cpp"
>
</File>
<File
RelativePath=".\VideoTest.cpp"
>
</File>
<File
RelativePath=".\VideoTest.h"
>
</File>
</Filter>
<Filter
Name="DXUT"
>
<File
RelativePath=".\DXUT\dxstdafx.cpp"
>
</File>
<File
RelativePath=".\DXUT\dxstdafx.h"
>
</File>
<File
RelativePath=".\DXUT\DXUT.cpp"
>
</File>
<File
RelativePath=".\DXUT\DXUT.h"
>
</File>
<File
RelativePath=".\DXUT\DXUTEffectMap.cpp"
>
</File>
<File
RelativePath=".\DXUT\DXUTEffectMap.h"
>
</File>
<File
RelativePath=".\DXUT\DXUTenum.cpp"
>
</File>
<File
RelativePath=".\DXUT\DXUTenum.h"
>
</File>
<File
RelativePath=".\DXUT\DXUTgui.cpp"
>
</File>
<File
RelativePath=".\DXUT\DXUTgui.h"
>
</File>
<File
RelativePath=".\DXUT\DXUTMesh.cpp"
>
</File>
<File
RelativePath=".\DXUT\DXUTMesh.h"
>
</File>
<File
RelativePath=".\DXUT\DXUTmisc.cpp"
>
</File>
<File
RelativePath=".\DXUT\DXUTmisc.h"
>
</File>
<File
RelativePath=".\DXUT\DXUTsettingsdlg.cpp"
>
</File>
<File
RelativePath=".\DXUT\DXUTsettingsdlg.h"
>
</File>
<File
RelativePath=".\DXUT\DXUTsound.cpp"
>
</File>
<File
RelativePath=".\DXUT\DXUTsound.h"
>
</File>
<File
RelativePath=".\DXUT\SDKmesh.cpp"
>
</File>
<File
RelativePath=".\DXUT\SDKmesh.h"
>
</File>
</Filter>
<Filter
Name="bvl"
>
<File
RelativePath="..\..\source\BandiVideoLibrary.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\source\BandiVideoLibrary.h"
>
</File>
<File
RelativePath="..\..\source\BandiVideoTexture.h"
>
</File>
<File
RelativePath="..\..\source\BandiVideoTexture_DX9.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\source\BandiVideoTexture_DX9.h"
>
</File>
</Filter>
<File
RelativePath=".\ReadMe.txt"
>
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>
@@ -0,0 +1,241 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{4E71EE8D-57F4-4400-9109-E0C4A1F273D0}</ProjectGuid>
<RootNamespace>BandiVidSample</RootNamespace>
<Keyword>Win32Proj</Keyword>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseOfAtl>Static</UseOfAtl>
<CharacterSet>Unicode</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseOfAtl>Static</UseOfAtl>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseOfAtl>Static</UseOfAtl>
<CharacterSet>Unicode</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseOfAtl>Static</UseOfAtl>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Platform)\$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(Platform)\$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental>
<IncludePath Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(WindowsSdkDir)include;$(DXSDK_DIR)include;$(IncludePath)</IncludePath>
<LibraryPath Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(DXSDK_DIR)Lib\x86;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>.;./dxut;../../include;../../source;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
</ClCompile>
<Link>
<OutputFile>..\..\bin\$(ProjectName)_d.exe</OutputFile>
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<TargetMachine>MachineX86</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Midl>
<TargetEnvironment>X64</TargetEnvironment>
</Midl>
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>.;./dxut;../../include;../../source;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Link>
<OutputFile>..\..\bin\$(ProjectName)64_d.exe</OutputFile>
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<TargetMachine>MachineX64</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<Optimization>MaxSpeed</Optimization>
<IntrinsicFunctions>true</IntrinsicFunctions>
<AdditionalIncludeDirectories>.;./dxut;../../include;../../source;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Link>
<OutputFile>$(SolutionDir)$(Configuration)\BandiVidSample.exe</OutputFile>
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<TargetMachine>MachineX86</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Midl>
<TargetEnvironment>X64</TargetEnvironment>
</Midl>
<ClCompile>
<Optimization>MaxSpeed</Optimization>
<IntrinsicFunctions>true</IntrinsicFunctions>
<AdditionalIncludeDirectories>.;./dxut;../../include;../../source;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Link>
<OutputFile>..\..\bin\$(ProjectName)64.exe</OutputFile>
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<TargetMachine>MachineX64</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<None Include="BandiVidSample.ico" />
<None Include="small.ico" />
<None Include="ReadMe.txt" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="BandiVidSample.rc" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="Resource.h" />
<ClInclude Include="stdafx.h" />
<ClInclude Include="targetver.h" />
<ClInclude Include="VideoTest.h" />
<ClInclude Include="DXUT\dxstdafx.h" />
<ClInclude Include="DXUT\DXUT.h" />
<ClInclude Include="DXUT\DXUTEffectMap.h" />
<ClInclude Include="DXUT\DXUTenum.h" />
<ClInclude Include="DXUT\DXUTgui.h" />
<ClInclude Include="DXUT\DXUTMesh.h" />
<ClInclude Include="DXUT\DXUTmisc.h" />
<ClInclude Include="DXUT\DXUTsettingsdlg.h" />
<ClInclude Include="DXUT\DXUTsound.h" />
<ClInclude Include="DXUT\SDKmesh.h" />
<ClInclude Include="..\..\source\BandiVideoLibrary.h" />
<ClInclude Include="..\..\source\BandiVideoTexture.h" />
<ClInclude Include="..\..\source\BandiVideoTexture_DX9.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="stdafx.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
</ClCompile>
<ClCompile Include="BandiVidSample.cpp" />
<ClCompile Include="VideoTest.cpp" />
<ClCompile Include="DXUT\dxstdafx.cpp" />
<ClCompile Include="DXUT\DXUT.cpp" />
<ClCompile Include="DXUT\DXUTEffectMap.cpp" />
<ClCompile Include="DXUT\DXUTenum.cpp" />
<ClCompile Include="DXUT\DXUTgui.cpp" />
<ClCompile Include="DXUT\DXUTMesh.cpp" />
<ClCompile Include="DXUT\DXUTmisc.cpp" />
<ClCompile Include="DXUT\DXUTsettingsdlg.cpp" />
<ClCompile Include="DXUT\DXUTsound.cpp" />
<ClCompile Include="DXUT\SDKmesh.cpp" />
<ClCompile Include="..\..\source\BandiVideoLibrary.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
</PrecompiledHeader>
</ClCompile>
<ClCompile Include="..\..\source\BandiVideoTexture_DX9.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
</PrecompiledHeader>
</ClCompile>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
@@ -0,0 +1,135 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions>
</Filter>
<Filter Include="default">
<UniqueIdentifier>{1a09e89f-b061-4f8e-a9c2-2d81e029087c}</UniqueIdentifier>
</Filter>
<Filter Include="main">
<UniqueIdentifier>{5b234827-d2df-40d3-828d-da21b4183520}</UniqueIdentifier>
</Filter>
<Filter Include="DXUT">
<UniqueIdentifier>{e8a2c620-9eab-4ae3-9d4c-f8df5e0d7760}</UniqueIdentifier>
</Filter>
<Filter Include="bvl">
<UniqueIdentifier>{def60c92-5f53-40f4-acd7-841c8812cf96}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<None Include="BandiVidSample.ico">
<Filter>Resource Files</Filter>
</None>
<None Include="small.ico">
<Filter>Resource Files</Filter>
</None>
<None Include="ReadMe.txt" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="BandiVidSample.rc">
<Filter>Resource Files</Filter>
</ResourceCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="Resource.h">
<Filter>Resource Files</Filter>
</ClInclude>
<ClInclude Include="stdafx.h">
<Filter>default</Filter>
</ClInclude>
<ClInclude Include="targetver.h">
<Filter>default</Filter>
</ClInclude>
<ClInclude Include="VideoTest.h">
<Filter>main</Filter>
</ClInclude>
<ClInclude Include="DXUT\dxstdafx.h">
<Filter>DXUT</Filter>
</ClInclude>
<ClInclude Include="DXUT\DXUT.h">
<Filter>DXUT</Filter>
</ClInclude>
<ClInclude Include="DXUT\DXUTEffectMap.h">
<Filter>DXUT</Filter>
</ClInclude>
<ClInclude Include="DXUT\DXUTenum.h">
<Filter>DXUT</Filter>
</ClInclude>
<ClInclude Include="DXUT\DXUTgui.h">
<Filter>DXUT</Filter>
</ClInclude>
<ClInclude Include="DXUT\DXUTMesh.h">
<Filter>DXUT</Filter>
</ClInclude>
<ClInclude Include="DXUT\DXUTmisc.h">
<Filter>DXUT</Filter>
</ClInclude>
<ClInclude Include="DXUT\DXUTsettingsdlg.h">
<Filter>DXUT</Filter>
</ClInclude>
<ClInclude Include="DXUT\DXUTsound.h">
<Filter>DXUT</Filter>
</ClInclude>
<ClInclude Include="DXUT\SDKmesh.h">
<Filter>DXUT</Filter>
</ClInclude>
<ClInclude Include="..\..\source\BandiVideoLibrary.h">
<Filter>bvl</Filter>
</ClInclude>
<ClInclude Include="..\..\source\BandiVideoTexture.h">
<Filter>bvl</Filter>
</ClInclude>
<ClInclude Include="..\..\source\BandiVideoTexture_DX9.h">
<Filter>bvl</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="stdafx.cpp">
<Filter>default</Filter>
</ClCompile>
<ClCompile Include="BandiVidSample.cpp">
<Filter>main</Filter>
</ClCompile>
<ClCompile Include="VideoTest.cpp">
<Filter>main</Filter>
</ClCompile>
<ClCompile Include="DXUT\dxstdafx.cpp">
<Filter>DXUT</Filter>
</ClCompile>
<ClCompile Include="DXUT\DXUT.cpp">
<Filter>DXUT</Filter>
</ClCompile>
<ClCompile Include="DXUT\DXUTEffectMap.cpp">
<Filter>DXUT</Filter>
</ClCompile>
<ClCompile Include="DXUT\DXUTenum.cpp">
<Filter>DXUT</Filter>
</ClCompile>
<ClCompile Include="DXUT\DXUTgui.cpp">
<Filter>DXUT</Filter>
</ClCompile>
<ClCompile Include="DXUT\DXUTMesh.cpp">
<Filter>DXUT</Filter>
</ClCompile>
<ClCompile Include="DXUT\DXUTmisc.cpp">
<Filter>DXUT</Filter>
</ClCompile>
<ClCompile Include="DXUT\DXUTsettingsdlg.cpp">
<Filter>DXUT</Filter>
</ClCompile>
<ClCompile Include="DXUT\DXUTsound.cpp">
<Filter>DXUT</Filter>
</ClCompile>
<ClCompile Include="DXUT\SDKmesh.cpp">
<Filter>DXUT</Filter>
</ClCompile>
<ClCompile Include="..\..\source\BandiVideoLibrary.cpp">
<Filter>bvl</Filter>
</ClCompile>
<ClCompile Include="..\..\source\BandiVideoTexture_DX9.cpp">
<Filter>bvl</Filter>
</ClCompile>
</ItemGroup>
</Project>
@@ -0,0 +1,599 @@
<?xml version="1.0" encoding="ks_c_5601-1987"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="BandiVidSample"
ProjectGUID="{4E71EE8D-57F4-4400-9109-E0C4A1F273D0}"
RootNamespace="BandiVidSample"
Keyword="Win32Proj"
TargetFrameworkVersion="196613"
>
<Platforms>
<Platform
Name="Win32"
/>
<Platform
Name="x64"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
UseOfATL="1"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=".;./dxut;../../include,../../source"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="2"
WarningLevel="3"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
OutputFile="..\..\bin\$(ProjectName)_d.exe"
LinkIncremental="2"
AdditionalLibraryDirectories=""
GenerateDebugInformation="true"
SubSystem="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Debug|x64"
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="1"
UseOfATL="1"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=".;./dxut;../../include,../../source"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="2"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
OutputFile="..\..\bin\$(ProjectName)64_d.exe"
LinkIncremental="2"
AdditionalLibraryDirectories=""
GenerateDebugInformation="true"
SubSystem="2"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
UseOfATL="1"
CharacterSet="1"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
EnableIntrinsicFunctions="true"
AdditionalIncludeDirectories=".;./dxut;../../include,../../source"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
RuntimeLibrary="0"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="2"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
OutputFile="..\..\bin\$(ProjectName).exe"
LinkIncremental="1"
AdditionalLibraryDirectories=""
GenerateDebugInformation="true"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|x64"
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="1"
UseOfATL="1"
CharacterSet="1"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
EnableIntrinsicFunctions="true"
AdditionalIncludeDirectories=".;./dxut;../../include,../../source"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
RuntimeLibrary="0"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="2"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
OutputFile="..\..\bin\$(ProjectName)64.exe"
LinkIncremental="1"
AdditionalLibraryDirectories=""
GenerateDebugInformation="true"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
<File
RelativePath=".\BandiVidSample.ico"
>
</File>
<File
RelativePath=".\BandiVidSample.rc"
>
</File>
<File
RelativePath=".\Resource.h"
>
</File>
<File
RelativePath=".\small.ico"
>
</File>
</Filter>
<Filter
Name="default"
>
<File
RelativePath=".\stdafx.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="1"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="1"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="1"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="1"
/>
</FileConfiguration>
</File>
<File
RelativePath=".\stdafx.h"
>
</File>
<File
RelativePath=".\targetver.h"
>
</File>
</Filter>
<Filter
Name="main"
>
<File
RelativePath=".\BandiVidSample.cpp"
>
</File>
<File
RelativePath=".\VideoTest.cpp"
>
</File>
<File
RelativePath=".\VideoTest.h"
>
</File>
</Filter>
<Filter
Name="DXUT"
>
<File
RelativePath=".\DXUT\dxstdafx.cpp"
>
</File>
<File
RelativePath=".\DXUT\dxstdafx.h"
>
</File>
<File
RelativePath=".\DXUT\DXUT.cpp"
>
</File>
<File
RelativePath=".\DXUT\DXUT.h"
>
</File>
<File
RelativePath=".\DXUT\DXUTEffectMap.cpp"
>
</File>
<File
RelativePath=".\DXUT\DXUTEffectMap.h"
>
</File>
<File
RelativePath=".\DXUT\DXUTenum.cpp"
>
</File>
<File
RelativePath=".\DXUT\DXUTenum.h"
>
</File>
<File
RelativePath=".\DXUT\DXUTgui.cpp"
>
</File>
<File
RelativePath=".\DXUT\DXUTgui.h"
>
</File>
<File
RelativePath=".\DXUT\DXUTMesh.cpp"
>
</File>
<File
RelativePath=".\DXUT\DXUTMesh.h"
>
</File>
<File
RelativePath=".\DXUT\DXUTmisc.cpp"
>
</File>
<File
RelativePath=".\DXUT\DXUTmisc.h"
>
</File>
<File
RelativePath=".\DXUT\DXUTsettingsdlg.cpp"
>
</File>
<File
RelativePath=".\DXUT\DXUTsettingsdlg.h"
>
</File>
<File
RelativePath=".\DXUT\DXUTsound.cpp"
>
</File>
<File
RelativePath=".\DXUT\DXUTsound.h"
>
</File>
<File
RelativePath=".\DXUT\SDKmesh.cpp"
>
</File>
<File
RelativePath=".\DXUT\SDKmesh.h"
>
</File>
</Filter>
<Filter
Name="bvl"
>
<File
RelativePath="..\..\source\BandiVideoLibrary.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\source\BandiVideoLibrary.h"
>
</File>
<File
RelativePath="..\..\source\BandiVideoTexture.h"
>
</File>
<File
RelativePath="..\..\source\BandiVideoTexture_DX9.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\source\BandiVideoTexture_DX9.h"
>
</File>
</Filter>
<File
RelativePath=".\ReadMe.txt"
>
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,189 @@
//--------------------------------------------------------------------------------------
// File: DXUT.h
//
// DirectX SDK Direct3D sample framework
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//--------------------------------------------------------------------------------------
#pragma once
#ifndef DXUT_H
#define DXUT_H
#ifndef UNICODE
#error "The sample framework requires a Unicode build. If you are using Microsoft Visual C++ .NET, under the General tab of the project properties change the Character Set to 'Use Unicode Character Set'."
#endif
//--------------------------------------------------------------------------------------
// Structs
//--------------------------------------------------------------------------------------
class CD3DEnumeration;
class CD3DSettingsDlg;
struct DXUTDeviceSettings
{
UINT AdapterOrdinal;
D3DDEVTYPE DeviceType;
D3DFORMAT AdapterFormat;
DWORD BehaviorFlags;
D3DPRESENT_PARAMETERS pp;
};
//--------------------------------------------------------------------------------------
// Error codes
//--------------------------------------------------------------------------------------
#define DXUTERR_NODIRECT3D MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x0901)
#define DXUTERR_NOCOMPATIBLEDEVICES MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x0902)
#define DXUTERR_MEDIANOTFOUND MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x0903)
#define DXUTERR_NONZEROREFCOUNT MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x0904)
#define DXUTERR_CREATINGDEVICE MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x0905)
#define DXUTERR_RESETTINGDEVICE MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x0906)
#define DXUTERR_CREATINGDEVICEOBJECTS MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x0907)
#define DXUTERR_RESETTINGDEVICEOBJECTS MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x0908)
#define DXUTERR_INCORRECTVERSION MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x0909)
//--------------------------------------------------------------------------------------
// Callback registration
//--------------------------------------------------------------------------------------
typedef bool (CALLBACK *LPDXUTCALLBACKISDEVICEACCEPTABLE)( D3DCAPS9* pCaps, D3DFORMAT AdapterFormat, D3DFORMAT BackBufferFormat, bool bWindowed );
typedef void (CALLBACK *LPDXUTCALLBACKMODIFYDEVICESETTINGS)( DXUTDeviceSettings* pDeviceSettings, const D3DCAPS9* pCaps );
typedef HRESULT (CALLBACK *LPDXUTCALLBACKDEVICECREATED)( IDirect3DDevice9* pd3dDevice, const D3DSURFACE_DESC* pBackBufferSurfaceDesc );
typedef HRESULT (CALLBACK *LPDXUTCALLBACKDEVICERESET)( IDirect3DDevice9* pd3dDevice, const D3DSURFACE_DESC* pBackBufferSurfaceDesc );
typedef void (CALLBACK *LPDXUTCALLBACKDEVICEDESTROYED)();
typedef void (CALLBACK *LPDXUTCALLBACKDEVICELOST)();
typedef void (CALLBACK *LPDXUTCALLBACKFRAMEMOVE)( IDirect3DDevice9* pd3dDevice, double fTime, float fElapsedTime );
typedef void (CALLBACK *LPDXUTCALLBACKFRAMERENDER)( IDirect3DDevice9* pd3dDevice, double fTime, float fElapsedTime );
typedef void (CALLBACK *LPDXUTCALLBACKKEYBOARD)( UINT nChar, bool bKeyDown, bool bAltDown );
typedef void (CALLBACK *LPDXUTCALLBACKMOUSE)( bool bLeftButtonDown, bool bRightButtonDown, bool bMiddleButtonDown, bool bSideButton1Down, bool bSideButton2Down, int nMouseWheelDelta, int xPos, int yPos );
typedef LRESULT (CALLBACK *LPDXUTCALLBACKMSGPROC)( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, bool* pbNoFurtherProcessing );
typedef void (CALLBACK *LPDXUTCALLBACKTIMER)( UINT idEvent );
// Device callbacks
void DXUTSetCallbackDeviceCreated( LPDXUTCALLBACKDEVICECREATED pCallbackDeviceCreated );
void DXUTSetCallbackDeviceReset( LPDXUTCALLBACKDEVICERESET pCallbackDeviceReset );
void DXUTSetCallbackDeviceLost( LPDXUTCALLBACKDEVICELOST pCallbackDeviceLost );
void DXUTSetCallbackDeviceDestroyed( LPDXUTCALLBACKDEVICEDESTROYED pCallbackDeviceDestroyed );
// Frame callbacks
void DXUTSetCallbackFrameMove( LPDXUTCALLBACKFRAMEMOVE pCallbackFrameMove );
void DXUTSetCallbackFrameRender( LPDXUTCALLBACKFRAMERENDER pCallbackFrameRender );
// Message callbacks
void DXUTSetCallbackKeyboard( LPDXUTCALLBACKKEYBOARD pCallbackKeyboard );
void DXUTSetCallbackMouse( LPDXUTCALLBACKMOUSE pCallbackMouse, bool bIncludeMouseMove = false );
void DXUTSetCallbackMsgProc( LPDXUTCALLBACKMSGPROC pCallbackMsgProc );
//--------------------------------------------------------------------------------------
// Initialization
//--------------------------------------------------------------------------------------
HRESULT DXUTInit( bool bParseCommandLine = true, bool bHandleDefaultHotkeys = true, bool bShowMsgBoxOnError = true );
// Choose either DXUTCreateWindow or DXUTSetWindow. If using DXUTSetWindow, consider using DXUTStaticWndProc
HRESULT DXUTCreateWindow( const WCHAR* strWindowTitle = L"Direct3D Window",
HINSTANCE hInstance = NULL, HICON hIcon = NULL, HMENU hMenu = NULL,
int x = CW_USEDEFAULT, int y = CW_USEDEFAULT );
HRESULT DXUTSetWindow( HWND hWndFocus, HWND hWndDeviceFullScreen, HWND hWndDeviceWindowed, bool bHandleMessages = true );
LRESULT CALLBACK DXUTStaticWndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam );
// Choose either DXUTCreateDevice or DXUTSetDevice or DXUTCreateDeviceFromSettings
HRESULT DXUTCreateDevice( UINT AdapterOrdinal = D3DADAPTER_DEFAULT, bool bWindowed = true,
int nSuggestedWidth = 640, int nSuggestedHeight = 480,
LPDXUTCALLBACKISDEVICEACCEPTABLE pCallbackIsDeviceAcceptable = NULL,
LPDXUTCALLBACKMODIFYDEVICESETTINGS pCallbackModifyDeviceSettings = NULL );
HRESULT DXUTCreateDeviceFromSettings( DXUTDeviceSettings* pDeviceSettings, bool bPreserveInput = false );
HRESULT DXUTSetDevice( IDirect3DDevice9* pd3dDevice );
// Choose either DXUTMainLoop or implement your own main loop
HRESULT DXUTMainLoop( HACCEL hAccel = NULL );
// If not using DXUTMainLoop consider using DXUTRender3DEnvironment
void DXUTRender3DEnvironment();
//--------------------------------------------------------------------------------------
// Finding valid device settings
//--------------------------------------------------------------------------------------
enum DXUT_MATCH_TYPE
{
DXUTMT_IGNORE_INPUT = 0, // Use the closest valid value to a default
DXUTMT_PRESERVE_INPUT, // Use input without change, but may cause no valid device to be found
DXUTMT_CLOSEST_TO_INPUT // Use the closest valid value to the input
};
struct DXUTMatchOptions
{
DXUT_MATCH_TYPE eAdapterOrdinal;
DXUT_MATCH_TYPE eDeviceType;
DXUT_MATCH_TYPE eWindowed;
DXUT_MATCH_TYPE eAdapterFormat;
DXUT_MATCH_TYPE eVertexProcessing;
DXUT_MATCH_TYPE eResolution;
DXUT_MATCH_TYPE eBackBufferFormat;
DXUT_MATCH_TYPE eBackBufferCount;
DXUT_MATCH_TYPE eMultiSample;
DXUT_MATCH_TYPE eSwapEffect;
DXUT_MATCH_TYPE eDepthFormat;
DXUT_MATCH_TYPE eStencilFormat;
DXUT_MATCH_TYPE ePresentFlags;
DXUT_MATCH_TYPE eRefreshRate;
DXUT_MATCH_TYPE ePresentInterval;
};
HRESULT DXUTFindValidDeviceSettings( DXUTDeviceSettings* pOut, DXUTDeviceSettings* pIn = NULL, DXUTMatchOptions* pMatchOptions = NULL );
//--------------------------------------------------------------------------------------
// Common Tasks
//--------------------------------------------------------------------------------------
void DXUTSetCursorSettings( bool bShowCursorWhenFullScreen, bool bClipCursorWhenFullScreen );
void DXUTSetMultimonSettings( bool bAutoChangeAdapter );
void DXUTSetShortcutKeySettings( bool bAllowWhenFullscreen = false, bool bAllowWhenWindowed = true ); // Controls the Windows key, and accessibility shortcut keys
void DXUTSetConstantFrameTime( bool bConstantFrameTime, float fTimePerFrame = 0.0333f );
void DXUTSetShowSettingsDialog( bool bShow );
HRESULT DXUTSetTimer( LPDXUTCALLBACKTIMER pCallbackTimer, float fTimeoutInSecs = 1.0f, UINT* pnIDEvent = NULL );
HRESULT DXUTKillTimer( UINT nIDEvent );
HRESULT DXUTToggleFullScreen();
HRESULT DXUTToggleREF();
void DXUTPause( bool bPauseTime, bool bPauseRendering );
void DXUTResetFrameworkState();
void DXUTShutdown();
//--------------------------------------------------------------------------------------
// State Retrieval
//--------------------------------------------------------------------------------------
IDirect3D9* DXUTGetD3DObject(); // Does not addref unlike typical Get* APIs
IDirect3DDevice9* DXUTGetD3DDevice(); // Does not addref unlike typical Get* APIs
DXUTDeviceSettings DXUTGetDeviceSettings();
D3DPRESENT_PARAMETERS DXUTGetPresentParameters();
const D3DSURFACE_DESC* DXUTGetBackBufferSurfaceDesc();
const D3DCAPS9* DXUTGetDeviceCaps();
HWND DXUTGetHWND();
HWND DXUTGetHWNDFocus();
HWND DXUTGetHWNDDeviceFullScreen();
HWND DXUTGetHWNDDeviceWindowed();
const RECT& DXUTGetWindowClientRect();
double DXUTGetTime();
float DXUTGetElapsedTime();
bool DXUTIsWindowed();
float DXUTGetFPS();
LPCWSTR DXUTGetWindowTitle();
LPCWSTR DXUTGetFrameStats();
LPCWSTR DXUTGetDeviceStats();
bool DXUTGetShowSettingsDialog();
bool DXUTIsRenderingPaused();
bool DXUTIsTimePaused();
int DXUTGetExitCode();
bool DXUTIsKeyDown( BYTE vKey ); // Pass a virtual-key code, ex. VK_F1, 'A', VK_RETURN, VK_LSHIFT, etc
bool DXUTIsMouseButtonDown( BYTE vButton ); // Pass a virtual-key code: VK_LBUTTON, VK_RBUTTON, VK_MBUTTON, VK_XBUTTON1, VK_XBUTTON2
#endif
@@ -0,0 +1,544 @@
//-----------------------------------------------------------------------------
// File: DXUTEffectMap.cpp
//
// Desc: Maps the set of standard semantics and annotations to a collection
// of ID3DXEffect objects.
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------------------------
#include "stdafx.h"
#include "dxstdafx.h"
//-------------------------------------------------------------------------------------
DXUT_SEMANTIC CDXUTEffectMap::StringToSemantic( const char* cstrSemantic )
{
char strSemantic[MAX_PATH+1] = {0};
RemoveTrailingNumber( strSemantic, MAX_PATH, cstrSemantic );
if( StringEquals( strSemantic, "Diffuse" ) ) return DXUT_Diffuse;
if( StringEquals( strSemantic, "Specular" ) ) return DXUT_Specular;
if( StringEquals( strSemantic, "Ambient" ) ) return DXUT_Ambient;
if( StringEquals( strSemantic, "SpecularPower" ) ) return DXUT_SpecularPower;
if( StringEquals( strSemantic, "Emissive" ) ) return DXUT_Emissive;
if( StringEquals( strSemantic, "Normal" ) ) return DXUT_Normal;
if( StringEquals( strSemantic, "Height" ) ) return DXUT_Height;
if( StringEquals( strSemantic, "Refraction" ) ) return DXUT_Refraction;
if( StringEquals( strSemantic, "Opacity" ) ) return DXUT_Opacity;
if( StringEquals( strSemantic, "Environment" ) ) return DXUT_Environment;
if( StringEquals( strSemantic, "EnvironmentNormal" ) ) return DXUT_EnvironmentNormal;
if( StringEquals( strSemantic, "Fresnel" ) ) return DXUT_Fresnel;
if( StringEquals( strSemantic, "World" ) ) return DXUT_World;
if( StringEquals( strSemantic, "WorldInverse" ) ) return DXUT_WorldInverse;
if( StringEquals( strSemantic, "WorldInverseTranspose" ) ) return DXUT_WorldInverseTranspose;
if( StringEquals( strSemantic, "WorldView" ) ) return DXUT_WorldView;
if( StringEquals( strSemantic, "WorldViewInverse" ) ) return DXUT_WorldViewInverse;
if( StringEquals( strSemantic, "WorldViewInverseTranspose" ) ) return DXUT_WorldViewInverseTranspose;
if( StringEquals( strSemantic, "WorldViewProjection" ) ) return DXUT_WorldViewProjection;
if( StringEquals( strSemantic, "WorldViewProjectionInverse" ) ) return DXUT_WorldViewProjectionInverse;
if( StringEquals( strSemantic, "WorldViewProjectionInverseTranspose" ) ) return DXUT_WorldViewProjectionInverseTranspose;
if( StringEquals( strSemantic, "View" ) ) return DXUT_View;
if( StringEquals( strSemantic, "ViewInverse" ) ) return DXUT_ViewInverse;
if( StringEquals( strSemantic, "ViewInverseTranspose" ) ) return DXUT_ViewInverseTranspose;
if( StringEquals( strSemantic, "ViewProjection" ) ) return DXUT_ViewProjection;
if( StringEquals( strSemantic, "ViewProjectionInverse" ) ) return DXUT_ViewProjectionInverse;
if( StringEquals( strSemantic, "ViewProjectionInverseTranspose" ) ) return DXUT_ViewProjectionInverseTranspose;
if( StringEquals( strSemantic, "Projection" ) ) return DXUT_Projection;
if( StringEquals( strSemantic, "ProjectionInverse" ) ) return DXUT_ProjectionInverse;
if( StringEquals( strSemantic, "ProjectionInverseTranspose" ) ) return DXUT_ProjectionInverseTranspose;
if( StringEquals( strSemantic, "RenderTargetDimensions" ) ) return DXUT_RenderTargetDimensions;
if( StringEquals( strSemantic, "RenderTargetClipping" ) ) return DXUT_RenderTargetClipping;
if( StringEquals( strSemantic, "Time" ) ) return DXUT_Time;
if( StringEquals( strSemantic, "LastTime" ) ) return DXUT_LastTime;
if( StringEquals( strSemantic, "ElapsedTime" ) ) return DXUT_ElapsedTime;
if( StringEquals( strSemantic, "Position" ) ) return DXUT_Position;
if( StringEquals( strSemantic, "Direction" ) ) return DXUT_Direction;
if( StringEquals( strSemantic, "BoundingCenter" ) ) return DXUT_BoundingCenter;
if( StringEquals( strSemantic, "BoundingSphereSize" ) ) return DXUT_BoundingSphereSize;
if( StringEquals( strSemantic, "BoundingSphereMin" ) ) return DXUT_BoundingSphereMin;
if( StringEquals( strSemantic, "BoundingSphereMax" ) ) return DXUT_BoundingSphereMax;
if( StringEquals( strSemantic, "BoundingBoxSize" ) ) return DXUT_BoundingBoxSize;
if( StringEquals( strSemantic, "BoundingBoxMin" ) ) return DXUT_BoundingBoxMin;
if( StringEquals( strSemantic, "BoundingBoxMax" ) ) return DXUT_BoundingBoxMax;
if( StringEquals( strSemantic, "Attenuation" ) ) return DXUT_Attenuation;
if( StringEquals( strSemantic, "RenderColorTarget" ) ) return DXUT_RenderColorTarget;
if( StringEquals( strSemantic, "RenderDepthStencilTarget" ) ) return DXUT_RenderDepthStencilTarget;
if( StringEquals( strSemantic, "UnitsScale" ) ) return DXUT_UnitsScale;
if( StringEquals( strSemantic, "StandardsGlobal" ) ) return DXUT_StandardsGlobal;
return DXUT_UNKNOWN_SEMANTIC;
}
//-------------------------------------------------------------------------------------
DXUT_SEMANTIC CDXUTEffectMap::StringToSemantic( const WCHAR* strSemantic )
{
char cstr[MAX_PATH+1] = {0};
WideCharToMultiByte( CP_ACP, 0, strSemantic, -1, cstr, MAX_PATH, NULL, NULL );
return StringToSemantic( cstr );
}
//-------------------------------------------------------------------------------------
DXUT_OBJECT CDXUTEffectMap::StringToObject( const char* cstrObject )
{
char strObject[MAX_PATH+1] = {0};
RemoveTrailingNumber( strObject, MAX_PATH, cstrObject );
if( StringEquals( strObject, "Geometry" ) ) return DXUT_Geometry;
if( StringEquals( strObject, "Light" ) ) return DXUT_Light;
if( StringEquals( strObject, "Camera" ) ) return DXUT_Camera;
if( StringEquals( strObject, "Frame" ) ) return DXUT_Frame;
return DXUT_UNKNOWN_OBJECT;
}
//-------------------------------------------------------------------------------------
DXUT_OBJECT CDXUTEffectMap::StringToObject( const WCHAR* strObject )
{
char cstr[MAX_PATH+1] = {0};
WideCharToMultiByte( CP_ACP, 0, strObject, -1, cstr, MAX_PATH, NULL, NULL );
return StringToObject( cstr );
}
//-------------------------------------------------------------------------------------
VOID CDXUTEffectMap::Reset()
{
D3DXMatrixIdentity( &m_matWorld );
D3DXMatrixIdentity( &m_matView );
D3DXMatrixIdentity( &m_matProjection );
// Reset all the stored parameter lists
for( UINT iSemantic = 0; iSemantic < NUM_DXUT_SEMANTICS; iSemantic++ )
{
for( UINT iObject = 0; iObject < NUM_DXUT_OBJECTS; iObject++ )
{
for( UINT iIndex = 0; iIndex < MAX_INDEX; iIndex++ )
{
CGrowableArray<ParamList>* pBinding = &m_Bindings[ iSemantic ][ iObject ][ iIndex ];
// Clear nested arrays first
for( int iParamList = 0; iParamList < pBinding->GetSize(); iParamList++ )
{
pBinding->GetAt( iParamList ).Reset();
}
// Remove all the bound parameter lists
pBinding->RemoveAll();
}
}
}
}
//-------------------------------------------------------------------------------------
HRESULT CDXUTEffectMap::SetStandardParameter( const WCHAR* strSemantic,
const WCHAR* strObject,
DWORD dwObjectIndex,
float* pData,
DWORD dwDataLen,
const WCHAR* strType,
const WCHAR* strUnits,
const WCHAR* strSpace )
{
// Map the semantic to the standard set
DXUT_SEMANTIC eSemantic = StringToSemantic( strSemantic );
if( eSemantic == DXUT_UNKNOWN_SEMANTIC )
return E_FAIL;
// Map the object to the standard set
DXUT_OBJECT eObject = StringToObject( strObject );
if( eObject == DXUT_UNKNOWN_OBJECT )
return E_FAIL;
return SetStandardParameter( eSemantic, eObject, dwObjectIndex, pData, dwDataLen, strType, strUnits, strSpace );
}
//-------------------------------------------------------------------------------------
HRESULT CDXUTEffectMap::SetStandardParameter( DXUT_SEMANTIC eSemantic,
DXUT_OBJECT eObject,
DWORD dwObjectIndex,
float* pData,
DWORD dwDataLen,
const WCHAR* strType,
const WCHAR* strUnits,
const WCHAR* strSpace )
{
HRESULT hr;
// TODO: remove index limits
if( dwObjectIndex >= MAX_INDEX )
return E_INVALIDARG;
// TODO: handle unit and space conversions
// Retrieve the interested handles
CGrowableArray<ParamList>* pBindings = &m_Bindings[ eSemantic ][ eObject ][ dwObjectIndex ];
for( int iList=0; iList < pBindings->GetSize(); iList++ )
{
ParamList& paramList = pBindings->GetAt(iList);
for( int iParam=0; iParam < paramList.ahParameters.GetSize(); iParam++ )
{
V_RETURN( paramList.pEffect->SetFloatArray( paramList.ahParameters[iParam], pData, dwDataLen ) );
}
}
return S_OK;
}
void ParamList::Reset()
{
SAFE_RELEASE(pEffect);
ahParameters.RemoveAll();
}
//-------------------------------------------------------------------------------------
// Investigates all the parameters, looking at semantics and annotations and placing
// handles to these parameters within the internal database.
//-------------------------------------------------------------------------------------
HRESULT CDXUTEffectMap::AddEffect( ID3DXEffect* pEffect )
{
HRESULT hr;
if( pEffect == NULL )
return E_INVALIDARG;
// Get the number of parameters
D3DXEFFECT_DESC descEffect;
V_RETURN( pEffect->GetDesc( &descEffect ) );
// Enumerate the parameters
for( UINT iParam=0; iParam < descEffect.Parameters; iParam++ )
{
// Retrieve param
D3DXHANDLE hParameter = pEffect->GetParameter( NULL, iParam );
if( NULL == hParameter )
return E_FAIL;
// Grab description
D3DXPARAMETER_DESC desc;
V_RETURN( pEffect->GetParameterDesc( hParameter, &desc ) );
// If this parameter doesn't have a semantic, skip to the next parameter
if( desc.Semantic == NULL )
continue;
// Map the semantic to the standard set
DXUT_SEMANTIC eSemantic = StringToSemantic( desc.Semantic );
if( eSemantic == DXUT_UNKNOWN_SEMANTIC )
continue;
// Get the object annotation
const char* cstrObject = "Geometry";
D3DXHANDLE hAnnotation = pEffect->GetAnnotationByName( hParameter, "Object" );
if( hAnnotation )
{
V_RETURN( pEffect->GetString( hAnnotation, &cstrObject ) );
}
// Map the object to the standard set
DXUT_OBJECT eObject = StringToObject( cstrObject );
if( eObject == DXUT_UNKNOWN_OBJECT )
continue;
// Extract the index from the semantic
int index = 0;
const char* strIndex = desc.Semantic + strlen(desc.Semantic)-1;
// If there is a digit at the end of the semantic, locate the beginning of the index
// and convert to an integer
if( isdigit( (BYTE) (*strIndex) ) )
{
while( isdigit( (BYTE) (*(strIndex-1)) ) )
{
--strIndex;
}
index = atoi( strIndex );
}
// Check whether index is out of bounds
if( index < 0 || index >= MAX_INDEX )
continue;
// Store the handle
CGrowableArray<ParamList>* pBindings = &m_Bindings[ eSemantic ][ eObject ][ index ];
bool bBound = false;
for( int i=0; i < pBindings->GetSize(); i++ )
{
if( pBindings->GetAt(i).pEffect == pEffect )
{
// Found the containing effect for this parameter in the list, add the new handle
pBindings->GetAt(i).ahParameters.Add( hParameter );
bBound = true;
break;
}
}
if( !bBound )
{
// This parameter belongs to a new effect
ParamList newParamList;
newParamList.pEffect = pEffect;
pEffect->AddRef();
newParamList.ahParameters.Add( hParameter );
pBindings->Add( newParamList );
}
}
return S_OK;
}
//-------------------------------------------------------------------------------------
// Removes all instances of this effect from the binding list
//-------------------------------------------------------------------------------------
HRESULT CDXUTEffectMap::RemoveEffect( ID3DXEffect* pEffect )
{
if( pEffect == NULL )
return E_INVALIDARG;
// Search through the list of registered semantics and remove all items
// assigned to the given effect
for( UINT iSemantic = 0; iSemantic < NUM_DXUT_SEMANTICS; iSemantic++ )
{
for( UINT iObject = 0; iObject < NUM_DXUT_OBJECTS; iObject++ )
{
for( UINT iIndex = 0; iIndex < MAX_INDEX; iIndex++ )
{
CGrowableArray<ParamList>* pBinding = &m_Bindings[ iSemantic ][ iObject ][ iIndex ];
// Clear nested arrays first
for( int iParamList = 0; iParamList < pBinding->GetSize(); iParamList++ )
{
ParamList& rParamList = pBinding->GetAt( iParamList );
if( rParamList.pEffect == pEffect )
rParamList.Reset();
}
}
}
}
return S_OK;
}
//-------------------------------------------------------------------------------------
HRESULT CDXUTEffectMap::SetWorldMatrix( D3DXMATRIXA16* pWorldMatrix, const WCHAR* strUnits )
{
m_matWorld = *pWorldMatrix;
return UpdateTransforms( DXUT_World );
}
//-------------------------------------------------------------------------------------
HRESULT CDXUTEffectMap::SetViewMatrix( D3DXMATRIXA16* pViewMatrix, const WCHAR* strUnits )
{
m_matView = *pViewMatrix;
return UpdateTransforms( DXUT_View );
}
//-------------------------------------------------------------------------------------
HRESULT CDXUTEffectMap::SetProjectionMatrix( D3DXMATRIXA16* pProjectionMatrix )
{
m_matProjection = *pProjectionMatrix;
return UpdateTransforms( DXUT_Projection );
}
//-------------------------------------------------------------------------------------
HRESULT CDXUTEffectMap::UpdateTransforms( DXUT_SEMANTIC eSemantic, const WCHAR* strUnits )
{
HRESULT hr;
// Determine which transforms are required by the effect
bool bEffectContains[ NUM_DXUT_SEMANTICS ] = {0};
for( int iTransform = DXUT_World; iTransform <= DXUT_ProjectionInverseTranspose; iTransform++ )
{
bEffectContains[iTransform] = ( m_Bindings[ iTransform ][ DXUT_Geometry ][ 0 ].GetSize() > 0 );
}
if( eSemantic == DXUT_World )
{
// World matrix permutations
if( bEffectContains[ DXUT_World ] ||
bEffectContains[ DXUT_WorldInverse ] ||
bEffectContains[ DXUT_WorldInverseTranspose ] )
{
V_RETURN( SetStandardParameter( DXUT_World, DXUT_Geometry, 0, (float*)&m_matWorld, 16, L"", strUnits, L"World" ) );
if( bEffectContains[ DXUT_WorldInverse ] ||
bEffectContains[ DXUT_WorldInverseTranspose ] )
{
D3DXMATRIXA16 matWorldInverse;
D3DXMatrixInverse( &matWorldInverse, NULL, &m_matWorld );
V_RETURN( SetStandardParameter( DXUT_WorldInverse, DXUT_Geometry, 0, (float*)&matWorldInverse, 16, L"", strUnits, L"World" ) );
if( bEffectContains[ DXUT_WorldInverseTranspose ] )
{
D3DXMATRIXA16 matWorldInverseTranspose;
D3DXMatrixTranspose( &matWorldInverseTranspose, &matWorldInverse );
V_RETURN( SetStandardParameter( DXUT_WorldInverseTranspose, DXUT_Geometry, 0, (float*)&matWorldInverseTranspose, 16, L"", strUnits, L"World" ) );
}
}
}
}
if( eSemantic == DXUT_World ||
eSemantic == DXUT_View )
{
// WorldView matrix permutations
if( bEffectContains[ DXUT_WorldView ] ||
bEffectContains[ DXUT_WorldViewInverse ] ||
bEffectContains[ DXUT_WorldViewInverseTranspose ] )
{
D3DXMATRIXA16 matWorldView;
D3DXMatrixMultiply( &matWorldView, &m_matWorld, &m_matView );
V_RETURN( SetStandardParameter( DXUT_WorldView, DXUT_Geometry, 0, (float*)&matWorldView, 16, L"", strUnits, L"World" ) );
if( bEffectContains[ DXUT_WorldViewInverse ] ||
bEffectContains[ DXUT_WorldViewInverseTranspose ] )
{
D3DXMATRIXA16 matWorldViewInverse;
D3DXMatrixInverse( &matWorldViewInverse, NULL, &matWorldView );
V_RETURN( SetStandardParameter( DXUT_WorldViewInverse, DXUT_Geometry, 0, (float*)&matWorldViewInverse, 16, L"", strUnits, L"World" ) );
if( bEffectContains[ DXUT_WorldViewInverseTranspose ] )
{
D3DXMATRIXA16 matWorldViewInverseTranspose;
D3DXMatrixTranspose( &matWorldViewInverseTranspose, &matWorldViewInverse );
V_RETURN( SetStandardParameter( DXUT_WorldViewInverseTranspose, DXUT_Geometry, 0, (float*)&matWorldViewInverseTranspose, 16, L"", strUnits, L"World" ) );
}
}
}
}
if( eSemantic == DXUT_World ||
eSemantic == DXUT_View ||
eSemantic == DXUT_Projection )
{
// WorldViewProjection matrix permutations
if( bEffectContains[ DXUT_WorldViewProjection ] ||
bEffectContains[ DXUT_WorldViewProjectionInverse ] ||
bEffectContains[ DXUT_WorldViewProjectionInverseTranspose ] )
{
D3DXMATRIXA16 matWorldViewProjection;
D3DXMatrixMultiply( &matWorldViewProjection, &m_matWorld, &m_matView );
D3DXMatrixMultiply( &matWorldViewProjection, &matWorldViewProjection, &m_matProjection );
V_RETURN( SetStandardParameter( DXUT_WorldViewProjection, DXUT_Geometry, 0, (float*)&matWorldViewProjection, 16, L"", strUnits, L"World" ) );
if( bEffectContains[ DXUT_WorldViewProjectionInverse ] ||
bEffectContains[ DXUT_WorldViewProjectionInverseTranspose ] )
{
D3DXMATRIXA16 matWorldViewProjectionInverse;
D3DXMatrixInverse( &matWorldViewProjectionInverse, NULL, &matWorldViewProjection );
V_RETURN( SetStandardParameter( DXUT_WorldViewProjectionInverse, DXUT_Geometry, 0, (float*)&matWorldViewProjectionInverse, 16, L"", strUnits, L"World" ) );
if( bEffectContains[ DXUT_WorldViewProjectionInverseTranspose ] )
{
D3DXMATRIXA16 matWorldViewProjectionInverseTranspose;
D3DXMatrixTranspose( &matWorldViewProjectionInverseTranspose, &matWorldViewProjectionInverse );
V_RETURN( SetStandardParameter( DXUT_WorldViewProjectionInverseTranspose, DXUT_Geometry, 0, (float*)&matWorldViewProjectionInverseTranspose, 16, L"", strUnits, L"World" ) );
}
}
}
}
if( eSemantic == DXUT_View )
{
// View matrix permutations
if( bEffectContains[ DXUT_View ] ||
bEffectContains[ DXUT_ViewInverse ] ||
bEffectContains[ DXUT_ViewInverseTranspose ] )
{
V_RETURN( SetStandardParameter( DXUT_View, DXUT_Geometry, 0, (float*)&m_matView, 16, L"", strUnits, L"World" ) );
if( bEffectContains[ DXUT_ViewInverse ] ||
bEffectContains[ DXUT_ViewInverseTranspose ] )
{
D3DXMATRIXA16 matViewInverse;
D3DXMatrixInverse( &matViewInverse, NULL, &m_matView );
V_RETURN( SetStandardParameter( DXUT_ViewInverse, DXUT_Geometry, 0, (float*)&matViewInverse, 16, L"", strUnits, L"World" ) );
if( bEffectContains[ DXUT_ViewInverseTranspose ] )
{
D3DXMATRIXA16 matViewInverseTranspose;
D3DXMatrixTranspose( &matViewInverseTranspose, &matViewInverse );
V_RETURN( SetStandardParameter( DXUT_ViewInverseTranspose, DXUT_Geometry, 0, (float*)&matViewInverseTranspose, 16, L"", strUnits, L"World" ) );
}
}
}
}
if( eSemantic == DXUT_View ||
eSemantic == DXUT_Projection )
{
// ViewProjection matrix permutations
if( bEffectContains[ DXUT_ViewProjection ] ||
bEffectContains[ DXUT_ViewProjectionInverse ] ||
bEffectContains[ DXUT_ViewProjectionInverseTranspose ] )
{
D3DXMATRIXA16 matViewProjection;
D3DXMatrixMultiply( &matViewProjection, &m_matView, &m_matProjection );
V_RETURN( SetStandardParameter( DXUT_ViewProjection, DXUT_Geometry, 0, (float*)&matViewProjection, 16, L"", strUnits, L"World" ) );
if( bEffectContains[ DXUT_ViewProjectionInverse ] ||
bEffectContains[ DXUT_ViewProjectionInverseTranspose ] )
{
D3DXMATRIXA16 matViewProjectionInverse;
D3DXMatrixInverse( &matViewProjectionInverse, NULL, &matViewProjection );
V_RETURN( SetStandardParameter( DXUT_ViewProjectionInverse, DXUT_Geometry, 0, (float*)&matViewProjectionInverse, 16, L"", strUnits, L"World" ) );
if( bEffectContains[ DXUT_ViewProjectionInverseTranspose ] )
{
D3DXMATRIXA16 matViewProjectionInverseTranspose;
D3DXMatrixTranspose( &matViewProjectionInverseTranspose, &matViewProjectionInverse );
V_RETURN( SetStandardParameter( DXUT_ViewProjectionInverseTranspose, DXUT_Geometry, 0, (float*)&matViewProjectionInverseTranspose, 16, L"", strUnits, L"World" ) );
}
}
}
}
if( eSemantic == DXUT_Projection )
{
// Projection matrix permutations
if( bEffectContains[ DXUT_Projection ] ||
bEffectContains[ DXUT_ProjectionInverse ] ||
bEffectContains[ DXUT_ProjectionInverseTranspose ] )
{
V_RETURN( SetStandardParameter( DXUT_Projection, DXUT_Geometry, 0, (float*)&m_matProjection, 16, L"", strUnits, L"World" ) );
if( bEffectContains[ DXUT_ProjectionInverse ] ||
bEffectContains[ DXUT_ProjectionInverseTranspose ] )
{
D3DXMATRIXA16 matProjectionInverse;
D3DXMatrixInverse( &matProjectionInverse, NULL, &m_matProjection );
V_RETURN( SetStandardParameter( DXUT_ProjectionInverse, DXUT_Geometry, 0, (float*)&matProjectionInverse, 16, L"", strUnits, L"World" ) );
if( bEffectContains[ DXUT_ProjectionInverseTranspose ] )
{
D3DXMATRIXA16 matProjectionInverseTranspose;
D3DXMatrixTranspose( &matProjectionInverseTranspose, &matProjectionInverse );
V_RETURN( SetStandardParameter( DXUT_ProjectionInverseTranspose, DXUT_Geometry, 0, (float*)&matProjectionInverseTranspose, 16, L"", strUnits, L"World" ) );
}
}
}
}
return S_OK;
}
@@ -0,0 +1,164 @@
//-----------------------------------------------------------------------------
// File: DXUTEffectMap.h
//
// Desc: Maps the set of standard semantics and annotations to a collection
// of ID3DXEffect objects.
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------------------------
#pragma once
#ifndef DXUT_EFFECTMAP_H
#define DXUT_EFFECTMAP_H
const int MAX_INDEX = 5;
enum DXUT_SEMANTIC
{
DXUT_UNKNOWN_SEMANTIC,
DXUT_Diffuse,
DXUT_Specular,
DXUT_Ambient,
DXUT_SpecularPower,
DXUT_Emissive,
DXUT_Normal,
DXUT_Height,
DXUT_Refraction,
DXUT_Opacity,
DXUT_Environment,
DXUT_EnvironmentNormal,
DXUT_Fresnel,
DXUT_World,
DXUT_WorldInverse,
DXUT_WorldInverseTranspose,
DXUT_WorldView,
DXUT_WorldViewInverse,
DXUT_WorldViewInverseTranspose,
DXUT_WorldViewProjection,
DXUT_WorldViewProjectionInverse,
DXUT_WorldViewProjectionInverseTranspose,
DXUT_View,
DXUT_ViewInverse,
DXUT_ViewInverseTranspose,
DXUT_ViewProjection,
DXUT_ViewProjectionInverse,
DXUT_ViewProjectionInverseTranspose,
DXUT_Projection,
DXUT_ProjectionInverse,
DXUT_ProjectionInverseTranspose,
DXUT_RenderTargetDimensions,
DXUT_RenderTargetClipping,
DXUT_Time,
DXUT_LastTime,
DXUT_ElapsedTime,
DXUT_Position,
DXUT_Direction,
DXUT_BoundingCenter,
DXUT_BoundingSphereSize,
DXUT_BoundingSphereMin,
DXUT_BoundingSphereMax,
DXUT_BoundingBoxSize,
DXUT_BoundingBoxMin,
DXUT_BoundingBoxMax,
DXUT_Attenuation,
DXUT_RenderColorTarget,
DXUT_RenderDepthStencilTarget,
DXUT_UnitsScale,
DXUT_StandardsGlobal,
NUM_DXUT_SEMANTICS
};
enum DXUT_OBJECT
{
DXUT_UNKNOWN_OBJECT,
DXUT_Geometry,
DXUT_Light,
DXUT_Camera,
DXUT_Frame,
NUM_DXUT_OBJECTS
};
struct ParamList
{
ID3DXEffect* pEffect;
CGrowableArray< D3DXHANDLE > ahParameters;
void Reset();
};
class CDXUTEffectMap
{
public:
CDXUTEffectMap() { Reset(); }
~CDXUTEffectMap() { Reset(); }
VOID Reset();
HRESULT AddEffect( ID3DXEffect* pEffect );
HRESULT RemoveEffect( ID3DXEffect* pEffect );
HRESULT SetStandardParameter( const WCHAR* strSemantic, const WCHAR* strObject, DWORD dwObjectIndex, float* pData, DWORD dwDataLen, const WCHAR* strType = NULL, const WCHAR* strUnits = NULL, const WCHAR* strSpace = NULL );
HRESULT SetStandardParameter( DXUT_SEMANTIC eSemantic, DXUT_OBJECT eObject, DWORD dwObjectIndex, float* pData, DWORD dwDataLen, const WCHAR* strType = NULL, const WCHAR* strUnits = NULL, const WCHAR* strSpace = NULL );
HRESULT SetWorldMatrix( D3DXMATRIXA16* pWorldMatrix, const WCHAR* strUnits = NULL );
HRESULT SetViewMatrix( D3DXMATRIXA16* pViewMatrix, const WCHAR* strUnits = NULL );
HRESULT SetProjectionMatrix( D3DXMATRIXA16* pProjectionMatrix );
static DXUT_SEMANTIC StringToSemantic( const char* cstrSemantic );
static DXUT_SEMANTIC StringToSemantic( const WCHAR* strSemantic );
static DXUT_OBJECT StringToObject( const char* cstrObject );
static DXUT_OBJECT StringToObject( const WCHAR* strObject );
private:
HRESULT UpdateTransforms( DXUT_SEMANTIC eSemantic, const WCHAR* strUnits = L"m" );
D3DXMATRIXA16 m_matWorld;
D3DXMATRIXA16 m_matView;
D3DXMATRIXA16 m_matProjection;
// Database of DXUTEffect object parameter handles which are indexed accoring to
// Semantic, Object annotation, index, and containing mesh pointer
CGrowableArray<ParamList> m_Bindings[ NUM_DXUT_SEMANTICS ][ NUM_DXUT_OBJECTS ][ MAX_INDEX ];
};
//-------------------------------------------------------------------------------------
inline bool StringBegins( const char* strTest, const char* strStartsWith )
{
return ( 0 == _strnicmp( strTest, strStartsWith, strlen(strStartsWith) ) );
}
//-------------------------------------------------------------------------------------
inline bool StringEquals( const char* strTest, const char* strEquals )
{
return( 0 == _stricmp( strTest, strEquals ) );
}
//-------------------------------------------------------------------------------------
inline void RemoveTrailingNumber( char* strWithoutNumber, DWORD dwBufLen, const char* str )
{
StringCchCopyA( strWithoutNumber, dwBufLen, str );
char* strIndex = strWithoutNumber + strlen(strWithoutNumber);
// If there is a digit at the end of the semantic discard it
while( isdigit( (BYTE) (*(strIndex-1)) ) )
{
--strIndex;
}
*strIndex = 0;
}
#endif //DXUT_EFFECTMAP_H
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,138 @@
//-----------------------------------------------------------------------------
// File: DXUTMesh.h
//
// Desc: Support code for loading DirectX .X files.
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------------------------
#pragma once
#ifndef DXUTMESH_H
#define DXUTMESH_H
//-----------------------------------------------------------------------------
// Name: class CDXUTMesh
// Desc: Class for loading and rendering file-based meshes
//-----------------------------------------------------------------------------
class CDXUTMesh
{
public:
WCHAR m_strName[512];
LPD3DXMESH m_pSysMemMesh; // SysMem mesh, lives through resize
LPD3DXMESH m_pLocalMesh; // Local mesh, rebuilt on resize
DWORD m_dwNumMaterials; // Materials for the mesh
D3DMATERIAL9* m_pMaterials;
IDirect3DBaseTexture9** m_pTextures;
bool m_bUseMaterials;
public:
// Rendering
HRESULT Render( LPDIRECT3DDEVICE9 pd3dDevice,
bool bDrawOpaqueSubsets = true,
bool bDrawAlphaSubsets = true );
HRESULT Render( ID3DXEffect *pEffect,
D3DXHANDLE hTexture = NULL,
D3DXHANDLE hDiffuse = NULL,
D3DXHANDLE hAmbient = NULL,
D3DXHANDLE hSpecular = NULL,
D3DXHANDLE hEmissive = NULL,
D3DXHANDLE hPower = NULL,
bool bDrawOpaqueSubsets = true,
bool bDrawAlphaSubsets = true );
// Mesh access
LPD3DXMESH GetSysMemMesh() { return m_pSysMemMesh; }
LPD3DXMESH GetLocalMesh() { return m_pLocalMesh; }
// Rendering options
void UseMeshMaterials( bool bFlag ) { m_bUseMaterials = bFlag; }
HRESULT SetFVF( LPDIRECT3DDEVICE9 pd3dDevice, DWORD dwFVF );
HRESULT SetVertexDecl( LPDIRECT3DDEVICE9 pd3dDevice, const D3DVERTEXELEMENT9 *pDecl );
// Initializing
HRESULT RestoreDeviceObjects( LPDIRECT3DDEVICE9 pd3dDevice );
HRESULT InvalidateDeviceObjects();
// Creation/destruction
HRESULT Create( LPDIRECT3DDEVICE9 pd3dDevice, LPCWSTR strFilename );
HRESULT Create( LPDIRECT3DDEVICE9 pd3dDevice, LPD3DXFILEDATA pFileData );
HRESULT CreateMaterials( LPCWSTR strPath, IDirect3DDevice9 *pd3dDevice, ID3DXBuffer *pAdjacencyBuffer, ID3DXBuffer *pMtrlBuffer );
HRESULT Destroy();
CDXUTMesh( LPCWSTR strName = L"CDXUTMeshFile_Mesh" );
virtual ~CDXUTMesh();
};
//-----------------------------------------------------------------------------
// Name: class CDXUTMeshFrame
// Desc: Class for loading and rendering file-based meshes
//-----------------------------------------------------------------------------
class CDXUTMeshFrame
{
public:
WCHAR m_strName[512];
D3DXMATRIX m_mat;
CDXUTMesh* m_pMesh;
CDXUTMeshFrame* m_pNext;
CDXUTMeshFrame* m_pChild;
public:
// Matrix access
void SetMatrix( D3DXMATRIX* pmat ) { m_mat = *pmat; }
D3DXMATRIX* GetMatrix() { return &m_mat; }
CDXUTMesh* FindMesh( LPCWSTR strMeshName );
CDXUTMeshFrame* FindFrame( LPCWSTR strFrameName );
bool EnumMeshes( bool (*EnumMeshCB)(CDXUTMesh*,void*),
void* pContext );
HRESULT Destroy();
HRESULT RestoreDeviceObjects( LPDIRECT3DDEVICE9 pd3dDevice );
HRESULT InvalidateDeviceObjects();
HRESULT Render( LPDIRECT3DDEVICE9 pd3dDevice,
bool bDrawOpaqueSubsets = true,
bool bDrawAlphaSubsets = true,
D3DXMATRIX* pmatWorldMatrix = NULL);
CDXUTMeshFrame( LPCWSTR strName = L"CDXUTMeshFile_Frame" );
virtual ~CDXUTMeshFrame();
};
//-----------------------------------------------------------------------------
// Name: class CDXUTMeshFile
// Desc: Class for loading and rendering file-based meshes
//-----------------------------------------------------------------------------
class CDXUTMeshFile : public CDXUTMeshFrame
{
HRESULT LoadMesh( LPDIRECT3DDEVICE9 pd3dDevice, LPD3DXFILEDATA pFileData,
CDXUTMeshFrame* pParentFrame );
HRESULT LoadFrame( LPDIRECT3DDEVICE9 pd3dDevice, LPD3DXFILEDATA pFileData,
CDXUTMeshFrame* pParentFrame );
public:
HRESULT Create( LPDIRECT3DDEVICE9 pd3dDevice, LPCWSTR strFilename );
HRESULT CreateFromResource( LPDIRECT3DDEVICE9 pd3dDevice, LPCWSTR strResource, LPCWSTR strType );
// For pure devices, specify the world transform. If the world transform is not
// specified on pure devices, this function will fail.
HRESULT Render( LPDIRECT3DDEVICE9 pd3dDevice, D3DXMATRIX* pmatWorldMatrix = NULL );
CDXUTMeshFile() : CDXUTMeshFrame( L"CDXUTMeshFile_Root" ) {}
};
#endif
@@ -0,0 +1,870 @@
//--------------------------------------------------------------------------------------
// File: DXUTEnum.cpp
//
// Enumerates D3D adapters, devices, modes, etc.
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//--------------------------------------------------------------------------------------
#include "stdafx.h"
#include "dxstdafx.h"
//--------------------------------------------------------------------------------------
// Forward declarations
//--------------------------------------------------------------------------------------
static int __cdecl SortModesCallback( const void* arg1, const void* arg2 );
UINT DXUTStencilBits( D3DFORMAT fmt );
UINT DXUTDepthBits( D3DFORMAT fmt );
UINT DXUTAlphaChannelBits( D3DFORMAT fmt );
UINT DXUTColorChannelBits( D3DFORMAT fmt );
CD3DEnumeration* DXUTGetEnumeration()
{
// Using an accessor function gives control of the construction order
static CD3DEnumeration d3denum;
return &d3denum;
}
//--------------------------------------------------------------------------------------
CD3DEnumeration::CD3DEnumeration()
{
m_pD3D = NULL;
m_IsDeviceAcceptableFunc = NULL;
m_bRequirePostPixelShaderBlending = true;
m_nMinWidth = 0;
m_nMinHeight = 0;
m_nMaxWidth = UINT_MAX;
m_nMaxHeight = UINT_MAX;
m_nRefreshMin = 0;
m_nRefreshMax = UINT_MAX;
m_nMultisampleQualityMax = 0xFFFF;
ResetPossibleDepthStencilFormats();
ResetPossibleMultisampleTypeList();
ResetPossiblePresentIntervalList();
SetPossibleVertexProcessingList( true, true, true, false );
}
//--------------------------------------------------------------------------------------
CD3DEnumeration::~CD3DEnumeration()
{
ClearAdapterInfoList();
}
//--------------------------------------------------------------------------------------
// Enumerates available D3D adapters, devices, modes, etc.
//--------------------------------------------------------------------------------------
HRESULT CD3DEnumeration::Enumerate( IDirect3D9* pD3D,
LPDXUTCALLBACKISDEVICEACCEPTABLE IsDeviceAcceptableFunc )
{
if( pD3D == NULL )
{
pD3D = DXUTGetD3DObject();
if( pD3D == NULL )
return DXUTERR_NODIRECT3D;
}
m_pD3D = pD3D;
m_IsDeviceAcceptableFunc = IsDeviceAcceptableFunc;
HRESULT hr;
ClearAdapterInfoList();
CGrowableArray<D3DFORMAT> adapterFormatList;
const D3DFORMAT allowedAdapterFormatArray[] =
{
D3DFMT_X8R8G8B8,
D3DFMT_X1R5G5B5,
D3DFMT_R5G6B5,
D3DFMT_A2R10G10B10
};
const UINT allowedAdapterFormatArrayCount = sizeof(allowedAdapterFormatArray) / sizeof(allowedAdapterFormatArray[0]);
UINT numAdapters = pD3D->GetAdapterCount();
for (UINT adapterOrdinal = 0; adapterOrdinal < numAdapters; adapterOrdinal++)
{
CD3DEnumAdapterInfo* pAdapterInfo = new CD3DEnumAdapterInfo;
if( pAdapterInfo == NULL )
return E_OUTOFMEMORY;
pAdapterInfo->AdapterOrdinal = adapterOrdinal;
pD3D->GetAdapterIdentifier(adapterOrdinal, 0, &pAdapterInfo->AdapterIdentifier);
// Get list of all display modes on this adapter.
// Also build a temporary list of all display adapter formats.
adapterFormatList.RemoveAll();
for( UINT iFormatList = 0; iFormatList < allowedAdapterFormatArrayCount; iFormatList++ )
{
D3DFORMAT allowedAdapterFormat = allowedAdapterFormatArray[iFormatList];
UINT numAdapterModes = pD3D->GetAdapterModeCount( adapterOrdinal, allowedAdapterFormat );
for (UINT mode = 0; mode < numAdapterModes; mode++)
{
D3DDISPLAYMODE displayMode;
pD3D->EnumAdapterModes( adapterOrdinal, allowedAdapterFormat, mode, &displayMode );
if( displayMode.Width < m_nMinWidth ||
displayMode.Height < m_nMinHeight ||
displayMode.Width > m_nMaxWidth ||
displayMode.Height > m_nMaxHeight ||
displayMode.RefreshRate < m_nRefreshMin ||
displayMode.RefreshRate > m_nRefreshMax )
{
continue;
}
pAdapterInfo->displayModeList.Add( displayMode );
if( !adapterFormatList.Contains(displayMode.Format) )
adapterFormatList.Add( displayMode.Format );
}
}
D3DDISPLAYMODE displayMode;
pD3D->GetAdapterDisplayMode( adapterOrdinal, &displayMode );
if( !adapterFormatList.Contains(displayMode.Format) )
adapterFormatList.Add( displayMode.Format );
// Sort displaymode list
qsort( pAdapterInfo->displayModeList.GetData(),
pAdapterInfo->displayModeList.GetSize(), sizeof( D3DDISPLAYMODE ),
SortModesCallback );
// Get info for each device on this adapter
if( FAILED( EnumerateDevices( pAdapterInfo, &adapterFormatList ) ) )
{
delete pAdapterInfo;
continue;
}
// If at least one device on this adapter is available and compatible
// with the app, add the adapterInfo to the list
if( pAdapterInfo->deviceInfoList.GetSize() > 0 )
{
hr = m_AdapterInfoList.Add( pAdapterInfo );
if( FAILED(hr) )
return hr;
} else
delete pAdapterInfo;
}
bool bUniqueDesc = true;
CD3DEnumAdapterInfo* pAdapterInfo;
int i;
for( i=0; i<m_AdapterInfoList.GetSize(); i++ )
{
CD3DEnumAdapterInfo* pAdapterInfo1 = m_AdapterInfoList.GetAt(i);
for( int j=i+1; j<m_AdapterInfoList.GetSize(); j++ )
{
CD3DEnumAdapterInfo* pAdapterInfo2 = m_AdapterInfoList.GetAt(j);
if( _stricmp( pAdapterInfo1->AdapterIdentifier.Description,
pAdapterInfo2->AdapterIdentifier.Description ) == 0 )
{
bUniqueDesc = false;
break;
}
}
if( !bUniqueDesc )
break;
}
for( i=0; i<m_AdapterInfoList.GetSize(); i++ )
{
pAdapterInfo = m_AdapterInfoList.GetAt(i);
MultiByteToWideChar( CP_ACP, 0,
pAdapterInfo->AdapterIdentifier.Description, -1,
pAdapterInfo->szUniqueDescription, 100 );
pAdapterInfo->szUniqueDescription[100] = 0;
if( !bUniqueDesc )
{
WCHAR sz[100];
StringCchPrintf( sz, 100, L" (#%d)", pAdapterInfo->AdapterOrdinal );
StringCchCat( pAdapterInfo->szUniqueDescription, 256, sz );
}
}
return S_OK;
}
//--------------------------------------------------------------------------------------
// Enumerates D3D devices for a particular adapter.
//--------------------------------------------------------------------------------------
HRESULT CD3DEnumeration::EnumerateDevices( CD3DEnumAdapterInfo* pAdapterInfo, CGrowableArray<D3DFORMAT>* pAdapterFormatList )
{
HRESULT hr;
const D3DDEVTYPE devTypeArray[] =
{
D3DDEVTYPE_HAL,
D3DDEVTYPE_SW,
D3DDEVTYPE_REF
};
const UINT devTypeArrayCount = sizeof(devTypeArray) / sizeof(devTypeArray[0]);
// Enumerate each Direct3D device type
for( UINT iDeviceType = 0; iDeviceType < devTypeArrayCount; iDeviceType++ )
{
CD3DEnumDeviceInfo* pDeviceInfo = new CD3DEnumDeviceInfo;
if( pDeviceInfo == NULL )
return E_OUTOFMEMORY;
// Fill struct w/ AdapterOrdinal and D3DDEVTYPE
pDeviceInfo->DeviceType = devTypeArray[iDeviceType];
// Store device caps
if( FAILED( hr = m_pD3D->GetDeviceCaps( pAdapterInfo->AdapterOrdinal, pDeviceInfo->DeviceType,
&pDeviceInfo->Caps ) ) )
{
delete pDeviceInfo;
continue;
}
// Get info for each devicecombo on this device
if( FAILED( hr = EnumerateDeviceCombos( pAdapterInfo, pDeviceInfo, pAdapterFormatList ) ) )
{
delete pDeviceInfo;
continue;
}
// If at least one devicecombo for this device is found,
// add the deviceInfo to the list
if (pDeviceInfo->deviceSettingsComboList.GetSize() > 0 )
pAdapterInfo->deviceInfoList.Add( pDeviceInfo );
else
delete pDeviceInfo;
}
return S_OK;
}
//--------------------------------------------------------------------------------------
// Enumerates DeviceCombos for a particular device.
//--------------------------------------------------------------------------------------
HRESULT CD3DEnumeration::EnumerateDeviceCombos( CD3DEnumAdapterInfo* pAdapterInfo, CD3DEnumDeviceInfo* pDeviceInfo, CGrowableArray<D3DFORMAT>* pAdapterFormatList )
{
const D3DFORMAT backBufferFormatArray[] =
{
D3DFMT_A8R8G8B8,
D3DFMT_X8R8G8B8,
D3DFMT_A2R10G10B10,
D3DFMT_R5G6B5,
D3DFMT_A1R5G5B5,
D3DFMT_X1R5G5B5
};
const UINT backBufferFormatArrayCount = sizeof(backBufferFormatArray) / sizeof(backBufferFormatArray[0]);
// See which adapter formats are supported by this device
for( int iFormat=0; iFormat<pAdapterFormatList->GetSize(); iFormat++ )
{
D3DFORMAT adapterFormat = pAdapterFormatList->GetAt(iFormat);
for( UINT iBackBufferFormat = 0; iBackBufferFormat < backBufferFormatArrayCount; iBackBufferFormat++ )
{
D3DFORMAT backBufferFormat = backBufferFormatArray[iBackBufferFormat];
for( int nWindowed = 0; nWindowed < 2; nWindowed++)
{
if( !nWindowed && pAdapterInfo->displayModeList.GetSize() == 0 )
continue;
if (FAILED( m_pD3D->CheckDeviceType( pAdapterInfo->AdapterOrdinal, pDeviceInfo->DeviceType,
adapterFormat, backBufferFormat, nWindowed )))
{
continue;
}
if( m_bRequirePostPixelShaderBlending )
{
// If the backbuffer format doesn't support D3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING
// then alpha test, pixel fog, render-target blending, color write enable, and dithering.
// are not supported.
if( FAILED( m_pD3D->CheckDeviceFormat( pAdapterInfo->AdapterOrdinal, pDeviceInfo->DeviceType,
adapterFormat, D3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING,
D3DRTYPE_TEXTURE, backBufferFormat ) ) )
{
continue;
}
}
// If an application callback function has been provided, make sure this device
// is acceptable to the app.
if( m_IsDeviceAcceptableFunc != NULL )
{
if( !m_IsDeviceAcceptableFunc( &pDeviceInfo->Caps, adapterFormat, backBufferFormat, FALSE != nWindowed ) )
continue;
}
// At this point, we have an adapter/device/adapterformat/backbufferformat/iswindowed
// DeviceCombo that is supported by the system and acceptable to the app. We still
// need to find one or more suitable depth/stencil buffer format,
// multisample type, and present interval.
CD3DEnumDeviceSettingsCombo* pDeviceCombo = new CD3DEnumDeviceSettingsCombo;
if( pDeviceCombo == NULL )
return E_OUTOFMEMORY;
pDeviceCombo->AdapterOrdinal = pAdapterInfo->AdapterOrdinal;
pDeviceCombo->DeviceType = pDeviceInfo->DeviceType;
pDeviceCombo->AdapterFormat = adapterFormat;
pDeviceCombo->BackBufferFormat = backBufferFormat;
pDeviceCombo->Windowed = (nWindowed != 0);
BuildDepthStencilFormatList( pDeviceCombo );
BuildMultiSampleTypeList( pDeviceCombo );
if (pDeviceCombo->multiSampleTypeList.GetSize() == 0)
{
delete pDeviceCombo;
continue;
}
BuildDSMSConflictList( pDeviceCombo );
BuildPresentIntervalList(pDeviceInfo, pDeviceCombo );
pDeviceCombo->pAdapterInfo = pAdapterInfo;
pDeviceCombo->pDeviceInfo = pDeviceInfo;
pDeviceInfo->deviceSettingsComboList.Add( pDeviceCombo );
}
}
}
return S_OK;
}
//--------------------------------------------------------------------------------------
// Adds all depth/stencil formats that are compatible with the device
// and app to the given D3DDeviceCombo.
//--------------------------------------------------------------------------------------
void CD3DEnumeration::BuildDepthStencilFormatList( CD3DEnumDeviceSettingsCombo* pDeviceCombo )
{
D3DFORMAT depthStencilFmt;
for( int idsf = 0; idsf < m_DepthStecilPossibleList.GetSize(); idsf++ )
{
depthStencilFmt = m_DepthStecilPossibleList.GetAt(idsf);
if (SUCCEEDED(m_pD3D->CheckDeviceFormat(pDeviceCombo->AdapterOrdinal,
pDeviceCombo->DeviceType, pDeviceCombo->AdapterFormat,
D3DUSAGE_DEPTHSTENCIL, D3DRTYPE_SURFACE, depthStencilFmt)))
{
if (SUCCEEDED(m_pD3D->CheckDepthStencilMatch(pDeviceCombo->AdapterOrdinal,
pDeviceCombo->DeviceType, pDeviceCombo->AdapterFormat,
pDeviceCombo->BackBufferFormat, depthStencilFmt)))
{
pDeviceCombo->depthStencilFormatList.Add( depthStencilFmt );
}
}
}
}
//--------------------------------------------------------------------------------------
// Adds all multisample types that are compatible with the device and app to
// the given D3DDeviceCombo.
//--------------------------------------------------------------------------------------
void CD3DEnumeration::BuildMultiSampleTypeList( CD3DEnumDeviceSettingsCombo* pDeviceCombo )
{
D3DMULTISAMPLE_TYPE msType;
DWORD msQuality;
for( int imst = 0; imst < m_MultiSampleTypeList.GetSize(); imst++ )
{
msType = m_MultiSampleTypeList.GetAt(imst);
if( SUCCEEDED( m_pD3D->CheckDeviceMultiSampleType( pDeviceCombo->AdapterOrdinal,
pDeviceCombo->DeviceType, pDeviceCombo->BackBufferFormat,
pDeviceCombo->Windowed, msType, &msQuality ) ) )
{
pDeviceCombo->multiSampleTypeList.Add( msType );
if( msQuality > m_nMultisampleQualityMax+1 )
msQuality = m_nMultisampleQualityMax+1;
pDeviceCombo->multiSampleQualityList.Add( msQuality );
}
}
}
//--------------------------------------------------------------------------------------
// Find any conflicts between the available depth/stencil formats and
// multisample types.
//--------------------------------------------------------------------------------------
void CD3DEnumeration::BuildDSMSConflictList( CD3DEnumDeviceSettingsCombo* pDeviceCombo )
{
CD3DEnumDSMSConflict DSMSConflict;
for( int iDS=0; iDS<pDeviceCombo->depthStencilFormatList.GetSize(); iDS++ )
{
D3DFORMAT dsFmt = pDeviceCombo->depthStencilFormatList.GetAt(iDS);
for( int iMS=0; iMS<pDeviceCombo->multiSampleTypeList.GetSize(); iMS++ )
{
D3DMULTISAMPLE_TYPE msType = pDeviceCombo->multiSampleTypeList.GetAt(iMS);
if( FAILED( m_pD3D->CheckDeviceMultiSampleType( pDeviceCombo->AdapterOrdinal, pDeviceCombo->DeviceType,
dsFmt, pDeviceCombo->Windowed, msType, NULL ) ) )
{
DSMSConflict.DSFormat = dsFmt;
DSMSConflict.MSType = msType;
pDeviceCombo->DSMSConflictList.Add( DSMSConflict );
}
}
}
}
//--------------------------------------------------------------------------------------
// Adds all present intervals that are compatible with the device and app
// to the given D3DDeviceCombo.
//--------------------------------------------------------------------------------------
void CD3DEnumeration::BuildPresentIntervalList( CD3DEnumDeviceInfo* pDeviceInfo,
CD3DEnumDeviceSettingsCombo* pDeviceCombo )
{
UINT pi;
for( int ipi = 0; ipi < m_PresentIntervalList.GetSize(); ipi++ )
{
pi = m_PresentIntervalList.GetAt(ipi);
if( pDeviceCombo->Windowed )
{
if( pi == D3DPRESENT_INTERVAL_TWO ||
pi == D3DPRESENT_INTERVAL_THREE ||
pi == D3DPRESENT_INTERVAL_FOUR )
{
// These intervals are not supported in windowed mode.
continue;
}
}
// Note that D3DPRESENT_INTERVAL_DEFAULT is zero, so you
// can't do a caps check for it -- it is always available.
if( pi == D3DPRESENT_INTERVAL_DEFAULT ||
(pDeviceInfo->Caps.PresentationIntervals & pi) )
{
pDeviceCombo->presentIntervalList.Add( pi );
}
}
}
//--------------------------------------------------------------------------------------
// Release all the allocated CD3DEnumAdapterInfo objects and empty the list
//--------------------------------------------------------------------------------------
void CD3DEnumeration::ClearAdapterInfoList()
{
CD3DEnumAdapterInfo* pAdapterInfo;
for( int i=0; i<m_AdapterInfoList.GetSize(); i++ )
{
pAdapterInfo = m_AdapterInfoList.GetAt(i);
delete pAdapterInfo;
}
m_AdapterInfoList.RemoveAll();
}
//--------------------------------------------------------------------------------------
// Call GetAdapterInfoList() after Enumerate() to get a STL vector of
// CD3DEnumAdapterInfo*
//--------------------------------------------------------------------------------------
CGrowableArray<CD3DEnumAdapterInfo*>* CD3DEnumeration::GetAdapterInfoList()
{
return &m_AdapterInfoList;
}
//--------------------------------------------------------------------------------------
CD3DEnumAdapterInfo* CD3DEnumeration::GetAdapterInfo( UINT AdapterOrdinal )
{
for( int iAdapter=0; iAdapter<m_AdapterInfoList.GetSize(); iAdapter++ )
{
CD3DEnumAdapterInfo* pAdapterInfo = m_AdapterInfoList.GetAt(iAdapter);
if( pAdapterInfo->AdapterOrdinal == AdapterOrdinal )
return pAdapterInfo;
}
return NULL;
}
//--------------------------------------------------------------------------------------
CD3DEnumDeviceInfo* CD3DEnumeration::GetDeviceInfo( UINT AdapterOrdinal, D3DDEVTYPE DeviceType )
{
CD3DEnumAdapterInfo* pAdapterInfo = GetAdapterInfo( AdapterOrdinal );
if( pAdapterInfo )
{
for( int iDeviceInfo=0; iDeviceInfo<pAdapterInfo->deviceInfoList.GetSize(); iDeviceInfo++ )
{
CD3DEnumDeviceInfo* pDeviceInfo = pAdapterInfo->deviceInfoList.GetAt(iDeviceInfo);
if( pDeviceInfo->DeviceType == DeviceType )
return pDeviceInfo;
}
}
return NULL;
}
//--------------------------------------------------------------------------------------
//
//--------------------------------------------------------------------------------------
CD3DEnumDeviceSettingsCombo* CD3DEnumeration::GetDeviceSettingsCombo( UINT AdapterOrdinal, D3DDEVTYPE DeviceType, D3DFORMAT AdapterFormat, D3DFORMAT BackBufferFormat, BOOL bWindowed )
{
CD3DEnumDeviceInfo* pDeviceInfo = GetDeviceInfo( AdapterOrdinal, DeviceType );
if( pDeviceInfo )
{
for( int iDeviceCombo=0; iDeviceCombo<pDeviceInfo->deviceSettingsComboList.GetSize(); iDeviceCombo++ )
{
CD3DEnumDeviceSettingsCombo* pDeviceSettingsCombo = pDeviceInfo->deviceSettingsComboList.GetAt(iDeviceCombo);
if( pDeviceSettingsCombo->AdapterFormat == AdapterFormat &&
pDeviceSettingsCombo->BackBufferFormat == BackBufferFormat &&
pDeviceSettingsCombo->Windowed == bWindowed )
return pDeviceSettingsCombo;
}
}
return NULL;
}
//--------------------------------------------------------------------------------------
// Returns the number of color channel bits in the specified D3DFORMAT
//--------------------------------------------------------------------------------------
UINT DXUTColorChannelBits( D3DFORMAT fmt )
{
switch( fmt )
{
case D3DFMT_R8G8B8:
return 8;
case D3DFMT_A8R8G8B8:
return 8;
case D3DFMT_X8R8G8B8:
return 8;
case D3DFMT_R5G6B5:
return 5;
case D3DFMT_X1R5G5B5:
return 5;
case D3DFMT_A1R5G5B5:
return 5;
case D3DFMT_A4R4G4B4:
return 4;
case D3DFMT_R3G3B2:
return 2;
case D3DFMT_A8R3G3B2:
return 2;
case D3DFMT_X4R4G4B4:
return 4;
case D3DFMT_A2B10G10R10:
return 10;
case D3DFMT_A8B8G8R8:
return 8;
case D3DFMT_A2R10G10B10:
return 10;
case D3DFMT_A16B16G16R16:
return 16;
default:
return 0;
}
}
//--------------------------------------------------------------------------------------
// Returns the number of alpha channel bits in the specified D3DFORMAT
//--------------------------------------------------------------------------------------
UINT DXUTAlphaChannelBits( D3DFORMAT fmt )
{
switch( fmt )
{
case D3DFMT_R8G8B8:
return 0;
case D3DFMT_A8R8G8B8:
return 8;
case D3DFMT_X8R8G8B8:
return 0;
case D3DFMT_R5G6B5:
return 0;
case D3DFMT_X1R5G5B5:
return 0;
case D3DFMT_A1R5G5B5:
return 1;
case D3DFMT_A4R4G4B4:
return 4;
case D3DFMT_R3G3B2:
return 0;
case D3DFMT_A8R3G3B2:
return 8;
case D3DFMT_X4R4G4B4:
return 0;
case D3DFMT_A2B10G10R10:
return 2;
case D3DFMT_A8B8G8R8:
return 8;
case D3DFMT_A2R10G10B10:
return 2;
case D3DFMT_A16B16G16R16:
return 16;
default:
return 0;
}
}
//--------------------------------------------------------------------------------------
// Returns the number of depth bits in the specified D3DFORMAT
//--------------------------------------------------------------------------------------
UINT DXUTDepthBits( D3DFORMAT fmt )
{
switch( fmt )
{
case D3DFMT_D32F_LOCKABLE:
case D3DFMT_D32:
return 32;
case D3DFMT_D24X8:
case D3DFMT_D24S8:
case D3DFMT_D24X4S4:
case D3DFMT_D24FS8:
return 24;
case D3DFMT_D16_LOCKABLE:
case D3DFMT_D16:
return 16;
case D3DFMT_D15S1:
return 15;
default:
return 0;
}
}
//--------------------------------------------------------------------------------------
// Returns the number of stencil bits in the specified D3DFORMAT
//--------------------------------------------------------------------------------------
UINT DXUTStencilBits( D3DFORMAT fmt )
{
switch( fmt )
{
case D3DFMT_D16_LOCKABLE:
case D3DFMT_D16:
case D3DFMT_D32F_LOCKABLE:
case D3DFMT_D32:
case D3DFMT_D24X8:
return 0;
case D3DFMT_D15S1:
return 1;
case D3DFMT_D24X4S4:
return 4;
case D3DFMT_D24S8:
case D3DFMT_D24FS8:
return 8;
default:
return 0;
}
}
//--------------------------------------------------------------------------------------
// Used to sort D3DDISPLAYMODEs
//--------------------------------------------------------------------------------------
static int __cdecl SortModesCallback( const void* arg1, const void* arg2 )
{
D3DDISPLAYMODE* pdm1 = (D3DDISPLAYMODE*)arg1;
D3DDISPLAYMODE* pdm2 = (D3DDISPLAYMODE*)arg2;
if (pdm1->Width > pdm2->Width)
return 1;
if (pdm1->Width < pdm2->Width)
return -1;
if (pdm1->Height > pdm2->Height)
return 1;
if (pdm1->Height < pdm2->Height)
return -1;
if (pdm1->Format > pdm2->Format)
return 1;
if (pdm1->Format < pdm2->Format)
return -1;
if (pdm1->RefreshRate > pdm2->RefreshRate)
return 1;
if (pdm1->RefreshRate < pdm2->RefreshRate)
return -1;
return 0;
}
//--------------------------------------------------------------------------------------
CD3DEnumAdapterInfo::~CD3DEnumAdapterInfo( void )
{
CD3DEnumDeviceInfo* pDeviceInfo;
for( int i=0; i<deviceInfoList.GetSize(); i++ )
{
pDeviceInfo = deviceInfoList.GetAt(i);
delete pDeviceInfo;
}
deviceInfoList.RemoveAll();
}
//--------------------------------------------------------------------------------------
CD3DEnumDeviceInfo::~CD3DEnumDeviceInfo( void )
{
CD3DEnumDeviceSettingsCombo* pDeviceCombo;
for( int i=0; i<deviceSettingsComboList.GetSize(); i++ )
{
pDeviceCombo = deviceSettingsComboList.GetAt(i);
delete pDeviceCombo;
}
deviceSettingsComboList.RemoveAll();
}
//--------------------------------------------------------------------------------------
void CD3DEnumeration::ResetPossibleDepthStencilFormats()
{
m_DepthStecilPossibleList.RemoveAll();
m_DepthStecilPossibleList.Add( D3DFMT_D16 );
m_DepthStecilPossibleList.Add( D3DFMT_D15S1 );
m_DepthStecilPossibleList.Add( D3DFMT_D24X8 );
m_DepthStecilPossibleList.Add( D3DFMT_D24S8 );
m_DepthStecilPossibleList.Add( D3DFMT_D24X4S4 );
m_DepthStecilPossibleList.Add( D3DFMT_D32 );
}
//--------------------------------------------------------------------------------------
CGrowableArray<D3DFORMAT>* CD3DEnumeration::GetPossibleDepthStencilFormatList()
{
return &m_DepthStecilPossibleList;
}
//--------------------------------------------------------------------------------------
CGrowableArray<D3DMULTISAMPLE_TYPE>* CD3DEnumeration::GetPossibleMultisampleTypeList()
{
return &m_MultiSampleTypeList;
}
//--------------------------------------------------------------------------------------
void CD3DEnumeration::ResetPossibleMultisampleTypeList()
{
m_MultiSampleTypeList.RemoveAll();
m_MultiSampleTypeList.Add( D3DMULTISAMPLE_NONE );
m_MultiSampleTypeList.Add( D3DMULTISAMPLE_NONMASKABLE );
m_MultiSampleTypeList.Add( D3DMULTISAMPLE_2_SAMPLES );
m_MultiSampleTypeList.Add( D3DMULTISAMPLE_3_SAMPLES );
m_MultiSampleTypeList.Add( D3DMULTISAMPLE_4_SAMPLES );
m_MultiSampleTypeList.Add( D3DMULTISAMPLE_5_SAMPLES );
m_MultiSampleTypeList.Add( D3DMULTISAMPLE_6_SAMPLES );
m_MultiSampleTypeList.Add( D3DMULTISAMPLE_7_SAMPLES );
m_MultiSampleTypeList.Add( D3DMULTISAMPLE_8_SAMPLES );
m_MultiSampleTypeList.Add( D3DMULTISAMPLE_9_SAMPLES );
m_MultiSampleTypeList.Add( D3DMULTISAMPLE_10_SAMPLES );
m_MultiSampleTypeList.Add( D3DMULTISAMPLE_11_SAMPLES );
m_MultiSampleTypeList.Add( D3DMULTISAMPLE_12_SAMPLES );
m_MultiSampleTypeList.Add( D3DMULTISAMPLE_13_SAMPLES );
m_MultiSampleTypeList.Add( D3DMULTISAMPLE_14_SAMPLES );
m_MultiSampleTypeList.Add( D3DMULTISAMPLE_15_SAMPLES );
m_MultiSampleTypeList.Add( D3DMULTISAMPLE_16_SAMPLES );
}
//--------------------------------------------------------------------------------------
void CD3DEnumeration::GetPossibleVertexProcessingList( bool* pbSoftwareVP, bool* pbHardwareVP, bool* pbPureHarewareVP, bool* pbMixedVP )
{
*pbSoftwareVP = m_bSoftwareVP;
*pbHardwareVP = m_bHardwareVP;
*pbPureHarewareVP = m_bPureHarewareVP;
*pbMixedVP = m_bMixedVP;
}
//--------------------------------------------------------------------------------------
void CD3DEnumeration::SetPossibleVertexProcessingList( bool bSoftwareVP, bool bHardwareVP, bool bPureHarewareVP, bool bMixedVP )
{
m_bSoftwareVP = bSoftwareVP;
m_bHardwareVP = bHardwareVP;
m_bPureHarewareVP = bPureHarewareVP;
m_bMixedVP = bMixedVP;
}
//--------------------------------------------------------------------------------------
CGrowableArray<UINT>* CD3DEnumeration::GetPossiblePresentIntervalList()
{
return &m_PresentIntervalList;
}
//--------------------------------------------------------------------------------------
void CD3DEnumeration::ResetPossiblePresentIntervalList()
{
m_PresentIntervalList.RemoveAll();
m_PresentIntervalList.Add( D3DPRESENT_INTERVAL_IMMEDIATE );
m_PresentIntervalList.Add( D3DPRESENT_INTERVAL_DEFAULT );
m_PresentIntervalList.Add( D3DPRESENT_INTERVAL_ONE );
m_PresentIntervalList.Add( D3DPRESENT_INTERVAL_TWO );
m_PresentIntervalList.Add( D3DPRESENT_INTERVAL_THREE );
m_PresentIntervalList.Add( D3DPRESENT_INTERVAL_FOUR );
}
//--------------------------------------------------------------------------------------
void CD3DEnumeration::SetResolutionMinMax( UINT nMinWidth, UINT nMinHeight,
UINT nMaxWidth, UINT nMaxHeight )
{
m_nMinWidth = nMinWidth;
m_nMinHeight = nMinHeight;
m_nMaxWidth = nMaxWidth;
m_nMaxHeight = nMaxHeight;
}
//--------------------------------------------------------------------------------------
void CD3DEnumeration::SetRefreshMinMax( UINT nMin, UINT nMax )
{
m_nRefreshMin = nMin;
m_nRefreshMax = nMax;
}
//--------------------------------------------------------------------------------------
void CD3DEnumeration::SetMultisampleQualityMax( UINT nMax )
{
if( nMax > 0xFFFF )
nMax = 0xFFFF;
m_nMultisampleQualityMax = nMax;
}
@@ -0,0 +1,171 @@
//--------------------------------------------------------------------------------------
// File: DXUTEnum.h
//
// Enumerates D3D adapters, devices, modes, etc.
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//--------------------------------------------------------------------------------------
#pragma once
#ifndef DXUT_ENUM_H
#define DXUT_ENUM_H
//--------------------------------------------------------------------------------------
// Forward declarations
//--------------------------------------------------------------------------------------
class CD3DEnumAdapterInfo;
class CD3DEnumDeviceInfo;
struct CD3DEnumDeviceSettingsCombo;
struct CD3DEnumDSMSConflict;
//--------------------------------------------------------------------------------------
// Enumerates available Direct3D adapters, devices, modes, etc.
// Use DXUTGetEnumeration() to access global instance
//--------------------------------------------------------------------------------------
class CD3DEnumeration
{
public:
// These should be called before Enumerate().
//
// Use these calls and the IsDeviceAcceptable to control the contents of
// the enumeration object, which affects the device selection and the device settings dialog.
void SetRequirePostPixelShaderBlending( bool bRequire ) { m_bRequirePostPixelShaderBlending = bRequire; }
void SetResolutionMinMax( UINT nMinWidth, UINT nMinHeight, UINT nMaxWidth, UINT nMaxHeight );
void SetRefreshMinMax( UINT nMin, UINT nMax );
void SetMultisampleQualityMax( UINT nMax );
void GetPossibleVertexProcessingList( bool* pbSoftwareVP, bool* pbHardwareVP, bool* pbPureHarewareVP, bool* pbMixedVP );
void SetPossibleVertexProcessingList( bool bSoftwareVP, bool bHardwareVP, bool bPureHarewareVP, bool bMixedVP );
CGrowableArray<D3DFORMAT>* GetPossibleDepthStencilFormatList();
CGrowableArray<D3DMULTISAMPLE_TYPE>* GetPossibleMultisampleTypeList();
CGrowableArray<UINT>* GetPossiblePresentIntervalList();
void ResetPossibleDepthStencilFormats();
void ResetPossibleMultisampleTypeList();
void ResetPossiblePresentIntervalList();
// Call Enumerate() to enumerate available D3D adapters, devices, modes, etc.
HRESULT Enumerate( IDirect3D9* pD3D = NULL,
LPDXUTCALLBACKISDEVICEACCEPTABLE IsDeviceAcceptableFunc = NULL );
// These should be called after Enumerate() is called
CGrowableArray<CD3DEnumAdapterInfo*>* GetAdapterInfoList();
CD3DEnumAdapterInfo* GetAdapterInfo( UINT AdapterOrdinal );
CD3DEnumDeviceInfo* GetDeviceInfo( UINT AdapterOrdinal, D3DDEVTYPE DeviceType );
CD3DEnumDeviceSettingsCombo* GetDeviceSettingsCombo( DXUTDeviceSettings* pDeviceSettings ) { return GetDeviceSettingsCombo( pDeviceSettings->AdapterOrdinal, pDeviceSettings->DeviceType, pDeviceSettings->AdapterFormat, pDeviceSettings->pp.BackBufferFormat, pDeviceSettings->pp.Windowed ); }
CD3DEnumDeviceSettingsCombo* GetDeviceSettingsCombo( UINT AdapterOrdinal, D3DDEVTYPE DeviceType, D3DFORMAT AdapterFormat, D3DFORMAT BackBufferFormat, BOOL Windowed );
~CD3DEnumeration();
private:
friend CD3DEnumeration* DXUTGetEnumeration();
// Use DXUTGetEnumeration() to access global instance
CD3DEnumeration();
IDirect3D9* m_pD3D;
LPDXUTCALLBACKISDEVICEACCEPTABLE m_IsDeviceAcceptableFunc;
bool m_bRequirePostPixelShaderBlending;
CGrowableArray<D3DFORMAT> m_DepthStecilPossibleList;
CGrowableArray<D3DMULTISAMPLE_TYPE> m_MultiSampleTypeList;
CGrowableArray<UINT> m_PresentIntervalList;
bool m_bSoftwareVP;
bool m_bHardwareVP;
bool m_bPureHarewareVP;
bool m_bMixedVP;
UINT m_nMinWidth;
UINT m_nMaxWidth;
UINT m_nMinHeight;
UINT m_nMaxHeight;
UINT m_nRefreshMin;
UINT m_nRefreshMax;
UINT m_nMultisampleQualityMax;
// Array of CD3DEnumAdapterInfo* with unique AdapterOrdinals
CGrowableArray<CD3DEnumAdapterInfo*> m_AdapterInfoList;
HRESULT EnumerateDevices( CD3DEnumAdapterInfo* pAdapterInfo, CGrowableArray<D3DFORMAT>* pAdapterFormatList );
HRESULT EnumerateDeviceCombos( CD3DEnumAdapterInfo* pAdapterInfo, CD3DEnumDeviceInfo* pDeviceInfo, CGrowableArray<D3DFORMAT>* pAdapterFormatList );
void BuildDepthStencilFormatList( CD3DEnumDeviceSettingsCombo* pDeviceCombo );
void BuildMultiSampleTypeList( CD3DEnumDeviceSettingsCombo* pDeviceCombo );
void BuildDSMSConflictList( CD3DEnumDeviceSettingsCombo* pDeviceCombo );
void BuildPresentIntervalList( CD3DEnumDeviceInfo* pDeviceInfo, CD3DEnumDeviceSettingsCombo* pDeviceCombo );
void ClearAdapterInfoList();
};
CD3DEnumeration* DXUTGetEnumeration();
//--------------------------------------------------------------------------------------
// A class describing an adapter which contains a unique adapter ordinal
// that is installed on the system
//--------------------------------------------------------------------------------------
class CD3DEnumAdapterInfo
{
public:
~CD3DEnumAdapterInfo();
UINT AdapterOrdinal;
D3DADAPTER_IDENTIFIER9 AdapterIdentifier;
WCHAR szUniqueDescription[256];
CGrowableArray<D3DDISPLAYMODE> displayModeList; // Array of supported D3DDISPLAYMODEs
CGrowableArray<CD3DEnumDeviceInfo*> deviceInfoList; // Array of CD3DEnumDeviceInfo* with unique supported DeviceTypes
};
//--------------------------------------------------------------------------------------
// A class describing a Direct3D device that contains a
// unique supported device type
//--------------------------------------------------------------------------------------
class CD3DEnumDeviceInfo
{
public:
~CD3DEnumDeviceInfo();
UINT AdapterOrdinal;
D3DDEVTYPE DeviceType;
D3DCAPS9 Caps;
// List of CD3DEnumDeviceSettingsCombo* with a unique set
// of AdapterFormat, BackBufferFormat, and Windowed
CGrowableArray<CD3DEnumDeviceSettingsCombo*> deviceSettingsComboList;
};
//--------------------------------------------------------------------------------------
// A struct describing device settings that contains a unique combination of
// adapter format, back buffer format, and windowed that is compatible with a
// particular Direct3D device and the app.
//--------------------------------------------------------------------------------------
struct CD3DEnumDeviceSettingsCombo
{
UINT AdapterOrdinal;
D3DDEVTYPE DeviceType;
D3DFORMAT AdapterFormat;
D3DFORMAT BackBufferFormat;
BOOL Windowed;
CGrowableArray<D3DFORMAT> depthStencilFormatList; // List of D3DFORMATs
CGrowableArray<D3DMULTISAMPLE_TYPE> multiSampleTypeList; // List of D3DMULTISAMPLE_TYPEs
CGrowableArray<DWORD> multiSampleQualityList; // List of number of quality levels for each multisample type
CGrowableArray<UINT> presentIntervalList; // List of D3DPRESENT flags
CGrowableArray<CD3DEnumDSMSConflict> DSMSConflictList; // List of CD3DEnumDSMSConflict
CD3DEnumAdapterInfo* pAdapterInfo;
CD3DEnumDeviceInfo* pDeviceInfo;
};
//--------------------------------------------------------------------------------------
// A depth/stencil buffer format that is incompatible with a
// multisample type.
//--------------------------------------------------------------------------------------
struct CD3DEnumDSMSConflict
{
D3DFORMAT DSFormat;
D3DMULTISAMPLE_TYPE MSType;
};
#endif
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,889 @@
//--------------------------------------------------------------------------------------
// File: DXUTMisc.h
//
// Helper functions for Direct3D programming.
//
// Copyright (c) Microsoft Corporation. All rights reserved
//--------------------------------------------------------------------------------------
#pragma once
#ifndef DXUT_MISC_H
#define DXUT_MISC_H
//--------------------------------------------------------------------------------------
// A growable array
//--------------------------------------------------------------------------------------
template< typename TYPE >
class CGrowableArray
{
public:
CGrowableArray() { m_pData = NULL; m_nSize = 0; m_nMaxSize = 0; }
CGrowableArray( const CGrowableArray<TYPE>& a ) { for( int i=0; i < a.m_nSize; i++ ) Add( a.m_pData[i] ); }
~CGrowableArray() { RemoveAll(); }
const TYPE& operator[]( int nIndex ) const { return GetAt( nIndex ); }
TYPE& operator[]( int nIndex ) { return GetAt( nIndex ); }
CGrowableArray& operator=( const CGrowableArray<TYPE>& a ) { if( this == &a ) return *this; RemoveAll(); for( int i=0; i < a.m_nSize; i++ ) Add( a.m_pData[i] ); return *this; }
HRESULT SetSize( int nNewMaxSize );
HRESULT Add( const TYPE& value );
HRESULT Insert( int nIndex, const TYPE& value );
HRESULT SetAt( int nIndex, const TYPE& value );
TYPE& GetAt( int nIndex ) { assert( nIndex >= 0 && nIndex < m_nSize ); return m_pData[nIndex]; }
int GetSize() const { return m_nSize; }
TYPE* GetData() { return m_pData; }
bool Contains( const TYPE& value ){ return ( -1 != IndexOf( value ) ); }
int IndexOf( const TYPE& value ) { return ( m_nSize > 0 ) ? IndexOf( value, 0, m_nSize ) : -1; }
int IndexOf( const TYPE& value, int iStart ) { return IndexOf( value, iStart, m_nSize - iStart ); }
int IndexOf( const TYPE& value, int nIndex, int nNumElements );
int LastIndexOf( const TYPE& value ) { return ( m_nSize > 0 ) ? LastIndexOf( value, m_nSize-1, m_nSize ) : -1; }
int LastIndexOf( const TYPE& value, int nIndex ) { return LastIndexOf( value, nIndex, nIndex+1 ); }
int LastIndexOf( const TYPE& value, int nIndex, int nNumElements );
HRESULT Remove( int nIndex );
void RemoveAll() { SetSize(0); }
protected:
TYPE* m_pData; // the actual array of data
int m_nSize; // # of elements (upperBound - 1)
int m_nMaxSize; // max allocated
HRESULT SetSizeInternal( int nNewMaxSize ); // This version doesn't call ctor or dtor.
};
//--------------------------------------------------------------------------------------
// Performs timer operations
// Use DXUTGetGlobalTimer() to get the global instance
//--------------------------------------------------------------------------------------
class CDXUTTimer
{
public:
CDXUTTimer();
void Reset(); // resets the timer
void Start(); // starts the timer
void Stop(); // stop (or pause) the timer
void Advance(); // advance the timer by 0.1 seconds
double GetAbsoluteTime(); // get the absolute system time
double GetTime(); // get the current time
double GetElapsedTime(); // get the time that elapsed between GetElapsedTime() calls
bool IsStopped(); // returns true if timer stopped
protected:
bool m_bUsingQPF;
bool m_bTimerStopped;
LONGLONG m_llQPFTicksPerSec;
LONGLONG m_llStopTime;
LONGLONG m_llLastElapsedTime;
LONGLONG m_llBaseTime;
};
CDXUTTimer* DXUTGetGlobalTimer();
//-----------------------------------------------------------------------------
// Resource cache for textures, fonts, meshs, and effects.
// Use DXUTGetGlobalResourceCache() to access the global cache
//-----------------------------------------------------------------------------
enum DXUTCACHE_SOURCELOCATION { DXUTCACHE_LOCATION_FILE, DXUTCACHE_LOCATION_RESOURCE };
struct DXUTCache_Texture
{
DXUTCACHE_SOURCELOCATION Location;
WCHAR wszSource[MAX_PATH];
HMODULE hSrcModule;
UINT Width;
UINT Height;
UINT Depth;
UINT MipLevels;
DWORD Usage;
D3DFORMAT Format;
D3DPOOL Pool;
D3DRESOURCETYPE Type;
IDirect3DBaseTexture9 *pTexture;
};
struct DXUTCache_Font : public D3DXFONT_DESC
{
ID3DXFont *pFont;
};
struct DXUTCache_Effect
{
DXUTCACHE_SOURCELOCATION Location;
WCHAR wszSource[MAX_PATH];
HMODULE hSrcModule;
DWORD dwFlags;
ID3DXEffect *pEffect;
};
class CDXUTResourceCache
{
public:
~CDXUTResourceCache();
HRESULT CreateTextureFromFile( LPDIRECT3DDEVICE9 pDevice, LPCTSTR pSrcFile, LPDIRECT3DTEXTURE9 *ppTexture );
HRESULT CreateTextureFromFileEx( LPDIRECT3DDEVICE9 pDevice, LPCTSTR pSrcFile, UINT Width, UINT Height, UINT MipLevels, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, DWORD Filter, DWORD MipFilter, D3DCOLOR ColorKey, D3DXIMAGE_INFO *pSrcInfo, PALETTEENTRY *pPalette, LPDIRECT3DTEXTURE9 *ppTexture );
HRESULT CreateTextureFromResource( LPDIRECT3DDEVICE9 pDevice, HMODULE hSrcModule, LPCTSTR pSrcResource, LPDIRECT3DTEXTURE9 *ppTexture );
HRESULT CreateTextureFromResourceEx( LPDIRECT3DDEVICE9 pDevice, HMODULE hSrcModule, LPCTSTR pSrcResource, UINT Width, UINT Height, UINT MipLevels, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, DWORD Filter, DWORD MipFilter, D3DCOLOR ColorKey, D3DXIMAGE_INFO *pSrcInfo, PALETTEENTRY *pPalette, LPDIRECT3DTEXTURE9 *ppTexture );
HRESULT CreateCubeTextureFromFile( LPDIRECT3DDEVICE9 pDevice, LPCTSTR pSrcFile, LPDIRECT3DCUBETEXTURE9 *ppCubeTexture );
HRESULT CreateCubeTextureFromFileEx( LPDIRECT3DDEVICE9 pDevice, LPCTSTR pSrcFile, UINT Size, UINT MipLevels, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, DWORD Filter, DWORD MipFilter, D3DCOLOR ColorKey, D3DXIMAGE_INFO *pSrcInfo, PALETTEENTRY *pPalette, LPDIRECT3DCUBETEXTURE9 *ppCubeTexture );
HRESULT CreateCubeTextureFromResource( LPDIRECT3DDEVICE9 pDevice, HMODULE hSrcModule, LPCTSTR pSrcResource, LPDIRECT3DCUBETEXTURE9 *ppCubeTexture );
HRESULT CreateCubeTextureFromResourceEx( LPDIRECT3DDEVICE9 pDevice, HMODULE hSrcModule, LPCTSTR pSrcResource, UINT Size, UINT MipLevels, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, DWORD Filter, DWORD MipFilter, D3DCOLOR ColorKey, D3DXIMAGE_INFO *pSrcInfo, PALETTEENTRY *pPalette, LPDIRECT3DCUBETEXTURE9 *ppCubeTexture );
HRESULT CreateVolumeTextureFromFile( LPDIRECT3DDEVICE9 pDevice, LPCTSTR pSrcFile, LPDIRECT3DVOLUMETEXTURE9 *ppVolumeTexture );
HRESULT CreateVolumeTextureFromFileEx( LPDIRECT3DDEVICE9 pDevice, LPCTSTR pSrcFile, UINT Width, UINT Height, UINT Depth, UINT MipLevels, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, DWORD Filter, DWORD MipFilter, D3DCOLOR ColorKey, D3DXIMAGE_INFO *pSrcInfo, PALETTEENTRY *pPalette, LPDIRECT3DVOLUMETEXTURE9 *ppTexture );
HRESULT CreateVolumeTextureFromResource( LPDIRECT3DDEVICE9 pDevice, HMODULE hSrcModule, LPCTSTR pSrcResource, LPDIRECT3DVOLUMETEXTURE9 *ppVolumeTexture );
HRESULT CreateVolumeTextureFromResourceEx( LPDIRECT3DDEVICE9 pDevice, HMODULE hSrcModule, LPCTSTR pSrcResource, UINT Width, UINT Height, UINT Depth, UINT MipLevels, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, DWORD Filter, DWORD MipFilter, D3DCOLOR ColorKey, D3DXIMAGE_INFO *pSrcInfo, PALETTEENTRY *pPalette, LPDIRECT3DVOLUMETEXTURE9 *ppVolumeTexture );
HRESULT CreateFont( LPDIRECT3DDEVICE9 pDevice, UINT Height, UINT Width, UINT Weight, UINT MipLevels, BOOL Italic, DWORD CharSet, DWORD OutputPrecision, DWORD Quality, DWORD PitchAndFamily, LPCTSTR pFacename, LPD3DXFONT *ppFont );
HRESULT CreateFontIndirect( LPDIRECT3DDEVICE9 pDevice, CONST D3DXFONT_DESC *pDesc, LPD3DXFONT *ppFont );
HRESULT CreateEffectFromFile( LPDIRECT3DDEVICE9 pDevice, LPCTSTR pSrcFile, const D3DXMACRO *pDefines, LPD3DXINCLUDE pInclude, DWORD Flags, LPD3DXEFFECTPOOL pPool, LPD3DXEFFECT *ppEffect, LPD3DXBUFFER *ppCompilationErrors );
HRESULT CreateEffectFromResource( LPDIRECT3DDEVICE9 pDevice, HMODULE hSrcModule, LPCTSTR pSrcResource, const D3DXMACRO *pDefines, LPD3DXINCLUDE pInclude, DWORD Flags, LPD3DXEFFECTPOOL pPool, LPD3DXEFFECT *ppEffect, LPD3DXBUFFER *ppCompilationErrors );
public:
HRESULT OnCreateDevice( IDirect3DDevice9 *pd3dDevice );
HRESULT OnResetDevice( IDirect3DDevice9 *pd3dDevice );
HRESULT OnLostDevice();
HRESULT OnDestroyDevice();
protected:
friend CDXUTResourceCache& DXUTGetGlobalResourceCache();
friend HRESULT DXUTInitialize3DEnvironment();
friend HRESULT DXUTReset3DEnvironment();
friend void DXUTCleanup3DEnvironment( bool bReleaseSettings );
CDXUTResourceCache() { }
CGrowableArray< DXUTCache_Texture > m_TextureCache;
CGrowableArray< DXUTCache_Effect > m_EffectCache;
CGrowableArray< DXUTCache_Font > m_FontCache;
};
CDXUTResourceCache& DXUTGetGlobalResourceCache();
//--------------------------------------------------------------------------------------
class CD3DArcBall
{
public:
CD3DArcBall();
// Functions to change behavior
void Reset();
void SetTranslationRadius( FLOAT fRadiusTranslation ) { m_fRadiusTranslation = fRadiusTranslation; }
void SetWindow( INT nWidth, INT nHeight, FLOAT fRadius = 0.9f ) { m_nWidth = nWidth; m_nHeight = nHeight; m_fRadius = fRadius; m_vCenter = D3DXVECTOR2(m_nWidth/2.0f,m_nHeight/2.0f); }
void SetOffset( INT nX, INT nY ) { m_Offset.x = nX; m_Offset.y = nY; }
// Call these from client and use GetRotationMatrix() to read new rotation matrix
void OnBegin( int nX, int nY ); // start the rotation (pass current mouse position)
void OnMove( int nX, int nY ); // continue the rotation (pass current mouse position)
void OnEnd(); // end the rotation
// Or call this to automatically handle left, middle, right buttons
LRESULT HandleMessages( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam );
// Functions to get/set state
D3DXMATRIX* GetRotationMatrix() { return D3DXMatrixRotationQuaternion(&m_mRotation, &m_qNow); };
D3DXMATRIX* GetTranslationMatrix() { return &m_mTranslation; }
D3DXMATRIX* GetTranslationDeltaMatrix() { return &m_mTranslationDelta; }
bool IsBeingDragged() { return m_bDrag; }
D3DXQUATERNION GetQuatNow() { return m_qNow; }
void SetQuatNow( D3DXQUATERNION q ) { m_qNow = q; }
static D3DXQUATERNION QuatFromBallPoints( const D3DXVECTOR3 &vFrom, const D3DXVECTOR3 &vTo );
protected:
D3DXMATRIXA16 m_mRotation; // Matrix for arc ball's orientation
D3DXMATRIXA16 m_mTranslation; // Matrix for arc ball's position
D3DXMATRIXA16 m_mTranslationDelta; // Matrix for arc ball's position
POINT m_Offset; // window offset, or upper-left corner of window
INT m_nWidth; // arc ball's window width
INT m_nHeight; // arc ball's window height
D3DXVECTOR2 m_vCenter; // center of arc ball
FLOAT m_fRadius; // arc ball's radius in screen coords
FLOAT m_fRadiusTranslation; // arc ball's radius for translating the target
D3DXQUATERNION m_qDown; // Quaternion before button down
D3DXQUATERNION m_qNow; // Composite quaternion for current drag
bool m_bDrag; // Whether user is dragging arc ball
POINT m_ptLastMouse; // position of last mouse point
D3DXVECTOR3 m_vDownPt; // starting point of rotation arc
D3DXVECTOR3 m_vCurrentPt; // current point of rotation arc
D3DXVECTOR3 ScreenToVector( float fScreenPtX, float fScreenPtY );
};
//--------------------------------------------------------------------------------------
// used by CCamera to map WM_KEYDOWN keys
//--------------------------------------------------------------------------------------
enum D3DUtil_CameraKeys
{
CAM_STRAFE_LEFT = 0,
CAM_STRAFE_RIGHT,
CAM_MOVE_FORWARD,
CAM_MOVE_BACKWARD,
CAM_MOVE_UP,
CAM_MOVE_DOWN,
CAM_RESET,
CAM_CONTROLDOWN,
CAM_MAX_KEYS,
CAM_UNKNOWN = 0xFF
};
#define KEY_WAS_DOWN_MASK 0x80
#define KEY_IS_DOWN_MASK 0x01
#define MOUSE_LEFT_BUTTON 0x01
#define MOUSE_MIDDLE_BUTTON 0x02
#define MOUSE_RIGHT_BUTTON 0x04
#define MOUSE_WHEEL 0x08
//--------------------------------------------------------------------------------------
// Simple base camera class that moves and rotates. The base class
// records mouse and keyboard input for use by a derived class, and
// keeps common state.
//--------------------------------------------------------------------------------------
class CBaseCamera
{
public:
CBaseCamera();
// Call these from client and use Get*Matrix() to read new matrices
virtual LRESULT HandleMessages( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam );
virtual void FrameMove( FLOAT fElapsedTime ) = 0;
// Functions to change camera matrices
virtual void Reset();
virtual void SetViewParams( D3DXVECTOR3* pvEyePt, D3DXVECTOR3* pvLookatPt );
virtual void SetProjParams( FLOAT fFOV, FLOAT fAspect, FLOAT fNearPlane, FLOAT fFarPlane );
// Functions to change behavior
virtual void SetDragRect( RECT &rc ) { m_rcDrag = rc; }
void SetInvertPitch( bool bInvertPitch ) { m_bInvertPitch = bInvertPitch; }
void SetDrag( bool bMovementDrag, FLOAT fTotalDragTimeToZero = 0.25f ) { m_bMovementDrag = bMovementDrag; m_fTotalDragTimeToZero = fTotalDragTimeToZero; }
void SetEnableYAxisMovement( bool bEnableYAxisMovement ) { m_bEnableYAxisMovement = bEnableYAxisMovement; }
void SetEnablePositionMovement( bool bEnablePositionMovement ) { m_bEnablePositionMovement = bEnablePositionMovement; }
void SetClipToBoundary( bool bClipToBoundary, D3DXVECTOR3* pvMinBoundary, D3DXVECTOR3* pvMaxBoundary ) { m_bClipToBoundary = bClipToBoundary; if( pvMinBoundary ) m_vMinBoundary = *pvMinBoundary; if( pvMaxBoundary ) m_vMaxBoundary = *pvMaxBoundary; }
void SetScalers( FLOAT fRotationScaler = 0.01f, FLOAT fMoveScaler = 5.0f ) { m_fRotationScaler = fRotationScaler; m_fMoveScaler = fMoveScaler; }
void SetNumberOfFramesToSmoothMouseData( int nFrames ) { if( nFrames > 0 ) m_fFramesToSmoothMouseData = (float)nFrames; }
void SetResetCursorAfterMove( bool bResetCursorAfterMove ) { m_bResetCursorAfterMove = bResetCursorAfterMove; }
// Functions to get state
const D3DXMATRIX* GetViewMatrix() const { return &m_mView; }
const D3DXMATRIX* GetProjMatrix() const { return &m_mProj; }
const D3DXVECTOR3* GetEyePt() const { return &m_vEye; }
const D3DXVECTOR3* GetLookAtPt() const { return &m_vLookAt; }
bool IsBeingDragged() { return (m_bMouseLButtonDown || m_bMouseMButtonDown || m_bMouseRButtonDown); }
bool IsMouseLButtonDown() { return m_bMouseLButtonDown; }
bool IsMouseMButtonDown() { return m_bMouseMButtonDown; }
bool IsMouseRButtonDown() { return m_bMouseRButtonDown; }
protected:
// Functions to map a WM_KEYDOWN key to a D3DUtil_CameraKeys enum
virtual D3DUtil_CameraKeys MapKey( UINT nKey );
bool IsKeyDown( BYTE key ) { return( (key & KEY_IS_DOWN_MASK) == KEY_IS_DOWN_MASK ); }
bool WasKeyDown( BYTE key ) { return( (key & KEY_WAS_DOWN_MASK) == KEY_WAS_DOWN_MASK ); }
void ConstrainToBoundary( D3DXVECTOR3* pV );
void UpdateMouseDelta( float fElapsedTime );
void UpdateVelocity( float fElapsedTime );
D3DXMATRIX m_mView; // View matrix
D3DXMATRIX m_mProj; // Projection matrix
BYTE m_aKeys[CAM_MAX_KEYS]; // State of input - KEY_WAS_DOWN_MASK|KEY_IS_DOWN_MASK
POINT m_ptLastMousePosition; // Last absolute position of mouse cursor
bool m_bMouseLButtonDown; // True if left button is down
bool m_bMouseMButtonDown; // True if middle button is down
bool m_bMouseRButtonDown; // True if right button is down
int m_nCurrentButtonMask; // mask of which buttons are down
int m_nMouseWheelDelta; // Amount of middle wheel scroll (+/-)
D3DXVECTOR2 m_vMouseDelta; // Mouse relative delta smoothed over a few frames
float m_fFramesToSmoothMouseData; // Number of frames to smooth mouse data over
D3DXVECTOR3 m_vDefaultEye; // Default camera eye position
D3DXVECTOR3 m_vDefaultLookAt; // Default LookAt position
D3DXVECTOR3 m_vEye; // Camera eye position
D3DXVECTOR3 m_vLookAt; // LookAt position
float m_fCameraYawAngle; // Yaw angle of camera
float m_fCameraPitchAngle; // Pitch angle of camera
RECT m_rcDrag; // Rectangle within which a drag can be initiated.
D3DXVECTOR3 m_vVelocity; // Velocity of camera
bool m_bMovementDrag; // If true, then camera movement will slow to a stop otherwise movement is instant
D3DXVECTOR3 m_vVelocityDrag; // Velocity drag force
FLOAT m_fDragTimer; // Countdown timer to apply drag
FLOAT m_fTotalDragTimeToZero; // Time it takes for velocity to go from full to 0
D3DXVECTOR2 m_vRotVelocity; // Velocity of camera
float m_fFOV; // Field of view
float m_fAspect; // Aspect ratio
float m_fNearPlane; // Near plane
float m_fFarPlane; // Far plane
float m_fRotationScaler; // Scaler for rotation
float m_fMoveScaler; // Scaler for movement
bool m_bInvertPitch; // Invert the pitch axis
bool m_bEnablePositionMovement; // If true, then the user can translate the camera/model
bool m_bEnableYAxisMovement; // If true, then camera can move in the y-axis
bool m_bClipToBoundary; // If true, then the camera will be clipped to the boundary
D3DXVECTOR3 m_vMinBoundary; // Min point in clip boundary
D3DXVECTOR3 m_vMaxBoundary; // Max point in clip boundary
bool m_bResetCursorAfterMove;// If true, the class will reset the cursor position so that the cursor always has space to move
};
//--------------------------------------------------------------------------------------
// Simple first person camera class that moves and rotates.
// It allows yaw and pitch but not roll. It uses WM_KEYDOWN and
// GetCursorPos() to respond to keyboard and mouse input and updates the
// view matrix based on input.
//--------------------------------------------------------------------------------------
class CFirstPersonCamera : public CBaseCamera
{
public:
CFirstPersonCamera();
// Call these from client and use Get*Matrix() to read new matrices
virtual void FrameMove( FLOAT fElapsedTime );
// Functions to change behavior
void SetRotateButtons( bool bLeft, bool bMiddle, bool bRight );
// Functions to get state
D3DXMATRIX* GetWorldMatrix() { return &m_mCameraWorld; }
const D3DXVECTOR3* GetWorldRight() const { return (D3DXVECTOR3*)&m_mCameraWorld._11; }
const D3DXVECTOR3* GetWorldUp() const { return (D3DXVECTOR3*)&m_mCameraWorld._21; }
const D3DXVECTOR3* GetWorldAhead() const { return (D3DXVECTOR3*)&m_mCameraWorld._31; }
const D3DXVECTOR3* GetEyePt() const { return (D3DXVECTOR3*)&m_mCameraWorld._41; }
protected:
D3DXMATRIX m_mCameraWorld; // World matrix of the camera (inverse of the view matrix)
int m_nActiveButtonMask; // Mask to determine which button to enable for rotation
};
//--------------------------------------------------------------------------------------
// Simple model viewing camera class that rotates around the object.
//--------------------------------------------------------------------------------------
class CModelViewerCamera : public CBaseCamera
{
public:
CModelViewerCamera();
// Call these from client and use Get*Matrix() to read new matrices
virtual LRESULT HandleMessages( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam );
virtual void FrameMove( FLOAT fElapsedTime );
// Functions to change behavior
virtual void SetDragRect( RECT &rc );
void Reset();
void SetViewParams( D3DXVECTOR3* pvEyePt, D3DXVECTOR3* pvLookatPt );
void SetButtonMasks( int nRotateModelButtonMask = MOUSE_LEFT_BUTTON, int nZoomButtonMask = MOUSE_WHEEL, int nRotateCameraButtonMask = MOUSE_RIGHT_BUTTON ) { m_nRotateModelButtonMask = nRotateModelButtonMask, m_nZoomButtonMask = nZoomButtonMask; m_nRotateCameraButtonMask = nRotateCameraButtonMask; }
void SetAttachCameraToModel( bool bEnable = false ) { m_bAttachCameraToModel = bEnable; }
void SetWindow( int nWidth, int nHeight, float fArcballRadius=0.9f ) { m_WorldArcBall.SetWindow( nWidth, nHeight, fArcballRadius ); m_ViewArcBall.SetWindow( nWidth, nHeight, fArcballRadius ); }
void SetRadius( float fDefaultRadius=5.0f, float fMinRadius=1.0f, float fMaxRadius=FLT_MAX ) { m_fDefaultRadius = m_fRadius = fDefaultRadius; m_fMinRadius = fMinRadius; m_fMaxRadius = fMaxRadius; }
void SetModelCenter( D3DXVECTOR3 vModelCenter ) { m_vModelCenter = vModelCenter; }
void SetLimitPitch( bool bLimitPitch ) { m_bLimitPitch = bLimitPitch; }
void SetViewQuat( D3DXQUATERNION q ) { m_ViewArcBall.SetQuatNow( q ); m_bDragSinceLastUpdate = true; }
void SetWorldQuat( D3DXQUATERNION q ) { m_WorldArcBall.SetQuatNow( q ); m_bDragSinceLastUpdate = true; }
// Functions to get state
D3DXMATRIX* GetWorldMatrix() { return &m_mWorld; }
protected:
CD3DArcBall m_WorldArcBall;
CD3DArcBall m_ViewArcBall;
D3DXVECTOR3 m_vModelCenter;
D3DXMATRIX m_mModelLastRot; // Last arcball rotation matrix for model
D3DXMATRIX m_mModelRot; // Rotation matrix of model
D3DXMATRIX m_mWorld; // World matrix of model
int m_nRotateModelButtonMask;
int m_nZoomButtonMask;
int m_nRotateCameraButtonMask;
bool m_bAttachCameraToModel;
bool m_bLimitPitch;
float m_fRadius; // Distance from the camera to model
float m_fDefaultRadius; // Distance from the camera to model
float m_fMinRadius; // Min radius
float m_fMaxRadius; // Max radius
bool m_bDragSinceLastUpdate; // True if mouse drag has happened since last time FrameMove is called.
D3DXMATRIX m_mCameraRotLast;
};
//--------------------------------------------------------------------------------------
// Manages the intertion point when drawing text
//--------------------------------------------------------------------------------------
class CDXUTTextHelper
{
public:
CDXUTTextHelper( ID3DXFont* pFont, ID3DXSprite* pSprite, int nLineHeight );
void SetInsertionPos( int x, int y ) { m_pt.x = x; m_pt.y = y; }
void SetForegroundColor( D3DXCOLOR clr ) { m_clr = clr; }
void Begin();
HRESULT DrawFormattedTextLine( const WCHAR* strMsg, ... );
HRESULT DrawTextLine( const WCHAR* strMsg );
HRESULT DrawFormattedTextLine( RECT &rc, DWORD dwFlags, const WCHAR* strMsg, ... );
HRESULT DrawTextLine( RECT &rc, DWORD dwFlags, const WCHAR* strMsg );
void End();
protected:
ID3DXFont* m_pFont;
ID3DXSprite* m_pSprite;
D3DXCOLOR m_clr;
POINT m_pt;
int m_nLineHeight;
};
//--------------------------------------------------------------------------------------
// Manages a persistent list of lines and draws them using ID3DXLine
//--------------------------------------------------------------------------------------
class CDXUTLineManager
{
public:
CDXUTLineManager();
~CDXUTLineManager();
HRESULT OnCreatedDevice( IDirect3DDevice9* pd3dDevice );
HRESULT OnResetDevice();
HRESULT OnRender();
HRESULT OnLostDevice();
HRESULT OnDeletedDevice();
HRESULT AddLine( int* pnLineID, D3DXVECTOR2* pVertexList, DWORD dwVertexListCount, D3DCOLOR Color, float fWidth, float fScaleRatio, bool bAntiAlias );
HRESULT AddRect( int* pnLineID, RECT rc, D3DCOLOR Color, float fWidth, float fScaleRatio, bool bAntiAlias );
HRESULT RemoveLine( int nLineID );
HRESULT RemoveAllLines();
protected:
struct LINE_NODE
{
int nLineID;
D3DCOLOR Color;
float fWidth;
bool bAntiAlias;
float fScaleRatio;
D3DXVECTOR2* pVertexList;
DWORD dwVertexListCount;
};
CGrowableArray<LINE_NODE*> m_LinesList;
IDirect3DDevice9* m_pd3dDevice;
ID3DXLine* m_pD3DXLine;
};
//--------------------------------------------------------------------------------------
// Manages the mesh, direction, mouse events of a directional arrow that
// rotates around a radius controlled by an arcball
//--------------------------------------------------------------------------------------
class CDXUTDirectionWidget
{
public:
CDXUTDirectionWidget();
static HRESULT StaticOnCreateDevice( IDirect3DDevice9* pd3dDevice );
HRESULT OnResetDevice( const D3DSURFACE_DESC* pBackBufferSurfaceDesc );
HRESULT OnRender( D3DXCOLOR color, const D3DXMATRIX* pmView, const D3DXMATRIX* pmProj, const D3DXVECTOR3* pEyePt );
LRESULT HandleMessages( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam );
static void StaticOnLostDevice();
static void StaticOnDestroyDevice();
D3DXVECTOR3 GetLightDirection() { return m_vCurrentDir; };
void SetLightDirection( D3DXVECTOR3 vDir ) { m_vDefaultDir = m_vCurrentDir = vDir; };
void SetButtonMask( int nRotate = MOUSE_RIGHT_BUTTON ) { m_nRotateMask = nRotate; }
float GetRadius() { return m_fRadius; };
void SetRadius( float fRadius ) { m_fRadius = fRadius; };
bool IsBeingDragged() { return m_ArcBall.IsBeingDragged(); };
protected:
HRESULT UpdateLightDir();
static IDirect3DDevice9* s_pd3dDevice;
static ID3DXEffect* s_pEffect;
static ID3DXMesh* s_pMesh;
float m_fRadius;
int m_nRotateMask;
CD3DArcBall m_ArcBall;
D3DXVECTOR3 m_vDefaultDir;
D3DXVECTOR3 m_vCurrentDir;
D3DXMATRIX m_mView;
D3DXMATRIXA16 m_mRot;
D3DXMATRIXA16 m_mRotSnapshot;
};
//--------------------------------------------------------------------------------------
// Tries to finds a media file by searching in common locations
//--------------------------------------------------------------------------------------
HRESULT DXUTFindDXSDKMediaFileCch( WCHAR* strDestPath, int cchDest, LPCWSTR strFilename );
HRESULT DXUTSetMediaSearchPath( LPCWSTR strPath );
LPCWSTR DXUTGetMediaSearchPath();
//--------------------------------------------------------------------------------------
// Returns the string for the given D3DFORMAT.
// bWithPrefix determines whether the string should include the "D3DFMT_"
//--------------------------------------------------------------------------------------
LPCWSTR DXUTD3DFormatToString( D3DFORMAT format, bool bWithPrefix );
//--------------------------------------------------------------------------------------
// Builds and sets a cursor for the D3D device based on hCursor.
//--------------------------------------------------------------------------------------
HRESULT DXUTSetDeviceCursor( IDirect3DDevice9* pd3dDevice, HCURSOR hCursor, bool bAddWatermark );
//--------------------------------------------------------------------------------------
// Returns a view matrix for rendering to a face of a cubemap.
//--------------------------------------------------------------------------------------
D3DXMATRIX DXUTGetCubeMapViewMatrix( DWORD dwFace );
//--------------------------------------------------------------------------------------
// Debug printing support
// See dxerr9.h for more debug printing support
//--------------------------------------------------------------------------------------
void DXUTOutputDebugStringW( LPCWSTR strMsg, ... );
void DXUTOutputDebugStringA( LPCSTR strMsg, ... );
HRESULT WINAPI DXUTTrace( const CHAR* strFile, DWORD dwLine, HRESULT hr, const WCHAR* strMsg, bool bPopMsgBox );
#ifdef UNICODE
#define DXUTOutputDebugString DXUTOutputDebugStringW
#else
#define DXUTOutputDebugString DXUTOutputDebugStringA
#endif
// These macros are very similar to dxerr9's but it special cases the HRESULT defined
// by the sample framework pop better message boxes.
#if defined(DEBUG) | defined(_DEBUG)
#define DXUT_ERR(str,hr) DXUTTrace( __FILE__, (DWORD)__LINE__, hr, str, false )
#define DXUT_ERR_MSGBOX(str,hr) DXUTTrace( __FILE__, (DWORD)__LINE__, hr, str, true )
#define DXUTTRACE DXUTOutputDebugString
#else
#define DXUT_ERR(str,hr) (hr)
#define DXUT_ERR_MSGBOX(str,hr) (hr)
#define DXUTTRACE (__noop)
#endif
//--------------------------------------------------------------------------------------
// Direct3D9 dynamic linking support -- calls top-level D3D9 APIs with graceful
// failure if APIs are not present.
//--------------------------------------------------------------------------------------
IDirect3D9 * WINAPI DXUT_Dynamic_Direct3DCreate9(UINT SDKVersion);
int WINAPI DXUT_Dynamic_D3DPERF_BeginEvent( D3DCOLOR col, LPCWSTR wszName );
int WINAPI DXUT_Dynamic_D3DPERF_EndEvent( void );
void WINAPI DXUT_Dynamic_D3DPERF_SetMarker( D3DCOLOR col, LPCWSTR wszName );
void WINAPI DXUT_Dynamic_D3DPERF_SetRegion( D3DCOLOR col, LPCWSTR wszName );
BOOL WINAPI DXUT_Dynamic_D3DPERF_QueryRepeatFrame( void );
void WINAPI DXUT_Dynamic_D3DPERF_SetOptions( DWORD dwOptions );
DWORD WINAPI DXUT_Dynamic_D3DPERF_GetStatus( void );
//--------------------------------------------------------------------------------------
// Profiling/instrumentation support
//--------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------
// Some D3DPERF APIs take a color that can be used when displaying user events in
// performance analysis tools. The following constants are provided for your
// convenience, but you can use any colors you like.
//--------------------------------------------------------------------------------------
const D3DCOLOR DXUT_PERFEVENTCOLOR = D3DCOLOR_XRGB(200,100,100);
const D3DCOLOR DXUT_PERFEVENTCOLOR2 = D3DCOLOR_XRGB(100,200,100);
const D3DCOLOR DXUT_PERFEVENTCOLOR3 = D3DCOLOR_XRGB(100,100,200);
//--------------------------------------------------------------------------------------
// The following macros provide a convenient way for your code to call the D3DPERF
// functions only when PROFILE is defined. If PROFILE is not defined (as for the final
// release version of a program), these macros evaluate to nothing, so no detailed event
// information is embedded in your shipping program. It is recommended that you create
// and use three build configurations for your projects:
// Debug (nonoptimized code, asserts active, PROFILE defined to assist debugging)
// Profile (optimized code, asserts disabled, PROFILE defined to assist optimization)
// Release (optimized code, asserts disabled, PROFILE not defined)
//--------------------------------------------------------------------------------------
#ifdef PROFILE
// PROFILE is defined, so these macros call the D3DPERF functions
#define DXUT_BeginPerfEvent( color, pstrMessage ) DXUT_Dynamic_D3DPERF_BeginEvent( color, pstrMessage )
#define DXUT_EndPerfEvent() DXUT_Dynamic_D3DPERF_EndEvent()
#define DXUT_SetPerfMarker( color, pstrMessage ) DXUT_Dynamic_D3DPERF_SetMarker( color, pstrMessage )
#else
// PROFILE is not defined, so these macros do nothing
#define DXUT_BeginPerfEvent( color, pstrMessage ) (__noop)
#define DXUT_EndPerfEvent() (__noop)
#define DXUT_SetPerfMarker( color, pstrMessage ) (__noop)
#endif
//--------------------------------------------------------------------------------------
// CDXUTPerfEventGenerator is a helper class that makes it easy to attach begin and end
// events to a block of code. Simply define a CDXUTPerfEventGenerator variable anywhere
// in a block of code, and the class's constructor will call DXUT_BeginPerfEvent when
// the block of code begins, and the class's destructor will call DXUT_EndPerfEvent when
// the block ends.
//--------------------------------------------------------------------------------------
class CDXUTPerfEventGenerator
{
public:
CDXUTPerfEventGenerator( D3DCOLOR color, LPCWSTR pstrMessage ) { DXUT_BeginPerfEvent( color, pstrMessage ); }
~CDXUTPerfEventGenerator( void ) { DXUT_EndPerfEvent(); }
};
//--------------------------------------------------------------------------------------
// Implementation of CGrowableArray
//--------------------------------------------------------------------------------------
// This version doesn't call ctor or dtor.
template< typename TYPE >
HRESULT CGrowableArray<TYPE>::SetSizeInternal( int nNewMaxSize )
{
if( nNewMaxSize < 0 )
{
assert( false );
return E_INVALIDARG;
}
if( nNewMaxSize == 0 )
{
// Shrink to 0 size & cleanup
if( m_pData )
{
free( m_pData );
m_pData = NULL;
}
m_nMaxSize = 0;
m_nSize = 0;
}
else if( m_pData == NULL || nNewMaxSize > m_nMaxSize )
{
// Grow array
int nGrowBy = ( m_nMaxSize == 0 ) ? 16 : m_nMaxSize;
nNewMaxSize = max( nNewMaxSize, m_nMaxSize + nGrowBy );
TYPE* pDataNew = (TYPE*) realloc( m_pData, nNewMaxSize * sizeof(TYPE) );
if( pDataNew == NULL )
return E_OUTOFMEMORY;
m_pData = pDataNew;
m_nMaxSize = nNewMaxSize;
}
return S_OK;
}
//--------------------------------------------------------------------------------------
template< typename TYPE >
HRESULT CGrowableArray<TYPE>::SetSize( int nNewMaxSize )
{
int nOldSize = m_nSize;
if( nOldSize > nNewMaxSize )
{
// Removing elements. Call dtor.
for( int i = nNewMaxSize; i < nOldSize; ++i )
m_pData[i].~TYPE();
}
// Adjust buffer. Note that there's no need to check for error
// since if it happens, nOldSize == nNewMaxSize will be true.)
HRESULT hr = SetSizeInternal( nNewMaxSize );
if( nOldSize < nNewMaxSize )
{
// Adding elements. Call ctor.
for( int i = nOldSize; i < nNewMaxSize; ++i )
::new (&m_pData[i]) TYPE;
}
return hr;
}
//--------------------------------------------------------------------------------------
template< typename TYPE >
HRESULT CGrowableArray<TYPE>::Add( const TYPE& value )
{
HRESULT hr;
if( FAILED( hr = SetSizeInternal( m_nSize + 1 ) ) )
return hr;
// Construct the new element
::new (&m_pData[m_nSize]) TYPE;
// Assign
m_pData[m_nSize] = value;
++m_nSize;
return S_OK;
}
//--------------------------------------------------------------------------------------
template< typename TYPE >
HRESULT CGrowableArray<TYPE>::Insert( int nIndex, const TYPE& value )
{
HRESULT hr;
// Validate index
if( nIndex < 0 ||
nIndex > m_nSize )
{
assert( false );
return E_INVALIDARG;
}
// Prepare the buffer
if( FAILED( hr = SetSizeInternal( m_nSize + 1 ) ) )
return hr;
// Shift the array
MoveMemory( &m_pData[nIndex+1], &m_pData[nIndex], sizeof(TYPE) * (m_nSize - nIndex) );
// Construct the new element
::new (&m_pData[nIndex]) TYPE;
// Set the value and increase the size
m_pData[nIndex] = value;
++m_nSize;
return S_OK;
}
//--------------------------------------------------------------------------------------
template< typename TYPE >
HRESULT CGrowableArray<TYPE>::SetAt( int nIndex, const TYPE& value )
{
// Validate arguments
if( nIndex < 0 ||
nIndex >= m_nSize )
{
assert( false );
return E_INVALIDARG;
}
m_pData[nIndex] = value;
return S_OK;
}
//--------------------------------------------------------------------------------------
// Searches for the specified value and returns the index of the first occurrence
// within the section of the data array that extends from iStart and contains the
// specified number of elements. Returns -1 if value is not found within the given
// section.
//--------------------------------------------------------------------------------------
template< typename TYPE >
int CGrowableArray<TYPE>::IndexOf( const TYPE& value, int iStart, int nNumElements )
{
// Validate arguments
if( iStart < 0 ||
iStart >= m_nSize ||
nNumElements < 0 ||
iStart + nNumElements > m_nSize )
{
assert( false );
return -1;
}
// Search
for( int i = iStart; i < (iStart + nNumElements); i++ )
{
if( value == m_pData[i] )
return i;
}
// Not found
return -1;
}
//--------------------------------------------------------------------------------------
// Searches for the specified value and returns the index of the last occurrence
// within the section of the data array that contains the specified number of elements
// and ends at iEnd. Returns -1 if value is not found within the given section.
//--------------------------------------------------------------------------------------
template< typename TYPE >
int CGrowableArray<TYPE>::LastIndexOf( const TYPE& value, int iEnd, int nNumElements )
{
// Validate arguments
if( iEnd < 0 ||
iEnd >= m_nSize ||
nNumElements < 0 ||
iEnd - nNumElements < 0 )
{
assert( false );
return -1;
}
// Search
for( int i = iEnd; i > (iEnd - nNumElements); i-- )
{
if( value == m_pData[i] )
return i;
}
// Not found
return -1;
}
//--------------------------------------------------------------------------------------
template< typename TYPE >
HRESULT CGrowableArray<TYPE>::Remove( int nIndex )
{
if( nIndex < 0 ||
nIndex >= m_nSize )
{
assert( false );
return E_INVALIDARG;
}
// Destruct the element to be removed
m_pData[nIndex].~TYPE();
// Compact the array and decrease the size
MoveMemory( &m_pData[nIndex], &m_pData[nIndex+1], sizeof(TYPE) * (m_nSize - (nIndex+1)) );
--m_nSize;
return S_OK;
}
#endif
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,139 @@
//--------------------------------------------------------------------------------------
// File: DXUTSettingsDlg.cpp
//
// Copyright (c) Microsoft Corporation. All rights reserved
//--------------------------------------------------------------------------------------
#pragma once
#ifndef DXUT_SETTINGS_H
#define DXUT_SETTINGS_H
//--------------------------------------------------------------------------------------
// Control IDs
//--------------------------------------------------------------------------------------
#define DXUTSETTINGSDLG_STATIC -1
#define DXUTSETTINGSDLG_OK 1
#define DXUTSETTINGSDLG_CANCEL 2
#define DXUTSETTINGSDLG_ADAPTER 3
#define DXUTSETTINGSDLG_DEVICE_TYPE 4
#define DXUTSETTINGSDLG_WINDOWED 5
#define DXUTSETTINGSDLG_FULLSCREEN 6
#define DXUTSETTINGSDLG_ADAPTER_FORMAT 7
#define DXUTSETTINGSDLG_ADAPTER_FORMAT_LABEL 8
#define DXUTSETTINGSDLG_RESOLUTION 9
#define DXUTSETTINGSDLG_RESOLUTION_LABEL 10
#define DXUTSETTINGSDLG_REFRESH_RATE 11
#define DXUTSETTINGSDLG_REFRESH_RATE_LABEL 12
#define DXUTSETTINGSDLG_BACK_BUFFER_FORMAT 13
#define DXUTSETTINGSDLG_DEPTH_STENCIL 14
#define DXUTSETTINGSDLG_MULTISAMPLE_TYPE 15
#define DXUTSETTINGSDLG_MULTISAMPLE_QUALITY 16
#define DXUTSETTINGSDLG_VERTEX_PROCESSING 17
#define DXUTSETTINGSDLG_PRESENT_INTERVAL 18
#define DXUTSETTINGSDLG_DEVICECLIP 19
#define DXUTSETTINGSDLG_WINDOWED_GROUP 0x0100
//--------------------------------------------------------------------------------------
// Dialog for selection of device settings
// Use DXUTGetSettingsDialog() to access global instance
// To control the contents of the dialog, use the CD3DEnumeration class.
//--------------------------------------------------------------------------------------
class CD3DSettingsDlg
{
public:
HRESULT OnCreateDevice( IDirect3DDevice9* pd3dDevice );
HRESULT Refresh();
HRESULT OnResetDevice();
HRESULT OnLostDevice();
HRESULT OnRender( float fElapsedTime );
HRESULT OnDestroyDevice();
CDXUTDialog* GetDialogControl() { return &m_Dialog; }
LRESULT HandleMessages( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam );
~CD3DSettingsDlg();
protected:
friend CD3DSettingsDlg* DXUTGetSettingsDialog();
// Use DXUTGetSettingsDialog() to access global instance
CD3DSettingsDlg();
void CreateControls();
HRESULT SetDeviceSettingsFromUI();
void OnEvent( UINT nEvent, int nControlID, CDXUTControl* pControl );
static void WINAPI StaticOnEvent( UINT nEvent, int nControlID, CDXUTControl* pControl );
CD3DEnumAdapterInfo* GetCurrentAdapterInfo();
CD3DEnumDeviceInfo* GetCurrentDeviceInfo();
CD3DEnumDeviceSettingsCombo* GetCurrentDeviceSettingsCombo();
void AddAdapter( const WCHAR* strDescription, UINT iAdapter );
UINT GetSelectedAdapter();
void AddDeviceType( D3DDEVTYPE devType );
D3DDEVTYPE GetSelectedDeviceType();
void SetWindowed( bool bWindowed );
bool IsWindowed();
void AddAdapterFormat( D3DFORMAT format );
D3DFORMAT GetSelectedAdapterFormat();
void AddResolution( DWORD dwWidth, DWORD dwHeight );
void GetSelectedResolution( DWORD* pdwWidth, DWORD* pdwHeight );
void AddRefreshRate( DWORD dwRate );
DWORD GetSelectedRefreshRate();
void AddBackBufferFormat( D3DFORMAT format );
D3DFORMAT GetSelectedBackBufferFormat();
void AddDepthStencilBufferFormat( D3DFORMAT format );
D3DFORMAT GetSelectedDepthStencilBufferFormat();
void AddMultisampleType( D3DMULTISAMPLE_TYPE type );
D3DMULTISAMPLE_TYPE GetSelectedMultisampleType();
void AddMultisampleQuality( DWORD dwQuality );
DWORD GetSelectedMultisampleQuality();
void AddVertexProcessingType( DWORD dwType );
DWORD GetSelectedVertexProcessingType();
void AddPresentInterval( DWORD dwInterval );
DWORD GetSelectedPresentInterval();
void SetDeviceClip( bool bDeviceClip );
bool IsDeviceClip();
HRESULT OnAdapterChanged();
HRESULT OnDeviceTypeChanged();
HRESULT OnWindowedFullScreenChanged();
HRESULT OnAdapterFormatChanged();
HRESULT OnResolutionChanged();
HRESULT OnRefreshRateChanged();
HRESULT OnBackBufferFormatChanged();
HRESULT OnDepthStencilBufferFormatChanged();
HRESULT OnMultisampleTypeChanged();
HRESULT OnMultisampleQualityChanged();
HRESULT OnVertexProcessingChanged();
HRESULT OnPresentIntervalChanged();
HRESULT OnDeviceClipChanged();
CDXUTDialog m_Dialog;
DWORD m_dwWindowWidth;
DWORD m_dwWindowHeight;
};
CD3DSettingsDlg* DXUTGetSettingsDialog();
#endif
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,151 @@
//-----------------------------------------------------------------------------
// File: DXUTsound.h
//
// Copyright (c) Microsoft Corp. All rights reserved.
//-----------------------------------------------------------------------------
#ifndef DXUTSOUND_H
#define DXUTSOUND_H
//-----------------------------------------------------------------------------
// Classes used by this header
//-----------------------------------------------------------------------------
class CSoundManager;
class CSound;
class CStreamingSound;
class CWaveFile;
//-----------------------------------------------------------------------------
// Typing macros
//-----------------------------------------------------------------------------
#define WAVEFILE_READ 1
#define WAVEFILE_WRITE 2
#define DXUT_StopSound(s) { if(s) s->Stop(); }
#define DXUT_PlaySound(s) { if(s) s->Play( 0, 0 ); }
#define DXUT_PlaySoundLooping(s) { if(s) s->Play( 0, DSBPLAY_LOOPING ); }
//-----------------------------------------------------------------------------
// Name: class CSoundManager
// Desc:
//-----------------------------------------------------------------------------
class CSoundManager
{
protected:
IDirectSound8* m_pDS;
public:
CSoundManager();
~CSoundManager();
HRESULT Initialize( HWND hWnd, DWORD dwCoopLevel );
inline LPDIRECTSOUND8 GetDirectSound() { return m_pDS; }
HRESULT SetPrimaryBufferFormat( DWORD dwPrimaryChannels, DWORD dwPrimaryFreq, DWORD dwPrimaryBitRate );
HRESULT Get3DListenerInterface( LPDIRECTSOUND3DLISTENER* ppDSListener );
HRESULT Create( CSound** ppSound, LPWSTR strWaveFileName, DWORD dwCreationFlags = 0, GUID guid3DAlgorithm = GUID_NULL, DWORD dwNumBuffers = 1 );
HRESULT CreateFromMemory( CSound** ppSound, BYTE* pbData, ULONG ulDataSize, LPWAVEFORMATEX pwfx, DWORD dwCreationFlags = 0, GUID guid3DAlgorithm = GUID_NULL, DWORD dwNumBuffers = 1 );
HRESULT CreateStreaming( CStreamingSound** ppStreamingSound, LPWSTR strWaveFileName, DWORD dwCreationFlags, GUID guid3DAlgorithm, DWORD dwNotifyCount, DWORD dwNotifySize, HANDLE hNotifyEvent );
};
//-----------------------------------------------------------------------------
// Name: class CSound
// Desc: Encapsulates functionality of a DirectSound buffer.
//-----------------------------------------------------------------------------
class CSound
{
protected:
LPDIRECTSOUNDBUFFER* m_apDSBuffer;
DWORD m_dwDSBufferSize;
CWaveFile* m_pWaveFile;
DWORD m_dwNumBuffers;
DWORD m_dwCreationFlags;
HRESULT RestoreBuffer( LPDIRECTSOUNDBUFFER pDSB, BOOL* pbWasRestored );
public:
CSound( LPDIRECTSOUNDBUFFER* apDSBuffer, DWORD dwDSBufferSize, DWORD dwNumBuffers, CWaveFile* pWaveFile, DWORD dwCreationFlags );
virtual ~CSound();
HRESULT Get3DBufferInterface( DWORD dwIndex, LPDIRECTSOUND3DBUFFER* ppDS3DBuffer );
HRESULT FillBufferWithSound( LPDIRECTSOUNDBUFFER pDSB, BOOL bRepeatWavIfBufferLarger );
LPDIRECTSOUNDBUFFER GetFreeBuffer();
LPDIRECTSOUNDBUFFER GetBuffer( DWORD dwIndex );
HRESULT Play( DWORD dwPriority = 0, DWORD dwFlags = 0, LONG lVolume = 0, LONG lFrequency = -1, LONG lPan = 0 );
HRESULT Play3D( LPDS3DBUFFER p3DBuffer, DWORD dwPriority = 0, DWORD dwFlags = 0, LONG lFrequency = 0 );
HRESULT Stop();
HRESULT Reset();
BOOL IsSoundPlaying();
};
//-----------------------------------------------------------------------------
// Name: class CStreamingSound
// Desc: Encapsulates functionality to play a wave file with DirectSound.
// The Create() method loads a chunk of wave file into the buffer,
// and as sound plays more is written to the buffer by calling
// HandleWaveStreamNotification() whenever hNotifyEvent is signaled.
//-----------------------------------------------------------------------------
class CStreamingSound : public CSound
{
protected:
DWORD m_dwLastPlayPos;
DWORD m_dwPlayProgress;
DWORD m_dwNotifySize;
DWORD m_dwNextWriteOffset;
BOOL m_bFillNextNotificationWithSilence;
public:
CStreamingSound( LPDIRECTSOUNDBUFFER pDSBuffer, DWORD dwDSBufferSize, CWaveFile* pWaveFile, DWORD dwNotifySize );
~CStreamingSound();
HRESULT HandleWaveStreamNotification( BOOL bLoopedPlay );
HRESULT Reset();
};
//-----------------------------------------------------------------------------
// Name: class CWaveFile
// Desc: Encapsulates reading or writing sound data to or from a wave file
//-----------------------------------------------------------------------------
class CWaveFile
{
public:
WAVEFORMATEX* m_pwfx; // Pointer to WAVEFORMATEX structure
HMMIO m_hmmio; // MM I/O handle for the WAVE
MMCKINFO m_ck; // Multimedia RIFF chunk
MMCKINFO m_ckRiff; // Use in opening a WAVE file
DWORD m_dwSize; // The size of the wave file
MMIOINFO m_mmioinfoOut;
DWORD m_dwFlags;
BOOL m_bIsReadingFromMemory;
BYTE* m_pbData;
BYTE* m_pbDataCur;
ULONG m_ulDataSize;
CHAR* m_pResourceBuffer;
protected:
HRESULT ReadMMIO();
HRESULT WriteMMIO( WAVEFORMATEX *pwfxDest );
public:
CWaveFile();
~CWaveFile();
HRESULT Open( LPWSTR strFileName, WAVEFORMATEX* pwfx, DWORD dwFlags );
HRESULT OpenFromMemory( BYTE* pbData, ULONG ulDataSize, WAVEFORMATEX* pwfx, DWORD dwFlags );
HRESULT Close();
HRESULT Read( BYTE* pBuffer, DWORD dwSizeToRead, DWORD* pdwSizeRead );
HRESULT Write( UINT nSizeToWrite, BYTE* pbData, UINT* pnSizeWrote );
DWORD GetSize();
HRESULT ResetFile();
WAVEFORMATEX* GetFormat() { return m_pwfx; };
};
#endif // DXUTSOUND_H
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,600 @@
//--------------------------------------------------------------------------------------
// File: SDKMesh.h
//
// Disclaimer:
// The SDK Mesh format (.sdkmesh) is not a recommended file format for shipping titles.
// It was designed to meet the specific needs of the SDK samples. Any real-world
// applications should avoid this file format in favor of a destination format that
// meets the specific needs of the application.
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//--------------------------------------------------------------------------------------
#pragma once
#ifndef _SDKMESH_
#define _SDKMESH_
//--------------------------------------------------------------------------------------
// Hard Defines for the various structures
//--------------------------------------------------------------------------------------
#define SDKMESH_FILE_VERSION 101
#define MAX_VERTEX_ELEMENTS 32
#define MAX_VERTEX_STREAMS 16
#define MAX_FRAME_NAME 100
#define MAX_MESH_NAME 100
#define MAX_SUBSET_NAME 100
#define MAX_MATERIAL_NAME 100
#define MAX_TEXTURE_NAME MAX_PATH
#define MAX_MATERIAL_PATH MAX_PATH
#define INVALID_FRAME ((UINT)-1)
#define INVALID_MESH ((UINT)-1)
#define INVALID_MATERIAL ((UINT)-1)
#define INVALID_SUBSET ((UINT)-1)
#define INVALID_ANIMATION_DATA ((UINT)-1)
#define ERROR_RESOURCE_VALUE 1
template<typename TYPE> BOOL IsErrorResource( TYPE data )
{
if( ( TYPE )ERROR_RESOURCE_VALUE == data )
return TRUE;
return FALSE;
}
//--------------------------------------------------------------------------------------
// Enumerated Types. These will have mirrors in both D3D9 and D3D10
//--------------------------------------------------------------------------------------
enum SDKMESH_PRIMITIVE_TYPE
{
PT_TRIANGLE_LIST = 0,
PT_TRIANGLE_STRIP,
PT_LINE_LIST,
PT_LINE_STRIP,
PT_POINT_LIST,
PT_TRIANGLE_LIST_ADJ,
PT_TRIANGLE_STRIP_ADJ,
PT_LINE_LIST_ADJ,
PT_LINE_STRIP_ADJ,
};
enum SDKMESH_INDEX_TYPE
{
IT_16BIT = 0,
IT_32BIT,
};
enum FRAME_TRANSFORM_TYPE
{
FTT_RELATIVE = 0,
FTT_ABSOLUTE, //This is not currently used but is here to support absolute transformations in the future
};
//--------------------------------------------------------------------------------------
// Structures. Unions with pointers are forced to 64bit.
//--------------------------------------------------------------------------------------
struct SDKMESH_HEADER
{
//Basic Info and sizes
UINT Version;
BYTE IsBigEndian;
UINT64 HeaderSize;
UINT64 NonBufferDataSize;
UINT64 BufferDataSize;
//Stats
UINT NumVertexBuffers;
UINT NumIndexBuffers;
UINT NumMeshes;
UINT NumTotalSubsets;
UINT NumFrames;
UINT NumMaterials;
//Offsets to Data
UINT64 VertexStreamHeadersOffset;
UINT64 IndexStreamHeadersOffset;
UINT64 MeshDataOffset;
UINT64 SubsetDataOffset;
UINT64 FrameDataOffset;
UINT64 MaterialDataOffset;
};
struct SDKMESH_VERTEX_BUFFER_HEADER
{
UINT64 NumVertices;
UINT64 SizeBytes;
UINT64 StrideBytes;
D3DVERTEXELEMENT9 Decl[MAX_VERTEX_ELEMENTS];
union
{
UINT64 DataOffset; //(This also forces the union to 64bits)
IDirect3DVertexBuffer9* pVB9;
#ifdef D3D10_SDK_VERSION
ID3D10Buffer* pVB10;
#endif
};
};
struct SDKMESH_INDEX_BUFFER_HEADER
{
UINT64 NumIndices;
UINT64 SizeBytes;
UINT IndexType;
union
{
UINT64 DataOffset; //(This also forces the union to 64bits)
IDirect3DIndexBuffer9* pIB9;
#ifdef D3D10_SDK_VERSION
ID3D10Buffer* pIB10;
#endif
};
};
struct SDKMESH_MESH
{
char Name[MAX_MESH_NAME];
BYTE NumVertexBuffers;
UINT VertexBuffers[MAX_VERTEX_STREAMS];
UINT IndexBuffer;
UINT NumSubsets;
UINT NumFrameInfluences; //aka bones
D3DXVECTOR3 BoundingBoxCenter;
D3DXVECTOR3 BoundingBoxExtents;
union
{
UINT64 SubsetOffset; //Offset to list of subsets (This also forces the union to 64bits)
UINT* pSubsets; //Pointer to list of subsets
};
union
{
UINT64 FrameInfluenceOffset; //Offset to list of frame influences (This also forces the union to 64bits)
UINT* pFrameInfluences; //Pointer to list of frame influences
};
};
struct SDKMESH_SUBSET
{
char Name[MAX_SUBSET_NAME];
UINT MaterialID;
UINT PrimitiveType;
UINT64 IndexStart;
UINT64 IndexCount;
UINT64 VertexStart;
UINT64 VertexCount;
};
struct SDKMESH_FRAME
{
char Name[MAX_FRAME_NAME];
UINT Mesh;
UINT ParentFrame;
UINT ChildFrame;
UINT SiblingFrame;
D3DXMATRIX Matrix;
UINT AnimationDataIndex; //Used to index which set of keyframes transforms this frame
};
struct SDKMESH_MATERIAL
{
char Name[MAX_MATERIAL_NAME];
// Use MaterialInstancePath
char MaterialInstancePath[MAX_MATERIAL_PATH];
// Or fall back to d3d8-type materials
char DiffuseTexture[MAX_TEXTURE_NAME];
char NormalTexture[MAX_TEXTURE_NAME];
char SpecularTexture[MAX_TEXTURE_NAME];
D3DXVECTOR4 Diffuse;
D3DXVECTOR4 Ambient;
D3DXVECTOR4 Specular;
D3DXVECTOR4 Emissive;
FLOAT Power;
union
{
UINT64 Force64_1; //Force the union to 64bits
IDirect3DTexture9* pDiffuseTexture9;
#ifdef D3D10_SDK_VERSION
ID3D10Texture2D* pDiffuseTexture10;
#endif
};
union
{
UINT64 Force64_2; //Force the union to 64bits
IDirect3DTexture9* pNormalTexture9;
#ifdef D3D10_SDK_VERSION
ID3D10Texture2D* pNormalTexture10;
#endif
};
union
{
UINT64 Force64_3; //Force the union to 64bits
IDirect3DTexture9* pSpecularTexture9;
#ifdef D3D10_SDK_VERSION
ID3D10Texture2D* pSpecularTexture10;
#endif
};
union
{
UINT64 Force64_4; //Force the union to 64bits
#ifdef D3D10_SDK_VERSION
ID3D10ShaderResourceView* pDiffuseRV10;
#endif
};
union
{
UINT64 Force64_5; //Force the union to 64bits
#ifdef D3D10_SDK_VERSION
ID3D10ShaderResourceView* pNormalRV10;
#endif
};
union
{
UINT64 Force64_6; //Force the union to 64bits
#ifdef D3D10_SDK_VERSION
ID3D10ShaderResourceView* pSpecularRV10;
#endif
};
};
struct SDKANIMATION_FILE_HEADER
{
UINT Version;
BYTE IsBigEndian;
UINT FrameTransformType;
UINT NumFrames;
UINT NumAnimationKeys;
UINT AnimationFPS;
UINT64 AnimationDataSize;
UINT64 AnimationDataOffset;
};
struct SDKANIMATION_DATA
{
D3DXVECTOR3 Translation;
D3DXVECTOR4 Orientation;
D3DXVECTOR3 Scaling;
};
struct SDKANIMATION_FRAME_DATA
{
char FrameName[MAX_FRAME_NAME];
union
{
UINT64 DataOffset;
SDKANIMATION_DATA* pAnimationData;
};
};
#ifndef _CONVERTER_APP_
//--------------------------------------------------------------------------------------
// AsyncLoading callbacks
//--------------------------------------------------------------------------------------
typedef void ( CALLBACK*LPCREATETEXTUREFROMFILE9 )( IDirect3DDevice9* pDev, char* szFileName,
IDirect3DTexture9** ppTexture, void* pContext );
typedef void ( CALLBACK*LPCREATEVERTEXBUFFER9 )( IDirect3DDevice9* pDev, IDirect3DVertexBuffer9** ppBuffer,
UINT iSizeBytes, DWORD Usage, DWORD FVF, D3DPOOL Pool, void* pData,
void* pContext );
typedef void ( CALLBACK*LPCREATEINDEXBUFFER9 )( IDirect3DDevice9* pDev, IDirect3DIndexBuffer9** ppBuffer,
UINT iSizeBytes, DWORD Usage, D3DFORMAT ibFormat, D3DPOOL Pool,
void* pData, void* pContext );
struct SDKMESH_CALLBACKS9
{
LPCREATETEXTUREFROMFILE9 pCreateTextureFromFile;
LPCREATEVERTEXBUFFER9 pCreateVertexBuffer;
LPCREATEINDEXBUFFER9 pCreateIndexBuffer;
void* pContext;
};
/*
typedef void ( CALLBACK*LPCREATETEXTUREFROMFILE10 )( ID3D10Device* pDev, char* szFileName,
ID3D10ShaderResourceView** ppRV, void* pContext );
typedef void ( CALLBACK*LPCREATEVERTEXBUFFER10 )( ID3D10Device* pDev, ID3D10Buffer** ppBuffer,
D3D10_BUFFER_DESC BufferDesc, void* pData, void* pContext );
typedef void ( CALLBACK*LPCREATEINDEXBUFFER10 )( ID3D10Device* pDev, ID3D10Buffer** ppBuffer,
D3D10_BUFFER_DESC BufferDesc, void* pData, void* pContext );
struct SDKMESH_CALLBACKS10
{
LPCREATETEXTUREFROMFILE10 pCreateTextureFromFile;
LPCREATEVERTEXBUFFER10 pCreateVertexBuffer;
LPCREATEINDEXBUFFER10 pCreateIndexBuffer;
void* pContext;
};
*/
//--------------------------------------------------------------------------------------
// CDXUTSDKMesh class. This class reads the sdkmesh file format for use by the samples
//--------------------------------------------------------------------------------------
/*
class CDXUTSDKMesh
{
private:
UINT m_NumOutstandingResources;
bool m_bLoading;
//BYTE* m_pBufferData;
HANDLE m_hFile;
HANDLE m_hFileMappingObject;
CGrowableArray <BYTE*> m_MappedPointers;
IDirect3DDevice9* m_pDev9;
// ID3D10Device* m_pDev10;
protected:
//These are the pointers to the two chunks of data loaded in from the mesh file
BYTE* m_pStaticMeshData;
BYTE* m_pHeapData;
BYTE* m_pAnimationData;
BYTE** m_ppVertices;
BYTE** m_ppIndices;
//Keep track of the path
WCHAR m_strPathW[MAX_PATH];
char m_strPath[MAX_PATH];
//General mesh info
SDKMESH_HEADER* m_pMeshHeader;
SDKMESH_VERTEX_BUFFER_HEADER* m_pVertexBufferArray;
SDKMESH_INDEX_BUFFER_HEADER* m_pIndexBufferArray;
SDKMESH_MESH* m_pMeshArray;
SDKMESH_SUBSET* m_pSubsetArray;
SDKMESH_FRAME* m_pFrameArray;
SDKMESH_MATERIAL* m_pMaterialArray;
// Adjacency information (not part of the m_pStaticMeshData, so it must be created and destroyed separately )
SDKMESH_INDEX_BUFFER_HEADER* m_pAdjacencyIndexBufferArray;
//Animation (TODO: Add ability to load/track multiple animation sets)
SDKANIMATION_FILE_HEADER* m_pAnimationHeader;
SDKANIMATION_FRAME_DATA* m_pAnimationFrameData;
D3DXMATRIX* m_pBindPoseFrameMatrices;
D3DXMATRIX* m_pTransformedFrameMatrices;
protected:
// void LoadMaterials( ID3D10Device* pd3dDevice, SDKMESH_MATERIAL* pMaterials,
// UINT NumMaterials, SDKMESH_CALLBACKS10* pLoaderCallbacks=NULL );
void LoadMaterials( IDirect3DDevice9* pd3dDevice, SDKMESH_MATERIAL* pMaterials,
UINT NumMaterials, SDKMESH_CALLBACKS9* pLoaderCallbacks=NULL );
// HRESULT CreateVertexBuffer( ID3D10Device* pd3dDevice,
// SDKMESH_VERTEX_BUFFER_HEADER* pHeader, void* pVertices,
// SDKMESH_CALLBACKS10* pLoaderCallbacks=NULL );
HRESULT CreateVertexBuffer( IDirect3DDevice9* pd3dDevice,
SDKMESH_VERTEX_BUFFER_HEADER* pHeader, void* pVertices,
SDKMESH_CALLBACKS9* pLoaderCallbacks=NULL );
// HRESULT CreateIndexBuffer( ID3D10Device* pd3dDevice, SDKMESH_INDEX_BUFFER_HEADER* pHeader,
// void* pIndices, SDKMESH_CALLBACKS10* pLoaderCallbacks=NULL );
HRESULT CreateIndexBuffer( IDirect3DDevice9* pd3dDevice,
SDKMESH_INDEX_BUFFER_HEADER* pHeader, void* pIndices,
SDKMESH_CALLBACKS9* pLoaderCallbacks=NULL );
virtual HRESULT CreateFromFile( ID3D10Device* pDev10, IDirect3DDevice9* pDev9, LPCTSTR szFileName,
bool bCreateAdjacencyIndices,
SDKMESH_CALLBACKS10* pLoaderCallbacks10=NULL,
SDKMESH_CALLBACKS9* pLoaderCallbacks9=NULL );
virtual HRESULT CreateFromMemory( ID3D10Device* pDev10,
IDirect3DDevice9* pDev9,
BYTE* pData,
UINT DataBytes,
bool bCreateAdjacencyIndices,
bool bCopyStatic,
SDKMESH_CALLBACKS10* pLoaderCallbacks10=NULL,
SDKMESH_CALLBACKS9* pLoaderCallbacks9=NULL );
//frame manipulation
void TransformBindPoseFrame( UINT iFrame, D3DXMATRIX* pParentWorld );
void TransformFrame( UINT iFrame, D3DXMATRIX* pParentWorld, double fTime );
void TransformFrameAbsolute( UINT iFrame, double fTime );
//Direct3D 10 rendering helpers
void RenderMesh( UINT iMesh,
bool bAdjacent,
ID3D10Device* pd3dDevice,
ID3D10EffectTechnique* pTechnique,
ID3D10EffectShaderResourceVariable* ptxDiffuse,
ID3D10EffectShaderResourceVariable* ptxNormal,
ID3D10EffectShaderResourceVariable* ptxSpecular,
ID3D10EffectVectorVariable* pvDiffuse,
ID3D10EffectVectorVariable* pvSpecular );
void RenderFrame( UINT iFrame,
bool bAdjacent,
ID3D10Device* pd3dDevice,
ID3D10EffectTechnique* pTechnique,
ID3D10EffectShaderResourceVariable* ptxDiffuse,
ID3D10EffectShaderResourceVariable* ptxNormal,
ID3D10EffectShaderResourceVariable* ptxSpecular,
ID3D10EffectVectorVariable* pvDiffuse,
ID3D10EffectVectorVariable* pvSpecular );
//Direct3D 9 rendering helpers
void RenderMesh( UINT iMesh,
LPDIRECT3DDEVICE9 pd3dDevice,
LPD3DXEFFECT pEffect,
D3DXHANDLE hTechnique,
D3DXHANDLE htxDiffuse,
D3DXHANDLE htxNormal,
D3DXHANDLE htxSpecular );
void RenderFrame( UINT iFrame,
LPDIRECT3DDEVICE9 pd3dDevice,
LPD3DXEFFECT pEffect,
D3DXHANDLE hTechnique,
D3DXHANDLE htxDiffuse,
D3DXHANDLE htxNormal,
D3DXHANDLE htxSpecular );
public:
CDXUTSDKMesh();
virtual ~CDXUTSDKMesh();
virtual HRESULT Create( ID3D10Device* pDev10, LPCTSTR szFileName, bool bCreateAdjacencyIndices=
false, SDKMESH_CALLBACKS10* pLoaderCallbacks=NULL );
virtual HRESULT Create( IDirect3DDevice9* pDev9, LPCTSTR szFileName, bool bCreateAdjacencyIndices=
false, SDKMESH_CALLBACKS9* pLoaderCallbacks=NULL );
virtual HRESULT Create( ID3D10Device* pDev10, BYTE* pData, UINT DataBytes,
bool bCreateAdjacencyIndices=false, bool bCopyStatic=false,
SDKMESH_CALLBACKS10* pLoaderCallbacks=NULL );
virtual HRESULT Create( IDirect3DDevice9* pDev9, BYTE* pData, UINT DataBytes,
bool bCreateAdjacencyIndices=false, bool bCopyStatic=false,
SDKMESH_CALLBACKS9* pLoaderCallbacks=NULL );
virtual HRESULT LoadAnimation( WCHAR* szFileName );
virtual void Destroy();
//Frame manipulation
void TransformBindPose( D3DXMATRIX* pWorld );
void TransformMesh( D3DXMATRIX* pWorld, double fTime );
//Adjacency
HRESULT CreateAdjacencyIndices( ID3D10Device* pd3dDevice, float fEpsilon,
BYTE* pBufferData );
//Direct3D 10 Rendering
virtual void Render( ID3D10Device* pd3dDevice,
ID3D10EffectTechnique* pTechnique,
ID3D10EffectShaderResourceVariable* ptxDiffuse = NULL,
ID3D10EffectShaderResourceVariable* ptxNormal = NULL,
ID3D10EffectShaderResourceVariable* ptxSpecular = NULL,
ID3D10EffectVectorVariable* pvDiffuse = NULL,
ID3D10EffectVectorVariable* pvSpecular = NULL );
virtual void RenderAdjacent( ID3D10Device* pd3dDevice,
ID3D10EffectTechnique* pTechnique,
ID3D10EffectShaderResourceVariable* ptxDiffuse = NULL,
ID3D10EffectShaderResourceVariable* ptxNormal = NULL,
ID3D10EffectShaderResourceVariable* ptxSpecular = NULL,
ID3D10EffectVectorVariable* pvDiffuse = NULL,
ID3D10EffectVectorVariable* pvSpecular = NULL );
//Direct3D 9 Rendering
virtual void Render( LPDIRECT3DDEVICE9 pd3dDevice,
LPD3DXEFFECT pEffect,
D3DXHANDLE hTechnique,
D3DXHANDLE htxDiffuse = 0,
D3DXHANDLE htxNormal = 0,
D3DXHANDLE htxSpecular = 0 );
//Helpers (D3D10 specific)
static D3D10_PRIMITIVE_TOPOLOGY GetPrimitiveType10( SDKMESH_PRIMITIVE_TYPE PrimType );
DXGI_FORMAT GetIBFormat10( UINT iMesh );
ID3D10Buffer* GetVB10( UINT iMesh, UINT iVB );
ID3D10Buffer* GetIB10( UINT iMesh );
ID3D10Buffer* GetAdjIB10( UINT iMesh );
//Helpers (D3D9 specific)
static D3DPRIMITIVETYPE GetPrimitiveType9( SDKMESH_PRIMITIVE_TYPE PrimType );
D3DFORMAT GetIBFormat9( UINT iMesh );
IDirect3DVertexBuffer9* GetVB9( UINT iMesh, UINT iVB );
IDirect3DIndexBuffer9* GetIB9( UINT iMesh );
//Helpers (general)
char* GetMeshPathA();
WCHAR* GetMeshPathW();
UINT GetNumMeshes();
UINT GetNumMaterials();
UINT GetNumVBs();
UINT GetNumIBs();
IDirect3DVertexBuffer9* GetVB9At( UINT iVB );
IDirect3DIndexBuffer9* GetIB9At( UINT iIB );
ID3D10Buffer* GetVB10At( UINT iVB );
ID3D10Buffer* GetIB10At( UINT iIB );
BYTE* GetRawVerticesAt( UINT iVB );
BYTE* GetRawIndicesAt( UINT iIB );
SDKMESH_MATERIAL* GetMaterial( UINT iMaterial );
SDKMESH_MESH* GetMesh( UINT iMesh );
UINT GetNumSubsets( UINT iMesh );
SDKMESH_SUBSET* GetSubset( UINT iMesh, UINT iSubset );
UINT GetVertexStride( UINT iMesh, UINT iVB );
SDKMESH_FRAME* FindFrame( char* pszName );
UINT64 GetNumVertices( UINT iMesh, UINT iVB );
UINT64 GetNumIndices( UINT iMesh );
D3DXVECTOR3 GetMeshBBoxCenter( UINT iMesh );
D3DXVECTOR3 GetMeshBBoxExtents( UINT iMesh );
UINT GetOutstandingResources();
UINT GetOutstandingBufferResources();
bool CheckLoadDone();
bool IsLoaded();
bool IsLoading();
void SetLoading( bool bLoading );
BOOL HadLoadingError();
//Animation
UINT GetNumInfluences( UINT iMesh );
const D3DXMATRIX* GetMeshInfluenceMatrix( UINT iMesh, UINT iInfluence );
UINT GetAnimationKeyFromTime( double fTime );
};
*/
//-----------------------------------------------------------------------------
// Name: class CDXUTXFileMesh
// Desc: Class for loading and rendering file-based meshes
//-----------------------------------------------------------------------------
class CDXUTXFileMesh
{
public:
WCHAR m_strName[512];
LPD3DXMESH m_pMesh; // Managed mesh
// Cache of data in m_pMesh for easy access
IDirect3DVertexBuffer9* m_pVB;
IDirect3DIndexBuffer9* m_pIB;
IDirect3DVertexDeclaration9* m_pDecl;
DWORD m_dwNumVertices;
DWORD m_dwNumFaces;
DWORD m_dwBytesPerVertex;
DWORD m_dwNumMaterials; // Materials for the mesh
D3DMATERIAL9* m_pMaterials;
CHAR (*m_strMaterials )[MAX_PATH];
IDirect3DBaseTexture9** m_pTextures;
bool m_bUseMaterials;
public:
// Rendering
HRESULT Render( LPDIRECT3DDEVICE9 pd3dDevice,
bool bDrawOpaqueSubsets = true,
bool bDrawAlphaSubsets = true );
HRESULT Render( ID3DXEffect* pEffect,
D3DXHANDLE hTexture = NULL,
D3DXHANDLE hDiffuse = NULL,
D3DXHANDLE hAmbient = NULL,
D3DXHANDLE hSpecular = NULL,
D3DXHANDLE hEmissive = NULL,
D3DXHANDLE hPower = NULL,
bool bDrawOpaqueSubsets = true,
bool bDrawAlphaSubsets = true );
// Mesh access
LPD3DXMESH GetMesh()
{
return m_pMesh;
}
// Rendering options
void UseMeshMaterials( bool bFlag )
{
m_bUseMaterials = bFlag;
}
HRESULT SetFVF( LPDIRECT3DDEVICE9 pd3dDevice, DWORD dwFVF );
HRESULT SetVertexDecl( LPDIRECT3DDEVICE9 pd3dDevice, const D3DVERTEXELEMENT9* pDecl,
bool bAutoComputeNormals = true, bool bAutoComputeTangents = true,
bool bSplitVertexForOptimalTangents = false );
// Initializing
HRESULT RestoreDeviceObjects( LPDIRECT3DDEVICE9 pd3dDevice );
HRESULT InvalidateDeviceObjects();
// Creation/destruction
HRESULT Create( LPDIRECT3DDEVICE9 pd3dDevice, LPCWSTR strFilename );
HRESULT Create( LPDIRECT3DDEVICE9 pd3dDevice, LPD3DXFILEDATA pFileData );
HRESULT Create( LPDIRECT3DDEVICE9 pd3dDevice, ID3DXMesh* pInMesh, D3DXMATERIAL* pd3dxMaterials,
DWORD dwMaterials );
HRESULT CreateMaterials( LPCWSTR strPath, IDirect3DDevice9* pd3dDevice, D3DXMATERIAL* d3dxMtrls,
DWORD dwNumMaterials );
HRESULT Destroy();
CDXUTXFileMesh( LPCWSTR strName = L"CDXUTXMeshFile_Mesh" );
virtual ~CDXUTXFileMesh();
};
#endif
#endif
@@ -0,0 +1,13 @@
//--------------------------------------------------------------------------------------
// File: DxStdAfx.cpp
//
// Desc: Source file that includes just the standard includes for the
// DirectX SDK samples
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//--------------------------------------------------------------------------------------
#include "stdafx.h"
#include "dxstdafx.h"
@@ -0,0 +1,114 @@
//--------------------------------------------------------------------------------------
// File: DxStdAfx.h
//
// Desc: Header file that is the standard includes for the DirectX SDK samples
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//--------------------------------------------------------------------------------------
#pragma once
#ifndef DXSDK_STDAFX_H
#define DXSDK_STDAFX_H
#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
//#define STRICT
// Works with Windows 2000 and later and Windows 98 or later
#undef _WIN32_IE
#undef WINVER
#undef _WIN32_WINDOWS
#undef _WIN32_WINNT
#define WINVER 0x0500
#define _WIN32_WINDOWS 0x0410
#define _WIN32_WINNT 0x0500
#include <windows.h>
#include <assert.h>
#include <wchar.h>
#include <mmsystem.h>
#include <commctrl.h> // for InitCommonControls()
#include <shellapi.h> // for ExtractIcon()
#include <new.h> // for placement new
#include <math.h>
#include <limits.h>
#include <stdio.h>
// CRT's memory leak detection
#if defined(DEBUG) | defined(_DEBUG)
#include <crtdbg.h>
#endif
// Enable extra D3D debugging in debug builds if using the debug DirectX runtime.
// This makes D3D objects work well in the debugger watch window, but slows down
// performance slightly.
#if defined(DEBUG) | defined(_DEBUG)
#define D3D_DEBUG_INFO
#endif
// Direct3D includes
#include <d3d9.h>
#include <d3dx9.h>
#include <dxerr9.h>
// DirectSound includes
#include <mmsystem.h>
#include <mmreg.h>
#define DIRECTSOUND_VERSION 0x0800
#include <dsound.h>
// strsafe.h deprecates old unsecure string functions. If you
// really do not want to it to (not recommended), then uncomment the next line and
// comment out the following lines:
#define STRSAFE_NO_DEPRECATE
/*
#pragma deprecated(strncpy)
#pragma deprecated(wcsncpy)
#pragma deprecated(_tcsncpy)
#pragma deprecated(wcsncat)
#pragma deprecated(strncat)
#pragma deprecated(_tcsncat)
*/
#include <strsafe.h>
//#define PROFILE
#include "DXUT.h"
#include "DXUTmisc.h"
#include "DXUTenum.h"
#include "DXUTeffectmap.h"
#include "DXUTmesh.h"
#include "DXUTgui.h"
#include "DXUTsettingsDlg.h"
#include "DXUTSound.h"
#if defined(DEBUG) | defined(_DEBUG)
#ifndef V
#define V(x) { hr = x; if( FAILED(hr) ) { DXUTTrace( __FILE__, (DWORD)__LINE__, hr, L#x, true ); } }
#endif
#ifndef V_RETURN
#define V_RETURN(x) { hr = x; if( FAILED(hr) ) { return DXUTTrace( __FILE__, (DWORD)__LINE__, hr, L#x, true ); } }
#endif
#else
#ifndef V
#define V(x) { hr = x; }
#endif
#ifndef V_RETURN
#define V_RETURN(x) { hr = x; if( FAILED(hr) ) { return hr; } }
#endif
#endif
#ifndef SAFE_DELETE
#define SAFE_DELETE(p) { if(p) { delete (p); (p)=NULL; } }
#endif
#ifndef SAFE_DELETE_ARRAY
#define SAFE_DELETE_ARRAY(p) { if(p) { delete[] (p); (p)=NULL; } }
#endif
#ifndef SAFE_RELEASE
#define SAFE_RELEASE(p) { if(p) { (p)->Release(); (p)=NULL; } }
#endif
#endif // !defined(DXSDK_STDAFX_H)
@@ -0,0 +1,416 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
///
/// BandiVideoLibrary 2.1 Sample
///
/// Copyright(C) 2008-2011 BandiSoft.com All rights reserved.
///
/// Visit http://www.bandisoft.com for more information.
///
////////////////////////////////////////////////////////////////////////////////////////////////////
#include "StdAfx.h"
#include "VideoTest.h"
#include "BandiVideoTexture_DX9.h"
static BOOL GetThisPath(LPCTSTR szFileName, LPTSTR buf, int nLenBuf)
{
TCHAR szModuleName[MAX_PATH*4];
::GetModuleFileName(NULL,szModuleName,MAX_PATH*4);
*(_tcsrchr( szModuleName, '\\' ) + 1) = NULL;
_sntprintf(buf, nLenBuf, _T("%s%s"), szModuleName, szFileName);
return TRUE;
}
CVideoTest::CVideoTest(void)
{
m_nWidth = 0;
m_nHeight = 0;
m_hWnd = NULL;
m_hInstance = NULL;
m_pd3d9 = NULL;
m_pd3dDevice = NULL;
m_bvt = NULL;
m_current_time = 0;
m_current_frame = 0;
}
CVideoTest::~CVideoTest(void)
{
Close();
}
void CVideoTest::Init(HINSTANCE hInstance, HWND hWnd)
{
m_hInstance = hInstance;
m_hWnd = hWnd;
TCHAR szPathName[MAX_PATH];
GetThisPath(_T("sample.avi"), szPathName, MAX_PATH);
// Load bandi video library dll
if(FAILED(m_bvl.Create(BANDIVIDEO_DLL_FILE_NAME)))
ASSERT(0);
// verify
if(FAILED(m_bvl.Verify("BANDISOFT-TRIAL-200909", "ea92bc5b")))
ASSERT(0);
if(Bvl_Open(szPathName) == FALSE)
ASSERT(0);
}
void CVideoTest::Close()
{
if(m_bvt)
{
delete m_bvt;
m_bvt = NULL;
}
}
static int vid_y = 0;
extern CDXUTDialog g_HUD; // dialog for standard controls
void CVideoTest::InitializeDialogs(int iY)
{
g_HUD.AddStatic(IDC_INFO, L"[ Video file ]", 35, iY, 125, 22);
g_HUD.AddButton(IDC_OPEN, L"Open", 35, iY += 24, 125, 22, VK_F5);
g_HUD.AddButton(IDC_CLOSE, L"Close", 35, iY += 24, 125, 22, VK_F4);
g_HUD.AddStatic(IDC_INFO, L"[ Playback ]", 35, iY += 24, 125, 22);
g_HUD.AddButton(IDC_PLAY, L"Play", 35, iY += 24, 125, 22, VK_F6);
g_HUD.AddButton(IDC_PAUSE, L"Pause", 35, iY += 24, 125, 22, VK_F7);
g_HUD.AddButton(IDC_STOP, L"Stop", 35, iY += 24, 125, 22, VK_F8);
g_HUD.AddButton(IDC_REW, L"-10sec", 35, iY += 24, 125, 22, VK_F11);
g_HUD.AddButton(IDC_FF, L"+10sec", 35, iY += 24, 125, 22, VK_F12);
g_HUD.AddButton(IDC_FRAME, L"+frame", 35, iY += 24, 125, 22);
g_HUD.AddStatic(IDC_INFO, L"[ Small screen ]", 35, iY += 24, 125, 22);
vid_y = iY + 24;
}
void CVideoTest::OnGUIEvent( UINT nEvent, int nControlID, CDXUTControl* pControl)
{
switch( nControlID )
{
case IDC_OPEN :
{
TCHAR file_path[MAX_PATH];
OPENFILENAME ofn;
ZeroMemory(&ofn, sizeof(ofn));
file_path[0] = NULL;
static const TCHAR szFilter[]
= TEXT("BVL Video Files (.AVI)\0*.AVI\0") \
TEXT("All Files (*.*)\0*.*\0\0");
ofn.lStructSize = sizeof(OPENFILENAME);
ofn.hwndOwner = m_hWnd;
ofn.hInstance = NULL;
ofn.lpstrFilter = szFilter;
ofn.nFilterIndex = 1;
ofn.lpstrCustomFilter = NULL;
ofn.nMaxCustFilter = 0;
ofn.lpstrFile = file_path;
ofn.nMaxFile = MAX_PATH;
ofn.lpstrFileTitle = NULL;
ofn.nMaxFileTitle = 0;
ofn.lpstrInitialDir = NULL;
ofn.lpstrTitle = TEXT("Select a video file to play...");
ofn.Flags = OFN_HIDEREADONLY;
ofn.nFileOffset = 0;
ofn.nFileExtension = 0;
ofn.lpstrDefExt = TEXT("AVI");
ofn.lCustData = 0L;
ofn.lpfnHook = NULL;
ofn.lpTemplateName = NULL;
m_pd3dDevice->SetDialogBoxMode(TRUE);
if(GetOpenFileName (&ofn)) // user specified a file
{
Bvl_Open(file_path);
}
m_pd3dDevice->SetDialogBoxMode(FALSE);
break;
}
case IDC_PLAY :
Bvl_Play();
break;
case IDC_PAUSE :
Bvl_Pause();
break;
case IDC_STOP :
Bvl_Stop();
break;
case IDC_REW :
Bvl_REW();
break;
case IDC_FF :
Bvl_FF();
break;
case IDC_FRAME :
Bvl_Frame();
break;
case IDC_CLOSE :
Bvl_Close();
break;
}
}
HRESULT CVideoTest::OnD3D9CreateDevice( IDirect3DDevice9* pd3dDevice, const D3DSURFACE_DESC* pBackBufferSurfaceDesc)
{
m_pd3dDevice = pd3dDevice;
m_pd3dDevice->GetDirect3D(&m_pd3d9);
return S_OK;
}
HRESULT CVideoTest::OnD3D9ResetDevice( IDirect3DDevice9* pd3dDevice, const D3DSURFACE_DESC* pBackBufferSurfaceDesc)
{
m_pd3dDevice = pd3dDevice;
m_pd3dDevice->GetDirect3D(&m_pd3d9);
m_nWidth = pBackBufferSurfaceDesc->Width;
m_nHeight = pBackBufferSurfaceDesc->Height;
return S_OK;
}
void CVideoTest::OnFrameMove( double fTime, float fElapsedTime)
{
}
LRESULT CVideoTest::MsgProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, bool* pbNoFurtherProcessing)
{
if(uMsg==WM_TIMER)
{
OnTimer(wParam);
}
return 0;
}
void CVideoTest::OnD3D9LostDevice()
{
if(m_bvt)
{
delete m_bvt;
m_bvt = NULL;
}
}
void CVideoTest::OnD3D9DestroyDevice()
{
}
////////////////////////////////////////////////////////////////////////////////////////////////////
/// message to screen
/// @date Thursday, August 07, 2008 3:26:06 PM
////////////////////////////////////////////////////////////////////////////////////////////////////
void CVideoTest::Message(LPCTSTR szMsg, ...)
{
CAtlString sMsg;
va_list args;
va_start(args, szMsg);
sMsg.FormatV(szMsg, args);
va_end(args);
m_messages.AddHead(sMsg);
SetTimer(m_hWnd, TIMER_PROCESSMESSAGE, 2000, NULL);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
/// process timer
/// @date Thursday, August 07, 2008 3:26:00 PM
////////////////////////////////////////////////////////////////////////////////////////////////////
void CVideoTest::OnTimer(int nTimerID)
{
if(nTimerID == TIMER_PROCESSMESSAGE)
{
if(m_messages.GetCount())
m_messages.RemoveAll();
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////
/// render text after capture processing
/// @param &txtHelper
/// @param bCaptured
/// @date 2008-09-02 14:29:34
////////////////////////////////////////////////////////////////////////////////////////////////////
void CVideoTest::RenderText(CDXUTTextHelper &txtHelper)
{
BVL_STATUS status;
m_bvl.GetStatus(status);
if(status >= BVL_STATUS_PLAYING)
{
TCHAR s[128];
INT cmsec = INT(m_current_time/10000i64);
INT tmsec = INT(m_video_info.total_time/10000i64);
_stprintf(s, _T("[ %02d:%02d:%03d (%I64d) / %02d:%02d:%03d ]"),
cmsec/(60*1000), cmsec%(60*1000)/1000, cmsec%1000, m_current_frame,
tmsec/(60*1000), tmsec%(60*1000)/1000, tmsec%1000);
txtHelper.DrawTextLine(_T(""));
txtHelper.DrawTextLine(s);
}
POSITION p = m_messages.GetHeadPosition();
while(p)
{
txtHelper.DrawTextLine(m_messages.GetNext(p));
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////
/// render scene
/// @param pd3dDevice
/// @date 2008-09-02 14:28:26
////////////////////////////////////////////////////////////////////////////////////////////////////
void CVideoTest::RenderScene( IDirect3DDevice9* pd3dDevice)
{
// Draw small screen.
if(m_bvt) m_bvt->Draw(m_nWidth - 125 - 10, vid_y, 125, 100);
}
LPDIRECT3DTEXTURE9 CVideoTest::GetVideoTexture()
{
if(m_bvl.IsCreated() == FALSE)
return NULL;
BVL_STATUS status;
m_bvl.GetStatus(status);
if(status == BVL_STATUS_PLAYEND)
{
m_bvl.Seek(0, BVL_SEEK_TIME);
m_bvl.Play();
}
if(m_bvl.IsNextFrame())
{
if(m_bvt == NULL)
{
BV_DEVICE_DX9 bvd = { m_pd3d9, m_pd3dDevice, m_hWnd };
m_bvt = new CBandiVideoTexture_DX9(&bvd);
if(!m_bvt || FAILED(m_bvt->Open(m_video_info.width , m_video_info.height)))
{
if(m_bvt) delete m_bvt; m_bvt = NULL;
return NULL;
}
}
INT pitch;
BYTE* buf = m_bvt->Lock(pitch);
if(buf)
{
// Get frame
BVL_FRAME frame;
frame.frame_buf = buf;
frame.frame_buf_size = m_video_info.height*pitch;
frame.pitch = pitch;
frame.width = m_video_info.width;
frame.height = m_video_info.height;
frame.pixel_format = m_bvt->GetFormat();
m_bvl.GetFrame(frame, TRUE);
m_bvt->Unlock();
m_current_time = frame.frame_time;
m_current_frame = frame.frame_number;
}
}
return m_bvt ? (LPDIRECT3DTEXTURE9)m_bvt->GetObject() : NULL;
}
BOOL CVideoTest::Bvl_Open(LPCTSTR path)
{
Bvl_Close();
if(FAILED(m_bvl.Open(path, FALSE)))
{
ASSERT(0);
return FALSE;
}
if(FAILED(m_bvl.GetVideoInfo(m_video_info)))
{
ASSERT(0);
return FALSE;
}
return SUCCEEDED(m_bvl.Play());
}
void CVideoTest::Bvl_Play()
{
m_bvl.Seek(0, BVL_SEEK_TIME);
m_bvl.Play();
}
void CVideoTest::Bvl_Pause()
{
BVL_STATUS status;
if(SUCCEEDED(m_bvl.GetStatus(status)))
{
m_bvl.Pause(status != BVL_STATUS_PAUSED);
}
}
void CVideoTest::Bvl_Stop()
{
m_bvl.Stop();
}
void CVideoTest::Bvl_FF()
{
m_bvl.Seek(m_current_time + 100000000i64, BVL_SEEK_TIME);
}
void CVideoTest::Bvl_REW()
{
m_bvl.Seek(m_current_time - 100000000i64, BVL_SEEK_TIME);
}
void CVideoTest::Bvl_Close()
{
if(m_bvt)
{
delete m_bvt;
m_bvt = NULL;
}
m_bvl.Close();
}
void CVideoTest::Bvl_Frame()
{
m_bvl.Pause(TRUE);
m_bvl.Seek(m_current_frame + 1, BVL_SEEK_FRAME);
}
@@ -0,0 +1,93 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
///
/// BandiVideoLibrary 2.1 Sample
///
/// Copyright(C) 2008-2011 BandiSoft.com All rights reserved.
///
/// Visit http://www.bandisoft.com for more information.
///
////////////////////////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "dxstdafx.h"
#include "DXUT.h"
#include "DXUTgui.h"
#include "DXUTmisc.h"
#include "DXUTSettingsDlg.h"
#include "DXUTMesh.h"
#include "sdkmesh.h"
#include "BandiVideoLibrary.h"
#define TIMER_PROCESSMESSAGE 1
#define IDC_INFO 10
#define IDC_OPEN 11
#define IDC_PLAY 12
#define IDC_PAUSE 13
#define IDC_STOP 14
#define IDC_REW 15
#define IDC_FF 16
#define IDC_FRAME 17
#define IDC_CLOSE 18
class CBandiVideoTexture;
class CVideoTest
{
public:
CVideoTest(void);
~CVideoTest(void);
public :
void Init(HINSTANCE hInstance, HWND hWnd);
void Close();
public :
void InitializeDialogs(int iY);
void RenderText(CDXUTTextHelper &txtHelper);
void OnGUIEvent(UINT nEvent, int nControlID, CDXUTControl* pControl);
HRESULT OnD3D9CreateDevice(IDirect3DDevice9* pd3dDevice, const D3DSURFACE_DESC* pBackBufferSurfaceDesc);
HRESULT OnD3D9ResetDevice(IDirect3DDevice9* pd3dDevice, const D3DSURFACE_DESC* pBackBufferSurfaceDesc);
void OnFrameMove(double fTime, float fElapsedTime);
LRESULT MsgProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, bool* pbNoFurtherProcessing);
void OnKeyboard(UINT nChar, bool bKeyDown, bool bAltDown);
void OnD3D9LostDevice();
void OnD3D9DestroyDevice();
void RenderScene(IDirect3DDevice9* pd3dDevice);
LPDIRECT3DTEXTURE9 GetVideoTexture();
private :
void Message(LPCTSTR szMsg, ...);
void OnTimer(int nTimerID);
BOOL Bvl_Open(LPCTSTR path);
void Bvl_Play();
void Bvl_Pause();
void Bvl_Stop();
void Bvl_FF();
void Bvl_REW();
void Bvl_Frame();
void Bvl_Close();
private :
int m_nWidth;
int m_nHeight;
CAtlList<CAtlString> m_messages;
HWND m_hWnd;
HINSTANCE m_hInstance;
LPDIRECT3D9 m_pd3d9;
LPDIRECT3DDEVICE9 m_pd3dDevice;
CBandiVideoLibrary m_bvl;
CBandiVideoTexture* m_bvt;
LONGLONG m_current_time;
LONGLONG m_current_frame;
BVL_VIDEO_INFO m_video_info;
};
@@ -0,0 +1,31 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by BandiVidSample.rc
//
#define IDS_APP_TITLE 103
#define IDR_MAINFRAME 128
#define IDD_BANDIVIDSAMPLE_DIALOG 102
#define IDD_ABOUTBOX 103
#define IDM_ABOUT 104
#define IDM_EXIT 105
#define IDI_BANDIVIDSAMPLE 107
#define IDI_SMALL 108
#define IDC_BANDIVIDSAMPLE 109
#define IDC_MYICON 2
#ifndef IDC_STATIC
#define IDC_STATIC -1
#endif
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NO_MFC 130
#define _APS_NEXT_RESOURCE_VALUE 129
#define _APS_NEXT_COMMAND_VALUE 32771
#define _APS_NEXT_CONTROL_VALUE 1000
#define _APS_NEXT_SYMED_VALUE 110
#endif
#endif
Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

@@ -0,0 +1,8 @@
// stdafx.cpp : source file that includes just the standard includes
// BandiVidSample.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"
// TODO: reference any additional headers you need in STDAFX.H
// and not in this file
@@ -0,0 +1,33 @@
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#pragma once
#include "targetver.h"
#define _CRT_SECURE_NO_WARNINGS
#define _CRT_NON_CONFORMING_SWPRINTFS
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
// Windows Header Files:
#include <windows.h>
#include <commdlg.h>
// C RunTime Header Files
#include <stdlib.h>
#include <malloc.h>
#include <memory.h>
#include <tchar.h>
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
#include <atlbase.h>
#include <atlstr.h>
#include <atlhost.h>
#include <atlcoll.h>
#ifndef ASSERT
#define ASSERT ATLASSERT
#endif
@@ -0,0 +1,24 @@
#pragma once
// The following macros define the minimum required platform. The minimum required platform
// is the earliest version of Windows, Internet Explorer etc. that has the necessary features to run
// your application. The macros work by enabling all features available on platform versions up to and
// including the version specified.
// Modify the following defines if you have to target a platform prior to the ones specified below.
// Refer to MSDN for the latest info on corresponding values for different platforms.
#ifndef WINVER // Specifies that the minimum required platform is Windows Vista.
#define WINVER 0x0600 // Change this to the appropriate value to target other versions of Windows.
#endif
#ifndef _WIN32_WINNT // Specifies that the minimum required platform is Windows Vista.
#define _WIN32_WINNT 0x0600 // Change this to the appropriate value to target other versions of Windows.
#endif
#ifndef _WIN32_WINDOWS // Specifies that the minimum required platform is Windows 98.
#define _WIN32_WINDOWS 0x0410 // Change this to the appropriate value to target Windows Me or later.
#endif
#ifndef _WIN32_IE // Specifies that the minimum required platform is Internet Explorer 7.0.
#define _WIN32_IE 0x0700 // Change this to the appropriate value to target other versions of IE.
#endif
@@ -0,0 +1,315 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
///
/// BandiVideoLibrary 2. Sample
///
/// Copyright(C) 2008-2011 BandiSoft.com All rights reserved.
///
/// Visit http://www.bandisoft.com for more information.
///
////////////////////////////////////////////////////////////////////////////////////////////////////
#define _WIN32_WINNT 0x400
#include <windows.h>
#include <stdio.h>
#include <math.h>
#define USE_NULL_SOUND 0
#include "BandiVideoLibrary.h"
#include "BandiVideoTexture_DX9.h"
#include "BandiVideoFileReader.h"
#if USE_NULL_SOUND
#include "BandiVideoSound_NULL.h"
#else
#include "BandiVideoSound_DS.h"
#endif
#pragma warning (disable:4996)
#define WINDOW_TEXT "BandiVideo Custom Playback"
// global
CBandiVideoLibrary g_bvl;
INT64 g_total_time = 0;
INT64 g_play_time = 0;
INT g_volume = 255;
// 상태 정보 업데이트
static void UpdateStatistics(HWND hwnd)
{
char buf[256];
int psec = int(g_play_time/10000000);
int tsec = int(g_total_time/10000000);
sprintf(buf, "%s - %02d:%02d:%02d / %02d:%02d:%02d", WINDOW_TEXT, psec/3600, (psec/60)%60, psec%60, tsec/3600, (tsec/60)%60, tsec%60);
SetWindowText(hwnd, buf);
}
LRESULT WINAPI WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch(uMsg)
{
case WM_CHAR:
if(wParam == 27) // esc
{
DestroyWindow(hwnd);
}
else if(wParam == 32) // space
{
BVL_STATUS status;
if(SUCCEEDED(g_bvl.GetStatus(status)))
g_bvl.Pause((status != BVL_STATUS_PAUSED));
}
else if(wParam == ',' || wParam == '<')
{
g_play_time -= 100000000i64;
g_bvl.Seek(g_play_time, BVL_SEEK_TIME);
}
else if(wParam == '.' || wParam == '>')
{
g_play_time += 100000000i64;
g_bvl.Seek(g_play_time, BVL_SEEK_TIME);
}
break;
case WM_MOUSEWHEEL:
{
g_volume += (GET_WHEEL_DELTA_WPARAM(wParam) > 0 ? 10 : -10);
g_volume = min(max(g_volume, 0), 255);
g_bvl.SetVolume(g_volume);
}
break;
case WM_PAINT:
{
// 검은색으로 배경 칠하기
PAINTSTRUCT ps;
HDC dc;
dc = BeginPaint(hwnd, &ps);
PatBlt(dc, 0, 0, 4096, 4096, BLACKNESS);
EndPaint(hwnd, &ps);
}
return 0;
case WM_ERASEBKGND:
return 1;
// 재생 상태 표시용 타이머
case WM_TIMER:
UpdateStatistics(hwnd);
break;
case WM_DESTROY:
PostQuitMessage(0);
return 0;
}
return DefWindowProc(hwnd, uMsg, wParam, lParam);
}
// 윈도우 생성
static HWND CreatePlayerWindow(HINSTANCE hInstance, HINSTANCE hPrevInstance)
{
if(!hPrevInstance)
{
WNDCLASS wc;
wc.style = 0;
wc.lpfnWndProc = WindowProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = hInstance;
wc.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(101));
wc.hCursor = LoadCursor(0, IDC_ARROW);;
wc.hbrBackground = 0;
wc.lpszMenuName = 0;
wc.lpszClassName = "CustomPlayback";
if(!RegisterClass(&wc))
{
return( 0 );
}
}
return CreateWindow("CustomPlayback", WINDOW_TEXT,
WS_CAPTION | WS_POPUP| WS_CLIPCHILDREN |
WS_SYSMENU | WS_MINIMIZEBOX | WS_SIZEBOX,
64, 64,
64, 64,
0, 0, hInstance,0);
}
// 윈도우 보더 크기 계산
static void CalcWindowBorder(HWND hwnd, int &extra_width, int &extra_height)
{
RECT r, c;
GetWindowRect(hwnd, &r);
GetClientRect(hwnd, &c);
extra_width = ( r.right - r.left ) - ( c.right - c.left );
extra_height = ( r.bottom - r.top ) - ( c.bottom - c.top );
}
int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
HWND hwnd;
MSG msg;
int extra_width, extra_height;
// 재생창 생성하기
hwnd = CreatePlayerWindow(hInstance, hPrevInstance);
if(!hwnd)
{
MessageBox(NULL, "Error creating window.", WINDOW_TEXT, MB_OK | MB_ICONSTOP);
return 1;
}
CalcWindowBorder(hwnd, extra_width, extra_height);
CBandiVideoDevice* bvd;
CBandiVideoTexture* bvt;
#if USE_NULL_SOUND
if(FAILED(g_bvl.Create(BANDIVIDEO_DLL_FILE_NAME, new CBandiVideoFileReader(), new CBandiVideoSound_NULL())))
#else
if(FAILED(g_bvl.Create(BANDIVIDEO_DLL_FILE_NAME, new CBandiVideoFileReader(), new CBandiVideoSound_DS())))
#endif
{
MessageBox(NULL, "Error creating BandiVideoLibrary.", WINDOW_TEXT, MB_OK | MB_ICONSTOP);
DestroyWindow(hwnd);
return 2;
}
/* // verify
if(FAILED(bvl.Verify("BANDISOFT-TRIAL-200909", "ea92bc5b")))
{
// trial expired!!
ASSERT(0);
}*/
if(FAILED(g_bvl.Open(lpCmdLine, FALSE)))
{
MessageBox(NULL, "Error opening file....", WINDOW_TEXT, MB_OK | MB_ICONSTOP);
DestroyWindow(hwnd);
return 3;
}
BVL_VIDEO_INFO info;
if(FAILED(g_bvl.GetVideoInfo(info)))
{
MessageBox(NULL, "Error getting video info....", WINDOW_TEXT, MB_OK | MB_ICONSTOP);
DestroyWindow(hwnd);
return 4;
}
// 비디오 크기에 맞춰 창크기 변경
SetWindowPos(hwnd, 0, 0, 0, info.width+extra_width, info.height+extra_height, SWP_NOMOVE);
bvd = new CBandiVideoDevice_DX9();
if(!bvd || FAILED(bvd->Open(hwnd)))
{
MessageBox(NULL, "Error opening device...", WINDOW_TEXT, MB_OK | MB_ICONSTOP);
DestroyWindow(hwnd);
if(bvd) delete bvd;
return -1;
}
bvt = new CBandiVideoTexture_DX9((CBandiVideoDevice_DX9*)bvd);
if(!bvt || FAILED(bvt->Open(info.width , info.height)))
{
MessageBox(NULL, "Error opening texture...", WINDOW_TEXT, MB_OK | MB_ICONSTOP);
DestroyWindow(hwnd);
if(bvd) delete bvd;
if(bvt) delete bvt;
return -1;
}
g_bvl.Play();
g_total_time = info.total_time;
ShowWindow(hwnd, nCmdShow);
SetTimer(hwnd, 0, 1000, NULL);
do
{
if(PeekMessage(&msg, 0, 0, 0, PM_REMOVE))
{
if(msg.message == WM_QUIT)
break;
TranslateMessage(&msg);
DispatchMessage(&msg);
}
else
{
BVL_STATUS status;
g_bvl.GetStatus(status);
if(status == BVL_STATUS_PLAYEND)
{
g_bvl.Seek(0, BVL_SEEK_TIME);
g_bvl.Play();
}
// 새 프레임을 출력할 시간인가?
if(g_bvl.IsNextFrame())
{
INT pitch;
BYTE* buf = bvt->Lock(pitch);
if(buf)
{
// Get frame
BVL_FRAME frame;
frame.frame_buf = buf;
frame.frame_buf_size = info.height*pitch;
frame.pitch = pitch;
frame.width = info.width;
frame.height = info.height;
frame.pixel_format = bvt->GetFormat();
g_bvl.GetFrame(frame, TRUE);
bvt->Unlock();
// Show frame
bvd->StartFrame();
bvt->Draw(0, 0, info.width, info.height);
bvd->EndFrame();
g_play_time = frame.frame_time;
}
}
else
{
Sleep(1);
}
}
}
while(1);
g_bvl.Destroy();
if(bvd)
{
bvd->Close();
delete bvd;
}
if(bvt)
{
bvt->Close();
delete bvt;
}
return 0;
}
@@ -0,0 +1,389 @@
<?xml version="1.0" encoding="ks_c_5601-1987"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Name="CustomPlayback"
ProjectGUID="{1F7179BE-7E15-421F-9628-18BBBED8326A}"
RootNamespace="CustomPlayback"
Keyword="Win32Proj"
TargetFrameworkVersion="196613"
>
<Platforms>
<Platform
Name="Win32"
/>
<Platform
Name="x64"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../../include, ../../source"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="d3d9.lib dsound.lib"
OutputFile="..\..\bin\$(ProjectName)_d.exe"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Debug|x64"
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../../include, ../../source"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="d3d9.lib dsound.lib"
OutputFile="..\..\bin\$(ProjectName)64_d.exe"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="2"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="2"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
EnableIntrinsicFunctions="true"
AdditionalIncludeDirectories="../../include, ../../source"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
RuntimeLibrary="0"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="d3d9.lib dsound.lib"
OutputFile="..\..\bin\$(ProjectName).exe"
LinkIncremental="1"
GenerateDebugInformation="true"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|x64"
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="2"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
EnableIntrinsicFunctions="true"
AdditionalIncludeDirectories="../../include, ../../source"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
RuntimeLibrary="0"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="d3d9.lib dsound.lib"
OutputFile="..\..\bin\$(ProjectName)64.exe"
LinkIncremental="1"
GenerateDebugInformation="true"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="bvl"
>
<File
RelativePath="..\..\source\BandiVideoFileReader.cpp"
>
</File>
<File
RelativePath="..\..\source\BandiVideoFileReader.h"
>
</File>
<File
RelativePath="..\..\source\BandiVideoLibrary.cpp"
>
</File>
<File
RelativePath="..\..\source\BandiVideoLibrary.h"
>
</File>
<File
RelativePath="..\..\source\BandiVideoSound_DS.cpp"
>
</File>
<File
RelativePath="..\..\source\BandiVideoSound_DS.h"
>
</File>
<File
RelativePath="..\..\source\BandiVideoSound_NULL.cpp"
>
</File>
<File
RelativePath="..\..\source\BandiVideoSound_NULL.h"
>
</File>
<File
RelativePath="..\..\source\BandiVideoTexture.h"
>
</File>
<File
RelativePath="..\..\source\BandiVideoTexture_DX9.cpp"
>
</File>
<File
RelativePath="..\..\source\BandiVideoTexture_DX9.h"
>
</File>
</Filter>
<Filter
Name="main"
>
<File
RelativePath=".\CustomPlayback.cpp"
>
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>
@@ -0,0 +1,26 @@
Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CustomPlayback", "CustomPlayback_2005.vcxproj", "{1F7179BE-7E15-421F-9628-18BBBED8326A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Debug|x64 = Debug|x64
Release|Win32 = Release|Win32
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{1F7179BE-7E15-421F-9628-18BBBED8326A}.Debug|Win32.ActiveCfg = Debug|Win32
{1F7179BE-7E15-421F-9628-18BBBED8326A}.Debug|Win32.Build.0 = Debug|Win32
{1F7179BE-7E15-421F-9628-18BBBED8326A}.Debug|x64.ActiveCfg = Debug|x64
{1F7179BE-7E15-421F-9628-18BBBED8326A}.Debug|x64.Build.0 = Debug|x64
{1F7179BE-7E15-421F-9628-18BBBED8326A}.Release|Win32.ActiveCfg = Release|Win32
{1F7179BE-7E15-421F-9628-18BBBED8326A}.Release|Win32.Build.0 = Release|Win32
{1F7179BE-7E15-421F-9628-18BBBED8326A}.Release|x64.ActiveCfg = Release|x64
{1F7179BE-7E15-421F-9628-18BBBED8326A}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
@@ -0,0 +1,389 @@
<?xml version="1.0" encoding="ks_c_5601-1987"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="CustomPlayback"
ProjectGUID="{1F7179BE-7E15-421F-9628-18BBBED8326A}"
RootNamespace="CustomPlayback"
Keyword="Win32Proj"
TargetFrameworkVersion="196613"
>
<Platforms>
<Platform
Name="Win32"
/>
<Platform
Name="x64"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../../include, ../../source"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="d3d9.lib dsound.lib"
OutputFile="..\..\bin\$(ProjectName)_d.exe"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Debug|x64"
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../../include, ../../source"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="d3d9.lib dsound.lib"
OutputFile="..\..\bin\$(ProjectName)64_d.exe"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="2"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="2"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
EnableIntrinsicFunctions="true"
AdditionalIncludeDirectories="../../include, ../../source"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
RuntimeLibrary="0"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="d3d9.lib dsound.lib"
OutputFile="..\..\bin\$(ProjectName).exe"
LinkIncremental="1"
GenerateDebugInformation="true"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|x64"
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="2"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
EnableIntrinsicFunctions="true"
AdditionalIncludeDirectories="../../include, ../../source"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
RuntimeLibrary="0"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="d3d9.lib dsound.lib"
OutputFile="..\..\bin\$(ProjectName)64.exe"
LinkIncremental="1"
GenerateDebugInformation="true"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="bvl"
>
<File
RelativePath="..\..\source\BandiVideoFileReader.cpp"
>
</File>
<File
RelativePath="..\..\source\BandiVideoFileReader.h"
>
</File>
<File
RelativePath="..\..\source\BandiVideoLibrary.cpp"
>
</File>
<File
RelativePath="..\..\source\BandiVideoLibrary.h"
>
</File>
<File
RelativePath="..\..\source\BandiVideoSound_DS.cpp"
>
</File>
<File
RelativePath="..\..\source\BandiVideoSound_DS.h"
>
</File>
<File
RelativePath="..\..\source\BandiVideoSound_NULL.cpp"
>
</File>
<File
RelativePath="..\..\source\BandiVideoSound_NULL.h"
>
</File>
<File
RelativePath="..\..\source\BandiVideoTexture.h"
>
</File>
<File
RelativePath="..\..\source\BandiVideoTexture_DX9.cpp"
>
</File>
<File
RelativePath="..\..\source\BandiVideoTexture_DX9.h"
>
</File>
</Filter>
<Filter
Name="main"
>
<File
RelativePath=".\CustomPlayback.cpp"
>
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>
@@ -0,0 +1,190 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectName>CustomPlayback</ProjectName>
<ProjectGuid>{1F7179BE-7E15-421F-9628-18BBBED8326A}</ProjectGuid>
<RootNamespace>CustomPlayback</RootNamespace>
<Keyword>Win32Proj</Keyword>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Platform)\$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(Platform)\$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>../../include; ../../source;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
</ClCompile>
<Link>
<AdditionalDependencies>d3d9.lib;dsound.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>..\..\bin\$(ProjectName)_d.exe</OutputFile>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<TargetMachine>MachineX86</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Midl>
<TargetEnvironment>X64</TargetEnvironment>
</Midl>
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>../../include; ../../source;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Link>
<AdditionalDependencies>d3d9.lib;dsound.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>..\..\bin\$(ProjectName)64_d.exe</OutputFile>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<TargetMachine>MachineX64</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<Optimization>MaxSpeed</Optimization>
<IntrinsicFunctions>true</IntrinsicFunctions>
<AdditionalIncludeDirectories>../../include; ../../source;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Link>
<AdditionalDependencies>d3d9.lib;dsound.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>..\..\bin\$(ProjectName).exe</OutputFile>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<TargetMachine>MachineX86</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Midl>
<TargetEnvironment>X64</TargetEnvironment>
</Midl>
<ClCompile>
<Optimization>MaxSpeed</Optimization>
<IntrinsicFunctions>true</IntrinsicFunctions>
<AdditionalIncludeDirectories>../../include; ../../source;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Link>
<AdditionalDependencies>d3d9.lib;dsound.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>..\..\bin\$(ProjectName)64.exe</OutputFile>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<TargetMachine>MachineX64</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\..\source\BandiVideoFileReader.cpp" />
<ClCompile Include="..\..\source\BandiVideoLibrary.cpp" />
<ClCompile Include="..\..\source\BandiVideoSound_DS.cpp" />
<ClCompile Include="..\..\source\BandiVideoSound_NULL.cpp" />
<ClCompile Include="..\..\source\BandiVideoTexture_DX9.cpp" />
<ClCompile Include="CustomPlayback.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\source\BandiVideoFileReader.h" />
<ClInclude Include="..\..\source\BandiVideoLibrary.h" />
<ClInclude Include="..\..\source\BandiVideoSound_DS.h" />
<ClInclude Include="..\..\source\BandiVideoSound_NULL.h" />
<ClInclude Include="..\..\source\BandiVideoTexture.h" />
<ClInclude Include="..\..\source\BandiVideoTexture_DX9.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
@@ -0,0 +1,51 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="bvl">
<UniqueIdentifier>{b7d7934e-23e1-42ce-a1a3-a8a5167d9255}</UniqueIdentifier>
</Filter>
<Filter Include="main">
<UniqueIdentifier>{2cfb88d0-fe29-4a27-a90e-0218bae12032}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\source\BandiVideoFileReader.cpp">
<Filter>bvl</Filter>
</ClCompile>
<ClCompile Include="..\..\source\BandiVideoLibrary.cpp">
<Filter>bvl</Filter>
</ClCompile>
<ClCompile Include="..\..\source\BandiVideoSound_DS.cpp">
<Filter>bvl</Filter>
</ClCompile>
<ClCompile Include="..\..\source\BandiVideoSound_NULL.cpp">
<Filter>bvl</Filter>
</ClCompile>
<ClCompile Include="..\..\source\BandiVideoTexture_DX9.cpp">
<Filter>bvl</Filter>
</ClCompile>
<ClCompile Include="CustomPlayback.cpp">
<Filter>main</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\source\BandiVideoFileReader.h">
<Filter>bvl</Filter>
</ClInclude>
<ClInclude Include="..\..\source\BandiVideoLibrary.h">
<Filter>bvl</Filter>
</ClInclude>
<ClInclude Include="..\..\source\BandiVideoSound_DS.h">
<Filter>bvl</Filter>
</ClInclude>
<ClInclude Include="..\..\source\BandiVideoSound_NULL.h">
<Filter>bvl</Filter>
</ClInclude>
<ClInclude Include="..\..\source\BandiVideoTexture.h">
<Filter>bvl</Filter>
</ClInclude>
<ClInclude Include="..\..\source\BandiVideoTexture_DX9.h">
<Filter>bvl</Filter>
</ClInclude>
</ItemGroup>
</Project>
@@ -0,0 +1,249 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
///
/// BandiVideoLibrary 2.1 Sample
///
/// Copyright(C) 2008-2011 BandiSoft.com All rights reserved.
///
/// Visit http://www.bandisoft.com for more information.
///
////////////////////////////////////////////////////////////////////////////////////////////////////
#include <windows.h>
#include <stdio.h>
#include "BandiVideoLibrary.h"
#pragma warning (disable:4996)
#define WINDOW_TEXT "BandiVideo Gdi Playback"
LRESULT WINAPI WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch(uMsg)
{
case WM_PAINT:
{
// 검은색으로 배경 칠하기
PAINTSTRUCT ps;
HDC dc;
dc = BeginPaint(hwnd, &ps);
PatBlt(dc, 0, 0, 4096, 4096, BLACKNESS);
EndPaint(hwnd, &ps);
}
return 0;
case WM_ERASEBKGND:
return 1;
case WM_DESTROY:
PostQuitMessage(0);
return 0;
}
return DefWindowProc(hwnd, uMsg, wParam, lParam);
}
// 윈도우 생성
static HWND CreatePlayerWindow(HINSTANCE hInstance, HINSTANCE hPrevInstance)
{
if(!hPrevInstance)
{
WNDCLASS wc;
wc.style = 0;
wc.lpfnWndProc = WindowProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = hInstance;
wc.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(101));
wc.hCursor = LoadCursor(0, IDC_ARROW);;
wc.hbrBackground = 0;
wc.lpszMenuName = 0;
wc.lpszClassName = "GdiPlayback";
if(!RegisterClass(&wc))
{
return( 0 );
}
}
return CreateWindow("GdiPlayback", WINDOW_TEXT,
WS_CAPTION | WS_POPUP| WS_CLIPCHILDREN |
WS_SYSMENU | WS_MINIMIZEBOX | WS_SIZEBOX,
64, 64,
64, 64,
0, 0, hInstance,0);
}
// 윈도우 보더 크기 계산
static void CalcWindowBorder(HWND hwnd, int &extra_width, int &extra_height)
{
RECT r, c;
GetWindowRect(hwnd, &r);
GetClientRect(hwnd, &c);
extra_width = ( r.right - r.left ) - ( c.right - c.left );
extra_height = ( r.bottom - r.top ) - ( c.bottom - c.top );
}
static BOOL DrawHBITMAP(HWND hWnd, HBITMAP hBitmap)
{
HDC hDC = ::GetDC(hWnd);
if(hDC==NULL) {ASSERT(0); return FALSE;}
// 화면 밖으로 안나가게 하기..
RECT rClient;
int sw, sh;
::GetClientRect(hWnd, &rClient);
sw = (rClient.right-rClient.left);
sh = (rClient.bottom-rClient.top);
HDC hdcSrc = CreateCompatibleDC(hDC);
if(hdcSrc==NULL){ASSERT(0); ::ReleaseDC(hWnd, hDC); return FALSE;}
HBITMAP hBitmapOld = (HBITMAP)SelectObject(hdcSrc, hBitmap);
BitBlt(hDC, 0, 0, sw, sh, hdcSrc, 0, 0, SRCCOPY);
SelectObject(hdcSrc, hBitmapOld);
DeleteDC(hdcSrc);
::ReleaseDC(hWnd, hDC);
return TRUE;
}
int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
HWND hwnd;
MSG msg;
BITMAPINFO bmpinfo;
BYTE* bmpdata = NULL;
int extra_width, extra_height;
// 재생창 생성하기
hwnd = CreatePlayerWindow(hInstance, hPrevInstance);
if(!hwnd)
{
MessageBox(NULL, "Error creating window.", WINDOW_TEXT, MB_OK | MB_ICONSTOP);
return 1;
}
CalcWindowBorder(hwnd, extra_width, extra_height);
CBandiVideoLibrary bvl;
if(FAILED(bvl.Create(BANDIVIDEO_DLL_FILE_NAME, NULL, NULL)))
{
MessageBox(NULL, "Error creating BandiVideoLibrary.", WINDOW_TEXT, MB_OK | MB_ICONSTOP);
DestroyWindow(hwnd);
return 2;
}
/* // verify
if(FAILED(bvl.Verify("BANDISOFT-TRIAL-200909", "ea92bc5b")))
{
// trial expired!!
ASSERT(0);
}*/
if(FAILED(bvl.Open(lpCmdLine, FALSE)))
{
MessageBox(NULL, "Error opening file....", WINDOW_TEXT, MB_OK | MB_ICONSTOP);
DestroyWindow(hwnd);
return 3;
}
BVL_VIDEO_INFO info;
if(FAILED(bvl.GetVideoInfo(info)))
{
MessageBox(NULL, "Error getting video info....", WINDOW_TEXT, MB_OK | MB_ICONSTOP);
DestroyWindow(hwnd);
return 4;
}
// 비디오 크기에 맞춰 창크기 변경
SetWindowPos(hwnd, 0, 0, 0, info.width+extra_width, info.height+extra_height, SWP_NOMOVE);
// BITMAPINFO 생성
memset(&bmpinfo, NULL, sizeof(bmpinfo));
bmpinfo.bmiHeader.biHeight = -info.height;
bmpinfo.bmiHeader.biWidth = info.width;
bmpinfo.bmiHeader.biBitCount = 32;
bmpinfo.bmiHeader.biClrUsed = 0;
bmpinfo.bmiHeader.biClrImportant = 0;
bmpinfo.bmiHeader.biCompression = BI_RGB;
bmpinfo.bmiHeader.biXPelsPerMeter = 0;
bmpinfo.bmiHeader.biYPelsPerMeter = 0;
bmpinfo.bmiHeader.biPlanes = 1;
bmpinfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
DWORD dwRowByte = ((bmpinfo.bmiHeader.biWidth * (DWORD)32 + 31) & ~31) >> 3;
bmpinfo.bmiHeader.biSizeImage = dwRowByte*bmpinfo.bmiHeader.biWidth;
HBITMAP hbitmap;
hbitmap = CreateDIBSection(NULL, &bmpinfo, DIB_RGB_COLORS, (LPVOID*)&bmpdata, NULL, 0);
bvl.Play();
ShowWindow(hwnd, nCmdShow);
do
{
if(PeekMessage(&msg, 0, 0, 0, PM_REMOVE))
{
if(msg.message == WM_QUIT)
break;
TranslateMessage(&msg);
DispatchMessage(&msg);
}
else
{
BVL_STATUS status;
bvl.GetStatus(status);
if(status == BVL_STATUS_PLAYEND)
{
bvl.Seek(0, BVL_SEEK_TIME);
bvl.Play();
}
// 새 프레임을 출력할 시간인가?
if(bvl.IsNextFrame())
{
// Get frame
BVL_FRAME frame;
frame.frame_buf = bmpdata;
frame.frame_buf_size = bmpinfo.bmiHeader.biSizeImage;
frame.pitch = dwRowByte;
frame.width = bmpinfo.bmiHeader.biWidth;
frame.height = abs(bmpinfo.bmiHeader.biHeight);
frame.pixel_format = BVLPF_X8R8G8B8;
bvl.GetFrame(frame, FALSE);
DrawHBITMAP(hwnd, hbitmap);
}
else
{
Sleep(1);
}
}
}
while(1);
bvl.Destroy();
if(hbitmap) DeleteObject(hbitmap);
return 0;
}
@@ -0,0 +1,425 @@
<?xml version="1.0" encoding="ks_c_5601-1987"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Name="GdiPlayback"
ProjectGUID="{F0D048E9-9A54-484B-A2EF-3DDED4B519ED}"
RootNamespace="GdiPlayback"
Keyword="Win32Proj"
TargetFrameworkVersion="196613"
>
<Platforms>
<Platform
Name="Win32"
/>
<Platform
Name="x64"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../../include, ../../source"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
OutputFile="..\..\bin\$(ProjectName)_d.exe"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Debug|x64"
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../../include, ../../source"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
OutputFile="..\..\bin\$(ProjectName)64_d.exe"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="2"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="2"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="0"
WholeProgramOptimization="true"
AdditionalIncludeDirectories="../../include, ../../source"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
RuntimeLibrary="0"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
OutputFile="..\..\bin\$(ProjectName).exe"
LinkIncremental="1"
GenerateDebugInformation="true"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|x64"
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="2"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
EnableIntrinsicFunctions="true"
AdditionalIncludeDirectories="../../include, ../../source"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
RuntimeLibrary="0"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
OutputFile="..\..\bin\$(ProjectName)64.exe"
LinkIncremental="1"
GenerateDebugInformation="true"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Releaae2|x64"
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../../include, ../../source"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
OutputFile="..\..\bin\$(ProjectName)64_d.exe"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="2"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="bvl"
>
<File
RelativePath="..\..\source\BandiVideoLibrary.cpp"
>
</File>
<File
RelativePath="..\..\source\BandiVideoLibrary.h"
>
</File>
</Filter>
<Filter
Name="main"
>
<File
RelativePath=".\GdiPlayback.cpp"
>
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>
@@ -0,0 +1,225 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Releaae2|Win32">
<Configuration>Releaae2</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Releaae2|x64">
<Configuration>Releaae2</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{F0D048E9-9A54-484B-A2EF-3DDED4B519ED}</ProjectGuid>
<RootNamespace>GdiPlayback</RootNamespace>
<Keyword>Win32Proj</Keyword>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Releaae2|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Releaae2|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Releaae2|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Releaae2|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Platform)\$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(Platform)\$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Releaae2|x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Releaae2|x64'">$(Platform)\$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Releaae2|x64'">true</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>../../include; ../../source;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
</ClCompile>
<Link>
<OutputFile>..\..\bin\$(ProjectName)_d.exe</OutputFile>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<TargetMachine>MachineX86</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Midl>
<TargetEnvironment>X64</TargetEnvironment>
</Midl>
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>../../include; ../../source;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Link>
<OutputFile>..\..\bin\$(ProjectName)64_d.exe</OutputFile>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<TargetMachine>MachineX64</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<Optimization>MaxSpeed</Optimization>
<IntrinsicFunctions>true</IntrinsicFunctions>
<FavorSizeOrSpeed>Neither</FavorSizeOrSpeed>
<WholeProgramOptimization>true</WholeProgramOptimization>
<AdditionalIncludeDirectories>../../include; ../../source;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Link>
<OutputFile>..\..\bin\$(ProjectName).exe</OutputFile>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<TargetMachine>MachineX86</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Midl>
<TargetEnvironment>X64</TargetEnvironment>
</Midl>
<ClCompile>
<Optimization>MaxSpeed</Optimization>
<IntrinsicFunctions>true</IntrinsicFunctions>
<AdditionalIncludeDirectories>../../include; ../../source;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Link>
<OutputFile>..\..\bin\$(ProjectName)64.exe</OutputFile>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<TargetMachine>MachineX64</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Releaae2|x64'">
<Midl>
<TargetEnvironment>X64</TargetEnvironment>
</Midl>
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>../../include; ../../source;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Link>
<OutputFile>..\..\bin\$(ProjectName)64_d.exe</OutputFile>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<TargetMachine>MachineX64</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\..\source\BandiVideoLibrary.cpp" />
<ClCompile Include="GdiPlayback.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\source\BandiVideoLibrary.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="bvl">
<UniqueIdentifier>{fd2abfaa-c932-4552-a925-c4b1665e54a2}</UniqueIdentifier>
</Filter>
<Filter Include="main">
<UniqueIdentifier>{45878f75-9e14-48df-8af9-07c16db6c608}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\source\BandiVideoLibrary.cpp">
<Filter>bvl</Filter>
</ClCompile>
<ClCompile Include="GdiPlayback.cpp">
<Filter>main</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\source\BandiVideoLibrary.h">
<Filter>bvl</Filter>
</ClInclude>
</ItemGroup>
</Project>
@@ -0,0 +1,425 @@
<?xml version="1.0" encoding="ks_c_5601-1987"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="GdiPlayback"
ProjectGUID="{F0D048E9-9A54-484B-A2EF-3DDED4B519ED}"
RootNamespace="GdiPlayback"
Keyword="Win32Proj"
TargetFrameworkVersion="196613"
>
<Platforms>
<Platform
Name="Win32"
/>
<Platform
Name="x64"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../../include, ../../source"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
OutputFile="..\..\bin\$(ProjectName)_d.exe"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Debug|x64"
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../../include, ../../source"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
OutputFile="..\..\bin\$(ProjectName)64_d.exe"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="2"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="2"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="0"
WholeProgramOptimization="true"
AdditionalIncludeDirectories="../../include, ../../source"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
RuntimeLibrary="0"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
OutputFile="..\..\bin\$(ProjectName).exe"
LinkIncremental="1"
GenerateDebugInformation="true"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|x64"
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="2"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
EnableIntrinsicFunctions="true"
AdditionalIncludeDirectories="../../include, ../../source"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
RuntimeLibrary="0"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
OutputFile="..\..\bin\$(ProjectName)64.exe"
LinkIncremental="1"
GenerateDebugInformation="true"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Releaae2|x64"
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../../include, ../../source"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
OutputFile="..\..\bin\$(ProjectName)64_d.exe"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="2"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="bvl"
>
<File
RelativePath="..\..\source\BandiVideoLibrary.cpp"
>
</File>
<File
RelativePath="..\..\source\BandiVideoLibrary.h"
>
</File>
</Filter>
<Filter
Name="main"
>
<File
RelativePath=".\GdiPlayback.cpp"
>
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>
@@ -0,0 +1,240 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
///
/// BandiVideoLibrary 2.1 Sample
///
/// Copyright(C) 2008-2011 BandiSoft.com All rights reserved.
///
/// Visit http://www.bandisoft.com for more information.
///
////////////////////////////////////////////////////////////////////////////////////////////////////
#include <windows.h>
#include <stdio.h>
#include "BandiVideoLibrary.h"
#include "BandiVideoTexture_DX9.h"
#pragma warning (disable:4996)
#define WINDOW_TEXT "BandiVideo Simple Playback"
LRESULT WINAPI WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch(uMsg)
{
case WM_PAINT:
{
// 검은색으로 배경 칠하기
PAINTSTRUCT ps;
HDC dc;
dc = BeginPaint(hwnd, &ps);
PatBlt(dc, 0, 0, 4096, 4096, BLACKNESS);
EndPaint(hwnd, &ps);
}
return 0;
case WM_ERASEBKGND:
return 1;
case WM_DESTROY:
PostQuitMessage(0);
return 0;
}
return DefWindowProc(hwnd, uMsg, wParam, lParam);
}
// 윈도우 생성
static HWND CreatePlayerWindow(HINSTANCE hInstance, HINSTANCE hPrevInstance)
{
if(!hPrevInstance)
{
WNDCLASS wc;
wc.style = 0;
wc.lpfnWndProc = WindowProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = hInstance;
wc.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(101));
wc.hCursor = LoadCursor(0, IDC_ARROW);;
wc.hbrBackground = 0;
wc.lpszMenuName = 0;
wc.lpszClassName = "SimplePlayback";
if(!RegisterClass(&wc))
{
return( 0 );
}
}
return CreateWindow("SimplePlayback", WINDOW_TEXT,
WS_CAPTION | WS_POPUP| WS_CLIPCHILDREN |
WS_SYSMENU | WS_MINIMIZEBOX | WS_SIZEBOX,
64, 64,
64, 64,
0, 0, hInstance,0);
}
// 윈도우 보더 크기 계산
static void CalcWindowBorder(HWND hwnd, int &extra_width, int &extra_height)
{
RECT r, c;
GetWindowRect(hwnd, &r);
GetClientRect(hwnd, &c);
extra_width = ( r.right - r.left ) - ( c.right - c.left );
extra_height = ( r.bottom - r.top ) - ( c.bottom - c.top );
}
int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
HWND hwnd;
MSG msg;
int extra_width, extra_height;
// 재생창 생성하기
hwnd = CreatePlayerWindow(hInstance, hPrevInstance);
if(!hwnd)
{
MessageBox(NULL, "Error creating window.", WINDOW_TEXT, MB_OK | MB_ICONSTOP);
return 1;
}
CalcWindowBorder(hwnd, extra_width, extra_height);
CBandiVideoLibrary bvl;
CBandiVideoDevice* bvd;
CBandiVideoTexture* bvt;
if(FAILED(bvl.Create(BANDIVIDEO_DLL_FILE_NAME, NULL, NULL)))
{
MessageBox(NULL, "Error creating BandiVideoLibrary.", WINDOW_TEXT, MB_OK | MB_ICONSTOP);
DestroyWindow(hwnd);
return 2;
}
/* // verify
if(FAILED(bvl.Verify("BANDISOFT-TRIAL-200909", "ea92bc5b")))
{
// trial expired!!
ASSERT(0);
}*/
if(FAILED(bvl.Open(lpCmdLine, FALSE)))
{
MessageBox(NULL, "Error opening file....", WINDOW_TEXT, MB_OK | MB_ICONSTOP);
DestroyWindow(hwnd);
return 3;
}
BVL_VIDEO_INFO info;
if(FAILED(bvl.GetVideoInfo(info)))
{
MessageBox(NULL, "Error getting video info....", WINDOW_TEXT, MB_OK | MB_ICONSTOP);
DestroyWindow(hwnd);
return 4;
}
// 비디오 크기에 맞춰 창크기 변경
SetWindowPos(hwnd, 0, 0, 0, info.width+extra_width, info.height+extra_height, SWP_NOMOVE);
bvd = new CBandiVideoDevice_DX9();
if(!bvd || FAILED(bvd->Open(hwnd)))
{
MessageBox(NULL, "Error opening device...", WINDOW_TEXT, MB_OK | MB_ICONSTOP);
DestroyWindow(hwnd);
if(bvd) delete bvd;
return -1;
}
bvt = new CBandiVideoTexture_DX9((CBandiVideoDevice_DX9*)bvd);
if(!bvt || FAILED(bvt->Open(info.width , info.height)))
{
MessageBox(NULL, "Error opening texture...", WINDOW_TEXT, MB_OK | MB_ICONSTOP);
DestroyWindow(hwnd);
if(bvd) delete bvd;
if(bvt) delete bvt;
return -1;
}
bvl.Play();
ShowWindow(hwnd, nCmdShow);
do
{
if(PeekMessage(&msg, 0, 0, 0, PM_REMOVE))
{
if(msg.message == WM_QUIT)
break;
TranslateMessage(&msg);
DispatchMessage(&msg);
}
else
{
BVL_STATUS status;
bvl.GetStatus(status);
if(status == BVL_STATUS_PLAYEND)
{
bvl.Seek(0, BVL_SEEK_TIME);
bvl.Play();
}
// 새 프레임을 출력할 시간인가?
if(bvl.IsNextFrame())
{
INT pitch;
BYTE* buf = bvt->Lock(pitch);
if(buf)
{
// Get frame
BVL_FRAME frame;
frame.frame_buf = buf;
frame.frame_buf_size = info.height*pitch;
frame.pitch = pitch;
frame.width = info.width;
frame.height = info.height;
frame.pixel_format = bvt->GetFormat();
bvl.GetFrame(frame, FALSE);
bvt->Unlock();
// Show frame
bvd->StartFrame();
bvt->Draw(0, 0, info.width, info.height);
bvd->EndFrame();
}
}
else
{
Sleep(1);
}
}
}
while(1);
bvl.Destroy();
if(bvd)
{
bvd->Close();
delete bvd;
}
if(bvt)
{
bvt->Close();
delete bvt;
}
return 0;
}
@@ -0,0 +1,397 @@
<?xml version="1.0" encoding="ks_c_5601-1987"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Name="SimplePlayback"
ProjectGUID="{CD9FEE1E-7405-4663-BCAF-A4AAE4511E15}"
RootNamespace="SimplePlayback_Gdi"
Keyword="Win32Proj"
TargetFrameworkVersion="196613"
>
<Platforms>
<Platform
Name="Win32"
/>
<Platform
Name="x64"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../../include, ../../source"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="d3d9.lib dsound.lib"
OutputFile="..\..\bin\$(ProjectName)_d.exe"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Debug|x64"
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../../include, ../../source"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="d3d9.lib dsound.lib"
OutputFile="..\..\bin\$(ProjectName)64_d.exe"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="2"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="2"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
EnableIntrinsicFunctions="true"
AdditionalIncludeDirectories="../../include, ../../source"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
RuntimeLibrary="0"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="d3d9.lib dsound.lib"
OutputFile="..\..\bin\$(ProjectName).exe"
LinkIncremental="1"
GenerateDebugInformation="true"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|x64"
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="2"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
EnableIntrinsicFunctions="true"
AdditionalIncludeDirectories="../../include, ../../source"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
RuntimeLibrary="0"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="d3d9.lib dsound.lib"
OutputFile="..\..\bin\$(ProjectName)64.exe"
LinkIncremental="1"
GenerateDebugInformation="true"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="bvl"
>
<File
RelativePath="..\..\source\BandiVideoLibrary.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\source\BandiVideoLibrary.h"
>
</File>
<File
RelativePath="..\..\source\BandiVideoTexture.h"
>
</File>
<File
RelativePath="..\..\source\BandiVideoTexture_DX9.cpp"
>
</File>
<File
RelativePath="..\..\source\BandiVideoTexture_DX9.h"
>
</File>
</Filter>
<Filter
Name="main"
>
<File
RelativePath=".\SimplePlayback.cpp"
>
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>
@@ -0,0 +1,192 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{CD9FEE1E-7405-4663-BCAF-A4AAE4511E15}</ProjectGuid>
<RootNamespace>SimplePlayback_Gdi</RootNamespace>
<Keyword>Win32Proj</Keyword>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Platform)\$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(Platform)\$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>../../include; ../../source;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
</ClCompile>
<Link>
<AdditionalDependencies>d3d9.lib;dsound.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>..\..\bin\$(ProjectName)_d.exe</OutputFile>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<TargetMachine>MachineX86</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Midl>
<TargetEnvironment>X64</TargetEnvironment>
</Midl>
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>../../include; ../../source;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Link>
<AdditionalDependencies>d3d9.lib;dsound.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>..\..\bin\$(ProjectName)64_d.exe</OutputFile>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<TargetMachine>MachineX64</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<Optimization>MaxSpeed</Optimization>
<IntrinsicFunctions>true</IntrinsicFunctions>
<AdditionalIncludeDirectories>../../include; ../../source;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Link>
<AdditionalDependencies>d3d9.lib;dsound.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>..\..\bin\$(ProjectName).exe</OutputFile>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<TargetMachine>MachineX86</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Midl>
<TargetEnvironment>X64</TargetEnvironment>
</Midl>
<ClCompile>
<Optimization>MaxSpeed</Optimization>
<IntrinsicFunctions>true</IntrinsicFunctions>
<AdditionalIncludeDirectories>../../include; ../../source;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Link>
<AdditionalDependencies>d3d9.lib;dsound.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>..\..\bin\$(ProjectName)64.exe</OutputFile>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<TargetMachine>MachineX64</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\..\source\BandiVideoLibrary.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
</PrecompiledHeader>
</ClCompile>
<ClCompile Include="..\..\source\BandiVideoTexture_DX9.cpp" />
<ClCompile Include="SimplePlayback.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\source\BandiVideoLibrary.h" />
<ClInclude Include="..\..\source\BandiVideoTexture.h" />
<ClInclude Include="..\..\source\BandiVideoTexture_DX9.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="bvl">
<UniqueIdentifier>{840a83bc-2f7d-486e-aa23-754245c9d4ca}</UniqueIdentifier>
</Filter>
<Filter Include="main">
<UniqueIdentifier>{f7d8b418-0945-4282-9281-469fbcd4c830}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\source\BandiVideoLibrary.cpp">
<Filter>bvl</Filter>
</ClCompile>
<ClCompile Include="..\..\source\BandiVideoTexture_DX9.cpp">
<Filter>bvl</Filter>
</ClCompile>
<ClCompile Include="SimplePlayback.cpp">
<Filter>main</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\source\BandiVideoLibrary.h">
<Filter>bvl</Filter>
</ClInclude>
<ClInclude Include="..\..\source\BandiVideoTexture.h">
<Filter>bvl</Filter>
</ClInclude>
<ClInclude Include="..\..\source\BandiVideoTexture_DX9.h">
<Filter>bvl</Filter>
</ClInclude>
</ItemGroup>
</Project>
@@ -0,0 +1,397 @@
<?xml version="1.0" encoding="ks_c_5601-1987"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="SimplePlayback"
ProjectGUID="{CD9FEE1E-7405-4663-BCAF-A4AAE4511E15}"
RootNamespace="SimplePlayback_Gdi"
Keyword="Win32Proj"
TargetFrameworkVersion="196613"
>
<Platforms>
<Platform
Name="Win32"
/>
<Platform
Name="x64"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../../include, ../../source"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="d3d9.lib dsound.lib"
OutputFile="..\..\bin\$(ProjectName)_d.exe"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Debug|x64"
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../../include, ../../source"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="d3d9.lib dsound.lib"
OutputFile="..\..\bin\$(ProjectName)64_d.exe"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="2"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="2"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
EnableIntrinsicFunctions="true"
AdditionalIncludeDirectories="../../include, ../../source"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
RuntimeLibrary="0"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="d3d9.lib dsound.lib"
OutputFile="..\..\bin\$(ProjectName).exe"
LinkIncremental="1"
GenerateDebugInformation="true"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|x64"
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="2"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
EnableIntrinsicFunctions="true"
AdditionalIncludeDirectories="../../include, ../../source"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
RuntimeLibrary="0"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="d3d9.lib dsound.lib"
OutputFile="..\..\bin\$(ProjectName)64.exe"
LinkIncremental="1"
GenerateDebugInformation="true"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="bvl"
>
<File
RelativePath="..\..\source\BandiVideoLibrary.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\source\BandiVideoLibrary.h"
>
</File>
<File
RelativePath="..\..\source\BandiVideoTexture.h"
>
</File>
<File
RelativePath="..\..\source\BandiVideoTexture_DX9.cpp"
>
</File>
<File
RelativePath="..\..\source\BandiVideoTexture_DX9.h"
>
</File>
</Filter>
<Filter
Name="main"
>
<File
RelativePath=".\SimplePlayback.cpp"
>
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>
@@ -0,0 +1,147 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
///
/// BandiVideoLibrary 2.1
///
/// Copyright(C) 2008-2011 BandiSoft.com All rights reserved.
///
/// Visit http://www.bandisoft.com for more information.
///
////////////////////////////////////////////////////////////////////////////////////////////////////
#include "BandiVideoFileReader.h"
CBandiVideoFileReader::CBandiVideoFileReader() : m_ref_count(0), m_file_handle(NULL)
{
}
CBandiVideoFileReader::~CBandiVideoFileReader()
{
Close();
}
STDMETHODIMP_(ULONG) CBandiVideoFileReader::AddRef()
{
LONG lRef = InterlockedIncrement(&m_ref_count);
ASSERT(lRef >= 0);
return m_ref_count;
}
STDMETHODIMP_(ULONG) CBandiVideoFileReader::Release()
{
LONG lRef = InterlockedDecrement(&m_ref_count);
ASSERT(lRef >= 0);
if(lRef == 0)
{
delete this;
return ULONG(0);
}
return m_ref_count;
}
////////////////////////////////////////////////////////////////////////////////////////////////////
///
/// Open a bandivideo file.
///
////////////////////////////////////////////////////////////////////////////////////////////////////
HRESULT CBandiVideoFileReader::Open(LPCWSTR path_name)
{
Close();
HANDLE hFile = CreateFileW(path_name, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_FLAG_SEQUENTIAL_SCAN, NULL);
if(hFile == INVALID_HANDLE_VALUE)
return E_FAIL;
m_file_handle = hFile;
return S_OK;
}
////////////////////////////////////////////////////////////////////////////////////////////////////
///
/// Close a bandivideo file.
///
////////////////////////////////////////////////////////////////////////////////////////////////////
void CBandiVideoFileReader::Close()
{
if(m_file_handle)
{
::CloseHandle(m_file_handle);
m_file_handle = NULL;
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////
///
/// Read data from a file.
///
////////////////////////////////////////////////////////////////////////////////////////////////////
INT CBandiVideoFileReader::Read(BYTE* buf, INT bytes_to_read)
{
DWORD dwBytesRead = 0;
if (!::ReadFile(m_file_handle, buf, bytes_to_read, &dwBytesRead, NULL))
return 0;
return dwBytesRead;
}
////////////////////////////////////////////////////////////////////////////////////////////////////
///
/// Move the file pointer of the specified file.
///
////////////////////////////////////////////////////////////////////////////////////////////////////
INT64 CBandiVideoFileReader::SetPosition(INT64 pos)
{
LARGE_INTEGER li;
li.QuadPart = pos;
li.LowPart = ::SetFilePointer(m_file_handle , li.LowPart , &li.HighPart , FILE_BEGIN);
if (li.LowPart == INVALID_SET_FILE_POINTER && GetLastError() != NO_ERROR)
{
li.QuadPart = -1;
}
return li.QuadPart;
}
////////////////////////////////////////////////////////////////////////////////////////////////////
///
/// Return the file pointer of the specified file.
///
////////////////////////////////////////////////////////////////////////////////////////////////////
INT64 CBandiVideoFileReader::GetPosition()
{
LARGE_INTEGER li;
li.QuadPart = 0;
li.LowPart = ::SetFilePointer(m_file_handle , li.LowPart , &li.HighPart , FILE_CURRENT);
return li.QuadPart;
}
////////////////////////////////////////////////////////////////////////////////////////////////////
///
/// Return the size of the specified file.
///
////////////////////////////////////////////////////////////////////////////////////////////////////
INT64 CBandiVideoFileReader::GetFileSize()
{
LARGE_INTEGER size = {0, 0};
size.LowPart = ::GetFileSize(m_file_handle , (DWORD*)&size.HighPart);
return size.QuadPart;
}
@@ -0,0 +1,38 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
///
/// BandiVideoLibrary 2.1
///
/// Copyright(C) 2008-2011 BandiSoft.com All rights reserved.
///
/// Visit http://www.bandisoft.com for more information.
///
////////////////////////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "bandivid.h"
class CBandiVideoFileReader : public IBandiVideoFileReader
{
public:
CBandiVideoFileReader();
virtual ~CBandiVideoFileReader();
// IUnknown
STDMETHODIMP QueryInterface(REFIID riid, void **ppv) { return E_NOTIMPL; };
STDMETHODIMP_(ULONG) AddRef();
STDMETHODIMP_(ULONG) Release();
// IBandiVideoFileReader
HRESULT Open(LPCWSTR path_name);
void Close();
INT Read(BYTE* buf, INT bytes_to_read);
INT64 SetPosition(INT64 pos);
INT64 GetPosition();
INT64 GetFileSize();
protected:
LONG m_ref_count;
HANDLE m_file_handle;
};
@@ -0,0 +1,172 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
///
/// BandiVideoLibrary 2.1
///
/// Copyright(C) 2008-2011 BandiSoft.com All rights reserved.
///
/// Visit http://www.bandisoft.com for more information.
///
////////////////////////////////////////////////////////////////////////////////////////////////////
#include "BandiVideoLibrary.h"
CBandiVideoLibrary::CBandiVideoLibrary()
{
m_dll = NULL;
m_pCreateBandiVideo2 = NULL;
m_bvl = NULL;
}
CBandiVideoLibrary::~CBandiVideoLibrary()
{
Destroy();
}
// 라이브러리 초기화
HRESULT CBandiVideoLibrary::Create(LPCTSTR dll_path_name, IBandiVideoFileReader *reader /*= NULL */, IBandiVideoSound *sound /*= NULL */)
{
if(m_dll) {ASSERT(0); return BVERR_ALREADY_CREATED;}
// check os version
OSVERSIONINFO osv;
osv.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
if (GetVersionEx(&osv)==FALSE ||
osv.dwPlatformId <=VER_PLATFORM_WIN32_WINDOWS) // does not support 98
{
return BVERR_UNSUPPORTED_OS;
}
// DLL 로드
m_dll = LoadLibrary(dll_path_name);
if(m_dll==NULL)
{
m_dll = LoadLibrary(BANDIVIDEO_RELEASE_DLL_FILE_NAME);
if(m_dll==NULL)
{
ASSERT(0);
return BVERR_LOAD_LIBRARY_FAIL;
}
}
m_pCreateBandiVideo2 = (LPCREATEBANDIVIDEO2)GetProcAddress(m_dll, "CreateBandiVideo2");
if(m_pCreateBandiVideo2==NULL)
{
ASSERT(0);
FreeLibrary(m_dll);
m_dll = NULL;
return BVERR_GET_PROC_ADDRESS_FAIL;
}
return m_pCreateBandiVideo2(BVL_VERSION, (void**)&m_bvl, reader, sound);
}
BOOL CBandiVideoLibrary::IsCreated()
{
return m_bvl ? TRUE : FALSE;
}
// 라이브러리 해제
void CBandiVideoLibrary::Destroy()
{
if(m_bvl)
{
m_bvl->Release();
m_bvl = NULL;
}
m_pCreateBandiVideo2 = NULL;
if(m_dll) FreeLibrary(m_dll);
m_dll = NULL;
}
// 인증하기
HRESULT CBandiVideoLibrary::Verify(LPCSTR id, LPCSTR key)
{
if(m_bvl==NULL) {ASSERT(0); return BVERR_LIBRARY_NOT_LOADED;}
return m_bvl->Verify(id, key);
}
// 버전 정보
INT CBandiVideoLibrary::GetVersion()
{
if(m_bvl==NULL) {ASSERT(0); return 0;}
return m_bvl->GetVersion();
}
HRESULT CBandiVideoLibrary::Open(LPCWSTR path_name, BOOL async)
{
if(m_bvl==NULL) {ASSERT(0); return BVERR_LIBRARY_NOT_LOADED;}
return m_bvl->Open(path_name, async);
}
HRESULT CBandiVideoLibrary::Open(LPCSTR path_name, BOOL async)
{
if(m_bvl==NULL) {ASSERT(0); return BVERR_LIBRARY_NOT_LOADED;}
WCHAR wszPath[MAX_PATH+1];
MultiByteToWideChar(CP_ACP, NULL, path_name, -1, wszPath, MAX_PATH);
return m_bvl->Open(wszPath, async);
}
HRESULT CBandiVideoLibrary::Close()
{
if(m_bvl==NULL) {ASSERT(0); return BVERR_LIBRARY_NOT_LOADED;}
return m_bvl->Close();
}
HRESULT CBandiVideoLibrary::Play()
{
if(m_bvl==NULL) {ASSERT(0); return BVERR_LIBRARY_NOT_LOADED;}
return m_bvl->Play();
}
HRESULT CBandiVideoLibrary::Stop()
{
if(m_bvl==NULL) {ASSERT(0); return BVERR_LIBRARY_NOT_LOADED;}
return m_bvl->Stop();
}
HRESULT CBandiVideoLibrary::Seek(INT64 value, BVL_SEEK_FLAG seek_flag)
{
if(m_bvl==NULL) {ASSERT(0); return BVERR_LIBRARY_NOT_LOADED;}
return m_bvl->Seek(value, seek_flag);
}
HRESULT CBandiVideoLibrary::Pause(BOOL pause)
{
if(m_bvl==NULL) {ASSERT(0); return BVERR_LIBRARY_NOT_LOADED;}
return m_bvl->Pause(pause);
}
BOOL CBandiVideoLibrary::IsNextFrame()
{
if(m_bvl==NULL) {ASSERT(0); return FALSE;}
return m_bvl->IsNextFrame();
}
HRESULT CBandiVideoLibrary::GetFrame(BVL_FRAME &frame, BOOL can_skip)
{
if(m_bvl==NULL) {ASSERT(0); return BVERR_LIBRARY_NOT_LOADED;}
return m_bvl->GetFrame(frame, can_skip);
}
HRESULT CBandiVideoLibrary::GetVideoInfo(BVL_VIDEO_INFO &info)
{
if(m_bvl==NULL) {ASSERT(0); return BVERR_LIBRARY_NOT_LOADED;}
return m_bvl->GetVideoInfo(info);
}
HRESULT CBandiVideoLibrary::GetStatus(BVL_STATUS &status)
{
if(m_bvl==NULL) {ASSERT(0); return BVERR_LIBRARY_NOT_LOADED;}
return m_bvl->GetStatus(status);
}
HRESULT CBandiVideoLibrary::SetVolume(INT volume)
{
if(m_bvl==NULL) {ASSERT(0); return BVERR_LIBRARY_NOT_LOADED;}
return m_bvl->SetVolume(volume);
}
@@ -0,0 +1,77 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
///
/// BandiVideoLibrary 2.1
///
/// Copyright(C) 2008-2011 BandiSoft.com All rights reserved.
///
/// Visit http://www.bandisoft.com for more information.
///
////////////////////////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "bandivid.h"
#ifdef _WIN64
# ifdef _DEBUG
# define BANDIVIDEO_DLL_FILE_NAME _T("bdvid64_d.dll")
# else
# define BANDIVIDEO_DLL_FILE_NAME _T("bdvid64.dll")
# endif
# define BANDIVIDEO_RELEASE_DLL_FILE_NAME _T("bdvid64.dll")
#else
# ifdef _DEBUG
# define BANDIVIDEO_DLL_FILE_NAME _T("bdvid32_d.dll")
# else
# define BANDIVIDEO_DLL_FILE_NAME _T("bdvid32.dll")
# endif
# define BANDIVIDEO_RELEASE_DLL_FILE_NAME _T("bdvid32.dll")
#endif
////////////////////////////////////////////////////////////////////////////////////////////////////
// utility class for load library and create instance for video library
////////////////////////////////////////////////////////////////////////////////////////////////////
class CBandiVideoLibrary : public IBandiVideo2
{
public :
CBandiVideoLibrary();
~CBandiVideoLibrary();
HRESULT Create(LPCTSTR dll_path_name, IBandiVideoFileReader *reader = NULL, IBandiVideoSound *sound = NULL);
void Destroy();
BOOL IsCreated();
public :
// IUnknown
HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** p) { return E_NOTIMPL; }
ULONG STDMETHODCALLTYPE AddRef(void) {return 0;}
ULONG STDMETHODCALLTYPE Release(void) {return 0;}
// IBandiVideo2
HRESULT Verify(LPCSTR szID, LPCSTR szKey); // ÀÎÁõÇϱâ
INT GetVersion(); // ¹öÀü Á¤º¸
HRESULT Open(LPCWSTR path_name, BOOL async = FALSE);
HRESULT Open(LPCSTR path_name, BOOL async = FALSE);
HRESULT Close();
HRESULT Play();
HRESULT Stop();
HRESULT Seek(INT64 value, BVL_SEEK_FLAG seek_flag);
HRESULT Pause(BOOL pause);
BOOL IsNextFrame();
HRESULT GetFrame(BVL_FRAME &frame, BOOL can_skip);
HRESULT GetVideoInfo(BVL_VIDEO_INFO &info);
HRESULT GetStatus(BVL_STATUS &status);
HRESULT SetVolume(INT volume); // 0 ~ 255
private :
HMODULE m_dll;
LPCREATEBANDIVIDEO2 m_pCreateBandiVideo2;
public:
IBandiVideo2* m_bvl;
};
@@ -0,0 +1,504 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
///
/// BandiVideoLibrary 2.1
///
/// Copyright(C) 2008-2011 BandiSoft.com All rights reserved.
///
/// Visit http://www.bandisoft.com for more information.
///
////////////////////////////////////////////////////////////////////////////////////////////////////
#include <windows.h>
#include <process.h>
#include <math.h>
#include "BandiVideoSound_DS.h"
#define BVL_DSWND_CLASS_NAME _T("CBandiVideoSound_DS")
CBandiVideoSound_DS::CBandiVideoSound_DS() : m_ref_count(0)
{
m_hwnd = NULL;
m_hinst = NULL;
m_ds = NULL;
m_dsb_primary = NULL;
m_dsb_secondary = NULL;
m_channels = m_samplerate = 0;
m_last_write_pos = 0;
m_inbuf_samples = m_total_samples = 0;
m_cur_play_time = 0;
memset(&m_crit_sec, NULL, sizeof(m_crit_sec));
m_crit_sec_inited = FALSE;
m_hevent = NULL;
m_hthread = NULL;
m_thread_id = 0;
m_playing = FALSE;
m_callback = NULL;
m_outbuf_size_max = -1;
m_outbuf_size_min = -1;
memset(m_sample_block, NULL, PLAY_SAMPLE_BLOCK_LEN);
m_sample_block_size = 0;
}
CBandiVideoSound_DS::~CBandiVideoSound_DS()
{
Close();
}
STDMETHODIMP_(ULONG) CBandiVideoSound_DS::AddRef()
{
LONG lRef = InterlockedIncrement(&m_ref_count);
ASSERT(lRef >= 0);
return m_ref_count;
}
STDMETHODIMP_(ULONG) CBandiVideoSound_DS::Release()
{
LONG lRef = InterlockedDecrement(&m_ref_count);
ASSERT(lRef >= 0);
if(lRef == 0)
{
delete this;
return ULONG(0);
}
return m_ref_count;
}
////////////////////////////////////////////////////////////////////////////////////////////////////
///
/// Open sound device.
///
////////////////////////////////////////////////////////////////////////////////////////////////////
HRESULT CBandiVideoSound_DS::Open(INT channels, INT samplerate, IBandiVideoSoundCB *callback)
{
Close();
HRESULT hr = E_FAIL;
m_hinst = (HINSTANCE)GetModuleHandle(NULL);
if(m_hinst == NULL) goto error;
WNDCLASS wc;
ZeroMemory(&wc, sizeof(wc));
wc.lpfnWndProc = DefWindowProc;
wc.lpszClassName = BVL_DSWND_CLASS_NAME;
RegisterClass(&wc);
// 버퍼타임으로 버퍼 byte 크기 계산
m_outbuf_size_max = MulDiv(samplerate * channels * 2, MAX_BUFFER_TIME , 1000) ;
m_outbuf_size_min = MulDiv(samplerate * channels * 2, MIN_BUFFER_TIME ,1000 );
// Create dummy window
m_hwnd = CreateWindow(BVL_DSWND_CLASS_NAME, _T(""), 0, 0, 0, 0, 0, NULL, NULL, m_hinst, 0L);
if(m_hwnd == NULL)
goto error;
// Create Direct Sound Instance
hr = DirectSoundCreate8(NULL, &m_ds, NULL);
if(FAILED(hr))
goto error;
hr = m_ds->SetCooperativeLevel(m_hwnd, DSSCL_PRIORITY);
if(FAILED(hr))
goto error;
// Create a primary buffer
DSBUFFERDESC dsbdesc;
ZeroMemory(&dsbdesc, sizeof(DSBUFFERDESC));
dsbdesc.dwSize = sizeof(DSBUFFERDESC);
dsbdesc.dwFlags = DSBCAPS_PRIMARYBUFFER;
hr = m_ds->CreateSoundBuffer(&dsbdesc, &m_dsb_primary, NULL);
if(FAILED(hr))
goto error;
// Set format of the primary buffer
WAVEFORMATEX wfx;
ZeroMemory(&wfx, sizeof(WAVEFORMATEX));
wfx.wFormatTag = WAVE_FORMAT_PCM;
wfx.nChannels = channels;
wfx.nSamplesPerSec = samplerate;
wfx.wBitsPerSample = 16;
wfx.nBlockAlign = wfx.wBitsPerSample / 8 * wfx.nChannels;
wfx.nAvgBytesPerSec = wfx.nSamplesPerSec * wfx.nBlockAlign;
hr = m_dsb_primary->SetFormat(&wfx);
if(FAILED(hr))
goto error;
// Create secondary sound buffer
ZeroMemory(&dsbdesc, sizeof(DSBUFFERDESC));
dsbdesc.dwSize = sizeof(DSBUFFERDESC);
dsbdesc.dwFlags = DSBCAPS_GETCURRENTPOSITION2 | DSBCAPS_GLOBALFOCUS
/*| DSBCAPS_LOCDEFER | DSBCAPS_CTRLFREQUENCY*/ | DSBCAPS_CTRLVOLUME;
dsbdesc.dwBufferBytes = m_outbuf_size_max;
dsbdesc.lpwfxFormat = &wfx;
hr = m_ds->CreateSoundBuffer(&dsbdesc, &m_dsb_secondary, NULL);
if(FAILED(hr))
goto error;
InitializeCriticalSection(&m_crit_sec);
m_crit_sec_inited = TRUE;
// Create an event object for periodical processing
m_hevent = CreateEvent(NULL, FALSE, FALSE, NULL); // auto reset event
if(m_hevent == NULL)
goto error;
// Create thread for playback
m_hthread = (HANDLE)_beginthreadex(NULL, 0, InitialThreadProc, this, CREATE_SUSPENDED, &m_thread_id);
if(m_hthread == NULL)
goto error;
m_channels = channels;
m_samplerate = samplerate;
m_callback = callback;
memset(m_sample_block, NULL, PLAY_SAMPLE_BLOCK_LEN);
m_sample_block_size = 0;
SetThreadPriority(m_hthread, THREAD_PRIORITY_TIME_CRITICAL);
ResumeThread(m_hthread);
return S_OK;
error:
Close();
return FAILED(hr) ? hr : E_FAIL;
}
////////////////////////////////////////////////////////////////////////////////////////////////////
///
/// Close sound device.
///
////////////////////////////////////////////////////////////////////////////////////////////////////
void CBandiVideoSound_DS::Close()
{
HANDLE hThread = (HANDLE)InterlockedExchangePointer(&m_hthread, 0);
if(hThread)
{
if(m_hevent) SetEvent(m_hevent);
WaitForSingleObject(hThread, INFINITE);
CloseHandle(hThread);
}
if(m_hevent)
{
CloseHandle(m_hevent);
m_hevent = NULL;
}
if(m_crit_sec_inited)
{
DeleteCriticalSection(&m_crit_sec);
m_crit_sec_inited = FALSE;
}
if(m_dsb_secondary)
{
m_dsb_secondary->Release();
m_dsb_secondary = NULL;
}
if(m_dsb_primary)
{
m_dsb_primary->Release();
m_dsb_primary = NULL;
}
if(m_ds)
{
m_ds->Release();
m_ds = NULL;
}
if(m_hwnd)
{
DestroyWindow(m_hwnd);
UnregisterClass(BVL_DSWND_CLASS_NAME, m_hinst);
m_hwnd = NULL;
}
m_channels = m_samplerate = 0;
m_last_write_pos = 0;
m_inbuf_samples = m_total_samples = 0;
m_cur_play_time = 0;
m_playing = FALSE;
}
////////////////////////////////////////////////////////////////////////////////////////////////////
///
/// Start
///
////////////////////////////////////////////////////////////////////////////////////////////////////
HRESULT CBandiVideoSound_DS::Start()
{
EnterCriticalSection(&m_crit_sec);
m_playing = TRUE;
LeaveCriticalSection(&m_crit_sec);
return S_OK;
}
////////////////////////////////////////////////////////////////////////////////////////////////////
///
/// Stop
///
////////////////////////////////////////////////////////////////////////////////////////////////////
HRESULT CBandiVideoSound_DS::Stop()
{
EnterCriticalSection(&m_crit_sec);
m_playing = FALSE;
if(m_dsb_secondary)
{
BYTE *pbData = NULL;
BYTE *pbData2 = NULL;
DWORD dwLength=0;
DWORD dwLength2=0;
m_dsb_secondary->Stop();
m_dsb_secondary->SetCurrentPosition(0);
// Lock DirectSound buffer
m_dsb_secondary->Lock(0, m_outbuf_size_max, (void**)&pbData, &dwLength, (void**)&pbData2, &dwLength2, 0);
if(pbData) memset(pbData, 0, dwLength);
if(pbData2) memset(pbData2, 0, dwLength2);
// Unlock the buffer
m_dsb_secondary->Unlock(pbData, dwLength, pbData2, dwLength2);
m_last_write_pos = 0;
m_total_samples = m_inbuf_samples = 0;
m_cur_play_time = 0;
memset(m_sample_block, NULL, PLAY_SAMPLE_BLOCK_LEN);
m_sample_block_size = 0;
}
LeaveCriticalSection(&m_crit_sec);
return S_OK;
}
////////////////////////////////////////////////////////////////////////////////////////////////////
///
/// Stop
///
////////////////////////////////////////////////////////////////////////////////////////////////////
HRESULT CBandiVideoSound_DS::Pause(BOOL pause)
{
EnterCriticalSection(&m_crit_sec);
if(pause)
{
m_playing = FALSE;
if(m_dsb_secondary) m_dsb_secondary->Stop();
}
else
{
m_playing = TRUE;
}
LeaveCriticalSection(&m_crit_sec);
return S_OK;
}
#include <stdio.h>
////////////////////////////////////////////////////////////////////////////////////////////////////
///
/// Get play time (100nsec units)
///
////////////////////////////////////////////////////////////////////////////////////////////////////
HRESULT CBandiVideoSound_DS::GetTime(INT64 &time)
{
EnterCriticalSection(&m_crit_sec);
time = m_cur_play_time;
LeaveCriticalSection(&m_crit_sec);
return S_OK;
}
////////////////////////////////////////////////////////////////////////////////////////////////////
///
/// Set sound volume
///
////////////////////////////////////////////////////////////////////////////////////////////////////
HRESULT CBandiVideoSound_DS::SetVolume(INT volume)
{
if(m_dsb_secondary == NULL)
return E_POINTER;
double lfPower10 = pow(10.0,-10.0); // 10^(-10);
double lfVolume = (1 - lfPower10)*((double)volume/255) + lfPower10;
lfVolume = 10*log10(lfVolume);
lfVolume *= 300;
if(lfVolume < -10000)
lfVolume = -10000;
return m_dsb_secondary->SetVolume((LONG)lfVolume);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
///
/// ThreadProc
///
////////////////////////////////////////////////////////////////////////////////////////////////////
UINT CBandiVideoSound_DS::ThreadProc()
{
BOOL bWorking = FALSE;
while(m_hthread)
{
EnterCriticalSection(&m_crit_sec);
{
if(m_playing)
PlayDS();
}
LeaveCriticalSection(&m_crit_sec);
WaitForSingleObject(m_hevent, 2);
}
return 0;
}
////////////////////////////////////////////////////////////////////////////////////////////////////
///
/// Play DirectSound
///
////////////////////////////////////////////////////////////////////////////////////////////////////
HRESULT CBandiVideoSound_DS::PlayDS()
{
HRESULT hr;
int sample_bytes = m_channels*sizeof(INT16);
DWORD free_buffer_size = GetFreeBufferSize();
// Update play position
m_inbuf_samples = (m_outbuf_size_max - free_buffer_size)/(m_channels*sizeof(INT16));
m_cur_play_time = max((m_total_samples - m_inbuf_samples)*10000000i64/m_samplerate, 0);
// Transfer PCM data to Direct Sound Buffer
if(m_callback)
{
void *lock1_ptr = NULL;
void *lock2_ptr = NULL;
DWORD lock1_bytes = 0;
DWORD lock2_bytes = 0;
if(m_sample_block_size < PLAY_SAMPLE_BLOCK_LEN)
{
int req_samples = (PLAY_SAMPLE_BLOCK_LEN-m_sample_block_size)/sample_bytes;
int get_samples = m_callback->GetPcmData((INT16*)(&m_sample_block[m_sample_block_size]), req_samples);
m_sample_block_size += get_samples*sample_bytes;
}
if(m_sample_block_size == PLAY_SAMPLE_BLOCK_LEN && m_sample_block_size <= free_buffer_size)
{
hr = m_dsb_secondary->Lock(m_last_write_pos, m_sample_block_size,
&lock1_ptr, &lock1_bytes,
&lock2_ptr, &lock2_bytes, 0);
if(hr == DSERR_BUFFERLOST)
{
m_dsb_secondary->Restore();
hr = m_dsb_secondary->Lock(m_last_write_pos, m_sample_block_size,
&lock1_ptr, &lock1_bytes,
&lock2_ptr, &lock2_bytes, 0);
}
if(FAILED(hr)) return hr;
if(lock1_ptr) memcpy(lock1_ptr, m_sample_block, lock1_bytes);
if(lock2_ptr) memcpy(lock2_ptr, m_sample_block+lock1_bytes, lock2_bytes);
m_dsb_secondary->Unlock(lock1_ptr, lock1_bytes, lock2_ptr, lock2_bytes);
// Update Write Pointer
m_total_samples += m_sample_block_size/sample_bytes;
m_last_write_pos += m_sample_block_size;
if (INT(m_last_write_pos) >= m_outbuf_size_max)
m_last_write_pos = m_last_write_pos - m_outbuf_size_max;
m_sample_block_size = 0;
}
}
// PLAYBACK control
DWORD dsb_status;
m_dsb_secondary->GetStatus(&dsb_status);
if((dsb_status & DSBSTATUS_PLAYING) == 0)
{
if (m_inbuf_samples >= m_outbuf_size_min)
{
m_dsb_secondary->Play(0, 0, DSBPLAY_LOOPING);
}
}
return S_OK;
}
////////////////////////////////////////////////////////////////////////////////////////////////////
///
/// Get amount of free data in the buffer
///
////////////////////////////////////////////////////////////////////////////////////////////////////
DWORD CBandiVideoSound_DS::GetFreeBufferSize()
{
if(m_dsb_secondary == NULL) return 0;
if(m_total_samples == 0)
return m_outbuf_size_max;
DWORD play_pos;
DWORD free_buffer_size = 0;
if(SUCCEEDED(m_dsb_secondary->GetCurrentPosition(&play_pos, NULL)))
{
if(m_last_write_pos > play_pos)
free_buffer_size = (m_outbuf_size_max - m_last_write_pos) + play_pos;
else
free_buffer_size = play_pos - m_last_write_pos;
}
else
{
free_buffer_size = m_outbuf_size_max;
}
return free_buffer_size;
}
@@ -0,0 +1,89 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
///
/// BandiVideoLibrary 2.1
///
/// Copyright(C) 2008-2011 BandiSoft.com All rights reserved.
///
/// Visit http://www.bandisoft.com for more information.
///
////////////////////////////////////////////////////////////////////////////////////////////////////
#pragma once
#define DIRECTSOUND_VERSION 0x0800
#include <dsound.h>
#include "bandivid.h"
class CBandiVideoSound_DS : public IBandiVideoSound
{
public:
static const UINT MAX_BUFFER_TIME = 200; // ms
static const UINT MIN_BUFFER_TIME = 20; // ms
static const UINT PLAY_SAMPLE_BLOCK = 1000;
static const UINT PLAY_SAMPLE_BLOCK_LEN = PLAY_SAMPLE_BLOCK*4;
CBandiVideoSound_DS();
virtual ~CBandiVideoSound_DS();
// IUnknown
STDMETHODIMP QueryInterface(REFIID riid, void **ppv) { return E_NOTIMPL; };
STDMETHODIMP_(ULONG) AddRef();
STDMETHODIMP_(ULONG) Release();
// IBandiVideoSound
HRESULT Open(INT channels, INT samplerate, IBandiVideoSoundCB *callback);
void Close();
HRESULT Start();
HRESULT Stop();
HRESULT Pause(BOOL pause);
HRESULT GetTime(INT64 &time);
HRESULT SetVolume(INT volume);
protected:
static unsigned WINAPI InitialThreadProc(LPVOID param)
{
CBandiVideoSound_DS *p = (CBandiVideoSound_DS*)param;
return p->ThreadProc();
};
UINT ThreadProc();
HRESULT PlayDS();
DWORD GetFreeBufferSize();
LONG m_ref_count;
HWND m_hwnd; // Window Handle
HINSTANCE m_hinst; // Instance Handle
LPDIRECTSOUND8 m_ds; // DirectSound Interface
LPDIRECTSOUNDBUFFER m_dsb_primary; // Primary buffer Interface
LPDIRECTSOUNDBUFFER m_dsb_secondary; // DirectSound secondary sound buffer
UINT m_channels; // Number of Channnel
UINT m_samplerate; // Sample rate;
INT m_outbuf_size_max;
INT m_outbuf_size_min;
UINT m_last_write_pos; // Last write offset (in BYTE)
INT m_inbuf_samples; // Number of samples in the buffer
INT m_total_samples; // Total number of written samples
LONGLONG m_cur_play_time; // 100nsec
CRITICAL_SECTION m_crit_sec;
BOOL m_crit_sec_inited;
HANDLE m_hevent;
HANDLE m_hthread;
UINT m_thread_id;
BOOL m_playing;
BYTE m_sample_block[PLAY_SAMPLE_BLOCK_LEN];
UINT m_sample_block_size;
IBandiVideoSoundCB* m_callback;
};
@@ -0,0 +1,294 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
///
/// BandiVideoLibrary 2.1
///
/// Copyright(C) 2008-2011 BandiSoft.com All rights reserved.
///
/// Visit http://www.bandisoft.com for more information.
///
////////////////////////////////////////////////////////////////////////////////////////////////////
#include <process.h>
#include "BandiVideoSound_NULL.h"
CBandiVideoSound_NULL::CBandiVideoSound_NULL() : m_ref_count(0)
{
m_init_count = 0;
m_start_time = 0;
memset(&m_crit_sec, NULL, sizeof(m_crit_sec));
m_crit_sec_inited = FALSE;
m_playing = FALSE;
m_hevent = NULL;
m_hthread = NULL;
m_thread_id = 0;
m_callback = NULL;
// Performance Frequency ±¸Çϱâ
LARGE_INTEGER freq = {0, 0};
QueryPerformanceFrequency(&freq);
m_freq_units = freq.QuadPart;
}
CBandiVideoSound_NULL::~CBandiVideoSound_NULL()
{
Close();
}
STDMETHODIMP_(ULONG) CBandiVideoSound_NULL::AddRef()
{
LONG lRef = InterlockedIncrement( &m_ref_count );
ASSERT(lRef >= 0);
return m_ref_count;
}
STDMETHODIMP_(ULONG) CBandiVideoSound_NULL::Release()
{
LONG lRef = InterlockedDecrement( &m_ref_count );
ASSERT(lRef >= 0);
if(lRef == 0)
{
delete this;
return ULONG(0);
}
return m_ref_count;
}
////////////////////////////////////////////////////////////////////////////////////////////////////
///
/// Open sound device.
///
////////////////////////////////////////////////////////////////////////////////////////////////////
HRESULT CBandiVideoSound_NULL::Open(INT channels, INT samplerate, IBandiVideoSoundCB *callback)
{
InitializeCriticalSection(&m_crit_sec);
m_crit_sec_inited = TRUE;
// Create an event object for periodical processing
m_hevent = CreateEvent(NULL, FALSE, FALSE, NULL); // auto reset event
if(m_hevent == NULL)
goto error;
// Create thread for playback
m_hthread = (HANDLE)_beginthreadex(NULL, 0, InitialThreadProc, this, CREATE_SUSPENDED, &m_thread_id);
if(m_hthread == NULL)
goto error;
m_callback = callback;
SetThreadPriority(m_hthread, THREAD_PRIORITY_TIME_CRITICAL);
ResumeThread(m_hthread);
return S_OK;
error:
Close();
return E_FAIL;
}
////////////////////////////////////////////////////////////////////////////////////////////////////
///
/// Close sound device.
///
////////////////////////////////////////////////////////////////////////////////////////////////////
void CBandiVideoSound_NULL::Close()
{
HANDLE hThread = (HANDLE)InterlockedExchangePointer(&m_hthread, 0);
if(hThread)
{
if(m_hevent) SetEvent(m_hevent);
WaitForSingleObject(hThread, INFINITE);
CloseHandle(hThread);
}
if(m_hevent)
{
CloseHandle(m_hevent);
m_hevent = NULL;
}
if(m_crit_sec_inited)
{
DeleteCriticalSection(&m_crit_sec);
m_crit_sec_inited = FALSE;
}
m_init_count = 0;
m_start_time = 0;
}
static LONGLONG GetPerformanceCounter()
{
LARGE_INTEGER count;
::QueryPerformanceCounter(&count);
return count.QuadPart;
}
////////////////////////////////////////////////////////////////////////////////////////////////////
///
/// Start
///
////////////////////////////////////////////////////////////////////////////////////////////////////
HRESULT CBandiVideoSound_NULL::Start()
{
EnterCriticalSection(&m_crit_sec);
{
m_init_count = GetPerformanceCounter();
m_start_time = 0;
m_playing = TRUE;
}
LeaveCriticalSection(&m_crit_sec);
return S_OK;
}
////////////////////////////////////////////////////////////////////////////////////////////////////
///
/// Stop
///
////////////////////////////////////////////////////////////////////////////////////////////////////
HRESULT CBandiVideoSound_NULL::Stop()
{
EnterCriticalSection(&m_crit_sec);
{
m_start_time = 0;
m_playing = FALSE;
}
LeaveCriticalSection(&m_crit_sec);
return S_OK;
}
////////////////////////////////////////////////////////////////////////////////////////////////////
///
/// Stop
///
////////////////////////////////////////////////////////////////////////////////////////////////////
HRESULT CBandiVideoSound_NULL::Pause(BOOL pause)
{
EnterCriticalSection(&m_crit_sec);
{
if(pause)
{
m_start_time = CalcTime();
m_playing = FALSE;
}
else
{
m_init_count = GetPerformanceCounter();
m_playing = TRUE;
}
}
LeaveCriticalSection(&m_crit_sec);
return S_OK;
}
////////////////////////////////////////////////////////////////////////////////////////////////////
///
/// Get play time (100nsec units)
///
////////////////////////////////////////////////////////////////////////////////////////////////////
HRESULT CBandiVideoSound_NULL::GetTime(INT64 &time)
{
EnterCriticalSection(&m_crit_sec);
{
time = CalcTime();
}
LeaveCriticalSection(&m_crit_sec);
return S_OK;
}
////////////////////////////////////////////////////////////////////////////////////////////////////
///
/// Set sound volume
///
////////////////////////////////////////////////////////////////////////////////////////////////////
HRESULT CBandiVideoSound_NULL::SetVolume(INT volume)
{
return E_NOTIMPL;
}
////////////////////////////////////////////////////////////////////////////////////////////////////
///
/// ThreadProc
///
////////////////////////////////////////////////////////////////////////////////////////////////////
UINT CBandiVideoSound_NULL::ThreadProc()
{
BOOL bWorking = FALSE;
while(m_hthread)
{
EnterCriticalSection(&m_crit_sec);
{
if(m_playing)
PlayNULL();
}
LeaveCriticalSection(&m_crit_sec);
WaitForSingleObject(m_hevent, 10);
}
return 0;
}
////////////////////////////////////////////////////////////////////////////////////////////////////
///
/// Play NullSound
///
////////////////////////////////////////////////////////////////////////////////////////////////////
HRESULT CBandiVideoSound_NULL::PlayNULL()
{
if(m_callback)
{
INT16 buf[1024*2];
m_callback->GetPcmData(buf, 1024);
}
return S_OK;
}
////////////////////////////////////////////////////////////////////////////////////////////////////
///
/// Calculate current time
///
////////////////////////////////////////////////////////////////////////////////////////////////////
LONGLONG CBandiVideoSound_NULL::CalcTime()
{
LONGLONG ret;
LONGLONG delta_time = 0;
EnterCriticalSection(&m_crit_sec);
{
if(m_playing && m_freq_units)
delta_time = LONGLONG(double(GetPerformanceCounter() - m_init_count)/(double)m_freq_units*10000000.0);
ret = m_start_time + delta_time;
}
LeaveCriticalSection(&m_crit_sec);
return ret;
}
Loaded 100 of 20588 files, more files were not shown because too many files have changed in this diff. Show more