Realtime Fractal Renderer Documentation
hello_world.cl
Go to the documentation of this file.
1
#include "
utils.cl
"
2
#include "
types.cl
"
3
#include "
sdf.cl
"
4
5
#define CAMERA_POSITIONS_LENGTH 1
6
#define CAMERA_POSITIONS_ARRAY { (float4)(5, 0, 0, 0) }
7
8
#define CAMERA_FACING_DIRECTIONS_LENGTH 1
9
#define CAMERA_FACING_DIRECTIONS_ARRAY { (float4)(normalise((float3)(-1, 0, 0)), 0) }
10
11
#define CAMERA_SPEED 2.5f
12
13
#define SCENE_BACKGROUND_COLOUR (float3)(0.1f, 0.1f, 0.1f)
14
#define DO_SOFT_SHADOWS true
15
16
#define MAXIMUM_MARCH_STEPS 100
17
#define MAXIMUM_MARCH_DISTANCE 50.0f
18
19
Light
getLight
(
float
time
)
20
{
21
Light
light;
22
light.
ambient
= (float3)(0.2f, 0.2f, 0.2f);
23
light.
diffuse
= (float3)(0.5f, 0.5f, 0.5f);
24
light.
specular
= (float3)(1.0f, 1.0f, 1.0f);
25
light.
position
= (float3)(0.0, -4, -4);
26
27
return
light;
28
}
29
30
Material
SDF
(
const
float3 position,
const
float
time
,
float
* distance)
31
{
32
// Distance estimation
33
*distance = sphereSDF(position, (float3)(0, 0, 0), 1.0f);
34
35
// Material
36
Material
material;
37
material.
ambient
= (float3)(0.75f, 0.25f, 0.5f);
38
material.
diffuse
= material.
ambient
;
39
material.
specular
= (float3)(0.5f, 0.5f, 0.5f);
40
material.
shininess
= 25.0f;
41
42
return
material;
43
}
44
45
Material
getMaterial
(float3 position,
float
time
)
46
{
47
float
distance;
48
return
SDF
(position,
time
, &distance);
49
}
50
51
float
DE
(float3 position,
float
time
)
52
{
53
float
distance;
54
SDF
(position,
time
, &distance);
55
return
distance;
56
}
57
58
#include "
main.cl
"
getLight
Light getLight(float time)
Definition:
hello_world.cl:19
SDF
Material SDF(const float3 position, const float time, float *distance)
Definition:
hello_world.cl:30
getMaterial
Material getMaterial(float3 position, float time)
Definition:
hello_world.cl:45
DE
float DE(float3 position, float time)
Definition:
hello_world.cl:51
main.cl
time
const uint const uint const float time
Definition:
main.cl:368
sdf.cl
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
Material::ambient
float3 ambient
Definition:
types.cl:21
Material::diffuse
float3 diffuse
Definition:
types.cl:22
Material::shininess
float shininess
Definition:
types.cl:24
Material::specular
float3 specular
Definition:
types.cl:23
types.cl
utils.cl
FractalGeometryRenderer
kernels
hello_world.cl
Generated by
1.9.3