//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
//**************** Copyright (c) 2016 Marko Pintera (marko.pintera@gmail.com). All rights reserved. **********************//
using System;
using System.Runtime.CompilerServices;
using bs;
namespace bs.Editor
{
/** @addtogroup Scene-Editor
* @{
*/
///
/// Determines how is grid drawn.
///
internal enum GridMode // Note: Must match C++ enum GridMode
{
Perspective,
OrthoX,
OrthoY,
OrthoZ,
OrthoNegX,
OrthoNegY,
OrthoNegZ
}
///
/// Handles rendering of the scene grid for the specified camera. Grid properties are controlled through
/// .
///
internal sealed class SceneGrid : ScriptObject
{
///
/// Creates a new scene grid renderer.
///
/// Camera into which the grid will be rendered.
internal SceneGrid(Camera sceneCamera)
{
Internal_Create(this, sceneCamera.GetCachedPtr());
}
///
/// Queues grid drawing for this frame.
///
internal void Draw()
{
Internal_Draw(mCachedPtr);
}
///
/// Changes how is the grid drawn.
///
/// Determines orientation and position of the grid so it suits the camera in the provided mode.
///
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);
}
/** @} */
}