#include "defines.cl"
#include "types.cl"
Go to the source code of this file.
|
| __kernel void | getSceneInformation (__global float3 *camera_up_axis, const uint array_capacity, __global uint *number_camera_positions, __global float4 *camera_positions_at_time, __global uint *number_camera_facing, __global float4 *camera_facing_at_time, __global bool *do_camera_loop, __global float *camera_speed, __global float2 *benchmark_start_stop_time) |
| | Kernel function used to pass scene information to the C++ interface. More...
|
| |
| float3 | estimateSurfaceNormal (const float3 position, const float time) |
| | Calculates the surface normal for a any point in the scene. More...
|
| |
| float | calculateSoftShadow (const float3 pointOnGeometry, const float time, const float3 lightPosition) |
| | Calculates soft shadows for a point on geometry in the scene. More...
|
| |
| float | calculateHardShadow (const float3 pointOnGeometry, const float time, const float3 lightPosition) |
| | Calculates hard shadows for a point on geometry in the scene. More...
|
| |
| float3 | reflect (float3 incident, float3 normal) |
| |
| float3 | trace (const Ray ray, const float time) |
| | Traces the path of a ray. More...
|
| |
| Ray | getCameraRay (const float2 screen_coordinate, const float3 camera_position, const float3 camera_facing, const float aspect_ratio) |
| | Creates a ray for the specified position on the camera screen. More...
|
| |
| uchar3 | convertColourTo8Bit (const float3 colour) |
| | Converts a colour range 0-1 to an integer colour with range 0-255. More...
|
| |
| | __attribute__ ((vec_type_hint(float3))) __kernel void calculatePixelColour(__global uchar *colours |
| | Main kernel function. Calculates the colour for a pixel with the specified coordinate position range 0-1. More...
|
| |
| | if (ID< width *height) |
| |
|
| const uint | width |
| |
| const uint const uint | height |
| |
| const uint const uint const float | time |
| |
| const uint const uint const float const float3 | camera_position |
| |
| const uint const uint const float const float3 const float3 | camera_facing |
| |
◆ __attribute__()
| __attribute__ |
( |
(vec_type_hint(float3)) |
| ) |
|
Main kernel function. Calculates the colour for a pixel with the specified coordinate position range 0-1.
- Parameters
-
| colours | Output colour buffer RGBA ordering |
| width | Image width in pixels |
| height | Image height in pixels |
| time | Scene time in seconds |
| camera_position | Position of the camera in the scene |
| camera_facing | Facing direction of the camera |
◆ calculateHardShadow()
| float calculateHardShadow |
( |
const float3 |
pointOnGeometry, |
|
|
const float |
time, |
|
|
const float3 |
lightPosition |
|
) |
| |
Calculates hard shadows for a point on geometry in the scene.
- Parameters
-
| pointOnGeometry | Position in world space |
| time | Scene time in seconds |
| lightPosition | Position of the light in the scene |
- Returns
- Shadow value between 0 and 1
Definition at line 124 of file main.cl.
◆ calculateSoftShadow()
| float calculateSoftShadow |
( |
const float3 |
pointOnGeometry, |
|
|
const float |
time, |
|
|
const float3 |
lightPosition |
|
) |
| |
Calculates soft shadows for a point on geometry in the scene.
- Parameters
-
| pointOnGeometry | Position in world space |
| time | Scene time in seconds |
| lightPosition | Position of the light in the scene |
- Returns
- Shadow value between 0 and 1
Definition at line 82 of file main.cl.
◆ convertColourTo8Bit()
| uchar3 convertColourTo8Bit |
( |
const float3 |
colour | ) |
|
Converts a colour range 0-1 to an integer colour with range 0-255.
- Parameters
-
| colour | Colour in range 0 to 1 |
- Returns
- An 8-bit colour value, range 0-255
Definition at line 352 of file main.cl.
◆ estimateSurfaceNormal()
| float3 estimateSurfaceNormal |
( |
const float3 |
position, |
|
|
const float |
time |
|
) |
| |
Calculates the surface normal for a any point in the scene.
- Parameters
-
| position | Position in world space |
| time | Scene time in seconds |
- Returns
- Surface normal vector for the position on the geometry
Definition at line 62 of file main.cl.
◆ getCameraRay()
| Ray getCameraRay |
( |
const float2 |
screen_coordinate, |
|
|
const float3 |
camera_position, |
|
|
const float3 |
camera_facing, |
|
|
const float |
aspect_ratio |
|
) |
| |
Creates a ray for the specified position on the camera screen.
- Parameters
-
| screen_coordinate | Position on the screen, range 0-1 for x and y |
| camera_position | Camera position in world units |
| camera_facing | Camera normalised facing direction |
| aspect_ratio | Aspect ratio of the camera |
- Returns
- A Ray
Definition at line 324 of file main.cl.
◆ getSceneInformation()
| __kernel void getSceneInformation |
( |
__global float3 * |
camera_up_axis, |
|
|
const uint |
array_capacity, |
|
|
__global uint * |
number_camera_positions, |
|
|
__global float4 * |
camera_positions_at_time, |
|
|
__global uint * |
number_camera_facing, |
|
|
__global float4 * |
camera_facing_at_time, |
|
|
__global bool * |
do_camera_loop, |
|
|
__global float * |
camera_speed, |
|
|
__global float2 * |
benchmark_start_stop_time |
|
) |
| |
Kernel function used to pass scene information to the C++ interface.
- Parameters
-
| camera_up_axis | Up direction for the camera |
| array_capacity | Max allowed array capacity |
| number_camera_positions | Number of values in the camera positions array |
| camera_positions_at_time | Camera positions array |
| number_camera_facing | Number of values in the camera facing directions array |
| camera_facing_at_time | Camera facing directions array |
| do_camera_loop | Whether the camera should loop back to the start of the camera path once it finishes |
| camera_speed | Speed of the camera when manually controlling the camera |
| benchmark_start_stop_time | Start and stop times when benchmarking |
Definition at line 21 of file main.cl.
◆ if()
◆ reflect()
| float3 reflect |
( |
float3 |
incident, |
|
|
float3 |
normal |
|
) |
| |
◆ trace()
| float3 trace |
( |
const Ray |
ray, |
|
|
const float |
time |
|
) |
| |
Traces the path of a ray.
- Parameters
-
| ray | A ray |
| time | Scene time in seconds |
- Returns
- The colour that the pixel should be drawn as (range 0-1)
Definition at line 161 of file main.cl.
◆ camera_facing
| const uint const uint const float const float3 const float3 camera_facing |
Initial value:{
const int ID = get_global_id(0)
Definition at line 368 of file main.cl.
◆ camera_position
| const uint const uint const float const float3 camera_position |
◆ height
| const uint const uint height |
◆ time
| const uint const uint const float time |
◆ width