コード例 #1
0
        public void render(TransformEX parentWorld, bool dirty)
        {
            //if object from parent be dirty than it will be true
            dirty |= dirty_;

            //if not changed than (dirty=false),jump it from combine
            if (dirty)
            {
                Debug.Log("this node is dirty,combine it!");
                world_ = local_.combine(parentWorld);
                dirty_ = false;
            }

            //renderMesh
            if (mesh_ != null)
            {
                renderMesh(mesh_, world_);
            }

            for (int i = 0; i < numChildren_; i++)
            {
                if (children_[i] != null)
                {
                    children_[i].render(world_, dirty);
                }
            }
        }
コード例 #2
0
        /// <summary>
        /// 渲染
        /// </summary>
        public void render(TransformEX parentWorld, bool dirty)
        {
            //如果父链中它之上的任何物体标记为脏,则它将被置为true
            dirty |= dirty_;

            //而当节点没有改动时(dirty=false),跳过combine的过程,否则,表示此链为脏,进行combine
            if (dirty)
            {
                Debug.Log("this node is dirty,combine it!");
                world_ = local_.combine(parentWorld);
                dirty_ = false;
            }

            //渲染mesh
            if (_mesh != null)
            {
                renderMesh(_mesh, world_);
            }

            for (int i = 0; i < numChildren_; i++)
            {
                if (children_[i] != null)
                {
                    children_[i].render(world_, dirty);
                }
            }
        }
コード例 #3
0
        public GraphNode(MeshEX mesh)
        {
            mesh_ = mesh;
            local_ = TransformEX.origin;
            dirty_ = true;

        }
コード例 #4
0
        public void render(TransformEX parentWorld, bool dirty)
        {

            //If any object above it in the parent chain is marked as dirty, it will be set to true

            dirty |= dirty_;

            //When the node is not changed (dirty=false), skip the combine process, otherwise, it means that the chain is dirty and combine
            if (dirty)
            {
                Debug.Log("this node is dirty,combine it!");
                world_ = local_.combine(parentWorld);
                dirty_ = false;
            }

           
            if (mesh_ != null)
            {
                renderMesh(mesh_, world_);
            }

            for (int i = 0; i < numChildren_; i++)
            {
                if (children_[i] != null)
                {
                    children_[i].render(world_, dirty);
                }

            }
        }
コード例 #5
0
        public TransformEX combine(TransformEX other)
        {
            TransformEX trans = new TransformEX();

            if (other != null)
            {
                trans.Position = Position + other.Position;
            }
            return(trans);
        }
コード例 #6
0
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.Alpha1))
     {
         //Location Change,Dirty to press
         TransformEX newLocalTransform = new TransformEX();
         newLocalTransform.Position = new Vector3(2, 2, 2);
         graphNode.setTransform(newLocalTransform);
         graphNode.render(parentWorldTransform, true);
     }
 }
コード例 #7
0
        private void Update()
        {
            if (Input.GetKeyDown(KeyCode.Alpha1))
            {
                //修改位置,触发脏标记
                TransformEX newLocalTransform = new TransformEX();
                newLocalTransform.Position = new Vector3(2, 2, 2);
                graphNode.setTransform(newLocalTransform);

                //再次进行渲染
                graphNode.render(parentWorldTransform, true);
            }
        }
コード例 #8
0
        void Update()
        {
            if (Input.GetKeyDown(KeyCode.Alpha1))
            {
                //Modify position, trigger dirty mark
                TransformEX newLocalTransform = new TransformEX();
                newLocalTransform.Position = new Vector3(2, 2, 2);
                graphNode.setTransform(newLocalTransform);

                //re-render
                graphNode.render(parentWorldTransform, true);
            }
        }
コード例 #9
0
 public void setTransform(TransformEX local)
 {
     local_ = local;
     dirty_ = true;
 }
コード例 #10
0
 private void renderMesh(MeshEX mesh_, TransformEX world_)
 {
     Debug.Log("renderMesh!");
 }