Jsfiddle Help WebGL function Quest
The beautiful Life of the Sun Vulcan (http://blog.csdn.net/opengl_es)
This article follows "Attribution-non-commercial use-consistent" authoring public agreement
Reprint Please keep this sentence: Sun Vulcan's Beautiful Life-this blog focuses on Agile development and mobile and IoT device research: IOS, Android, HTML5, Arduino, Pcduino . Otherwise, the article from this blog refused to reprint or re-reproduced, thank you for your cooperation.
The following shows a sample that produces a shadow projection of the underlying geometry, as well as a copy of the code. is not projected, and the code that can be projected in this part. Almost the same, but do not always have its law, need to further check, the ability to know the details of where the difference, which key parts of the role of shadow projection.
Or calm down, and make clear every line of code, this is the shortest way!
tend to pursue the results of short cuts. It is elephant, and finally, the more you feel the more outrageous. Even the first unconscious realms were gone.
So the Buddha told us to pursue the truth. Like a child.
In fact. is to remove delusion and push. Realistically according to the matter of the original face to consider the problem, it will not be a false end of the things that affect your mood, so that deviation from the right, the birth of trouble.
A piece of information circulating in, probably meaning. Only if you think about it, you will do it unconsciously. Doing so will produce an effect. The effect lasts for a long time, will become the habit, the habit is many forms the character, but the disposition decides the destiny.
So, to change, start with the idea.
This is not an idealist theory, sometimes feeling, pure materialism, often let people neglect and people's thinking and subconscious changes in the physical world.
And the reason why humans are different from animals. Most of the book is about. Man is able to change the state of his own world through thought, of course. This state. is one of the many choices inherent in the physical world. But at least it can be chosen.
If we assume that we are not in control, we will become a random choice, the state of the physical world is good and bad, the results of random selection can be imagined. It is not possible to be completely in a bad state.
To sum up, the human advanced. Is that by thinking about guiding actions, you can finally change the default selection and prioritize the advantageous options.
http://jsfiddle.net/4Txgp/13/embedded
var screen_width = Window.innerwidth-100;var Screen_height = Window.innerheight-100;var camera, Scene;var CanvasRender Er, Webglrenderer;var container, mesh, geometry, plane;var windowhalfx = Window.innerwidth/2;var Windowhalfy = window.in Nerheight/2;init (); animate (); function init () {container = document.createelement (' div '); Document.body.appendChild (container); Camera = new three. Perspectivecamera (Window.innerwidth/window.innerheight, 1, 100000); camera.position.x = 1200; CAMERA.POSITION.Y = 1000; Camera.lookat ({x:0, y:0, z:0}); Scene = new three. Scene (); var groundmaterial = new three. Meshphongmaterial ({color:0x6c6c6c}); Plane = new three. Mesh (new three. Planegeometry (a), groundmaterial); plane.rotation.x =-MATH.PI/2; Plane.receiveshadow = true; Scene.add (plane); LIGHTS Scene.add (new three. Ambientlight (0x666666)); var light; Light = new three. DirectionalLight (0xdfeBFF, 1.75); Light.position.set (300, 400, 50); Light.position.multiplyScalar (1.3); Light.castshadow = true; Light.shadowcameravisible = true; Light.shadowmapwidth = 512; Light.shadowmapheight = 512; var d = 200; Light.shadowcameraleft =-D; Light.shadowcameraright = D; Light.shadowcameratop = D; Light.shadowcamerabottom =-D; Light.shadowcamerafar = 1000; light.shadowdarkness = 0.2; Scene.add (light); var boxgeometry = new three. Cubegeometry (100, 100, 100); var boxmaterial = new three. Meshlambertmaterial ({COLOR:0X0AEEDF}); var cube = new three. Mesh (Boxgeometry, boxmaterial); Cube.castshadow = true; cube.position.x = 0; CUBE.POSITION.Y = 100; cube.position.z = 0; Scene.add (Cube); RENDERER webglrenderer = new three. Webglrenderer (); Webglrenderer.setsize (Screen_width, screen_height); WebglRenderer.domElement.style.position = "relative"; Webglrenderer.shadowmapenabled = true; Webglrenderer. Shadowmapsoft = true; Container.appendchild (webglrenderer.domelement); Window.addeventlistener (' Resize ', onwindowresize, false);} function Onwindowresize () {windowhalfx = WINDOW.INNERWIDTH/2; Windowhalfy = WINDOW.INNERHEIGHT/2; Camera.aspect = Window.innerwidth/window.innerheight; Camera.updateprojectionmatrix (); Webglrenderer.setsize (Window.innerwidth, window.innerheight);} function animate () {var timer = Date.now () * 0.0002; camera.position.x = Math.Cos (timer) * 1000; CAMERA.POSITION.Z = Math.sin (timer) * 1000; Requestanimationframe (animate); Render ();} function render () {Camera.lookat (scene.position); Webglrenderer.render (scene, camera);}
Exploration of Jsfiddle power Threejs function