* Refactor web examples and tutorials - Consolidate web/docs and web/samples into web/examples - Remove literal programming blocks from Markdown tutorials - Replace tutorial_template.html with a fully embedded template in serve.py - Move serve.py to web/examples/serve.py and update dependency rules - Update filament-js wrapper to expose _malloc, _free and set GEN_MIPMAPPABLE usage - Update sample materials and WebGL asset generation within web/examples/CMakeLists.txt - Add python venv instructions and usage details to web/README.md - Remove obsolete examples, Pipfile, and demo templates * Transfer web tutorials and samples to docs_src - Introduce copy_web_docs.py api to deploy and rewrite web sample outputs into the docs output tree - Hook copy_web_docs into docs_src/build/run.py natively - Configure duplicates.json to map WebGL outputs to embedded .md docs - Strip html skeleton out of examples in run.py so they map into markdown cleanly - Update update-docs workflow to pre-build the WebGL target - Remove obsolete remote docs path from src_raw - Add explanatory comments to copy_web_docs.py and run.py - Add index page with thumbnails for Web Tutorials and samples
45 lines
1.2 KiB
Plaintext
45 lines
1.2 KiB
Plaintext
// Textured material
|
|
|
|
material {
|
|
name : parquet,
|
|
shadingModel : lit,
|
|
parameters : [
|
|
// Base color sRGB texture
|
|
{
|
|
type : sampler2d,
|
|
name : baseColor
|
|
},
|
|
// Packed ambient occlusion/roughness/metallic RGB texture
|
|
{
|
|
type : sampler2d,
|
|
name : aoRoughnessMetallic
|
|
},
|
|
// Normal map RGB texture
|
|
{
|
|
type : sampler2d,
|
|
name : normal
|
|
}
|
|
],
|
|
// To sample textures our material must declare that it requires
|
|
// a set of UV coordinates from the rendered mesh
|
|
requires: [
|
|
uv0
|
|
]
|
|
}
|
|
|
|
fragment {
|
|
void material(inout MaterialInputs material) {
|
|
// The normal map must be set *before* calling prepareMaterial()
|
|
material.normal = texture(materialParams_normal, getUV0()).xyz * 2.0 - 1.0;
|
|
|
|
prepareMaterial(material);
|
|
|
|
material.baseColor = texture(materialParams_baseColor, getUV0());
|
|
|
|
vec3 aoRoughnessMetallic = texture(materialParams_aoRoughnessMetallic, getUV0()).rgb;
|
|
material.ambientOcclusion = aoRoughnessMetallic.r;
|
|
material.roughness = aoRoughnessMetallic.g;
|
|
material.metallic = aoRoughnessMetallic.b;
|
|
}
|
|
}
|