korede nannka kyuutaiga detekuru

var args = { w : window.innerWidth, h : window.innerHeight, cam : null, lt : null, scn : null, sphere : null, renderer : null } function set_renderer(){ args.renderer = new THREE.WebGLRenderer(); args.renderer.setSize(args.w, args.h); args.renderer.setClearColor(0x333333); document.getElementById("cv").appendChild(args.renderer.domElement); } function camera(){ args.cam = new THREE.PerspectiveCamera( 30,args.w/args.h); args.cam.position.x = 100; args.cam.position.y = 100; args.cam.position.z = 100; args.cam.lookAt({x:0, y:0, z:0}); } function scene() { args.scn = new THREE.Scene(); } function light() { args.lt = new THREE.DirectionalLight(); args.lt.position.set( 300, 200, 100 ); args.scn.add( args.lt ); } function set_obj() { args.sphere = new THREE.Mesh( new THREE.SphereGeometry(30,30,30), new THREE.MeshLambertMaterial({color: 0xEEEEEE}) ); args.scn.add(args.sphere); args.sphere.position.set(0,0,0); } window.onload = function(){ set_renderer(); camera(); scene(); light(); set_obj(); args.renderer.render( args.scn, args.cam ); } Three.jsです。

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.