JSFIDDLE helps Threejs explore features, jsfiddlethreejs

Source: Internet
Author: User

JSFIDDLE helps Threejs explore features, jsfiddlethreejs

JSFIDDLE facilitates WebGL function Exploration

Beautiful Life of the sun and fire god (http://blog.csdn.net/opengl_es)

This article follows the "signature-non-commercial use-consistency" creation public agreement

Reprinted please keep this sentence: Sun huoshen's beautiful life-this blog focuses on Agile development and mobile and IOT device research: iOS, Android, Html5, Arduino, pcDuino, otherwise, this blog post is rejected or reprinted. Thank you for your cooperation.



The following example can generate a shadow projection of the basic ry, and there is another piece of code that cannot be projected. It is similar to the code that can be projected with this copy, but it is always impossible to do so, further verification is required to know where the specific differences are and which key parts play the role of shadow.


Let's just calm down and clarify every line of code. This is a shortcut!

The result of the pursuit of shortcuts is to blindly touch the image. In the end, the more you touch the image, the more you get out of the way. Even the original unconscious world is gone.


Therefore, Buddha warned us to pursue the truth, just like a child.

In fact, it is to remove the delusion and speculation, and realistically consider the problem based on the original face of the matter, so that nothing can be guessed by the terminal will affect your mood, and even deviate from the normal path, give birth to events.


A piece of information circulating in this article probably means that if you think about it, you will do it without knowing it. After doing so, it will produce results. After the effect lasts for a long time, it will become a habit, when you get used to it more often, you will become a character, and character determines fate.

Therefore, to change, first change your mind.

This is not an idealistic theory. Sometimes it is true that pure materialism often allows people to ignore and change their thinking and subconscious to the material world.

The most basic difference between humans and animals is that humans can change the state of their own world through thinking. Of course, this state is also one of the various choices inherent in the material world, but at least it can be selected.

If we do not control it, it will become a random choice. The physical world may be in good or bad state, and the random choice results can be imagined. It is completely bad or not.

To sum up, the advanced level of human beings lies in the fact that, by thinking and guiding actions, the default options can be changed and favorable options can be prioritized.



Http://jsfiddle.net/4Txgp/13/embedded


var SCREEN_WIDTH = window.innerWidth - 100;var SCREEN_HEIGHT = window.innerHeight - 100;var camera, scene;var canvasRenderer, webglRenderer;var container, mesh, geometry, plane;var windowHalfX = window.innerWidth / 2;var windowHalfY = window.innerHeight / 2;init();animate();function init() {    container = document.createElement('div');    document.body.appendChild(container);    camera = new THREE.PerspectiveCamera(30, 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(500, 500), 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);}





Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.