fix texture loading
[cltracer.git] / types.h
blob40ab5bd12e1dc28afe18dbbd0d8204104888cd89
1 /*
2 * This program is free software: you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation, either version 3 of the License, or
5 * (at your option) any later version.
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
12 * You should have received a copy of the GNU General Public License
13 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 * Copyright (C) 2010 Pavel Herrmann (morpheus.ibis@gmail.com)
20 #ifndef _TYPES_H_
21 #define _TYPES_H_ 1
23 #ifndef __OPENCL_VERSION__
24 #include <CL/cl.h>
25 #include <CL/cl_platform.h>
26 typedef cl_float3 float3;
27 typedef cl_float2 float2;
28 typedef cl_int3 int3;
29 typedef cl_int2 int2;
31 #endif
34 struct triangle_s
36 float3 spaceCoords[3];
37 float3 normalCoords[3];
38 float2 textureCoords[3];
39 int objectIndex;
42 typedef struct triangle_s triangle_t;
44 struct pixel_s
46 float3 color;
47 float fill;
48 unsigned int lock;
52 struct reconstruct_s
54 int pixelNumber;
55 float importance;
56 unsigned int randomSeed;
60 struct ray_s
62 float3 origin;
63 float3 direction;
64 struct reconstruct_s reconstructInfo;
67 typedef struct ray_s ray_t;
69 struct hit_s
71 float3 baryCoords;
72 float3 rayDirection;
73 int triIndex;
74 struct reconstruct_s reconstructInfo;
77 typedef struct hit_s hit_t;
79 struct dummyaccel_s
81 #ifdef __OPENCL_VERSION__
82 int triangleCount;
83 #else
84 cl_int triangleCount;
85 #endif
88 typedef struct dummyaccel_s dummyaccel_t;
90 struct gridinfo_s
92 float3 minDimension;
93 float3 maxDimension;
94 float3 cellSize;
95 int3 cellCount;
98 typedef struct gridinfo_s gridinfo_t;
100 struct gridaccel_s
102 #ifdef __OPENCL_VERSION__
103 __global const struct gridinfo_s * gridinfo;
104 __global const int * grid;
105 __global const int * cells;
106 #else
107 cl_mem gridinfo;
108 cl_mem grid;
109 cl_mem cells;
110 #endif
113 typedef struct gridaccel_s gridaccel_t;
115 struct accel_s
117 int type;
118 union
120 struct dummyaccel_s dummy;
121 struct gridaccel_s grid;
125 #define ACCEL_DUMMY 0
126 #define ACCEL_GRID 1
128 typedef struct accel_s accel_t;
131 struct texinfo_s
133 unsigned char * data;
134 int3 dimensions;
135 int bpp;
138 typedef struct texinfo_s texinfo_t;
140 struct mtl_def_s
142 int texcount;
143 char** texnames;
144 int* texidx;
147 typedef struct mtl_def_s mtl_def_t;
149 struct omni_light_s
151 float3 position;
154 struct directional_light_s
156 float3 direction;
159 struct spot_light_s
161 float3 position;
162 float3 direction;
163 float coneangle;
164 float cutoff;
168 struct light_s
170 float3 color;
171 float intensity;
172 int type;
173 union
175 struct omni_light_s omni;
176 struct directional_light_s directional;
177 struct spot_light_s spot;
181 #define LIGHT_AMBIENT 0
182 #define LIGHT_OMNI 1
183 #define LIGHT_DIRECTIONAL 2
184 #define LIGHT_SPOT 3
186 typedef struct light_s light_t;
188 struct light_sample_s
190 float3 color;
191 float intensity;
192 float3 direction;
195 typedef struct light_sample_s light_sample_t;
197 #endif //_TYPES_H_