-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
27 changed files
with
879 additions
and
330 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
--- | ||
Checks: "-*,bugprone-*,performance-*,modernize-*,-modernize-use-trailing-return-type,-bugprone-easily-swappable-parameters,-bugprone-exception-escape" | ||
Checks: "-*,bugprone-*,performance-*,modernize-*,-modernize-use-trailing-return-type,-bugprone-easily-swappable-parameters,-bugprone-exception-escape,-modernize-pass-by-value" | ||
WarningsAsErrors: "*" | ||
FormatStyle: none |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
mdl 1.8; | ||
|
||
import ::anno::*; | ||
import ::state::*; | ||
import ::tex::*; | ||
|
||
using ::gltf::pbr import *; | ||
|
||
module [[ | ||
anno::version( 1, 0, 0), | ||
anno::display_name("Cesium MDL functions") | ||
]]; | ||
|
||
export float2 world_coordinate_2d(float2 min_world_xy=float2(-5000.0,-5000.0), float2 max_world_xy=float2(5000.0,5000.0)) | ||
[[ | ||
anno::display_name("World Coordinate 2D"), | ||
anno::description("Returns UV coordinates for mapping rasters to world space positions."), | ||
anno::author("Cesium"), | ||
anno::in_group("Cesium functions"), | ||
anno::ui_order(300) | ||
]]{ | ||
// Get the world pos of the pixel | ||
float3 world_pos = state::transform_vector(state::coordinate_internal, state::coordinate_world, state::position()); | ||
|
||
// Return 0-1 UVs based on the min/max world coordinates provided | ||
return float2(0.0,0.0) + (float2(world_pos.x, world_pos.y) - min_world_xy) * (float2(1.0, 1.0) - float2(0.0, 0.0)) / (max_world_xy - min_world_xy); | ||
} | ||
|
||
export float4 lookup_world_texture_float4(uniform texture_2d texture = texture_2d(), float2 min_world_xy=float2(-5000.0,-5000.0), float2 max_world_xy=float2(5000.0,5000.0)) | ||
[[ | ||
anno::display_name("World-mapped texture lookup float4"), | ||
anno::description("Returns float4 from a texture mapped to world UV coordinates"), | ||
anno::author("Cesium GS Inc."), | ||
anno::in_group("Cesium functions"), | ||
anno::ui_order(300) | ||
]] | ||
{ | ||
return tex::lookup_float4( | ||
tex: texture, | ||
coord: world_coordinate_2d(min_world_xy, max_world_xy), | ||
wrap_u: ::tex::wrap_clamp, | ||
wrap_v: ::tex::wrap_clamp); | ||
} | ||
|
||
export float3 lookup_world_texture_float3(uniform texture_2d texture = texture_2d(), float2 min_world_xy=float2(-5000.0,-5000.0), float2 max_world_xy=float2(5000.0,5000.0)) | ||
[[ | ||
anno::display_name("World-mapped texture lookup float3"), | ||
anno::description("Returns float3 from a texture mapped to world UV coordinates"), | ||
anno::author("Cesium GS Inc."), | ||
anno::in_group("Cesium functions"), | ||
anno::ui_order(300) | ||
]] | ||
{ | ||
return tex::lookup_float3( | ||
tex: texture, | ||
coord: world_coordinate_2d(min_world_xy, max_world_xy), | ||
wrap_u: ::tex::wrap_clamp, | ||
wrap_v: ::tex::wrap_clamp); | ||
} | ||
|
||
|
||
// The use of world_coordinate_2d and subsequent call to state::position causes issues when used in this color specific function and I have absolutely no idea why!! | ||
// export color lookup_world_texture_color(uniform texture_2d texture = texture_2d(), float2 min_world_xy=float2(-5000.0,-5000.0), float2 max_world_xy=float2(5000.0,5000.0)) | ||
// [[ | ||
// anno::display_name("World-mapped texture lookup color"), | ||
// anno::description("Returns color from a texture mapped to world UV coordinates"), | ||
// anno::author("Cesium GS Inc."), | ||
// anno::in_group("Cesium functions"), | ||
// anno::ui_order(300) | ||
// ]] | ||
// { | ||
// return tex::lookup_color( | ||
// tex: texture, | ||
// coord: world_coordinate_2d(min_world_xy, max_world_xy)); | ||
// } | ||
|
||
export material cesium_gltf_material(*) = gltf_material(); | ||
export gltf_texture_lookup_value cesium_gltf_texture_lookup(*) = gltf_texture_lookup(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.