equal
deleted
inserted
replaced
25 };*/ |
25 };*/ |
26 |
26 |
27 void texture2D(Float u, Float v, Float &r, Float &g, Float &b) |
27 void texture2D(Float u, Float v, Float &r, Float &g, Float &b) |
28 { |
28 { |
29 // checkers |
29 // checkers |
30 r = fabs((int)(u*4.4)%2 + (int)(v*4.4)%2 - 1); |
30 r = fabs((int)(u*4.2)%2 + (int)(v*4.2)%2 - 1); |
31 g=r; b=r; |
31 g=r; b=r; |
32 } |
32 } |
33 |
33 |
34 class PlanarMapTexture: public Texture |
34 class PlanarMapTexture: public Texture |
35 { |
35 { |
58 Float u,v; |
58 Float u,v; |
59 if (fabs(point.x) > fabs(point.y)) |
59 if (fabs(point.x) > fabs(point.y)) |
60 { |
60 { |
61 if (fabs(point.x) > fabs(point.z)) |
61 if (fabs(point.x) > fabs(point.z)) |
62 { |
62 { |
63 u = point.y; |
63 if (point.x < 0) |
|
64 u = -point.y; |
|
65 else |
|
66 u = point.y; |
64 v = point.z; |
67 v = point.z; |
65 } |
68 } |
66 else |
69 else |
67 { |
70 { |
68 u = point.x; |
71 if (point.z < 0) |
|
72 u = -point.x; |
|
73 else |
|
74 u = point.x; |
69 v = point.y; |
75 v = point.y; |
70 } |
76 } |
71 } |
77 } |
72 else |
78 else |
73 { |
79 { |
74 if (fabs(point.y) > fabs(point.z)) |
80 if (fabs(point.y) > fabs(point.z)) |
75 { |
81 { |
76 u = point.x; |
82 if (point.y < 0) |
|
83 u = -point.x; |
|
84 else |
|
85 u = point.x; |
77 v = point.z; |
86 v = point.z; |
78 } |
87 } |
79 else |
88 else |
80 { |
89 { |
81 u = point.x; |
90 if (point.z < 0) |
|
91 u = -point.x; |
|
92 else |
|
93 u = point.x; |
82 v = point.y; |
94 v = point.y; |
83 } |
95 } |
84 } |
96 } |
85 u += 1000; |
97 u += 1000; |
86 v += 1000; |
98 v += 1000; |
264 { |
276 { |
265 pyrit_verbosity = 2; |
277 pyrit_verbosity = 2; |
266 Float *fdata = (Float *) malloc(w*h*3*sizeof(Float)); |
278 Float *fdata = (Float *) malloc(w*h*3*sizeof(Float)); |
267 rt.setOversample(2); |
279 rt.setOversample(2); |
268 rt.setSubsample(1); |
280 rt.setSubsample(1); |
|
281 rt.ambientocclusion(300, 5.0, 0.5); |
269 rt.render(w, h, fdata); |
282 rt.render(w, h, fdata); |
270 |
283 |
271 struct image *img; |
284 struct image *img; |
272 new_image(&img, w, h, 3); |
285 new_image(&img, w, h, 3); |
273 |
286 |