Ember

textures

Jan 16th, 2014
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.         D3D11_TEXTURE2D_DESC textureDesc;
  2.         ZeroMemory(&textureDesc, sizeof(textureDesc));
  3.         textureDesc.Width = 512;
  4.         textureDesc.Height = 512;
  5.         textureDesc.MipLevels = 10;
  6.         textureDesc.ArraySize = 1;
  7.         textureDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
  8.         textureDesc.SampleDesc.Count = 1;
  9.         textureDesc.SampleDesc.Quality = 0;
  10.         textureDesc.Usage = D3D11_USAGE_IMMUTABLE;
  11.         textureDesc.BindFlags = D3D11_BIND_SHADER_RESOURCE;
  12.         textureDesc.CPUAccessFlags = 0;
  13.         textureDesc.MiscFlags = 0;
  14.  
  15.         Byte textureMip0[512][512];
  16.         // Load mip data
  17.         Byte textureMip1[256][256];
  18.         // Load mip data
  19.         Byte textureMip2[128][128];
  20.         // Load mip data
  21.         Byte textureMip3[64][64];
  22.         // Load mip data
  23.         Byte textureMip4[32][32];
  24.         // Load mip data
  25.         Byte textureMip5[16][16];
  26.         // Load mip data
  27.         Byte textureMip6[8][8];
  28.         // Load mip data
  29.         Byte textureMip7[4][4];
  30.         // Load mip data
  31.         Byte textureMip8[2][2];
  32.         // Load mip data
  33.         Byte textureMip9[1][1];
  34.         // Load mip data
  35.  
  36.         D3D11_SUBRESOURCE_DATA textureData[10];
  37.         ZeroMemory(&textureData, sizeof(textureData));
  38.         textureData[0].pSysMem = textureMip0;
  39.         textureData[0].SysMemPitch = 512;
  40.         textureData[0].SysMemSlicePitch = 0;
  41.         textureData[1].pSysMem = textureMip1;
  42.         textureData[1].SysMemPitch = 256;
  43.         textureData[1].SysMemSlicePitch = 0;
  44.         textureData[2].pSysMem = textureMip2;
  45.         textureData[2].SysMemPitch = 128;
  46.         textureData[2].SysMemSlicePitch = 0;
  47.         textureData[3].pSysMem = textureMip3;
  48.         textureData[3].SysMemPitch = 64;
  49.         textureData[3].SysMemSlicePitch = 0;
  50.         textureData[4].pSysMem = textureMip4;
  51.         textureData[4].SysMemPitch = 32;
  52.         textureData[4].SysMemSlicePitch = 0;
  53.         textureData[5].pSysMem = textureMip5;
  54.         textureData[5].SysMemPitch = 16;
  55.         textureData[5].SysMemSlicePitch = 0;
  56.         textureData[6].pSysMem = textureMip6;
  57.         textureData[6].SysMemPitch = 8;
  58.         textureData[6].SysMemSlicePitch = 0;
  59.         textureData[7].pSysMem = textureMip7;
  60.         textureData[7].SysMemPitch = 4;
  61.         textureData[7].SysMemSlicePitch = 0;
  62.         textureData[8].pSysMem = textureMip8;
  63.         textureData[8].SysMemPitch = 2;
  64.         textureData[8].SysMemSlicePitch = 0;
  65.         textureData[9].pSysMem = textureMip9;
  66.         textureData[9].SysMemPitch = 1;
  67.         textureData[9].SysMemSlicePitch = 0;
  68.  
  69.         ID3D11Texture2D* mTexture;
  70.         result = mDevice->CreateTexture2D(&textureDesc, textureData, &mTexture);
Advertisement
Add Comment
Please, Sign In to add comment