public async ValueTask detachPostProcess(PostProcess postProcess) { await EventHorizonBlazorInterop.Func <CachedEntity>( new object[] { new string[] { this.___guid, "detachPostProcess" }, postProcess } ); }
public ValueTask set_postProcess(PostProcess value) { __postProcess = null; return(EventHorizonBlazorInterop.Set( this.___guid, "postProcess", value )); }
public async ValueTask <decimal> attachPostProcess(PostProcess postProcess, System.Nullable <decimal> insertAt = null) { return(await EventHorizonBlazorInterop.Func <decimal>( new object[] { new string[] { this.___guid, "attachPostProcess" }, postProcess, insertAt } )); }
public async ValueTask setTextureFromPostProcessOutput(string channel, PostProcess postProcess) { await EventHorizonBlazorInterop.Func <CachedEntity>( new object[] { new string[] { this.___guid, "setTextureFromPostProcessOutput" }, channel, postProcess } ); }
public void createEffectForPostProcess(PostProcess postProcess) { EventHorizonBlazorInterop.Func <CachedEntity>( new object[] { new string[] { this.___guid, "createEffectForPostProcess" }, postProcess } ); }
public void setTextureFromPostProcess(string channel, PostProcess postProcess) { EventHorizonBlazorInterop.Func <CachedEntity>( new object[] { new string[] { this.___guid, "setTextureFromPostProcess" }, channel, postProcess } ); }
/// <summary> /// </summary> /// <param name="postProcess"> /// </param> /// <param name="insertAt"> /// </param> /// <returns> /// </returns> public virtual int attachPostProcess(PostProcess postProcess, int insertAt = -1) { if (!postProcess.isReusable() && this._postProcesses.IndexOf(postProcess) > -1) { Tools.Error("You're trying to reuse a post process not defined as reusable."); return(0); } if (insertAt < 0) { this._postProcesses.Add(postProcess); this._postProcessesTakenIndices.Add(this._postProcesses.Length - 1); return(this._postProcesses.Length - 1); } var add = 0; if (this._postProcesses[insertAt] != null) { var start = this._postProcesses.Length - 1; for (var i = start; i >= insertAt + 1; --i) { this._postProcesses[i + 1] = this._postProcesses[i]; } add = 1; } for (var i = 0; i < this._postProcessesTakenIndices.Length; ++i) { if (this._postProcessesTakenIndices[i] < insertAt) { continue; } var start = this._postProcessesTakenIndices.Length - 1; for (var j = start; j >= i; --j) { this._postProcessesTakenIndices[j + 1] = this._postProcessesTakenIndices[j] + add; } this._postProcessesTakenIndices[i] = insertAt; break; } if (add == 0 && this._postProcessesTakenIndices.IndexOf(insertAt) == -1) { this._postProcessesTakenIndices.Add(insertAt); } var result = insertAt + add; this._postProcesses[result] = postProcess; return(result); }
public PostProcess shareOutputWith(PostProcess postProcess) { return(EventHorizonBlazorInterop.FuncClass <PostProcess>( entity => new PostProcess() { ___guid = entity.___guid }, new object[] { new string[] { this.___guid, "shareOutputWith" }, postProcess } )); }
/// <summary> /// </summary> /// <param name="engine"> /// </param> /// <param name="name"> /// </param> /// <param name="postProcessType"> /// </param> /// <param name="ratio"> /// </param> /// <param name="samplingMode"> /// </param> public PostProcessRenderEffect(Engine engine, string name, PostProcess postProcessType, double ratio = 1.0, int samplingMode = 0) { this._engine = engine; this._name = name; this._postProcessType = postProcessType; this._ratio = ratio; this._samplingMode = samplingMode; this._cameras = new Map <string, Camera>(); this._postProcesses = new Map <string, PostProcess>(); this._indicesForCamera = new Map <string, Array <int> >(); this._renderPasses = new Map <string, PostProcessRenderPass>(); this._renderEffectAsPasses = new Map <string, PostProcessRenderEffect>(); this.parameters = (Effect effect) => { }; }
public async ValueTask <PostProcess> get_rigPostProcess() { if (__rigPostProcess == null) { __rigPostProcess = await EventHorizonBlazorInterop.GetClass <PostProcess>( this.___guid, "rigPostProcess", (entity) => { return(new PostProcess() { ___guid = entity.___guid }); } ); } return(__rigPostProcess); }
/// <summary> /// </summary> /// <param name="postProcess"> /// </param> /// <param name="atIndices"> /// </param> /// <returns> /// </returns> public virtual Array <int> detachPostProcess(PostProcess postProcess, Array <int> atIndices = null) { var result = new Array <int>(); if (atIndices == null) { var Length = this._postProcesses.Length; for (var i = 0; i < Length; i++) { if (this._postProcesses[i] != postProcess) { continue; } this._postProcesses[i] = null; var index = this._postProcessesTakenIndices.IndexOf(i); this._postProcessesTakenIndices.RemoveAt(index); } } else { for (var i = 0; i < atIndices.Length; i++) { var foundPostProcess = this._postProcesses[atIndices[i]]; if (foundPostProcess != postProcess) { result.Add(i); continue; } this._postProcesses[atIndices[i]] = null; var index = this._postProcessesTakenIndices.IndexOf(atIndices[i]); this._postProcessesTakenIndices.RemoveAt(index); } } return(result); }
/// <summary> /// </summary> /// <param name="channel"> /// </param> /// <param name="postProcess"> /// </param> public virtual void setTextureFromPostProcess(string channel, PostProcess postProcess) { this._engine.setTextureFromPostProcess(this._samplers.IndexOf(channel), postProcess); }
private void Scene16() { 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(-40, 40, 0)); camera.lowerBetaLimit = (Math.PI / 2) * 0.9; // 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; // Spheres var sphere0 = BABYLON.Mesh.CreateSphere("Sphere0", 16, 10, scene); var sphere1 = BABYLON.Mesh.CreateSphere("Sphere1", 16, 10, scene); var sphere2 = BABYLON.Mesh.CreateSphere("Sphere2", 16, 10, scene); var cube = BABYLON.Mesh.CreateBox("Cube", 10.0, scene); var material0 = new BABYLON.StandardMaterial("white", scene); material0.diffuseColor = new BABYLON.Color3(0, 0, 0); material0.specularColor = new BABYLON.Color3(0, 0, 0); material0.emissiveColor = new BABYLON.Color3(1.0, 1.0, 1.0); sphere0.material = material0; sphere1.material = sphere0.material; sphere2.material = sphere0.material; var material1 = new BABYLON.StandardMaterial("red", scene); material1.diffuseColor = new BABYLON.Color3(0, 0, 0); material1.specularColor = new BABYLON.Color3(0, 0, 0); material1.emissiveColor = new BABYLON.Color3(1.0, 0, 0); cube.material = material1; // Post-process var blurWidth = 1.0; var postProcess0 = new BABYLON.PassPostProcess("Scene copy", 1.0, camera); var postProcess1 = new BABYLON.PostProcess("Down sample", "./postprocesses/downsample", new Array <string>("screenSize", "highlightThreshold"), null, 0.25, camera, BABYLON.Texture.BILINEAR_SAMPLINGMODE); postProcess1.onApply = (effect) => { effect.setFloat2("screenSize", postProcess1.width, postProcess1.height); effect.setFloat("highlightThreshold", 0.90); }; var postProcess2 = new BABYLON.BlurPostProcess("Horizontal blur", new BABYLON.Vector2(1.0, 0), blurWidth, 0.25, camera); var postProcess3 = new BABYLON.BlurPostProcess("Vertical blur", new BABYLON.Vector2(0, 1.0), blurWidth, 0.25, camera); var postProcess4 = new BABYLON.PostProcess("Final compose", "./postprocesses/compose", new Array <string>("sceneIntensity", "glowIntensity", "highlightIntensity"), new Array <string>("sceneSampler"), 1, camera, BABYLON.Texture.BILINEAR_SAMPLINGMODE); postProcess4.onApply = (effect) => { effect.setTextureFromPostProcess("sceneSampler", postProcess0); effect.setFloat("sceneIntensity", 0.5); effect.setFloat("glowIntensity", 0.4); effect.setFloat("highlightIntensity", 1.0); }; // Animations var alpha = 0.0; scene.registerBeforeRender(() => { sphere0.position = new BABYLON.Vector3(20 * Math.Sin(alpha), 0, 20 * Math.Cos(alpha)); sphere1.position = new BABYLON.Vector3(20 * Math.Sin(alpha), 0, -20 * Math.Cos(alpha)); sphere2.position = new BABYLON.Vector3(20 * Math.Cos(alpha), 0, 20 * Math.Sin(alpha)); cube.rotation.y += 0.01; cube.rotation.z += 0.01; alpha += 0.01; }); this.scene.activeCamera.attachControl(this.canvas); }
/// <summary> /// </summary> /// <param name="engine"> /// </param> /// <param name="postProcessType"> /// </param> /// <param name="ratio"> /// </param> /// <param name="samplingMode"> /// </param> /// <returns> /// </returns> private static PostProcess _GetInstance(Engine engine, PostProcess postProcessType, double ratio = 1.0, int samplingMode = 0) { // TODO: finish it return(null); }