Realtime Fractal Renderer Documentation
sierpinski_cube.cl
Go to the documentation of this file.
1#define CAMERA_POSITIONS_LENGTH 1
2#define CAMERA_POSITIONS_ARRAY { (float4)(5, 1, 1, 0) }
3
4#define CAMERA_FACING_DIRECTIONS_LENGTH 1
5#define CAMERA_FACING_DIRECTIONS_ARRAY { (float4)(normalise((float3)(-0.5, -0.5, -0.5)), 0.0f) }
6
7#define MAXIMUM_MARCH_STEPS 100
8#define MAXIMUM_MARCH_DISTANCE 10.0f
9
10#define SURFACE_INTERSECTION_EPSILON 0.000001f
11
12#define FORCE_FREE_CAMERA true
13#define CAMERA_SPEED 1.0f
14
15#define USE_BOUNDING_VOLUME true
16
17
18// Debug
19#define DO_RENDER_SURFACE_NORMALS false
20#define DO_RENDER_MARCHING_ITERATIONS false
21#define DISPLAY_BOUNDING_VOLUME false
22
23
24
25
26#include "sierpinski.cl"
27
28#include "types.cl"
29#include "sdf.cl"
30
32{
33 Light light;
34 light.ambient = (float3)(0.2f, 0.2f, 0.2f);
35 light.diffuse = (float3)(0.5f, 0.5f, 0.5f);
36 light.specular = (float3)(1.0f, 1.0f, 1.0f);
37 light.position = (float3)(0.0, -4, -4);
38
39 return light;
40}
41
42Material getMaterial(float3 position, float time)
43{
44 float distance;
45 return sierpinskiCubeSDF(position, 10, &distance);
46}
47
48float DE(float3 position, float time)
49{
50 float distance;
51 sierpinskiCubeSDF(position, 8, &distance);
52 return distance;
53}
54
55float boundingVolumeDE(float3 position, float time)
56{
57 return boxSDF(position, (float3)(1, 1, 1), (float3)(1, 1, 1));
58}
59
60#include "main.cl"
const uint const uint const float time
Definition: main.cl:368
Light getLight(float time)
Material getMaterial(float3 position, float time)
float boundingVolumeDE(float3 position, float time)
float DE(float3 position, float time)
A struct representing a light, for use with the phong illumination model.
Definition: types.cl:32
float3 ambient
Definition: types.cl:34
float3 position
Definition: types.cl:33
float3 diffuse
Definition: types.cl:35
float3 specular
Definition: types.cl:36
A struct representing a geometry material, for use with the Phong reflection model.
Definition: types.cl:20