Addede a bunch of abstract hdris as well as the option to cycle cle though them at runtime

This commit is contained in:
AlexandruPopovici
2024-04-17 17:28:15 +03:00
parent 4fc7373d4b
commit 0d0a8bc6b8
12 changed files with 44 additions and 6 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+35 -1
View File
@@ -25,7 +25,14 @@ import { FilteringExtension } from '@speckle/viewer'
import { MeasurementsExtension } from '@speckle/viewer'
import { CameraController } from '@speckle/viewer'
import { UpdateFlags } from '@speckle/viewer'
import { Viewer } from '@speckle/viewer'
import { Viewer, AssetType, Assets } from '@speckle/viewer'
import hdri0 from '../assets/sample-hdri.png'
import hdri1 from '../assets/1.png'
import hdri2 from '../assets/2.png'
import hdri3 from '../assets/3.png'
import hdri4 from '../assets/4.png'
import hdri5 from '../assets/5.png'
import hdri6 from '../assets/6.png'
import { Euler, Vector3 } from 'three'
@@ -839,6 +846,33 @@ export default class Sandbox {
title: 'Indirect',
expanded: true
})
const hdriParams = {
id: 1
}
indirectLightsFolder
.addInput(hdriParams, 'id', {
label: 'HDRI',
options: {
0: hdri0,
1: hdri1,
2: hdri2,
3: hdri3,
4: hdri4,
5: hdri5,
6: hdri6
}
})
.on('change', async (value) => {
this.viewer.getRenderer().indirectIBL = await Assets.getEnvironment(
{
id: hdriParams.id,
src: value.value,
type: AssetType.TEXTURE_EXR
},
this.viewer.getRenderer().renderer
)
this.viewer.requestRender()
})
indirectLightsFolder
.addInput(this.lightParams, 'indirectLightIntensity', {
+2 -2
View File
@@ -119,7 +119,7 @@ const getStream = () => {
// prettier-ignore
// 'https://speckle.xyz/streams/da9e320dad/commits/5388ef24b8?c=%5B-7.66134,10.82932,6.41935,-0.07739,-13.88552,1.8697,0,1%5D'
// Revit sample house (good for bim-like stuff with many display meshes)
// 'https://speckle.xyz/streams/da9e320dad/commits/5388ef24b8'
'https://speckle.xyz/streams/da9e320dad/commits/5388ef24b8'
// 'https://latest.speckle.dev/streams/58b5648c4d/commits/60371ecb2d'
// 'Super' heavy revit shit
// 'https://speckle.xyz/streams/e6f9156405/commits/0694d53bb5'
@@ -248,7 +248,7 @@ const getStream = () => {
// 'https://latest.speckle.dev/streams/f92e060177/commits/038a587267'
// 'https://latest.speckle.dev/streams/3f895e614f/commits/8a3e424997'
// 'https://latest.speckle.dev/streams/f92e060177/commits/f51ee777d5'
'https://latest.speckle.dev/streams/f92e060177/commits/bbd821e3a1'
// 'https://latest.speckle.dev/streams/f92e060177/commits/bbd821e3a1'
// Big curves
// 'https://latest.speckle.dev/streams/c1faab5c62/commits/49dad07ae2'
// 'https://speckle.xyz/streams/7ce9010d71/commits/afda4ffdf8'
+5 -1
View File
@@ -1,5 +1,6 @@
import { Viewer } from './modules/Viewer'
import {
AssetType,
DefaultLightConfiguration,
DefaultViewerParams,
IViewer,
@@ -66,6 +67,7 @@ import SpeckleStandardMaterial from './modules/materials/SpeckleStandardMaterial
import SpeckleTextMaterial from './modules/materials/SpeckleTextMaterial'
import { SpeckleText } from './modules/objects/SpeckleText'
import { NodeRenderView } from './modules/tree/NodeRenderView'
import { Assets } from './modules/Assets'
export {
Viewer,
@@ -105,7 +107,9 @@ export {
SpeckleStandardMaterial,
SpeckleTextMaterial,
SpeckleText,
NodeRenderView
NodeRenderView,
Assets,
AssetType
}
export type {
@@ -197,6 +197,7 @@ export default class SpeckleRenderer {
public set indirectIBL(texture: Texture) {
this._scene.environment = texture
this._scene.background = texture
}
public set indirectIBLIntensity(value: number) {
+1 -2
View File
@@ -41,7 +41,7 @@ export class Viewer extends EventEmitter implements IViewer {
/** Viewer components */
protected tree: WorldTree = new WorldTree()
protected world: World = new World()
public static Assets: Assets
public static readonly theAssets: Assets = new Assets()
public speckleRenderer: SpeckleRenderer
protected propertyManager: PropertyManager
@@ -143,7 +143,6 @@ export class Viewer extends EventEmitter implements IViewer {
this.speckleRenderer.create(this.container)
window.addEventListener('resize', this.resize.bind(this), false)
new Assets()
this.propertyManager = new PropertyManager()
this.frame()