Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
onMount(instance: CreatedInstance): void {
this.addControls(instance)
if (instance.customProps.createForParentMesh) {
// console.log('for parent mesh', instance.parent ? instance.parent.babylonJsObject : 'error: no parent object')
let mesh: Mesh = instance.parent!.hostInstance // should crawl parent hierarchy for a mesh
// console.error('we will be attaching the mesh:', mesh.name, mesh);
const material = new StandardMaterial("AdvancedDynamicTextureMaterial", mesh.getScene())
material.backFaceCulling = false
material.diffuseColor = Color3.Black()
material.specularColor = Color3.Black()
if(instance.hostInstance === undefined) {
console.error('missing instance')
} else {
if (this.props.hasAlpha) {
material.diffuseTexture = instance.hostInstance
material.emissiveTexture = instance.hostInstance
instance.hostInstance.hasAlpha = true
} else {
material.emissiveTexture = instance.hostInstance
material.opacityTexture = instance.hostInstance
}
}
mesh.material = material
onMount(instance: CreatedInstance): void {
this.addControls(instance)
if (instance.customProps.createForParentMesh) {
// console.log('for parent mesh', instance.parent ? instance.parent.babylonJsObject : 'error: no parent object')
let mesh: Mesh = instance.parent!.hostInstance // should crawl parent hierarchy for a mesh
// console.error('we will be attaching the mesh:', mesh.name, mesh);
const material = new StandardMaterial("AdvancedDynamicTextureMaterial", mesh.getScene())
material.backFaceCulling = false
material.diffuseColor = Color3.Black()
material.specularColor = Color3.Black()
if(instance.hostInstance === undefined) {
console.error('missing instance')
} else {
if (this.props.hasAlpha) {
material.diffuseTexture = instance.hostInstance
material.emissiveTexture = instance.hostInstance
instance.hostInstance.hasAlpha = true
} else {
material.emissiveTexture = instance.hostInstance
material.opacityTexture = instance.hostInstance
}
}
mesh.material = material
let material = new StandardMaterial("kosh", scene);
material.reflectionTexture = new CubeTexture("assets/textures/TropicalSunnyDay", scene);
material.diffuseColor = new Color3(0, 0, 0);
material.emissiveColor = new Color3(0.5, 0.5, 0.5);
material.alpha = 0.2;
material.specularPower = 16;
// Fresnel
material.reflectionFresnelParameters = new FresnelParameters();
material.reflectionFresnelParameters.bias = 0.1;
material.emissiveFresnelParameters = new FresnelParameters();
material.emissiveFresnelParameters.bias = 0.6;
material.emissiveFresnelParameters.power = 4;
material.emissiveFresnelParameters.leftColor = Color3.White();
material.emissiveFresnelParameters.rightColor = Color3.Black();
material.opacityFresnelParameters = new FresnelParameters();
material.opacityFresnelParameters.leftColor = Color3.White();
material.opacityFresnelParameters.rightColor = Color3.Black();
if(index === 0){
this.logoTween.to(mesh.scaling, 2, { x: 4, y: 4, z: 4 })
this.logoTween.to(mesh.scaling, 2, { x: 2, y: 2, z: 2 })
this.logoTween.to(mesh.rotation, 1, { x: 1, y: 1, z: 1 })
this.logoTween.play();
}
mesh.material = material;
})
}
if (plane) {
let forwardRay = camera.getForwardRay()
plane.position = camera.position.clone().add(forwardRay.direction.scale(1.5 / camera.fov /* * forwardRay.length */))
plane.lookAt(camera.position, 0, Math.PI, Math.PI)
}
}}
/>
{this.state.showModal === true &&