summaryrefslogtreecommitdiff
path: root/Runtime/Export/GizmoBindings.txt
blob: ed3266c7b95d3e36c75c529f39f01212d539711e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
C++RAW

#include "UnityPrefix.h"
#include "Runtime/Math/Vector3.h"
#include "Runtime/Geometry/Ray.h"
#include "Runtime/Math/Rect.h"
#include "Runtime/Math/Matrix4x4.h"
#include "Runtime/Graphics/Texture.h"
#include "Runtime/Filters/Misc/Font.h"
#include "Runtime/Shaders/Material.h"
#include "Runtime/IMGUI/TextUtil.h"
#include "Runtime/Camera/RenderLayers/GUITexture.h"
#include "Runtime/Misc/InputEvent.h"
#include "Runtime/Mono/MonoBehaviour.h"
#include "Runtime/Scripting/ScriptingUtility.h"

#if UNITY_EDITOR
#include "Editor/Src/Gizmos/GizmoManager.h"
#include "Editor/Src/Gizmos/GizmoUtil.h"
#include "Editor/Src/Gizmos/GizmoRenderer.h"
#endif

using namespace Unity;

/*
   Mono defines a bool as either 1 or 2 bytes.
   On windows a bool on the C++ side needs to be 2 bytes.
   We use the typemap to map bool's to short's.
   When using the C++ keyword and you want to export a bool value 
   to mono you have to use a short on the C++ side.
*/


void PauseEditor ();
using namespace std;

CSRAW
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Collections;

namespace UnityEngine
{


// Gizmos are used to give visual debugging or setup aids in the scene view.
CLASS Gizmos
	
	C++RAW
 
	static void CheckGizmoDrawing ();
	static void CheckGizmoDrawing ()
	{
		#if !GAMERELEASE
		if (!GizmoManager::Get ().IsDrawingGizmos ())
			Scripting::RaiseMonoException ("Gizmo drawing functions can only be used in OnDrawGizmos and OnDrawGizmosSelected.");
		#endif
	}


	/// *listonly*
	CSRAW public static void DrawRay (Ray r)
	{
		Gizmos.DrawLine (r.origin, r.origin + r.direction);
	}
	// Draws a ray starting at /from/ to /from/ + /direction/.
	CSRAW public static void DrawRay (Vector3 from, Vector3 direction)
	{
		Gizmos.DrawLine (from, from + direction);
	}
	
	

	// Draws a line starting at /from/ towards /to/.
	CUSTOM static void DrawLine (Vector3 from, Vector3 to)
	{
		CheckGizmoDrawing ();
		#if !GAMERELEASE
		DrawLine (from, to);
		#endif
	}
		
	// Draws a wireframe sphere with /center/ and /radius/.
	CUSTOM static void DrawWireSphere (Vector3 center, float radius)
	{
		#if !GAMERELEASE
		CheckGizmoDrawing ();
		DrawWireSphere (center, radius);
		#endif
	}
	
	// Draws a solid sphere with /center/ and /radius/.
	CUSTOM static void DrawSphere (Vector3 center, float radius)
	{
		#if !GAMERELEASE
		CheckGizmoDrawing ();
		DrawSphere (center, radius);
		#endif
	}

	// Draw a wireframe box with /center/ and /size/.
	CUSTOM static void DrawWireCube (Vector3 center, Vector3 size)
	{
		#if !GAMERELEASE
		CheckGizmoDrawing ();
		DrawWireCube (center, size);
		#endif
	}

	// Draw a solid box with /center/ and /size/.
	CUSTOM static void DrawCube (Vector3 center, Vector3 size)
	{
		#if !GAMERELEASE
		CheckGizmoDrawing ();
		DrawCube (center, size);
		#endif
	}


	// Draw an icon at a position in the scene view.
	CUSTOM static void DrawIcon (Vector3 center, string name, bool allowScaling = true)
	{
		#if !GAMERELEASE
		CheckGizmoDrawing ();
		DrawIcon (center, name, allowScaling);
		#endif
	}


	/// *listonly*
	CSRAW public static void DrawGUITexture (Rect screenRect, Texture texture, Material mat = null) { DrawGUITexture (screenRect, texture,0,0,0,0, mat); }
	// Draw a texture in screen coordinates. Useful for GUI backgrounds.
	CUSTOM static void DrawGUITexture (Rect screenRect, Texture texture, int leftBorder, int rightBorder, int topBorder, int bottomBorder, Material mat = null) {
		#if !GAMERELEASE
		CheckGizmoDrawing ();
		DrawGUITexture (screenRect, texture, leftBorder, rightBorder, topBorder, bottomBorder, ColorRGBA32(128,128,128,128), mat);
		#endif	
	}


	// Sets the color for the gizmos that will be drawn next.
	CUSTOM_PROP static Color color
	{
		#if !GAMERELEASE
		return gizmos::g_GizmoColor;
		#endif
		return ColorRGBAf (1,1,1,1);
	}
	{
		#if !GAMERELEASE
		gizmos::g_GizmoColor = value;
		#endif
	}

	// Set the gizmo matrix used to draw all gizmos.
	CUSTOM_PROP static Matrix4x4 matrix
	{
		#if !GAMERELEASE
		return GetGizmoMatrix ();
		#endif
		return Matrix4x4f::identity;
	}
	{
		#if !GAMERELEASE
		SetGizmoMatrix (value);
		#endif
	}

	
	CUSTOM static void DrawFrustum (Vector3 center, float fov, float maxRange, float minRange, float aspect) {
		#if !GAMERELEASE
		DrawFrustum (center, fov, maxRange, minRange, aspect);
		#endif
	}
END



CSRAW }