Lightmetrica  0.0.1.50dbee3 (yosakoi)
 All Classes Functions Variables Typedefs Enumerations Enumerator
testscenes.h
1 /*
2  Lightmetrica : A research-oriented renderer
3 
4  Copyright (c) 2014 Hisanari Otsu
5 
6  This program is free software: you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  This program is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19 
20 #pragma once
21 #ifndef LIB_LIGHTMETRICA_TEST_TEST_SCENES_H
22 #define LIB_LIGHTMETRICA_TEST_TEST_SCENES_H
23 
24 #include "common.h"
25 #include <string>
26 
27 LM_NAMESPACE_BEGIN
28 LM_TEST_NAMESPACE_BEGIN
29 
37 {
38 private:
39 
40  TestScenes();
41  LM_DISABLE_COPY_AND_MOVE(TestScenes);
42 
43 public:
44 
45  static std::string Simple03()
46  {
47  return LM_TEST_MULTILINE_LITERAL(
48  <assets>
49  <triangle_meshes>
50  <triangle_mesh id="quad" type="raw">
51  <positions>
52  -0.1 0 -0.1
53  -0.1 0 0.1
54  0.1 0 0.1
55  0.1 0 -0.1
56  </positions>
57  <normals>
58  0 -1 0
59  0 -1 0
60  0 -1 0
61  0 -1 0
62  </normals>
63  <faces>
64  0 2 1
65  0 3 2
66  </faces>
67  </triangle_mesh>
68  </triangle_meshes>
69  <bsdfs>
70  <bsdf id="diffuse_white" type="diffuse">
71  <diffuse_reflectance>
72  <color>0.9 0.9 0.9</color>
73  </diffuse_reflectance>
74  </bsdf>
75  <bsdf id="diffuse_black" type="diffuse">
76  <diffuse_reflectance>
77  <color>0 0 0</color>
78  </diffuse_reflectance>
79  </bsdf>
80  <bsdf id="diffuse_red" type="diffuse">
81  <diffuse_reflectance>
82  <color>0.9 0.1 0.1</color>
83  </diffuse_reflectance>
84  </bsdf>
85  <bsdf id="diffuse_green" type="diffuse">
86  <diffuse_reflectance>
87  <color>0.1 0.9 0.1</color>
88  </diffuse_reflectance>
89  </bsdf>
90  </bsdfs>
91  <films>
92  <film id="film_1" type="hdr">
93  <width>500</width>
94  <height>500</height>
95  <imagetype>radiancehdr</imagetype>
96  </film>
97  </films>
98  <cameras>
99  <camera id="camera_1" type="perspective">
100  <film ref="film_1" />
101  <fovy>45</fovy>
102  </camera>
103  </cameras>
104  <lights>
105  <light id="light_1" type="area">
106  <luminance>2 2 2</luminance>
107  </light>
108  </lights>
109  </assets>
110  <scene type="naive">
111  <root>
112  <node>
113  <transform>
114  <lookat>
115  <position>0 0.1 0.3</position>
116  <center>0 0.1 0</center>
117  <up>0 1 0</up>
118  </lookat>
119  </transform>
120  <camera ref="camera_1" />
121  </node>
122  <node>
123  <transform>
124  <rotate>
125  <angle>-90</angle>
126  <axis>1 0 0</axis>
127  </rotate>
128  <translate>0 0.1 -0.1</translate>
129  </transform>
130  <triangle_mesh ref="quad" />
131  <bsdf ref="diffuse_white" />
132  </node>
133  <node>
134  <transform>
135  <translate>0 0.2 0</translate>
136  </transform>
137  <triangle_mesh ref="quad" />
138  <light ref="light_1" />
139  <bsdf ref="diffuse_black" />
140  </node>
141  </root>
142  </scene>
143  );
144  }
145 
146  static std::string Simple05()
147  {
148  return LM_TEST_MULTILINE_LITERAL(
149  <assets>
150  <triangle_meshes>
151  <triangle_mesh id="quad" type="raw">
152  <positions>
153  -0.1 0 -0.1
154  -0.1 0 0.1
155  0.1 0 0.1
156  0.1 0 -0.1
157  </positions>
158  <normals>
159  0 -1 0
160  0 -1 0
161  0 -1 0
162  0 -1 0
163  </normals>
164  <faces>
165  0 2 1
166  0 3 2
167  </faces>
168  </triangle_mesh>
169  </triangle_meshes>
170  <bsdfs>
171  <bsdf id="diffuse_white" type="diffuse">
172  <diffuse_reflectance>
173  <color>0.9 0.9 0.9</color>
174  </diffuse_reflectance>
175  </bsdf>
176  <bsdf id="glass" type="dielectric">
177  <specular_reflectance>1 0.5 0.5</specular_reflectance>
178  <specular_transmittance>1 0.5 0.5</specular_transmittance>
179  <external_ior>1</external_ior>
180  <internal_ior>1.458</internal_ior>
181  </bsdf>
182  </bsdfs>
183  <films>
184  <film id="film_1" type="hdr">
185  <width>500</width>
186  <height>500</height>
187  <imagetype>radiancehdr</imagetype>
188  </film>
189  </films>
190  <cameras>
191  <camera id="camera_1" type="perspective">
192  <film ref="film_1" />
193  <fovy>45</fovy>
194  </camera>
195  </cameras>
196  <lights>
197  <light id="light_1" type="area">
198  <luminance>2 2 2</luminance>
199  </light>
200  </lights>
201  </assets>
202  <scene type="naive">
203  <root>
204  <node>
205  <transform>
206  <lookat>
207  <position>0 0.1 0.3</position>
208  <center>0 0.1 0</center>
209  <up>0 1 0</up>
210  </lookat>
211  </transform>
212  <camera ref="camera_1" />
213  </node>
214  <node>
215  <transform>
216  <translate>0 0.2 0</translate>
217  </transform>
218  <triangle_mesh ref="quad" />
219  <light ref="light_1" />
220  <bsdf ref="diffuse_white" />
221  </node>
222  <node>
223  <transform>
224  <rotate>
225  <angle>-90</angle>
226  <axis>1 0 0</axis>
227  </rotate>
228  <translate>0 0.1 -0.1</translate>
229  </transform>
230  <triangle_mesh ref="quad" />
231  <bsdf ref="diffuse_white" />
232  </node>
233  <node>
234  <transform>
235  <rotate>
236  <angle>180</angle>
237  <axis>1 0 0</axis>
238  </rotate>
239  <translate>0 0.02 0</translate>
240  <scale>0.5 0.5 0.5</scale>
241  </transform>
242  <triangle_mesh ref="quad" />
243  <bsdf ref="glass" />
244  </node>
245  <node>
246  <transform>
247  <rotate>
248  <angle>180</angle>
249  <axis>1 0 0</axis>
250  </rotate>
251  </transform>
252  <triangle_mesh ref="quad" />
253  <bsdf ref="diffuse_white" />
254  </node>
255  </root>
256  </scene>
257  );
258  }
259 
260 };
261 
262 LM_TEST_NAMESPACE_END
263 LM_NAMESPACE_END
264 
265 #endif // LIB_LIGHTMETRICA_TEST_TEST_SCENES_H
Definition: testscenes.h:36