public void Render(FrustumCuller culler) { if (visible) { // render the array in reverse order, first boxes then labels float sliceX, sliceY, sliceZ; sliceX = this.position.X; sliceY = this.position.Y; sliceZ = this.position.Z; cullCount = 0; GL.PushMatrix(); MoveIntoPosition(false); FileNode.SetBoxState(isDimmed); for (int i = fileNodes.Length - 1; i >= 0; i--) { float nodeZ = sliceZ + fileNodes[i].Position.Z; float nodeX = sliceX + fileNodes[i].Position.X - 2.1f; float nodeY = sliceY + fileNodes[i].Position.Y; if ((nodeZ > parentWindow.GetCamera().Position.Z) && (culler.isBoxVisible(nodeX, nodeY, nodeZ, 3f, 8f))) { fileNodes[i].culled = false; fileNodes[i].DrawBox(i); } else { fileNodes[i].culled = true; cullCount++; } } FileNode.UnsetBoxState(isDimmed); FileNode.SetTextState(isDimmed); for (int i = fileNodes.Length - 1; i >= 0; i--) { if (!fileNodes[i].culled) { fileNodes[i].DrawLabel(); } } FileNode.UnsetTextState(isDimmed); GL.PopMatrix(); } }
public SliceManager(MainWindow parent) { parentWindow = parent; culler = new FrustumCuller(); }
public void Render(FrustumCuller culler) { if(visible) { // render the array in reverse order, first boxes then labels float sliceX, sliceY, sliceZ; sliceX = this.position.X; sliceY = this.position.Y; sliceZ = this.position.Z; cullCount = 0; GL.PushMatrix(); MoveIntoPosition(false); FileNode.SetBoxState(isDimmed); for(int i = fileNodes.Length-1; i >= 0; i--) { float nodeZ = sliceZ + fileNodes[i].Position.Z; float nodeX = sliceX + fileNodes[i].Position.X - 2.1f; float nodeY = sliceY + fileNodes[i].Position.Y; if( (nodeZ > parentWindow.GetCamera().Position.Z) && (culler.isBoxVisible(nodeX, nodeY, nodeZ, 3f, 8f)) ) { fileNodes[i].culled = false; fileNodes[i].DrawBox(i); } else { fileNodes[i].culled = true; cullCount++; } } FileNode.UnsetBoxState(isDimmed); FileNode.SetTextState(isDimmed); for(int i = fileNodes.Length-1; i >= 0; i--) { if(!fileNodes[i].culled) { fileNodes[i].DrawLabel(); } } FileNode.UnsetTextState(isDimmed); GL.PopMatrix(); } }
public void Render(FrustumCuller culler) { if (visible) { // render the array in reverse order, first boxes then labels float sliceX, sliceY, sliceZ; sliceX = this.position.X; sliceY = this.position.Y; sliceZ = this.position.Z; cullCount = 0; /* * // GROUND PLANE * GL.PushMatrix(); * * GL.Disable (EnableCap.DepthTest); * GL.Enable (EnableCap.Texture2D); * // bind texture to texture unit 0 * GL.ActiveTexture(TextureUnit.Texture0); * GL.BindTexture(TextureTarget.Texture2D, texture); * GL.Begin(PrimitiveType.Quads); * float numberOfTextureRepeats = 30.0f; * float mSize = 500.0f; * GL.Normal3( -1.0f, 1.0f, -1.0f); * float cameraPositionZ = parentWindow.GetCamera().Position.Z; * float cameraPositionX = parentWindow.GetCamera().Position.X; * GL.TexCoord2(numberOfTextureRepeats, numberOfTextureRepeats); GL.Vertex3( (float)(cameraPositionX + mSize/2f), sliceY, (cameraPositionZ + mSize/2f)); * GL.Normal3( -1.0f, 1.0f, 1.0f); * GL.TexCoord2(numberOfTextureRepeats, 0.0f); GL.Vertex3( (float)(cameraPositionX + mSize/2f), sliceY, (cameraPositionZ - mSize/2f)); * GL.Normal3( 1.0f, 1.0f, 1.0f); * GL.TexCoord2(0.0f, 0.0f); GL.Vertex3( (float)(cameraPositionX -mSize/2f), sliceY, (cameraPositionZ - mSize/2f)); * GL.Normal3( 1.0f, 1.0f, -1.0f); * GL.TexCoord2(0.0f, numberOfTextureRepeats); GL.Vertex3( (float)(cameraPositionX -mSize/2f), sliceY, (cameraPositionZ + mSize/2f)); * GL.Disable (EnableCap.Texture2D); * GL.Enable(EnableCap.DepthTest); * GL.End (); * * GL.PopMatrix(); */ fileSliceModelMatrix = parentWindow.GetCamera().CameraModelMatrix; MoveIntoPosition(false, ref fileSliceModelMatrix); Node.SetBoxState(isDimmed); for (int i = fileNodes.Length - 1; i >= 0; i--) { float nodeZ = sliceZ + fileNodes[i].Position.Z; float nodeX = sliceX + fileNodes [i].Position.X - 2.1f; float nodeY = sliceY + fileNodes[i].Position.Y; if (/*(nodeZ > parentWindow.GetCamera().Position.Z) && */ //If you don't want to show all the boxes that are behind you - uncomment this line; For VR we need every box to be visible (culler.isBoxVisible(nodeX, nodeY, nodeZ, 3f, 8f))) //TODO: correct culler { fileNodes[i].culled = false; fileNodes[i].DrawBox(i, parentWindow.FrameDelta); //the main boxes drawing method } else { fileNodes[i].culled = true; cullCount++; } } Node.UnsetBoxState(isDimmed); Node.SetTextState(isDimmed); for (int i = fileNodes.Length - 1; i >= 0; i--) { if (!fileNodes[i].culled) { fileNodes[i].DrawLabel(); } } Node.UnsetTextState(isDimmed); } }