Kaynağa Gözat

Documentation

BearishSun 10 yıl önce
ebeveyn
işleme
d4f4151761

+ 1 - 1
BansheeCore/Include/BsGameObject.h

@@ -122,7 +122,7 @@ namespace BansheeEngine
 	public:
 		friend class GameObjectRTTI;
 		static RTTITypeBase* getRTTIStatic();
-		virtual RTTITypeBase* getRTTI() const;
+		virtual RTTITypeBase* getRTTI() const override;
 	};
 }
 

+ 4 - 4
BansheeCore/Include/BsSceneObject.h

@@ -27,8 +27,8 @@ namespace BansheeEngine
 	};
 
 	/**
-	 * @brief	SceneObject represents an object in the scene graph. It has a world position,
-	 *			place in the hierarchy and optionally a number of attached components.
+	 * @brief	An object in the scene graph. It has a world position, place in the hierarchy and 
+	 * 			optionally a number of attached components.
 	 */
 	class BS_CORE_EXPORT SceneObject : public GameObject
 	{
@@ -219,8 +219,8 @@ namespace BansheeEngine
 		const Vector3& getWorldScale() const;
 
 		/**
-		 * @brief	Orients the object so it is looking at the provided "location" (local space)
-		 *			where "up" is used for determining the location of the objects Y axis.
+		 * @brief	Orients the object so it is looking at the provided \p location (local space)
+		 *			where \p up is used for determining the location of the object's Y axis.
 		 *
 		 */
 		void lookAt(const Vector3& location, const Vector3& up = Vector3::UNIT_Y);

+ 161 - 14
MBansheeEngine/SceneObject.cs

@@ -3,26 +3,42 @@ using System.Runtime.CompilerServices;
 
 namespace BansheeEngine
 {
+    /// <summary>
+    /// An object in the scene graph. It has a position, place in the hierarchy and optionally a number of attached 
+    /// components.
+    /// </summary>
     public sealed class SceneObject : GameObject
     {
+        /// <summary>
+        /// Name of the scene object.
+        /// </summary>
         public string Name
         {
             get { return Internal_GetName(mCachedPtr); }
             set { Internal_SetName(mCachedPtr, value); }
         }
 
+        /// <summary>
+        /// Parent in the scene object hierarchy. Null for hierarchy root.
+        /// </summary>
         public SceneObject Parent
         {
             get { return Internal_GetParent(mCachedPtr); }
             set { Internal_SetParent(mCachedPtr, value); }
         }
 
+        /// <summary>
+        /// Determines if the object's components are being updated or not.
+        /// </summary>
         public bool Active
         {
             get { return Internal_GetActive(mCachedPtr); }
             set { Internal_SetActive(mCachedPtr, value); }
         }
 
+        /// <summary>
+        /// World position. This includes local position of this object, plus position offset of any parents.
+        /// </summary>
         public Vector3 Position
         {
             get
@@ -38,6 +54,9 @@ namespace BansheeEngine
             }
         }
 
+        /// <summary>
+        /// Local space position (relative to the parent).
+        /// </summary>
         public Vector3 LocalPosition
         {
             get
@@ -53,6 +72,9 @@ namespace BansheeEngine
             }
         }
 
+        /// <summary>
+        /// World rotation. This includes local rotation of this object, plus rotation of any parents.
+        /// </summary>
         public Quaternion Rotation
         {
             get
@@ -68,6 +90,9 @@ namespace BansheeEngine
             }
         }
 
+        /// <summary>
+        /// Local rotation (relative to the parent).
+        /// </summary>
         public Quaternion LocalRotation
         {
             get
@@ -83,6 +108,9 @@ namespace BansheeEngine
             }
         }
 
+        /// <summary>
+        /// World space scale. This includes local scale of this object, plus scale of any parent.
+        /// </summary>
         public Vector3 Scale
         {
             get
@@ -93,6 +121,9 @@ namespace BansheeEngine
             }
         }
 
+        /// <summary>
+        /// Local scale (relative to the parent).
+        /// </summary>
         public Vector3 LocalScale
         {
             get
@@ -108,6 +139,10 @@ namespace BansheeEngine
             }
         }
 
+        /// <summary>
+        /// Returns the world transform matrix. This matrix accounts for position, rotation and scale transformations
+        /// relative to the world basis.
+        /// </summary>
         public Matrix4 WorldTransform
         {
             get
@@ -118,6 +153,10 @@ namespace BansheeEngine
             }
         }
 
+        /// <summary>
+        /// Returns the local transform matrix. This matrix accounts for position, rotation and scale transformations
+        /// relative to the parent's basis.
+        /// </summary>
         public Matrix4 LocalTransform
         {
             get
@@ -128,6 +167,9 @@ namespace BansheeEngine
             }
         }
 
+        /// <summary>
+        /// Direction in world space that points along the local positive Z axis.
+        /// </summary>
         public Vector3 Forward
         {
             get
@@ -142,6 +184,9 @@ namespace BansheeEngine
             }
         }
 
+        /// <summary>
+        /// Direction in world space that points along the local positive X axis.
+        /// </summary>
         public Vector3 Right
         {
             get
@@ -152,6 +197,9 @@ namespace BansheeEngine
             }
         }
 
+        /// <summary>
+        /// Direction in world space that points along the local positive Y axis.
+        /// </summary>
         public Vector3 Up
         {
             get
@@ -162,17 +210,29 @@ namespace BansheeEngine
             }
         }
 
-        // For internal use by the runtime
+        /// <summary>
+        /// Constructor for internal use by the runtime.
+        /// </summary>
         private SceneObject()
         {
             
         }
 
+        /// <summary>
+        /// Creates a new scene object. Object will initially be parented to scene root and placed at the world origin.
+        /// </summary>
+        /// <param name="name">Name of the scene object.</param>
         public SceneObject(string name)
         {
             Internal_CreateInstance(this, name, 0);
         }
 
+        /// <summary>
+        /// Creates a new scene object. Object will initially be parented to scene root and placed at the world origin.
+        /// </summary>
+        /// <param name="name">Name of the scene object.</param>
+        /// <param name="isInternal">Specifies this object is for internal use by the runtime. Internal object will not
+        ///                          get saved, nor will they be displayed in the editor during non-debug mode.</param>
         internal SceneObject(string name, bool isInternal)
         {
             if(isInternal)
@@ -181,36 +241,67 @@ namespace BansheeEngine
                 Internal_CreateInstance(this, name, 0);
         }
 
+        /// <summary>
+        /// Constructs a new component of the specified type and adds it to the internal component list.
+        /// </summary>
+        /// <typeparam name="T">Type of component to create.</typeparam>
+        /// <returns>Instance of the new component.</returns>
         public T AddComponent<T>() where T : Component
         {
             return (T)Component.Internal_AddComponent(this, typeof (T));
         }
 
+        /// <summary>
+        /// Constructs a new component of the specified type and adds it to the internal component list.
+        /// </summary>
+        /// <param name="type">Type of component to create.</param>
+        /// <returns>Instance of the new component.</returns>
         public Component AddComponent(Type type)
         {
             return Component.Internal_AddComponent(this, type);
         }
 
+        /// <summary>
+        /// Searches for a component of a specific type.
+        /// </summary>
+        /// <typeparam name="T">Type of the component to search for.</typeparam>
+        /// <returns>Component instance if found, null otherwise.</returns>
         public T GetComponent<T>() where T : Component
         {
             return (T)Component.Internal_GetComponent(this, typeof(T));
         }
 
+        /// <summary>
+        /// Returns a list of all components attached to this object.
+        /// </summary>
+        /// <returns>All components attached to this object.</returns>
         public Component[] GetComponents()
         {
             return Component.Internal_GetComponents(this);
         }
 
+        /// <summary>
+        /// Removes a component from the scene object.
+        /// </summary>
+        /// <typeparam name="T">Type of the component to remove.</typeparam>
         public void RemoveComponent<T>() where T : Component
         {
             Component.Internal_RemoveComponent(this, typeof(T));
         }
 
+        /// <summary>
+        /// Removes a component from the scene object.
+        /// </summary>
+        /// <param name="type">Type of the component to remove.</param>
         public void RemoveComponent(Type type)
         {
             Component.Internal_RemoveComponent(this, type);
         }
 
+        /// <summary>
+        /// Returns the number of child scene objects this object is parent to.
+        /// </summary>
+        /// <returns>Number of child scene objects.</returns>
         public int GetNumChildren()
         {
             int value;
@@ -218,51 +309,95 @@ namespace BansheeEngine
             return value;
         }
 
+        /// <summary>
+        /// Returns a child scene object.
+        /// </summary>
+        /// <param name="idx">Index of the child scene object to retrieve.</param>
+        /// <returns>Instance of the child scene object, or null if index is out of range.</returns>
         public SceneObject GetChild(int idx)
         {
             return Internal_GetChild(mCachedPtr, idx);
         }
 
-        public void LookAt(Vector3 direction)
+        /// <summary>
+        /// Orients the object so it is looking at the provided location.
+        /// </summary>
+        /// <param name="position">Position in local space where to look at.</param>
+        public void LookAt(Vector3 position)
         {
-            Internal_LookAt(mCachedPtr, direction, Vector3.YAxis);
+            Internal_LookAt(mCachedPtr, position, Vector3.YAxis);
         }
 
-        public void LookAt(Vector3 direction, Vector3 up)
+        /// <summary>
+        /// Orients the object so it is looking at the provided location.
+        /// </summary>
+        /// <param name="position">Position in local space where to look at.</param>
+        /// <param name="up">Determines the object's Y axis orientation.</param>
+        public void LookAt(Vector3 position, Vector3 up)
         {
-            Internal_LookAt(mCachedPtr, direction, up);
+            Internal_LookAt(mCachedPtr, position, up);
         }
 
+        /// <summary>
+        /// Moves the object's position by the vector offset provided along world axes.
+        /// </summary>
+        /// <param name="amount">Amount and direction to move the object along.</param>
         public void Move(Vector3 amount)
         {
             Internal_Move(mCachedPtr, amount);
         }
 
+        /// <summary>
+        /// Moves the object's position by the vector offset provided along local axes.
+        /// </summary>
+        /// <param name="amount">Amount and direction to move the object along.</param>
         public void MoveLocal(Vector3 amount)
         {
             Internal_MoveLocal(mCachedPtr, amount);
         }
 
+        /// <summary>
+        /// Rotates the object by the quaternion, in world space.
+        /// </summary>
+        /// <param name="amount">Quaternion that specifies the rotation.</param>
         public void Rotate(Quaternion amount)
         {
             Internal_Rotate(mCachedPtr, amount);
         }
 
+        /// <summary>
+        /// Rotates around local Z axis.
+        /// </summary>
+        /// <param name="angle">Angle to rotate by.</param>
         public void Roll(Degree angle)
         {
             Internal_Roll(mCachedPtr, angle);
         }
 
+        /// <summary>
+        /// Rotates around local Y axis.
+        /// </summary>
+        /// <param name="angle">Angle to rotate by.</param>
         public void Yaw(Degree angle)
         {
             Internal_Yaw(mCachedPtr, angle);
         }
 
+        /// <summary>
+        /// Rotates around local X axis.
+        /// </summary>
+        /// <param name="angle">Angle to rotate by.</param>
         public void Pitch(Degree angle)
         {
             Internal_Pitch(mCachedPtr, angle);
         }
 
+        /// <summary>
+        /// Destroys the scene object, removing it from scene and stopping component updates.
+        /// </summary>
+        /// <param name="immediate">If true the scene object will be fully destroyed immediately. This means that objects
+        ///                         that are still referencing this scene object might fail. Normally destruction is delayed
+        ///                         until the end of the frame to give other object's a chance to stop using it.</param>
         public void Destroy(bool immediate = false)
         {
             Internal_Destroy(mCachedPtr, immediate);
@@ -374,15 +509,27 @@ namespace BansheeEngine
         private static extern void Internal_Destroy(IntPtr nativeInstance, bool immediate);
     }
 
-    // Note: Must be equal to C++ enum SceneObjectFlags
-    internal enum SceneObjectEditorFlags
+    /// <summary>
+    /// Flags that can be used for controlling scene object behaviour.
+    /// </summary>
+    internal enum SceneObjectEditorFlags // Note: Must match C++ enum SceneObjectFlags
     {
-        DontInstantiate = 0x01, /**< Object wont be in the main scene and its components won't receive updates. */
-        DontSave = 0x02,		/**< Object will be skipped when saving the scene hierarchy or a prefab. */
-        Persistent = 0x04,		/**< Object will remain in the scene even after scene clear, unless destroyed directly. 
-									 This only works with top-level objects. */
-        Internal = 0x08			/**< Provides a hint to external systems that his object is used by engine internals.
-									 For example, those systems might not want to display those objects together with the
-									 user created ones. */
+        /// <summary>Object wont be in the main scene and its components won't receive updates.</summary>
+        DontInstantiate = 0x01,
+
+        /// <summary> Object will be skipped when saving the scene hierarchy or a prefab.</summary>
+        DontSave = 0x02,
+
+        /// <summary>
+        /// Object will remain in the scene even after scene clear, unless destroyed directly. This only works with 
+        /// top-level objects.
+        /// </summary>
+        Persistent = 0x04,
+
+        /// <summary>
+        /// Provides a hint to external systems that his object is used by engine internals. For example, those systems 
+        /// might not want to display those objects together with the user created ones.
+        /// </summary>
+        Internal = 0x08
     }
 }

+ 12 - 0
MBansheeEngine/ScriptCode.cs

@@ -3,20 +3,32 @@ using System.Runtime.CompilerServices;
 
 namespace BansheeEngine
 {
+    /// <summary>
+    /// A resource containing compileable script code.
+    /// </summary>
     public class ScriptCode : Resource
     {
+        /// <summary>
+        /// Script code text.
+        /// </summary>
         public string Text
         {
             get { return Internal_GetText(mCachedPtr); }
             set { Internal_SetText(mCachedPtr, value); }
         }
 
+        /// <summary>
+        /// Determines should the script code be compiled with editor assemblies.
+        /// </summary>
         public bool EditorScript
         {
             get { return Internal_IsEditorScript(mCachedPtr); }
             set { Internal_SetEditorScript(mCachedPtr, value); }
         }
 
+        /// <summary>
+        /// Returns all script types that have been created when this script code resource was compiled.
+        /// </summary>
         public Type[] Types
         {
             get { return Internal_GetTypes(mCachedPtr); }

+ 13 - 0
MBansheeEngine/ScriptObject.cs

@@ -3,10 +3,19 @@ using System.Runtime.CompilerServices;
 
 namespace BansheeEngine
 {
+    /// <summary>
+    /// A base class for all script objects that interface with the native code.
+    /// </summary>
     public class ScriptObject
     {
+        /// <summary>
+        /// A pointer to the native script interop object.
+        /// </summary>
         internal IntPtr mCachedPtr;
 
+        /// <summary>
+        /// Notifies the native script interop object that the managed instance was finalized.
+        /// </summary>
         ~ScriptObject()
         {
             if (mCachedPtr == IntPtr.Zero)
@@ -22,6 +31,10 @@ namespace BansheeEngine
                 Internal_ManagedInstanceDeleted(mCachedPtr);
         }
 
+        /// <summary>
+        /// Returns a pointer to the native script interop object.
+        /// </summary>
+        /// <returns>Pointer to the native script interop object</returns>
         internal IntPtr GetCachedPtr()
         {
             return mCachedPtr;

+ 21 - 1
MBansheeEngine/SerializableArray.cs

@@ -4,18 +4,29 @@ using System.Runtime.CompilerServices;
 namespace BansheeEngine
 {
     #pragma warning disable 649
+
+    /// <summary>
+    /// Allows you to access meta-data about a managed array and its children. Similar to Reflection but simpler and faster.
+    /// </summary>
     public sealed class SerializableArray : ScriptObject
     {
         private SerializableProperty.FieldType elementType;
         private Type internalElementType;
         private SerializableProperty parentProperty;
 
+        /// <summary>
+        /// Type of elements stored in the array.
+        /// </summary>
         public SerializableProperty.FieldType ElementType
         {
             get { return elementType; }
         }
 
-        // Constructed from native code
+        /// <summary>
+        /// Constructor for use by the runtime only.
+        /// </summary>
+        /// <param name="internalElementType">C# type of the elements in the array.</param>
+        /// <param name="parentProperty">Property this array belongs to.</param>
         private SerializableArray(Type internalElementType, SerializableProperty parentProperty)
         {
             this.parentProperty = parentProperty;
@@ -23,6 +34,11 @@ namespace BansheeEngine
             elementType = SerializableProperty.DetermineFieldType(internalElementType);
         }
 
+        /// <summary>
+        /// Returns a serializable property for a specific array element.
+        /// </summary>
+        /// <param name="elementIdx">Index of the element in the array.</param>
+        /// <returns>Serializable property for the element that may be used for querying element meta-data.</returns>
         public SerializableProperty GetProperty(int elementIdx)
         {
             SerializableProperty.Getter getter = () =>
@@ -49,6 +65,10 @@ namespace BansheeEngine
             return property;
         }
 
+        /// <summary>
+        /// Returns number of elements in the array.
+        /// </summary>
+        /// <returns>Number of elements in the array.</returns>
         public int GetLength()
         {
             Array array = parentProperty.GetValue<Array>();

+ 27 - 2
MBansheeEngine/SerializableDictionary.cs

@@ -5,7 +5,12 @@ using System.Runtime.CompilerServices;
 
 namespace BansheeEngine
 {
-#pragma warning disable 649
+    #pragma warning disable 649
+
+    /// <summary>
+    /// Allows you to access meta-data about a managed dictionary and its children. Similar to Reflection but simpler and 
+    /// faster.
+    /// </summary>
     public sealed class SerializableDictionary : ScriptObject
     {
         private SerializableProperty.FieldType keyType;
@@ -14,17 +19,28 @@ namespace BansheeEngine
         private Type internalValueType;
         private SerializableProperty parentProperty;
 
+        /// <summary>
+        /// Type of keys stored in the dictionary.
+        /// </summary>
         public SerializableProperty.FieldType KeyType
         {
             get { return keyType; }
         }
 
+        /// <summary>
+        /// Type of values stored in the dictionary.
+        /// </summary>
         public SerializableProperty.FieldType ValueType
         {
             get { return valueType; }
         }
 
-        // Constructed from native code
+        /// <summary>
+        /// Constructor for use by the runtime only.
+        /// </summary>
+        /// <param name="internalKeyType">C# type of the keys in the dictionary.</param>
+        /// <param name="internalValueType">C# type of the values in the dictionary.</param>
+        /// <param name="parentProperty">Property this dictionary belongs to.</param>
         private SerializableDictionary(Type internalKeyType, Type internalValueType, SerializableProperty parentProperty)
         {
             this.parentProperty = parentProperty;
@@ -34,6 +50,11 @@ namespace BansheeEngine
             valueType = SerializableProperty.DetermineFieldType(internalValueType);
         }
 
+        /// <summary>
+        /// Returns a property that can be used for retrieving meta-data about a value in the dictionary.
+        /// </summary>
+        /// <param name="key">Dictionary key for the value to retrieve.</param>
+        /// <returns>Serializable property for the element that may be used for querying element meta-data.</returns>
         public KeyValuePair<SerializableProperty, SerializableProperty> GetProperty(object key)
         {
             IDictionary dictionary = parentProperty.GetValue<IDictionary>();
@@ -77,6 +98,10 @@ namespace BansheeEngine
             return new KeyValuePair<SerializableProperty, SerializableProperty>(keyProperty, valueProperty);
         }
 
+        /// <summary>
+        /// Returns the total number of elements in the dictionary.
+        /// </summary>
+        /// <returns>Total number of elements in the dictionary.</returns>
         public int GetLength()
         {
             IDictionary dictionary = parentProperty.GetValue<IDictionary>();