public DebugRenderer(MasterRenderer master) : base(master) { batchedAABBs = new HashSet <AxisAlignedBoundingBox>(); batchedRays = new HashSet <RenderableRay>(); bulletImpacts = new List <Impact>(); playerRollbacks = new List <Impact>(); aabbDebugBox = new DebugCube(Color4.White, 1); }
public TerrainEditorTool(EditorScreen screen, WorldEditor editor, EditorToolType type, Key keyBind) : base(screen, editor, type, keyBind) { TerrainEditor = Editor.TerrainEditor; entRenderer = Renderer.GetRenderer3D <EntityRenderer>(); if (cursorCube == null) { cursorCube = new DebugCube(Color4.White, Block.CUBE_SIZE); } }
public ClientMuzzleFlash(MasterRenderer renderer, Player ownerPlayer) { this.renderer = renderer; this.ownerPlayer = ownerPlayer; camera = ownerPlayer.GetCamera(); light = new Light(Vector3.Zero, LightType.Point, 0f, Color.White, new Vector3(1, 0, 0.1f)); light.Visible = false; renderer.Lights.Add(light); flashCube = new DebugCube(Color4.Yellow, 0.7f); flashCube.ApplyNoLighting = true; }
public TerrainEditor(EditorScreen screen) { this.screen = screen; editor = screen.WorldEditor; renderer = screen.Window.Renderer; terrainPhys = new TerrainPhysicsExtension(); entRenderer = renderer.GetRenderer3D <EntityRenderer>(); colorPicker = screen.UI.ColorWindow.ColorPicker; blockCursorCube = new DebugCube(Color4.White, Block.CUBE_SIZE); SelectionBox = new EditorSelectionBox(); undoStack = new Stack <TerrainOperationBatch>(); redoStack = new Stack <TerrainOperationBatch>(); operationBatch = new TerrainOperationBatch(); rayIntersection = new TerrainRaycastResult(new Ray(Vector3.Zero, Vector3.UnitZ)); }
public Spade(ItemManager itemManager, MasterRenderer renderer) : base(renderer, itemManager, ItemType.Spade) { ModelOffset = new Vector3(-3f, -5f, 3f); LoadModel("Models/spade.aosm"); if (GlobalNetwork.IsClient) { entRenderer = renderer.GetRenderer3D <EntityRenderer>(); if (cursorCube == null) { cursorCube = new DebugCube(Color4.Black, Block.CUBE_SIZE); cursorCube.RenderAsWireframe = true; cursorCube.ApplyNoLighting = true; cursorCube.OnlyRenderFor = RenderPass.Normal; } if (!itemManager.IsReplicated) { AudioBuffer hitBlockAudioBuffer = AssetManager.LoadSound("Weapons/Spade/hit-block.wav"); if (hitBlockAudioBuffer != null) { hitBlockAudioSource = new AudioSource(hitBlockAudioBuffer); hitBlockAudioSource.IsSourceRelative = true; hitBlockAudioSource.Gain = 0.2f; } AudioBuffer missAudioBuffer = AssetManager.LoadSound("Weapons/Spade/miss.wav"); if (missAudioBuffer != null) { missAudioSource = new AudioSource(missAudioBuffer); missAudioSource.IsSourceRelative = true; missAudioSource.Gain = 0.5f; } } } }
public BlockItem(ItemManager itemManager, MasterRenderer renderer) : base(itemManager, ItemType.BlockItem) { this.renderer = renderer; ModelOffset = new Vector3(-1.75f, -1.75f, 2.5f); ownerPlayerPhysicsBody = OwnerPlayer.GetComponent <PhysicsBodyComponent>(); if (!GlobalNetwork.IsServer) { entRenderer = renderer.GetRenderer3D <EntityRenderer>(); cube = new DebugCube(Color4.White, 1.5f); Renderer.VoxelObject = cube.VoxelObject; if (cursorCube == null) { cursorCube = new DebugCube(Color4.White, Block.CUBE_SIZE); cursorCube.RenderAsWireframe = true; cursorCube.ApplyNoLighting = true; cursorCube.OnlyRenderFor = RenderPass.Normal; } Colors = new Color[PaletteHeight, PaletteWidth]; for (int y = 0; y < PaletteHeight; y++) { for (int x = 0; x < PaletteWidth; x++) { if (y == 0) { Colors[y, x] = Maths.HSVToRGB(0, 0, Math.Max(x / (float)PaletteWidth, 0.05f)); } else { int halfPalette = PaletteWidth / 2; if (x > halfPalette) { Colors[y, x] = Maths.HSVToRGB( (y - 1) / ((float)PaletteHeight - 1) * 360, 1f - Math.Max((x - halfPalette) / (float)halfPalette, 0.05f), 1f); } else { Colors[y, x] = Maths.HSVToRGB( (y - 1) / ((float)PaletteHeight - 1) * 360, 1f, Math.Max(x / (float)halfPalette, 0.05f)); } } } } BlockColor = Colors[ColorY, ColorX]; if (!itemManager.IsReplicated) { AudioBuffer buildAudioBuffer = AssetManager.LoadSound("Weapons/Block/build.wav"); if (buildAudioBuffer != null) { buildAudioSource = new AudioSource(buildAudioBuffer); buildAudioSource.IsSourceRelative = true; buildAudioSource.Gain = 0.5f; } } } }