Skip to content

Instantly share code, notes, and snippets.

@d7samurai
Last active September 30, 2025 02:07
Show Gist options
  • Save d7samurai/d74299f8bcadcb9cb06867c7412f2461 to your computer and use it in GitHub Desktop.
Save d7samurai/d74299f8bcadcb9cb06867c7412f2461 to your computer and use it in GitHub Desktop.
Minimal D3D11 bonus material: MSAA

Minimal D3D11 bonus material: MSAA

image

This is essentially just the original Minimal D3D11 codebase with 8x MSAA added. However, since MSAA only smooths triangle edges and does not affect textured surface interiors, texturing is removed to isolate the effect of MSAA and make it clearer.

In short there are two parts to it: 1) Create and render to an MSAA texture rather than your typical rendertarget/framebuffer (note: the depth buffer must match), and 2) Resolve that texture into the framebuffer before Present.

As usual: complete, runnable single-function app. ~180 LOC. No modern C++, OOP or (other) obscuring cruft.

#pragma comment(lib, "user32")
#pragma comment(lib, "d3d11")
#pragma comment(lib, "d3dcompiler")
///////////////////////////////////////////////////////////////////////////////////////////////////
#include <windows.h>
#include <d3d11.h>
#include <d3dcompiler.h>
#include <math.h> // sin, cos
#include "xube.h" // 3d model
///////////////////////////////////////////////////////////////////////////////////////////////////
struct float3 { float x, y, z; };
struct matrix { float m[4][4]; };
matrix operator*(const matrix& m1, const matrix& m2);
///////////////////////////////////////////////////////////////////////////////////////////////////
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
{
WNDCLASSA wndclass = { 0, DefWindowProcA, 0, 0, 0, 0, 0, 0, 0, "d7" };
RegisterClassA(&wndclass);
HWND window = CreateWindowExA(0, "d7", 0, 0x91000000, 0, 0, 0, 0, 0, 0, 0, 0);
///////////////////////////////////////////////////////////////////////////////////////////////
D3D_FEATURE_LEVEL featurelevels[] = { D3D_FEATURE_LEVEL_11_0 };
DXGI_SWAP_CHAIN_DESC swapchaindesc = {};
swapchaindesc.BufferDesc.Width = 0; // use window width
swapchaindesc.BufferDesc.Height = 0; // use window height
swapchaindesc.BufferDesc.Format = DXGI_FORMAT_B8G8R8A8_UNORM; // can't specify SRGB framebuffer directly when using FLIP model swap effect. see lines 45, 62
swapchaindesc.SampleDesc.Count = 1;
swapchaindesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
swapchaindesc.BufferCount = 2;
swapchaindesc.OutputWindow = window;
swapchaindesc.Windowed = TRUE;
swapchaindesc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_DISCARD;
IDXGISwapChain* swapchain;
ID3D11Device* device;
ID3D11DeviceContext* devicecontext;
D3D11CreateDeviceAndSwapChain(nullptr, D3D_DRIVER_TYPE_HARDWARE, nullptr, D3D11_CREATE_DEVICE_BGRA_SUPPORT, featurelevels, ARRAYSIZE(featurelevels), D3D11_SDK_VERSION, &swapchaindesc, &swapchain, &device, nullptr, &devicecontext); // D3D11_CREATE_DEVICE_DEBUG is optional, but provides useful d3d11 debug output
swapchain->GetDesc(&swapchaindesc); // update swapchaindesc with actual window size
///////////////////////////////////////////////////////////////////////////////////////////////
ID3D11Texture2D* framebuffer;
swapchain->GetBuffer(0, __uuidof(ID3D11Texture2D), (void**)&framebuffer); // get pointer to framebuffer from swapchain ..
D3D11_RENDER_TARGET_VIEW_DESC framebufferRTVdesc = {}; // (needed for SRGB framebuffer when using FLIP model swap effect)
framebufferRTVdesc.Format = DXGI_FORMAT_B8G8R8A8_UNORM_SRGB;
framebufferRTVdesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2D;
ID3D11RenderTargetView* framebufferRTV;
device->CreateRenderTargetView(framebuffer, &framebufferRTVdesc, &framebufferRTV); // ..and put a render target view on it
///////////////////////////////////////////////////////////////////////////////////////////////
D3D11_TEXTURE2D_DESC msaabufferdesc;
framebuffer->GetDesc(&msaabufferdesc); // copy framebuffer properties; they're mostly the same
msaabufferdesc.Format = DXGI_FORMAT_B8G8R8A8_UNORM_SRGB; // need to set this because the framebuffer texture itself isn't SRGB (it gets its _SRGB from the RTV)
msaabufferdesc.SampleDesc.Count = 8; // 8x MSAA
ID3D11Texture2D* msaabuffer;
device->CreateTexture2D(&msaabufferdesc, nullptr, &msaabuffer);
ID3D11RenderTargetView* msaabufferRTV;
device->CreateRenderTargetView(msaabuffer, nullptr, &msaabufferRTV);
///////////////////////////////////////////////////////////////////////////////////////////////
D3D11_TEXTURE2D_DESC depthbufferdesc;
msaabuffer->GetDesc(&depthbufferdesc); // copy msaabuffer properties; the depth buffer needs to have matching settings (esp. sample desc)
depthbufferdesc.Format = DXGI_FORMAT_D24_UNORM_S8_UINT;
depthbufferdesc.BindFlags = D3D11_BIND_DEPTH_STENCIL;
ID3D11Texture2D* depthbuffer;
device->CreateTexture2D(&depthbufferdesc, nullptr, &depthbuffer);
ID3D11DepthStencilView* depthbufferDSV;
device->CreateDepthStencilView(depthbuffer, nullptr, &depthbufferDSV);
///////////////////////////////////////////////////////////////////////////////////////////////
ID3DBlob* vertexshaderCSO;
D3DCompileFromFile(L"gpu.hlsl", nullptr, nullptr, "VsMain", "vs_5_0", 0, 0, &vertexshaderCSO, nullptr); // remember to keep gpu.hlsl in working directory (or fully qualify path)
ID3D11VertexShader* vertexshader;
device->CreateVertexShader(vertexshaderCSO->GetBufferPointer(), vertexshaderCSO->GetBufferSize(), nullptr, &vertexshader);
D3D11_INPUT_ELEMENT_DESC inputelementdesc[] = // maps to vertexdesc struct in gpu.hlsl via semantic names ("POS", "NOR", "COL")
{
{ "POS", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 }, // float3 position
{ "NOR", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 }, // float3 normal
{ "COL", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 }, // float3 color
};
ID3D11InputLayout* inputlayout;
device->CreateInputLayout(inputelementdesc, ARRAYSIZE(inputelementdesc), vertexshaderCSO->GetBufferPointer(), vertexshaderCSO->GetBufferSize(), &inputlayout);
///////////////////////////////////////////////////////////////////////////////////////////////
ID3DBlob* pixelshaderCSO;
D3DCompileFromFile(L"gpu.hlsl", nullptr, nullptr, "PsMain", "ps_5_0", 0, 0, &pixelshaderCSO, nullptr); // remember to keep gpu.hlsl in working directory (or fully qualify path)
ID3D11PixelShader* pixelshader;
device->CreatePixelShader(pixelshaderCSO->GetBufferPointer(), pixelshaderCSO->GetBufferSize(), nullptr, &pixelshader);
///////////////////////////////////////////////////////////////////////////////////////////////
D3D11_RASTERIZER_DESC rasterizerdesc = {};
rasterizerdesc.FillMode = D3D11_FILL_SOLID;
rasterizerdesc.CullMode = D3D11_CULL_BACK;
ID3D11RasterizerState* rasterizerstate;
device->CreateRasterizerState(&rasterizerdesc, &rasterizerstate);
///////////////////////////////////////////////////////////////////////////////////////////////
D3D11_DEPTH_STENCIL_DESC depthstencildesc = {};
depthstencildesc.DepthEnable = TRUE;
depthstencildesc.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ALL;
depthstencildesc.DepthFunc = D3D11_COMPARISON_LESS;
ID3D11DepthStencilState* depthstencilstate;
device->CreateDepthStencilState(&depthstencildesc, &depthstencilstate);
///////////////////////////////////////////////////////////////////////////////////////////////
struct Constants { matrix transform, projection; float3 lightvector; };
D3D11_BUFFER_DESC constantbufferdesc = {};
constantbufferdesc.ByteWidth = sizeof(Constants) + 0xf & 0xfffffff0; // ensure constant buffer size is multiple of 16 bytes
constantbufferdesc.Usage = D3D11_USAGE_DYNAMIC; // because updated from CPU every frame
constantbufferdesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
constantbufferdesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
ID3D11Buffer* constantbuffer;
device->CreateBuffer(&constantbufferdesc, nullptr, &constantbuffer);
///////////////////////////////////////////////////////////////////////////////////////////////
D3D11_BUFFER_DESC vertexbufferdesc = {};
vertexbufferdesc.ByteWidth = sizeof(vertexdata);
vertexbufferdesc.Usage = D3D11_USAGE_IMMUTABLE; // because will never be updated
vertexbufferdesc.BindFlags = D3D11_BIND_VERTEX_BUFFER;
D3D11_SUBRESOURCE_DATA vertexbufferSRD = { vertexdata }; // in xube.h
ID3D11Buffer* vertexbuffer;
device->CreateBuffer(&vertexbufferdesc, &vertexbufferSRD, &vertexbuffer);
///////////////////////////////////////////////////////////////////////////////////////////////
D3D11_BUFFER_DESC indexbufferdesc = {};
indexbufferdesc.ByteWidth = sizeof(indexdata);
indexbufferdesc.Usage = D3D11_USAGE_IMMUTABLE; // because will never be updated
indexbufferdesc.BindFlags = D3D11_BIND_INDEX_BUFFER;
D3D11_SUBRESOURCE_DATA indexbufferSRD = { indexdata }; // in xube.h
ID3D11Buffer* indexbuffer;
device->CreateBuffer(&indexbufferdesc, &indexbufferSRD, &indexbuffer);
///////////////////////////////////////////////////////////////////////////////////////////////
FLOAT clearcolor[4] = { 0.025f, 0.025f, 0.025f, 1.0f };
UINT stride = 9 * sizeof(float); // vertex size (9 floats: float3 position, float3 normal, float3 color)
UINT offset = 0;
D3D11_VIEWPORT viewport = { 0.0f, 0.0f, (float)swapchaindesc.BufferDesc.Width, (float)swapchaindesc.BufferDesc.Height, 0.0f, 1.0f };
///////////////////////////////////////////////////////////////////////////////////////////////
float w = viewport.Width / viewport.Height; // width (aspect ratio, since height is 1.0)
float h = 1.0f; // height
float n = 1.0f; // near
float f = 9.0f; // far
float3 modelrotation = { 0.0f, 0.0f, 0.0f };
float3 modelscale = { 1.0f, 1.0f, 1.0f };
float3 modeltranslation = { 0.0f, 0.0f, 4.0f };
///////////////////////////////////////////////////////////////////////////////////////////////
while (true)
{
MSG msg;
while (PeekMessageA(&msg, nullptr, 0, 0, PM_REMOVE))
{
if (msg.message == WM_KEYDOWN) return 0; // PRESS ANY KEY TO EXIT
DispatchMessageA(&msg);
}
///////////////////////////////////////////////////////////////////////////////////////////
matrix rotatex = { 1, 0, 0, 0, 0, (float)cos(modelrotation.x), -(float)sin(modelrotation.x), 0, 0, (float)sin(modelrotation.x), (float)cos(modelrotation.x), 0, 0, 0, 0, 1 };
matrix rotatey = { (float)cos(modelrotation.y), 0, (float)sin(modelrotation.y), 0, 0, 1, 0, 0, -(float)sin(modelrotation.y), 0, (float)cos(modelrotation.y), 0, 0, 0, 0, 1 };
matrix rotatez = { (float)cos(modelrotation.z), -(float)sin(modelrotation.z), 0, 0, (float)sin(modelrotation.z), (float)cos(modelrotation.z), 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 };
matrix scale = { modelscale.x, 0, 0, 0, 0, modelscale.y, 0, 0, 0, 0, modelscale.z, 0, 0, 0, 0, 1 };
matrix translate = { 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, modeltranslation.x, modeltranslation.y, modeltranslation.z, 1 };
modelrotation.x += 0.0005f;
modelrotation.y += 0.0009f;
modelrotation.z += 0.0001f;
///////////////////////////////////////////////////////////////////////////////////////////
D3D11_MAPPED_SUBRESOURCE constantbufferMSR;
devicecontext->Map(constantbuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &constantbufferMSR); // update constant buffer every frame
{
Constants* constants = (Constants*)constantbufferMSR.pData;
constants->transform = rotatex * rotatey * rotatez * scale * translate;
constants->projection = { 2 * n / w, 0, 0, 0, 0, 2 * n / h, 0, 0, 0, 0, f / (f - n), 1, 0, 0, n * f / (n - f), 0 };
constants->lightvector = { 1.0f, -1.0f, 1.0f };
}
devicecontext->Unmap(constantbuffer, 0);
///////////////////////////////////////////////////////////////////////////////////////////
devicecontext->ClearRenderTargetView(msaabufferRTV, clearcolor); // clear MSAA texture
devicecontext->ClearDepthStencilView(depthbufferDSV, D3D11_CLEAR_DEPTH, 1.0f, 0);
devicecontext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
devicecontext->IASetInputLayout(inputlayout);
devicecontext->IASetVertexBuffers(0, 1, &vertexbuffer, &stride, &offset);
devicecontext->IASetIndexBuffer(indexbuffer, DXGI_FORMAT_R32_UINT, 0);
devicecontext->VSSetShader(vertexshader, nullptr, 0);
devicecontext->VSSetConstantBuffers(0, 1, &constantbuffer);
devicecontext->RSSetViewports(1, &viewport);
devicecontext->RSSetState(rasterizerstate);
devicecontext->PSSetShader(pixelshader, nullptr, 0);
devicecontext->OMSetRenderTargets(1, &msaabufferRTV, depthbufferDSV); // render to MSAA texture
devicecontext->OMSetDepthStencilState(depthstencilstate, 0);
devicecontext->OMSetBlendState(nullptr, nullptr, 0xffffffff); // use default blend mode (i.e. no blending)
///////////////////////////////////////////////////////////////////////////////////////////
devicecontext->DrawIndexed(ARRAYSIZE(indexdata), 0, 0);
///////////////////////////////////////////////////////////////////////////////////////////
devicecontext->ResolveSubresource(framebuffer, 0, msaabuffer, 0, DXGI_FORMAT_B8G8R8A8_UNORM_SRGB); // resolve the MSAA texture into framebuffer
///////////////////////////////////////////////////////////////////////////////////////////
swapchain->Present(1, 0);
}
}
///////////////////////////////////////////////////////////////////////////////////////////////////
matrix operator*(const matrix& m1, const matrix& m2)
{
return
{
m1.m[0][0] * m2.m[0][0] + m1.m[0][1] * m2.m[1][0] + m1.m[0][2] * m2.m[2][0] + m1.m[0][3] * m2.m[3][0],
m1.m[0][0] * m2.m[0][1] + m1.m[0][1] * m2.m[1][1] + m1.m[0][2] * m2.m[2][1] + m1.m[0][3] * m2.m[3][1],
m1.m[0][0] * m2.m[0][2] + m1.m[0][1] * m2.m[1][2] + m1.m[0][2] * m2.m[2][2] + m1.m[0][3] * m2.m[3][2],
m1.m[0][0] * m2.m[0][3] + m1.m[0][1] * m2.m[1][3] + m1.m[0][2] * m2.m[2][3] + m1.m[0][3] * m2.m[3][3],
m1.m[1][0] * m2.m[0][0] + m1.m[1][1] * m2.m[1][0] + m1.m[1][2] * m2.m[2][0] + m1.m[1][3] * m2.m[3][0],
m1.m[1][0] * m2.m[0][1] + m1.m[1][1] * m2.m[1][1] + m1.m[1][2] * m2.m[2][1] + m1.m[1][3] * m2.m[3][1],
m1.m[1][0] * m2.m[0][2] + m1.m[1][1] * m2.m[1][2] + m1.m[1][2] * m2.m[2][2] + m1.m[1][3] * m2.m[3][2],
m1.m[1][0] * m2.m[0][3] + m1.m[1][1] * m2.m[1][3] + m1.m[1][2] * m2.m[2][3] + m1.m[1][3] * m2.m[3][3],
m1.m[2][0] * m2.m[0][0] + m1.m[2][1] * m2.m[1][0] + m1.m[2][2] * m2.m[2][0] + m1.m[2][3] * m2.m[3][0],
m1.m[2][0] * m2.m[0][1] + m1.m[2][1] * m2.m[1][1] + m1.m[2][2] * m2.m[2][1] + m1.m[2][3] * m2.m[3][1],
m1.m[2][0] * m2.m[0][2] + m1.m[2][1] * m2.m[1][2] + m1.m[2][2] * m2.m[2][2] + m1.m[2][3] * m2.m[3][2],
m1.m[2][0] * m2.m[0][3] + m1.m[2][1] * m2.m[1][3] + m1.m[2][2] * m2.m[2][3] + m1.m[2][3] * m2.m[3][3],
m1.m[3][0] * m2.m[0][0] + m1.m[3][1] * m2.m[1][0] + m1.m[3][2] * m2.m[2][0] + m1.m[3][3] * m2.m[3][0],
m1.m[3][0] * m2.m[0][1] + m1.m[3][1] * m2.m[1][1] + m1.m[3][2] * m2.m[2][1] + m1.m[3][3] * m2.m[3][1],
m1.m[3][0] * m2.m[0][2] + m1.m[3][1] * m2.m[1][2] + m1.m[3][2] * m2.m[2][2] + m1.m[3][3] * m2.m[3][2],
m1.m[3][0] * m2.m[0][3] + m1.m[3][1] * m2.m[1][3] + m1.m[3][2] * m2.m[2][3] + m1.m[3][3] * m2.m[3][3],
};
}
cbuffer constants : register(b0)
{
row_major float4x4 transform;
row_major float4x4 projection;
float3 lightvector;
}
struct vertexdesc
{
float3 position : POS;
float3 normal : NOR;
float3 color : COL;
};
struct pixeldesc
{
float4 position : SV_POSITION;
float4 color : COL;
};
pixeldesc VsMain(vertexdesc vertex)
{
float light = clamp(dot(mul(vertex.normal, transform), normalize(-lightvector)), 0.0f, 1.0f) * 0.8f + 0.2f;
pixeldesc output;
output.position = mul(float4(vertex.position, 1.0f), mul(transform, projection));
output.color = float4(vertex.color * light, 1.0f);
return output;
}
float4 PsMain(pixeldesc pixel) : SV_TARGET
{
return pixel.color;
}
float vertexdata[] = // pos.x, pos.y, pos.z, nor.x, nor.y, nor.z, col.r, col.g, col.b,
{
-1.0f, 1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.973f, 0.480f, 0.002f,
-0.6f, 1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.973f, 0.480f, 0.002f,
0.6f, 1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.973f, 0.480f, 0.002f,
1.0f, 1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.973f, 0.480f, 0.002f,
-0.6f, 0.6f, -1.0f, 0.0f, 0.0f, -1.0f, 0.973f, 0.480f, 0.002f,
0.6f, 0.6f, -1.0f, 0.0f, 0.0f, -1.0f, 0.973f, 0.480f, 0.002f,
-0.6f, -0.6f, -1.0f, 0.0f, 0.0f, -1.0f, 0.973f, 0.480f, 0.002f,
0.6f, -0.6f, -1.0f, 0.0f, 0.0f, -1.0f, 0.973f, 0.480f, 0.002f,
-1.0f, -1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.973f, 0.480f, 0.002f,
-0.6f, -1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.973f, 0.480f, 0.002f,
0.6f, -1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.973f, 0.480f, 0.002f,
1.0f, -1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.973f, 0.480f, 0.002f,
1.0f, 1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 0.897f, 0.163f, 0.011f,
1.0f, 1.0f, -0.6f, 1.0f, 0.0f, 0.0f, 0.897f, 0.163f, 0.011f,
1.0f, 1.0f, 0.6f, 1.0f, 0.0f, 0.0f, 0.897f, 0.163f, 0.011f,
1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 0.897f, 0.163f, 0.011f,
1.0f, 0.6f, -0.6f, 1.0f, 0.0f, 0.0f, 0.897f, 0.163f, 0.011f,
1.0f, 0.6f, 0.6f, 1.0f, 0.0f, 0.0f, 0.897f, 0.163f, 0.011f,
1.0f, -0.6f, -0.6f, 1.0f, 0.0f, 0.0f, 0.897f, 0.163f, 0.011f,
1.0f, -0.6f, 0.6f, 1.0f, 0.0f, 0.0f, 0.897f, 0.163f, 0.011f,
1.0f, -1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 0.897f, 0.163f, 0.011f,
1.0f, -1.0f, -0.6f, 1.0f, 0.0f, 0.0f, 0.897f, 0.163f, 0.011f,
1.0f, -1.0f, 0.6f, 1.0f, 0.0f, 0.0f, 0.897f, 0.163f, 0.011f,
1.0f, -1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 0.897f, 0.163f, 0.011f,
1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.612f, 0.000f, 0.069f,
0.6f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.612f, 0.000f, 0.069f,
-0.6f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.612f, 0.000f, 0.069f,
-1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.612f, 0.000f, 0.069f,
0.6f, 0.6f, 1.0f, 0.0f, 0.0f, 1.0f, 0.612f, 0.000f, 0.069f,
-0.6f, 0.6f, 1.0f, 0.0f, 0.0f, 1.0f, 0.612f, 0.000f, 0.069f,
0.6f, -0.6f, 1.0f, 0.0f, 0.0f, 1.0f, 0.612f, 0.000f, 0.069f,
-0.6f, -0.6f, 1.0f, 0.0f, 0.0f, 1.0f, 0.612f, 0.000f, 0.069f,
1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.612f, 0.000f, 0.069f,
0.6f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.612f, 0.000f, 0.069f,
-0.6f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.612f, 0.000f, 0.069f,
-1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.612f, 0.000f, 0.069f,
-1.0f, 1.0f, 1.0f, -1.0f, 0.0f, 0.0f, 0.127f, 0.116f, 0.408f,
-1.0f, 1.0f, 0.6f, -1.0f, 0.0f, 0.0f, 0.127f, 0.116f, 0.408f,
-1.0f, 1.0f, -0.6f, -1.0f, 0.0f, 0.0f, 0.127f, 0.116f, 0.408f,
-1.0f, 1.0f, -1.0f, -1.0f, 0.0f, 0.0f, 0.127f, 0.116f, 0.408f,
-1.0f, 0.6f, 0.6f, -1.0f, 0.0f, 0.0f, 0.127f, 0.116f, 0.408f,
-1.0f, 0.6f, -0.6f, -1.0f, 0.0f, 0.0f, 0.127f, 0.116f, 0.408f,
-1.0f, -0.6f, 0.6f, -1.0f, 0.0f, 0.0f, 0.127f, 0.116f, 0.408f,
-1.0f, -0.6f, -0.6f, -1.0f, 0.0f, 0.0f, 0.127f, 0.116f, 0.408f,
-1.0f, -1.0f, 1.0f, -1.0f, 0.0f, 0.0f, 0.127f, 0.116f, 0.408f,
-1.0f, -1.0f, 0.6f, -1.0f, 0.0f, 0.0f, 0.127f, 0.116f, 0.408f,
-1.0f, -1.0f, -0.6f, -1.0f, 0.0f, 0.0f, 0.127f, 0.116f, 0.408f,
-1.0f, -1.0f, -1.0f, -1.0f, 0.0f, 0.0f, 0.127f, 0.116f, 0.408f,
-1.0f, 1.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.000f, 0.254f, 0.637f,
-0.6f, 1.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.000f, 0.254f, 0.637f,
0.6f, 1.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.000f, 0.254f, 0.637f,
1.0f, 1.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.000f, 0.254f, 0.637f,
-0.6f, 1.0f, 0.6f, 0.0f, 1.0f, 0.0f, 0.000f, 0.254f, 0.637f,
0.6f, 1.0f, 0.6f, 0.0f, 1.0f, 0.0f, 0.000f, 0.254f, 0.637f,
-0.6f, 1.0f, -0.6f, 0.0f, 1.0f, 0.0f, 0.000f, 0.254f, 0.637f,
0.6f, 1.0f, -0.6f, 0.0f, 1.0f, 0.0f, 0.000f, 0.254f, 0.637f,
-1.0f, 1.0f, -1.0f, 0.0f, 1.0f, 0.0f, 0.000f, 0.254f, 0.637f,
-0.6f, 1.0f, -1.0f, 0.0f, 1.0f, 0.0f, 0.000f, 0.254f, 0.637f,
0.6f, 1.0f, -1.0f, 0.0f, 1.0f, 0.0f, 0.000f, 0.254f, 0.637f,
1.0f, 1.0f, -1.0f, 0.0f, 1.0f, 0.0f, 0.000f, 0.254f, 0.637f,
-1.0f, -1.0f, -1.0f, 0.0f, -1.0f, 0.0f, 0.001f, 0.447f, 0.067f,
-0.6f, -1.0f, -1.0f, 0.0f, -1.0f, 0.0f, 0.001f, 0.447f, 0.067f,
0.6f, -1.0f, -1.0f, 0.0f, -1.0f, 0.0f, 0.001f, 0.447f, 0.067f,
1.0f, -1.0f, -1.0f, 0.0f, -1.0f, 0.0f, 0.001f, 0.447f, 0.067f,
-0.6f, -1.0f, -0.6f, 0.0f, -1.0f, 0.0f, 0.001f, 0.447f, 0.067f,
0.6f, -1.0f, -0.6f, 0.0f, -1.0f, 0.0f, 0.001f, 0.447f, 0.067f,
-0.6f, -1.0f, 0.6f, 0.0f, -1.0f, 0.0f, 0.001f, 0.447f, 0.067f,
0.6f, -1.0f, 0.6f, 0.0f, -1.0f, 0.0f, 0.001f, 0.447f, 0.067f,
-1.0f, -1.0f, 1.0f, 0.0f, -1.0f, 0.0f, 0.001f, 0.447f, 0.067f,
-0.6f, -1.0f, 1.0f, 0.0f, -1.0f, 0.0f, 0.001f, 0.447f, 0.067f,
0.6f, -1.0f, 1.0f, 0.0f, -1.0f, 0.0f, 0.001f, 0.447f, 0.067f,
1.0f, -1.0f, 1.0f, 0.0f, -1.0f, 0.0f, 0.001f, 0.447f, 0.067f,
-0.6f, 0.6f, -1.0f, 1.0f, 0.0f, 0.0f, 0.973f, 0.480f, 0.002f,
-0.6f, 0.6f, -0.6f, 1.0f, 0.0f, 0.0f, 0.973f, 0.480f, 0.002f,
-0.6f, -0.6f, -0.6f, 1.0f, 0.0f, 0.0f, 0.973f, 0.480f, 0.002f,
-0.6f, -0.6f, -1.0f, 1.0f, 0.0f, 0.0f, 0.973f, 0.480f, 0.002f,
0.6f, 0.6f, -0.6f, -1.0f, 0.0f, 0.0f, 0.973f, 0.480f, 0.002f,
0.6f, 0.6f, -1.0f, -1.0f, 0.0f, 0.0f, 0.973f, 0.480f, 0.002f,
0.6f, -0.6f, -1.0f, -1.0f, 0.0f, 0.0f, 0.973f, 0.480f, 0.002f,
0.6f, -0.6f, -0.6f, -1.0f, 0.0f, 0.0f, 0.973f, 0.480f, 0.002f,
-0.6f, -0.6f, -1.0f, 0.0f, 1.0f, 0.0f, 0.973f, 0.480f, 0.002f,
-0.6f, -0.6f, -0.6f, 0.0f, 1.0f, 0.0f, 0.973f, 0.480f, 0.002f,
0.6f, -0.6f, -0.6f, 0.0f, 1.0f, 0.0f, 0.973f, 0.480f, 0.002f,
0.6f, -0.6f, -1.0f, 0.0f, 1.0f, 0.0f, 0.973f, 0.480f, 0.002f,
-0.6f, 0.6f, -0.6f, 0.0f, -1.0f, 0.0f, 0.973f, 0.480f, 0.002f,
-0.6f, 0.6f, -1.0f, 0.0f, -1.0f, 0.0f, 0.973f, 0.480f, 0.002f,
0.6f, 0.6f, -1.0f, 0.0f, -1.0f, 0.0f, 0.973f, 0.480f, 0.002f,
0.6f, 0.6f, -0.6f, 0.0f, -1.0f, 0.0f, 0.973f, 0.480f, 0.002f,
1.0f, 0.6f, -0.6f, 0.0f, 0.0f, 1.0f, 0.897f, 0.163f, 0.011f,
0.6f, 0.6f, -0.6f, 0.0f, 0.0f, 1.0f, 0.897f, 0.163f, 0.011f,
0.6f, -0.6f, -0.6f, 0.0f, 0.0f, 1.0f, 0.897f, 0.163f, 0.011f,
1.0f, -0.6f, -0.6f, 0.0f, 0.0f, 1.0f, 0.897f, 0.163f, 0.011f,
0.6f, 0.6f, 0.6f, 0.0f, 0.0f, -1.0f, 0.897f, 0.163f, 0.011f,
1.0f, 0.6f, 0.6f, 0.0f, 0.0f, -1.0f, 0.897f, 0.163f, 0.011f,
1.0f, -0.6f, 0.6f, 0.0f, 0.0f, -1.0f, 0.897f, 0.163f, 0.011f,
0.6f, -0.6f, 0.6f, 0.0f, 0.0f, -1.0f, 0.897f, 0.163f, 0.011f,
1.0f, 0.6f, 0.6f, 0.0f, -1.0f, 0.0f, 0.897f, 0.163f, 0.011f,
0.6f, 0.6f, 0.6f, 0.0f, -1.0f, 0.0f, 0.897f, 0.163f, 0.011f,
0.6f, 0.6f, -0.6f, 0.0f, -1.0f, 0.0f, 0.897f, 0.163f, 0.011f,
1.0f, 0.6f, -0.6f, 0.0f, -1.0f, 0.0f, 0.897f, 0.163f, 0.011f,
0.6f, -0.6f, 0.6f, 0.0f, 1.0f, 0.0f, 0.897f, 0.163f, 0.011f,
1.0f, -0.6f, 0.6f, 0.0f, 1.0f, 0.0f, 0.897f, 0.163f, 0.011f,
1.0f, -0.6f, -0.6f, 0.0f, 1.0f, 0.0f, 0.897f, 0.163f, 0.011f,
0.6f, -0.6f, -0.6f, 0.0f, 1.0f, 0.0f, 0.897f, 0.163f, 0.011f,
0.6f, 0.6f, 1.0f, -1.0f, 0.0f, 0.0f, 0.612f, 0.000f, 0.069f,
0.6f, 0.6f, 0.6f, -1.0f, 0.0f, 0.0f, 0.612f, 0.000f, 0.069f,
0.6f, -0.6f, 0.6f, -1.0f, 0.0f, 0.0f, 0.612f, 0.000f, 0.069f,
0.6f, -0.6f, 1.0f, -1.0f, 0.0f, 0.0f, 0.612f, 0.000f, 0.069f,
-0.6f, 0.6f, 0.6f, 1.0f, 0.0f, 0.0f, 0.612f, 0.000f, 0.069f,
-0.6f, 0.6f, 1.0f, 1.0f, 0.0f, 0.0f, 0.612f, 0.000f, 0.069f,
-0.6f, -0.6f, 1.0f, 1.0f, 0.0f, 0.0f, 0.612f, 0.000f, 0.069f,
-0.6f, -0.6f, 0.6f, 1.0f, 0.0f, 0.0f, 0.612f, 0.000f, 0.069f,
0.6f, -0.6f, 1.0f, 0.0f, 1.0f, 0.0f, 0.612f, 0.000f, 0.069f,
0.6f, -0.6f, 0.6f, 0.0f, 1.0f, 0.0f, 0.612f, 0.000f, 0.069f,
-0.6f, -0.6f, 0.6f, 0.0f, 1.0f, 0.0f, 0.612f, 0.000f, 0.069f,
-0.6f, -0.6f, 1.0f, 0.0f, 1.0f, 0.0f, 0.612f, 0.000f, 0.069f,
0.6f, 0.6f, 0.6f, 0.0f, -1.0f, 0.0f, 0.612f, 0.000f, 0.069f,
0.6f, 0.6f, 1.0f, 0.0f, -1.0f, 0.0f, 0.612f, 0.000f, 0.069f,
-0.6f, 0.6f, 1.0f, 0.0f, -1.0f, 0.0f, 0.612f, 0.000f, 0.069f,
-0.6f, 0.6f, 0.6f, 0.0f, -1.0f, 0.0f, 0.612f, 0.000f, 0.069f,
-1.0f, 0.6f, 0.6f, 0.0f, 0.0f, -1.0f, 0.127f, 0.116f, 0.408f,
-0.6f, 0.6f, 0.6f, 0.0f, 0.0f, -1.0f, 0.127f, 0.116f, 0.408f,
-0.6f, -0.6f, 0.6f, 0.0f, 0.0f, -1.0f, 0.127f, 0.116f, 0.408f,
-1.0f, -0.6f, 0.6f, 0.0f, 0.0f, -1.0f, 0.127f, 0.116f, 0.408f,
-0.6f, 0.6f, -0.6f, 0.0f, 0.0f, 1.0f, 0.127f, 0.116f, 0.408f,
-1.0f, 0.6f, -0.6f, 0.0f, 0.0f, 1.0f, 0.127f, 0.116f, 0.408f,
-1.0f, -0.6f, -0.6f, 0.0f, 0.0f, 1.0f, 0.127f, 0.116f, 0.408f,
-0.6f, -0.6f, -0.6f, 0.0f, 0.0f, 1.0f, 0.127f, 0.116f, 0.408f,
-1.0f, -0.6f, 0.6f, 0.0f, 1.0f, 0.0f, 0.127f, 0.116f, 0.408f,
-0.6f, -0.6f, 0.6f, 0.0f, 1.0f, 0.0f, 0.127f, 0.116f, 0.408f,
-0.6f, -0.6f, -0.6f, 0.0f, 1.0f, 0.0f, 0.127f, 0.116f, 0.408f,
-1.0f, -0.6f, -0.6f, 0.0f, 1.0f, 0.0f, 0.127f, 0.116f, 0.408f,
-0.6f, 0.6f, 0.6f, 0.0f, -1.0f, 0.0f, 0.127f, 0.116f, 0.408f,
-1.0f, 0.6f, 0.6f, 0.0f, -1.0f, 0.0f, 0.127f, 0.116f, 0.408f,
-1.0f, 0.6f, -0.6f, 0.0f, -1.0f, 0.0f, 0.127f, 0.116f, 0.408f,
-0.6f, 0.6f, -0.6f, 0.0f, -1.0f, 0.0f, 0.127f, 0.116f, 0.408f,
-0.6f, 1.0f, 0.6f, 1.0f, 0.0f, 0.0f, 0.000f, 0.254f, 0.637f,
-0.6f, 0.6f, 0.6f, 1.0f, 0.0f, 0.0f, 0.000f, 0.254f, 0.637f,
-0.6f, 0.6f, -0.6f, 1.0f, 0.0f, 0.0f, 0.000f, 0.254f, 0.637f,
-0.6f, 1.0f, -0.6f, 1.0f, 0.0f, 0.0f, 0.000f, 0.254f, 0.637f,
0.6f, 0.6f, 0.6f, -1.0f, 0.0f, 0.0f, 0.000f, 0.254f, 0.637f,
0.6f, 1.0f, 0.6f, -1.0f, 0.0f, 0.0f, 0.000f, 0.254f, 0.637f,
0.6f, 1.0f, -0.6f, -1.0f, 0.0f, 0.0f, 0.000f, 0.254f, 0.637f,
0.6f, 0.6f, -0.6f, -1.0f, 0.0f, 0.0f, 0.000f, 0.254f, 0.637f,
-0.6f, 1.0f, -0.6f, 0.0f, 0.0f, 1.0f, 0.000f, 0.254f, 0.637f,
-0.6f, 0.6f, -0.6f, 0.0f, 0.0f, 1.0f, 0.000f, 0.254f, 0.637f,
0.6f, 0.6f, -0.6f, 0.0f, 0.0f, 1.0f, 0.000f, 0.254f, 0.637f,
0.6f, 1.0f, -0.6f, 0.0f, 0.0f, 1.0f, 0.000f, 0.254f, 0.637f,
-0.6f, 0.6f, 0.6f, 0.0f, 0.0f, -1.0f, 0.000f, 0.254f, 0.637f,
-0.6f, 1.0f, 0.6f, 0.0f, 0.0f, -1.0f, 0.000f, 0.254f, 0.637f,
0.6f, 1.0f, 0.6f, 0.0f, 0.0f, -1.0f, 0.000f, 0.254f, 0.637f,
0.6f, 0.6f, 0.6f, 0.0f, 0.0f, -1.0f, 0.000f, 0.254f, 0.637f,
-0.6f, -0.6f, 0.6f, 1.0f, 0.0f, 0.0f, 0.001f, 0.447f, 0.067f,
-0.6f, -1.0f, 0.6f, 1.0f, 0.0f, 0.0f, 0.001f, 0.447f, 0.067f,
-0.6f, -1.0f, -0.6f, 1.0f, 0.0f, 0.0f, 0.001f, 0.447f, 0.067f,
-0.6f, -0.6f, -0.6f, 1.0f, 0.0f, 0.0f, 0.001f, 0.447f, 0.067f,
0.6f, -1.0f, 0.6f, -1.0f, 0.0f, 0.0f, 0.001f, 0.447f, 0.067f,
0.6f, -0.6f, 0.6f, -1.0f, 0.0f, 0.0f, 0.001f, 0.447f, 0.067f,
0.6f, -0.6f, -0.6f, -1.0f, 0.0f, 0.0f, 0.001f, 0.447f, 0.067f,
0.6f, -1.0f, -0.6f, -1.0f, 0.0f, 0.0f, 0.001f, 0.447f, 0.067f,
-0.6f, -0.6f, -0.6f, 0.0f, 0.0f, 1.0f, 0.001f, 0.447f, 0.067f,
-0.6f, -1.0f, -0.6f, 0.0f, 0.0f, 1.0f, 0.001f, 0.447f, 0.067f,
0.6f, -1.0f, -0.6f, 0.0f, 0.0f, 1.0f, 0.001f, 0.447f, 0.067f,
0.6f, -0.6f, -0.6f, 0.0f, 0.0f, 1.0f, 0.001f, 0.447f, 0.067f,
-0.6f, -1.0f, 0.6f, 0.0f, 0.0f, -1.0f, 0.001f, 0.447f, 0.067f,
-0.6f, -0.6f, 0.6f, 0.0f, 0.0f, -1.0f, 0.001f, 0.447f, 0.067f,
0.6f, -0.6f, 0.6f, 0.0f, 0.0f, -1.0f, 0.001f, 0.447f, 0.067f,
0.6f, -1.0f, 0.6f, 0.0f, 0.0f, -1.0f, 0.001f, 0.447f, 0.067f,
};
UINT indexdata[] =
{
0, 1, 9, 9, 8, 0, 1, 2, 5, 5, 4, 1, 6, 7, 10, 10, 9, 6, 2, 3, 11, 11, 10, 2,
12, 13, 21, 21, 20, 12, 13, 14, 17, 17, 16, 13, 18, 19, 22, 22, 21, 18, 14, 15, 23, 23, 22, 14,
24, 25, 33, 33, 32, 24, 25, 26, 29, 29, 28, 25, 30, 31, 34, 34, 33, 30, 26, 27, 35, 35, 34, 26,
36, 37, 45, 45, 44, 36, 37, 38, 41, 41, 40, 37, 42, 43, 46, 46, 45, 42, 38, 39, 47, 47, 46, 38,
48, 49, 57, 57, 56, 48, 49, 50, 53, 53, 52, 49, 54, 55, 58, 58, 57, 54, 50, 51, 59, 59, 58, 50,
60, 61, 69, 69, 68, 60, 61, 62, 65, 65, 64, 61, 66, 67, 70, 70, 69, 66, 62, 63, 71, 71, 70, 62,
72, 73, 74, 74, 75, 72, 76, 77, 78, 78, 79, 76, 80, 81, 82, 82, 83, 80, 84, 85, 86, 86, 87, 84,
88, 89, 90, 90, 91, 88, 92, 93, 94, 94, 95, 92, 96, 97, 98, 98, 99, 96, 100, 101, 102, 102, 103, 100,
104, 105, 106, 106, 107, 104, 108, 109, 110, 110, 111, 108, 112, 113, 114, 114, 115, 112, 116, 117, 118, 118, 119, 116,
120, 121, 122, 122, 123, 120, 124, 125, 126, 126, 127, 124, 128, 129, 130, 130, 131, 128, 132, 133, 134, 134, 135, 132,
136, 137, 138, 138, 139, 136, 140, 141, 142, 142, 143, 140, 144, 145, 146, 146, 147, 144, 148, 149, 150, 150, 151, 148,
152, 153, 154, 154, 155, 152, 156, 157, 158, 158, 159, 156, 160, 161, 162, 162, 163, 160, 164, 165, 166, 166, 167, 164,
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment