Ejemplo n.º 1
0
 /// <summary>Adds this block to the parent meshes linked list.
 /// Call this during a reflow to reuse this same block again.</summary>
 public void AddToParent()
 {
     BlockAfter = null;
     ParentMesh.BlockCount++;
     // Push it into the block chain:
     if (ParentMesh.FirstBlock == null)
     {
         ParentMesh.FirstBlock = ParentMesh.LastBlock = this;
     }
     else
     {
         ParentMesh.LastBlock = ParentMesh.LastBlock.BlockAfter = this;
     }
 }
Ejemplo n.º 2
0
        /// <summary>Allocates a block from this mesh. Note that the block object is actually shared. The block can then have
        /// its vertices/triangles edited. Changes will be outputted visually when MeshBlock.Done is called.</summary>
        public MeshBlock Allocate(Renderman renderer)
        {
            MeshBlock block = renderer.Block;

            block.Colour  = Color.white;
            block.TextUV  = null;
            block.ImageUV = null;

            if (FirstBuffer == null || CurrentBufferBlocks == MeshDataBufferPool.BlockCount)
            {
                NextBuffer();
            }

            // Apply buffer and block index:
            block.Buffer     = LastBuffer;
            block.BlockIndex = CurrentBufferBlocks;

            // Bump up the index:
            CurrentBufferBlocks++;

            return(block);
        }
Ejemplo n.º 3
0
		public bool Overlaps(MeshBlock block){
			
			// Check if any of blocks 4 corners are within this square.
			
			Vector3[] vertBuffer=block.ParentMesh.Vertices.Buffer;
			
			// Apply inverse transform to blocks corners:
			for(int i=0;i<4;i++){
				
				// Map it:
				Vector3 point=Transform.ApplyInverse(vertBuffer[block.VertexIndex+i]);
				
				// Simple box test:
				if(point.x<VertexBottomLeft.x || point.x>VertexBottomRight.x || point.y<VertexBottomLeft.y || point.y>VertexTopLeft.y){
					continue;
				}
				
				return true;
				
			}
			
			return false;
		}
Ejemplo n.º 4
0
        public bool Overlaps(MeshBlock block)
        {
            // Check if any of blocks 4 corners are within this square.

            Vector3[] vertBuffer = block.ParentMesh.Vertices.Buffer;

            // Apply inverse transform to blocks corners:
            for (int i = 0; i < 4; i++)
            {
                // Map it:
                Vector3 point = Transform.ApplyInverse(vertBuffer[block.VertexIndex + i]);

                // Simple box test:
                if (point.x < VertexBottomLeft.x || point.x > VertexBottomRight.x || point.y < VertexBottomLeft.y || point.y > VertexTopLeft.y)
                {
                    continue;
                }

                return(true);
            }

            return(false);
        }
Ejemplo n.º 5
0
		/// <summary>Adds this block to the parent meshes linked list.
		/// Call this during a reflow to reuse this same block again.</summary>
		public void AddToParent(){
			BlockAfter=null;
			ParentMesh.BlockCount++;
			// Push it into the block chain:
			if(ParentMesh.FirstBlock==null){
				ParentMesh.FirstBlock=ParentMesh.LastBlock=this;	
			}else{
				ParentMesh.LastBlock=ParentMesh.LastBlock.BlockAfter=this;
			}
		}
Ejemplo n.º 6
0
		/// <summary>Allocates a block from this mesh. The block can then have
		/// its vertices/triangles edited. Changes will be outputted visually when <see cref="PowerUI.DynamicMesh.Flush"/> is called.</summary>
		public MeshBlock Allocate(){
			MeshBlock result=new MeshBlock(this);
			result.AddToParent();
			return result;
		}
Ejemplo n.º 7
0
		/// <summary>Let the mesh know it's about to undergo a layout routine.
		/// <see cref="PowerUI.Renderman.Layout"/>.</summary>
		public void PrepareForLayout(){
			FirstBlock=LastBlock=null;
			LastBlockCount=BlockCount;
			BlockCount=0;
		}
Ejemplo n.º 8
0
 /// <summary>Let the mesh know it's about to undergo a layout routine.
 /// <see cref="PowerUI.Renderman.Layout"/>.</summary>
 public void PrepareForLayout()
 {
     FirstBlock     = LastBlock = null;
     LastBlockCount = BlockCount;
     BlockCount     = 0;
 }