Skip to content

Commit 1e1f887

Browse files
proper prefixes.
1 parent ee4509b commit 1e1f887

File tree

9 files changed

+386
-405
lines changed

9 files changed

+386
-405
lines changed

examples_tests/18.MitsubaLoader/main.cpp

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,25 +54,26 @@ vec2 SampleSphericalMap(in vec3 v)
5454
return uv;
5555
}
5656
57-
vec3 nbl_computeLighting(inout nbl_glsl_IsotropicViewSurfaceInteraction out_interaction, in mat2 dUV, in nbl_glsl_MC_precomputed_t precomp)
57+
vec3 nbl_computeLighting(inout nbl_glsl_AnisotropicViewSurfaceInteraction out_interaction, in mat2 dUV)
5858
{
5959
nbl_glsl_xoroshiro64star_state_t scramble_start_state = textureLod(scramblebuf,gl_FragCoord.xy/VIEWPORT_SZ,0).rg;
6060
61-
vec3 emissive = nbl_glsl_decodeRGB19E7(InstData.data[InstanceIndex].emissive);
61+
material = nbl_glsl_MC_material_data_t_getOriented(InstData.data[InstanceIndex].material,precomp.frontface);
62+
vec3 emissive = nbl_glsl_MC_oriented_material_t_getEmissive(material);
6263
6364
vec3 color = vec3(0.0);
6465
6566
#ifdef USE_ENVMAP
66-
nbl_glsl_instr_stream_t gcs = getGenChoiceStream(precomp);
67-
nbl_glsl_instr_stream_t rnps = getRemAndPdfStream(precomp);
67+
nbl_glsl_MC_instr_stream_t gcs = nbl_glsl_MC_oriented_material_t_getGenChoiceStream(material);
68+
nbl_glsl_MC_instr_stream_t rnps = nbl_glsl_MC_oriented_material_t_getRemAndPdfStream(material);
6869
for (int i = 0; i < SAMPLE_COUNT; ++i)
6970
{
7071
nbl_glsl_xoroshiro64star_state_t scramble_state = scramble_start_state;
7172
7273
vec3 rand = rand3d(i,scramble_state);
7374
float pdf;
7475
nbl_glsl_LightSample s;
75-
vec3 rem = nbl_glsl_runGenerateAndRemainderStream(precomp, gcs, rnps, rand, pdf, s);
76+
vec3 rem = nbl_glsl_MC_runGenerateAndRemainderStream(precomp, gcs, rnps, rand, pdf, s);
7677
7778
vec2 uv = SampleSphericalMap(s.L);
7879
color += rem*textureLod(envMap, uv, 0.0).xyz;
@@ -84,9 +85,10 @@ vec3 nbl_computeLighting(inout nbl_glsl_IsotropicViewSurfaceInteraction out_inte
8485
{
8586
SLight l = lights[i];
8687
vec3 L = l.position-WorldPos;
87-
//params.L = L;
8888
const float intensityScale = LIGHT_INTENSITY_SCALE;//ehh might want to render to hdr fbo and do tonemapping
89-
color += nbl_bsdf_cos_eval(precomp, normalize(L), out_interaction, dUV)*l.intensity*intensityScale / dot(L,L);
89+
nbl_glsl_LightSample _sample;
90+
_sample.L = L;
91+
color += nbl_bsdf_cos_eval(_sample,out_interaction, dUV)*l.intensity*intensityScale / dot(L,L);
9092
}
9193
9294
return color+emissive;

include/nbl/asset/material_compiler/CMaterialCompilerGLSLBackendCommon.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ class CMaterialCompilerGLSLBackendCommon
197197
case OP_DIFFUSE: [[fallthrough]];
198198
case OP_CONDUCTOR: [[fallthrough]];
199199
case OP_DIELECTRIC: [[fallthrough]];
200-
case OP_DIFFTRANS: [[fallthrough]];
200+
case OP_DIFFTRANS:
201201
return 2u;
202202
case OP_COATING: [[fallthrough]];
203203
case OP_BLEND: [[fallthrough]];
@@ -628,6 +628,7 @@ class CMaterialCompilerGLSLBackendCommon
628628

629629
struct result_t
630630
{
631+
// TODO: should probably use <nbl/builtin/glsl/material_compiler/common_invariant_declarations.glsl> here, actually material compiler should just make `nbl_glsl_MC_oriented_material_t`
631632
struct instr_streams_t
632633
{
633634
struct stream_t

include/nbl/builtin/glsl/ext/MitsubaLoader/instance_data_struct.glsl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ struct nbl_glsl_ext_Mitsuba_Loader_instance_data_t
1313
uint padding1;
1414
vec3 normalMatrixRow2;
1515
float determinant;
16-
nbl_glsl_MC_MaterialData material;
16+
nbl_glsl_MC_material_data_t material;
1717
};
1818

1919

0 commit comments

Comments
 (0)