Skip to content

Commit

Permalink
BaryWire + Texture3D and clang warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
mklefrancois committed May 17, 2023
1 parent 3ee3081 commit b38052d
Show file tree
Hide file tree
Showing 53 changed files with 1,982 additions and 1,070 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ If you are new to this repository, the first samples to read to better understan
| [simple_polygons](samples/simple_polygons) | Rasterizing multiple polygonal objects. | ![](samples/simple_polygons/docs/simple_polygons_th.jpg) |
| [offscreen](samples/offscreen) | Render without window context and save image to disk. | ![](samples/offscreen/docs/offline_th.jpg) |
| [tiny_shader_toy](samples/tiny_shader_toy) | Compile shader on the fly, diplay compilation errors, multiple pipeline stages. | ![](samples/tiny_shader_toy/docs/tiny_shader_toy_th.jpg) |

| [barycentric_wireframe](samples/barycentric_wireframe) | Draw wifreframe in a a single pass using `gl_BaryCoordNV` | ![](samples/barycentric_wireframe/docs/bary_wireframe_th.jpg) |
| [texture 3d](samples/texture_3d) | Create a 3D texture and do ray marching. | ![](samples/texture_3d/docs/texture_3d_th.jpg) |

## LICENSE

Expand Down
8 changes: 4 additions & 4 deletions common/bird_curve_helper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ std::size_t makeHash(const nvmath::vec3f& v)
{
return hashVal(v.x, v.y, v.z);
}
auto hash = [&](const nvmath::vec3f& v) { return makeHash(v); };
auto equal = [&](const nvmath::vec3f& l, const nvmath::vec3f& r) { return l == r; };
auto hash = [](const nvmath::vec3f& v) { return makeHash(v); };
auto equal = [](const nvmath::vec3f& l, const nvmath::vec3f& r) { return l == r; };


static std::unordered_map<nvmath::vec3f, uint32_t, decltype(hash), decltype(equal)> buildMap(const BirdCurveHelper::BaryCoordinates& bary_coords)
Expand Down Expand Up @@ -167,7 +167,7 @@ void BirdCurveHelper::birdLevel(int level,
const nvmath::vec3f& u,
const nvmath::vec3f& v)
{
m_triBary[level - 1].push_back({w, u, v}); // Adding triangle barycentric coordinates
m_triBary[level - 1ULL].push_back({w, u, v}); // Adding triangle barycentric coordinates

if(level >= m_birdValues.size())
return;
Expand Down Expand Up @@ -320,7 +320,7 @@ static inline float __uint_as_float(uint32_t x)
{
float f;
uint32_t i;
} var;
} var{};
var.i = x;
return var.f;
}
Expand Down
2 changes: 1 addition & 1 deletion common/bird_curve_helper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class BirdCurveHelper

DisplacementBlocks createDisplacementBlocks(uint32_t level); // Return the displacement blocks: block of indices for unorm11 uncompressed

static void BirdCurveHelper::micro2bary(uint32_t index, uint32_t subdivisionLevel, nvmath::vec3f& uv0, nvmath::vec3f& uv1, nvmath::vec3f& uv2);
static void micro2bary(uint32_t index, uint32_t subdivisionLevel, nvmath::vec3f& uv0, nvmath::vec3f& uv1, nvmath::vec3f& uv2);

private:
void init(const nvmath::vec3f& w, const nvmath::vec3f& u, const nvmath::vec3f& v);
Expand Down
204 changes: 1 addition & 203 deletions media/cornellBox.gltf
Original file line number Diff line number Diff line change
Expand Up @@ -507,198 +507,26 @@
"type": "perspective"
}
],
"extensions": {
"NV_materials_mdl": {
"modules": [
"mdl::base",
"mdl::gltf_support",
"mdl::nvidia::core_definitions",
"mdl::state"
],
"shaders": [
{
"arguments": {
"texture": 0
},
"definition": "mdl::base::environment_spherical(texture_2d)",
"name": "env_shd"
},
{
"arguments": {
"metallic_factor": 0.0
},
"definition": "mdl::gltf_support::gltf_material",
"hash": [
"0x2b557fab",
"0x5f2f13b5",
"0x5dbe3123",
"0x469f59c1"
],
"name": "cube_instance_material"
},
{
"arguments": {
"metallic_factor": 0.0
},
"definition": "mdl::gltf_support::gltf_material",
"hash": [
"0x2b557fab",
"0x5f2f13b5",
"0x5dbe3123",
"0x469f59c1"
],
"name": "cube_instance_2_material"
},
{
"arguments": {
"base_color_factor": [
0.054592281579971313,
1.0,
0.0
]
},
"definition": "mdl::gltf_support::gltf_material",
"hash": [
"0x2b557fab",
"0x5f2f13b5",
"0x5dbe3123",
"0x469f59c1"
],
"name": "gltf_material_mat"
},
{
"arguments": {
"base_color_factor": [
1.0,
0.0,
0.00010718735575210303
],
"metallic_factor": 0.0
},
"definition": "mdl::gltf_support::gltf_material",
"hash": [
"0x2b557fab",
"0x5f2f13b5",
"0x5dbe3123",
"0x469f59c1"
],
"name": "cube_instance_5_material"
},
{
"arguments": {
"emissive_factor": [
10.0,
10.0,
10.0
],
"metallic_factor": 0.0,
"roughness_factor": 0.0
},
"definition": "mdl::gltf_support::gltf_material",
"hash": [
"0x2b557fab",
"0x5f2f13b5",
"0x5dbe3123",
"0x469f59c1"
],
"name": "cube_instance_8_material"
},
{
"arguments": {
"normal=": 7
},
"definition": "mdl::nvidia::core_definitions::flex_material",
"hash": [
"0xcdccb2f5",
"0xccfa4281",
"0x41aa45c6",
"0x53936269"
],
"name": "cube_instance_14_material"
},
{
"definition": "mdl::state::normal()",
"name": "mdl::state::normal_801"
},
{
"definition": "mdl::gltf_support::gltf_material",
"hash": [
"0x2b557fab",
"0x5f2f13b5",
"0x5dbe3123",
"0x469f59c1"
],
"name": "cube_instance_16_material"
},
{
"arguments": {
"normal=": 10
},
"definition": "mdl::nvidia::core_definitions::thick_glass",
"hash": [
"0x45a51489",
"0x068b105e",
"0xcfed7f3b",
"0x1b45b4f8"
],
"name": "sphere_instance_material"
},
{
"definition": "mdl::state::normal()",
"name": "mdl::state::normal_804"
},
{
"arguments": {
"roughness_factor": 0.0
},
"definition": "mdl::gltf_support::gltf_material",
"hash": [
"0x2b557fab",
"0x5f2f13b5",
"0x5dbe3123",
"0x469f59c1"
],
"name": "sphere_instance_22_material"
}
]
}
},
"extensionsUsed": [
"NV_materials_mdl",
"KHR_lights_punctual"
],
"materials": [
{
"doubleSided": true,
"extensions": {
"NV_materials_mdl": {
"mdl_shader": 1
}
},
"doubleSided": true,
"name": "cube_instance_material",
"pbrMetallicRoughness": {
"metallicFactor": 0.0
}
},
{
"doubleSided": true,
"extensions": {
"NV_materials_mdl": {
"mdl_shader": 2
}
},
"name": "cube_instance_2_material",
"pbrMetallicRoughness": {
"metallicFactor": 0.0
}
},
{
"doubleSided": true,
"extensions": {
"NV_materials_mdl": {
"mdl_shader": 3
}
},
"name": "gltf_material_mat",
"pbrMetallicRoughness": {
"baseColorFactor": [
Expand All @@ -711,11 +539,6 @@
},
{
"doubleSided": true,
"extensions": {
"NV_materials_mdl": {
"mdl_shader": 4
}
},
"name": "cube_instance_5_material",
"pbrMetallicRoughness": {
"baseColorFactor": [
Expand All @@ -734,11 +557,6 @@
3.0,
3.0
],
"extensions": {
"NV_materials_mdl": {
"mdl_shader": 5
}
},
"name": "cube_instance_8_material",
"pbrMetallicRoughness": {
"metallicFactor": 0.0,
Expand All @@ -747,11 +565,6 @@
},
{
"doubleSided": true,
"extensions": {
"NV_materials_mdl": {
"mdl_shader": 6
}
},
"name": "cube_instance_14_material",
"pbrMetallicRoughness": {
"baseColorFactor": [
Expand All @@ -764,21 +577,11 @@
},
{
"doubleSided": true,
"extensions": {
"NV_materials_mdl": {
"mdl_shader": 8
}
},
"name": "cube_instance_16_material"
},
{
"alphaMode": "BLEND",
"doubleSided": true,
"extensions": {
"NV_materials_mdl": {
"mdl_shader": 9
}
},
"name": "sphere_instance_material",
"pbrMetallicRoughness": {
"baseColorFactor": [
Expand All @@ -792,11 +595,6 @@
},
{
"doubleSided": true,
"extensions": {
"NV_materials_mdl": {
"mdl_shader": 11
}
},
"name": "sphere_instance_22_material",
"pbrMetallicRoughness": {
"roughnessFactor": 0.0
Expand Down
Loading

0 comments on commit b38052d

Please sign in to comment.