zoukankan      html  css  js  c++  java
  • threejs 正交视图 透视视图详解

    threejs 正交视图详解

    用正交就是因为能更好的用像素

      canvaswidth = 750;
            canvasheight = 1206;
    
            renderer = new THREE.WebGLRenderer({ alpha: true });
            renderer.setSize(canvaswidth, canvasheight,false);
            document.body.appendChild(renderer.domElement);
            //
            camera = new THREE.OrthographicCamera (canvaswidth / - 2, canvaswidth / 2, canvasheight / 2, canvasheight / - 2, 1, 1000 );
            camera.position.z = 350;
            scene = new THREE.Scene();
    
            var geometry = new THREE.PlaneGeometry(750, 1206, 1, 1);
            // A begin
            geometry.vertices[0].uv = new THREE.Vector2(0, 0);
            geometry.vertices[1].uv = new THREE.Vector2(1, 0);
            geometry.vertices[2].uv = new THREE.Vector2(1, 1);
            geometry.vertices[3].uv = new THREE.Vector2(0, 1);
    
            // A end
            // B begin
            // 纹理坐标怎么弄
            var texture1 = THREE.ImageUtils.loadTexture("/moban/images/tietu.png", null, function(t) {});
            var material = new THREE.MeshBasicMaterial({ map: texture1, transparent: true, side: THREE.DoubleSide });
            mesh = new THREE.Mesh(geometry, material);
            mesh.position.z = 0;
            mesh.position.x = 0;
            mesh.position.y = 0;
            mesh.rotation.x = 0;
            mesh.rotation.y = 0;
            mesh.rotation.z = 0;
    
    
            scene.add(mesh);
            //用于自适应
            window.addEventListener('resize', onWindowResize, false);
    
    
            var tm = new TimelineMax();

    里面的坐标就是按照像素来的 所以一般2D转3D 一般用正交视图 方便坐标变换

    透视视图 就有从远到近效果

    一般这些像素参数是固定的不用去改他 


    如果遇到什么不懂的地方直接关注公众号留言(本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须在文章页面给出原文连接,否则保留追究法律责任的权利。)
    作者:newmiracle
    出处:https://www.cnblogs.com/newmiracle/

     
  • 相关阅读:
    struct page*
    ARM平台linux内核Notes 1
    CTDIY1字符设备驱动的使用
    深入理解linux内核读书笔记1
    在linux下设置pl2303串口
    struct per_cpu_pageset
    ARM平台linux内核Notes 2
    CTDIY2字符设备驱动的注册
    深入理解linux内核读书笔记2
    How to rollback a transaction in TSQL
  • 原文地址:https://www.cnblogs.com/newmiracle/p/14324993.html
Copyright © 2011-2022 走看看