equal
deleted
inserted
replaced
57 phase = -1; |
57 phase = -1; |
58 return 0; |
58 return 0; |
59 } |
59 } |
60 } |
60 } |
61 |
61 |
62 Sample* DefaultSampler::nextSample() |
62 bool DefaultSampler::nextSample(Sample* s) |
63 { |
63 { |
64 DefaultSample *s = new DefaultSample; |
|
65 |
|
66 /* grid oversampling */ |
64 /* grid oversampling */ |
67 static const int gridsamples[] = {1,5,9,16}; |
65 static const int gridsamples[] = {1,5,9,16}; |
68 static const Float osa5x[] = {0.0, -0.4, +0.4, +0.4, -0.4}; |
66 static const Float osa5x[] = {0.0, -0.4, +0.4, +0.4, -0.4}; |
69 static const Float osa5y[] = {0.0, -0.4, -0.4, +0.4, +0.4}; |
67 static const Float osa5y[] = {0.0, -0.4, -0.4, +0.4, +0.4}; |
70 static const Float osa9x[] = {-0.34, 0.00, +0.34, |
68 static const Float osa9x[] = {-0.34, 0.00, +0.34, |
107 if (sx >= w) |
105 if (sx >= w) |
108 { |
106 { |
109 sx = 0; |
107 sx = 0; |
110 sy++; |
108 sy++; |
111 } |
109 } |
|
110 |
112 if (sy >= h) |
111 if (sy >= h) |
113 { |
112 return false; |
114 delete s; |
113 |
115 return NULL; |
|
116 } |
|
117 s->x = (Float)sx/h - (Float)w/h/2.0; |
114 s->x = (Float)sx/h - (Float)w/h/2.0; |
118 s->y = (Float)sy/h - 0.5; |
115 s->y = (Float)sy/h - 0.5; |
119 osa_samp = 0; |
116 osa_samp = 0; |
120 } |
117 } |
121 } |
118 } |
131 } |
128 } |
132 |
129 |
133 s->sx = sx; |
130 s->sx = sx; |
134 s->sy = sy; |
131 s->sy = sy; |
135 s->osa_samp = osa_samp; |
132 s->osa_samp = osa_samp; |
136 return s; |
133 |
|
134 return true; |
137 } |
135 } |
138 |
136 |
139 void DefaultSampler::saveSample(Sample *samp, Colour &col) |
137 void DefaultSampler::saveSample(Sample &samp, Colour &col) |
140 { |
138 { |
141 DefaultSample *sp = static_cast<DefaultSample*>(samp); |
139 Float *buf = buffer + 3*(samp.sy * w + samp.sx); |
142 Float *buf = buffer + 3*(sp->sy*w + sp->sx); |
|
143 if (oversample) |
140 if (oversample) |
144 { |
141 { |
145 *(buf+0) += col.r; |
142 *(buf+0) += col.r; |
146 *(buf+1) += col.g; |
143 *(buf+1) += col.g; |
147 *(buf+2) += col.b; |
144 *(buf+2) += col.b; |