@@ -71,83 +71,6 @@ RadeonProRender::float4 sRGB_to_ACEScg(const RadeonProRender::float4& srgb)
71
71
}
72
72
73
73
74
- // create a simple quad shape
75
- rpr_shape CreateQuad (rpr_context context, rpr_scene scene, vertex* meshVertices, unsigned int meshVertices_nbOfElement )
76
- {
77
- rpr_int indices[] = { 3 ,2 ,1 ,0 , };
78
- rpr_int num_face_vertices[] = { 4 , };
79
-
80
- const unsigned int num_face_vertices_nbOfElement = sizeof (num_face_vertices)/sizeof (num_face_vertices[0 ]);
81
-
82
- rpr_shape mesh = nullptr ;
83
-
84
- CHECK ( rprContextCreateMesh (context,
85
- (rpr_float const *)&meshVertices[0 ], meshVertices_nbOfElement , sizeof (vertex),
86
- (rpr_float const *)((char *)&meshVertices[0 ] + sizeof (rpr_float)*3 ), meshVertices_nbOfElement, sizeof (vertex),
87
- (rpr_float const *)((char *)&meshVertices[0 ] + sizeof (rpr_float)*6 ), meshVertices_nbOfElement, sizeof (vertex),
88
- (rpr_int const *)indices, sizeof (rpr_int),
89
- (rpr_int const *)indices, sizeof (rpr_int),
90
- (rpr_int const *)indices, sizeof (rpr_int),
91
- num_face_vertices, num_face_vertices_nbOfElement, &mesh) );
92
-
93
- if ( scene ) { CHECK ( rprSceneAttachShape (scene, mesh) ); }
94
-
95
- return mesh;
96
- }
97
-
98
- // Create a Quad shape on the YZ plane
99
- rpr_shape CreateQuad_YZ (rpr_context context, rpr_scene scene, float ax, float ay, float bx, float by, float X)
100
- {
101
- vertex meshVertices[] =
102
- {
103
- { X, ax, by, 1 .0f , 0 .0f , 0 .0f , 0 .0f , 0 .0f },
104
- { X, bx, by, 1 .0f , 0 .0f , 0 .0f , 1 .0f , 0 .0f },
105
- { X, bx, ay, 1 .0f , 0 .0f , 0 .0f , 1 .0f , 1 .0f },
106
- { X, ax, ay, 1 .0f , 0 .0f , 0 .0f , 0 .0f , 1 .0f },
107
- };
108
-
109
- const unsigned int meshVertices_nbOfElement = sizeof (meshVertices)/sizeof (meshVertices[0 ]);
110
-
111
- rpr_shape mesh = CreateQuad (context, scene, meshVertices, meshVertices_nbOfElement);
112
- return mesh;
113
- }
114
-
115
- // Create a Quad shape on the XZ plane
116
- rpr_shape CreateQuad_XZ (rpr_context context, rpr_scene scene, float ax, float ay, float bx, float by, float Y, float normal)
117
- {
118
- vertex meshVertices[] =
119
- {
120
- { ax, Y, by, 0 .0f , normal, 0 .0f , 0 .0f , 0 .0f },
121
- { bx, Y, by, 0 .0f , normal, 0 .0f , 1 .0f , 0 .0f },
122
- { bx, Y, ay, 0 .0f , normal, 0 .0f , 1 .0f , 1 .0f },
123
- { ax, Y, ay, 0 .0f , normal, 0 .0f , 0 .0f , 1 .0f },
124
- };
125
-
126
- const unsigned int meshVertices_nbOfElement = sizeof (meshVertices)/sizeof (meshVertices[0 ]);
127
-
128
- rpr_shape mesh = CreateQuad (context, scene, meshVertices, meshVertices_nbOfElement);
129
- return mesh;
130
- }
131
-
132
- // Create a Quad shape on the XY plane
133
- rpr_shape CreateQuad_XY (rpr_context context, rpr_scene scene, float ax, float ay, float bx, float by, float Z)
134
- {
135
- vertex meshVertices[] =
136
- {
137
- { ax, by, Z, 0 .0f , 0 .0f , 1 .0f , 0 .0f , 0 .0f },
138
- { bx, by, Z, 0 .0f , 0 .0f , 1 .0f , 1 .0f , 0 .0f },
139
- { bx, ay, Z, 0 .0f , 0 .0f , 1 .0f , 1 .0f , 1 .0f },
140
- { ax, ay, Z, 0 .0f , 0 .0f , 1 .0f , 0 .0f , 1 .0f },
141
- };
142
-
143
- const unsigned int meshVertices_nbOfElement = sizeof (meshVertices)/sizeof (meshVertices[0 ]);
144
-
145
- rpr_shape mesh = CreateQuad (context, scene, meshVertices, meshVertices_nbOfElement);
146
- return mesh;
147
- }
148
-
149
-
150
-
151
74
152
75
int main ()
153
76
{
@@ -342,35 +265,21 @@ int main()
342
265
const float lightX1 = lightX0 + 0 .8f ;
343
266
const float lightX2 = 4 .0f - 0 .4f - 0 .8f ;
344
267
const float lightX3 = lightX2 + 0 .8f ;
345
- rpr_shape roof0 = CreateQuad_XZ (context, scene, -4 .0f , -2 .0f , lightX0, +2 .0f , roofY, -1 .0f );
346
- rpr_shape roof1 = CreateQuad_XZ (context, scene, lightX0, -2 .0f , lightX1 , -2 .0f +0.8 *2 .0f , roofY, -1 .0f );
347
- rpr_shape roof2 = CreateQuad_XZ (context, scene, lightX0, -2 .0f +0.8 *3 .0f , lightX1 , +2 .0f , roofY, -1 .0f );
348
- rpr_shape roofLightLeft = CreateQuad_XZ (context, scene, lightX0, -2 .0f +0.8 *2 .0f , lightX1 , -2 .0f +0.8 *3 .0f , roofY, -1 .0f );
349
- rpr_shape roof3 = CreateQuad_XZ (context, scene, lightX1, -2 .0f , lightX2, +2 .0f , roofY, -1 .0f );
350
- rpr_shape roof4 = CreateQuad_XZ (context, scene, lightX2, -2 .0f , lightX3 , -2 .0f +0.8 *2 .0f , roofY, -1 .0f );
351
- rpr_shape roof5 = CreateQuad_XZ (context, scene, lightX2, -2 .0f +0.8 *3 .0f , lightX3 , +2 .0f , roofY, -1 .0f );
352
- rpr_shape roofLightRight = CreateQuad_XZ (context, scene, lightX2, -2 .0f +0.8 *2 .0f , lightX3 , -2 .0f +0.8 *3 .0f , roofY, -1 .0f );
353
- rpr_shape roof6 = CreateQuad_XZ (context, scene, lightX3, -2 .0f , 4 .0f , +2 .0f , roofY, -1 .0f );
354
- rpr_shape floor = CreateQuad_XZ (context, scene, -4 .0f , -2 .0f , +4 .0f , +2 .0f , 0 .0f , +1 .0f );
355
- rpr_shape shapeWallLeft = CreateQuad_YZ (context, scene, 0.0 , -2 .0f , roofY, +2 .0f , -4 .0f );
356
- rpr_shape shapeWallRight = CreateQuad_YZ (context, scene, 0.0 , -2 .0f , roofY, +2 .0f , +4 .0f );
357
- rpr_shape shapeWallBack = CreateQuad_XY (context, scene, -4.0 , 0.0 , +4 .0f , roofY , -2 .0f );
358
- rpr_shape pictureShape = CreateQuad_XY (context, scene, 0.0 , 0.3 , +3 .5f , roofY-0 .3f , -1 .9f );
359
- g_gc.GCAdd (roof0);
360
- g_gc.GCAdd (roof1);
361
- g_gc.GCAdd (roof2);
362
- g_gc.GCAdd (roofLightLeft);
363
- g_gc.GCAdd (roof3);
364
- g_gc.GCAdd (roof4);
365
- g_gc.GCAdd (roof5);
366
- g_gc.GCAdd (roofLightRight);
367
- g_gc.GCAdd (roof6);
368
- g_gc.GCAdd (floor);
369
- g_gc.GCAdd (shapeWallLeft);
370
- g_gc.GCAdd (shapeWallRight);
371
- g_gc.GCAdd (shapeWallBack);
372
- g_gc.GCAdd (pictureShape);
373
-
268
+ rpr_shape roof0 = CreateQuad_XZ (g_gc, context, scene, -4 .0f , -2 .0f , lightX0, +2 .0f , roofY, -1 .0f );
269
+ rpr_shape roof1 = CreateQuad_XZ (g_gc, context, scene, lightX0, -2 .0f , lightX1 , -2 .0f +0.8 *2 .0f , roofY, -1 .0f );
270
+ rpr_shape roof2 = CreateQuad_XZ (g_gc, context, scene, lightX0, -2 .0f +0.8 *3 .0f , lightX1 , +2 .0f , roofY, -1 .0f );
271
+ rpr_shape roofLightLeft = CreateQuad_XZ (g_gc, context, scene, lightX0, -2 .0f +0.8 *2 .0f , lightX1 , -2 .0f +0.8 *3 .0f , roofY, -1 .0f );
272
+ rpr_shape roof3 = CreateQuad_XZ (g_gc, context, scene, lightX1, -2 .0f , lightX2, +2 .0f , roofY, -1 .0f );
273
+ rpr_shape roof4 = CreateQuad_XZ (g_gc, context, scene, lightX2, -2 .0f , lightX3 , -2 .0f +0.8 *2 .0f , roofY, -1 .0f );
274
+ rpr_shape roof5 = CreateQuad_XZ (g_gc, context, scene, lightX2, -2 .0f +0.8 *3 .0f , lightX3 , +2 .0f , roofY, -1 .0f );
275
+ rpr_shape roofLightRight = CreateQuad_XZ (g_gc, context, scene, lightX2, -2 .0f +0.8 *2 .0f , lightX3 , -2 .0f +0.8 *3 .0f , roofY, -1 .0f );
276
+ rpr_shape roof6 = CreateQuad_XZ (g_gc, context, scene, lightX3, -2 .0f , 4 .0f , +2 .0f , roofY, -1 .0f );
277
+ rpr_shape floor = CreateQuad_XZ (g_gc, context, scene, -4 .0f , -2 .0f , +4 .0f , +2 .0f , 0 .0f , +1 .0f );
278
+ rpr_shape shapeWallLeft = CreateQuad_YZ (g_gc, context, scene, 0.0 , -2 .0f , roofY, +2 .0f , -4 .0f , 1 .0f );
279
+ rpr_shape shapeWallRight = CreateQuad_YZ (g_gc, context, scene, 0.0 , -2 .0f , roofY, +2 .0f , +4 .0f , 1 .0f );
280
+ rpr_shape shapeWallBack = CreateQuad_XY (g_gc, context, scene, -4.0 , 0.0 , +4 .0f , roofY , -2 .0f , 1 .0f );
281
+ rpr_shape pictureShape = CreateQuad_XY (g_gc, context, scene, 0.0 , 0.3 , +3 .5f , roofY-0 .3f , -1 .9f , 1 .0f );
282
+
374
283
375
284
// create material for the left wall
376
285
{
0 commit comments