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); } } }
/// <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); } } }
public GraphNode(MeshEX mesh) { mesh_ = mesh; local_ = TransformEX.origin; dirty_ = true; }
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); } } }
public TransformEX combine(TransformEX other) { TransformEX trans = new TransformEX(); if (other != null) { trans.Position = Position + other.Position; } return(trans); }
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); } }
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); } }
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); } }
public void setTransform(TransformEX local) { local_ = local; dirty_ = true; }
private void renderMesh(MeshEX mesh_, TransformEX world_) { Debug.Log("renderMesh!"); }