2
* Copyright 2011, Blender Foundation.
4
* This program is free software; you can redistribute it and/or
5
* modify it under the terms of the GNU General Public License
6
* as published by the Free Software Foundation; either version 2
7
* of the License, or (at your option) any later version.
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
14
* You should have received a copy of the GNU General Public License
15
* along with this program; if not, write to the Free Software Foundation,
16
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
2
* Copyright 2011-2013 Blender Foundation
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
* you may not use this file except in compliance with the License.
6
* You may obtain a copy of the License at
8
* http://www.apache.org/licenses/LICENSE-2.0
10
* Unless required by applicable law or agreed to in writing, software
11
* distributed under the License is distributed on an "AS IS" BASIS,
12
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
* See the License for the specific language governing permissions and
14
* limitations under the License
19
17
#include "../closure/bsdf_ashikhmin_velvet.h"
47
48
case CLOSURE_BSDF_DIFFUSE_ID:
49
case CLOSURE_BSDF_BSSRDF_ID:
48
50
label = bsdf_diffuse_sample(sc, sd->Ng, sd->I, sd->dI.dx, sd->dI.dy, randu, randv,
49
51
eval, omega_in, &domega_in->dx, &domega_in->dy, pdf);
113
115
label = bsdf_westin_sheen_sample(sc, sd->Ng, sd->I, sd->dI.dx, sd->dI.dy, randu, randv,
114
116
eval, omega_in, &domega_in->dx, &domega_in->dy, pdf);
118
case CLOSURE_BSDF_HAIR_REFLECTION_ID:
119
label = bsdf_hair_reflection_sample(sc, sd->Ng, sd->I, sd->dI.dx, sd->dI.dy, randu, randv,
120
eval, omega_in, &domega_in->dx, &domega_in->dy, pdf);
122
case CLOSURE_BSDF_HAIR_TRANSMISSION_ID:
123
label = bsdf_hair_transmission_sample(sc, sd->Ng, sd->I, sd->dI.dx, sd->dI.dy, randu, randv,
124
eval, omega_in, &domega_in->dx, &domega_in->dy, pdf);
118
128
label = LABEL_NONE;
134
144
if(dot(sd->Ng, omega_in) >= 0.0f) {
135
145
switch(sc->type) {
136
146
case CLOSURE_BSDF_DIFFUSE_ID:
147
case CLOSURE_BSDF_BSSRDF_ID:
137
148
eval = bsdf_diffuse_eval_reflect(sc, sd->I, omega_in, pdf);
186
197
case CLOSURE_BSDF_WESTIN_SHEEN_ID:
187
198
eval = bsdf_westin_sheen_eval_reflect(sc, sd->I, omega_in, pdf);
200
case CLOSURE_BSDF_HAIR_REFLECTION_ID:
201
eval = bsdf_hair_reflection_eval_reflect(sc, sd->I, omega_in, pdf);
203
case CLOSURE_BSDF_HAIR_TRANSMISSION_ID:
204
eval = bsdf_hair_transmission_eval_reflect(sc, sd->I, omega_in, pdf);
191
208
eval = make_float3(0.0f, 0.0f, 0.0f);
196
213
switch(sc->type) {
197
214
case CLOSURE_BSDF_DIFFUSE_ID:
215
case CLOSURE_BSDF_BSSRDF_ID:
198
216
eval = bsdf_diffuse_eval_transmit(sc, sd->I, omega_in, pdf);
241
259
case CLOSURE_BSDF_WESTIN_SHEEN_ID:
242
260
eval = bsdf_westin_sheen_eval_transmit(sc, sd->I, omega_in, pdf);
262
case CLOSURE_BSDF_HAIR_REFLECTION_ID:
263
eval = bsdf_hair_reflection_eval_transmit(sc, sd->I, omega_in, pdf);
265
case CLOSURE_BSDF_HAIR_TRANSMISSION_ID:
266
eval = bsdf_hair_transmission_eval_transmit(sc, sd->I, omega_in, pdf);
246
270
eval = make_float3(0.0f, 0.0f, 0.0f);
314
339
case CLOSURE_BSDF_WESTIN_SHEEN_ID:
315
340
bsdf_westin_sheen_blur(sc, roughness);
342
case CLOSURE_BSDF_HAIR_REFLECTION_ID:
343
case CLOSURE_BSDF_HAIR_TRANSMISSION_ID:
344
bsdf_hair_reflection_blur(sc, roughness);