Skip to content

Instantly share code, notes, and snippets.

@pJotoro
Last active August 31, 2024 15:53
Show Gist options
  • Save pJotoro/402a4c923052d9d17df437a4988d753f to your computer and use it in GitHub Desktop.
Save pJotoro/402a4c923052d9d17df437a4988d753f to your computer and use it in GitHub Desktop.
Minimal D3D11 with jo
package main
// Original: https://gist.github.com/d7samurai/261c69490cce0620d0bfc93003cd1052
import "jo:app"
import "vendor:directx/d3d11"
import "vendor:directx/dxgi"
import "vendor:directx/d3d_compiler"
import win32 "core:sys/windows"
import "core:os"
import "core:log"
import "core:math"
import "base:intrinsics"
L :: intrinsics.constant_utf16_cstring
SHADER_PATH :: "gpu.hlsl"
main :: proc() {
context.logger = log.create_console_logger()
app.init(title = "Minimal D3D11 in Odin")
feature_levels := [?]d3d11.FEATURE_LEVEL{._11_0}
swap_chain_desc: dxgi.SWAP_CHAIN_DESC
swap_chain_desc.BufferDesc.Format = .B8G8R8A8_UNORM
swap_chain_desc.SampleDesc.Count = 1
swap_chain_desc.BufferUsage = {.RENDER_TARGET_OUTPUT}
swap_chain_desc.BufferCount = 2
swap_chain_desc.OutputWindow = win32.HWND(app.window())
swap_chain_desc.Windowed = true
swap_chain_desc.SwapEffect = .FLIP_DISCARD
swap_chain: ^dxgi.ISwapChain
device: ^d3d11.IDevice
device_context: ^d3d11.IDeviceContext
d3d11.CreateDeviceAndSwapChain(
nil,
.HARDWARE,
nil,
{.BGRA_SUPPORT, .DEBUG},
raw_data(&feature_levels),
u32(len(feature_levels)),
d3d11.SDK_VERSION,
&swap_chain_desc,
&swap_chain,
&device,
nil,
&device_context)
swap_chain->GetDesc(&swap_chain_desc) // update swapchaindesc with actual window size
///////////////////////////////////////////////////////////////////////////////////////////////
frame_buffer: ^d3d11.ITexture2D
swap_chain->GetBuffer(0, d3d11.ITexture2D_UUID, (^rawptr)(&frame_buffer)) // grab framebuffer from swapchain
// needed for SRGB framebuffer when using FLIP model swap effect
frame_buffer_rtv_desc := d3d11.RENDER_TARGET_VIEW_DESC {
Format = .B8G8R8A8_UNORM_SRGB,
ViewDimension = .TEXTURE2D,
}
frame_buffer_rtv: ^d3d11.IRenderTargetView
device->CreateRenderTargetView(frame_buffer, &frame_buffer_rtv_desc, &frame_buffer_rtv)
///////////////////////////////////////////////////////////////////////////////////////////////
depth_buffer_desc: d3d11.TEXTURE2D_DESC
frame_buffer->GetDesc(&depth_buffer_desc) // copy framebuffer properties; they're mostly the same
depth_buffer_desc.Format = .D24_UNORM_S8_UINT
depth_buffer_desc.BindFlags = {.DEPTH_STENCIL}
depth_buffer: ^d3d11.ITexture2D
device->CreateTexture2D(&depth_buffer_desc, nil, &depth_buffer)
depth_buffer_dsv: ^d3d11.IDepthStencilView
device->CreateDepthStencilView(depth_buffer, nil, &depth_buffer_dsv)
///////////////////////////////////////////////////////////////////////////////////////////////
// CSO: compiled shader object
vertex_shader_cso: ^d3d11.IBlob
d3d_compiler.CompileFromFile(L(SHADER_PATH), nil, nil, "myvertexshader", "vs_5_0", 0, 0, &vertex_shader_cso, nil)
vertex_shader: ^d3d11.IVertexShader
device->CreateVertexShader(vertex_shader_cso->GetBufferPointer(), vertex_shader_cso->GetBufferSize(), nil, &vertex_shader)
input_element_descs := [?]d3d11.INPUT_ELEMENT_DESC {
{ "POS", 0, .R32G32B32_FLOAT, 0, 0, .VERTEX_DATA, 0 },
{ "NOR", 0, .R32G32B32_FLOAT, 0, d3d11.APPEND_ALIGNED_ELEMENT, .VERTEX_DATA, 0 },
{ "TEX", 0, .R32G32_FLOAT, 0, d3d11.APPEND_ALIGNED_ELEMENT, .VERTEX_DATA, 0 },
{ "COL", 0, .R32G32B32_FLOAT, 0, d3d11.APPEND_ALIGNED_ELEMENT, .VERTEX_DATA, 0 },
}
input_layout: ^d3d11.IInputLayout
device->CreateInputLayout(
raw_data(&input_element_descs),
u32(len(input_element_descs)),
vertex_shader_cso->GetBufferPointer(),
vertex_shader_cso->GetBufferSize(),
&input_layout)
///////////////////////////////////////////////////////////////////////////////////////////////
pixel_shader_cso: ^d3d11.IBlob
d3d_compiler.CompileFromFile(L(SHADER_PATH), nil, nil, "mypixelshader", "ps_5_0", 0, 0, &pixel_shader_cso, nil)
pixel_shader: ^d3d11.IPixelShader
device->CreatePixelShader(pixel_shader_cso->GetBufferPointer(), pixel_shader_cso->GetBufferSize(), nil, &pixel_shader)
///////////////////////////////////////////////////////////////////////////////////////////////
rasterizer_desc := d3d11.RASTERIZER_DESC {
FillMode = .SOLID,
CullMode = .BACK,
}
rasterizer_state: ^d3d11.IRasterizerState
device->CreateRasterizerState(&rasterizer_desc, &rasterizer_state)
///////////////////////////////////////////////////////////////////////////////////////////////
sampler_desc := d3d11.SAMPLER_DESC {
Filter = .MIN_MAG_MIP_POINT,
AddressU = .WRAP,
AddressV = .WRAP,
AddressW = .WRAP,
ComparisonFunc = .NEVER,
}
sampler_state: ^d3d11.ISamplerState
device->CreateSamplerState(&sampler_desc, &sampler_state)
///////////////////////////////////////////////////////////////////////////////////////////////
depth_stencil_desc := d3d11.DEPTH_STENCIL_DESC {
DepthEnable = true,
DepthWriteMask = .ALL,
DepthFunc = .LESS,
}
depth_stencil_state: ^d3d11.IDepthStencilState
device->CreateDepthStencilState(&depth_stencil_desc, &depth_stencil_state)
///////////////////////////////////////////////////////////////////////////////////////////////
Constants :: struct {
transform, projection: #row_major matrix[4, 4]f32,
light_vector: [3]f32,
}
constant_buffer_desc := d3d11.BUFFER_DESC {
ByteWidth = (size_of(Constants) + 0xF) & 0xFFFFFFF0, // ensure constant buffer size is multiple of 16 bytes
Usage = .DYNAMIC, // will be updated from CPU every frame
BindFlags = {.CONSTANT_BUFFER},
CPUAccessFlags = {.WRITE},
}
constant_buffer: ^d3d11.IBuffer
device->CreateBuffer(&constant_buffer_desc, nil, &constant_buffer)
///////////////////////////////////////////////////////////////////////////////////////////////
texture_desc := d3d11.TEXTURE2D_DESC {
Width = TEXTURE_WIDTH, // in xcube.odin
Height = TEXTURE_HEIGHT, // in xcube.odin
MipLevels = 1,
ArraySize = 1,
Format = .B8G8R8A8_UNORM_SRGB, // same as framebuffer(view)
SampleDesc = {Count = 1},
Usage = .IMMUTABLE, // will never be updated
BindFlags = {.SHADER_RESOURCE},
}
texture_rsd := d3d11.SUBRESOURCE_DATA {
pSysMem = raw_data(&texture_data), // in xcube.odin
SysMemPitch = TEXTURE_WIDTH * size_of(u32), // 1 u32 = 4 bytes per pixel, 0xAARRGGBB
}
texture: ^d3d11.ITexture2D
device->CreateTexture2D(&texture_desc, &texture_rsd, &texture)
texture_srv: ^d3d11.IShaderResourceView
device->CreateShaderResourceView(texture, nil, &texture_srv)
///////////////////////////////////////////////////////////////////////////////////////////////
vertex_buffer_desc := d3d11.BUFFER_DESC {
ByteWidth = size_of(vertex_data),
Usage = .IMMUTABLE, // will never be updated
BindFlags = {.VERTEX_BUFFER},
}
vertex_buffer_srd := d3d11.SUBRESOURCE_DATA{
pSysMem = raw_data(&vertex_data), // in xcube.odin
}
vertex_buffer: ^d3d11.IBuffer
device->CreateBuffer(&vertex_buffer_desc, &vertex_buffer_srd, &vertex_buffer)
///////////////////////////////////////////////////////////////////////////////////////////////
index_buffer_desc := d3d11.BUFFER_DESC {
ByteWidth = size_of(index_data),
Usage = .IMMUTABLE, // will never be updated
BindFlags = {.INDEX_BUFFER},
}
index_buffer_srd := d3d11.SUBRESOURCE_DATA {
pSysMem = raw_data(&index_data), // in xcube.odin
}
index_buffer: ^d3d11.IBuffer
device->CreateBuffer(&index_buffer_desc, &index_buffer_srd, &index_buffer)
///////////////////////////////////////////////////////////////////////////////////////////////
clear_color := [4]f32 { 0.025, 0.025, 0.025, 1.0}
stride := u32(11 * size_of(f32)) // vertex size (11 floats: float3 position, float3 normal, float2 texcoord, float3 color)
offset: u32
viewport := d3d11.VIEWPORT {
0.0,
0.0,
f32(swap_chain_desc.BufferDesc.Width),
f32(swap_chain_desc.BufferDesc.Height),
0.0,
1.0,
}
///////////////////////////////////////////////////////////////////////////////////////////////
w := viewport.Width / viewport.Height // width (aspect ratio)
h := f32(1.0) // height
n := f32(1.0) // near
f := f32(9.0) // far
model_rotation := [3]f32 { 0.0, 0.0, 0.0 }
model_scale := [3]f32 { 1.0, 1.0, 1.0 }
model_translation := [3]f32 { 0.0, 0.0, 4.0 }
///////////////////////////////////////////////////////////////////////////////////////////////
for app.running() {
///////////////////////////////////////////////////////////////////////////////////////////
rotatex := #row_major matrix[4, 4]f32 { 1, 0, 0, 0, 0, math.cos_f32(model_rotation.x), -math.sin_f32(model_rotation.x), 0, 0, math.sin_f32(model_rotation.x), math.cos_f32(model_rotation.x), 0, 0, 0, 0, 1 }
rotatey := #row_major matrix[4, 4]f32 { math.cos_f32(model_rotation.y), 0, math.sin_f32(model_rotation.y), 0, 0, 1, 0, 0, -math.sin_f32(model_rotation.y), 0, math.cos_f32(model_rotation.y), 0, 0, 0, 0, 1 }
rotatez := #row_major matrix[4, 4]f32 { math.cos_f32(model_rotation.z), -math.sin_f32(model_rotation.z), 0, 0, math.sin_f32(model_rotation.z), math.cos_f32(model_rotation.z), 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 }
scale := #row_major matrix[4, 4]f32 { model_scale.x, 0, 0, 0, 0, model_scale.y, 0, 0, 0, 0, model_scale.z, 0, 0, 0, 0, 1 }
translate := #row_major matrix[4, 4]f32 { 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, model_translation.x, model_translation.y, model_translation.z, 1 }
model_rotation.x += 0.005
model_rotation.y += 0.009
model_rotation.z += 0.001
///////////////////////////////////////////////////////////////////////////////////////////
constant_buffer_msr: d3d11.MAPPED_SUBRESOURCE
device_context->Map(constant_buffer, 0, .WRITE_DISCARD, {}, &constant_buffer_msr) // update constant buffer every frame
{
constants := (^Constants)(constant_buffer_msr.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, 0, n * f / (n - f), 0 }
constants.light_vector = { 1.0, -1.0, 1.0 }
}
device_context->Unmap(constant_buffer, 0)
///////////////////////////////////////////////////////////////////////////////////////////
device_context->ClearRenderTargetView(frame_buffer_rtv, &clear_color)
device_context->ClearDepthStencilView(depth_buffer_dsv, {.DEPTH}, 1.0, 0)
device_context->IASetPrimitiveTopology(.TRIANGLELIST)
device_context->IASetInputLayout(input_layout)
device_context->IASetVertexBuffers(0, 1, &vertex_buffer, &stride, &offset)
device_context->IASetIndexBuffer(index_buffer, .R32_UINT, 0)
device_context->VSSetShader(vertex_shader, nil, 0)
device_context->VSSetConstantBuffers(0, 1, &constant_buffer)
device_context->RSSetViewports(1, &viewport)
device_context->RSSetState(rasterizer_state)
device_context->PSSetShader(pixel_shader, nil, 0)
device_context->PSSetShaderResources(0, 1, &texture_srv)
device_context->PSSetSamplers(0, 1, &sampler_state)
device_context->OMSetRenderTargets(1, &frame_buffer_rtv, depth_buffer_dsv)
device_context->OMSetDepthStencilState(depth_stencil_state, 0)
device_context->OMSetBlendState(nil, nil, 0xFFFFFFFF) // use default blend mode (i.e. no blending)
///////////////////////////////////////////////////////////////////////////////////////////
device_context->DrawIndexed(u32(len(index_data)), 0, 0)
///////////////////////////////////////////////////////////////////////////////////////////
swap_chain->Present(1, {})
}
}
package main
TEXTURE_WIDTH :: 2
TEXTURE_HEIGHT :: 2
// 2x2 pixel checkerboard pattern, 0xAARRGGBB
texture_data := [?]u32 {
0xFFFFFFFF, 0xFF7F7F7F,
0xFF7F7F7F, 0xFFFFFFFF,
}
vertex_data := [?]f32 { // pos.x, pos.y, pos.z, nor.x, nor.y, nor.z, tex.u, tex.v, col.r, col.g, col.b,
-1.0, 1.0, -1.0, 0.0, 0.0, -1.0, 0.0, 0.0, 0.973, 0.480, 0.002,
-0.6, 1.0, -1.0, 0.0, 0.0, -1.0, 2.0, 0.0, 0.973, 0.480, 0.002,
0.6, 1.0, -1.0, 0.0, 0.0, -1.0, 8.0, 0.0, 0.973, 0.480, 0.002,
1.0, 1.0, -1.0, 0.0, 0.0, -1.0, 10.0, 0.0, 0.973, 0.480, 0.002,
-0.6, 0.6, -1.0, 0.0, 0.0, -1.0, 2.0, 2.0, 0.973, 0.480, 0.002,
0.6, 0.6, -1.0, 0.0, 0.0, -1.0, 8.0, 2.0, 0.973, 0.480, 0.002,
-0.6, -0.6, -1.0, 0.0, 0.0, -1.0, 2.0, 8.0, 0.973, 0.480, 0.002,
0.6, -0.6, -1.0, 0.0, 0.0, -1.0, 8.0, 8.0, 0.973, 0.480, 0.002,
-1.0, -1.0, -1.0, 0.0, 0.0, -1.0, 0.0, 10.0, 0.973, 0.480, 0.002,
-0.6, -1.0, -1.0, 0.0, 0.0, -1.0, 2.0, 10.0, 0.973, 0.480, 0.002,
0.6, -1.0, -1.0, 0.0, 0.0, -1.0, 8.0, 10.0, 0.973, 0.480, 0.002,
1.0, -1.0, -1.0, 0.0, 0.0, -1.0, 10.0, 10.0, 0.973, 0.480, 0.002,
1.0, 1.0, -1.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.897, 0.163, 0.011,
1.0, 1.0, -0.6, 1.0, 0.0, 0.0, 2.0, 0.0, 0.897, 0.163, 0.011,
1.0, 1.0, 0.6, 1.0, 0.0, 0.0, 8.0, 0.0, 0.897, 0.163, 0.011,
1.0, 1.0, 1.0, 1.0, 0.0, 0.0, 10.0, 0.0, 0.897, 0.163, 0.011,
1.0, 0.6, -0.6, 1.0, 0.0, 0.0, 2.0, 2.0, 0.897, 0.163, 0.011,
1.0, 0.6, 0.6, 1.0, 0.0, 0.0, 8.0, 2.0, 0.897, 0.163, 0.011,
1.0, -0.6, -0.6, 1.0, 0.0, 0.0, 2.0, 8.0, 0.897, 0.163, 0.011,
1.0, -0.6, 0.6, 1.0, 0.0, 0.0, 8.0, 8.0, 0.897, 0.163, 0.011,
1.0, -1.0, -1.0, 1.0, 0.0, 0.0, 0.0, 10.0, 0.897, 0.163, 0.011,
1.0, -1.0, -0.6, 1.0, 0.0, 0.0, 2.0, 10.0, 0.897, 0.163, 0.011,
1.0, -1.0, 0.6, 1.0, 0.0, 0.0, 8.0, 10.0, 0.897, 0.163, 0.011,
1.0, -1.0, 1.0, 1.0, 0.0, 0.0, 10.0, 10.0, 0.897, 0.163, 0.011,
1.0, 1.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.612, 0.000, 0.069,
0.6, 1.0, 1.0, 0.0, 0.0, 1.0, 2.0, 0.0, 0.612, 0.000, 0.069,
-0.6, 1.0, 1.0, 0.0, 0.0, 1.0, 8.0, 0.0, 0.612, 0.000, 0.069,
-1.0, 1.0, 1.0, 0.0, 0.0, 1.0, 10.0, 0.0, 0.612, 0.000, 0.069,
0.6, 0.6, 1.0, 0.0, 0.0, 1.0, 2.0, 2.0, 0.612, 0.000, 0.069,
-0.6, 0.6, 1.0, 0.0, 0.0, 1.0, 8.0, 2.0, 0.612, 0.000, 0.069,
0.6, -0.6, 1.0, 0.0, 0.0, 1.0, 2.0, 8.0, 0.612, 0.000, 0.069,
-0.6, -0.6, 1.0, 0.0, 0.0, 1.0, 8.0, 8.0, 0.612, 0.000, 0.069,
1.0, -1.0, 1.0, 0.0, 0.0, 1.0, 0.0, 10.0, 0.612, 0.000, 0.069,
0.6, -1.0, 1.0, 0.0, 0.0, 1.0, 2.0, 10.0, 0.612, 0.000, 0.069,
-0.6, -1.0, 1.0, 0.0, 0.0, 1.0, 8.0, 10.0, 0.612, 0.000, 0.069,
-1.0, -1.0, 1.0, 0.0, 0.0, 1.0, 10.0, 10.0, 0.612, 0.000, 0.069,
-1.0, 1.0, 1.0, -1.0, 0.0, 0.0, 0.0, 0.0, 0.127, 0.116, 0.408,
-1.0, 1.0, 0.6, -1.0, 0.0, 0.0, 2.0, 0.0, 0.127, 0.116, 0.408,
-1.0, 1.0, -0.6, -1.0, 0.0, 0.0, 8.0, 0.0, 0.127, 0.116, 0.408,
-1.0, 1.0, -1.0, -1.0, 0.0, 0.0, 10.0, 0.0, 0.127, 0.116, 0.408,
-1.0, 0.6, 0.6, -1.0, 0.0, 0.0, 2.0, 2.0, 0.127, 0.116, 0.408,
-1.0, 0.6, -0.6, -1.0, 0.0, 0.0, 8.0, 2.0, 0.127, 0.116, 0.408,
-1.0, -0.6, 0.6, -1.0, 0.0, 0.0, 2.0, 8.0, 0.127, 0.116, 0.408,
-1.0, -0.6, -0.6, -1.0, 0.0, 0.0, 8.0, 8.0, 0.127, 0.116, 0.408,
-1.0, -1.0, 1.0, -1.0, 0.0, 0.0, 0.0, 10.0, 0.127, 0.116, 0.408,
-1.0, -1.0, 0.6, -1.0, 0.0, 0.0, 2.0, 10.0, 0.127, 0.116, 0.408,
-1.0, -1.0, -0.6, -1.0, 0.0, 0.0, 8.0, 10.0, 0.127, 0.116, 0.408,
-1.0, -1.0, -1.0, -1.0, 0.0, 0.0, 10.0, 10.0, 0.127, 0.116, 0.408,
-1.0, 1.0, 1.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.000, 0.254, 0.637,
-0.6, 1.0, 1.0, 0.0, 1.0, 0.0, 2.0, 0.0, 0.000, 0.254, 0.637,
0.6, 1.0, 1.0, 0.0, 1.0, 0.0, 8.0, 0.0, 0.000, 0.254, 0.637,
1.0, 1.0, 1.0, 0.0, 1.0, 0.0, 10.0, 0.0, 0.000, 0.254, 0.637,
-0.6, 1.0, 0.6, 0.0, 1.0, 0.0, 2.0, 2.0, 0.000, 0.254, 0.637,
0.6, 1.0, 0.6, 0.0, 1.0, 0.0, 8.0, 2.0, 0.000, 0.254, 0.637,
-0.6, 1.0, -0.6, 0.0, 1.0, 0.0, 2.0, 8.0, 0.000, 0.254, 0.637,
0.6, 1.0, -0.6, 0.0, 1.0, 0.0, 8.0, 8.0, 0.000, 0.254, 0.637,
-1.0, 1.0, -1.0, 0.0, 1.0, 0.0, 0.0, 10.0, 0.000, 0.254, 0.637,
-0.6, 1.0, -1.0, 0.0, 1.0, 0.0, 2.0, 10.0, 0.000, 0.254, 0.637,
0.6, 1.0, -1.0, 0.0, 1.0, 0.0, 8.0, 10.0, 0.000, 0.254, 0.637,
1.0, 1.0, -1.0, 0.0, 1.0, 0.0, 10.0, 10.0, 0.000, 0.254, 0.637,
-1.0, -1.0, -1.0, 0.0, -1.0, 0.0, 0.0, 0.0, 0.001, 0.447, 0.067,
-0.6, -1.0, -1.0, 0.0, -1.0, 0.0, 2.0, 0.0, 0.001, 0.447, 0.067,
0.6, -1.0, -1.0, 0.0, -1.0, 0.0, 8.0, 0.0, 0.001, 0.447, 0.067,
1.0, -1.0, -1.0, 0.0, -1.0, 0.0, 10.0, 0.0, 0.001, 0.447, 0.067,
-0.6, -1.0, -0.6, 0.0, -1.0, 0.0, 2.0, 2.0, 0.001, 0.447, 0.067,
0.6, -1.0, -0.6, 0.0, -1.0, 0.0, 8.0, 2.0, 0.001, 0.447, 0.067,
-0.6, -1.0, 0.6, 0.0, -1.0, 0.0, 2.0, 8.0, 0.001, 0.447, 0.067,
0.6, -1.0, 0.6, 0.0, -1.0, 0.0, 8.0, 8.0, 0.001, 0.447, 0.067,
-1.0, -1.0, 1.0, 0.0, -1.0, 0.0, 0.0, 10.0, 0.001, 0.447, 0.067,
-0.6, -1.0, 1.0, 0.0, -1.0, 0.0, 2.0, 10.0, 0.001, 0.447, 0.067,
0.6, -1.0, 1.0, 0.0, -1.0, 0.0, 8.0, 10.0, 0.001, 0.447, 0.067,
1.0, -1.0, 1.0, 0.0, -1.0, 0.0, 10.0, 10.0, 0.001, 0.447, 0.067,
-0.6, 0.6, -1.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.973, 0.480, 0.002,
-0.6, 0.6, -0.6, 1.0, 0.0, 0.0, 0.0, 0.0, 0.973, 0.480, 0.002,
-0.6, -0.6, -0.6, 1.0, 0.0, 0.0, 0.0, 0.0, 0.973, 0.480, 0.002,
-0.6, -0.6, -1.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.973, 0.480, 0.002,
0.6, 0.6, -0.6, -1.0, 0.0, 0.0, 0.0, 0.0, 0.973, 0.480, 0.002,
0.6, 0.6, -1.0, -1.0, 0.0, 0.0, 0.0, 0.0, 0.973, 0.480, 0.002,
0.6, -0.6, -1.0, -1.0, 0.0, 0.0, 0.0, 0.0, 0.973, 0.480, 0.002,
0.6, -0.6, -0.6, -1.0, 0.0, 0.0, 0.0, 0.0, 0.973, 0.480, 0.002,
-0.6, -0.6, -1.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.973, 0.480, 0.002,
-0.6, -0.6, -0.6, 0.0, 1.0, 0.0, 0.0, 0.0, 0.973, 0.480, 0.002,
0.6, -0.6, -0.6, 0.0, 1.0, 0.0, 0.0, 0.0, 0.973, 0.480, 0.002,
0.6, -0.6, -1.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.973, 0.480, 0.002,
-0.6, 0.6, -0.6, 0.0, -1.0, 0.0, 0.0, 0.0, 0.973, 0.480, 0.002,
-0.6, 0.6, -1.0, 0.0, -1.0, 0.0, 0.0, 0.0, 0.973, 0.480, 0.002,
0.6, 0.6, -1.0, 0.0, -1.0, 0.0, 0.0, 0.0, 0.973, 0.480, 0.002,
0.6, 0.6, -0.6, 0.0, -1.0, 0.0, 0.0, 0.0, 0.973, 0.480, 0.002,
1.0, 0.6, -0.6, 0.0, 0.0, 1.0, 0.0, 0.0, 0.897, 0.163, 0.011,
0.6, 0.6, -0.6, 0.0, 0.0, 1.0, 0.0, 0.0, 0.897, 0.163, 0.011,
0.6, -0.6, -0.6, 0.0, 0.0, 1.0, 0.0, 0.0, 0.897, 0.163, 0.011,
1.0, -0.6, -0.6, 0.0, 0.0, 1.0, 0.0, 0.0, 0.897, 0.163, 0.011,
0.6, 0.6, 0.6, 0.0, 0.0, -1.0, 0.0, 0.0, 0.897, 0.163, 0.011,
1.0, 0.6, 0.6, 0.0, 0.0, -1.0, 0.0, 0.0, 0.897, 0.163, 0.011,
1.0, -0.6, 0.6, 0.0, 0.0, -1.0, 0.0, 0.0, 0.897, 0.163, 0.011,
0.6, -0.6, 0.6, 0.0, 0.0, -1.0, 0.0, 0.0, 0.897, 0.163, 0.011,
1.0, 0.6, 0.6, 0.0, -1.0, 0.0, 0.0, 0.0, 0.897, 0.163, 0.011,
0.6, 0.6, 0.6, 0.0, -1.0, 0.0, 0.0, 0.0, 0.897, 0.163, 0.011,
0.6, 0.6, -0.6, 0.0, -1.0, 0.0, 0.0, 0.0, 0.897, 0.163, 0.011,
1.0, 0.6, -0.6, 0.0, -1.0, 0.0, 0.0, 0.0, 0.897, 0.163, 0.011,
0.6, -0.6, 0.6, 0.0, 1.0, 0.0, 0.0, 0.0, 0.897, 0.163, 0.011,
1.0, -0.6, 0.6, 0.0, 1.0, 0.0, 0.0, 0.0, 0.897, 0.163, 0.011,
1.0, -0.6, -0.6, 0.0, 1.0, 0.0, 0.0, 0.0, 0.897, 0.163, 0.011,
0.6, -0.6, -0.6, 0.0, 1.0, 0.0, 0.0, 0.0, 0.897, 0.163, 0.011,
0.6, 0.6, 1.0, -1.0, 0.0, 0.0, 0.0, 0.0, 0.612, 0.000, 0.069,
0.6, 0.6, 0.6, -1.0, 0.0, 0.0, 0.0, 0.0, 0.612, 0.000, 0.069,
0.6, -0.6, 0.6, -1.0, 0.0, 0.0, 0.0, 0.0, 0.612, 0.000, 0.069,
0.6, -0.6, 1.0, -1.0, 0.0, 0.0, 0.0, 0.0, 0.612, 0.000, 0.069,
-0.6, 0.6, 0.6, 1.0, 0.0, 0.0, 0.0, 0.0, 0.612, 0.000, 0.069,
-0.6, 0.6, 1.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.612, 0.000, 0.069,
-0.6, -0.6, 1.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.612, 0.000, 0.069,
-0.6, -0.6, 0.6, 1.0, 0.0, 0.0, 0.0, 0.0, 0.612, 0.000, 0.069,
0.6, -0.6, 1.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.612, 0.000, 0.069,
0.6, -0.6, 0.6, 0.0, 1.0, 0.0, 0.0, 0.0, 0.612, 0.000, 0.069,
-0.6, -0.6, 0.6, 0.0, 1.0, 0.0, 0.0, 0.0, 0.612, 0.000, 0.069,
-0.6, -0.6, 1.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.612, 0.000, 0.069,
0.6, 0.6, 0.6, 0.0, -1.0, 0.0, 0.0, 0.0, 0.612, 0.000, 0.069,
0.6, 0.6, 1.0, 0.0, -1.0, 0.0, 0.0, 0.0, 0.612, 0.000, 0.069,
-0.6, 0.6, 1.0, 0.0, -1.0, 0.0, 0.0, 0.0, 0.612, 0.000, 0.069,
-0.6, 0.6, 0.6, 0.0, -1.0, 0.0, 0.0, 0.0, 0.612, 0.000, 0.069,
-1.0, 0.6, 0.6, 0.0, 0.0, -1.0, 0.0, 0.0, 0.127, 0.116, 0.408,
-0.6, 0.6, 0.6, 0.0, 0.0, -1.0, 0.0, 0.0, 0.127, 0.116, 0.408,
-0.6, -0.6, 0.6, 0.0, 0.0, -1.0, 0.0, 0.0, 0.127, 0.116, 0.408,
-1.0, -0.6, 0.6, 0.0, 0.0, -1.0, 0.0, 0.0, 0.127, 0.116, 0.408,
-0.6, 0.6, -0.6, 0.0, 0.0, 1.0, 0.0, 0.0, 0.127, 0.116, 0.408,
-1.0, 0.6, -0.6, 0.0, 0.0, 1.0, 0.0, 0.0, 0.127, 0.116, 0.408,
-1.0, -0.6, -0.6, 0.0, 0.0, 1.0, 0.0, 0.0, 0.127, 0.116, 0.408,
-0.6, -0.6, -0.6, 0.0, 0.0, 1.0, 0.0, 0.0, 0.127, 0.116, 0.408,
-1.0, -0.6, 0.6, 0.0, 1.0, 0.0, 0.0, 0.0, 0.127, 0.116, 0.408,
-0.6, -0.6, 0.6, 0.0, 1.0, 0.0, 0.0, 0.0, 0.127, 0.116, 0.408,
-0.6, -0.6, -0.6, 0.0, 1.0, 0.0, 0.0, 0.0, 0.127, 0.116, 0.408,
-1.0, -0.6, -0.6, 0.0, 1.0, 0.0, 0.0, 0.0, 0.127, 0.116, 0.408,
-0.6, 0.6, 0.6, 0.0, -1.0, 0.0, 0.0, 0.0, 0.127, 0.116, 0.408,
-1.0, 0.6, 0.6, 0.0, -1.0, 0.0, 0.0, 0.0, 0.127, 0.116, 0.408,
-1.0, 0.6, -0.6, 0.0, -1.0, 0.0, 0.0, 0.0, 0.127, 0.116, 0.408,
-0.6, 0.6, -0.6, 0.0, -1.0, 0.0, 0.0, 0.0, 0.127, 0.116, 0.408,
-0.6, 1.0, 0.6, 1.0, 0.0, 0.0, 0.0, 0.0, 0.000, 0.254, 0.637,
-0.6, 0.6, 0.6, 1.0, 0.0, 0.0, 0.0, 0.0, 0.000, 0.254, 0.637,
-0.6, 0.6, -0.6, 1.0, 0.0, 0.0, 0.0, 0.0, 0.000, 0.254, 0.637,
-0.6, 1.0, -0.6, 1.0, 0.0, 0.0, 0.0, 0.0, 0.000, 0.254, 0.637,
0.6, 0.6, 0.6, -1.0, 0.0, 0.0, 0.0, 0.0, 0.000, 0.254, 0.637,
0.6, 1.0, 0.6, -1.0, 0.0, 0.0, 0.0, 0.0, 0.000, 0.254, 0.637,
0.6, 1.0, -0.6, -1.0, 0.0, 0.0, 0.0, 0.0, 0.000, 0.254, 0.637,
0.6, 0.6, -0.6, -1.0, 0.0, 0.0, 0.0, 0.0, 0.000, 0.254, 0.637,
-0.6, 1.0, -0.6, 0.0, 0.0, 1.0, 0.0, 0.0, 0.000, 0.254, 0.637,
-0.6, 0.6, -0.6, 0.0, 0.0, 1.0, 0.0, 0.0, 0.000, 0.254, 0.637,
0.6, 0.6, -0.6, 0.0, 0.0, 1.0, 0.0, 0.0, 0.000, 0.254, 0.637,
0.6, 1.0, -0.6, 0.0, 0.0, 1.0, 0.0, 0.0, 0.000, 0.254, 0.637,
-0.6, 0.6, 0.6, 0.0, 0.0, -1.0, 0.0, 0.0, 0.000, 0.254, 0.637,
-0.6, 1.0, 0.6, 0.0, 0.0, -1.0, 0.0, 0.0, 0.000, 0.254, 0.637,
0.6, 1.0, 0.6, 0.0, 0.0, -1.0, 0.0, 0.0, 0.000, 0.254, 0.637,
0.6, 0.6, 0.6, 0.0, 0.0, -1.0, 0.0, 0.0, 0.000, 0.254, 0.637,
-0.6, -0.6, 0.6, 1.0, 0.0, 0.0, 0.0, 0.0, 0.001, 0.447, 0.067,
-0.6, -1.0, 0.6, 1.0, 0.0, 0.0, 0.0, 0.0, 0.001, 0.447, 0.067,
-0.6, -1.0, -0.6, 1.0, 0.0, 0.0, 0.0, 0.0, 0.001, 0.447, 0.067,
-0.6, -0.6, -0.6, 1.0, 0.0, 0.0, 0.0, 0.0, 0.001, 0.447, 0.067,
0.6, -1.0, 0.6, -1.0, 0.0, 0.0, 0.0, 0.0, 0.001, 0.447, 0.067,
0.6, -0.6, 0.6, -1.0, 0.0, 0.0, 0.0, 0.0, 0.001, 0.447, 0.067,
0.6, -0.6, -0.6, -1.0, 0.0, 0.0, 0.0, 0.0, 0.001, 0.447, 0.067,
0.6, -1.0, -0.6, -1.0, 0.0, 0.0, 0.0, 0.0, 0.001, 0.447, 0.067,
-0.6, -0.6, -0.6, 0.0, 0.0, 1.0, 0.0, 0.0, 0.001, 0.447, 0.067,
-0.6, -1.0, -0.6, 0.0, 0.0, 1.0, 0.0, 0.0, 0.001, 0.447, 0.067,
0.6, -1.0, -0.6, 0.0, 0.0, 1.0, 0.0, 0.0, 0.001, 0.447, 0.067,
0.6, -0.6, -0.6, 0.0, 0.0, 1.0, 0.0, 0.0, 0.001, 0.447, 0.067,
-0.6, -1.0, 0.6, 0.0, 0.0, -1.0, 0.0, 0.0, 0.001, 0.447, 0.067,
-0.6, -0.6, 0.6, 0.0, 0.0, -1.0, 0.0, 0.0, 0.001, 0.447, 0.067,
0.6, -0.6, 0.6, 0.0, 0.0, -1.0, 0.0, 0.0, 0.001, 0.447, 0.067,
0.6, -1.0, 0.6, 0.0, 0.0, -1.0, 0.0, 0.0, 0.001, 0.447, 0.067,
}
index_data := [?]u32 {
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