Skip to content

Commit

Permalink
Merge pull request #810 from cx20/update_rhodonite_to_latest
Browse files Browse the repository at this point in the history
Update Rhodonite v0.13.2 to v0.13.3
  • Loading branch information
cx20 authored Nov 30, 2024
2 parents 74fda55 + f27cd39 commit 21a3992
Show file tree
Hide file tree
Showing 10 changed files with 430 additions and 44 deletions.
8 changes: 4 additions & 4 deletions examples/rhodonite/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@
</head>
<body>
<!-- rhodonite.js -->
<script src="../../libs/rhodonite/v0.13.2/vendor/draco_decoder.js"></script>
<script src="../../libs/rhodonite/v0.13.2/vendor/msc_basis_transcoder.js"></script>
<script src="../../libs/rhodonite/v0.13.2/vendor/hdrpng.js"></script>
<script src="../../libs/rhodonite/v0.13.3/vendor/draco_decoder.js"></script>
<script src="../../libs/rhodonite/v0.13.3/vendor/msc_basis_transcoder.js"></script>
<script src="../../libs/rhodonite/v0.13.3/vendor/hdrpng.js"></script>

<script type="importmap">
{
"imports": {
"rhodonite": "../../libs/rhodonite/v0.13.2/esm/index.js",
"rhodonite": "../../libs/rhodonite/v0.13.3/esm/index.js",
"dat.gui": "../../libs/common/dat.gui.module.js"
}
}
Expand Down
39 changes: 21 additions & 18 deletions examples/rhodonite/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,17 @@ import * as dat from 'dat.gui';
let gui = new dat.GUI();

var obj = {
ROTATE: false,
CAMERA: "",
LIGHTS: false,
IBL: true,
VARIANT: ""
ROTATE: false,
CAMERA: "",
IBL: true,
LIGHTS: false,
//BLOOM: true, // TODO:
VARIANT: ""
}
let guiRotate = gui.add(obj, 'ROTATE').name('Rotate');
let guiLights = gui.add(obj, 'LIGHTS').name('Lights');
let guiIBL = gui.add(obj, 'IBL').name('IBL');
let guiLights = gui.add(obj, 'LIGHTS').name('Lights');
//let guiBloom = gui.add(obj, 'BLOOM').name('Bloom'); // TODO:
let guiCameras = null;
let guiVariantNames = null;

Expand Down Expand Up @@ -110,6 +112,16 @@ canvas.height = window.innerHeight;
}
});

// TODO:
/*
guiBloom.onChange(function(value) {
forwardRenderPipeline.setup(canvas.width, canvas.height, {
isBloom: value,
isShadow: false,
});
});
*/

// gltf
const mainExpression = (await Rn.GltfImporter.importFromUri(
url,
Expand All @@ -124,19 +136,14 @@ canvas.height = window.innerHeight;
)).unwrapForce();

// env
const envExpression = createEnvCubeExpression(
'../../textures/papermill_hdr',
cameraEntity
);
const envExpression = createEnvCubeExpression('../../textures/papermill_hdr', cameraEntity);

const mainRenderPass = mainExpression.renderPasses[0];
// cameraController
const mainCameraControllerComponent = cameraEntity.getCameraController();
/*
const controller = mainCameraControllerComponent.controller;
controller.setTarget(mainRenderPass.sceneTopLevelGraphComponents[0].entity);
controller.dolly = 0.83;
*/

// TODO: KHR_materials_variants support
let variantNames = [];
Expand Down Expand Up @@ -306,12 +313,8 @@ function createEnvCubeExpression(baseuri, cameraEntity) {
minFilter: Rn.TextureParameter.Linear,
magFilter: Rn.TextureParameter.Linear,
});
sphereMaterial.setTextureParameter(
"colorEnvTexture",
environmentCubeTexture,
sampler
);
sphereMaterial.setParameter(Rn.ShaderSemantics.EnvHdriFormat, Rn.HdriFormat.LDR_SRGB.index);
sphereMaterial.setTextureParameter("colorEnvTexture", environmentCubeTexture, sampler);
sphereMaterial.setParameter("envHdriFormat", Rn.HdriFormat.LDR_SRGB.index);

const spherePrimitive = new Rn.Sphere();
spherePrimitive.generate({
Expand Down
8 changes: 4 additions & 4 deletions examples/rhodonite_webgpu/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@
</head>
<body>
<!-- rhodonite.js -->
<script src="../../libs/rhodonite/v0.13.2/vendor/draco_decoder.js"></script>
<script src="../../libs/rhodonite/v0.13.2/vendor/msc_basis_transcoder.js"></script>
<script src="../../libs/rhodonite/v0.13.2/vendor/hdrpng.js"></script>
<script src="../../libs/rhodonite/v0.13.3/vendor/draco_decoder.js"></script>
<script src="../../libs/rhodonite/v0.13.3/vendor/msc_basis_transcoder.js"></script>
<script src="../../libs/rhodonite/v0.13.3/vendor/hdrpng.js"></script>

<script type="importmap">
{
"imports": {
"rhodonite": "../../libs/rhodonite/v0.13.2/esm/index.js",
"rhodonite": "../../libs/rhodonite/v0.13.3/esm/index.js",
"dat.gui": "../../libs/common/dat.gui.module.js"
}
}
Expand Down
39 changes: 21 additions & 18 deletions examples/rhodonite_webgpu/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,17 @@ import * as dat from 'dat.gui';
let gui = new dat.GUI();

var obj = {
ROTATE: false,
CAMERA: "",
LIGHTS: false,
IBL: true,
VARIANT: ""
ROTATE: false,
CAMERA: "",
IBL: true,
LIGHTS: false,
//BLOOM: true, // TODO:
VARIANT: ""
}
let guiRotate = gui.add(obj, 'ROTATE').name('Rotate');
let guiLights = gui.add(obj, 'LIGHTS').name('Lights');
let guiIBL = gui.add(obj, 'IBL').name('IBL');
let guiLights = gui.add(obj, 'LIGHTS').name('Lights');
//let guiBloom = gui.add(obj, 'BLOOM').name('Bloom'); // TODO:
let guiCameras = null;
let guiVariantNames = null;

Expand Down Expand Up @@ -112,6 +114,16 @@ canvas.height = window.innerHeight;
}
});

// TODO:
/*
guiBloom.onChange(function(value) {
forwardRenderPipeline.setup(canvas.width, canvas.height, {
isBloom: value,
isShadow: false,
});
});
*/

// gltf
const mainExpression = (await Rn.GltfImporter.importFromUri(
url,
Expand All @@ -126,19 +138,14 @@ canvas.height = window.innerHeight;
)).unwrapForce();

// env
const envExpression = createEnvCubeExpression(
'../../textures/papermill_hdr',
cameraEntity
);
const envExpression = createEnvCubeExpression('../../textures/papermill_hdr', cameraEntity);

const mainRenderPass = mainExpression.renderPasses[0];
// cameraController
const mainCameraControllerComponent = cameraEntity.getCameraController();
/*
const controller = mainCameraControllerComponent.controller;
controller.setTarget(mainRenderPass.sceneTopLevelGraphComponents[0].entity);
controller.dolly = 0.83;
*/

// TODO: KHR_materials_variants support
let variantNames = [];
Expand Down Expand Up @@ -308,12 +315,8 @@ function createEnvCubeExpression(baseuri, cameraEntity) {
minFilter: Rn.TextureParameter.Linear,
magFilter: Rn.TextureParameter.Linear,
});
sphereMaterial.setTextureParameter(
"colorEnvTexture",
environmentCubeTexture,
sampler
);
sphereMaterial.setParameter(Rn.ShaderSemantics.EnvHdriFormat, Rn.HdriFormat.LDR_SRGB.index);
sphereMaterial.setTextureParameter("colorEnvTexture", environmentCubeTexture, sampler);
sphereMaterial.setParameter("envHdriFormat", Rn.HdriFormat.LDR_SRGB.index);

const spherePrimitive = new Rn.Sphere();
spherePrimitive.generate({
Expand Down
2 changes: 2 additions & 0 deletions libs/rhodonite/v0.13.3/esm/index.js

Large diffs are not rendered by default.

32 changes: 32 additions & 0 deletions libs/rhodonite/v0.13.3/vendor/draco_decoder.js

Large diffs are not rendered by default.

Loading

0 comments on commit 21a3992

Please sign in to comment.