1package d3d11_test
2
3import D3D11 "vendor:directx/d3d11"
4import DXGI "vendor:directx/dxgi"
5import D3D "vendor:directx/d3d_compiler"
6import SDL "vendor:sdl3"
7import glm "core:math/linalg/glsl"
8
9
10main :: proc() {
11 assert(SDL.Init({.VIDEO}))
12 defer SDL.Quit()
13
14 SDL.SetHintWithPriority(SDL.HINT_RENDER_DRIVER, "direct3d11", .OVERRIDE)
15 window := SDL.CreateWindow("D3D11 in Odin",
16 854, 480,
17 {.HIGH_PIXEL_DENSITY, .HIDDEN, .RESIZABLE},
18 )
19 defer SDL.DestroyWindow(window)
20
21 native_window := DXGI.HWND(SDL.GetPointerProperty(SDL.GetWindowProperties(window), SDL.PROP_WINDOW_WIN32_HWND_POINTER, nil))
22
23 feature_levels := [?]D3D11.FEATURE_LEVEL{._11_0}
24
25 base_device: ^D3D11.IDevice
26 base_device_context: ^D3D11.IDeviceContext
27
28 D3D11.CreateDevice(nil, .HARDWARE, nil, {.BGRA_SUPPORT}, &feature_levels[0], len(feature_levels), D3D11.SDK_VERSION, &base_device, nil, &base_device_context)
29
30 device: ^D3D11.IDevice
31 base_device->QueryInterface(D3D11.IDevice_UUID, (^rawptr)(&device))
32
33 device_context: ^D3D11.IDeviceContext
34 base_device_context->QueryInterface(D3D11.IDeviceContext_UUID, (^rawptr)(&device_context))
35
36 dxgi_device: ^DXGI.IDevice
37 device->QueryInterface(DXGI.IDevice_UUID, (^rawptr)(&dxgi_device))
38
39 dxgi_adapter: ^DXGI.IAdapter
40 dxgi_device->GetAdapter(&dxgi_adapter)
41
42 dxgi_factory: ^DXGI.IFactory2
43 dxgi_adapter->GetParent(DXGI.IFactory2_UUID, (^rawptr)(&dxgi_factory))
44
45
46
47 swapchain_desc := DXGI.SWAP_CHAIN_DESC1{
48 Width = 0,
49 Height = 0,
50 Format = .B8G8R8A8_UNORM_SRGB,
51 Stereo = false,
52 SampleDesc = {
53 Count = 1,
54 Quality = 0,
55 },
56 BufferUsage = {.RENDER_TARGET_OUTPUT},
57 BufferCount = 2,
58 Scaling = .STRETCH,
59 SwapEffect = .DISCARD,
60 AlphaMode = .UNSPECIFIED,
61 Flags = {},
62 }
63
64 swapchain: ^DXGI.ISwapChain1
65 dxgi_factory->CreateSwapChainForHwnd(device, native_window, &swapchain_desc, nil, nil, &swapchain)
66
67 assert(swapchain != nil)
68
69 framebuffer: ^D3D11.ITexture2D
70 swapchain->GetBuffer(0, D3D11.ITexture2D_UUID, (^rawptr)(&framebuffer))
71
72 framebuffer_view: ^D3D11.IRenderTargetView
73 device->CreateRenderTargetView(framebuffer, nil, &framebuffer_view)
74
75 depth_buffer_desc: D3D11.TEXTURE2D_DESC
76 framebuffer->GetDesc(&depth_buffer_desc)
77 depth_buffer_desc.Format = .D24_UNORM_S8_UINT
78 depth_buffer_desc.BindFlags = {.DEPTH_STENCIL}
79
80 depth_buffer: ^D3D11.ITexture2D
81 device->CreateTexture2D(&depth_buffer_desc, nil, &depth_buffer)
82
83 depth_buffer_view: ^D3D11.IDepthStencilView
84 device->CreateDepthStencilView(depth_buffer, nil, &depth_buffer_view)
85
86
87
88 vs_blob: ^D3D11.IBlob
89 D3D.Compile(raw_data(shaders_hlsl), len(shaders_hlsl), "shaders.hlsl", nil, nil, "vs_main", "vs_5_0", 0, 0, &vs_blob, nil)
90 assert(vs_blob != nil)
91
92 vertex_shader: ^D3D11.IVertexShader
93 device->CreateVertexShader(vs_blob->GetBufferPointer(), vs_blob->GetBufferSize(), nil, &vertex_shader)
94
95 input_element_desc := [?]D3D11.INPUT_ELEMENT_DESC{
96 { "POS", 0, .R32G32B32_FLOAT, 0, 0, .VERTEX_DATA, 0 },
97 { "NOR", 0, .R32G32B32_FLOAT, 0, D3D11.APPEND_ALIGNED_ELEMENT, .VERTEX_DATA, 0 },
98 { "TEX", 0, .R32G32_FLOAT, 0, D3D11.APPEND_ALIGNED_ELEMENT, .VERTEX_DATA, 0 },
99 { "COL", 0, .R32G32B32_FLOAT, 0, D3D11.APPEND_ALIGNED_ELEMENT, .VERTEX_DATA, 0 },
100 }
101
102 input_layout: ^D3D11.IInputLayout
103 device->CreateInputLayout(&input_element_desc[0], len(input_element_desc), vs_blob->GetBufferPointer(), vs_blob->GetBufferSize(), &input_layout)
104
105 ps_blob: ^D3D11.IBlob
106 D3D.Compile(raw_data(shaders_hlsl), len(shaders_hlsl), "shaders.hlsl", nil, nil, "ps_main", "ps_5_0", 0, 0, &ps_blob, nil)
107
108 pixel_shader: ^D3D11.IPixelShader
109 device->CreatePixelShader(ps_blob->GetBufferPointer(), ps_blob->GetBufferSize(), nil, &pixel_shader)
110
111
112
113 rasterizer_desc := D3D11.RASTERIZER_DESC{
114 FillMode = .SOLID,
115 CullMode = .BACK,
116 }
117 rasterizer_state: ^D3D11.IRasterizerState
118 device->CreateRasterizerState(&rasterizer_desc, &rasterizer_state)
119
120 sampler_desc := D3D11.SAMPLER_DESC{
121 Filter = .MIN_MAG_MIP_POINT,
122 AddressU = .WRAP,
123 AddressV = .WRAP,
124 AddressW = .WRAP,
125 ComparisonFunc = .NEVER,
126 }
127 sampler_state: ^D3D11.ISamplerState
128 device->CreateSamplerState(&sampler_desc, &sampler_state)
129
130
131 depth_stencil_desc := D3D11.DEPTH_STENCIL_DESC{
132 DepthEnable = true,
133 DepthWriteMask = .ALL,
134 DepthFunc = .LESS,
135 }
136 depth_stencil_state: ^D3D11.IDepthStencilState
137 device->CreateDepthStencilState(&depth_stencil_desc, &depth_stencil_state)
138
139
140
141 Constants :: struct #align(16) {
142 transform: glm.mat4,
143 projection: glm.mat4,
144 light_vector: glm.vec3,
145 }
146
147 constant_buffer_desc := D3D11.BUFFER_DESC{
148 ByteWidth = size_of(Constants),
149 Usage = .DYNAMIC,
150 BindFlags = {.CONSTANT_BUFFER},
151 CPUAccessFlags = {.WRITE},
152 }
153 constant_buffer: ^D3D11.IBuffer
154 device->CreateBuffer(&constant_buffer_desc, nil, &constant_buffer)
155
156 vertex_buffer_desc := D3D11.BUFFER_DESC{
157 ByteWidth = size_of(vertex_data),
158 Usage = .IMMUTABLE,
159 BindFlags = {.VERTEX_BUFFER},
160 }
161 vertex_buffer: ^D3D11.IBuffer
162 device->CreateBuffer(&vertex_buffer_desc, &D3D11.SUBRESOURCE_DATA{pSysMem = &vertex_data[0], SysMemPitch = size_of(vertex_data)}, &vertex_buffer)
163
164 index_buffer_desc := D3D11.BUFFER_DESC{
165 ByteWidth = size_of(index_data),
166 Usage = .IMMUTABLE,
167 BindFlags = {.INDEX_BUFFER},
168 }
169 index_buffer: ^D3D11.IBuffer
170 device->CreateBuffer(&index_buffer_desc, &D3D11.SUBRESOURCE_DATA{pSysMem = &index_data[0], SysMemPitch = size_of(index_data)}, &index_buffer)
171
172
173
174 texture_desc := D3D11.TEXTURE2D_DESC{
175 Width = TEXTURE_WIDTH,
176 Height = TEXTURE_HEIGHT,
177 MipLevels = 1,
178 ArraySize = 1,
179 Format = .R8G8B8A8_UNORM_SRGB,
180 SampleDesc = {Count = 1},
181 Usage = .IMMUTABLE,
182 BindFlags = {.SHADER_RESOURCE},
183 }
184
185 texture_data := D3D11.SUBRESOURCE_DATA{
186 pSysMem = &texture_data[0],
187 SysMemPitch = TEXTURE_WIDTH * 4,
188 }
189
190 texture: ^D3D11.ITexture2D
191 device->CreateTexture2D(&texture_desc, &texture_data, &texture)
192
193 texture_view: ^D3D11.IShaderResourceView
194 device->CreateShaderResourceView(texture, nil, &texture_view)
195
196
197
198 vertex_buffer_stride := u32(11 * 4)
199 vertex_buffer_offset := u32(0)
200
201 model_rotation := glm.vec3{0.0, 0.0, 0.0}
202 model_translation := glm.vec3{0.0, 0.0, 4.0}
203
204 SDL.ShowWindow(window)
205 for quit := false; !quit; {
206 for e: SDL.Event; SDL.PollEvent(&e); {
207 #partial switch e.type {
208 case .QUIT:
209 quit = true
210 case .KEY_DOWN:
211 if e.key.scancode == .ESCAPE {
212 quit = true
213 }
214 }
215 }
216
217 viewport := D3D11.VIEWPORT{
218 0, 0,
219 f32(depth_buffer_desc.Width), f32(depth_buffer_desc.Height),
220 0, 1,
221 }
222
223 w := viewport.Width / viewport.Height
224 h := f32(1)
225 n := f32(1)
226 f := f32(9)
227
228 rotate_x := glm.mat4Rotate({1, 0, 0}, model_rotation.x)
229 rotate_y := glm.mat4Rotate({0, 1, 0}, model_rotation.y)
230 rotate_z := glm.mat4Rotate({0, 0, 1}, model_rotation.z)
231 translate := glm.mat4Translate(model_translation)
232
233 model_rotation.x += 0.005
234 model_rotation.y += 0.009
235 model_rotation.z += 0.001
236
237 mapped_subresource: D3D11.MAPPED_SUBRESOURCE
238 device_context->Map(constant_buffer, 0, .WRITE_DISCARD, {}, &mapped_subresource)
239 {
240 constants := (^Constants)(mapped_subresource.pData)
241 constants.transform = translate * rotate_z * rotate_y * rotate_x
242 constants.light_vector = {+1, -1, +1}
243
244 constants.projection = {
245 2 * n / w, 0, 0, 0,
246 0, 2 * n / h, 0, 0,
247 0, 0, f / (f - n), n * f / (n - f),
248 0, 0, 1, 0,
249 }
250 }
251 device_context->Unmap(constant_buffer, 0)
252
253
254
255 device_context->ClearRenderTargetView(framebuffer_view, &[4]f32{0.25, 0.5, 1.0, 1.0})
256 device_context->ClearDepthStencilView(depth_buffer_view, {.DEPTH}, 1, 0)
257
258 device_context->IASetPrimitiveTopology(.TRIANGLELIST)
259 device_context->IASetInputLayout(input_layout)
260 device_context->IASetVertexBuffers(0, 1, &vertex_buffer, &vertex_buffer_stride, &vertex_buffer_offset)
261 device_context->IASetIndexBuffer(index_buffer, .R32_UINT, 0)
262
263 device_context->VSSetShader(vertex_shader, nil, 0)
264 device_context->VSSetConstantBuffers(0, 1, &constant_buffer)
265
266 device_context->RSSetViewports(1, &viewport)
267 device_context->RSSetState(rasterizer_state)
268
269 device_context->PSSetShader(pixel_shader, nil, 0)
270 device_context->PSSetShaderResources(0, 1, &texture_view)
271 device_context->PSSetSamplers(0, 1, &sampler_state)
272
273 device_context->OMSetRenderTargets(1, &framebuffer_view, depth_buffer_view)
274 device_context->OMSetDepthStencilState(depth_stencil_state, 0)
275 device_context->OMSetBlendState(nil, nil, ~u32(0))
276
277
278
279 device_context->DrawIndexed(len(index_data), 0, 0)
280
281 swapchain->Present(1, {})
282 }
283}
284
285shaders_hlsl := `
286cbuffer constants : register(b0) {
287 float4x4 transform;
288 float4x4 projection;
289 float3 light_vector;
290}
291struct vs_in {
292 float3 position : POS;
293 float3 normal : NOR;
294 float2 texcoord : TEX;
295 float3 color : COL;
296};
297struct vs_out {
298 float4 position : SV_POSITION;
299 float2 texcoord : TEX;
300 float4 color : COL;
301};
302Texture2D mytexture : register(t0);
303SamplerState mysampler : register(s0);
304vs_out vs_main(vs_in input) {
305 float light = clamp(dot(normalize(mul(transform, float4(input.normal, 0.0f)).xyz), normalize(-light_vector)), 0.0f, 1.0f) * 0.8f + 0.2f;
306 vs_out output;
307 output.position = mul(projection, mul(transform, float4(input.position, 1.0f)));
308 output.texcoord = input.texcoord;
309 output.color = float4(input.color * light, 1.0f);
310 return output;
311}
312float4 ps_main(vs_out input) : SV_TARGET {
313 return mytexture.Sample(mysampler, input.texcoord) * input.color;
314}
315`
316
317TEXTURE_WIDTH :: 2
318TEXTURE_HEIGHT :: 2
319
320texture_data := [TEXTURE_WIDTH*TEXTURE_HEIGHT]u32{
321 0xffffffff, 0xff7f7f7f,
322 0xff7f7f7f, 0xffffffff,
323}
324
325
326vertex_data := [?]f32{
327 -1.0, 1.0, -1.0, 0.0, 0.0, -1.0, 0.0, 0.0, 0.973, 0.480, 0.002,
328 -0.6, 1.0, -1.0, 0.0, 0.0, -1.0, 2.0, 0.0, 0.973, 0.480, 0.002,
329 0.6, 1.0, -1.0, 0.0, 0.0, -1.0, 8.0, 0.0, 0.973, 0.480, 0.002,
330 1.0, 1.0, -1.0, 0.0, 0.0, -1.0, 10.0, 0.0, 0.973, 0.480, 0.002,
331 -0.6, 0.6, -1.0, 0.0, 0.0, -1.0, 2.0, 2.0, 0.973, 0.480, 0.002,
332 0.6, 0.6, -1.0, 0.0, 0.0, -1.0, 8.0, 2.0, 0.973, 0.480, 0.002,
333 -0.6, -0.6, -1.0, 0.0, 0.0, -1.0, 2.0, 8.0, 0.973, 0.480, 0.002,
334 0.6, -0.6, -1.0, 0.0, 0.0, -1.0, 8.0, 8.0, 0.973, 0.480, 0.002,
335 -1.0, -1.0, -1.0, 0.0, 0.0, -1.0, 0.0, 10.0, 0.973, 0.480, 0.002,
336 -0.6, -1.0, -1.0, 0.0, 0.0, -1.0, 2.0, 10.0, 0.973, 0.480, 0.002,
337 0.6, -1.0, -1.0, 0.0, 0.0, -1.0, 8.0, 10.0, 0.973, 0.480, 0.002,
338 1.0, -1.0, -1.0, 0.0, 0.0, -1.0, 10.0, 10.0, 0.973, 0.480, 0.002,
339 1.0, 1.0, -1.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.897, 0.163, 0.011,
340 1.0, 1.0, -0.6, 1.0, 0.0, 0.0, 2.0, 0.0, 0.897, 0.163, 0.011,
341 1.0, 1.0, 0.6, 1.0, 0.0, 0.0, 8.0, 0.0, 0.897, 0.163, 0.011,
342 1.0, 1.0, 1.0, 1.0, 0.0, 0.0, 10.0, 0.0, 0.897, 0.163, 0.011,
343 1.0, 0.6, -0.6, 1.0, 0.0, 0.0, 2.0, 2.0, 0.897, 0.163, 0.011,
344 1.0, 0.6, 0.6, 1.0, 0.0, 0.0, 8.0, 2.0, 0.897, 0.163, 0.011,
345 1.0, -0.6, -0.6, 1.0, 0.0, 0.0, 2.0, 8.0, 0.897, 0.163, 0.011,
346 1.0, -0.6, 0.6, 1.0, 0.0, 0.0, 8.0, 8.0, 0.897, 0.163, 0.011,
347 1.0, -1.0, -1.0, 1.0, 0.0, 0.0, 0.0, 10.0, 0.897, 0.163, 0.011,
348 1.0, -1.0, -0.6, 1.0, 0.0, 0.0, 2.0, 10.0, 0.897, 0.163, 0.011,
349 1.0, -1.0, 0.6, 1.0, 0.0, 0.0, 8.0, 10.0, 0.897, 0.163, 0.011,
350 1.0, -1.0, 1.0, 1.0, 0.0, 0.0, 10.0, 10.0, 0.897, 0.163, 0.011,
351 1.0, 1.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.612, 0.000, 0.069,
352 0.6, 1.0, 1.0, 0.0, 0.0, 1.0, 2.0, 0.0, 0.612, 0.000, 0.069,
353 -0.6, 1.0, 1.0, 0.0, 0.0, 1.0, 8.0, 0.0, 0.612, 0.000, 0.069,
354 -1.0, 1.0, 1.0, 0.0, 0.0, 1.0, 10.0, 0.0, 0.612, 0.000, 0.069,
355 0.6, 0.6, 1.0, 0.0, 0.0, 1.0, 2.0, 2.0, 0.612, 0.000, 0.069,
356 -0.6, 0.6, 1.0, 0.0, 0.0, 1.0, 8.0, 2.0, 0.612, 0.000, 0.069,
357 0.6, -0.6, 1.0, 0.0, 0.0, 1.0, 2.0, 8.0, 0.612, 0.000, 0.069,
358 -0.6, -0.6, 1.0, 0.0, 0.0, 1.0, 8.0, 8.0, 0.612, 0.000, 0.069,
359 1.0, -1.0, 1.0, 0.0, 0.0, 1.0, 0.0, 10.0, 0.612, 0.000, 0.069,
360 0.6, -1.0, 1.0, 0.0, 0.0, 1.0, 2.0, 10.0, 0.612, 0.000, 0.069,
361 -0.6, -1.0, 1.0, 0.0, 0.0, 1.0, 8.0, 10.0, 0.612, 0.000, 0.069,
362 -1.0, -1.0, 1.0, 0.0, 0.0, 1.0, 10.0, 10.0, 0.612, 0.000, 0.069,
363 -1.0, 1.0, 1.0, -1.0, 0.0, 0.0, 0.0, 0.0, 0.127, 0.116, 0.408,
364 -1.0, 1.0, 0.6, -1.0, 0.0, 0.0, 2.0, 0.0, 0.127, 0.116, 0.408,
365 -1.0, 1.0, -0.6, -1.0, 0.0, 0.0, 8.0, 0.0, 0.127, 0.116, 0.408,
366 -1.0, 1.0, -1.0, -1.0, 0.0, 0.0, 10.0, 0.0, 0.127, 0.116, 0.408,
367 -1.0, 0.6, 0.6, -1.0, 0.0, 0.0, 2.0, 2.0, 0.127, 0.116, 0.408,
368 -1.0, 0.6, -0.6, -1.0, 0.0, 0.0, 8.0, 2.0, 0.127, 0.116, 0.408,
369 -1.0, -0.6, 0.6, -1.0, 0.0, 0.0, 2.0, 8.0, 0.127, 0.116, 0.408,
370 -1.0, -0.6, -0.6, -1.0, 0.0, 0.0, 8.0, 8.0, 0.127, 0.116, 0.408,
371 -1.0, -1.0, 1.0, -1.0, 0.0, 0.0, 0.0, 10.0, 0.127, 0.116, 0.408,
372 -1.0, -1.0, 0.6, -1.0, 0.0, 0.0, 2.0, 10.0, 0.127, 0.116, 0.408,
373 -1.0, -1.0, -0.6, -1.0, 0.0, 0.0, 8.0, 10.0, 0.127, 0.116, 0.408,
374 -1.0, -1.0, -1.0, -1.0, 0.0, 0.0, 10.0, 10.0, 0.127, 0.116, 0.408,
375 -1.0, 1.0, 1.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.000, 0.254, 0.637,
376 -0.6, 1.0, 1.0, 0.0, 1.0, 0.0, 2.0, 0.0, 0.000, 0.254, 0.637,
377 0.6, 1.0, 1.0, 0.0, 1.0, 0.0, 8.0, 0.0, 0.000, 0.254, 0.637,
378 1.0, 1.0, 1.0, 0.0, 1.0, 0.0, 10.0, 0.0, 0.000, 0.254, 0.637,
379 -0.6, 1.0, 0.6, 0.0, 1.0, 0.0, 2.0, 2.0, 0.000, 0.254, 0.637,
380 0.6, 1.0, 0.6, 0.0, 1.0, 0.0, 8.0, 2.0, 0.000, 0.254, 0.637,
381 -0.6, 1.0, -0.6, 0.0, 1.0, 0.0, 2.0, 8.0, 0.000, 0.254, 0.637,
382 0.6, 1.0, -0.6, 0.0, 1.0, 0.0, 8.0, 8.0, 0.000, 0.254, 0.637,
383 -1.0, 1.0, -1.0, 0.0, 1.0, 0.0, 0.0, 10.0, 0.000, 0.254, 0.637,
384 -0.6, 1.0, -1.0, 0.0, 1.0, 0.0, 2.0, 10.0, 0.000, 0.254, 0.637,
385 0.6, 1.0, -1.0, 0.0, 1.0, 0.0, 8.0, 10.0, 0.000, 0.254, 0.637,
386 1.0, 1.0, -1.0, 0.0, 1.0, 0.0, 10.0, 10.0, 0.000, 0.254, 0.637,
387 -1.0, -1.0, -1.0, 0.0, -1.0, 0.0, 0.0, 0.0, 0.001, 0.447, 0.067,
388 -0.6, -1.0, -1.0, 0.0, -1.0, 0.0, 2.0, 0.0, 0.001, 0.447, 0.067,
389 0.6, -1.0, -1.0, 0.0, -1.0, 0.0, 8.0, 0.0, 0.001, 0.447, 0.067,
390 1.0, -1.0, -1.0, 0.0, -1.0, 0.0, 10.0, 0.0, 0.001, 0.447, 0.067,
391 -0.6, -1.0, -0.6, 0.0, -1.0, 0.0, 2.0, 2.0, 0.001, 0.447, 0.067,
392 0.6, -1.0, -0.6, 0.0, -1.0, 0.0, 8.0, 2.0, 0.001, 0.447, 0.067,
393 -0.6, -1.0, 0.6, 0.0, -1.0, 0.0, 2.0, 8.0, 0.001, 0.447, 0.067,
394 0.6, -1.0, 0.6, 0.0, -1.0, 0.0, 8.0, 8.0, 0.001, 0.447, 0.067,
395 -1.0, -1.0, 1.0, 0.0, -1.0, 0.0, 0.0, 10.0, 0.001, 0.447, 0.067,
396 -0.6, -1.0, 1.0, 0.0, -1.0, 0.0, 2.0, 10.0, 0.001, 0.447, 0.067,
397 0.6, -1.0, 1.0, 0.0, -1.0, 0.0, 8.0, 10.0, 0.001, 0.447, 0.067,
398 1.0, -1.0, 1.0, 0.0, -1.0, 0.0, 10.0, 10.0, 0.001, 0.447, 0.067,
399 -0.6, 0.6, -1.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.973, 0.480, 0.002,
400 -0.6, 0.6, -0.6, 1.0, 0.0, 0.0, 0.0, 0.0, 0.973, 0.480, 0.002,
401 -0.6, -0.6, -0.6, 1.0, 0.0, 0.0, 0.0, 0.0, 0.973, 0.480, 0.002,
402 -0.6, -0.6, -1.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.973, 0.480, 0.002,
403 0.6, 0.6, -0.6, -1.0, 0.0, 0.0, 0.0, 0.0, 0.973, 0.480, 0.002,
404 0.6, 0.6, -1.0, -1.0, 0.0, 0.0, 0.0, 0.0, 0.973, 0.480, 0.002,
405 0.6, -0.6, -1.0, -1.0, 0.0, 0.0, 0.0, 0.0, 0.973, 0.480, 0.002,
406 0.6, -0.6, -0.6, -1.0, 0.0, 0.0, 0.0, 0.0, 0.973, 0.480, 0.002,
407 -0.6, -0.6, -1.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.973, 0.480, 0.002,
408 -0.6, -0.6, -0.6, 0.0, 1.0, 0.0, 0.0, 0.0, 0.973, 0.480, 0.002,
409 0.6, -0.6, -0.6, 0.0, 1.0, 0.0, 0.0, 0.0, 0.973, 0.480, 0.002,
410 0.6, -0.6, -1.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.973, 0.480, 0.002,
411 -0.6, 0.6, -0.6, 0.0, -1.0, 0.0, 0.0, 0.0, 0.973, 0.480, 0.002,
412 -0.6, 0.6, -1.0, 0.0, -1.0, 0.0, 0.0, 0.0, 0.973, 0.480, 0.002,
413 0.6, 0.6, -1.0, 0.0, -1.0, 0.0, 0.0, 0.0, 0.973, 0.480, 0.002,
414 0.6, 0.6, -0.6, 0.0, -1.0, 0.0, 0.0, 0.0, 0.973, 0.480, 0.002,
415 1.0, 0.6, -0.6, 0.0, 0.0, 1.0, 0.0, 0.0, 0.897, 0.163, 0.011,
416 0.6, 0.6, -0.6, 0.0, 0.0, 1.0, 0.0, 0.0, 0.897, 0.163, 0.011,
417 0.6, -0.6, -0.6, 0.0, 0.0, 1.0, 0.0, 0.0, 0.897, 0.163, 0.011,
418 1.0, -0.6, -0.6, 0.0, 0.0, 1.0, 0.0, 0.0, 0.897, 0.163, 0.011,
419 0.6, 0.6, 0.6, 0.0, 0.0, -1.0, 0.0, 0.0, 0.897, 0.163, 0.011,
420 1.0, 0.6, 0.6, 0.0, 0.0, -1.0, 0.0, 0.0, 0.897, 0.163, 0.011,
421 1.0, -0.6, 0.6, 0.0, 0.0, -1.0, 0.0, 0.0, 0.897, 0.163, 0.011,
422 0.6, -0.6, 0.6, 0.0, 0.0, -1.0, 0.0, 0.0, 0.897, 0.163, 0.011,
423 1.0, 0.6, 0.6, 0.0, -1.0, 0.0, 0.0, 0.0, 0.897, 0.163, 0.011,
424 0.6, 0.6, 0.6, 0.0, -1.0, 0.0, 0.0, 0.0, 0.897, 0.163, 0.011,
425 0.6, 0.6, -0.6, 0.0, -1.0, 0.0, 0.0, 0.0, 0.897, 0.163, 0.011,
426 1.0, 0.6, -0.6, 0.0, -1.0, 0.0, 0.0, 0.0, 0.897, 0.163, 0.011,
427 0.6, -0.6, 0.6, 0.0, 1.0, 0.0, 0.0, 0.0, 0.897, 0.163, 0.011,
428 1.0, -0.6, 0.6, 0.0, 1.0, 0.0, 0.0, 0.0, 0.897, 0.163, 0.011,
429 1.0, -0.6, -0.6, 0.0, 1.0, 0.0, 0.0, 0.0, 0.897, 0.163, 0.011,
430 0.6, -0.6, -0.6, 0.0, 1.0, 0.0, 0.0, 0.0, 0.897, 0.163, 0.011,
431 0.6, 0.6, 1.0, -1.0, 0.0, 0.0, 0.0, 0.0, 0.612, 0.000, 0.069,
432 0.6, 0.6, 0.6, -1.0, 0.0, 0.0, 0.0, 0.0, 0.612, 0.000, 0.069,
433 0.6, -0.6, 0.6, -1.0, 0.0, 0.0, 0.0, 0.0, 0.612, 0.000, 0.069,
434 0.6, -0.6, 1.0, -1.0, 0.0, 0.0, 0.0, 0.0, 0.612, 0.000, 0.069,
435 -0.6, 0.6, 0.6, 1.0, 0.0, 0.0, 0.0, 0.0, 0.612, 0.000, 0.069,
436 -0.6, 0.6, 1.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.612, 0.000, 0.069,
437 -0.6, -0.6, 1.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.612, 0.000, 0.069,
438 -0.6, -0.6, 0.6, 1.0, 0.0, 0.0, 0.0, 0.0, 0.612, 0.000, 0.069,
439 0.6, -0.6, 1.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.612, 0.000, 0.069,
440 0.6, -0.6, 0.6, 0.0, 1.0, 0.0, 0.0, 0.0, 0.612, 0.000, 0.069,
441 -0.6, -0.6, 0.6, 0.0, 1.0, 0.0, 0.0, 0.0, 0.612, 0.000, 0.069,
442 -0.6, -0.6, 1.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.612, 0.000, 0.069,
443 0.6, 0.6, 0.6, 0.0, -1.0, 0.0, 0.0, 0.0, 0.612, 0.000, 0.069,
444 0.6, 0.6, 1.0, 0.0, -1.0, 0.0, 0.0, 0.0, 0.612, 0.000, 0.069,
445 -0.6, 0.6, 1.0, 0.0, -1.0, 0.0, 0.0, 0.0, 0.612, 0.000, 0.069,
446 -0.6, 0.6, 0.6, 0.0, -1.0, 0.0, 0.0, 0.0, 0.612, 0.000, 0.069,
447 -1.0, 0.6, 0.6, 0.0, 0.0, -1.0, 0.0, 0.0, 0.127, 0.116, 0.408,
448 -0.6, 0.6, 0.6, 0.0, 0.0, -1.0, 0.0, 0.0, 0.127, 0.116, 0.408,
449 -0.6, -0.6, 0.6, 0.0, 0.0, -1.0, 0.0, 0.0, 0.127, 0.116, 0.408,
450 -1.0, -0.6, 0.6, 0.0, 0.0, -1.0, 0.0, 0.0, 0.127, 0.116, 0.408,
451 -0.6, 0.6, -0.6, 0.0, 0.0, 1.0, 0.0, 0.0, 0.127, 0.116, 0.408,
452 -1.0, 0.6, -0.6, 0.0, 0.0, 1.0, 0.0, 0.0, 0.127, 0.116, 0.408,
453 -1.0, -0.6, -0.6, 0.0, 0.0, 1.0, 0.0, 0.0, 0.127, 0.116, 0.408,
454 -0.6, -0.6, -0.6, 0.0, 0.0, 1.0, 0.0, 0.0, 0.127, 0.116, 0.408,
455 -1.0, -0.6, 0.6, 0.0, 1.0, 0.0, 0.0, 0.0, 0.127, 0.116, 0.408,
456 -0.6, -0.6, 0.6, 0.0, 1.0, 0.0, 0.0, 0.0, 0.127, 0.116, 0.408,
457 -0.6, -0.6, -0.6, 0.0, 1.0, 0.0, 0.0, 0.0, 0.127, 0.116, 0.408,
458 -1.0, -0.6, -0.6, 0.0, 1.0, 0.0, 0.0, 0.0, 0.127, 0.116, 0.408,
459 -0.6, 0.6, 0.6, 0.0, -1.0, 0.0, 0.0, 0.0, 0.127, 0.116, 0.408,
460 -1.0, 0.6, 0.6, 0.0, -1.0, 0.0, 0.0, 0.0, 0.127, 0.116, 0.408,
461 -1.0, 0.6, -0.6, 0.0, -1.0, 0.0, 0.0, 0.0, 0.127, 0.116, 0.408,
462 -0.6, 0.6, -0.6, 0.0, -1.0, 0.0, 0.0, 0.0, 0.127, 0.116, 0.408,
463 -0.6, 1.0, 0.6, 1.0, 0.0, 0.0, 0.0, 0.0, 0.000, 0.254, 0.637,
464 -0.6, 0.6, 0.6, 1.0, 0.0, 0.0, 0.0, 0.0, 0.000, 0.254, 0.637,
465 -0.6, 0.6, -0.6, 1.0, 0.0, 0.0, 0.0, 0.0, 0.000, 0.254, 0.637,
466 -0.6, 1.0, -0.6, 1.0, 0.0, 0.0, 0.0, 0.0, 0.000, 0.254, 0.637,
467 0.6, 0.6, 0.6, -1.0, 0.0, 0.0, 0.0, 0.0, 0.000, 0.254, 0.637,
468 0.6, 1.0, 0.6, -1.0, 0.0, 0.0, 0.0, 0.0, 0.000, 0.254, 0.637,
469 0.6, 1.0, -0.6, -1.0, 0.0, 0.0, 0.0, 0.0, 0.000, 0.254, 0.637,
470 0.6, 0.6, -0.6, -1.0, 0.0, 0.0, 0.0, 0.0, 0.000, 0.254, 0.637,
471 -0.6, 1.0, -0.6, 0.0, 0.0, 1.0, 0.0, 0.0, 0.000, 0.254, 0.637,
472 -0.6, 0.6, -0.6, 0.0, 0.0, 1.0, 0.0, 0.0, 0.000, 0.254, 0.637,
473 0.6, 0.6, -0.6, 0.0, 0.0, 1.0, 0.0, 0.0, 0.000, 0.254, 0.637,
474 0.6, 1.0, -0.6, 0.0, 0.0, 1.0, 0.0, 0.0, 0.000, 0.254, 0.637,
475 -0.6, 0.6, 0.6, 0.0, 0.0, -1.0, 0.0, 0.0, 0.000, 0.254, 0.637,
476 -0.6, 1.0, 0.6, 0.0, 0.0, -1.0, 0.0, 0.0, 0.000, 0.254, 0.637,
477 0.6, 1.0, 0.6, 0.0, 0.0, -1.0, 0.0, 0.0, 0.000, 0.254, 0.637,
478 0.6, 0.6, 0.6, 0.0, 0.0, -1.0, 0.0, 0.0, 0.000, 0.254, 0.637,
479 -0.6, -0.6, 0.6, 1.0, 0.0, 0.0, 0.0, 0.0, 0.001, 0.447, 0.067,
480 -0.6, -1.0, 0.6, 1.0, 0.0, 0.0, 0.0, 0.0, 0.001, 0.447, 0.067,
481 -0.6, -1.0, -0.6, 1.0, 0.0, 0.0, 0.0, 0.0, 0.001, 0.447, 0.067,
482 -0.6, -0.6, -0.6, 1.0, 0.0, 0.0, 0.0, 0.0, 0.001, 0.447, 0.067,
483 0.6, -1.0, 0.6, -1.0, 0.0, 0.0, 0.0, 0.0, 0.001, 0.447, 0.067,
484 0.6, -0.6, 0.6, -1.0, 0.0, 0.0, 0.0, 0.0, 0.001, 0.447, 0.067,
485 0.6, -0.6, -0.6, -1.0, 0.0, 0.0, 0.0, 0.0, 0.001, 0.447, 0.067,
486 0.6, -1.0, -0.6, -1.0, 0.0, 0.0, 0.0, 0.0, 0.001, 0.447, 0.067,
487 -0.6, -0.6, -0.6, 0.0, 0.0, 1.0, 0.0, 0.0, 0.001, 0.447, 0.067,
488 -0.6, -1.0, -0.6, 0.0, 0.0, 1.0, 0.0, 0.0, 0.001, 0.447, 0.067,
489 0.6, -1.0, -0.6, 0.0, 0.0, 1.0, 0.0, 0.0, 0.001, 0.447, 0.067,
490 0.6, -0.6, -0.6, 0.0, 0.0, 1.0, 0.0, 0.0, 0.001, 0.447, 0.067,
491 -0.6, -1.0, 0.6, 0.0, 0.0, -1.0, 0.0, 0.0, 0.001, 0.447, 0.067,
492 -0.6, -0.6, 0.6, 0.0, 0.0, -1.0, 0.0, 0.0, 0.001, 0.447, 0.067,
493 0.6, -0.6, 0.6, 0.0, 0.0, -1.0, 0.0, 0.0, 0.001, 0.447, 0.067,
494 0.6, -1.0, 0.6, 0.0, 0.0, -1.0, 0.0, 0.0, 0.001, 0.447, 0.067,
495}
496
497index_data := [?]u32{
498 0, 1, 9, 9, 8, 0, 1, 2, 5, 5, 4, 1, 6, 7, 10, 10, 9, 6, 2, 3, 11, 11, 10, 2,
499 12, 13, 21, 21, 20, 12, 13, 14, 17, 17, 16, 13, 18, 19, 22, 22, 21, 18, 14, 15, 23, 23, 22, 14,
500 24, 25, 33, 33, 32, 24, 25, 26, 29, 29, 28, 25, 30, 31, 34, 34, 33, 30, 26, 27, 35, 35, 34, 26,
501 36, 37, 45, 45, 44, 36, 37, 38, 41, 41, 40, 37, 42, 43, 46, 46, 45, 42, 38, 39, 47, 47, 46, 38,
502 48, 49, 57, 57, 56, 48, 49, 50, 53, 53, 52, 49, 54, 55, 58, 58, 57, 54, 50, 51, 59, 59, 58, 50,
503 60, 61, 69, 69, 68, 60, 61, 62, 65, 65, 64, 61, 66, 67, 70, 70, 69, 66, 62, 63, 71, 71, 70, 62,
504 72, 73, 74, 74, 75, 72, 76, 77, 78, 78, 79, 76, 80, 81, 82, 82, 83, 80, 84, 85, 86, 86, 87, 84,
505 88, 89, 90, 90, 91, 88, 92, 93, 94, 94, 95, 92, 96, 97, 98, 98, 99, 96, 100, 101, 102, 102, 103, 100,
506 104, 105, 106, 106, 107, 104, 108, 109, 110, 110, 111, 108, 112, 113, 114, 114, 115, 112, 116, 117, 118, 118, 119, 116,
507 120, 121, 122, 122, 123, 120, 124, 125, 126, 126, 127, 124, 128, 129, 130, 130, 131, 128, 132, 133, 134, 134, 135, 132,
508 136, 137, 138, 138, 139, 136, 140, 141, 142, 142, 143, 140, 144, 145, 146, 146, 147, 144, 148, 149, 150, 150, 151, 148,
509 152, 153, 154, 154, 155, 152, 156, 157, 158, 158, 159, 156, 160, 161, 162, 162, 163, 160, 164, 165, 166, 166, 167, 164,
510}