public bool isReadyForSubMesh(SubMesh subMesh, string[] defines, ShadowGenerator shadowGenerator, bool useInstances) { return(EventHorizonBlazorInterop.Func <bool>( new object[] { new string[] { this.___guid, "isReadyForSubMesh" }, subMesh, defines, shadowGenerator, useInstances } )); }
public async ValueTask <Effect> getEffect(SubMesh subMesh, ShadowGenerator shadowGenerator) { return(await EventHorizonBlazorInterop.FuncClass <Effect>( entity => new Effect() { ___guid = entity.___guid }, new object[] { new string[] { this.___guid, "getEffect" }, subMesh, shadowGenerator } )); }
private void Scene15() { var scene = new BABYLON.Scene(engine); var light = new BABYLON.DirectionalLight("dir01", new BABYLON.Vector3(0, -0.5, -1.0), scene); var camera = new BABYLON.ArcRotateCamera("Camera", 0, 0, 10, new BABYLON.Vector3(0, 30, 0), scene); camera.setPosition(new BABYLON.Vector3(20, 70, 120)); light.position = new BABYLON.Vector3(20, 150, 70); camera.minZ = 10.0; scene.ambientColor = new BABYLON.Color3(0.3, 0.3, 0.3); // Ground var ground = BABYLON.Mesh.CreateGround("ground", 1000, 1000, 1, scene, false); var groundMaterial = new BABYLON.StandardMaterial("ground", scene); groundMaterial.diffuseColor = new BABYLON.Color3(0.2, 0.2, 0.2); groundMaterial.specularColor = new BABYLON.Color3(0, 0, 0); ground.material = groundMaterial; ground.receiveShadows = true; // Shadows var shadowGenerator = new BABYLON.ShadowGenerator(new BABYLON.Size() { width = 1024, height = 1024 }, light); // Meshes // Dude BABYLON.SceneLoader.ImportMesh(new Array <string>("him"), "", "Dude.babylon", scene, (newMeshes2, particleSystems2, skeletons2) => { this.scene = scene; this.scene.activeCamera.attachControl(this.canvas); var dude = newMeshes2[0]; for (var index = 0; index < newMeshes2.Length; index++) { shadowGenerator.getShadowMap().renderList.Add(newMeshes2[index]); } dude.rotation.y = Math.PI; dude.position = new BABYLON.Vector3(0, 0, -80); scene.beginAnimation(skeletons2[0], 0, 100, true, 1.0); }); }
private void Scene12() { this.scene = new BABYLON.Scene(engine); var camera = new BABYLON.ArcRotateCamera("Camera", 0, 0, 10, BABYLON.Vector3.Zero(), scene); var light = new BABYLON.DirectionalLight("dir01", new BABYLON.Vector3(0, -1, -0.2), scene); var light2 = new BABYLON.DirectionalLight("dir02", new BABYLON.Vector3(-1, -2, -1), scene); light.position = new BABYLON.Vector3(0, 30, 0); light2.position = new BABYLON.Vector3(10, 20, 10); light.intensity = 0.6; light2.intensity = 0.6; camera.setPosition(new BABYLON.Vector3(-20, 20, 0)); // Skybox var skybox = BABYLON.Mesh.CreateBox("skyBox", 1000.0, scene); var skyboxMaterial = new BABYLON.StandardMaterial("skyBox", scene); skyboxMaterial.backFaceCulling = false; skyboxMaterial.reflectionTexture = new BABYLON.CubeTexture("skybox", scene); skyboxMaterial.reflectionTexture.coordinatesMode = BABYLON.Texture.SKYBOX_MODE; skyboxMaterial.diffuseColor = new BABYLON.Color3(0, 0, 0); skyboxMaterial.specularColor = new BABYLON.Color3(0, 0, 0); skybox.material = skyboxMaterial; // Ground var ground = BABYLON.Mesh.CreateGround("ground", 1000, 1000, 1, scene, false); var groundMaterial = new BABYLON.StandardMaterial("ground", scene); BABYLON.Texture diffuseTexture = null; if (engine.getCaps().s3tc != null) { diffuseTexture = new BABYLON.Texture("grass.dds", scene); } else { diffuseTexture = new BABYLON.Texture("grass.jpg", scene); } diffuseTexture.uScale = 60; diffuseTexture.vScale = 60; groundMaterial.diffuseTexture = diffuseTexture; groundMaterial.specularColor = new BABYLON.Color3(0, 0, 0); ground.position.y = -2.05; ground.material = groundMaterial; // Torus var torus = BABYLON.Mesh.CreateTorus("torus", 8, 2, 32, scene, false); torus.position.y = 6.0; var torus2 = BABYLON.Mesh.CreateTorus("torus2", 4, 1, 32, scene, false); torus2.position.y = 6.0; var torusMaterial = new BABYLON.StandardMaterial("torus", scene); torusMaterial.diffuseColor = new BABYLON.Color3(0.5, 0.5, 0.5); torusMaterial.specularColor = new BABYLON.Color3(0.5, 0.5, 0.5); torus.material = torusMaterial; torus2.material = torusMaterial; // Shadows var shadowGenerator = new BABYLON.ShadowGenerator(new BABYLON.Size() { width = 512, height = 512 }, light); shadowGenerator.getShadowMap().renderList.Add(torus); shadowGenerator.getShadowMap().renderList.Add(torus2); shadowGenerator.usePoissonSampling = true; var shadowGenerator2 = new BABYLON.ShadowGenerator(new BABYLON.Size() { width = 512, height = 512 }, light2); shadowGenerator2.getShadowMap().renderList.Add(torus); shadowGenerator2.getShadowMap().renderList.Add(torus2); shadowGenerator2.useVarianceShadowMap = true; ground.receiveShadows = true; System.Action beforeRenderFunction = () => { // Camera if (camera.beta < 0.1) { camera.beta = 0.1; } else if (camera.beta > (Math.PI / 2) * 0.99) { camera.beta = (Math.PI / 2) * 0.99; } if (camera.radius > 150) { camera.radius = 150; } if (camera.radius < 5) { camera.radius = 5; } }; scene.registerBeforeRender(beforeRenderFunction); // Animations scene.registerBeforeRender(() => { torus.rotation.x += 0.01; torus.rotation.z += 0.02; torus2.rotation.x += 0.02; torus2.rotation.y += 0.01; }); this.scene.activeCamera.attachControl(this.canvas); }