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
31
Light
getLight
(
float
time
)
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
42
Material
getMaterial
(float3 position,
float
time
)
43
{
44
float
distance;
45
return
sierpinskiCubeSDF(position, 10, &distance);
46
}
47
48
float
DE
(float3 position,
float
time
)
49
{
50
float
distance;
51
sierpinskiCubeSDF(position, 8, &distance);
52
return
distance;
53
}
54
55
float
boundingVolumeDE
(float3 position,
float
time
)
56
{
57
return
boxSDF(position, (float3)(1, 1, 1), (float3)(1, 1, 1));
58
}
59
60
#include "
main.cl
"
main.cl
time
const uint const uint const float time
Definition:
main.cl:368
sdf.cl
sierpinski.cl
getLight
Light getLight(float time)
Definition:
sierpinski_cube.cl:31
getMaterial
Material getMaterial(float3 position, float time)
Definition:
sierpinski_cube.cl:42
boundingVolumeDE
float boundingVolumeDE(float3 position, float time)
Definition:
sierpinski_cube.cl:55
DE
float DE(float3 position, float time)
Definition:
sierpinski_cube.cl:48
Light
A struct representing a light, for use with the phong illumination model.
Definition:
types.cl:32
Light::ambient
float3 ambient
Definition:
types.cl:34
Light::position
float3 position
Definition:
types.cl:33
Light::diffuse
float3 diffuse
Definition:
types.cl:35
Light::specular
float3 specular
Definition:
types.cl:36
Material
A struct representing a geometry material, for use with the Phong reflection model.
Definition:
types.cl:20
types.cl
FractalGeometryRenderer
kernels
sierpinski_cube.cl
Generated by
1.9.3