/// <summary> /// /// </summary> /// <param name="control"></param> public override void Load(Control control) { base.Load(control); camera = new PerspectiveCamera(60, control.Width / (float)control.Height, 1, 10000); this.camera.Position.Z = 100; this.cameraRtt = new OrthographicCamera(control.Width / -2, control.Width / 2, control.Height / 2, control.Height / -2, -10000, 10000); this.cameraRtt.Position.Z = 100; scene = new Scene(); this.sceneRtt = new Scene(); sceneScreen = new Scene(); var light = new DirectionalLight(Color.White); light.Position.set(0, 0, 1).Normalize(); this.sceneRtt.Add(light); light = new DirectionalLight((Color)colorConvertor.ConvertFromString("#ffaaaa"), 1.5f); light.Position.set(0, 0, -1).Normalize(); this.sceneRtt.Add(light); rtTexture = new WebGLRenderTarget(control.Width, control.Height) { MinFilter = ThreeCs.Three.LinearFilter, MagFilter = ThreeCs.Three.NearestFilter, Format = ThreeCs.Three.RGBFormat }; material = new ShaderMaterial() { Uniforms = new Uniforms { { "time", new Uniform() { { "type", "f" }, { "value", 0.0f } } } }, VertexShader = VertexShader, FragmentShader = FragmentShaderPass1, }; materialScreen = new ShaderMaterial() { Uniforms = new Uniforms { { "tDiffuse", new Uniform() { { "type", "t" }, { "value", rtTexture } } } }, VertexShader = VertexShader, FragmentShader = FragmentShaderScreen, }; var plane = new PlaneBufferGeometry(control.Width, control.Height); quad = new Mesh(plane, material); quad.Position.Z = -100; this.sceneRtt.Add(quad); var geometry = new TorusGeometry(100, 25, 15, 30); var mat1 = new MeshPhongMaterial() { Color = (Color)colorConvertor.ConvertFromString("#555555"), Specular = (Color)colorConvertor.ConvertFromString("#ffaa00"), Shininess = 5 }; var mat2 = new MeshPhongMaterial() { Color = (Color)colorConvertor.ConvertFromString("#550000"), Specular = (Color)colorConvertor.ConvertFromString("#ff2200"), Shininess = 5 }; zmesh1 = new Mesh(geometry, mat1); zmesh1.Position.set(0, 0, 100); zmesh1.Scale.set(1.5f, 1.5f, 1.5f); this.sceneRtt.Add(zmesh1); zmesh2 = new Mesh(geometry, mat2); zmesh2.Position.set(0, 150, 100); zmesh2.Scale.set(0.75f, 0.75f, 0.75f); this.sceneRtt.Add(zmesh2); quad = new Mesh(plane, materialScreen); quad.Position.Z = -100; sceneScreen.Add(quad); // var geometry3 = new SphereGeometry(10, 64, 32); var material2 = new MeshBasicMaterial() { Color = Color.White /*, Map = rtTexture*/ }; int n = 5; for (var j = 0; j < n; j++) { for (var i = 0; i < n; i++) { var mesh = new Mesh(geometry3, material2); mesh.Position.X = (i - (n - 1) / 2) * 20; mesh.Position.Y = (j - (n - 1) / 2) * 20; mesh.Position.Z = 0; mesh.Rotation.Y = (float)-Math.PI / 2.0f; scene.Add(mesh); } } renderer.AutoClear = false; }
public EffectComposer(WebGLRenderer renderer, WebGLRenderTarget renderTarget) { // TODO: Complete member initialization this.renderer = renderer; this.renderTarget = renderTarget; }
public EffectComposer(WebGLRenderer renderer, WebGLRenderTarget renderTarget) { // TODO: Complete member initialization this.renderer = renderer; this.renderTarget = renderTarget; }