• 大小: 23.15MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-06-19
  • 语言: 其他
  • 标签: SkeAnimation  

资源简介

D3D11_SkeletonAnimation.rar

资源截图

代码片段和文件信息

#include“BitmapClass.h“

BitmapClass::BitmapClass()
{
    md3dVertexBuffer=NULL; //顶点缓存
    md3dIndexBuffer=NULL;  //索引缓存
mVertexCount = 0;
mIndexCount = 0;

}


BitmapClass::BitmapClass(const BitmapClass& other)
{

}

BitmapClass::~BitmapClass()
{

}

bool BitmapClass::Initialize(ID3D11Device* d3dDevice int ScrrenWidth int ScrrenHeight WCHAR* TextureFileName int bitmapWidth int bitmapHeight)
{
bool result;
//第一初始化屏幕长宽,纹理长宽,坐标点
mScrrenWidth = ScrrenWidth;
mScrrenHeight = ScrrenHeight;

mBitmapWith = bitmapWidth;
mBitmapHeight = bitmapHeight;

mPreviousPosX = -1;
mPreviousPosY = -1;

//第二初始化顶点缓存,索引缓存
result = InitializeBuffer(d3dDevice);
if (!result)
{
MessageBox(NULL L“Initialize Buffer failure“ L“ERROR“ MB_OK);
return false;
}

//第三加载纹理
result = LoadTexture(d3dDevice TextureFileName);
if (!result)
{
MessageBox(NULL L“ LoadTexture failure“ L“ERROR“ MB_OK);
return false;
}


return true;
}

void BitmapClass::Shutdown()
{
ReleaseTexture();
ShutdownBuffer();
}


bool BitmapClass::Render(ID3D11DeviceContext* d3dDeviceContextint positionX int positionY)
{
bool result;

result = UpdateBuffers(d3dDeviceContextpositionXpositionY);
if (!result)
{
return false;
}
//设置渲染管线的顶点缓存和索引缓存(IA阶段)
RenderBuffers(d3dDeviceContext);
return true;
}

bool BitmapClass::InitializeBuffer(ID3D11Device* d3dDevice)
{
Vertex* vertexs=NULL;
WORD*indices=NULL;  //一个字为两个字节 

mVertexCount = 6;
mIndexCount = 6;

//创建顶点数组
vertexs = new Vertex[mVertexCount];
if (!vertexs)
return false;

//创建索引数组
indices = new WORD[mIndexCount];
if (!indices)
return false;

//初始化顶点数组为0
memset(vertexs 0 sizeof(Vertex)*mVertexCount);


//赋予索引数组数据
//注意用左手定则判定是不是背面
indices[0] = 0;
indices[1] = 1;
indices[2] = 2;
indices[3] = 3;
indices[4] = 4;
indices[5] = 5;


//第一填充(顶点)缓存形容结构体和子资源数据结构体并创建顶点缓存(这里用的是动态缓存)
D3D11_BUFFER_DESC vertexBufferDesc;
vertexBufferDesc.Usage = D3D11_USAGE_DYNAMIC;
vertexBufferDesc.ByteWidth = sizeof(Vertex) * mVertexCount;
vertexBufferDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER;
vertexBufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
vertexBufferDesc.MiscFlags = 0;
vertexBufferDesc.StructureByteStride = 0;

D3D11_SUBRESOURCE_DATA vertexData;
vertexData.pSysMem = vertexs;
vertexData.SysMemPitch = 0;
vertexData.SysMemSlicePitch = 0;
HR(d3dDevice->CreateBuffer(&vertexBufferDesc &vertexData &md3dVertexBuffer));

//第二填充(索引)缓存形容结构体和子资源数据结构体并创建索引缓存
D3D11_BUFFER_DESC  indexBufferDesc;
indexBufferDesc.Usage = D3D11_USAGE_DEFAULT;
indexBufferDesc.ByteWidth = sizeof(WORD) * mIndexCount;
indexBufferDesc.BindFlags = D3D11_BIND_INDEX_BUFFER;
indexBufferDesc.CPUAccessFlags = 0;
indexBufferDesc.MiscFlags = 0;
indexBufferDesc.StructureByteStride = 0;

D3D11_SUBRESOURCE_DATA indexData;
indexData.pSysMem = indices;
indexData.SysMemPitch = 0;
indexData.Sy

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件    4194432  2010-05-13 17:48  D3D11_SkeletonAnimation\AnimationFile\head_diff.dds

     文件    4194432  2010-05-13 17:48  D3D11_SkeletonAnimation\AnimationFile\head_norm.dds

     文件    4194432  2010-05-13 17:48  D3D11_SkeletonAnimation\AnimationFile\jacket_diff.dds

     文件    4194432  2010-05-13 17:48  D3D11_SkeletonAnimation\AnimationFile\jacket_norm.dds

     文件    4194432  2010-05-13 17:48  D3D11_SkeletonAnimation\AnimationFile\pants_diff.dds

     文件    4194432  2010-05-13 17:48  D3D11_SkeletonAnimation\AnimationFile\pants_norm.dds

     文件    4039704  2011-09-19 18:04  D3D11_SkeletonAnimation\AnimationFile\soldier.m3d

     文件    4194432  2010-05-13 17:48  D3D11_SkeletonAnimation\AnimationFile\upBody_diff.dds

     文件    4194432  2010-05-13 17:48  D3D11_SkeletonAnimation\AnimationFile\upbody_norm.dds

     文件       6620  2017-01-15 01:43  D3D11_SkeletonAnimation\BitmapClass.cpp

     文件       1602  2017-01-15 01:43  D3D11_SkeletonAnimation\BitmapClass.h

     文件       8655  2016-12-24 09:55  D3D11_SkeletonAnimation\ColorShaderClass.cpp

     文件       1953  2016-12-24 09:54  D3D11_SkeletonAnimation\ColorShaderClass.h

     文件        717  2017-05-28 18:45  D3D11_SkeletonAnimation\CommonVertexFormat.h

     文件       1269  2016-10-07 19:15  D3D11_SkeletonAnimation\CPUClass.cpp

     文件        518  2016-10-07 19:46  D3D11_SkeletonAnimation\CPUClass.h

     文件       1946  2017-02-23 22:28  D3D11_SkeletonAnimation\CubeMapCameraClass.cpp

     文件        646  2017-02-23 22:28  D3D11_SkeletonAnimation\CubeMapCameraClass.h

     文件       6725  2017-02-23 22:29  D3D11_SkeletonAnimation\CubeMapRenderModelToTexure.cpp

     文件       1576  2017-02-23 21:00  D3D11_SkeletonAnimation\CubeMapRenderModelToTexure.h

     文件      16081  2017-02-23 00:53  D3D11_SkeletonAnimation\D3DClass.cpp

     文件       2856  2017-02-23 00:53  D3D11_SkeletonAnimation\D3DClass.h

     文件       5678  2016-12-20 23:59  D3D11_SkeletonAnimation\FirstCameraClass.cpp

     文件       1620  2016-12-21 19:44  D3D11_SkeletonAnimation\FirstCameraClass.h

     文件       1127  2016-12-24 09:58  D3D11_SkeletonAnimation\FontClass.h

     文件       3682  2016-12-24 09:58  D3D11_SkeletonAnimation\FontlClass.cpp

     文件       8697  2016-12-24 09:55  D3D11_SkeletonAnimation\FontShaderClass.cpp

     文件       1534  2016-12-24 09:54  D3D11_SkeletonAnimation\FontShaderClass.h

     文件        460  2016-10-07 17:08  D3D11_SkeletonAnimation\FPSClass.cpp

     文件        390  2016-10-07 16:59  D3D11_SkeletonAnimation\FPSClass.h

............此处省略80个文件信息

评论

共有 条评论

相关资源