| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- using System;
- using System.Runtime.CompilerServices;
- using BansheeEngine;
- namespace BansheeEditor
- {
- /// <summary>
- /// Determines how is grid drawn.
- /// </summary>
- internal enum GridMode // Note: Must match C++ enum GridMode
- {
- Perspective,
- OrthoX,
- OrthoY,
- OrthoZ,
- OrthoNegX,
- OrthoNegY,
- OrthoNegZ
- }
- /// <summary>
- /// Handles rendering of the scene grid for the specified camera. Grid properties are controlled through
- /// <see cref="EditorSettings"/>.
- /// </summary>
- internal sealed class SceneGrid : ScriptObject
- {
- /// <summary>
- /// Creates a new scene grid renderer.
- /// </summary>
- /// <param name="sceneCamera">Camera into which the grid will be rendered.</param>
- internal SceneGrid(Camera sceneCamera)
- {
- Internal_Create(this, sceneCamera.Native.GetCachedPtr());
- }
- /// <summary>
- /// Queues grid drawing for this frame.
- /// </summary>
- internal void Draw()
- {
- Internal_Draw(mCachedPtr);
- }
- /// <summary>
- /// Changes how is the grid drawn.
- /// </summary>
- /// <param name="mode">Determines orientation and position of the grid so it suits the camera in the provided mode.
- /// </param>
- internal void SetMode(GridMode mode)
- {
- Internal_SetMode(mCachedPtr, mode);
- }
- [MethodImpl(MethodImplOptions.InternalCall)]
- private static extern void Internal_Create(SceneGrid managedInstance, IntPtr camera);
- [MethodImpl(MethodImplOptions.InternalCall)]
- private static extern void Internal_Draw(IntPtr thisPtr);
- [MethodImpl(MethodImplOptions.InternalCall)]
- private static extern void Internal_SetMode(IntPtr thisPtr, GridMode mode);
- }
- }
|