1
0
mirror of https://github.com/Halofreak1990/XFXFramework synced 2024-12-26 13:49:34 +01:00

Updated comments

Added some new Type infos
Removed excess whitespace
Added some new files
Implemented missing methods
This commit is contained in:
Tom Lint 2013-08-13 20:04:25 +02:00
parent c56db35373
commit 3a960b5829
66 changed files with 1290 additions and 929 deletions

View File

@ -8,14 +8,20 @@
#define _XFX_AUDIO_AUDIOEMITTER_ #define _XFX_AUDIO_AUDIOEMITTER_
#include <System/Object.h> #include <System/Object.h>
#include <System/Type.h>
#include <Vector3.h> #include <Vector3.h>
using namespace System;
namespace XFX namespace XFX
{ {
namespace Audio namespace Audio
{ {
class AudioEmitter : public Object class AudioEmitter : public Object
{ {
private:
static const Type AudioEmitterTypeInfo;
public: public:
float DopplerScale; float DopplerScale;
Vector3 Forward; Vector3 Forward;
@ -25,8 +31,13 @@ namespace XFX
AudioEmitter() { } AudioEmitter() { }
inline int GetType() const { } const Type& GetType()
{
return AudioEmitterTypeInfo;
}
}; };
const Type AudioEmitter::AudioEmitterTypeInfo = Type("AudioEmitter", "XFX::Audio::AudioEmitter", TypeCode::Object);
} }
} }

View File

@ -27,12 +27,15 @@ namespace XFX
*/ */
class SoundEffect : public IDisposable, public Object class SoundEffect : public IDisposable, public Object
{ {
friend class SoundEffectInstance;
private: private:
static float distanceScale; static float distanceScale;
static float dopplerScale; static float dopplerScale;
TimeSpan duration; TimeSpan duration;
bool isDisposed; bool isDisposed;
static float masterVolume; static float masterVolume;
int referenceCount;
static float speedOfSound; static float speedOfSound;
float volume; float volume;

View File

@ -29,7 +29,7 @@ namespace XFX
SoundEffect* _parent; SoundEffect* _parent;
float _volume; float _volume;
SoundEffectInstance(SoundEffect* parent); SoundEffectInstance(SoundEffect * const parent);
virtual void Dispose(bool disposing); virtual void Dispose(bool disposing);

View File

@ -1,9 +1,9 @@
/******************************************************** /*****************************************************************************
* Enums.h * * Enums.h *
* * * *
* XFX enumeration definition file * * XFX enumeration definition file *
* Copyright (c) XFX Team. All Rights Reserved * * Copyright (c) XFX Team. All Rights Reserved *
********************************************************/ *****************************************************************************/
#ifndef _XFX_ENUMS_ #ifndef _XFX_ENUMS_
#define _XFX_ENUMS_ #define _XFX_ENUMS_

View File

@ -20,15 +20,15 @@ namespace XFX
class GameServiceContainer : public IServiceProvider class GameServiceContainer : public IServiceProvider
{ {
private: private:
Dictionary<String, Object*> _services; Dictionary<Type, Object*> _services;
public: public:
GameServiceContainer(); GameServiceContainer();
virtual ~GameServiceContainer() {} virtual ~GameServiceContainer() {}
void AddService(const String& serviceType, Object* provider); void AddService(const Type& serviceType, Object* provider);
Object* GetService(const String& ServiceType); Object* GetService(const Type& ServiceType);
void RemoveService(const String& type); void RemoveService(const Type& type);
}; };
} }

View File

@ -1,9 +1,9 @@
/******************************************************** /*****************************************************************************
* Guide.h * * Guide.h *
* * * *
* XFX Guide definition file * * XFX::GamerServices::Guide class definition file *
* Copyright (c) XFX Team. All Rights Reserved * * Copyright (c) XFX Team. All Rights Reserved *
********************************************************/ *****************************************************************************/
#ifndef _XFX_GAMERSERVICES_GUIDE_ #ifndef _XFX_GAMERSERVICES_GUIDE_
#define _XFX_GAMERSERVICES_GUIDE_ #define _XFX_GAMERSERVICES_GUIDE_
@ -23,7 +23,9 @@ namespace XFX
{ {
namespace GamerServices namespace GamerServices
{ {
// Provides access to the Guide user interface. /**
* Provides access to the Guide user interface.
*/
class Guide class Guide
{ {
private: private:

View File

@ -25,7 +25,7 @@ namespace XFX
class AlphaTestEffect : public Effect class AlphaTestEffect : public Effect
{ {
private: private:
byte effectCode[]; static byte effectCode[];
protected: protected:
AlphaTestEffect(AlphaTestEffect const * const cloneSource); AlphaTestEffect(AlphaTestEffect const * const cloneSource);
@ -50,7 +50,7 @@ namespace XFX
AlphaTestEffect(GraphicsDevice * const device); AlphaTestEffect(GraphicsDevice * const device);
Effect* Clone() const; Effect* Clone() const;
int GetType() const; static const Type& GetType();
}; };
} }
} }

View File

@ -21,7 +21,7 @@ namespace XFX
class BlendState : public GraphicsResource class BlendState : public GraphicsResource
{ {
private: private:
static const char * const isBoundErrorString; static const String isBoundErrorString;
BlendFunction_t alphaBlendFunction; BlendFunction_t alphaBlendFunction;
Blend_t alphaDestinationBlend; Blend_t alphaDestinationBlend;
Blend_t alphaSourceBlend; Blend_t alphaSourceBlend;

View File

@ -337,7 +337,9 @@ namespace XFX
}; };
}; };
// Defines the size of an element of an index buffer. /**
* Defines the size of an element of an index buffer.
*/
struct IndexElementSize struct IndexElementSize
{ {
enum type enum type
@ -347,7 +349,9 @@ namespace XFX
}; };
}; };
// Defines flags that describe the relationship between the adapter refresh rate and the rate at which GraphicsDevice.Present operations are completed. /**
* Defines flags that describe the relationship between the adapter refresh rate and the rate at which GraphicsDevice.Present operations are completed.
*/
struct PresentInterval struct PresentInterval
{ {
enum type enum type
@ -359,7 +363,9 @@ namespace XFX
}; };
}; };
// Defines how data in a vertex stream is interpreted during a draw call. /**
* Defines how data in a vertex stream is interpreted during a draw call.
*/
struct PrimitiveType struct PrimitiveType
{ {
enum type enum type
@ -372,7 +378,9 @@ namespace XFX
}; };
}; };
// Determines how render target data is used once a new render target is set. /**
* Determines how render target data is used once a new render target is set.
*/
struct RenderTargetUsage struct RenderTargetUsage
{ {
enum type enum type
@ -383,7 +391,9 @@ namespace XFX
}; };
}; };
// Describes whether existing buffer data will be overwritten or discarded during a SetData operation. /**
* Describes whether existing buffer data will be overwritten or discarded during a SetData operation.
*/
struct SetDataOptions struct SetDataOptions
{ {
enum type enum type
@ -394,18 +404,31 @@ namespace XFX
}; };
}; };
// Defines sprite rotation options. /**
* Defines sprite rotation options.
*/
struct SpriteEffects struct SpriteEffects
{ {
enum type enum type
{ {
FlipHorizontally = 1, //Rotate 180 degrees about the Y axis before rendering. /**
FlipVertically = 0x100, //Rotate 180 degrees about the X axis before rendering. * Rotate 180 degrees about the Y axis before rendering.
None = 0 //No rotations specified. */
FlipHorizontally = 1,
/**
* Rotate 180 degrees about the X axis before rendering.
*/
FlipVertically = 0x100,
/**
* No rotations specified.
*/
None = 0
}; };
}; };
// Defines sprite sort-rendering options. /**
* Defines sprite sort-rendering options.
*/
struct SpriteSortMode struct SpriteSortMode
{ {
enum type enum type
@ -418,7 +441,9 @@ namespace XFX
}; };
}; };
// Defines stencil buffer operations. /**
* Defines stencil buffer operations.
*/
struct StencilOperation struct StencilOperation
{ {
enum type enum type
@ -434,7 +459,9 @@ namespace XFX
}; };
}; };
// Defines various types of surface formats. /**
* Defines various types of surface formats.
*/
struct SurfaceFormat struct SurfaceFormat
{ {
enum type enum type
@ -464,7 +491,9 @@ namespace XFX
}; };
}; };
// Defines constants that describe supported texture-addressing modes. /**
* Defines constants that describe supported texture-addressing modes.
*/
struct TextureAddressMode struct TextureAddressMode
{ {
enum type enum type
@ -475,33 +504,55 @@ namespace XFX
}; };
}; };
// Defines how a texture will be filtered as it is minified for each mipmap level. /**
* Defines how a texture will be filtered as it is minified for each mipmap level.
*/
struct TextureFilter struct TextureFilter
{ {
enum type enum type
{ {
// Use linear filtering. /**
* Use linear filtering.
*/
Linear, Linear,
// Use point filtering. /**
* Use point filtering.
*/
Point, Point,
// Use anisotropic filtering. /**
* Use anisotropic filtering.
*/
Anisotropic, Anisotropic,
// Use linear filtering to shrink or expand, and point filtering between mipmap levels (mip). /**
* Use linear filtering to shrink or expand, and point filtering between mipmap levels (mip).
*/
LinearMipPoint, LinearMipPoint,
// Use point filtering to shrink (minify) or expand (magnify), and linear filtering between mipmap levels. /**
* Use point filtering to shrink (minify) or expand (magnify), and linear filtering between mipmap levels.
*/
PointMipLinear, PointMipLinear,
// Use linear filtering to shrink, point filtering to expand, and linear filtering between mipmap levels. /**
* Use linear filtering to shrink, point filtering to expand, and linear filtering between mipmap levels.
*/
MinLinearMagPointMipLinear, MinLinearMagPointMipLinear,
// Use linear filtering to shrink, point filtering to expand, and point filtering between mipmap levels. /**
* Use linear filtering to shrink, point filtering to expand, and point filtering between mipmap levels.
*/
MinLinearMagPointMipPoint, MinLinearMagPointMipPoint,
// Use point filtering to shrink, linear filtering to expand, and linear filtering between mipmap levels. /**
* Use point filtering to shrink, linear filtering to expand, and linear filtering between mipmap levels.
*/
MinPointMagLinearMipLinear, MinPointMagLinearMipLinear,
// Use point filtering to shrink, linear filtering to expand, and point filtering between mipmap levels. /**
* Use point filtering to shrink, linear filtering to expand, and point filtering between mipmap levels.
*/
MinPointMagLinearMipPoint MinPointMagLinearMipPoint
}; };
}; };
// Defines vertex element formats. /**
* Defines vertex element formats.
*/
struct VertexElementFormat struct VertexElementFormat
{ {
enum type enum type
@ -521,7 +572,9 @@ namespace XFX
}; };
}; };
// Defines usage for vertex elements. /**
* Defines usage for vertex elements.
*/
struct VertexElementUsage struct VertexElementUsage
{ {
enum type enum type
@ -544,31 +597,31 @@ namespace XFX
// Lots of typedefs, but there was no other way to make these typesafe enum hacks look good. // Lots of typedefs, but there was no other way to make these typesafe enum hacks look good.
typedef Blend::type Blend_t; typedef Blend::type Blend_t;
typedef BlendFunction::type BlendFunction_t; typedef BlendFunction::type BlendFunction_t;
typedef BufferUsage::type BufferUsage_t; typedef BufferUsage::type BufferUsage_t;
typedef ClearOptions::type ClearOptions_t; typedef ClearOptions::type ClearOptions_t;
typedef ColorWriteChannels::type ColorWriteChannels_t; typedef ColorWriteChannels::type ColorWriteChannels_t;
typedef CompareFunction::type CompareFunction_t; typedef CompareFunction::type CompareFunction_t;
typedef CubeMapFace::type CubeMapFace_t; typedef CubeMapFace::type CubeMapFace_t;
typedef CullMode::type CullMode_t; typedef CullMode::type CullMode_t;
typedef DepthFormat::type DepthFormat_t; typedef DepthFormat::type DepthFormat_t;
typedef EffectParameterClass::type EffectParameterClass_t; typedef EffectParameterClass::type EffectParameterClass_t;
typedef EffectParameterType::type EffectParameterType_t; typedef EffectParameterType::type EffectParameterType_t;
typedef FillMode::type FillMode_t; typedef FillMode::type FillMode_t;
typedef GraphicsDeviceStatus::type GraphicsDeviceStatus_t; typedef GraphicsDeviceStatus::type GraphicsDeviceStatus_t;
typedef ImageFileFormat::type ImageFileFormat_t; typedef ImageFileFormat::type ImageFileFormat_t;
typedef IndexElementSize::type IndexElementSize_t; typedef IndexElementSize::type IndexElementSize_t;
typedef PresentInterval::type PresentInterval_t; typedef PresentInterval::type PresentInterval_t;
typedef PrimitiveType::type PrimitiveType_t; typedef PrimitiveType::type PrimitiveType_t;
typedef RenderTargetUsage::type RenderTargetUsage_t; typedef RenderTargetUsage::type RenderTargetUsage_t;
typedef SetDataOptions::type SetDataOptions_t; typedef SetDataOptions::type SetDataOptions_t;
typedef SpriteEffects::type SpriteEffects_t; typedef SpriteEffects::type SpriteEffects_t;
typedef SpriteSortMode::type SpriteSortMode_t; typedef SpriteSortMode::type SpriteSortMode_t;
typedef StencilOperation::type StencilOperation_t; typedef StencilOperation::type StencilOperation_t;
typedef SurfaceFormat::type SurfaceFormat_t; typedef SurfaceFormat::type SurfaceFormat_t;
typedef TextureAddressMode::type TextureAddressMode_t; typedef TextureAddressMode::type TextureAddressMode_t;
typedef TextureFilter::type TextureFilter_t; typedef TextureFilter::type TextureFilter_t;
typedef VertexElementFormat::type VertexElementFormat_t; // Defines vertex element formats. typedef VertexElementFormat::type VertexElementFormat_t; // Defines vertex element formats.
typedef VertexElementUsage::type VertexElementUsage_t; // Defines usage for vertex elements. typedef VertexElementUsage::type VertexElementUsage_t; // Defines usage for vertex elements.
} }

View File

@ -14,6 +14,11 @@ namespace XFX
{ {
struct Matrix; struct Matrix;
namespace Content
{
class ModelReader;
}
namespace Graphics namespace Graphics
{ {
/** /**

View File

@ -16,6 +16,11 @@ using namespace System::Collections::Generic;
namespace XFX namespace XFX
{ {
namespace Content
{
class ModelReader;
}
namespace Graphics namespace Graphics
{ {
class ModelBoneCollection; class ModelBoneCollection;

View File

@ -1,7 +1,7 @@
/***************************************************************************** /*****************************************************************************
* PresentationParameters.h * * PresentationParameters.h *
* * * *
* XFX::Graphics::PresentationParameters class definition file * * XFX::Graphics::PresentationParameters class definition file *
* Copyright (c) XFX Team. All Rights Reserved * * Copyright (c) XFX Team. All Rights Reserved *
*****************************************************************************/ *****************************************************************************/
#ifndef _XFX_GRAPHICS_PRESENTATIONPARAMETERS_ #ifndef _XFX_GRAPHICS_PRESENTATIONPARAMETERS_
@ -30,7 +30,7 @@ namespace XFX
Rectangle getBounds() const; Rectangle getBounds() const;
DepthFormat_t DepthStencilFormat; DepthFormat_t DepthStencilFormat;
bool IsFullScreen; bool IsFullScreen;
int MultiSampleCount; int MultiSampleCount;
PresentInterval_t PresentationInterval; PresentInterval_t PresentationInterval;
RenderTargetUsage_t RenderTargetUsage; RenderTargetUsage_t RenderTargetUsage;

View File

@ -1,5 +1,5 @@
/***************************************************************************** /*****************************************************************************
* Viewport.h * * Viewport.h *
* * * *
* XFX::Graphics::Viewport structure definition file * * XFX::Graphics::Viewport structure definition file *
* Copyright (c) XFX Team. All Rights Reserved * * Copyright (c) XFX Team. All Rights Reserved *

View File

@ -1,11 +1,11 @@
/***************************************************************************** /*****************************************************************************
* GraphicsDeviceInformation.h * * GraphicsDeviceInformation.h *
* * * *
* XFX GraphicsDeviceInformation class definition file * * XFX GraphicsDeviceInformation class definition file *
* Copyright (c) XFX Team. All Rights Reserved * * Copyright (c) XFX Team. All Rights Reserved *
*****************************************************************************/ *****************************************************************************/
#ifndef _GRAPHICSDEVICEINFORMATION_ #ifndef _XFX_GRAPHICSDEVICEINFORMATION_
#define _GRAPHICSDEVICEINFORMATION_ #define _XFX_GRAPHICSDEVICEINFORMATION_
#include <Graphics/Enums.h> #include <Graphics/Enums.h>
#include <Graphics/PresentationParameters.h> #include <Graphics/PresentationParameters.h>
@ -32,4 +32,4 @@ namespace XFX
}; };
} }
#endif //_GRAPHICSDEVICEINFORMATION_ #endif //_XFX_GRAPHICSDEVICEINFORMATION_

View File

@ -1,9 +1,9 @@
/******************************************************** /*****************************************************************************
* Input.h * * Input.h *
* * * *
* XFX::Input namespace include file * * XFX::Input namespace include file *
* Copyright (c) XFX Team. All Rights Reserved * * Copyright (c) XFX Team. All Rights Reserved *
********************************************************/ *****************************************************************************/
#ifndef _XFX_INPUT_ #ifndef _XFX_INPUT_
#define _XFX_INPUT_ #define _XFX_INPUT_

View File

@ -1,9 +1,9 @@
/******************************************************** /*****************************************************************************
* Enums.h * * Enums.h *
* * * *
* XFX::Input enumeration definition file * * XFX::Input enumeration definition file *
* Copyright (c) XFX Team. All Rights Reserved * * Copyright (c) XFX Team. All Rights Reserved *
********************************************************/ *****************************************************************************/
#ifndef _XFX_INPUT_ENUMS_ #ifndef _XFX_INPUT_ENUMS_
#define _XFX_INPUT_ENUMS_ #define _XFX_INPUT_ENUMS_
@ -11,7 +11,9 @@ namespace XFX
{ {
namespace Input namespace Input
{ {
// Enumerates input device buttons. /**
* Enumerates input device buttons.
*/
struct Buttons struct Buttons
{ {
enum type enum type
@ -135,8 +137,8 @@ namespace XFX
typedef ButtonState::type ButtonState_t; typedef ButtonState::type ButtonState_t;
typedef GamePadDeadZone::type GamePadDeadZone_t; typedef GamePadDeadZone::type GamePadDeadZone_t;
typedef GamePadType::type GamePadType_t; typedef GamePadType::type GamePadType_t;
typedef Keys::type Keys_t; typedef Keys::type Keys_t;
typedef KeyState::type KeyState_t; typedef KeyState::type KeyState_t;
} }
} }

View File

@ -1,9 +1,9 @@
/******************************************************** /*****************************************************************************
* GamePad.h * * GamePad.h *
* * * *
* XFX GamePad definition file * * XFX::Input::GamePad class definition file *
* Copyright (c) XFX Team. All Rights Reserved * * Copyright (c) XFX Team. All Rights Reserved *
********************************************************/ *****************************************************************************/
#ifndef _XFX_INPUT_GAMEPAD_ #ifndef _XFX_INPUT_GAMEPAD_
#define _XFX_INPUT_GAMEPAD_ #define _XFX_INPUT_GAMEPAD_
@ -15,8 +15,10 @@ namespace XFX
{ {
namespace Input namespace Input
{ {
// Allows retrieval of user interaction with an XBOX Controller /**
// and setting of controller vibration motors. * Allows retrieval of user interaction with an XBOX Controller
* and setting of controller vibration motors.
*/
class GamePad class GamePad
{ {
private: private:

View File

@ -1,5 +1,5 @@
/***************************************************************************** /*****************************************************************************
* GamePadState.h * * GamePadState.h *
* * * *
* XFX::Input::GamePadState structure definition file * * XFX::Input::GamePadState structure definition file *
* Copyright (c) XFX Team. All Rights Reserved * * Copyright (c) XFX Team. All Rights Reserved *
@ -8,6 +8,9 @@
#define _XFX_INPUT_GAMEPADSTATE_ #define _XFX_INPUT_GAMEPADSTATE_
#include "GamePadButtons.h" #include "GamePadButtons.h"
#include "GamePadDPad.h"
#include "GamePadThumbSticks.h"
#include "GamePadTriggers.h"
namespace XFX namespace XFX
{ {

View File

@ -8,7 +8,6 @@
#define _XFX_INPUT_GAMEPADTHUMBSTICKS_ #define _XFX_INPUT_GAMEPADTHUMBSTICKS_
#include "Enums.h" #include "Enums.h"
#include <System/Object.h>
#include <Vector2.h> #include <Vector2.h>
using namespace System; using namespace System;

View File

@ -1,9 +1,9 @@
/******************************************************** /*****************************************************************************
* Keyboard.h * * Keyboard.h *
* * * *
* XFX Keyboard definition file * * XFX::Input::Keyboard class definition file *
* Copyright (c) XFX Team. All Rights Reserved * * Copyright (c) XFX Team. All Rights Reserved *
********************************************************/ *****************************************************************************/
#ifndef _XFX_INPUT_KEYBOARD_ #ifndef _XFX_INPUT_KEYBOARD_
#define _XFX_INPUT_KEYBOARD_ #define _XFX_INPUT_KEYBOARD_
@ -13,7 +13,9 @@ namespace XFX
{ {
namespace Input namespace Input
{ {
// Represents a state of keystrokes recorded by a keyboard input device. /**
* Represents a state of keystrokes recorded by a keyboard input device.
*/
struct KeyboardState struct KeyboardState
{ {
KeyboardState(); KeyboardState();
@ -36,7 +38,9 @@ namespace XFX
Keys_t* pressedKeys; Keys_t* pressedKeys;
}; };
// Allows retrieval of keystrokes from a keyboard input device. /**
* Allows retrieval of keystrokes from a keyboard input device.
*/
class Keyboard class Keyboard
{ {
private: private:

View File

@ -1,9 +1,9 @@
/******************************************************** /*****************************************************************************
* Mouse.h * * Mouse.h *
* * * *
* XFX Mouse definition file * * XFX::Input::Mouse class definition file *
* Copyright (c) XFX Team. All Rights Reserved * * Copyright (c) XFX Team. All Rights Reserved *
********************************************************/ *****************************************************************************/
#ifndef _XFX_INPUT_MOUSE_ #ifndef _XFX_INPUT_MOUSE_
#define _XFX_INPUT_MOUSE_ #define _XFX_INPUT_MOUSE_
@ -16,7 +16,9 @@ namespace XFX
{ {
namespace Input namespace Input
{ {
// Represents the state of a mouse input device, including mouse cursor position and buttons pressed. /**
* Represents the state of a mouse input device, including mouse cursor position and buttons pressed.
*/
struct MouseState struct MouseState
{ {
ButtonState_t LeftButton; ButtonState_t LeftButton;
@ -31,7 +33,9 @@ namespace XFX
bool operator==(const MouseState& other) const; bool operator==(const MouseState& other) const;
}; };
// Allows retrieval of position and button clicks from a mouse input device. /**
* Allows retrieval of position and button clicks from a mouse input device.
*/
class Mouse class Mouse
{ {
private: private:

View File

@ -1,15 +1,17 @@
/******************************************************** /*****************************************************************************
* MathHelper.h * * MathHelper.h *
* * * *
* XFX MathHelper definition file * * XFX::MathHelper class definition file *
* Copyright (c) XFX Team. All Rights Reserved * * Copyright (c) XFX Team. All Rights Reserved *
********************************************************/ *****************************************************************************/
#ifndef _XFX_MATHHELPER_ #ifndef _XFX_MATHHELPER_
#define _XFX_MATHHELPER_ #define _XFX_MATHHELPER_
namespace XFX namespace XFX
{ {
// Contains commonly used precalculated values. /**
* Contains commonly used precalculated values.
*/
class MathHelper class MathHelper
{ {
private: private:

View File

@ -1,5 +1,5 @@
/***************************************************************************** /*****************************************************************************
* Video.h * * Video.h *
* * * *
* XFX::Media::Video class definition file * * XFX::Media::Video class definition file *
* Copyright (c) XFX Team. All Rights Reserved * * Copyright (c) XFX Team. All Rights Reserved *
@ -7,10 +7,11 @@
#ifndef _XFX_MEDIA_VIDEO_H_ #ifndef _XFX_MEDIA_VIDEO_H_
#define _XFX_MEDIA_VIDEO_H_ #define _XFX_MEDIA_VIDEO_H_
#include <System/Types.h> #include <System/TimeSpan.h>
#include <System/Object.h>
#include "Enums.h" #include "Enums.h"
using namespace System;
namespace XFX namespace XFX
{ {
namespace Media namespace Media

View File

@ -8,8 +8,8 @@
#define _XFX_MEDIA_VIDEOPLAYER_ #define _XFX_MEDIA_VIDEOPLAYER_
#include "Enums.h" #include "Enums.h"
#include <Graphics/Texture2D.h>
#include <System/TimeSpan.h> #include <System/TimeSpan.h>
#include "../Graphics/Texture2D.h"
using namespace System; using namespace System;
using namespace XFX::Graphics; using namespace XFX::Graphics;
@ -20,11 +20,15 @@ namespace XFX
{ {
class Video; class Video;
// Provides methods and properties to playback, pause, resume, and stop video. VideoPlayer also exposes repeat, volume, and play position information. /**
* Provides methods and properties to playback, pause, resume, and stop video. VideoPlayer also exposes repeat, volume, and play position information.
*/
class VideoPlayer class VideoPlayer
{ {
private: private:
bool isDisposed; bool isDisposed;
Video* playingVideo;
void Dispose(bool disposing); void Dispose(bool disposing);
protected: protected:

View File

@ -1,7 +1,7 @@
/***************************************************************************** /*****************************************************************************
* Plane.h * * Plane.h *
* * * *
* XFX Plane definition file * * XFX::Plane structure definition file *
* Copyright (c) XFX Team. All Rights Reserved * * Copyright (c) XFX Team. All Rights Reserved *
*****************************************************************************/ *****************************************************************************/
#ifndef _XFX_PLANE_ #ifndef _XFX_PLANE_
@ -21,7 +21,9 @@ namespace XFX
struct Quaternion; struct Quaternion;
struct Vector4; struct Vector4;
// Defines a plane. /**
* Defines a plane.
*/
struct Plane : IEquatable<Plane>, Object struct Plane : IEquatable<Plane>, Object
{ {
float D; float D;
@ -42,8 +44,8 @@ namespace XFX
void DotNormal(const Vector3 value, out float& result) const; void DotNormal(const Vector3 value, out float& result) const;
bool Equals(Object const * const obj) const; bool Equals(Object const * const obj) const;
bool Equals(const Plane obj) const; bool Equals(const Plane obj) const;
int GetHashCode() const; int GetHashCode() const;
int GetType() const; static const Type& GetType();
PlaneIntersectionType_t Intersects(const BoundingBox boundingbox) const; PlaneIntersectionType_t Intersects(const BoundingBox boundingbox) const;
void Intersects(const BoundingBox boundingbox, out PlaneIntersectionType_t& result) const; void Intersects(const BoundingBox boundingbox, out PlaneIntersectionType_t& result) const;
PlaneIntersectionType_t Intersects(const BoundingSphere sphere) const; PlaneIntersectionType_t Intersects(const BoundingSphere sphere) const;

View File

@ -1,9 +1,9 @@
/******************************************************** /*****************************************************************************
* Storage.h * * Storage.h *
* * * *
* XFX::Storage namespace include file * * XFX::Storage namespace include file *
* Copyright (c) XFX Team. All Rights Reserved * * Copyright (c) XFX Team. All Rights Reserved *
********************************************************/ *****************************************************************************/
#ifndef _XFX_STORAGE_ #ifndef _XFX_STORAGE_
#define _XFX_STORAGE_ #define _XFX_STORAGE_

View File

@ -1,9 +1,9 @@
/******************************************************** /*****************************************************************************
* StorageContainer.h * * StorageContainer.h *
* * * *
* XFX StorageContainer definition file * * XFX::Storage::StorageContainer class definition file *
* Copyright (c) XFX Team. All Rights Reserved * * Copyright (c) XFX Team. All Rights Reserved *
********************************************************/ *****************************************************************************/
#ifndef _XFX_STORAGE_STORAGECONTAINER_ #ifndef _XFX_STORAGE_STORAGECONTAINER_
#define _XFX_STORAGE_STORAGECONTAINER_ #define _XFX_STORAGE_STORAGECONTAINER_
@ -21,17 +21,19 @@ namespace XFX
{ {
class StorageDevice; class StorageDevice;
// Represents a logical collection of storage files. /**
class StorageContainer : public IDisposable, public virtual Object * Represents a logical collection of storage files.
*/
class StorageContainer : public IDisposable, public Object
{ {
friend class StorageDevice; friend class StorageDevice;
private: private:
bool isDisposed; bool isDisposed;
DirectoryInfo containerFolder; DirectoryInfo containerFolder;
StorageDevice* device; StorageDevice* device;
PlayerIndex_t playerIndex; PlayerIndex_t playerIndex;
char* titleName; String titleName;
void Dispose(bool disposing); void Dispose(bool disposing);
virtual ~StorageContainer(); virtual ~StorageContainer();
@ -39,11 +41,11 @@ namespace XFX
public: public:
EventHandler Disposing; EventHandler Disposing;
bool IsDisposed(); bool IsDisposed() const;
const char* Path() const; const String Path() const;
StorageDevice* getStorageDevice() const; StorageDevice* getStorageDevice() const;
static const char* TitleLocation(); static const String TitleLocation();
const char* TitleName() const; const String TitleName() const;
void Delete(); void Delete();
void Dispose(); void Dispose();

View File

@ -15,13 +15,15 @@ namespace XFX
{ {
namespace Storage namespace Storage
{ {
// The exception that is thrown when the requested StorageDevice is not connected /**
* The exception that is thrown when the requested StorageDevice is not connected
*/
class StorageDeviceNotConnectedException : public ExternalException class StorageDeviceNotConnectedException : public ExternalException
{ {
public: public:
StorageDeviceNotConnectedException(); StorageDeviceNotConnectedException();
StorageDeviceNotConnectedException(char* message); StorageDeviceNotConnectedException(const String& message);
StorageDeviceNotConnectedException(char* message, Exception* innerException); StorageDeviceNotConnectedException(const String& message, Exception * const innerException);
}; };
} }
} }

View File

@ -19,6 +19,9 @@ using namespace System::Collections::Generic;
namespace System namespace System
{ {
/**
*
*/
template <typename T> template <typename T>
class Array : public ICollection<T>, public IEnumerable<T> class Array : public ICollection<T>, public IEnumerable<T>
{ {

View File

@ -1,9 +1,9 @@
/******************************************************** /*****************************************************************************
* Interfaces.h * * Interfaces.h *
* * * *
* XFX Generic Interfaces definition file * * XFX Generic Interfaces definition file *
* Copyright (c) XFX Team. All Rights Reserved * * Copyright (c) XFX Team. All Rights Reserved *
********************************************************/ *****************************************************************************/
#ifndef _SYSTEM_COLLECTIONS_GENERIC_INTERFACES_ #ifndef _SYSTEM_COLLECTIONS_GENERIC_INTERFACES_
#define _SYSTEM_COLLECTIONS_GENERIC_INTERFACES_ #define _SYSTEM_COLLECTIONS_GENERIC_INTERFACES_
@ -16,7 +16,9 @@ namespace System
{ {
namespace Generic namespace Generic
{ {
// Defines methods to manipulate generic collections. /**
* Defines methods to manipulate generic collections.
*/
template <class T> template <class T>
interface ICollection interface ICollection
{ {
@ -33,7 +35,9 @@ namespace System
virtual ~ICollection() { } virtual ~ICollection() { }
}; };
// Defines a method that a type implements to compare two objects. /**
* Defines a method that a type implements to compare two objects.
*/
template <class T> template <class T>
interface IComparer interface IComparer
{ {
@ -43,7 +47,9 @@ namespace System
virtual ~IComparer() { } virtual ~IComparer() { }
}; };
// Represents a generic collection of key/value pairs. /**
* Represents a generic collection of key/value pairs.
*/
template <class TKey, class TValue> template <class TKey, class TValue>
interface IDictionary interface IDictionary
{ {
@ -59,7 +65,9 @@ namespace System
virtual ~IDictionary() { } virtual ~IDictionary() { }
}; };
// Supports a simple iteration over a generic collection. /**
* Supports a simple iteration over a generic collection.
*/
template <class T> template <class T>
interface IEnumerator interface IEnumerator
{ {
@ -71,7 +79,9 @@ namespace System
virtual ~IEnumerator() { } virtual ~IEnumerator() { }
}; };
// Exposes the enumerator, which supports a simple iteration over a collection of a specified type. /**
* Exposes the enumerator, which supports a simple iteration over a collection of a specified type.
*/
template <class T> template <class T>
interface IEnumerable interface IEnumerable
{ {
@ -81,7 +91,9 @@ namespace System
virtual ~IEnumerable() { } virtual ~IEnumerable() { }
}; };
// Defines methods to support the comparison of objects for equality. /**
* Defines methods to support the comparison of objects for equality.
*/
template <class T> template <class T>
interface IEqualityComparer interface IEqualityComparer
{ {
@ -92,7 +104,9 @@ namespace System
virtual ~IEqualityComparer() { } virtual ~IEqualityComparer() { }
}; };
// Represents a collection of objects that can be individually accessed by index. /**
* Represents a collection of objects that can be individually accessed by index.
*/
template <class T> template <class T>
interface IList : public ICollection<T> interface IList : public ICollection<T>
{ {

View File

@ -179,7 +179,7 @@ namespace System
{ {
sassert(array != null, String::Format("array; %s", FrameworkResources::ArgumentNull_Generic)); sassert(array != null, String::Format("array; %s", FrameworkResources::ArgumentNull_Generic));
memcpy(&array[arrayIndex], _items, _size * sizeof(T)) memcpy(&array[arrayIndex], _items, _size * sizeof(T));
} }
static const Type& GetType() static const Type& GetType()
@ -320,7 +320,7 @@ namespace System
{ {
sassert(comparer != null, String::Format("comparer; %s", FrameworkResources::ArgumentNull_Generic)); sassert(comparer != null, String::Format("comparer; %s", FrameworkResources::ArgumentNull_Generic));
Sort(0, _actualSize, comparer); Sort(0, _size, comparer);
} }
T* ToArray() const T* ToArray() const
@ -353,6 +353,11 @@ namespace System
const List<T>& operator =(const List<T>& other) const List<T>& operator =(const List<T>& other)
{ {
if (other == *this)
{
return *this;
}
delete[] _items; delete[] _items;
_actualSize = other._actualSize; _actualSize = other._actualSize;
_size = other._size; _size = other._size;

View File

@ -1,24 +1,27 @@
/******************************************************** /*****************************************************************************
* StreamAsyncResult.h * * StreamAsyncResult.h *
* * * *
* XFX StreamAsyncResult definition file * * System::IO::StreamAsyncResult class definition file *
* Copyright (c) XFX Team. All Rights Reserved * * Copyright (c) XFX Team. All Rights Reserved *
********************************************************/ *****************************************************************************/
#ifndef _SYSTEM_IO_STREAMASYNCRESULT_ #ifndef _SYSTEM_IO_STREAMASYNCRESULT_
#define _SYSTEM_IO_STREAMASYNCRESULT_ #define _SYSTEM_IO_STREAMASYNCRESULT_
#include "../Interfaces.h" #include <System/Interfaces.h>
#include "../Object.h" #include <System/Object.h>
#include "../Types.h" #include <System/Types.h>
#include "../Threading/WaitHandle.h" #include <System/Threading/WaitHandle.h>
namespace System namespace System
{ {
namespace IO namespace IO
{ {
// /**
class StreamAsyncResult : public IAsyncResult, public virtual Object *
*/
class StreamAsyncResult : public IAsyncResult, public Object
{ {
private:
Object* _state; Object* _state;
bool completed; bool completed;
bool done; bool done;
@ -34,8 +37,26 @@ namespace System
int NBytes(); int NBytes();
bool Done; bool Done;
/**
*
*
* @param state
*
*/
StreamAsyncResult(Object* state); StreamAsyncResult(Object* state);
/**
*
*
* @param obj
*
*/
StreamAsyncResult(const IAsyncResult &obj); StreamAsyncResult(const IAsyncResult &obj);
/**
*
*
* @param obj
*
*/
StreamAsyncResult(const StreamAsyncResult &obj); StreamAsyncResult(const StreamAsyncResult &obj);
//void SetComplete(Exception* e); //void SetComplete(Exception* e);

View File

@ -81,7 +81,7 @@ namespace System
interface IServiceProvider interface IServiceProvider
{ {
public: public:
virtual Object* GetService(const String& serviceType)=0; virtual Object* GetService(const Type& serviceType)=0;
virtual ~IServiceProvider() { } virtual ~IServiceProvider() { }
}; };

View File

@ -1,7 +1,7 @@
/***************************************************************************** /*****************************************************************************
* Vector2.h * * Vector2.h *
* * * *
* XFX Vector2 definition file * * XFX Vector2 definition file *
* Copyright (c) XFX Team. All Rights Reserved * * Copyright (c) XFX Team. All Rights Reserved *
*****************************************************************************/ *****************************************************************************/
#ifndef _XFX_VECTOR2_ #ifndef _XFX_VECTOR2_
@ -29,62 +29,62 @@ namespace XFX
Vector2(); Vector2();
static Vector2 Add(const Vector2 value1, const Vector2 value2); static Vector2 Add(const Vector2 value1, const Vector2 value2);
static void Add(const Vector2& value1, const Vector2& value2, out Vector2& result); static void Add(const Vector2& value1, const Vector2& value2, out Vector2& result);
static Vector2 Baricentric(const Vector2 value1, const Vector2 value2, const Vector2 value3, const float amount1, const float amount2); static Vector2 Baricentric(const Vector2 value1, const Vector2 value2, const Vector2 value3, const float amount1, const float amount2);
static void Baricentric(const Vector2& value1, const Vector2& value2, const Vector2& value3, const float amount1, const float amount2, out Vector2& result); static void Baricentric(const Vector2& value1, const Vector2& value2, const Vector2& value3, const float amount1, const float amount2, out Vector2& result);
static Vector2 CatmullRom(const Vector2 value1, const Vector2 value2, const Vector2 value3, const Vector2 value4, const float amount); static Vector2 CatmullRom(const Vector2 value1, const Vector2 value2, const Vector2 value3, const Vector2 value4, const float amount);
static void CatmullRom(const Vector2& value1, const Vector2& value2, const Vector2& value3, const Vector2& value4, const float amount, out Vector2& result); static void CatmullRom(const Vector2& value1, const Vector2& value2, const Vector2& value3, const Vector2& value4, const float amount, out Vector2& result);
static Vector2 Clamp(const Vector2 value, const Vector2 min, const Vector2 max); static Vector2 Clamp(const Vector2 value, const Vector2 min, const Vector2 max);
static void Clamp(const Vector2& value, const Vector2& min, const Vector2& max, out Vector2& result); static void Clamp(const Vector2& value, const Vector2& min, const Vector2& max, out Vector2& result);
static float Distance(const Vector2 value1, const Vector2 value2); static float Distance(const Vector2 value1, const Vector2 value2);
static void Distance(const Vector2& value1, const Vector2& value2, out float& result); static void Distance(const Vector2& value1, const Vector2& value2, out float& result);
static float DistanceSquared(const Vector2 value1, const Vector2 value2); static float DistanceSquared(const Vector2 value1, const Vector2 value2);
static void DistanceSquared(const Vector2& value1, const Vector2& value2, out float& result); static void DistanceSquared(const Vector2& value1, const Vector2& value2, out float& result);
static Vector2 Divide(const Vector2 value1, const float divider); static Vector2 Divide(const Vector2 value1, const float divider);
static void Divide(const Vector2& value1, const float divider, out Vector2& result); static void Divide(const Vector2& value1, const float divider, out Vector2& result);
static Vector2 Divide(const Vector2 value1, const Vector2 value2); static Vector2 Divide(const Vector2 value1, const Vector2 value2);
static void Divide(const Vector2& value1, const Vector2& value2, out Vector2& result); static void Divide(const Vector2& value1, const Vector2& value2, out Vector2& result);
static float Dot(const Vector2 value1, const Vector2 value2); static float Dot(const Vector2 value1, const Vector2 value2);
static void Dot(const Vector2& value1, const Vector2& value2, out float& result); static void Dot(const Vector2& value1, const Vector2& value2, out float& result);
bool Equals(Object const * const obj) const; bool Equals(Object const * const obj) const;
bool Equals(const Vector2 other) const; bool Equals(const Vector2 other) const;
int GetHashCode() const; int GetHashCode() const;
static int GetType(); static const Type& GetType();
static Vector2 Hermite(const Vector2 value1, const Vector2 tangent1, const Vector2 value2, const Vector2 tangent2, const float amount); static Vector2 Hermite(const Vector2 value1, const Vector2 tangent1, const Vector2 value2, const Vector2 tangent2, const float amount);
static void Hermite(const Vector2& value1, const Vector2& tangent1, const Vector2& value2, const Vector2& tangent2, const float amount, out Vector2& result); static void Hermite(const Vector2& value1, const Vector2& tangent1, const Vector2& value2, const Vector2& tangent2, const float amount, out Vector2& result);
float Length() const; float Length() const;
float LengthSquared() const; float LengthSquared() const;
static Vector2 Lerp(const Vector2 value1, const Vector2 value2, const float amount); static Vector2 Lerp(const Vector2 value1, const Vector2 value2, const float amount);
static void Lerp(const Vector2& value1, const Vector2& value2, const float amount, out Vector2& result); static void Lerp(const Vector2& value1, const Vector2& value2, const float amount, out Vector2& result);
static Vector2 Max(const Vector2 value1, const Vector2 value2); static Vector2 Max(const Vector2 value1, const Vector2 value2);
static void Max(const Vector2& value1, const Vector2& value2, out Vector2& result); static void Max(const Vector2& value1, const Vector2& value2, out Vector2& result);
static Vector2 Min(const Vector2 value1, const Vector2 value2); static Vector2 Min(const Vector2 value1, const Vector2 value2);
static void Min(const Vector2& value1, const Vector2& value2, out Vector2& result); static void Min(const Vector2& value1, const Vector2& value2, out Vector2& result);
static Vector2 Multiply(const Vector2 value, const float scaleFactor); static Vector2 Multiply(const Vector2 value, const float scaleFactor);
void Multiply(const Vector2& value1, const float scaleFactor, out Vector2& result); void Multiply(const Vector2& value1, const float scaleFactor, out Vector2& result);
static Vector2 Multiply(const Vector2 value1, const Vector2 value2); static Vector2 Multiply(const Vector2 value1, const Vector2 value2);
void Multiply(const Vector2& value1, const Vector2& value2, out Vector2& result); void Multiply(const Vector2& value1, const Vector2& value2, out Vector2& result);
static Vector2 Negate(const Vector2 value); static Vector2 Negate(const Vector2 value);
static void Negate(const Vector2& value, out Vector2& result); static void Negate(const Vector2& value, out Vector2& result);
void Normalize(); void Normalize();
static Vector2 Normalize(const Vector2 value); static Vector2 Normalize(const Vector2 value);
static void Normalize(const Vector2& value, out Vector2& result); static void Normalize(const Vector2& value, out Vector2& result);
static Vector2 Reflect(const Vector2 vector, const Vector2 normal); static Vector2 Reflect(const Vector2 vector, const Vector2 normal);
static void Reflect(const Vector2& vector, const Vector2& normal, out Vector2& result); static void Reflect(const Vector2& vector, const Vector2& normal, out Vector2& result);
static Vector2 SmoothStep(const Vector2 value1, const Vector2 value2, const float amount); static Vector2 SmoothStep(const Vector2 value1, const Vector2 value2, const float amount);
static void SmoothStep(const Vector2& value1, const Vector2& value2, const float amount, out Vector2& result); static void SmoothStep(const Vector2& value1, const Vector2& value2, const float amount, out Vector2& result);
static Vector2 Subtract(const Vector2 value1, const Vector2 value2); static Vector2 Subtract(const Vector2 value1, const Vector2 value2);
static void Subtract(const Vector2& value1, const Vector2& value2, out Vector2& result); static void Subtract(const Vector2& value1, const Vector2& value2, out Vector2& result);
const String ToString() const; const String ToString() const;
static Vector2 Transform(const Vector2 position, const Matrix matrix); static Vector2 Transform(const Vector2 position, const Matrix matrix);
static void Transform(const Vector2& position, const Matrix& matrix, out Vector2& result); static void Transform(const Vector2& position, const Matrix& matrix, out Vector2& result);
static Vector2 Transform(const Vector2 position, const Quaternion rotation); static Vector2 Transform(const Vector2 position, const Quaternion rotation);
static void Transform(const Vector2& position, const Quaternion& rotation, out Vector2& result); static void Transform(const Vector2& position, const Quaternion& rotation, out Vector2& result);
static void Transform(const Vector2 sourceArray[], const int sourceIndex, const Matrix& matrix, Vector2 destinationArray[], const int destinationIndex, const int length); static void Transform(const Vector2 sourceArray[], const int sourceIndex, const Matrix& matrix, Vector2 destinationArray[], const int destinationIndex, const int length);
static void Transform(const Vector2 sourceArray[], const int sourceIndex, const Quaternion& rotation, Vector2 destinationArray[], const int destinationIndex, const int length); static void Transform(const Vector2 sourceArray[], const int sourceIndex, const Quaternion& rotation, Vector2 destinationArray[], const int destinationIndex, const int length);
static Vector2 TransformNormal(const Vector2 normal, const Matrix matrix); static Vector2 TransformNormal(const Vector2 normal, const Matrix matrix);
static void TransformNormal(const Vector2& normal, const Matrix& matrix, out Vector2& result); static void TransformNormal(const Vector2& normal, const Matrix& matrix, out Vector2& result);
static void TransformNormal(const Vector2 sourceArray[], const int sourceIndex, const Matrix& matrix, Vector2 destinationArray[], const int destinationIndex, const int length); static void TransformNormal(const Vector2 sourceArray[], const int sourceIndex, const Matrix& matrix, Vector2 destinationArray[], const int destinationIndex, const int length);
Vector2 operator -(const Vector2& other) const; Vector2 operator -(const Vector2& other) const;
Vector2 operator -() const; Vector2 operator -() const;

View File

@ -1,7 +1,7 @@
/***************************************************************************** /*****************************************************************************
* Vector3.h * * Vector3.h *
* * * *
* XFX::Vector3 definition file * * XFX::Vector3 structure definition file *
* Copyright (c) XFX Team. All Rights Reserved * * Copyright (c) XFX Team. All Rights Reserved *
*****************************************************************************/ *****************************************************************************/
#ifndef _XFX_VECTOR3_ #ifndef _XFX_VECTOR3_
@ -41,74 +41,74 @@ namespace XFX
Vector3(const Vector3 &obj); Vector3(const Vector3 &obj);
Vector3(); Vector3();
static Vector3 Add(const Vector3 value1, const Vector3 value2); static Vector3 Add(const Vector3 value1, const Vector3 value2);
static void Add(const Vector3 value1, const Vector3 value2, out Vector3& result); static void Add(const Vector3 value1, const Vector3 value2, out Vector3& result);
static Vector3 Baricentric(const Vector3 value1, const Vector3 value2, const Vector3 value3, const float amount1, const float amount2); static Vector3 Baricentric(const Vector3 value1, const Vector3 value2, const Vector3 value3, const float amount1, const float amount2);
static void Baricentric(const Vector3 value1, const Vector3 value2, const Vector3 value3, const float amount1, const float amount2, out Vector3& result); static void Baricentric(const Vector3 value1, const Vector3 value2, const Vector3 value3, const float amount1, const float amount2, out Vector3& result);
static Vector3 CatmullRom(const Vector3 value1, const Vector3 value2, const Vector3 value3, const Vector3 value4, const float amount); static Vector3 CatmullRom(const Vector3 value1, const Vector3 value2, const Vector3 value3, const Vector3 value4, const float amount);
static void CatmullRom(const Vector3 value1, const Vector3 value2, const Vector3 value3, const Vector3 value4, const float amount, out Vector3& result); static void CatmullRom(const Vector3 value1, const Vector3 value2, const Vector3 value3, const Vector3 value4, const float amount, out Vector3& result);
static Vector3 Clamp(const Vector3 value1, const Vector3 min, const Vector3 max); static Vector3 Clamp(const Vector3 value1, const Vector3 min, const Vector3 max);
static void Clamp(const Vector3 value1, const Vector3 min, const Vector3 max, out Vector3& result); static void Clamp(const Vector3 value1, const Vector3 min, const Vector3 max, out Vector3& result);
static Vector3 Cross(const Vector3 vector1, const Vector3 vector2); static Vector3 Cross(const Vector3 vector1, const Vector3 vector2);
static void Cross(const Vector3 vector1, const Vector3 vector2, out Vector3& result); static void Cross(const Vector3 vector1, const Vector3 vector2, out Vector3& result);
static float Distance(const Vector3 value1, const Vector3 value2); static float Distance(const Vector3 value1, const Vector3 value2);
static void Distance(const Vector3 value1, const Vector3 value2, out float& result); static void Distance(const Vector3 value1, const Vector3 value2, out float& result);
static float DistanceSquared(const Vector3 value1, const Vector3 value2); static float DistanceSquared(const Vector3 value1, const Vector3 value2);
static void DistanceSquared(const Vector3 value1, const Vector3 value2, out float& result); static void DistanceSquared(const Vector3 value1, const Vector3 value2, out float& result);
static Vector3 Divide(const Vector3 value1, const float value2); static Vector3 Divide(const Vector3 value1, const float value2);
static void Divide(const Vector3 value1, const float value2, out Vector3& result); static void Divide(const Vector3 value1, const float value2, out Vector3& result);
static Vector3 Divide(const Vector3 value1, const Vector3 value2); static Vector3 Divide(const Vector3 value1, const Vector3 value2);
static void Divide(const Vector3 value1, const Vector3 value2, out Vector3& result); static void Divide(const Vector3 value1, const Vector3 value2, out Vector3& result);
static float Dot(const Vector3 value1, const Vector3 value2); static float Dot(const Vector3 value1, const Vector3 value2);
static void Dot(const Vector3 value1, const Vector3 value2, out float& result); static void Dot(const Vector3 value1, const Vector3 value2, out float& result);
bool Equals(Object const * const obj) const; bool Equals(Object const * const obj) const;
bool Equals(const Vector3 other) const; bool Equals(const Vector3 other) const;
int GetHashCode() const; int GetHashCode() const;
static const Type& GetType(); static const Type& GetType();
static Vector3 Hermite(const Vector3 value1, const Vector3 tangent1, const Vector3 value2, const Vector3 tangent2, const float amount); static Vector3 Hermite(const Vector3 value1, const Vector3 tangent1, const Vector3 value2, const Vector3 tangent2, const float amount);
static void Hermite(const Vector3 value1, const Vector3 tangent1, const Vector3 value2, const Vector3 tangent2, const float amount, out Vector3& result); static void Hermite(const Vector3 value1, const Vector3 tangent1, const Vector3 value2, const Vector3 tangent2, const float amount, out Vector3& result);
float Length() const; float Length() const;
float LengthSquared() const; float LengthSquared() const;
static Vector3 Lerp(const Vector3 value1, const Vector3 value2, float amount); static Vector3 Lerp(const Vector3 value1, const Vector3 value2, float amount);
static void Lerp(const Vector3 value1, const Vector3 value2, const float amount, out Vector3& result); static void Lerp(const Vector3 value1, const Vector3 value2, const float amount, out Vector3& result);
static Vector3 Max(const Vector3 value1, const Vector3 value2); static Vector3 Max(const Vector3 value1, const Vector3 value2);
static void Max(const Vector3 value1, const Vector3 value2, out Vector3& result); static void Max(const Vector3 value1, const Vector3 value2, out Vector3& result);
static Vector3 Min(const Vector3 value1, const Vector3 value2); static Vector3 Min(const Vector3 value1, const Vector3 value2);
static void Min(const Vector3 value1, const Vector3 value2, out Vector3& result); static void Min(const Vector3 value1, const Vector3 value2, out Vector3& result);
static Vector3 Multiply(const Vector3 value1, const float scaleFactor); static Vector3 Multiply(const Vector3 value1, const float scaleFactor);
static void Multiply(const Vector3 value1, const float scaleFactor, out Vector3& result); static void Multiply(const Vector3 value1, const float scaleFactor, out Vector3& result);
static Vector3 Multiply(const Vector3 value1, const Vector3 value2); static Vector3 Multiply(const Vector3 value1, const Vector3 value2);
static void Multiply(const Vector3 value1, const Vector3 value2, out Vector3& result); static void Multiply(const Vector3 value1, const Vector3 value2, out Vector3& result);
static Vector3 Negate(const Vector3 value); static Vector3 Negate(const Vector3 value);
static void Negate(const Vector3 value, out Vector3& result); static void Negate(const Vector3 value, out Vector3& result);
void Normalize(); void Normalize();
static Vector3 Normalize(const Vector3 value); static Vector3 Normalize(const Vector3 value);
static void Normalize(const Vector3 value, out Vector3& result); static void Normalize(const Vector3 value, out Vector3& result);
static Vector3 Reflect(const Vector3 vector, const Vector3 normal); static Vector3 Reflect(const Vector3 vector, const Vector3 normal);
static void Reflect(const Vector3 vector, const Vector3 normal, out Vector3& result); static void Reflect(const Vector3 vector, const Vector3 normal, out Vector3& result);
static Vector3 SmoothStep(const Vector3 value1, const Vector3 value2, const float amount); static Vector3 SmoothStep(const Vector3 value1, const Vector3 value2, const float amount);
static void SmoothStep(const Vector3 value1, const Vector3 value2, const float amount, out Vector3& result); static void SmoothStep(const Vector3 value1, const Vector3 value2, const float amount, out Vector3& result);
static Vector3 Subtract(const Vector3 value1, const Vector3 value2); static Vector3 Subtract(const Vector3 value1, const Vector3 value2);
static void Subtract(const Vector3 value1, const Vector3 value2, out Vector3& result); static void Subtract(const Vector3 value1, const Vector3 value2, out Vector3& result);
const String ToString() const; const String ToString() const;
static Vector3 Transform(const Vector3 position, const Matrix matrix); static Vector3 Transform(const Vector3 position, const Matrix matrix);
static void Transform(const Vector3 position, const Matrix matrix, out Vector3& result); static void Transform(const Vector3 position, const Matrix matrix, out Vector3& result);
static Vector3 Transform(const Vector3 position, const Quaternion rotation); static Vector3 Transform(const Vector3 position, const Quaternion rotation);
static void Transform(const Vector3 position, const Quaternion rotation, out Vector3& result); static void Transform(const Vector3 position, const Quaternion rotation, out Vector3& result);
static void Transform(const Vector3 sourceArray[], const int sourceIndex, const Matrix matrix, Vector3 destinationArray[], const int destinationIndex, const int length) NONNULL(1, 4); static void Transform(const Vector3 sourceArray[], const int sourceIndex, const Matrix matrix, Vector3 destinationArray[], const int destinationIndex, const int length) NONNULL(1, 4);
static void Transform(const Vector3 sourceArray[], const int sourceIndex, const Quaternion rotation, Vector3 destinationArray[], const int destinationIndex, const int length) NONNULL(1, 4); static void Transform(const Vector3 sourceArray[], const int sourceIndex, const Quaternion rotation, Vector3 destinationArray[], const int destinationIndex, const int length) NONNULL(1, 4);
static void Transform(const Vector3 sourceArray[], const Matrix matrix, Vector3 destinationArray[]) NONNULL(1, 3); static void Transform(const Vector3 sourceArray[], const Matrix matrix, Vector3 destinationArray[]) NONNULL(1, 3);
static void Transform(const Vector3 sourceArray[], const Quaternion rotation, Vector3 destinationArray[]) NONNULL(1, 3); static void Transform(const Vector3 sourceArray[], const Quaternion rotation, Vector3 destinationArray[]) NONNULL(1, 3);
static Vector3 TransformNormal(const Vector3 normal, const Matrix matrix); static Vector3 TransformNormal(const Vector3 normal, const Matrix matrix);
static void TransformNormal(const Vector3 normal, const Matrix matrix, out Vector3& result); static void TransformNormal(const Vector3 normal, const Matrix matrix, out Vector3& result);
static void TransformNormal(const Vector3 sourceArray[], const int sourceIndex, const Matrix matrix, Vector3 destinationArray[], const int destinationIndex, const int length) NONNULL(1, 4); static void TransformNormal(const Vector3 sourceArray[], const int sourceIndex, const Matrix matrix, Vector3 destinationArray[], const int destinationIndex, const int length) NONNULL(1, 4);
static void TransformNormal(const Vector3 sourceArray[], const Matrix matrix, Vector3 destinationArray[]) NONNULL(1, 3); static void TransformNormal(const Vector3 sourceArray[], const Matrix matrix, Vector3 destinationArray[]) NONNULL(1, 3);
Vector3 operator+(const Vector3& other); Vector3 operator+(const Vector3& other);
Vector3 operator/(const float divider); Vector3 operator/(const float divider);
Vector3 operator/(const Vector3& other); Vector3 operator/(const Vector3& other);
bool operator==(const Vector3& other) const; bool operator==(const Vector3& other) const;
bool operator!=(const Vector3& other) const; bool operator!=(const Vector3& other) const;
Vector3 operator*(const float scaleFactor); Vector3 operator*(const float scaleFactor);
Vector3 operator*(const Vector3& other); Vector3 operator*(const Vector3& other);
Vector3 operator-(const Vector3& other); Vector3 operator-(const Vector3& other);

View File

@ -29,6 +29,8 @@
namespace XFX namespace XFX
{ {
const Type GameComponentTypeInfo("GameComponent", "XFX::GameComponent", TypeCode::Object);
bool GameComponent::getEnabled() const bool GameComponent::getEnabled() const
{ {
return _enabled; return _enabled;
@ -70,10 +72,10 @@ namespace XFX
void GameComponent::Dispose(bool disposing) void GameComponent::Dispose(bool disposing)
{ {
if (!_disposed) if (!_disposed)
{ {
_disposed = true; _disposed = true;
Disposed(this, const_cast<EventArgs*>(EventArgs::Empty)); Disposed(this, const_cast<EventArgs*>(EventArgs::Empty));
} }
} }
GameComponent::GameComponent(Game * const game) GameComponent::GameComponent(Game * const game)
@ -87,6 +89,11 @@ namespace XFX
Dispose(false); Dispose(false);
} }
const Type& GameComponent::GetType()
{
return GameComponentTypeInfo;
}
void GameComponent::Initialize() void GameComponent::Initialize()
{ {
} }

View File

@ -27,11 +27,18 @@
#include <Graphics/AlphaTestEffect.h> #include <Graphics/AlphaTestEffect.h>
#include <Graphics/Texture2D.h> #include <Graphics/Texture2D.h>
#include <System/Type.h>
namespace XFX namespace XFX
{ {
namespace Graphics namespace Graphics
{ {
const Type AlphaTestEffectTypeInfo("AlphaTestEffect", "XFX::Graphics::AlphaTestEffect", TypeCode::Object);
byte AlphaTestEffect::effectCode[] =
{
};
AlphaTestEffect::AlphaTestEffect(AlphaTestEffect const * const cloneSource) AlphaTestEffect::AlphaTestEffect(AlphaTestEffect const * const cloneSource)
: Effect(cloneSource), : Effect(cloneSource),
Alpha(cloneSource->Alpha), AlphaFunction(cloneSource->AlphaFunction), Alpha(cloneSource->Alpha), AlphaFunction(cloneSource->AlphaFunction),
@ -43,12 +50,12 @@ namespace XFX
{ {
} }
void AlphaTestEffect::OnApply() AlphaTestEffect::AlphaTestEffect(GraphicsDevice * const device)
: Effect(device, effectCode)
{ {
} }
AlphaTestEffect::AlphaTestEffect(GraphicsDevice * const device) void AlphaTestEffect::OnApply()
: Effect(device, effectCode)
{ {
} }
@ -57,8 +64,9 @@ namespace XFX
return new AlphaTestEffect(this); return new AlphaTestEffect(this);
} }
int AlphaTestEffect::GetType() const const Type& AlphaTestEffect::GetType()
{ {
return AlphaTestEffectTypeInfo;
} }
} }
} }

View File

@ -29,11 +29,14 @@
#include <Vector3.h> #include <Vector3.h>
#include <Graphics/BasicEffect.h> #include <Graphics/BasicEffect.h>
#include <Graphics/DirectionalLight.h> #include <Graphics/DirectionalLight.h>
#include <System/Type.h>
namespace XFX namespace XFX
{ {
namespace Graphics namespace Graphics
{ {
const Type BasicEffectTypeInfo("BasicEffect", "XFX::Graphics::BasicEffect", TypeCode::Object);
DirectionalLight* BasicEffect::getDirectionalLight0() const DirectionalLight* BasicEffect::getDirectionalLight0() const
{ {
} }
@ -82,9 +85,9 @@ namespace XFX
LightingEnabled = true; LightingEnabled = true;
} }
int BasicEffect::GetType() const Type& BasicEffect::GetType()
{ {
// TODO: implement return BasicEffectTypeInfo;
} }
void BasicEffect::OnApply() void BasicEffect::OnApply()

View File

@ -26,6 +26,7 @@
// POSSIBILITY OF SUCH DAMAGE. // POSSIBILITY OF SUCH DAMAGE.
#include <Graphics/BlendState.h> #include <Graphics/BlendState.h>
#include <System/Type.h>
#include <sassert.h> #include <sassert.h>
@ -33,7 +34,8 @@ namespace XFX
{ {
namespace Graphics namespace Graphics
{ {
const char * const BlendState::isBoundErrorString = ""; const String BlendState::isBoundErrorString = "";
const Type BlendStateTypeInfo("BlendState", "XFX::Graphics::BlendState", TypeCode::Object);
BlendState::BlendState() BlendState::BlendState()
{ {
@ -74,9 +76,9 @@ namespace XFX
{ {
} }
int BlendState::GetType() const Type& BlendState::GetType()
{ {
// TODO: implement return BlendStateTypeInfo;
} }
} }
} }

View File

@ -94,7 +94,7 @@ namespace XFX
Dispose(true); Dispose(true);
} }
int ContentManager::GetType() const Type& ContentManager::GetType()
{ {
} }
@ -102,9 +102,16 @@ namespace XFX
T ContentManager::Load(const String& assetName) T ContentManager::Load(const String& assetName)
{ {
T dummyVal; T dummyVal;
Object* obj2;
sassert(!disposed, "" + GetType().ToString());
sassert(!String::IsNullOrEmpty(assetName), String::Format("assetName; %s", FrameworkResources::ArgumentNull_Generic));
assetName = GetCleanPath(assetName);
/* TODO: port the C# code below to C++ /* TODO: port the C# code below to C++
object obj2; object obj2;
if (this.loadedAssets == null) if (this.loadedAssets == null)
{ {
throw new ObjectDisposedException(this.ToString()); throw new ObjectDisposedException(this.ToString());
@ -135,8 +142,8 @@ namespace XFX
return (T)obj2; return (T)obj2;
}*/ }*/
T local = this->ReadAsset<T>(assetName); T local = ReadAsset<T>(assetName);
//this->loadedAssets.Add(assetName, local); loadedAssets.Add(assetName, local);
return local; return local;
} }

View File

@ -36,9 +36,9 @@ namespace XFX
{ {
namespace Content namespace Content
{ {
const short ContentReader::XnbVersion = 2; const short ContentReader::XnbVersion = 5;
String ContentReader::getAssetName() const const String ContentReader::getAssetName() const
{ {
return _assetName; return _assetName;
} }

View File

@ -26,11 +26,14 @@
// POSSIBILITY OF SUCH DAMAGE. // POSSIBILITY OF SUCH DAMAGE.
#include <Graphics/Effect.h> #include <Graphics/Effect.h>
#include <System/Type.h>
namespace XFX namespace XFX
{ {
namespace Graphics namespace Graphics
{ {
const Type EffectTypeInfo("Effect", "XFX::Graphics::Effect", TypeCode::Object);
Effect::Effect(Effect const * const cloneSource) Effect::Effect(Effect const * const cloneSource)
: _parameters(cloneSource->_parameters), : _parameters(cloneSource->_parameters),
_techniques(cloneSource->_techniques), _techniques(cloneSource->_techniques),
@ -50,8 +53,9 @@ namespace XFX
return new Effect(this); return new Effect(this);
} }
int Effect::GetType() const Type& Effect::GetType()
{ {
return EffectTypeInfo;
} }
} }
} }

View File

@ -85,7 +85,6 @@ namespace XFX
bool GraphicsAdapter::QueryBackBufferFormat(SurfaceFormat_t format, DepthFormat_t depthFormat, int multiSampleCount, out SurfaceFormat_t selectedFormat, out DepthFormat_t selectedDepthFormat, out int selectedMultiSampleCount) const bool GraphicsAdapter::QueryBackBufferFormat(SurfaceFormat_t format, DepthFormat_t depthFormat, int multiSampleCount, out SurfaceFormat_t selectedFormat, out DepthFormat_t selectedDepthFormat, out int selectedMultiSampleCount) const
{ {
} }
bool GraphicsAdapter::QueryRenderTargetFormat(SurfaceFormat_t format, DepthFormat_t depthFormat, int multiSampleCount, out SurfaceFormat_t selectedFormat, out DepthFormat_t selectedDepthFormat, out int selectedMultiSampleCount) const bool GraphicsAdapter::QueryRenderTargetFormat(SurfaceFormat_t format, DepthFormat_t depthFormat, int multiSampleCount, out SurfaceFormat_t selectedFormat, out DepthFormat_t selectedDepthFormat, out int selectedMultiSampleCount) const

View File

@ -26,11 +26,14 @@
// POSSIBILITY OF SUCH DAMAGE. // POSSIBILITY OF SUCH DAMAGE.
#include <Graphics/GraphicsResource.h> #include <Graphics/GraphicsResource.h>
#include <System/Type.h>
namespace XFX namespace XFX
{ {
namespace Graphics namespace Graphics
{ {
const Type GraphicsResourceTypeInfo("GraphicsResource", "XFX::Graphics::GraphicsResource", TypeCode::Object);
GraphicsDevice* GraphicsResource::getGraphicsDevice() GraphicsDevice* GraphicsResource::getGraphicsDevice()
{ {
return graphicsDevice; return graphicsDevice;
@ -59,16 +62,16 @@ namespace XFX
void GraphicsResource::Dispose(bool disposing) void GraphicsResource::Dispose(bool disposing)
{ {
if(isDisposed) if(isDisposed)
return; return;
isDisposed = true; isDisposed = true;
Disposing(this, const_cast<EventArgs*>(EventArgs::Empty)); Disposing(this, const_cast<EventArgs*>(EventArgs::Empty));
} }
int GraphicsResource::GetType() const Type& GraphicsResource::GetType()
{ {
// TODO: implement return GraphicsResourceTypeInfo;
} }
} }
} }

View File

@ -65,7 +65,41 @@ namespace XFX
for (uint i = 0; i < boneCount; i++) for (uint i = 0; i < boneCount; i++)
{ {
ReadBoneReference(reader, boneCount);
// Read the child bone references.
uint childCount = reader->ReadUInt32();
if (childCount)
{
for (uint j = 0; j < childCount; j++)
{
ReadBoneReference(reader, boneCount);
}
}
}
// Read the mesh data.
uint meshCount = reader->ReadUInt32();
for (uint i = 0; i < meshCount; i++)
{
}
}
void ModelReader::ReadBoneReference(ContentReader * const reader, uint boneCount)
{
uint boneId;
// Read the bone ID, which may be encoded as either an 8 or 32 bit value.
if (boneCount < 255)
{
boneId = reader->ReadByte();
}
else
{
boneId = reader->ReadUInt32();
} }
} }
} }

View File

@ -18,6 +18,9 @@ namespace XFX
{ {
class ModelReader : public ContentTypeReader<Model> class ModelReader : public ContentTypeReader<Model>
{ {
private:
void ReadBoneReference(ContentReader * const input, uint boneCount);
public: public:
Model* Read(ContentReader * const input, Model* existingInstance); Model* Read(ContentReader * const input, Model* existingInstance);
}; };

View File

@ -34,11 +34,14 @@
#include <Vector4.h> #include <Vector4.h>
#include <System/Math.h> #include <System/Math.h>
#include <System/String.h> #include <System/String.h>
#include <System/Type.h>
using namespace System; using namespace System;
namespace XFX namespace XFX
{ {
const Type PlaneTypeInfo("Plane", "XFX::Plane", TypeCode::Object);
Plane::Plane(const float a, const float b, const float c, const float d) Plane::Plane(const float a, const float b, const float c, const float d)
: D(d), Normal(a, b, c) : D(d), Normal(a, b, c)
{ {
@ -52,20 +55,20 @@ namespace XFX
Plane::Plane(const Vector3 point1, const Vector3 point2, const Vector3 point3) Plane::Plane(const Vector3 point1, const Vector3 point2, const Vector3 point3)
{ {
float x1 = point2.X - point1.X; float x1 = point2.X - point1.X;
float y1 = point2.Y - point1.Y; float y1 = point2.Y - point1.Y;
float z1 = point2.Z - point1.Z; float z1 = point2.Z - point1.Z;
float x2 = point3.X - point1.X; float x2 = point3.X - point1.X;
float y2 = point3.Y - point1.Y; float y2 = point3.Y - point1.Y;
float z2 = point3.Z - point1.Z; float z2 = point3.Z - point1.Z;
float yz = (y1 * z2) - (z1 * y2); float yz = (y1 * z2) - (z1 * y2);
float xz = (z1 * x2) - (x1 * z2); float xz = (z1 * x2) - (x1 * z2);
float xy = (x1 * y2) - (y1 * x2); float xy = (x1 * y2) - (y1 * x2);
float invPyth = 1.0f / Math::Sqrt((yz * yz) + (xz * xz) + (xy * xy)); float invPyth = 1.0f / Math::Sqrt((yz * yz) + (xz * xz) + (xy * xy));
Normal.X = yz * invPyth; Normal.X = yz * invPyth;
Normal.Y = xz * invPyth; Normal.Y = xz * invPyth;
Normal.Z = xy * invPyth; Normal.Z = xy * invPyth;
D = -((Normal.X * point1.X) + (Normal.Y * point1.Y) + (Normal.Z * point1.Z)); D = -((Normal.X * point1.X) + (Normal.Y * point1.Y) + (Normal.Z * point1.Z));
} }
Plane::Plane(const Vector4 value) Plane::Plane(const Vector4 value)
@ -128,9 +131,9 @@ namespace XFX
return Normal.GetHashCode() ^ (int)D; return Normal.GetHashCode() ^ (int)D;
} }
int Plane::GetType() const Type& Plane::GetType()
{ {
// TODO: implement return PlaneTypeInfo;
} }
PlaneIntersectionType_t Plane::Intersects(const BoundingBox boundingbox) const PlaneIntersectionType_t Plane::Intersects(const BoundingBox boundingbox) const
@ -143,68 +146,68 @@ namespace XFX
void Plane::Intersects(const BoundingBox boundingbox, out PlaneIntersectionType_t& result) const void Plane::Intersects(const BoundingBox boundingbox, out PlaneIntersectionType_t& result) const
{ {
Vector3 min; Vector3 min;
Vector3 max; Vector3 max;
max.X = (Normal.X >= 0.0f) ? boundingbox.Min.X : boundingbox.Max.X; max.X = (Normal.X >= 0.0f) ? boundingbox.Min.X : boundingbox.Max.X;
max.Y = (Normal.Y >= 0.0f) ? boundingbox.Min.Y : boundingbox.Max.Y; max.Y = (Normal.Y >= 0.0f) ? boundingbox.Min.Y : boundingbox.Max.Y;
max.Z = (Normal.Z >= 0.0f) ? boundingbox.Min.Z : boundingbox.Max.Z; max.Z = (Normal.Z >= 0.0f) ? boundingbox.Min.Z : boundingbox.Max.Z;
min.X = (Normal.X >= 0.0f) ? boundingbox.Max.X : boundingbox.Min.X; min.X = (Normal.X >= 0.0f) ? boundingbox.Max.X : boundingbox.Min.X;
min.Y = (Normal.Y >= 0.0f) ? boundingbox.Max.Y : boundingbox.Min.Y; min.Y = (Normal.Y >= 0.0f) ? boundingbox.Max.Y : boundingbox.Min.Y;
min.Z = (Normal.Z >= 0.0f) ? boundingbox.Max.Z : boundingbox.Min.Z; min.Z = (Normal.Z >= 0.0f) ? boundingbox.Max.Z : boundingbox.Min.Z;
float dot = (Normal.X * max.X) + (Normal.Y * max.Y) + (Normal.Z * max.Z); float dot = (Normal.X * max.X) + (Normal.Y * max.Y) + (Normal.Z * max.Z);
if(dot + D > 0.0f) if(dot + D > 0.0f)
result = PlaneIntersectionType::Front; result = PlaneIntersectionType::Front;
dot = (Normal.X * min.X) + (Normal.Y * min.Y) + (Normal.Z * min.Z); dot = (Normal.X * min.X) + (Normal.Y * min.Y) + (Normal.Z * min.Z);
if(dot + D < 0.0f) if(dot + D < 0.0f)
result = PlaneIntersectionType::Back; result = PlaneIntersectionType::Back;
result = PlaneIntersectionType::Intersecting; result = PlaneIntersectionType::Intersecting;
} }
PlaneIntersectionType_t Plane::Intersects(const BoundingSphere sphere) const PlaneIntersectionType_t Plane::Intersects(const BoundingSphere sphere) const
{ {
PlaneIntersectionType_t result; PlaneIntersectionType_t result;
Intersects(sphere, result); Intersects(sphere, result);
return result; return result;
} }
void Plane::Intersects(const BoundingSphere sphere, out PlaneIntersectionType_t& result) const void Plane::Intersects(const BoundingSphere sphere, out PlaneIntersectionType_t& result) const
{ {
float dot = (sphere.Center.X * Normal.X) + (sphere.Center.Y * Normal.Y) + (sphere.Center.Z * Normal.Z) + D; float dot = (sphere.Center.X * Normal.X) + (sphere.Center.Y * Normal.Y) + (sphere.Center.Z * Normal.Z) + D;
if(dot > sphere.Radius) if(dot > sphere.Radius)
result = PlaneIntersectionType::Front; result = PlaneIntersectionType::Front;
if(dot < -sphere.Radius) if(dot < -sphere.Radius)
result = PlaneIntersectionType::Back; result = PlaneIntersectionType::Back;
result = PlaneIntersectionType::Intersecting; result = PlaneIntersectionType::Intersecting;
} }
void Plane::Normalize() void Plane::Normalize()
{ {
float magnitude = 1.0f / Math::Sqrt((Normal.X * Normal.X) + (Normal.Y * Normal.Y) + (Normal.Z * Normal.Z)); float magnitude = 1.0f / Math::Sqrt((Normal.X * Normal.X) + (Normal.Y * Normal.Y) + (Normal.Z * Normal.Z));
Normal.X *= magnitude; Normal.X *= magnitude;
Normal.Y *= magnitude; Normal.Y *= magnitude;
Normal.Z *= magnitude; Normal.Z *= magnitude;
D *= magnitude; D *= magnitude;
} }
Plane Plane::Normalize(const Plane plane) Plane Plane::Normalize(const Plane plane)
{ {
float magnitude = 1.0f / Math::Sqrt((plane.Normal.X * plane.Normal.X) + (plane.Normal.Y * plane.Normal.Y) + (plane.Normal.Z * plane.Normal.Z)); float magnitude = 1.0f / Math::Sqrt((plane.Normal.X * plane.Normal.X) + (plane.Normal.Y * plane.Normal.Y) + (plane.Normal.Z * plane.Normal.Z));
return Plane(plane.Normal.X * magnitude, plane.Normal.Y * magnitude, plane.Normal.Z * magnitude, plane.D * magnitude); return Plane(plane.Normal.X * magnitude, plane.Normal.Y * magnitude, plane.Normal.Z * magnitude, plane.D * magnitude);
} }
void Plane::Normalize(const Plane plane, out Plane& result) void Plane::Normalize(const Plane plane, out Plane& result)
{ {
result = Normalize(plane); result = Normalize(plane);
} }
const String Plane::ToString() const const String Plane::ToString() const
{ {
@ -215,53 +218,53 @@ namespace XFX
{ {
Plane result; Plane result;
Transform(plane, matrix, result); Transform(plane, matrix, result);
return result; return result;
} }
void Plane::Transform(Plane plane, Matrix matrix, out Plane& result) void Plane::Transform(Plane plane, Matrix matrix, out Plane& result)
{ {
float x = plane.Normal.X; float x = plane.Normal.X;
float y = plane.Normal.Y; float y = plane.Normal.Y;
float z = plane.Normal.Z; float z = plane.Normal.Z;
float d = plane.D; float d = plane.D;
matrix = Matrix::Invert(matrix); matrix = Matrix::Invert(matrix);
result.Normal.X = (((x * matrix.M11) + (y * matrix.M12)) + (z * matrix.M13)) + (d * matrix.M14); result.Normal.X = (((x * matrix.M11) + (y * matrix.M12)) + (z * matrix.M13)) + (d * matrix.M14);
result.Normal.Y = (((x * matrix.M21) + (y * matrix.M22)) + (z * matrix.M23)) + (d * matrix.M24); result.Normal.Y = (((x * matrix.M21) + (y * matrix.M22)) + (z * matrix.M23)) + (d * matrix.M24);
result.Normal.Z = (((x * matrix.M31) + (y * matrix.M32)) + (z * matrix.M33)) + (d * matrix.M34); result.Normal.Z = (((x * matrix.M31) + (y * matrix.M32)) + (z * matrix.M33)) + (d * matrix.M34);
result.D = (((x * matrix.M41) + (y * matrix.M42)) + (z * matrix.M43)) + (d * matrix.M44); result.D = (((x * matrix.M41) + (y * matrix.M42)) + (z * matrix.M43)) + (d * matrix.M44);
} }
Plane Plane::Transform(Plane plane, Quaternion quaternion) Plane Plane::Transform(Plane plane, Quaternion quaternion)
{ {
Plane result; Plane result;
Transform(plane, quaternion, result); Transform(plane, quaternion, result);
return result; return result;
} }
void Plane::Transform(Plane plane, Quaternion quaternion, out Plane& result) void Plane::Transform(Plane plane, Quaternion quaternion, out Plane& result)
{ {
float x2 = quaternion.X + quaternion.X; float x2 = quaternion.X + quaternion.X;
float y2 = quaternion.Y + quaternion.Y; float y2 = quaternion.Y + quaternion.Y;
float z2 = quaternion.Z + quaternion.Z; float z2 = quaternion.Z + quaternion.Z;
float wx = quaternion.W * x2; float wx = quaternion.W * x2;
float wy = quaternion.W * y2; float wy = quaternion.W * y2;
float wz = quaternion.W * z2; float wz = quaternion.W * z2;
float xx = quaternion.X * x2; float xx = quaternion.X * x2;
float xy = quaternion.X * y2; float xy = quaternion.X * y2;
float xz = quaternion.X * z2; float xz = quaternion.X * z2;
float yy = quaternion.Y * y2; float yy = quaternion.Y * y2;
float yz = quaternion.Y * z2; float yz = quaternion.Y * z2;
float zz = quaternion.Z * z2; float zz = quaternion.Z * z2;
float x = plane.Normal.X; float x = plane.Normal.X;
float y = plane.Normal.Y; float y = plane.Normal.Y;
float z = plane.Normal.Z; float z = plane.Normal.Z;
result.Normal.X = ((x * ((1.0f - yy) - zz)) + (y * (xy - wz))) + (z * (xz + wy)); result.Normal.X = ((x * ((1.0f - yy) - zz)) + (y * (xy - wz))) + (z * (xz + wy));
result.Normal.Y = ((x * (xy + wz)) + (y * ((1.0f - xx) - zz))) + (z * (yz - wx)); result.Normal.Y = ((x * (xy + wz)) + (y * ((1.0f - xx) - zz))) + (z * (yz - wx));
result.Normal.Z = ((x * (xz - wy)) + (y * (yz + wx))) + (z * ((1.0f - xx) - yy)); result.Normal.Z = ((x * (xz - wy)) + (y * (yz + wx))) + (z * ((1.0f - xx) - yy));
result.D = plane.D; result.D = plane.D;
} }
bool Plane::operator==(const Plane& other) const bool Plane::operator==(const Plane& other) const

View File

@ -27,10 +27,12 @@
#include "Point.h" #include "Point.h"
#include <System/String.h> #include <System/String.h>
#include <System/Type.h>
namespace XFX namespace XFX
{ {
const Point Point::Zero = Point(); const Point Point::Zero = Point();
const Type PointTypeInfo("Point", "XFX::Point", TypeCode::Object);
Point::Point(int x, int y) Point::Point(int x, int y)
: X(x), Y(y) : X(x), Y(y)
@ -62,9 +64,9 @@ namespace XFX
return (X + Y); return (X + Y);
} }
int Point::GetType() const Type& Point::GetType()
{ {
// TODO: implement return PointTypeInfo;
} }
const String Point::ToString() const const String Point::ToString() const

View File

@ -27,15 +27,17 @@
#include <Rectangle.h> #include <Rectangle.h>
#include <Graphics/PresentationParameters.h> #include <Graphics/PresentationParameters.h>
#include <System/Type.h>
namespace XFX namespace XFX
{ {
namespace Graphics namespace Graphics
{ {
const Type PresentationParametersTypeInfo("PresentationParameters", "XFX::Graphics::PresentationParameters", TypeCode::Object);
PresentationParameters::PresentationParameters() PresentationParameters::PresentationParameters()
: BackBufferFormat(SurfaceFormat::Color), : BackBufferFormat(SurfaceFormat::Color), BackBufferHeight(0),
BackBufferHeight(0), BackBufferWidth(0), BackBufferWidth(0), IsFullScreen(true), MultiSampleCount(0),
IsFullScreen(true), MultiSampleCount(0),
PresentationInterval(PresentInterval::Default), PresentationInterval(PresentInterval::Default),
RenderTargetUsage(RenderTargetUsage::DiscardContents) RenderTargetUsage(RenderTargetUsage::DiscardContents)
{ {
@ -46,9 +48,9 @@ namespace XFX
return Rectangle(0, 0, BackBufferWidth, BackBufferHeight); return Rectangle(0, 0, BackBufferWidth, BackBufferHeight);
} }
PresentationParameters* PresentationParameters::Clone() const PresentationParameters* PresentationParameters::Clone() const
{ {
PresentationParameters* clone = new PresentationParameters(); PresentationParameters* clone = new PresentationParameters();
clone->BackBufferFormat = this->BackBufferFormat; clone->BackBufferFormat = this->BackBufferFormat;
clone->BackBufferHeight = this->BackBufferHeight; clone->BackBufferHeight = this->BackBufferHeight;
clone->BackBufferWidth = this->BackBufferWidth; clone->BackBufferWidth = this->BackBufferWidth;
@ -58,37 +60,37 @@ namespace XFX
clone->PresentationInterval = this->PresentationInterval; clone->PresentationInterval = this->PresentationInterval;
clone->RenderTargetUsage = this->RenderTargetUsage; clone->RenderTargetUsage = this->RenderTargetUsage;
return clone; return clone;
} }
bool PresentationParameters::Equals(Object const * const obj) const bool PresentationParameters::Equals(Object const * const obj) const
{ {
return is(this, obj) ? (*this == *(PresentationParameters*)obj) : false; return is(this, obj) ? (*this == *(PresentationParameters*)obj) : false;
} }
int PresentationParameters::GetType() const Type& PresentationParameters::GetType()
{ {
// TODO: implement return PresentationParametersTypeInfo;
} }
bool PresentationParameters::operator!=(const PresentationParameters& other) const bool PresentationParameters::operator!=(const PresentationParameters& other) const
{ {
return ((other.BackBufferFormat != BackBufferFormat) || return ((other.BackBufferFormat != BackBufferFormat) ||
(other.BackBufferHeight != BackBufferHeight) || (other.BackBufferHeight != BackBufferHeight) ||
(other.BackBufferWidth != BackBufferWidth) || (other.BackBufferWidth != BackBufferWidth) ||
(other.IsFullScreen != IsFullScreen) || (other.IsFullScreen != IsFullScreen) ||
(other.MultiSampleCount != MultiSampleCount) || (other.MultiSampleCount != MultiSampleCount) ||
(other.PresentationInterval != this->PresentationInterval) || (other.PresentationInterval != this->PresentationInterval) ||
(other.RenderTargetUsage != this->RenderTargetUsage)); (other.RenderTargetUsage != this->RenderTargetUsage));
} }
bool PresentationParameters::operator==(const PresentationParameters& other) const bool PresentationParameters::operator==(const PresentationParameters& other) const
{ {
return ((other.BackBufferFormat == BackBufferFormat) && return ((other.BackBufferFormat == BackBufferFormat) &&
(other.BackBufferHeight == BackBufferHeight) && (other.BackBufferHeight == BackBufferHeight) &&
(other.BackBufferWidth == BackBufferWidth) && (other.BackBufferWidth == BackBufferWidth) &&
(other.IsFullScreen == IsFullScreen) && (other.IsFullScreen == IsFullScreen) &&
(other.MultiSampleCount == MultiSampleCount) && (other.MultiSampleCount == MultiSampleCount) &&
(other.PresentationInterval == this->PresentationInterval) && (other.PresentationInterval == this->PresentationInterval) &&
(other.RenderTargetUsage == this->RenderTargetUsage)); (other.RenderTargetUsage == this->RenderTargetUsage));
} }
} }

View File

@ -25,17 +25,19 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE. // POSSIBILITY OF SUCH DAMAGE.
#include <System/Math.h>
#include <MathHelper.h> #include <MathHelper.h>
#include <Matrix.h> #include <Matrix.h>
#include <Quaternion.h> #include <Quaternion.h>
#include <System/Type.h>
#include <Vector3.h> #include <Vector3.h>
#include <System/Math.h>
using namespace System; using namespace System;
namespace XFX namespace XFX
{ {
const Quaternion Quaternion::Identity = Quaternion(0, 0, 0, 1); const Quaternion Quaternion::Identity = Quaternion(0, 0, 0, 1);
const Type QuaternionTypeInfo("Quaternion", "XFX::Quaternion", TypeCode::Object);
Quaternion::Quaternion(float x, float y, float z, float w) Quaternion::Quaternion(float x, float y, float z, float w)
: W(w), X(x), Y(y), Z(z) : W(w), X(x), Y(y), Z(z)
@ -76,46 +78,46 @@ namespace XFX
Quaternion Quaternion::Concatenate(Quaternion quaternion1, Quaternion quaternion2) Quaternion Quaternion::Concatenate(Quaternion quaternion1, Quaternion quaternion2)
{ {
Quaternion quaternion; Quaternion quaternion;
float rx = quaternion2.X; float rx = quaternion2.X;
float ry = quaternion2.Y; float ry = quaternion2.Y;
float rz = quaternion2.Z; float rz = quaternion2.Z;
float rw = quaternion2.W; float rw = quaternion2.W;
float lx = quaternion1.X; float lx = quaternion1.X;
float ly = quaternion1.Y; float ly = quaternion1.Y;
float lz = quaternion1.Z; float lz = quaternion1.Z;
float lw = quaternion1.W; float lw = quaternion1.W;
float yz = (ry * lz) - (rz * ly); float yz = (ry * lz) - (rz * ly);
float xz = (rz * lx) - (rx * lz); float xz = (rz * lx) - (rx * lz);
float xy = (rx * ly) - (ry * lx); float xy = (rx * ly) - (ry * lx);
float lengthSq = ((rx * lx) + (ry * ly)) + (rz * lz); float lengthSq = ((rx * lx) + (ry * ly)) + (rz * lz);
quaternion.X = ((rx * lw) + (lx * rw)) + yz; quaternion.X = ((rx * lw) + (lx * rw)) + yz;
quaternion.Y = ((ry * lw) + (ly * rw)) + xz; quaternion.Y = ((ry * lw) + (ly * rw)) + xz;
quaternion.Z = ((rz * lw) + (lz * rw)) + xy; quaternion.Z = ((rz * lw) + (lz * rw)) + xy;
quaternion.W = (rw * lw) - lengthSq; quaternion.W = (rw * lw) - lengthSq;
return quaternion; return quaternion;
} }
void Quaternion::Concatenate(Quaternion quaternion1, Quaternion quaternion2, out Quaternion& result) void Quaternion::Concatenate(Quaternion quaternion1, Quaternion quaternion2, out Quaternion& result)
{ {
float rx = quaternion2.X; float rx = quaternion2.X;
float ry = quaternion2.Y; float ry = quaternion2.Y;
float rz = quaternion2.Z; float rz = quaternion2.Z;
float rw = quaternion2.W; float rw = quaternion2.W;
float lx = quaternion1.X; float lx = quaternion1.X;
float ly = quaternion1.Y; float ly = quaternion1.Y;
float lz = quaternion1.Z; float lz = quaternion1.Z;
float lw = quaternion1.W; float lw = quaternion1.W;
float yz = (ry * lz) - (rz * ly); float yz = (ry * lz) - (rz * ly);
float xz = (rz * lx) - (rx * lz); float xz = (rz * lx) - (rx * lz);
float xy = (rx * ly) - (ry * lx); float xy = (rx * ly) - (ry * lx);
float lengthSq = ((rx * lx) + (ry * ly)) + (rz * lz); float lengthSq = ((rx * lx) + (ry * ly)) + (rz * lz);
result.X = ((rx * lw) + (lx * rw)) + yz; result.X = ((rx * lw) + (lx * rw)) + yz;
result.Y = ((ry * lw) + (ly * rw)) + xz; result.Y = ((ry * lw) + (ly * rw)) + xz;
result.Z = ((rz * lw) + (lz * rw)) + xy; result.Z = ((rz * lw) + (lz * rw)) + xy;
result.W = (rw * lw) - lengthSq; result.W = (rw * lw) - lengthSq;
} }
void Quaternion::Conjugate() void Quaternion::Conjugate()
@ -128,19 +130,19 @@ namespace XFX
Quaternion Quaternion::Conjugate(Quaternion value) Quaternion Quaternion::Conjugate(Quaternion value)
{ {
Quaternion result; Quaternion result;
result.X = -value.X; result.X = -value.X;
result.Y = -value.Y; result.Y = -value.Y;
result.Z = -value.Z; result.Z = -value.Z;
result.W = value.W; result.W = value.W;
return result; return result;
} }
void Quaternion::Conjugate(Quaternion value, out Quaternion& result) void Quaternion::Conjugate(Quaternion value, out Quaternion& result)
{ {
result.X = -value.X; result.X = -value.X;
result.Y = -value.Y; result.Y = -value.Y;
result.Z = -value.Z; result.Z = -value.Z;
result.W = value.W; result.W = value.W;
} }
Quaternion Quaternion::CreateFromAxisAngle(Vector3 axis, float angle) Quaternion Quaternion::CreateFromAxisAngle(Vector3 axis, float angle)
@ -150,15 +152,15 @@ namespace XFX
Vector3::Normalize(axis, axis); Vector3::Normalize(axis, axis);
float half = angle * 0.5f; float half = angle * 0.5f;
float Sin = Math::Sin(half); float Sin = Math::Sin(half);
float Cos = Math::Cos(half); float Cos = Math::Cos(half);
result.X = axis.X * Sin; result.X = axis.X * Sin;
result.Y = axis.Y * Sin; result.Y = axis.Y * Sin;
result.Z = axis.Z * Sin; result.Z = axis.Z * Sin;
result.W = Cos; result.W = Cos;
return result; return result;
} }
void Quaternion::CreateFromAxisAngle(Vector3 axis, float angle, out Quaternion& result) void Quaternion::CreateFromAxisAngle(Vector3 axis, float angle, out Quaternion& result)
@ -166,13 +168,13 @@ namespace XFX
Vector3::Normalize(axis, axis); Vector3::Normalize(axis, axis);
float half = angle * 0.5f; float half = angle * 0.5f;
float Sin = Math::Sin(half); float Sin = Math::Sin(half);
float Cos = Math::Cos(half); float Cos = Math::Cos(half);
result.X = axis.X * Sin; result.X = axis.X * Sin;
result.Y = axis.Y * Sin; result.Y = axis.Y * Sin;
result.Z = axis.Z * Sin; result.Z = axis.Z * Sin;
result.W = Cos; result.W = Cos;
} }
Quaternion Quaternion::CreateFromRotationMatrix(Matrix matrix) Quaternion Quaternion::CreateFromRotationMatrix(Matrix matrix)
@ -364,102 +366,102 @@ namespace XFX
return ((((int)X + (int)Y) + (int)Z) + (int)W); return ((((int)X + (int)Y) + (int)Z) + (int)W);
} }
int Quaternion::GetType() const Type& Quaternion::GetType()
{ {
// TODO: implement return QuaternionTypeInfo;
} }
Quaternion Quaternion::Inverse(Quaternion quaternion) Quaternion Quaternion::Inverse(Quaternion quaternion)
{ {
Quaternion result; Quaternion result;
float lengthSq = 1.0f / ( (quaternion.X * quaternion.X) + (quaternion.Y * quaternion.Y) + (quaternion.Z * quaternion.Z) + (quaternion.W * quaternion.W) ); float lengthSq = 1.0f / ( (quaternion.X * quaternion.X) + (quaternion.Y * quaternion.Y) + (quaternion.Z * quaternion.Z) + (quaternion.W * quaternion.W) );
result.X = -quaternion.X * lengthSq; result.X = -quaternion.X * lengthSq;
result.Y = -quaternion.Y * lengthSq; result.Y = -quaternion.Y * lengthSq;
result.Z = -quaternion.Z * lengthSq; result.Z = -quaternion.Z * lengthSq;
result.W = quaternion.W * lengthSq; result.W = quaternion.W * lengthSq;
return result; return result;
}
void Quaternion::Inverse(Quaternion quaternion, out Quaternion& result)
{
float lengthSq = 1.0f / ( (quaternion.X * quaternion.X) + (quaternion.Y * quaternion.Y) + (quaternion.Z * quaternion.Z) + (quaternion.W * quaternion.W) );
result.X = -quaternion.X * lengthSq;
result.Y = -quaternion.Y * lengthSq;
result.Z = -quaternion.Z * lengthSq;
result.W = quaternion.W * lengthSq;
} }
float Quaternion::Length() void Quaternion::Inverse(Quaternion quaternion, out Quaternion& result)
{ {
return Math::Sqrt((X * X) + (Y * Y) + (Z * Z) + (W * W)); float lengthSq = 1.0f / ( (quaternion.X * quaternion.X) + (quaternion.Y * quaternion.Y) + (quaternion.Z * quaternion.Z) + (quaternion.W * quaternion.W) );
} result.X = -quaternion.X * lengthSq;
result.Y = -quaternion.Y * lengthSq;
result.Z = -quaternion.Z * lengthSq;
result.W = quaternion.W * lengthSq;
}
float Quaternion::LengthSquared() float Quaternion::Length()
{ {
return (X * X) + (Y * Y) + (Z * Z) + (W * W); return Math::Sqrt((X * X) + (Y * Y) + (Z * Z) + (W * W));
} }
Quaternion Quaternion::Lerp(Quaternion quaternion1, Quaternion quaternion2, float amount) float Quaternion::LengthSquared()
{ {
Quaternion result; return (X * X) + (Y * Y) + (Z * Z) + (W * W);
result.X = MathHelper::Lerp(quaternion1.X, quaternion2.X, amount); }
result.Y = MathHelper::Lerp(quaternion1.Y, quaternion2.Y, amount);
result.Z = MathHelper::Lerp(quaternion1.Z, quaternion2.Z, amount);
result.W = MathHelper::Lerp(quaternion1.W, quaternion2.W, amount);
return result;
}
void Quaternion::Lerp(Quaternion quaternion1, Quaternion quaternion2, float amount, out Quaternion& result) Quaternion Quaternion::Lerp(Quaternion quaternion1, Quaternion quaternion2, float amount)
{
Quaternion result;
result.X = MathHelper::Lerp(quaternion1.X, quaternion2.X, amount);
result.Y = MathHelper::Lerp(quaternion1.Y, quaternion2.Y, amount);
result.Z = MathHelper::Lerp(quaternion1.Z, quaternion2.Z, amount);
result.W = MathHelper::Lerp(quaternion1.W, quaternion2.W, amount);
return result;
}
void Quaternion::Lerp(Quaternion quaternion1, Quaternion quaternion2, float amount, out Quaternion& result)
{ {
result.X = MathHelper::Lerp(quaternion1.X, quaternion2.X, amount); result.X = MathHelper::Lerp(quaternion1.X, quaternion2.X, amount);
result.Y = MathHelper::Lerp(quaternion1.Y, quaternion2.Y, amount); result.Y = MathHelper::Lerp(quaternion1.Y, quaternion2.Y, amount);
result.Z = MathHelper::Lerp(quaternion1.Z, quaternion2.Z, amount); result.Z = MathHelper::Lerp(quaternion1.Z, quaternion2.Z, amount);
result.W = MathHelper::Lerp(quaternion1.W, quaternion2.W, amount); result.W = MathHelper::Lerp(quaternion1.W, quaternion2.W, amount);
} }
Quaternion Quaternion::Multiply(Quaternion quaternion1, Quaternion quaternion2) Quaternion Quaternion::Multiply(Quaternion quaternion1, Quaternion quaternion2)
{ {
Quaternion result; Quaternion result;
float rx = quaternion2.X; float rx = quaternion2.X;
float ry = quaternion2.Y; float ry = quaternion2.Y;
float rz = quaternion2.Z; float rz = quaternion2.Z;
float rw = quaternion2.W; float rw = quaternion2.W;
float lx = quaternion1.X; float lx = quaternion1.X;
float ly = quaternion1.Y; float ly = quaternion1.Y;
float lz = quaternion1.Z; float lz = quaternion1.Z;
float lw = quaternion1.W; float lw = quaternion1.W;
float yz = (ry * lz) - (rz * ly); float yz = (ry * lz) - (rz * ly);
float xz = (rz * lx) - (rx * lz); float xz = (rz * lx) - (rx * lz);
float xy = (rx * ly) - (ry * lx); float xy = (rx * ly) - (ry * lx);
float lengthSq = ((rx * lx) + (ry * ly)) + (rz * lz); float lengthSq = ((rx * lx) + (ry * ly)) + (rz * lz);
result.X = ((rx * lw) + (lx * rw)) + yz; result.X = ((rx * lw) + (lx * rw)) + yz;
result.Y = ((ry * lw) + (ly * rw)) + xz; result.Y = ((ry * lw) + (ly * rw)) + xz;
result.Z = ((rz * lw) + (lz * rw)) + xy; result.Z = ((rz * lw) + (lz * rw)) + xy;
result.W = (rw * lw) - lengthSq; result.W = (rw * lw) - lengthSq;
return result; return result;
} }
void Quaternion::Multiply(Quaternion quaternion1, Quaternion quaternion2, out Quaternion& result) void Quaternion::Multiply(Quaternion quaternion1, Quaternion quaternion2, out Quaternion& result)
{ {
float rx = quaternion2.X; float rx = quaternion2.X;
float ry = quaternion2.Y; float ry = quaternion2.Y;
float rz = quaternion2.Z; float rz = quaternion2.Z;
float rw = quaternion2.W; float rw = quaternion2.W;
float lx = quaternion1.X; float lx = quaternion1.X;
float ly = quaternion1.Y; float ly = quaternion1.Y;
float lz = quaternion1.Z; float lz = quaternion1.Z;
float lw = quaternion1.W; float lw = quaternion1.W;
float yz = (ry * lz) - (rz * ly); float yz = (ry * lz) - (rz * ly);
float xz = (rz * lx) - (rx * lz); float xz = (rz * lx) - (rx * lz);
float xy = (rx * ly) - (ry * lx); float xy = (rx * ly) - (ry * lx);
float lengthSq = ((rx * lx) + (ry * ly)) + (rz * lz); float lengthSq = ((rx * lx) + (ry * ly)) + (rz * lz);
result.X = ((rx * lw) + (lx * rw)) + yz; result.X = ((rx * lw) + (lx * rw)) + yz;
result.Y = ((ry * lw) + (ly * rw)) + xz; result.Y = ((ry * lw) + (ly * rw)) + xz;
result.Z = ((rz * lw) + (lz * rw)) + xy; result.Z = ((rz * lw) + (lz * rw)) + xy;
result.W = (rw * lw) - lengthSq; result.W = (rw * lw) - lengthSq;
} }
Quaternion Quaternion::Multiply(Quaternion quaternion, float scaleFactor) Quaternion Quaternion::Multiply(Quaternion quaternion, float scaleFactor)
@ -498,84 +500,84 @@ namespace XFX
result.W = -quaternion.W; result.W = -quaternion.W;
} }
void Quaternion::Normalize() void Quaternion::Normalize()
{ {
float length = 1.0f / Length(); float length = 1.0f / Length();
X *= length; X *= length;
Y *= length; Y *= length;
Z *= length; Z *= length;
W *= length; W *= length;
} }
Quaternion Quaternion::Slerp(Quaternion quaternion1, Quaternion quaternion2, float amount) Quaternion Quaternion::Slerp(Quaternion quaternion1, Quaternion quaternion2, float amount)
{ {
Quaternion result; Quaternion result;
float opposite; float opposite;
float inverse; float inverse;
float dot = (quaternion1.X * quaternion2.X) + (quaternion1.Y * quaternion2.Y) + (quaternion1.Z * quaternion2.Z) + (quaternion1.W * quaternion2.W); float dot = (quaternion1.X * quaternion2.X) + (quaternion1.Y * quaternion2.Y) + (quaternion1.Z * quaternion2.Z) + (quaternion1.W * quaternion2.W);
int flag = false; int flag = false;
if( dot < 0.0f ) if( dot < 0.0f )
{ {
flag = true; flag = true;
dot = -dot; dot = -dot;
} }
if( dot > 0.999999f ) if( dot > 0.999999f )
{ {
inverse = 1.0f - amount; inverse = 1.0f - amount;
opposite = flag ? -amount : amount; opposite = flag ? -amount : amount;
} }
else else
{ {
float Acos = Math::Acos(dot); float Acos = Math::Acos(dot);
float invSin = (1.0f / Math::Sin(Acos)); float invSin = (1.0f / Math::Sin(Acos));
inverse = (Math::Sin((1.0f - amount) * Acos)* invSin); inverse = (Math::Sin((1.0f - amount) * Acos)* invSin);
opposite = flag ? ( -Math::Sin(amount * Acos ) * invSin) : (Math::Sin(amount * Acos) * invSin); opposite = flag ? ( -Math::Sin(amount * Acos ) * invSin) : (Math::Sin(amount * Acos) * invSin);
} }
result.X = (inverse * quaternion1.X) + (opposite * quaternion2.X); result.X = (inverse * quaternion1.X) + (opposite * quaternion2.X);
result.Y = (inverse * quaternion1.Y) + (opposite * quaternion2.Y); result.Y = (inverse * quaternion1.Y) + (opposite * quaternion2.Y);
result.Z = (inverse * quaternion1.Z) + (opposite * quaternion2.Z); result.Z = (inverse * quaternion1.Z) + (opposite * quaternion2.Z);
result.W = (inverse * quaternion1.W) + (opposite * quaternion2.W); result.W = (inverse * quaternion1.W) + (opposite * quaternion2.W);
return result; return result;
} }
void Quaternion::Slerp(Quaternion quaternion1, Quaternion quaternion2, float amount, out Quaternion& result) void Quaternion::Slerp(Quaternion quaternion1, Quaternion quaternion2, float amount, out Quaternion& result)
{ {
float opposite; float opposite;
float inverse; float inverse;
float dot = (quaternion1.X * quaternion2.X) + (quaternion1.Y * quaternion2.Y) + (quaternion1.Z * quaternion2.Z) + (quaternion1.W * quaternion2.W); float dot = (quaternion1.X * quaternion2.X) + (quaternion1.Y * quaternion2.Y) + (quaternion1.Z * quaternion2.Z) + (quaternion1.W * quaternion2.W);
int flag = false; int flag = false;
if( dot < 0.0f ) if( dot < 0.0f )
{ {
flag = true; flag = true;
dot = -dot; dot = -dot;
} }
if( dot > 0.999999f ) if( dot > 0.999999f )
{ {
inverse = 1.0f - amount; inverse = 1.0f - amount;
opposite = flag ? -amount : amount; opposite = flag ? -amount : amount;
} }
else else
{ {
float Acos = Math::Acos(dot); float Acos = Math::Acos(dot);
float invSin = (1.0f / Math::Sin(Acos)); float invSin = (1.0f / Math::Sin(Acos));
inverse = (Math::Sin((1.0f - amount) * Acos)* invSin); inverse = (Math::Sin((1.0f - amount) * Acos)* invSin);
opposite = flag ? ( -Math::Sin(amount * Acos ) * invSin) : (Math::Sin(amount * Acos) * invSin); opposite = flag ? ( -Math::Sin(amount * Acos ) * invSin) : (Math::Sin(amount * Acos) * invSin);
} }
result.X = (inverse * quaternion1.X) + (opposite * quaternion2.X); result.X = (inverse * quaternion1.X) + (opposite * quaternion2.X);
result.Y = (inverse * quaternion1.Y) + (opposite * quaternion2.Y); result.Y = (inverse * quaternion1.Y) + (opposite * quaternion2.Y);
result.Z = (inverse * quaternion1.Z) + (opposite * quaternion2.Z); result.Z = (inverse * quaternion1.Z) + (opposite * quaternion2.Z);
result.W = (inverse * quaternion1.W) + (opposite * quaternion2.W); result.W = (inverse * quaternion1.W) + (opposite * quaternion2.W);
} }
Quaternion Quaternion::Subtract(Quaternion quaternion1, Quaternion quaternion2) Quaternion Quaternion::Subtract(Quaternion quaternion1, Quaternion quaternion2)
{ {
@ -613,25 +615,25 @@ namespace XFX
Quaternion Quaternion::operator*(const Quaternion& other) Quaternion Quaternion::operator*(const Quaternion& other)
{ {
Quaternion result; Quaternion result;
float rx = other.X; float rx = other.X;
float ry = other.Y; float ry = other.Y;
float rz = other.Z; float rz = other.Z;
float rw = other.W; float rw = other.W;
float lx = X; float lx = X;
float ly = Y; float ly = Y;
float lz = Z; float lz = Z;
float lw = W; float lw = W;
float yz = (ry * lz) - (rz * ly); float yz = (ry * lz) - (rz * ly);
float xz = (rz * lx) - (rx * lz); float xz = (rz * lx) - (rx * lz);
float xy = (rx * ly) - (ry * lx); float xy = (rx * ly) - (ry * lx);
float lengthSq = ((rx * lx) + (ry * ly)) + (rz * lz); float lengthSq = ((rx * lx) + (ry * ly)) + (rz * lz);
result.X = ((rx * lw) + (lx * rw)) + yz; result.X = ((rx * lw) + (lx * rw)) + yz;
result.Y = ((ry * lw) + (ly * rw)) + xz; result.Y = ((ry * lw) + (ly * rw)) + xz;
result.Z = ((rz * lw) + (lz * rw)) + xy; result.Z = ((rz * lw) + (lz * rw)) + xy;
result.W = (rw * lw) - lengthSq; result.W = (rw * lw) - lengthSq;
return result; return result;
} }
Quaternion Quaternion::operator*(const float scaleFactor) Quaternion Quaternion::operator*(const float scaleFactor)

View File

@ -32,12 +32,15 @@
#include <System/Math.h> #include <System/Math.h>
#include <System/Single.h> #include <System/Single.h>
#include <System/String.h> #include <System/String.h>
#include <System/Type.h>
#include <Vector3.h> #include <Vector3.h>
using namespace System; using namespace System;
namespace XFX namespace XFX
{ {
const Type RayTypeInfo("Ray", "XFX::Ray", TypeCode::Object);
Ray::Ray(Vector3 direction, Vector3 position) Ray::Ray(Vector3 direction, Vector3 position)
: Direction(direction), Position(position) : Direction(direction), Position(position)
{ {
@ -68,9 +71,9 @@ namespace XFX
return (Direction.GetHashCode() ^ Position.GetHashCode()); return (Direction.GetHashCode() ^ Position.GetHashCode());
} }
int Ray::GetType() const Type& Ray::GetType()
{ {
// TODO: implement return RayTypeInfo;
} }
float Ray::Intersects(BoundingBox boundingbox) const float Ray::Intersects(BoundingBox boundingbox) const
@ -80,100 +83,100 @@ namespace XFX
float MAXValue = Single::MaxValue; float MAXValue = Single::MaxValue;
if (Math::Abs(Direction.X) < 0.0000001) if (Math::Abs(Direction.X) < 0.0000001)
{ {
if (Position.X < boundingbox.Min.X || Position.X > boundingbox.Max.X) if (Position.X < boundingbox.Min.X || Position.X > boundingbox.Max.X)
{ {
distance = 0.0f; distance = 0.0f;
return distance; return distance;
}
}
else
{
float inv = 1.0f / Direction.X;
float MIN = (boundingbox.Min.X - Position.X) * inv;
float MAX = (boundingbox.Max.X - Position.X) * inv;
if (MIN > MAX)
{
float temp = MIN;
MIN = MAX;
MAX = temp;
}
d = Math::Max(MIN, d);
MAXValue = Math::Min(MAX, MAXValue);
if (d > MAXValue)
{
distance = 0.0f;
return distance;
}
}
if (Math::Abs(Direction.Y) < 0.0000001)
{
if (Position.Y < boundingbox.Min.Y || Position.Y > boundingbox.Max.Y)
{
distance = 0.0f;
return distance;
}
}
else
{
float inv = 1.0f / Direction.Y;
float MIN = (boundingbox.Min.Y - Position.Y) * inv;
float MAX = (boundingbox.Max.Y - Position.Y) * inv;
if (MIN > MAX)
{
float temp = MIN;
MIN = MAX;
MAX = temp;
}
d = Math::Max(MIN, d);
MAXValue = Math::Min(MAX, MAXValue);
if (d > MAXValue)
{
distance = 0.0f;
return distance;
}
}
if (Math::Abs(Direction.Z) < 0.0000001)
{
if (Position.Z < boundingbox.Min.Z || Position.Z > boundingbox.Max.Z)
{
distance = 0.0f;
return distance;
}
}
else
{
float inv = 1.0f / Direction.Z;
float MIN = (boundingbox.Min.Z - Position.Z) * inv;
float MAX = (boundingbox.Max.Z - Position.Z) * inv;
if (MIN > MAX)
{
float temp = MIN;
MIN = MAX;
MAX = temp;
}
d = Math::Max(MIN, d);
MAXValue = Math::Min(MAX, MAXValue);
if (d > MAXValue)
{
distance = 0.0f;
return distance;
} }
} }
else
{
float inv = 1.0f / Direction.X;
float MIN = (boundingbox.Min.X - Position.X) * inv;
float MAX = (boundingbox.Max.X - Position.X) * inv;
distance = d; if (MIN > MAX)
return distance; {
float temp = MIN;
MIN = MAX;
MAX = temp;
}
d = Math::Max(MIN, d);
MAXValue = Math::Min(MAX, MAXValue);
if (d > MAXValue)
{
distance = 0.0f;
return distance;
}
}
if (Math::Abs(Direction.Y) < 0.0000001)
{
if (Position.Y < boundingbox.Min.Y || Position.Y > boundingbox.Max.Y)
{
distance = 0.0f;
return distance;
}
}
else
{
float inv = 1.0f / Direction.Y;
float MIN = (boundingbox.Min.Y - Position.Y) * inv;
float MAX = (boundingbox.Max.Y - Position.Y) * inv;
if (MIN > MAX)
{
float temp = MIN;
MIN = MAX;
MAX = temp;
}
d = Math::Max(MIN, d);
MAXValue = Math::Min(MAX, MAXValue);
if (d > MAXValue)
{
distance = 0.0f;
return distance;
}
}
if (Math::Abs(Direction.Z) < 0.0000001)
{
if (Position.Z < boundingbox.Min.Z || Position.Z > boundingbox.Max.Z)
{
distance = 0.0f;
return distance;
}
}
else
{
float inv = 1.0f / Direction.Z;
float MIN = (boundingbox.Min.Z - Position.Z) * inv;
float MAX = (boundingbox.Max.Z - Position.Z) * inv;
if (MIN > MAX)
{
float temp = MIN;
MIN = MAX;
MAX = temp;
}
d = Math::Max(MIN, d);
MAXValue = Math::Min(MAX, MAXValue);
if (d > MAXValue)
{
distance = 0.0f;
return distance;
}
}
distance = d;
return distance;
} }
void Ray::Intersects(BoundingBox boundingbox, out float& distance) const void Ray::Intersects(BoundingBox boundingbox, out float& distance) const
@ -185,33 +188,33 @@ namespace XFX
{ {
float distance; float distance;
float x = sphere.Center.X - Position.X; float x = sphere.Center.X - Position.X;
float y = sphere.Center.Y - Position.Y; float y = sphere.Center.Y - Position.Y;
float z = sphere.Center.Z - Position.Z; float z = sphere.Center.Z - Position.Z;
float pyth = (x * x) + (y * y) + (z * z); float pyth = (x * x) + (y * y) + (z * z);
float rr = sphere.Radius * sphere.Radius; float rr = sphere.Radius * sphere.Radius;
if (pyth <= rr) if (pyth <= rr)
{ {
distance = 0.0f; distance = 0.0f;
return distance; return distance;
} }
float dot = (x * Direction.X) + (y * Direction.Y) + (z * Direction.Z); float dot = (x * Direction.X) + (y * Direction.Y) + (z * Direction.Z);
if (dot < 0.0f) if (dot < 0.0f)
{ {
distance = 0.0f; distance = 0.0f;
return distance; return distance;
} }
float temp = pyth - (dot * dot); float temp = pyth - (dot * dot);
if (temp > rr) if (temp > rr)
{ {
distance = 0.0f; distance = 0.0f;
return distance; return distance;
} }
distance = dot - Math::Sqrt(rr - temp); distance = dot - Math::Sqrt(rr - temp);
return distance; return distance;
} }
void Ray::Intersects(BoundingSphere sphere, out float& distance) const void Ray::Intersects(BoundingSphere sphere, out float& distance) const
@ -224,27 +227,27 @@ namespace XFX
float dotDirection = (plane.Normal.X * Direction.X) + (plane.Normal.Y * Direction.Y) + (plane.Normal.Z * Direction.Z); float dotDirection = (plane.Normal.X * Direction.X) + (plane.Normal.Y * Direction.Y) + (plane.Normal.Z * Direction.Z);
float distance; float distance;
if (Math::Abs(dotDirection) < 0.000001f) if (Math::Abs(dotDirection) < 0.000001f)
{ {
distance = 0.0f; distance = 0.0f;
return distance; return distance;
} }
float dotPosition = (plane.Normal.X * Position.X) + (plane.Normal.Y * Position.Y) + (plane.Normal.Z * Position.Z); float dotPosition = (plane.Normal.X * Position.X) + (plane.Normal.Y * Position.Y) + (plane.Normal.Z * Position.Z);
float num = (-plane.D - dotPosition) / dotDirection; float num = (-plane.D - dotPosition) / dotDirection;
if (num < 0.0f) if (num < 0.0f)
{ {
if (num < -0.000001f) if (num < -0.000001f)
{ {
distance = 0.0f; distance = 0.0f;
return distance; return distance;
} }
num = 0.0f; num = 0.0f;
} }
distance = num; distance = num;
return distance; return distance;
} }
void Ray::Intersects(Plane plane, out float& distance) const void Ray::Intersects(Plane plane, out float& distance) const

View File

@ -27,10 +27,12 @@
#include <Point.h> #include <Point.h>
#include <Rectangle.h> #include <Rectangle.h>
#include <System/Type.h>
namespace XFX namespace XFX
{ {
const Rectangle Rectangle::Empty = Rectangle(0, 0, 0, 0); const Rectangle Rectangle::Empty = Rectangle(0, 0, 0, 0);
const Type RectangleTypeInfo("Rectangle", "XFX::Rectangle", TypeCode::Object);
Rectangle::Rectangle(const int x, const int y, const int width, const int height) Rectangle::Rectangle(const int x, const int y, const int width, const int height)
: Height(height), Width(width), X(x), Y(y) : Height(height), Width(width), X(x), Y(y)
@ -107,9 +109,9 @@ namespace XFX
return X ^ Y ^ Width ^ Height; return X ^ Y ^ Width ^ Height;
} }
int Rectangle::GetType() const Type& Rectangle::GetType()
{ {
// TODO: implement return RectangleTypeInfo;
} }
void Rectangle::Inflate(int horizontalAmount, int verticalAmount) void Rectangle::Inflate(int horizontalAmount, int verticalAmount)

View File

@ -34,6 +34,8 @@ namespace XFX
{ {
namespace Audio namespace Audio
{ {
const Type SoundEffectInstanceTypeInfo("SoundEffectInstance", "XFX::Audio::SoundEffectInstance", TypeCode::Object);
bool SoundEffectInstance::IsDisposed() const bool SoundEffectInstance::IsDisposed() const
{ {
} }
@ -75,7 +77,7 @@ namespace XFX
{ {
} }
SoundEffectInstance::SoundEffectInstance(SoundEffect* parent) SoundEffectInstance::SoundEffectInstance(SoundEffect * const parent)
: _parent(parent), _volume(parent->volume) : _parent(parent), _volume(parent->volume)
{ {
_parent->referenceCount++; _parent->referenceCount++;
@ -83,6 +85,7 @@ namespace XFX
SoundEffectInstance::~SoundEffectInstance() SoundEffectInstance::~SoundEffectInstance()
{ {
_parent->referenceCount--;
} }
void SoundEffectInstance::Apply3D(AudioListener listener, AudioEmitter emitter) void SoundEffectInstance::Apply3D(AudioListener listener, AudioEmitter emitter)
@ -106,8 +109,9 @@ namespace XFX
} }
} }
int SoundEffectInstance::GetType() const Type& SoundEffectInstance::GetType()
{ {
return SoundEffectInstanceTypeInfo;
} }
void SoundEffectInstance::Pause() void SoundEffectInstance::Pause()
@ -124,6 +128,7 @@ namespace XFX
void SoundEffectInstance::Stop() void SoundEffectInstance::Stop()
{ {
Stop(true);
} }
void SoundEffectInstance::Stop(bool immediate) void SoundEffectInstance::Stop(bool immediate)

View File

@ -89,7 +89,7 @@ namespace XFX
return; return;
} }
} }
*cDriveLetter = 0; *cDriveLetter = 0;
} }
StorageDevice* StorageContainer::getStorageDevice() const StorageDevice* StorageContainer::getStorageDevice() const
@ -141,7 +141,7 @@ namespace XFX
// copy the XeImageFileName to tmp, and strip the \default.xbe // copy the XeImageFileName to tmp, and strip the \default.xbe
//char *tmp = strncpy(tmp, XeImageFileName->Buffer, XeImageFileName->Length - 12); //char *tmp = strncpy(tmp, XeImageFileName->Buffer, XeImageFileName->Length - 12);
char* szTemp = (char*)malloc(256); char* szTemp = (char *)malloc(256);
char cDriveLetter = 0; char cDriveLetter = 0;
char* szDest; char* szDest;

View File

@ -0,0 +1,34 @@
/*****************************************************************************
* StorageDeviceAsyncResult.h *
* *
* XFX::Storage::StorageDeviceAsyncResult class definition file *
* Copyright (c) XFX Team. All Rights Reserved *
*****************************************************************************/
#ifndef _XFX_STORAGE_STORAGEDEVICEASYNCRESULT_
#define _XFX_STORAGE_STORAGEDEVICEASYNCRESULT_
#include <System/Interfaces.h>
using namespace System;
namespace XFX
{
namespace Storage
{
class StorageDeviceAsyncResult : public IAsyncResult
{
private:
Object* _state;
public:
StorageDeviceAsyncResult(Object* state);
Object* AsyncState();
Threading::WaitHandle* AsyncWaitHandle();
bool CompletedSynchronously() const;
bool IsCompleted() const;
};
}
}
#endif //_XFX_STORAGE_STORAGEDEVICEASYNCRESULT_

View File

@ -32,7 +32,7 @@ namespace XFX
{ {
namespace Graphics namespace Graphics
{ {
const VertexElement vertexArray[] = const VertexElement VertexPositionColor::vertexArray[] =
{ {
VertexElement(0, VertexElementFormat::Vector3, VertexElementUsage::Position, 0), VertexElement(0, VertexElementFormat::Vector3, VertexElementUsage::Position, 0),
VertexElement(12, VertexElementFormat::Color, VertexElementUsage::Color, 0) VertexElement(12, VertexElementFormat::Color, VertexElementUsage::Color, 0)

View File

@ -26,6 +26,7 @@
// POSSIBILITY OF SUCH DAMAGE. // POSSIBILITY OF SUCH DAMAGE.
#include <System/String.h> #include <System/String.h>
#include <System/Type.h>
#include <Vector2.h> #include <Vector2.h>
#include <Vector3.h> #include <Vector3.h>
#include <Graphics/VertexPositionTexture.h> #include <Graphics/VertexPositionTexture.h>
@ -34,6 +35,8 @@ namespace XFX
{ {
namespace Graphics namespace Graphics
{ {
const Type VertexPositionTextureTypeInfo("VertexPositionTexture", "XFX::Graphics::VertexPositionTexture", TypeCode::Object);
const VertexElement VertexPositionTexture::vertexArray[] = const VertexElement VertexPositionTexture::vertexArray[] =
{ {
VertexElement(0, VertexElementFormat::Vector3, VertexElementUsage::Position, 0), VertexElement(0, VertexElementFormat::Vector3, VertexElementUsage::Position, 0),
@ -57,7 +60,7 @@ namespace XFX
bool VertexPositionTexture::Equals(Object const * const obj) const bool VertexPositionTexture::Equals(Object const * const obj) const
{ {
return is(obj, this) ? (*this == *(VertexPositionTexture*)obj) : false; return is(obj, this) ? (*this == *(VertexPositionTexture *)obj) : false;
} }
int VertexPositionTexture::GetHashCode() const int VertexPositionTexture::GetHashCode() const
@ -65,9 +68,9 @@ namespace XFX
return Position.GetHashCode() ^ TextureCoordinate.GetHashCode(); return Position.GetHashCode() ^ TextureCoordinate.GetHashCode();
} }
int VertexPositionTexture::GetType() const Type& VertexPositionTexture::GetType()
{ {
// TODO: implement return VertexPositionTextureTypeInfo;
} }
const String VertexPositionTexture::ToString() const const String VertexPositionTexture::ToString() const

62
src/libXFX/Video.cpp Normal file
View File

@ -0,0 +1,62 @@
// Copyright (C) XFX Team
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of the copyright holder nor the names of any
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
#include <System/Type.h>
#include <Media/Video.h>
namespace XFX
{
namespace Media
{
const Type VideoTypeInfo("Video", "XFX::Media::Video", TypeCode::Object);
TimeSpan Video::getDuration()
{
}
float Video::getFramesPerSecond()
{
}
int Video::getHeight()
{
}
VideoSoundtrackType_t Video::getVideoSoundtrackType()
{
}
int Video::getWidth()
{
}
const Type& Video::GetType()
{
return VideoTypeInfo;
}
}
}

View File

@ -47,6 +47,7 @@ namespace XFX
Video* VideoPlayer::getVideo() Video* VideoPlayer::getVideo()
{ {
return playingVideo;
} }
VideoPlayer::VideoPlayer() VideoPlayer::VideoPlayer()
@ -64,6 +65,7 @@ namespace XFX
Texture2D* VideoPlayer::GetTexture() Texture2D* VideoPlayer::GetTexture()
{ {
// TODO: return current video frame
} }
void VideoPlayer::Pause() void VideoPlayer::Pause()
@ -72,6 +74,7 @@ namespace XFX
void VideoPlayer::Play(Video * const video) void VideoPlayer::Play(Video * const video)
{ {
sassert(video != null, String::Format("value; %s", FrameworkResources::ArgumentNull_Generic));
} }
void VideoPlayer::Resume() void VideoPlayer::Resume()

View File

@ -25,23 +25,26 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE. // POSSIBILITY OF SUCH DAMAGE.
#include <Graphics/Viewport.h>
#include <System/String.h>
#include <Matrix.h> #include <Matrix.h>
#include <Rectangle.h> #include <Rectangle.h>
#include <System/String.h>
#include <System/Type.h>
#include <Vector3.h> #include <Vector3.h>
#include <Graphics/Viewport.h>
namespace XFX namespace XFX
{ {
namespace Graphics namespace Graphics
{ {
const Type ViewportTypeInfo("Viewport", "XFX::Graphics::Viewport", TypeCode::Object);
float Viewport::getAspectRatio() const float Viewport::getAspectRatio() const
{ {
if ((Height != 0) && (Width != 0)) if ((Height != 0) && (Width != 0))
{ {
return (((float)Width) / ((float)Height)); return (((float)Width) / ((float)Height));
} }
return 0.0f; return 0.0f;
} }
Rectangle Viewport::getBounds() const Rectangle Viewport::getBounds() const
@ -99,8 +102,9 @@ namespace XFX
return ((int)getAspectRatio() + Height + (int)MaxDepth + (int)MinDepth + Width + X + Y); return ((int)getAspectRatio() + Height + (int)MaxDepth + (int)MinDepth + Width + X + Y);
} }
int Viewport::GetType() const Type& Viewport::GetType()
{ {
return ViewportTypeInfo;
} }
Vector3 Viewport::Project(const Vector3 source, const Matrix projection, const Matrix view, const Matrix world) const Vector3 Viewport::Project(const Vector3 source, const Matrix projection, const Matrix view, const Matrix world) const

View File

@ -1,3 +1,9 @@
/*****************************************************************************
* XNBFile.h *
* *
* XNA Binary Resource file header definition *
* Copyright (c) XFX Team. All rights reserved *
*****************************************************************************/
#ifndef _XNBFILE_ #ifndef _XNBFILE_
#define _XNBFILE_ #define _XNBFILE_
@ -9,6 +15,9 @@ namespace XFX
{ {
namespace Content namespace Content
{ {
/**
* Represents the header of an *.xnb file
*/
struct XNBFile struct XNBFile
{ {
byte FormatID1; byte FormatID1;

View File

@ -119,6 +119,7 @@
<ClCompile Include="VertexPositionColor.cpp" /> <ClCompile Include="VertexPositionColor.cpp" />
<ClCompile Include="VertexPositionNormalTexture.cpp" /> <ClCompile Include="VertexPositionNormalTexture.cpp" />
<ClCompile Include="VertexPositionTexture.cpp" /> <ClCompile Include="VertexPositionTexture.cpp" />
<ClCompile Include="Video.cpp" />
<ClCompile Include="Viewport.cpp" /> <ClCompile Include="Viewport.cpp" />
<ClCompile Include="GamePad.cpp" /> <ClCompile Include="GamePad.cpp" />
<ClCompile Include="Keyboard.cpp" /> <ClCompile Include="Keyboard.cpp" />
@ -242,6 +243,7 @@
<ClInclude Include="BlendState.cpp" /> <ClInclude Include="BlendState.cpp" />
<ClInclude Include="Enums.h" /> <ClInclude Include="Enums.h" />
<ClInclude Include="ModelReader.h" /> <ClInclude Include="ModelReader.h" />
<ClInclude Include="StorageDeviceAsyncResult.h" />
<ClInclude Include="Texture2DReader.h" /> <ClInclude Include="Texture2DReader.h" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@ -206,9 +206,6 @@
<ClCompile Include="Guide.cpp"> <ClCompile Include="Guide.cpp">
<Filter>Source Files\GamerServices</Filter> <Filter>Source Files\GamerServices</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="StorageDeviceAsyncResult.cpp">
<Filter>Source Files\GamerServices</Filter>
</ClCompile>
<ClCompile Include="PacketReader.cpp"> <ClCompile Include="PacketReader.cpp">
<Filter>Source Files\Net</Filter> <Filter>Source Files\Net</Filter>
</ClCompile> </ClCompile>
@ -236,6 +233,12 @@
<ClCompile Include="Model.cpp"> <ClCompile Include="Model.cpp">
<Filter>Source Files\Graphics</Filter> <Filter>Source Files\Graphics</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="Video.cpp">
<Filter>Source Files\Media</Filter>
</ClCompile>
<ClCompile Include="StorageDeviceAsyncResult.cpp">
<Filter>Source Files\Storage</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="..\..\include\BoundingBox.h"> <ClInclude Include="..\..\include\BoundingBox.h">
@ -568,6 +571,9 @@
<ClInclude Include="..\..\include\Graphics\ModelMeshPartCollection.h"> <ClInclude Include="..\..\include\Graphics\ModelMeshPartCollection.h">
<Filter>Header Files\Graphics</Filter> <Filter>Header Files\Graphics</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="StorageDeviceAsyncResult.h">
<Filter>Source Files\Storage</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="makefile" /> <None Include="makefile" />