Browse Source

Fixed 3D sound in GamePlay.
Fixes to node cloning.
Doxygen fixes.

Darryl Gough 13 years ago
parent
commit
105568dc18

+ 3 - 2
gameplay/src/AnimationTarget.h

@@ -45,6 +45,7 @@ public:
      * 
      * 
      * @param propertyId The ID of the property on the AnimationTarget to set the animation property value on.
      * @param propertyId The ID of the property on the AnimationTarget to set the animation property value on.
      * @param value The container to set the animation property value in.
      * @param value The container to set the animation property value in.
+     * @param blendWeight The blend weight.
      */
      */
     virtual void setAnimationPropertyValue(int propertyId, AnimationValue* value, float blendWeight = 1.0f) = 0;
     virtual void setAnimationPropertyValue(int propertyId, AnimationValue* value, float blendWeight = 1.0f) = 0;
 
 
@@ -76,14 +77,14 @@ protected:
     /**
     /**
      * Deletes the given animation channel from this animation target.
      * Deletes the given animation channel from this animation target.
      * 
      * 
-     * @parma channel The animation channel to delete.
+     * @param channel The animation channel to delete.
      */
      */
     void deleteChannel(Animation::Channel* channel);
     void deleteChannel(Animation::Channel* channel);
 
 
     /**
     /**
      * Copies data from this animation target into the given target for the purpose of cloning.
      * Copies data from this animation target into the given target for the purpose of cloning.
      * 
      * 
-     * @param The target to copy into.
+     * @param target The target to copy into.
      * @param context The clone context.
      * @param context The clone context.
      */
      */
     void cloneInto(AnimationTarget* target, CloneContext &context) const;
     void cloneInto(AnimationTarget* target, CloneContext &context) const;

+ 12 - 12
gameplay/src/AudioBuffer.cpp

@@ -132,23 +132,23 @@ cleanup:
     return NULL;
     return NULL;
 #else
 #else
     // Get the file header in order to determine the type.
     // Get the file header in order to determine the type.
-    AAsset* asset = AAssetManager_open(__assetManager, path, AASSET_MODE_RANDOM);
+    AAsset* asset = AAssetManager_open(__assetManager, path, AASSET_MODE_RANDOM);
     char header[12];
     char header[12];
     if (AAsset_read(asset, header, 12) != 12)
     if (AAsset_read(asset, header, 12) != 12)
     {
     {
         LOG_ERROR_VARG("Invalid audio buffer file: %s", path);
         LOG_ERROR_VARG("Invalid audio buffer file: %s", path);
         return NULL;
         return NULL;
-    }
-
-    // Get the file descriptor for the audio file.
-    off_t start, length;
-    int fd = AAsset_openFileDescriptor(asset, &start, &length);
-    if (fd < 0)
-    {
-        LOG_ERROR_VARG("Failed to open file descriptor for asset: %s", path);
-        return NULL;
-    }
-    AAsset_close(asset);
+    }
+
+    // Get the file descriptor for the audio file.
+    off_t start, length;
+    int fd = AAsset_openFileDescriptor(asset, &start, &length);
+    if (fd < 0)
+    {
+        LOG_ERROR_VARG("Failed to open file descriptor for asset: %s", path);
+        return NULL;
+    }
+    AAsset_close(asset);
     SLDataLocator_AndroidFD data = {SL_DATALOCATOR_ANDROIDFD, fd, start, length};
     SLDataLocator_AndroidFD data = {SL_DATALOCATOR_ANDROIDFD, fd, start, length};
 
 
     // Set the appropriate mime type information.
     // Set the appropriate mime type information.

+ 1 - 1
gameplay/src/AudioController.cpp

@@ -170,7 +170,7 @@ void AudioController::update(long elapsedTime)
     {
     {
 #ifndef __ANDROID__
 #ifndef __ANDROID__
         alListenerf(AL_GAIN, listener->getGain());
         alListenerf(AL_GAIN, listener->getGain());
-        alListenerfv(AL_ORIENTATION, (ALfloat*)&listener->getOrientationForward());
+        alListenerfv(AL_ORIENTATION, (ALfloat*)listener->getOrientation());
         alListenerfv(AL_VELOCITY, (ALfloat*)&listener->getVelocity());
         alListenerfv(AL_VELOCITY, (ALfloat*)&listener->getVelocity());
         alListenerfv(AL_POSITION, (ALfloat*)&listener->getPosition());
         alListenerfv(AL_POSITION, (ALfloat*)&listener->getPosition());
 #else
 #else

+ 1 - 1
gameplay/src/AudioController.h

@@ -58,7 +58,7 @@ private:
     ALCdevice* _alcDevice;
     ALCdevice* _alcDevice;
     ALCcontext* _alcContext;
     ALCcontext* _alcContext;
 #else
 #else
-    SLObjectItf _engineObject;
+    SLObjectItf _engineObject;
     SLEngineItf _engineEngine;
     SLEngineItf _engineEngine;
     SLObjectItf _outputMixObject;
     SLObjectItf _outputMixObject;
     SLObjectItf _listenerObject;
     SLObjectItf _listenerObject;

+ 13 - 2
gameplay/src/AudioListener.cpp

@@ -21,6 +21,8 @@ AudioListener::~AudioListener()
 
 
 AudioListener* AudioListener::getInstance()
 AudioListener* AudioListener::getInstance()
 {
 {
+    if (!__audioListenerInstance)
+        new AudioListener();
     return __audioListenerInstance;
     return __audioListenerInstance;
 }
 }
 
 
@@ -54,6 +56,11 @@ void AudioListener::setVelocity(const Vector3& velocity)
     _velocity = velocity;
     _velocity = velocity;
 }
 }
 
 
+const float* AudioListener::getOrientation() const
+{
+    return (const float*)&_orientation[0];
+}
+
 const Vector3& AudioListener::getOrientationForward() const 
 const Vector3& AudioListener::getOrientationForward() const 
 { 
 { 
     return _orientation[0]; 
     return _orientation[0]; 
@@ -106,8 +113,12 @@ void AudioListener::transformChanged(Transform* transform, long cookie)
 {
 {
     if (transform)
     if (transform)
     {
     {
-        setPosition(transform->getTranslation());
-        setOrientation(transform->getForwardVector(), transform->getUpVector());
+        Node* node = static_cast<Node*>(transform);
+        setPosition(node->getTranslationWorld());
+        
+        Vector3 up;
+        node->getWorldMatrix().getUpVector(&up);
+        setOrientation(node->getForwardVectorWorld(), up);
     }
     }
 }
 }
 
 

+ 8 - 0
gameplay/src/AudioListener.h

@@ -67,6 +67,14 @@ public:
      */
      */
     void setVelocity(const Vector3& velocity);
     void setVelocity(const Vector3& velocity);
 
 
+    /**
+     * Gets the float pointer to the orientation of the audio listener.
+     * Orientation is represented as 6 floats. (forward.x, forward.y, forward.z, up.x, up.y, up.z).
+     * 
+     * @return Pointer to the 6 orientation float values.
+     */
+    const float* getOrientation() const;
+
     /**
     /**
      * Gets the forward orientation vector of the audio listener.
      * Gets the forward orientation vector of the audio listener.
      *
      *

+ 36 - 1
gameplay/src/AudioSource.cpp

@@ -454,6 +454,8 @@ void AudioSource::setNode(Node* node)
         if (_node)
         if (_node)
         {
         {
             _node->addListener(this);
             _node->addListener(this);
+            // Update the audio source position.
+            transformChanged(_node, 0);
         }
         }
     }
     }
 }
 }
@@ -461,7 +463,8 @@ void AudioSource::setNode(Node* node)
 void AudioSource::transformChanged(Transform* transform, long cookie)
 void AudioSource::transformChanged(Transform* transform, long cookie)
 {
 {
 #ifndef __ANDROID__
 #ifndef __ANDROID__
-    alSourcefv(_alSource, AL_POSITION, (const ALfloat*)&transform->getTranslation());
+    if (_node)
+        alSourcefv(_alSource, AL_POSITION, (const ALfloat*)&_node->getTranslationWorld());
 #else
 #else
     if (_playerLocation)
     if (_playerLocation)
     {
     {
@@ -478,4 +481,36 @@ void AudioSource::transformChanged(Transform* transform, long cookie)
 #endif
 #endif
 }
 }
 
 
+AudioSource* AudioSource::clone(CloneContext &context) const
+{
+#ifndef __ANDROID__
+    ALuint alSource = 0;
+    alGenSources(1, &alSource);
+    if (alGetError() != AL_NO_ERROR)
+    {
+        LOG_ERROR("AudioSource::createAudioSource - Error generating audio source.");
+        return NULL;
+    }
+    AudioSource* audioClone = new AudioSource(_buffer, alSource);
+#else
+    // TODO: Implement cloning audio source for Android
+    AudioSource* audioClone = new AudioSource(AudioBuffer* buffer, const SLObjectItf& player);
+
+#endif
+
+    audioClone->setLooped(isLooped());
+    audioClone->setGain(getGain());
+    audioClone->setPitch(getPitch());
+    audioClone->setVelocity(getVelocity());
+    if (Node* node = audioClone->getNode())
+    {
+        Node* clonedNode = context.findClonedNode(node);
+        if (clonedNode)
+        {
+            audioClone->setNode(clonedNode);
+        }
+    }
+    return audioClone;
+}
+
 }
 }

+ 15 - 6
gameplay/src/AudioSource.h

@@ -176,15 +176,24 @@ private:
      */
      */
     void transformChanged(Transform* transform, long cookie);
     void transformChanged(Transform* transform, long cookie);
 
 
+    /**
+     * Clones the audio source and returns a new audio source.
+     * 
+     * @param context The clone context.
+     * 
+     * @return The newly created audio source.
+     */
+    AudioSource* clone(CloneContext &context) const;
+
 #ifndef __ANDROID__
 #ifndef __ANDROID__
     ALuint _alSource;
     ALuint _alSource;
 #else
 #else
-    SLObjectItf _playerObject;
-    SL3DDopplerItf _playerDoppler;
-    SL3DLocationItf _playerLocation;
-    SLPlayItf _playerPlay;
-    SLPitchItf _playerPitch;
-    SLSeekItf _playerSeek;
+    SLObjectItf _playerObject;
+    SL3DDopplerItf _playerDoppler;
+    SL3DLocationItf _playerLocation;
+    SLPlayItf _playerPlay;
+    SLPitchItf _playerPitch;
+    SLSeekItf _playerSeek;
     SLVolumeItf _playerVolume;
     SLVolumeItf _playerVolume;
     SLmillibel _maxVolume;
     SLmillibel _maxVolume;
 #endif
 #endif

+ 20 - 0
gameplay/src/Camera.cpp

@@ -343,6 +343,26 @@ void Camera::pickRay(const Viewport* viewport, float x, float y, Ray* dst)
     dst->set(nearPoint, direction);
     dst->set(nearPoint, direction);
 }
 }
 
 
+Camera* Camera::clone(CloneContext &context) const
+{
+    Camera* cameraClone = NULL;
+    if (getCameraType() == PERSPECTIVE)
+    {
+        cameraClone = createPerspective(_fieldOfView, _aspectRatio, _nearPlane, _farPlane);
+    }
+    else if (getCameraType() == ORTHOGRAPHIC)
+    {
+        cameraClone = createOrthographic(getZoomX(), getZoomY(), getAspectRatio(), _nearPlane, _farPlane);
+    }
+    assert(cameraClone);
+
+    if (Node* node = context.findClonedNode(getNode()))
+    {
+        cameraClone->setNode(node);
+    }
+    return cameraClone;
+}
+
 void Camera::transformChanged(Transform* transform, long cookie)
 void Camera::transformChanged(Transform* transform, long cookie)
 {
 {
     _dirtyBits |= CAMERA_DIRTY_VIEW | CAMERA_DIRTY_INV_VIEW | CAMERA_DIRTY_INV_VIEW_PROJ | CAMERA_DIRTY_VIEW_PROJ | CAMERA_DIRTY_BOUNDS;
     _dirtyBits |= CAMERA_DIRTY_VIEW | CAMERA_DIRTY_INV_VIEW | CAMERA_DIRTY_INV_VIEW_PROJ | CAMERA_DIRTY_VIEW_PROJ | CAMERA_DIRTY_BOUNDS;

+ 9 - 0
gameplay/src/Camera.h

@@ -245,6 +245,15 @@ private:
      */
      */
     virtual ~Camera();
     virtual ~Camera();
 
 
+    /**
+     * Clones the camera and returns a new camera.
+     * 
+     * @param context The clone context.
+     * 
+     * @return The newly created camera.
+     */
+    Camera* clone(CloneContext &context) const;
+
     /**
     /**
      * @see Transform::Listener::transformChanged
      * @see Transform::Listener::transformChanged
      */
      */

+ 8 - 4
gameplay/src/Font.h

@@ -157,8 +157,8 @@ public:
      *
      *
      * @param text The text to measure.
      * @param text The text to measure.
      * @param size
      * @param size
-     * @param width Destination for the text's width.
-     * @param height Destination for the text's height.
+     * @param widthOut Destination for the text's width.
+     * @param heightOut Destination for the text's height.
      */
      */
     void measureText(const char* text, unsigned int size, unsigned int* widthOut, unsigned int* heightOut);
     void measureText(const char* text, unsigned int size, unsigned int* widthOut, unsigned int* heightOut);
 
 
@@ -177,11 +177,15 @@ public:
     void measureText(const char* text, const Rectangle& clip, unsigned int size, Rectangle* out,
     void measureText(const char* text, const Rectangle& clip, unsigned int size, Rectangle* out,
                      Justify justify = ALIGN_TOP_LEFT, bool wrap = true, bool ignoreClip = false);
                      Justify justify = ALIGN_TOP_LEFT, bool wrap = true, bool ignoreClip = false);
 
 
-    // Get an index into a string corresponding to the character nearest the given location within the clip region.
+    /**
+     * Get an index into a string corresponding to the character nearest the given location within the clip region.
+     */
     unsigned int getIndexAtLocation(const char* text, const Rectangle& clip, unsigned int size, const Vector2& inLocation, Vector2* outLocation,
     unsigned int getIndexAtLocation(const char* text, const Rectangle& clip, unsigned int size, const Vector2& inLocation, Vector2* outLocation,
                                     Justify justify = ALIGN_TOP_LEFT, bool wrap = true, bool rightToLeft = false);
                                     Justify justify = ALIGN_TOP_LEFT, bool wrap = true, bool rightToLeft = false);
 
 
-    // Get the location of the character at the given index.
+    /**
+     * Get the location of the character at the given index.
+     */
     void getLocationAtIndex(const char* text, const Rectangle& clip, unsigned int size, Vector2* outLocation, const unsigned int destIndex,
     void getLocationAtIndex(const char* text, const Rectangle& clip, unsigned int size, Vector2* outLocation, const unsigned int destIndex,
                             Justify justify = ALIGN_TOP_LEFT, bool wrap = true, bool rightToLeft = false);
                             Justify justify = ALIGN_TOP_LEFT, bool wrap = true, bool rightToLeft = false);
 
 

+ 26 - 0
gameplay/src/Light.cpp

@@ -196,6 +196,32 @@ float Light::getOuterAngleCos()  const
     return _spot->outerAngleCos;
     return _spot->outerAngleCos;
 }
 }
 
 
+Light* Light::clone(CloneContext &context) const
+{
+    Light* lightClone = NULL;
+    switch (_type)
+    {
+    case DIRECTIONAL:
+        lightClone = createDirectional(getColor());
+        break;
+    case POINT:
+        lightClone = createPoint(getColor(), getRange());
+        break;
+    case SPOT:
+        lightClone = createSpot(getColor(), getRange(), getInnerAngle(), getOuterAngle());
+        break;
+    default:
+        assert(false);
+    }
+    assert(lightClone);
+
+    if (Node* node = context.findClonedNode(getNode()))
+    {
+        lightClone->setNode(node);
+    }
+    return lightClone;
+}
+
 Light::Directional::Directional(const Vector3& color)
 Light::Directional::Directional(const Vector3& color)
     : color(color)
     : color(color)
 {
 {

+ 15 - 5
gameplay/src/Light.h

@@ -3,6 +3,7 @@
 
 
 #include "Ref.h"
 #include "Ref.h"
 #include "Vector3.h"
 #include "Vector3.h"
+#include "CloneContext.h"
 
 
 namespace gameplay
 namespace gameplay
 {
 {
@@ -54,8 +55,8 @@ public:
      * 
      * 
      * @param color The light's color.
      * @param color The light's color.
      * @param range The light's range.
      * @param range The light's range.
-     * @param innerCosAngle The light's inner angle (in radians).
-     * @param outerCosAngle The light's outer angle (in radians).
+     * @param innerAngle The light's inner angle (in radians).
+     * @param outerAngle The light's outer angle (in radians).
      * 
      * 
      * @return The new spot light.
      * @return The new spot light.
      */
      */
@@ -104,7 +105,7 @@ public:
     /**
     /**
      * Sets the range of point or spot light.
      * Sets the range of point or spot light.
      *
      *
-     * @param range of point or spot light.
+     * @param range The range of point or spot light.
      */
      */
     void setRange(float range);
     void setRange(float range);
 
 
@@ -125,7 +126,7 @@ public:
     /**
     /**
      * Sets the inner angle of a spot light (in radians).
      * Sets the inner angle of a spot light (in radians).
      *
      *
-     * @param inner angle of spot light (in radians).
+     * @param innerAngle The angle of spot light (in radians).
      */
      */
     void setInnerAngle(float innerAngle);
     void setInnerAngle(float innerAngle);
 
 
@@ -139,7 +140,7 @@ public:
     /**
     /**
      * Sets the outer angle of a spot light (in radians).
      * Sets the outer angle of a spot light (in radians).
      *
      *
-     * @param outer angle of spot light (in radians).
+     * @param outerAngle The angle of spot light (in radians).
      */
      */
     void setOuterAngle(float outerAngle);
     void setOuterAngle(float outerAngle);
 
 
@@ -223,6 +224,15 @@ private:
      */
      */
     void setNode(Node* node);
     void setNode(Node* node);
 
 
+    /**
+     * Clones the light and returns a new light.
+     * 
+     * @param context The clone context.
+     * 
+     * @return The newly created light.
+     */
+    Light* clone(CloneContext &context) const;
+
     Light::Type _type;
     Light::Type _type;
     union
     union
     {
     {

+ 5 - 0
gameplay/src/MaterialParameter.h

@@ -259,6 +259,11 @@ private:
 
 
     void applyAnimationValue(AnimationValue* value, float blendWeight, int components);
     void applyAnimationValue(AnimationValue* value, float blendWeight, int components);
 
 
+    /**
+     * Copies the data from this MaterialParameter into the given MaterialParameter.
+     * 
+     * @param materialParameter The MaterialParameter to copy the data to.
+     */
     void cloneInto(MaterialParameter* materialParameter) const;
     void cloneInto(MaterialParameter* materialParameter) const;
 
 
     unsigned int _count;
     unsigned int _count;

+ 1 - 1
gameplay/src/MeshBatch.h

@@ -54,7 +54,7 @@ public:
     /**
     /**
      * Explicitly sets a new capacity for the batch.
      * Explicitly sets a new capacity for the batch.
      *
      *
-     * @param The new batch capacity.
+     * @param capacity The new batch capacity.
      */
      */
     void setCapacity(unsigned int capacity);
     void setCapacity(unsigned int capacity);
 
 

+ 1 - 1
gameplay/src/Model.h

@@ -180,7 +180,7 @@ private:
     /**
     /**
      * Clones the model and returns a new model.
      * Clones the model and returns a new model.
      * 
      * 
-     * @param context The CloneContext.
+     * @param context The clone context.
      * 
      * 
      * @return The new cloned model.
      * @return The new cloned model.
      */
      */

+ 20 - 4
gameplay/src/Node.cpp

@@ -3,7 +3,6 @@
 #include "Scene.h"
 #include "Scene.h"
 #include "Joint.h"
 #include "Joint.h"
 #include "Game.h"
 #include "Game.h"
-#include "CloneContext.h"
 
 
 #define NODE_DIRTY_WORLD 1
 #define NODE_DIRTY_WORLD 1
 #define NODE_DIRTY_BOUNDS 2
 #define NODE_DIRTY_BOUNDS 2
@@ -735,11 +734,28 @@ void Node::cloneInto(Node* node, CloneContext &context) const
     // TODO: Clone the rest of the node data.
     // TODO: Clone the rest of the node data.
     //node->setCamera(getCamera());
     //node->setCamera(getCamera());
     //node->setLight(getLight());
     //node->setLight(getLight());
-    //node->setModel(getModel());
 
 
-    if (getModel())
+    if (Camera* camera = getCamera())
     {
     {
-        Model* modelClone = getModel()->clone(context);
+        Camera* cameraClone = camera->clone(context);
+        node->setCamera(cameraClone);
+        cameraClone->release();
+    }
+    if (Light* light = getLight())
+    {
+        Light* lightClone = lightClone = light->clone(context);
+        node->setLight(lightClone);
+        lightClone->release();
+    }
+    if (AudioSource* audio = getAudioSource())
+    {
+        AudioSource* audioClone = audio->clone(context);
+        node->setAudioSource(audioClone);
+        audioClone->release();
+    }
+    if (Model* model = getModel())
+    {
+        Model* modelClone = model->clone(context);
         node->setModel(modelClone);
         node->setModel(modelClone);
         modelClone->release();
         modelClone->release();
     }
     }

+ 4 - 1
gameplay/src/Node.h

@@ -483,7 +483,7 @@ protected:
     /**
     /**
      * Copies the data from this node into the given node.
      * Copies the data from this node into the given node.
      * 
      * 
-     * @param The node to copy the data to.
+     * @param node The node to copy the data to.
      * @param context The clone context.
      * @param context The clone context.
      */
      */
     void cloneInto(Node* node, CloneContext &context) const;
     void cloneInto(Node* node, CloneContext &context) const;
@@ -498,6 +498,9 @@ protected:
      */
      */
     void transformChanged();
     void transformChanged();
 
 
+    /**
+     * Called when this Node's hierarchy changes.
+     */
     void hierarchyChanged();
     void hierarchyChanged();
 
 
     /**
     /**

+ 3 - 3
gameplay/src/ParticleEmitter.h

@@ -432,8 +432,8 @@ public:
      * Gets the maximum rotation speed of each emitted particle.
      * Gets the maximum rotation speed of each emitted particle.
      * This determines the speed of rotation of each particle's screen-facing billboard.
      * This determines the speed of rotation of each particle's screen-facing billboard.
      *
      *
-     * @param min The minimum rotation speed (per particle).
-     * @param max The maximum rotation speed (per particle).
+     * @param speedMin The minimum rotation speed (per particle).
+     * @param speedMax The maximum rotation speed (per particle).
      */
      */
     void setRotationPerParticle(float speedMin, float speedMax);
     void setRotationPerParticle(float speedMin, float speedMax);
 
 
@@ -494,7 +494,7 @@ public:
     /**
     /**
      * Sets whether particles cycle through the sprite frames.
      * Sets whether particles cycle through the sprite frames.
      *
      *
-     * @param animating Whether to animate particles through the sprite frames.
+     * @param animated Whether to animate particles through the sprite frames.
      */
      */
     void setSpriteAnimated(bool animated);
     void setSpriteAnimated(bool animated);
 
 

+ 1 - 1
gameplay/src/Pass.h

@@ -96,7 +96,7 @@ private:
      * Clones the Pass and assigns it the given Technique.
      * Clones the Pass and assigns it the given Technique.
      * 
      * 
      * @param technique The technique to assign to the new Pass.
      * @param technique The technique to assign to the new Pass.
-     * @param context The CloneContext.
+     * @param context The clone context.
      * 
      * 
      * @return The newly created Pass.
      * @return The newly created Pass.
      */
      */

+ 6 - 0
gameplay/src/RenderState.h

@@ -332,6 +332,12 @@ protected:
      */
      */
     RenderState* getTopmost(RenderState* below);
     RenderState* getTopmost(RenderState* below);
 
 
+    /**
+     * Copies the data from this RenderState into the given RenderState.
+     * 
+     * @param renderState The RenderState to copy the data to.
+     * @param context The clone context.
+     */
     void cloneInto(RenderState* renderState, CloneContext& context) const;
     void cloneInto(RenderState* renderState, CloneContext& context) const;
 
 
 private:
 private:

+ 1 - 0
gameplay/src/SpriteBatch.h

@@ -192,6 +192,7 @@ public:
      * @param u2 Texture coordinate.
      * @param u2 Texture coordinate.
      * @param v2 Texture coordinate.
      * @param v2 Texture coordinate.
      * @param color The color to tint the sprite. Use white for no tint.
      * @param color The color to tint the sprite. Use white for no tint.
+     * @param clip The clip rectangle.
      */
      */
     void draw(float x, float y, float width, float height, float u1, float v1, float u2, float v2, const Vector4& color, const Rectangle& clip);
     void draw(float x, float y, float width, float height, float u1, float v1, float u2, float v2, const Vector4& color, const Rectangle& clip);
 
 

+ 1 - 1
gameplay/src/Transform.h

@@ -674,7 +674,7 @@ public:
      * Transforms the specified vector and stores the
      * Transforms the specified vector and stores the
      * result in the original vector.
      * result in the original vector.
      *
      *
-     * @param normal The vector to transform.
+     * @param vector The vector to transform.
      */
      */
     void transformVector(Vector3* vector);
     void transformVector(Vector3* vector);
 
 

+ 2 - 1
gameplay/src/Vector2.cpp

@@ -165,9 +165,10 @@ void Vector2::negate()
     y = -y;
     y = -y;
 }
 }
 
 
-void Vector2::normalize()
+Vector2& Vector2::normalize()
 {
 {
     normalize(this);
     normalize(this);
+    return *this;
 }
 }
 
 
 void Vector2::normalize(Vector2* dst)
 void Vector2::normalize(Vector2* dst)

+ 3 - 1
gameplay/src/Vector2.h

@@ -231,8 +231,10 @@ public:
      * after calling this method will be 1.0f). If the vector
      * after calling this method will be 1.0f). If the vector
      * already has unit length or if the length of the vector
      * already has unit length or if the length of the vector
      * is zero, this method does nothing.
      * is zero, this method does nothing.
+     * 
+     * @return This vector, after the normalization occurs.
      */
      */
-    void normalize();
+    Vector2& normalize();
 
 
     /**
     /**
      * Normalizes this vector and stores the result in dst.
      * Normalizes this vector and stores the result in dst.

+ 2 - 1
gameplay/src/Vector3.cpp

@@ -230,9 +230,10 @@ void Vector3::negate()
     z = -z;
     z = -z;
 }
 }
 
 
-void Vector3::normalize()
+Vector3& Vector3::normalize()
 {
 {
     normalize(this);
     normalize(this);
+    return *this;
 }
 }
 
 
 void Vector3::normalize(Vector3* dst) const
 void Vector3::normalize(Vector3* dst) const

+ 3 - 1
gameplay/src/Vector3.h

@@ -278,8 +278,10 @@ public:
      * after calling this method will be 1.0f). If the vector
      * after calling this method will be 1.0f). If the vector
      * already has unit length or if the length of the vector
      * already has unit length or if the length of the vector
      * is zero, this method does nothing.
      * is zero, this method does nothing.
+     * 
+     * @return This vector, after the normalization occurs.
      */
      */
-    void normalize();
+    Vector3& normalize();
 
 
     /**
     /**
      * Normalizes this vector and stores the result in dst.
      * Normalizes this vector and stores the result in dst.

+ 2 - 1
gameplay/src/Vector4.cpp

@@ -233,9 +233,10 @@ void Vector4::negate()
     w = -w;
     w = -w;
 }
 }
 
 
-void Vector4::normalize()
+Vector4& Vector4::normalize()
 {
 {
     normalize(this);
     normalize(this);
+    return *this;
 }
 }
 
 
 void Vector4::normalize(Vector4* dst)
 void Vector4::normalize(Vector4* dst)

+ 3 - 1
gameplay/src/Vector4.h

@@ -269,8 +269,10 @@ public:
      * after calling this method will be 1.0f). If the vector
      * after calling this method will be 1.0f). If the vector
      * already has unit length or if the length of the vector
      * already has unit length or if the length of the vector
      * is zero, this method does nothing.
      * is zero, this method does nothing.
+     * 
+     * @return This vector, after the normalization occurs.
      */
      */
-    void normalize();
+    Vector4& normalize();
 
 
     /**
     /**
      * Normalizes this vector and stores the result in dst.
      * Normalizes this vector and stores the result in dst.