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:
parent
c56db35373
commit
3a960b5829
@ -8,14 +8,20 @@
|
||||
#define _XFX_AUDIO_AUDIOEMITTER_
|
||||
|
||||
#include <System/Object.h>
|
||||
#include <System/Type.h>
|
||||
#include <Vector3.h>
|
||||
|
||||
using namespace System;
|
||||
|
||||
namespace XFX
|
||||
{
|
||||
namespace Audio
|
||||
{
|
||||
class AudioEmitter : public Object
|
||||
{
|
||||
private:
|
||||
static const Type AudioEmitterTypeInfo;
|
||||
|
||||
public:
|
||||
float DopplerScale;
|
||||
Vector3 Forward;
|
||||
@ -25,8 +31,13 @@ namespace XFX
|
||||
|
||||
AudioEmitter() { }
|
||||
|
||||
inline int GetType() const { }
|
||||
const Type& GetType()
|
||||
{
|
||||
return AudioEmitterTypeInfo;
|
||||
}
|
||||
};
|
||||
|
||||
const Type AudioEmitter::AudioEmitterTypeInfo = Type("AudioEmitter", "XFX::Audio::AudioEmitter", TypeCode::Object);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -27,12 +27,15 @@ namespace XFX
|
||||
*/
|
||||
class SoundEffect : public IDisposable, public Object
|
||||
{
|
||||
friend class SoundEffectInstance;
|
||||
|
||||
private:
|
||||
static float distanceScale;
|
||||
static float dopplerScale;
|
||||
TimeSpan duration;
|
||||
bool isDisposed;
|
||||
static float masterVolume;
|
||||
int referenceCount;
|
||||
static float speedOfSound;
|
||||
float volume;
|
||||
|
||||
|
@ -29,7 +29,7 @@ namespace XFX
|
||||
SoundEffect* _parent;
|
||||
float _volume;
|
||||
|
||||
SoundEffectInstance(SoundEffect* parent);
|
||||
SoundEffectInstance(SoundEffect * const parent);
|
||||
|
||||
virtual void Dispose(bool disposing);
|
||||
|
||||
|
@ -1,14 +1,14 @@
|
||||
/********************************************************
|
||||
* Enums.h *
|
||||
* *
|
||||
* XFX enumeration definition file *
|
||||
* Copyright (c) XFX Team. All Rights Reserved *
|
||||
********************************************************/
|
||||
/*****************************************************************************
|
||||
* Enums.h *
|
||||
* *
|
||||
* XFX enumeration definition file *
|
||||
* Copyright (c) XFX Team. All Rights Reserved *
|
||||
*****************************************************************************/
|
||||
#ifndef _XFX_ENUMS_
|
||||
#define _XFX_ENUMS_
|
||||
|
||||
namespace XFX
|
||||
{
|
||||
{
|
||||
// Describes how one bounding volume contains another.
|
||||
struct ContainmentType
|
||||
{
|
||||
@ -29,7 +29,7 @@ namespace XFX
|
||||
Step
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
// Defines how the value of a Curve will be determined for positions before the first point on the Curve or after the last point on the Curve.
|
||||
struct CurveLoopType
|
||||
{
|
||||
@ -42,7 +42,7 @@ namespace XFX
|
||||
Oscillate
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
// Specifies different tangent types to be calculated for CurveKey points in a Curve.
|
||||
struct CurveTangent
|
||||
{
|
||||
@ -53,7 +53,7 @@ namespace XFX
|
||||
Smooth
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
// Describes the intersection between a plane and a bounding volume.
|
||||
struct PlaneIntersectionType
|
||||
{
|
||||
@ -64,7 +64,7 @@ namespace XFX
|
||||
Intersecting
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
// Specifies the index of a player.
|
||||
struct PlayerIndex
|
||||
{
|
||||
|
@ -20,15 +20,15 @@ namespace XFX
|
||||
class GameServiceContainer : public IServiceProvider
|
||||
{
|
||||
private:
|
||||
Dictionary<String, Object*> _services;
|
||||
Dictionary<Type, Object*> _services;
|
||||
|
||||
public:
|
||||
GameServiceContainer();
|
||||
virtual ~GameServiceContainer() {}
|
||||
|
||||
void AddService(const String& serviceType, Object* provider);
|
||||
Object* GetService(const String& ServiceType);
|
||||
void RemoveService(const String& type);
|
||||
void AddService(const Type& serviceType, Object* provider);
|
||||
Object* GetService(const Type& ServiceType);
|
||||
void RemoveService(const Type& type);
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
/********************************************************
|
||||
* Guide.h *
|
||||
* *
|
||||
* XFX Guide definition file *
|
||||
* Copyright (c) XFX Team. All Rights Reserved *
|
||||
********************************************************/
|
||||
/*****************************************************************************
|
||||
* Guide.h *
|
||||
* *
|
||||
* XFX::GamerServices::Guide class definition file *
|
||||
* Copyright (c) XFX Team. All Rights Reserved *
|
||||
*****************************************************************************/
|
||||
#ifndef _XFX_GAMERSERVICES_GUIDE_
|
||||
#define _XFX_GAMERSERVICES_GUIDE_
|
||||
|
||||
@ -23,7 +23,9 @@ namespace XFX
|
||||
{
|
||||
namespace GamerServices
|
||||
{
|
||||
// Provides access to the Guide user interface.
|
||||
/**
|
||||
* Provides access to the Guide user interface.
|
||||
*/
|
||||
class Guide
|
||||
{
|
||||
private:
|
||||
|
@ -25,7 +25,7 @@ namespace XFX
|
||||
class AlphaTestEffect : public Effect
|
||||
{
|
||||
private:
|
||||
byte effectCode[];
|
||||
static byte effectCode[];
|
||||
|
||||
protected:
|
||||
AlphaTestEffect(AlphaTestEffect const * const cloneSource);
|
||||
@ -50,7 +50,7 @@ namespace XFX
|
||||
AlphaTestEffect(GraphicsDevice * const device);
|
||||
|
||||
Effect* Clone() const;
|
||||
int GetType() const;
|
||||
static const Type& GetType();
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ namespace XFX
|
||||
class BlendState : public GraphicsResource
|
||||
{
|
||||
private:
|
||||
static const char * const isBoundErrorString;
|
||||
static const String isBoundErrorString;
|
||||
BlendFunction_t alphaBlendFunction;
|
||||
Blend_t alphaDestinationBlend;
|
||||
Blend_t alphaSourceBlend;
|
||||
|
@ -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
|
||||
{
|
||||
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
|
||||
{
|
||||
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
|
||||
{
|
||||
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
|
||||
{
|
||||
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
|
||||
{
|
||||
enum type
|
||||
@ -394,18 +404,31 @@ namespace XFX
|
||||
};
|
||||
};
|
||||
|
||||
// Defines sprite rotation options.
|
||||
/**
|
||||
* Defines sprite rotation options.
|
||||
*/
|
||||
struct SpriteEffects
|
||||
{
|
||||
enum type
|
||||
{
|
||||
FlipHorizontally = 1, //Rotate 180 degrees about the Y axis before rendering.
|
||||
FlipVertically = 0x100, //Rotate 180 degrees about the X axis before rendering.
|
||||
None = 0 //No rotations specified.
|
||||
/**
|
||||
* Rotate 180 degrees about the Y axis before rendering.
|
||||
*/
|
||||
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
|
||||
{
|
||||
enum type
|
||||
@ -418,7 +441,9 @@ namespace XFX
|
||||
};
|
||||
};
|
||||
|
||||
// Defines stencil buffer operations.
|
||||
/**
|
||||
* Defines stencil buffer operations.
|
||||
*/
|
||||
struct StencilOperation
|
||||
{
|
||||
enum type
|
||||
@ -434,7 +459,9 @@ namespace XFX
|
||||
};
|
||||
};
|
||||
|
||||
// Defines various types of surface formats.
|
||||
/**
|
||||
* Defines various types of surface formats.
|
||||
*/
|
||||
struct SurfaceFormat
|
||||
{
|
||||
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
|
||||
{
|
||||
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
|
||||
{
|
||||
enum type
|
||||
{
|
||||
// Use linear filtering.
|
||||
/**
|
||||
* Use linear filtering.
|
||||
*/
|
||||
Linear,
|
||||
// Use point filtering.
|
||||
/**
|
||||
* Use point filtering.
|
||||
*/
|
||||
Point,
|
||||
// Use anisotropic filtering.
|
||||
/**
|
||||
* Use anisotropic filtering.
|
||||
*/
|
||||
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,
|
||||
// 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,
|
||||
// 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,
|
||||
// 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,
|
||||
// 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,
|
||||
// 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
|
||||
};
|
||||
};
|
||||
|
||||
// Defines vertex element formats.
|
||||
/**
|
||||
* Defines vertex element formats.
|
||||
*/
|
||||
struct VertexElementFormat
|
||||
{
|
||||
enum type
|
||||
@ -521,7 +572,9 @@ namespace XFX
|
||||
};
|
||||
};
|
||||
|
||||
// Defines usage for vertex elements.
|
||||
/**
|
||||
* Defines usage for vertex elements.
|
||||
*/
|
||||
struct VertexElementUsage
|
||||
{
|
||||
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.
|
||||
|
||||
typedef Blend::type Blend_t;
|
||||
typedef BlendFunction::type BlendFunction_t;
|
||||
typedef Blend::type Blend_t;
|
||||
typedef BlendFunction::type BlendFunction_t;
|
||||
typedef BufferUsage::type BufferUsage_t;
|
||||
typedef ClearOptions::type ClearOptions_t;
|
||||
typedef ColorWriteChannels::type ColorWriteChannels_t;
|
||||
typedef CompareFunction::type CompareFunction_t;
|
||||
typedef CubeMapFace::type CubeMapFace_t;
|
||||
typedef CullMode::type CullMode_t;
|
||||
typedef CullMode::type CullMode_t;
|
||||
typedef DepthFormat::type DepthFormat_t;
|
||||
typedef EffectParameterClass::type EffectParameterClass_t;
|
||||
typedef EffectParameterType::type EffectParameterType_t;
|
||||
typedef FillMode::type FillMode_t;
|
||||
typedef FillMode::type FillMode_t;
|
||||
typedef GraphicsDeviceStatus::type GraphicsDeviceStatus_t;
|
||||
typedef ImageFileFormat::type ImageFileFormat_t;
|
||||
typedef IndexElementSize::type IndexElementSize_t;
|
||||
typedef PresentInterval::type PresentInterval_t;
|
||||
typedef PrimitiveType::type PrimitiveType_t;
|
||||
typedef PrimitiveType::type PrimitiveType_t;
|
||||
typedef RenderTargetUsage::type RenderTargetUsage_t;
|
||||
typedef SetDataOptions::type SetDataOptions_t;
|
||||
typedef SpriteEffects::type SpriteEffects_t;
|
||||
typedef SpriteEffects::type SpriteEffects_t;
|
||||
typedef SpriteSortMode::type SpriteSortMode_t;
|
||||
typedef StencilOperation::type StencilOperation_t;
|
||||
typedef SurfaceFormat::type SurfaceFormat_t;
|
||||
typedef SurfaceFormat::type SurfaceFormat_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 VertexElementUsage::type VertexElementUsage_t; // Defines usage for vertex elements.
|
||||
}
|
||||
|
@ -14,6 +14,11 @@ namespace XFX
|
||||
{
|
||||
struct Matrix;
|
||||
|
||||
namespace Content
|
||||
{
|
||||
class ModelReader;
|
||||
}
|
||||
|
||||
namespace Graphics
|
||||
{
|
||||
/**
|
||||
|
@ -16,6 +16,11 @@ using namespace System::Collections::Generic;
|
||||
|
||||
namespace XFX
|
||||
{
|
||||
namespace Content
|
||||
{
|
||||
class ModelReader;
|
||||
}
|
||||
|
||||
namespace Graphics
|
||||
{
|
||||
class ModelBoneCollection;
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*****************************************************************************
|
||||
* PresentationParameters.h *
|
||||
* *
|
||||
* XFX::Graphics::PresentationParameters class definition file *
|
||||
* XFX::Graphics::PresentationParameters class definition file *
|
||||
* Copyright (c) XFX Team. All Rights Reserved *
|
||||
*****************************************************************************/
|
||||
#ifndef _XFX_GRAPHICS_PRESENTATIONPARAMETERS_
|
||||
@ -30,7 +30,7 @@ namespace XFX
|
||||
Rectangle getBounds() const;
|
||||
DepthFormat_t DepthStencilFormat;
|
||||
bool IsFullScreen;
|
||||
int MultiSampleCount;
|
||||
int MultiSampleCount;
|
||||
PresentInterval_t PresentationInterval;
|
||||
RenderTargetUsage_t RenderTargetUsage;
|
||||
|
||||
@ -40,7 +40,7 @@ namespace XFX
|
||||
bool Equals(Object const * const obj) const;
|
||||
bool Equals(const PresentationParameters other) const;
|
||||
static const Type& GetType();
|
||||
|
||||
|
||||
bool operator!=(const PresentationParameters& other) const;
|
||||
bool operator==(const PresentationParameters& other) const;
|
||||
};
|
||||
|
@ -22,7 +22,7 @@ namespace XFX
|
||||
{
|
||||
class Texture2DReader;
|
||||
}
|
||||
|
||||
|
||||
namespace Graphics
|
||||
{
|
||||
class GraphicsDevice;
|
||||
@ -40,12 +40,12 @@ namespace XFX
|
||||
SurfaceFormat_t _surfaceFormat; // The colour format of the texture
|
||||
int textureId; // The reference ID of the texture in OpenGL memory
|
||||
uint* textureData;
|
||||
|
||||
|
||||
void Load(byte buffer[]);
|
||||
|
||||
|
||||
protected:
|
||||
void Dispose(bool disposing);
|
||||
|
||||
|
||||
public:
|
||||
Rectangle getBounds() const;
|
||||
SurfaceFormat_t Format() const;
|
||||
|
@ -31,15 +31,15 @@ namespace XFX
|
||||
Vector3 Normal;
|
||||
Vector2 TextureCoordinate;
|
||||
VertexDeclaration getVertexDeclaration() const;
|
||||
|
||||
|
||||
VertexPositionNormalTexture();
|
||||
VertexPositionNormalTexture(const Vector3 position, const Vector3 normal, const Vector2 textureCoordinate);
|
||||
|
||||
|
||||
bool Equals(Object const * const obj) const;
|
||||
int GetHashCode() const;
|
||||
static const Type& GetType();
|
||||
const String ToString() const;
|
||||
|
||||
|
||||
bool operator!=(const VertexPositionNormalTexture& other) const;
|
||||
bool operator==(const VertexPositionNormalTexture& other) const;
|
||||
};
|
||||
|
@ -14,7 +14,7 @@ namespace XFX
|
||||
{
|
||||
struct Vector2;
|
||||
struct Vector3;
|
||||
|
||||
|
||||
namespace Graphics
|
||||
{
|
||||
/**
|
||||
@ -29,15 +29,15 @@ namespace XFX
|
||||
Vector3 Position;
|
||||
Vector2 TextureCoordinate;
|
||||
VertexDeclaration getVertexDeclaration() const;
|
||||
|
||||
|
||||
VertexPositionTexture();
|
||||
VertexPositionTexture(const Vector3 position, const Vector2 textureCoordinate);
|
||||
|
||||
|
||||
bool Equals(Object const * const obj) const;
|
||||
int GetHashCode() const;
|
||||
static const Type& GetType();
|
||||
const String ToString() const;
|
||||
|
||||
|
||||
bool operator!=(const VertexPositionTexture& other) const;
|
||||
bool operator==(const VertexPositionTexture& other) const;
|
||||
};
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*****************************************************************************
|
||||
* Viewport.h *
|
||||
* Viewport.h *
|
||||
* *
|
||||
* XFX::Graphics::Viewport structure definition file *
|
||||
* Copyright (c) XFX Team. All Rights Reserved *
|
||||
@ -16,7 +16,7 @@ namespace XFX
|
||||
struct Matrix;
|
||||
struct Rectangle;
|
||||
struct Vector3;
|
||||
|
||||
|
||||
namespace Graphics
|
||||
{
|
||||
/**
|
||||
@ -42,7 +42,7 @@ namespace XFX
|
||||
Viewport();
|
||||
Viewport(const int x, const int y, const int width, const int height);
|
||||
Viewport(const Rectangle bounds);
|
||||
|
||||
|
||||
bool Equals(Object const * const obj) const;
|
||||
bool Equals(const Viewport obj) const;
|
||||
int GetHashCode() const;
|
||||
|
@ -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 *
|
||||
*****************************************************************************/
|
||||
#ifndef _GRAPHICSDEVICEINFORMATION_
|
||||
#define _GRAPHICSDEVICEINFORMATION_
|
||||
#ifndef _XFX_GRAPHICSDEVICEINFORMATION_
|
||||
#define _XFX_GRAPHICSDEVICEINFORMATION_
|
||||
|
||||
#include <Graphics/Enums.h>
|
||||
#include <Graphics/PresentationParameters.h>
|
||||
@ -32,4 +32,4 @@ namespace XFX
|
||||
};
|
||||
}
|
||||
|
||||
#endif //_GRAPHICSDEVICEINFORMATION_
|
||||
#endif //_XFX_GRAPHICSDEVICEINFORMATION_
|
||||
|
@ -1,9 +1,9 @@
|
||||
/********************************************************
|
||||
* Input.h *
|
||||
* *
|
||||
* XFX::Input namespace include file *
|
||||
* Copyright (c) XFX Team. All Rights Reserved *
|
||||
********************************************************/
|
||||
/*****************************************************************************
|
||||
* Input.h *
|
||||
* *
|
||||
* XFX::Input namespace include file *
|
||||
* Copyright (c) XFX Team. All Rights Reserved *
|
||||
*****************************************************************************/
|
||||
#ifndef _XFX_INPUT_
|
||||
#define _XFX_INPUT_
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
/********************************************************
|
||||
* Enums.h *
|
||||
* *
|
||||
* XFX::Input enumeration definition file *
|
||||
* Copyright (c) XFX Team. All Rights Reserved *
|
||||
********************************************************/
|
||||
/*****************************************************************************
|
||||
* Enums.h *
|
||||
* *
|
||||
* XFX::Input enumeration definition file *
|
||||
* Copyright (c) XFX Team. All Rights Reserved *
|
||||
*****************************************************************************/
|
||||
#ifndef _XFX_INPUT_ENUMS_
|
||||
#define _XFX_INPUT_ENUMS_
|
||||
|
||||
@ -11,7 +11,9 @@ namespace XFX
|
||||
{
|
||||
namespace Input
|
||||
{
|
||||
// Enumerates input device buttons.
|
||||
/**
|
||||
* Enumerates input device buttons.
|
||||
*/
|
||||
struct Buttons
|
||||
{
|
||||
enum type
|
||||
@ -135,8 +137,8 @@ namespace XFX
|
||||
typedef ButtonState::type ButtonState_t;
|
||||
typedef GamePadDeadZone::type GamePadDeadZone_t;
|
||||
typedef GamePadType::type GamePadType_t;
|
||||
typedef Keys::type Keys_t;
|
||||
typedef KeyState::type KeyState_t;
|
||||
typedef Keys::type Keys_t;
|
||||
typedef KeyState::type KeyState_t;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
/********************************************************
|
||||
* GamePad.h *
|
||||
* *
|
||||
* XFX GamePad definition file *
|
||||
* Copyright (c) XFX Team. All Rights Reserved *
|
||||
********************************************************/
|
||||
/*****************************************************************************
|
||||
* GamePad.h *
|
||||
* *
|
||||
* XFX::Input::GamePad class definition file *
|
||||
* Copyright (c) XFX Team. All Rights Reserved *
|
||||
*****************************************************************************/
|
||||
#ifndef _XFX_INPUT_GAMEPAD_
|
||||
#define _XFX_INPUT_GAMEPAD_
|
||||
|
||||
@ -15,8 +15,10 @@ namespace XFX
|
||||
{
|
||||
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
|
||||
{
|
||||
private:
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*****************************************************************************
|
||||
* GamePadState.h *
|
||||
* GamePadState.h *
|
||||
* *
|
||||
* XFX::Input::GamePadState structure definition file *
|
||||
* Copyright (c) XFX Team. All Rights Reserved *
|
||||
@ -8,6 +8,9 @@
|
||||
#define _XFX_INPUT_GAMEPADSTATE_
|
||||
|
||||
#include "GamePadButtons.h"
|
||||
#include "GamePadDPad.h"
|
||||
#include "GamePadThumbSticks.h"
|
||||
#include "GamePadTriggers.h"
|
||||
|
||||
namespace XFX
|
||||
{
|
||||
|
@ -8,7 +8,6 @@
|
||||
#define _XFX_INPUT_GAMEPADTHUMBSTICKS_
|
||||
|
||||
#include "Enums.h"
|
||||
#include <System/Object.h>
|
||||
#include <Vector2.h>
|
||||
|
||||
using namespace System;
|
||||
|
@ -1,9 +1,9 @@
|
||||
/********************************************************
|
||||
* Keyboard.h *
|
||||
* *
|
||||
* XFX Keyboard definition file *
|
||||
* Copyright (c) XFX Team. All Rights Reserved *
|
||||
********************************************************/
|
||||
/*****************************************************************************
|
||||
* Keyboard.h *
|
||||
* *
|
||||
* XFX::Input::Keyboard class definition file *
|
||||
* Copyright (c) XFX Team. All Rights Reserved *
|
||||
*****************************************************************************/
|
||||
#ifndef _XFX_INPUT_KEYBOARD_
|
||||
#define _XFX_INPUT_KEYBOARD_
|
||||
|
||||
@ -13,7 +13,9 @@ namespace XFX
|
||||
{
|
||||
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
|
||||
{
|
||||
KeyboardState();
|
||||
@ -36,7 +38,9 @@ namespace XFX
|
||||
Keys_t* pressedKeys;
|
||||
};
|
||||
|
||||
// Allows retrieval of keystrokes from a keyboard input device.
|
||||
/**
|
||||
* Allows retrieval of keystrokes from a keyboard input device.
|
||||
*/
|
||||
class Keyboard
|
||||
{
|
||||
private:
|
||||
|
@ -1,9 +1,9 @@
|
||||
/********************************************************
|
||||
* Mouse.h *
|
||||
* *
|
||||
* XFX Mouse definition file *
|
||||
* Copyright (c) XFX Team. All Rights Reserved *
|
||||
********************************************************/
|
||||
/*****************************************************************************
|
||||
* Mouse.h *
|
||||
* *
|
||||
* XFX::Input::Mouse class definition file *
|
||||
* Copyright (c) XFX Team. All Rights Reserved *
|
||||
*****************************************************************************/
|
||||
#ifndef _XFX_INPUT_MOUSE_
|
||||
#define _XFX_INPUT_MOUSE_
|
||||
|
||||
@ -16,7 +16,9 @@ namespace XFX
|
||||
{
|
||||
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
|
||||
{
|
||||
ButtonState_t LeftButton;
|
||||
@ -26,12 +28,14 @@ namespace XFX
|
||||
ButtonState_t XButton1;
|
||||
ButtonState_t XButton2;
|
||||
int Y;
|
||||
|
||||
|
||||
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
|
||||
{
|
||||
private:
|
||||
|
@ -1,15 +1,17 @@
|
||||
/********************************************************
|
||||
* MathHelper.h *
|
||||
* *
|
||||
* XFX MathHelper definition file *
|
||||
* Copyright (c) XFX Team. All Rights Reserved *
|
||||
********************************************************/
|
||||
/*****************************************************************************
|
||||
* MathHelper.h *
|
||||
* *
|
||||
* XFX::MathHelper class definition file *
|
||||
* Copyright (c) XFX Team. All Rights Reserved *
|
||||
*****************************************************************************/
|
||||
#ifndef _XFX_MATHHELPER_
|
||||
#define _XFX_MATHHELPER_
|
||||
|
||||
namespace XFX
|
||||
{
|
||||
// Contains commonly used precalculated values.
|
||||
/**
|
||||
* Contains commonly used precalculated values.
|
||||
*/
|
||||
class MathHelper
|
||||
{
|
||||
private:
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*****************************************************************************
|
||||
* Video.h *
|
||||
* Video.h *
|
||||
* *
|
||||
* XFX::Media::Video class definition file *
|
||||
* Copyright (c) XFX Team. All Rights Reserved *
|
||||
@ -7,10 +7,11 @@
|
||||
#ifndef _XFX_MEDIA_VIDEO_H_
|
||||
#define _XFX_MEDIA_VIDEO_H_
|
||||
|
||||
#include <System/Types.h>
|
||||
#include <System/Object.h>
|
||||
#include <System/TimeSpan.h>
|
||||
#include "Enums.h"
|
||||
|
||||
using namespace System;
|
||||
|
||||
namespace XFX
|
||||
{
|
||||
namespace Media
|
||||
|
@ -8,8 +8,8 @@
|
||||
#define _XFX_MEDIA_VIDEOPLAYER_
|
||||
|
||||
#include "Enums.h"
|
||||
#include <Graphics/Texture2D.h>
|
||||
#include <System/TimeSpan.h>
|
||||
#include "../Graphics/Texture2D.h"
|
||||
|
||||
using namespace System;
|
||||
using namespace XFX::Graphics;
|
||||
@ -20,11 +20,15 @@ namespace XFX
|
||||
{
|
||||
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
|
||||
{
|
||||
private:
|
||||
bool isDisposed;
|
||||
Video* playingVideo;
|
||||
|
||||
void Dispose(bool disposing);
|
||||
|
||||
protected:
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*****************************************************************************
|
||||
* Plane.h *
|
||||
* Plane.h *
|
||||
* *
|
||||
* XFX Plane definition file *
|
||||
* XFX::Plane structure definition file *
|
||||
* Copyright (c) XFX Team. All Rights Reserved *
|
||||
*****************************************************************************/
|
||||
#ifndef _XFX_PLANE_
|
||||
@ -21,7 +21,9 @@ namespace XFX
|
||||
struct Quaternion;
|
||||
struct Vector4;
|
||||
|
||||
// Defines a plane.
|
||||
/**
|
||||
* Defines a plane.
|
||||
*/
|
||||
struct Plane : IEquatable<Plane>, Object
|
||||
{
|
||||
float D;
|
||||
@ -42,8 +44,8 @@ namespace XFX
|
||||
void DotNormal(const Vector3 value, out float& result) const;
|
||||
bool Equals(Object const * const obj) const;
|
||||
bool Equals(const Plane obj) const;
|
||||
int GetHashCode() const;
|
||||
int GetType() const;
|
||||
int GetHashCode() const;
|
||||
static const Type& GetType();
|
||||
PlaneIntersectionType_t Intersects(const BoundingBox boundingbox) const;
|
||||
void Intersects(const BoundingBox boundingbox, out PlaneIntersectionType_t& result) const;
|
||||
PlaneIntersectionType_t Intersects(const BoundingSphere sphere) const;
|
||||
|
@ -1,9 +1,9 @@
|
||||
/********************************************************
|
||||
* Storage.h *
|
||||
* *
|
||||
* XFX::Storage namespace include file *
|
||||
* Copyright (c) XFX Team. All Rights Reserved *
|
||||
********************************************************/
|
||||
/*****************************************************************************
|
||||
* Storage.h *
|
||||
* *
|
||||
* XFX::Storage namespace include file *
|
||||
* Copyright (c) XFX Team. All Rights Reserved *
|
||||
*****************************************************************************/
|
||||
#ifndef _XFX_STORAGE_
|
||||
#define _XFX_STORAGE_
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
/********************************************************
|
||||
* StorageContainer.h *
|
||||
* *
|
||||
* XFX StorageContainer definition file *
|
||||
* Copyright (c) XFX Team. All Rights Reserved *
|
||||
********************************************************/
|
||||
/*****************************************************************************
|
||||
* StorageContainer.h *
|
||||
* *
|
||||
* XFX::Storage::StorageContainer class definition file *
|
||||
* Copyright (c) XFX Team. All Rights Reserved *
|
||||
*****************************************************************************/
|
||||
#ifndef _XFX_STORAGE_STORAGECONTAINER_
|
||||
#define _XFX_STORAGE_STORAGECONTAINER_
|
||||
|
||||
@ -20,18 +20,20 @@ namespace XFX
|
||||
namespace Storage
|
||||
{
|
||||
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;
|
||||
|
||||
private:
|
||||
bool isDisposed;
|
||||
DirectoryInfo containerFolder;
|
||||
StorageDevice* device;
|
||||
PlayerIndex_t playerIndex;
|
||||
char* titleName;
|
||||
StorageDevice* device;
|
||||
PlayerIndex_t playerIndex;
|
||||
String titleName;
|
||||
|
||||
void Dispose(bool disposing);
|
||||
virtual ~StorageContainer();
|
||||
@ -39,12 +41,12 @@ namespace XFX
|
||||
public:
|
||||
EventHandler Disposing;
|
||||
|
||||
bool IsDisposed();
|
||||
const char* Path() const;
|
||||
bool IsDisposed() const;
|
||||
const String Path() const;
|
||||
StorageDevice* getStorageDevice() const;
|
||||
static const char* TitleLocation();
|
||||
const char* TitleName() const;
|
||||
|
||||
static const String TitleLocation();
|
||||
const String TitleName() const;
|
||||
|
||||
void Delete();
|
||||
void Dispose();
|
||||
};
|
||||
|
@ -15,13 +15,15 @@ namespace XFX
|
||||
{
|
||||
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
|
||||
{
|
||||
public:
|
||||
StorageDeviceNotConnectedException();
|
||||
StorageDeviceNotConnectedException(char* message);
|
||||
StorageDeviceNotConnectedException(char* message, Exception* innerException);
|
||||
StorageDeviceNotConnectedException(const String& message);
|
||||
StorageDeviceNotConnectedException(const String& message, Exception * const innerException);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -19,6 +19,9 @@ using namespace System::Collections::Generic;
|
||||
|
||||
namespace System
|
||||
{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
template <typename T>
|
||||
class Array : public ICollection<T>, public IEnumerable<T>
|
||||
{
|
||||
|
@ -1,9 +1,9 @@
|
||||
/********************************************************
|
||||
* Interfaces.h *
|
||||
* *
|
||||
* XFX Generic Interfaces definition file *
|
||||
* Copyright (c) XFX Team. All Rights Reserved *
|
||||
********************************************************/
|
||||
/*****************************************************************************
|
||||
* Interfaces.h *
|
||||
* *
|
||||
* XFX Generic Interfaces definition file *
|
||||
* Copyright (c) XFX Team. All Rights Reserved *
|
||||
*****************************************************************************/
|
||||
#ifndef _SYSTEM_COLLECTIONS_GENERIC_INTERFACES_
|
||||
#define _SYSTEM_COLLECTIONS_GENERIC_INTERFACES_
|
||||
|
||||
@ -16,7 +16,9 @@ namespace System
|
||||
{
|
||||
namespace Generic
|
||||
{
|
||||
// Defines methods to manipulate generic collections.
|
||||
/**
|
||||
* Defines methods to manipulate generic collections.
|
||||
*/
|
||||
template <class T>
|
||||
interface ICollection
|
||||
{
|
||||
@ -33,7 +35,9 @@ namespace System
|
||||
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>
|
||||
interface IComparer
|
||||
{
|
||||
@ -43,7 +47,9 @@ namespace System
|
||||
virtual ~IComparer() { }
|
||||
};
|
||||
|
||||
// Represents a generic collection of key/value pairs.
|
||||
/**
|
||||
* Represents a generic collection of key/value pairs.
|
||||
*/
|
||||
template <class TKey, class TValue>
|
||||
interface IDictionary
|
||||
{
|
||||
@ -59,7 +65,9 @@ namespace System
|
||||
virtual ~IDictionary() { }
|
||||
};
|
||||
|
||||
// Supports a simple iteration over a generic collection.
|
||||
/**
|
||||
* Supports a simple iteration over a generic collection.
|
||||
*/
|
||||
template <class T>
|
||||
interface IEnumerator
|
||||
{
|
||||
@ -71,7 +79,9 @@ namespace System
|
||||
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>
|
||||
interface IEnumerable
|
||||
{
|
||||
@ -81,7 +91,9 @@ namespace System
|
||||
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>
|
||||
interface IEqualityComparer
|
||||
{
|
||||
@ -92,7 +104,9 @@ namespace System
|
||||
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>
|
||||
interface IList : public ICollection<T>
|
||||
{
|
||||
|
@ -179,7 +179,7 @@ namespace System
|
||||
{
|
||||
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()
|
||||
@ -320,7 +320,7 @@ namespace System
|
||||
{
|
||||
sassert(comparer != null, String::Format("comparer; %s", FrameworkResources::ArgumentNull_Generic));
|
||||
|
||||
Sort(0, _actualSize, comparer);
|
||||
Sort(0, _size, comparer);
|
||||
}
|
||||
|
||||
T* ToArray() const
|
||||
@ -353,6 +353,11 @@ namespace System
|
||||
|
||||
const List<T>& operator =(const List<T>& other)
|
||||
{
|
||||
if (other == *this)
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
|
||||
delete[] _items;
|
||||
_actualSize = other._actualSize;
|
||||
_size = other._size;
|
||||
|
@ -1,24 +1,27 @@
|
||||
/********************************************************
|
||||
* StreamAsyncResult.h *
|
||||
* *
|
||||
* XFX StreamAsyncResult definition file *
|
||||
* Copyright (c) XFX Team. All Rights Reserved *
|
||||
********************************************************/
|
||||
/*****************************************************************************
|
||||
* StreamAsyncResult.h *
|
||||
* *
|
||||
* System::IO::StreamAsyncResult class definition file *
|
||||
* Copyright (c) XFX Team. All Rights Reserved *
|
||||
*****************************************************************************/
|
||||
#ifndef _SYSTEM_IO_STREAMASYNCRESULT_
|
||||
#define _SYSTEM_IO_STREAMASYNCRESULT_
|
||||
|
||||
#include "../Interfaces.h"
|
||||
#include "../Object.h"
|
||||
#include "../Types.h"
|
||||
#include "../Threading/WaitHandle.h"
|
||||
#include <System/Interfaces.h>
|
||||
#include <System/Object.h>
|
||||
#include <System/Types.h>
|
||||
#include <System/Threading/WaitHandle.h>
|
||||
|
||||
namespace System
|
||||
{
|
||||
namespace IO
|
||||
{
|
||||
//
|
||||
class StreamAsyncResult : public IAsyncResult, public virtual Object
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class StreamAsyncResult : public IAsyncResult, public Object
|
||||
{
|
||||
private:
|
||||
Object* _state;
|
||||
bool completed;
|
||||
bool done;
|
||||
@ -34,8 +37,26 @@ namespace System
|
||||
int NBytes();
|
||||
bool Done;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param state
|
||||
*
|
||||
*/
|
||||
StreamAsyncResult(Object* state);
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param obj
|
||||
*
|
||||
*/
|
||||
StreamAsyncResult(const IAsyncResult &obj);
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param obj
|
||||
*
|
||||
*/
|
||||
StreamAsyncResult(const StreamAsyncResult &obj);
|
||||
|
||||
//void SetComplete(Exception* e);
|
||||
|
@ -81,7 +81,7 @@ namespace System
|
||||
interface IServiceProvider
|
||||
{
|
||||
public:
|
||||
virtual Object* GetService(const String& serviceType)=0;
|
||||
virtual Object* GetService(const Type& serviceType)=0;
|
||||
|
||||
virtual ~IServiceProvider() { }
|
||||
};
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*****************************************************************************
|
||||
* Vector2.h *
|
||||
* *
|
||||
* XFX Vector2 definition file *
|
||||
* XFX Vector2 definition file *
|
||||
* Copyright (c) XFX Team. All Rights Reserved *
|
||||
*****************************************************************************/
|
||||
#ifndef _XFX_VECTOR2_
|
||||
@ -29,62 +29,62 @@ namespace XFX
|
||||
Vector2();
|
||||
|
||||
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 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 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 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 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 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 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 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 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(const Vector2 other) const;
|
||||
int GetHashCode() const;
|
||||
static int GetType();
|
||||
int GetHashCode() const;
|
||||
static const Type& GetType();
|
||||
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 LengthSquared() const;
|
||||
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 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 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);
|
||||
void Multiply(const Vector2& value1, const float scaleFactor, out Vector2& result);
|
||||
static Vector2 Multiply(const Vector2 value1, const Vector2 value2);
|
||||
void Multiply(const Vector2& value1, const Vector2& value2, out Vector2& result);
|
||||
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();
|
||||
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 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 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 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;
|
||||
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 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 Quaternion& rotation, Vector2 destinationArray[], const int destinationIndex, const int length);
|
||||
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 Quaternion& rotation, Vector2 destinationArray[], const int destinationIndex, const int length);
|
||||
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 sourceArray[], const int sourceIndex, const Matrix& matrix, Vector2 destinationArray[], const int destinationIndex, const int length);
|
||||
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);
|
||||
|
||||
Vector2 operator -(const Vector2& other) const;
|
||||
Vector2 operator -() const;
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*****************************************************************************
|
||||
* Vector3.h *
|
||||
* *
|
||||
* XFX::Vector3 definition file *
|
||||
* XFX::Vector3 structure definition file *
|
||||
* Copyright (c) XFX Team. All Rights Reserved *
|
||||
*****************************************************************************/
|
||||
#ifndef _XFX_VECTOR3_
|
||||
@ -41,74 +41,74 @@ namespace XFX
|
||||
Vector3(const Vector3 &obj);
|
||||
Vector3();
|
||||
|
||||
static Vector3 Add(const Vector3 value1, const Vector3 value2);
|
||||
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 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 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 void Clamp(const Vector3 value1, const Vector3 min, const Vector3 max, out Vector3& result);
|
||||
static Vector3 Cross(const Vector3 vector1, const Vector3 vector2);
|
||||
static void Cross(const Vector3 vector1, const Vector3 vector2, out Vector3& result);
|
||||
static float Distance(const Vector3 value1, const Vector3 value2);
|
||||
static void Distance(const Vector3 value1, const Vector3 value2, out float& result);
|
||||
static float DistanceSquared(const Vector3 value1, const Vector3 value2);
|
||||
static void DistanceSquared(const Vector3 value1, const Vector3 value2, out float& result);
|
||||
static Vector3 Divide(const Vector3 value1, const float value2);
|
||||
static void Divide(const Vector3 value1, const float value2, out Vector3& result);
|
||||
static Vector3 Add(const Vector3 value1, const Vector3 value2);
|
||||
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 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 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 void Clamp(const Vector3 value1, const Vector3 min, const Vector3 max, out Vector3& result);
|
||||
static Vector3 Cross(const Vector3 vector1, const Vector3 vector2);
|
||||
static void Cross(const Vector3 vector1, const Vector3 vector2, out Vector3& result);
|
||||
static float Distance(const Vector3 value1, const Vector3 value2);
|
||||
static void Distance(const Vector3 value1, const Vector3 value2, out float& result);
|
||||
static float DistanceSquared(const Vector3 value1, const Vector3 value2);
|
||||
static void DistanceSquared(const Vector3 value1, const Vector3 value2, out float& result);
|
||||
static Vector3 Divide(const Vector3 value1, const float value2);
|
||||
static void Divide(const Vector3 value1, const float value2, out Vector3& result);
|
||||
static Vector3 Divide(const Vector3 value1, const Vector3 value2);
|
||||
static void Divide(const Vector3 value1, const Vector3 value2, out Vector3& result);
|
||||
static float Dot(const Vector3 value1, const Vector3 value2);
|
||||
static void Dot(const Vector3 value1, const Vector3 value2, out float& result);
|
||||
bool Equals(Object const * const obj) const;
|
||||
bool Equals(const Vector3 other) const;
|
||||
int GetHashCode() const;
|
||||
static void Divide(const Vector3 value1, const Vector3 value2, out Vector3& result);
|
||||
static float Dot(const Vector3 value1, const Vector3 value2);
|
||||
static void Dot(const Vector3 value1, const Vector3 value2, out float& result);
|
||||
bool Equals(Object const * const obj) const;
|
||||
bool Equals(const Vector3 other) const;
|
||||
int GetHashCode() const;
|
||||
static const Type& GetType();
|
||||
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);
|
||||
float Length() const;
|
||||
float LengthSquared() const;
|
||||
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 Vector3 Max(const Vector3 value1, const Vector3 value2);
|
||||
static void Max(const Vector3 value1, const Vector3 value2, out Vector3& result);
|
||||
static Vector3 Min(const Vector3 value1, const Vector3 value2);
|
||||
static void Min(const Vector3 value1, const Vector3 value2, out Vector3& result);
|
||||
static Vector3 Multiply(const Vector3 value1, const float scaleFactor);
|
||||
static void Multiply(const Vector3 value1, const float scaleFactor, out Vector3& result);
|
||||
static Vector3 Multiply(const Vector3 value1, const Vector3 value2);
|
||||
static void Multiply(const Vector3 value1, const Vector3 value2, out Vector3& result);
|
||||
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);
|
||||
float Length() const;
|
||||
float LengthSquared() const;
|
||||
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 Vector3 Max(const Vector3 value1, const Vector3 value2);
|
||||
static void Max(const Vector3 value1, const Vector3 value2, out Vector3& result);
|
||||
static Vector3 Min(const Vector3 value1, const Vector3 value2);
|
||||
static void Min(const Vector3 value1, const Vector3 value2, out Vector3& result);
|
||||
static Vector3 Multiply(const Vector3 value1, const float scaleFactor);
|
||||
static void Multiply(const Vector3 value1, const float scaleFactor, out Vector3& result);
|
||||
static Vector3 Multiply(const Vector3 value1, const Vector3 value2);
|
||||
static void Multiply(const Vector3 value1, const Vector3 value2, out Vector3& result);
|
||||
static Vector3 Negate(const Vector3 value);
|
||||
static void Negate(const Vector3 value, out Vector3& result);
|
||||
void Normalize();
|
||||
static Vector3 Normalize(const Vector3 value);
|
||||
static void Normalize(const Vector3 value, out Vector3& result);
|
||||
static Vector3 Reflect(const Vector3 vector, const Vector3 normal);
|
||||
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 void SmoothStep(const Vector3 value1, const Vector3 value2, const float amount, out Vector3& result);
|
||||
static Vector3 Subtract(const Vector3 value1, const Vector3 value2);
|
||||
static void Subtract(const Vector3 value1, const Vector3 value2, out Vector3& result);
|
||||
const String ToString() const;
|
||||
static Vector3 Transform(const Vector3 position, const Matrix matrix);
|
||||
static void Transform(const Vector3 position, const Matrix matrix, out Vector3& result);
|
||||
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 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 Matrix matrix, 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 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 Matrix matrix, Vector3 destinationArray[]) NONNULL(1, 3);
|
||||
static void Negate(const Vector3 value, out Vector3& result);
|
||||
void Normalize();
|
||||
static Vector3 Normalize(const Vector3 value);
|
||||
static void Normalize(const Vector3 value, out Vector3& result);
|
||||
static Vector3 Reflect(const Vector3 vector, const Vector3 normal);
|
||||
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 void SmoothStep(const Vector3 value1, const Vector3 value2, const float amount, out Vector3& result);
|
||||
static Vector3 Subtract(const Vector3 value1, const Vector3 value2);
|
||||
static void Subtract(const Vector3 value1, const Vector3 value2, out Vector3& result);
|
||||
const String ToString() const;
|
||||
static Vector3 Transform(const Vector3 position, const Matrix matrix);
|
||||
static void Transform(const Vector3 position, const Matrix matrix, out Vector3& result);
|
||||
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 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 Matrix matrix, 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 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 Matrix matrix, Vector3 destinationArray[]) NONNULL(1, 3);
|
||||
|
||||
Vector3 operator+(const Vector3& other);
|
||||
Vector3 operator/(const float divider);
|
||||
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 Vector3& other);
|
||||
Vector3 operator-(const Vector3& other);
|
||||
|
@ -29,6 +29,8 @@
|
||||
|
||||
namespace XFX
|
||||
{
|
||||
const Type GameComponentTypeInfo("GameComponent", "XFX::GameComponent", TypeCode::Object);
|
||||
|
||||
bool GameComponent::getEnabled() const
|
||||
{
|
||||
return _enabled;
|
||||
@ -70,10 +72,10 @@ namespace XFX
|
||||
void GameComponent::Dispose(bool disposing)
|
||||
{
|
||||
if (!_disposed)
|
||||
{
|
||||
_disposed = true;
|
||||
Disposed(this, const_cast<EventArgs*>(EventArgs::Empty));
|
||||
}
|
||||
{
|
||||
_disposed = true;
|
||||
Disposed(this, const_cast<EventArgs*>(EventArgs::Empty));
|
||||
}
|
||||
}
|
||||
|
||||
GameComponent::GameComponent(Game * const game)
|
||||
@ -86,6 +88,11 @@ namespace XFX
|
||||
{
|
||||
Dispose(false);
|
||||
}
|
||||
|
||||
const Type& GameComponent::GetType()
|
||||
{
|
||||
return GameComponentTypeInfo;
|
||||
}
|
||||
|
||||
void GameComponent::Initialize()
|
||||
{
|
||||
|
@ -27,11 +27,18 @@
|
||||
|
||||
#include <Graphics/AlphaTestEffect.h>
|
||||
#include <Graphics/Texture2D.h>
|
||||
#include <System/Type.h>
|
||||
|
||||
namespace XFX
|
||||
{
|
||||
namespace Graphics
|
||||
{
|
||||
const Type AlphaTestEffectTypeInfo("AlphaTestEffect", "XFX::Graphics::AlphaTestEffect", TypeCode::Object);
|
||||
|
||||
byte AlphaTestEffect::effectCode[] =
|
||||
{
|
||||
};
|
||||
|
||||
AlphaTestEffect::AlphaTestEffect(AlphaTestEffect const * const cloneSource)
|
||||
: Effect(cloneSource),
|
||||
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)
|
||||
: Effect(device, effectCode)
|
||||
void AlphaTestEffect::OnApply()
|
||||
{
|
||||
}
|
||||
|
||||
@ -57,8 +64,9 @@ namespace XFX
|
||||
return new AlphaTestEffect(this);
|
||||
}
|
||||
|
||||
int AlphaTestEffect::GetType() const
|
||||
const Type& AlphaTestEffect::GetType()
|
||||
{
|
||||
return AlphaTestEffectTypeInfo;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -29,11 +29,14 @@
|
||||
#include <Vector3.h>
|
||||
#include <Graphics/BasicEffect.h>
|
||||
#include <Graphics/DirectionalLight.h>
|
||||
#include <System/Type.h>
|
||||
|
||||
namespace XFX
|
||||
{
|
||||
namespace Graphics
|
||||
{
|
||||
const Type BasicEffectTypeInfo("BasicEffect", "XFX::Graphics::BasicEffect", TypeCode::Object);
|
||||
|
||||
DirectionalLight* BasicEffect::getDirectionalLight0() const
|
||||
{
|
||||
}
|
||||
@ -82,9 +85,9 @@ namespace XFX
|
||||
LightingEnabled = true;
|
||||
}
|
||||
|
||||
int BasicEffect::GetType()
|
||||
const Type& BasicEffect::GetType()
|
||||
{
|
||||
// TODO: implement
|
||||
return BasicEffectTypeInfo;
|
||||
}
|
||||
|
||||
void BasicEffect::OnApply()
|
||||
|
@ -26,6 +26,7 @@
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#include <Graphics/BlendState.h>
|
||||
#include <System/Type.h>
|
||||
|
||||
#include <sassert.h>
|
||||
|
||||
@ -33,7 +34,8 @@ namespace XFX
|
||||
{
|
||||
namespace Graphics
|
||||
{
|
||||
const char * const BlendState::isBoundErrorString = "";
|
||||
const String BlendState::isBoundErrorString = "";
|
||||
const Type BlendStateTypeInfo("BlendState", "XFX::Graphics::BlendState", TypeCode::Object);
|
||||
|
||||
BlendState::BlendState()
|
||||
{
|
||||
@ -74,9 +76,9 @@ namespace XFX
|
||||
{
|
||||
}
|
||||
|
||||
int BlendState::GetType()
|
||||
const Type& BlendState::GetType()
|
||||
{
|
||||
// TODO: implement
|
||||
return BlendStateTypeInfo;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -86,7 +86,7 @@ namespace XFX
|
||||
}
|
||||
// Dispose any unmanaged resources
|
||||
disposed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ContentManager::Dispose()
|
||||
@ -94,17 +94,24 @@ namespace XFX
|
||||
Dispose(true);
|
||||
}
|
||||
|
||||
int ContentManager::GetType()
|
||||
const Type& ContentManager::GetType()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
template <class T>
|
||||
T ContentManager::Load(const String& assetName)
|
||||
{
|
||||
{
|
||||
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++
|
||||
object obj2;
|
||||
object obj2;
|
||||
if (this.loadedAssets == null)
|
||||
{
|
||||
throw new ObjectDisposedException(this.ToString());
|
||||
@ -135,8 +142,8 @@ namespace XFX
|
||||
|
||||
return (T)obj2;
|
||||
}*/
|
||||
T local = this->ReadAsset<T>(assetName);
|
||||
//this->loadedAssets.Add(assetName, local);
|
||||
T local = ReadAsset<T>(assetName);
|
||||
loadedAssets.Add(assetName, local);
|
||||
return local;
|
||||
}
|
||||
|
||||
|
@ -36,9 +36,9 @@ namespace XFX
|
||||
{
|
||||
namespace Content
|
||||
{
|
||||
const short ContentReader::XnbVersion = 2;
|
||||
const short ContentReader::XnbVersion = 5;
|
||||
|
||||
String ContentReader::getAssetName() const
|
||||
const String ContentReader::getAssetName() const
|
||||
{
|
||||
return _assetName;
|
||||
}
|
||||
|
@ -26,11 +26,14 @@
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#include <Graphics/Effect.h>
|
||||
#include <System/Type.h>
|
||||
|
||||
namespace XFX
|
||||
{
|
||||
namespace Graphics
|
||||
{
|
||||
const Type EffectTypeInfo("Effect", "XFX::Graphics::Effect", TypeCode::Object);
|
||||
|
||||
Effect::Effect(Effect const * const cloneSource)
|
||||
: _parameters(cloneSource->_parameters),
|
||||
_techniques(cloneSource->_techniques),
|
||||
@ -50,8 +53,9 @@ namespace XFX
|
||||
return new Effect(this);
|
||||
}
|
||||
|
||||
int Effect::GetType()
|
||||
const Type& Effect::GetType()
|
||||
{
|
||||
return EffectTypeInfo;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -46,37 +46,37 @@ namespace XFX
|
||||
//TODO: Come up with a device description
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
int GraphicsAdapter::DeviceId()
|
||||
{
|
||||
return 0x2a0;
|
||||
}
|
||||
|
||||
|
||||
const char* GraphicsAdapter::DeviceName()
|
||||
{
|
||||
return "NV2A";
|
||||
}
|
||||
|
||||
|
||||
const char* GraphicsAdapter::DriverDLL()
|
||||
{
|
||||
return "pbKit";
|
||||
}
|
||||
|
||||
|
||||
float GraphicsAdapter::DriverVersion()
|
||||
{
|
||||
return 1.0;
|
||||
}
|
||||
|
||||
|
||||
bool GraphicsAdapter::IsDefaultAdapter()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
int GraphicsAdapter::VendorId()
|
||||
{
|
||||
return 0x10DE;
|
||||
}
|
||||
|
||||
|
||||
bool GraphicsAdapter::IsWideScreen()
|
||||
{
|
||||
//TODO: Get WideScreen setting from EEPROM
|
||||
@ -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::QueryRenderTargetFormat(SurfaceFormat_t format, DepthFormat_t depthFormat, int multiSampleCount, out SurfaceFormat_t selectedFormat, out DepthFormat_t selectedDepthFormat, out int selectedMultiSampleCount) const
|
||||
|
@ -26,11 +26,14 @@
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#include <Graphics/GraphicsResource.h>
|
||||
#include <System/Type.h>
|
||||
|
||||
namespace XFX
|
||||
{
|
||||
namespace Graphics
|
||||
{
|
||||
const Type GraphicsResourceTypeInfo("GraphicsResource", "XFX::Graphics::GraphicsResource", TypeCode::Object);
|
||||
|
||||
GraphicsDevice* GraphicsResource::getGraphicsDevice()
|
||||
{
|
||||
return graphicsDevice;
|
||||
@ -58,17 +61,17 @@ namespace XFX
|
||||
|
||||
void GraphicsResource::Dispose(bool disposing)
|
||||
{
|
||||
if(isDisposed)
|
||||
return;
|
||||
|
||||
isDisposed = true;
|
||||
if(isDisposed)
|
||||
return;
|
||||
|
||||
isDisposed = true;
|
||||
|
||||
Disposing(this, const_cast<EventArgs*>(EventArgs::Empty));
|
||||
}
|
||||
|
||||
int GraphicsResource::GetType()
|
||||
const Type& GraphicsResource::GetType()
|
||||
{
|
||||
// TODO: implement
|
||||
return GraphicsResourceTypeInfo;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -65,7 +65,41 @@ namespace XFX
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -18,6 +18,9 @@ namespace XFX
|
||||
{
|
||||
class ModelReader : public ContentTypeReader<Model>
|
||||
{
|
||||
private:
|
||||
void ReadBoneReference(ContentReader * const input, uint boneCount);
|
||||
|
||||
public:
|
||||
Model* Read(ContentReader * const input, Model* existingInstance);
|
||||
};
|
||||
|
@ -34,80 +34,83 @@
|
||||
#include <Vector4.h>
|
||||
#include <System/Math.h>
|
||||
#include <System/String.h>
|
||||
#include <System/Type.h>
|
||||
|
||||
using namespace System;
|
||||
|
||||
namespace XFX
|
||||
{
|
||||
const Type PlaneTypeInfo("Plane", "XFX::Plane", TypeCode::Object);
|
||||
|
||||
Plane::Plane(const float a, const float b, const float c, const float d)
|
||||
: D(d), Normal(a, b, c)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
Plane::Plane(const Vector3 normal, const float d)
|
||||
: D(d), Normal(normal)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
Plane::Plane(const Vector3 point1, const Vector3 point2, const Vector3 point3)
|
||||
{
|
||||
float x1 = point2.X - point1.X;
|
||||
float y1 = point2.Y - point1.Y;
|
||||
float z1 = point2.Z - point1.Z;
|
||||
float x2 = point3.X - point1.X;
|
||||
float y2 = point3.Y - point1.Y;
|
||||
float z2 = point3.Z - point1.Z;
|
||||
float yz = (y1 * z2) - (z1 * y2);
|
||||
float xz = (z1 * x2) - (x1 * z2);
|
||||
float xy = (x1 * y2) - (y1 * x2);
|
||||
float invPyth = 1.0f / Math::Sqrt((yz * yz) + (xz * xz) + (xy * xy));
|
||||
|
||||
Normal.X = yz * invPyth;
|
||||
Normal.Y = xz * invPyth;
|
||||
Normal.Z = xy * invPyth;
|
||||
D = -((Normal.X * point1.X) + (Normal.Y * point1.Y) + (Normal.Z * point1.Z));
|
||||
float x1 = point2.X - point1.X;
|
||||
float y1 = point2.Y - point1.Y;
|
||||
float z1 = point2.Z - point1.Z;
|
||||
float x2 = point3.X - point1.X;
|
||||
float y2 = point3.Y - point1.Y;
|
||||
float z2 = point3.Z - point1.Z;
|
||||
float yz = (y1 * z2) - (z1 * y2);
|
||||
float xz = (z1 * x2) - (x1 * z2);
|
||||
float xy = (x1 * y2) - (y1 * x2);
|
||||
float invPyth = 1.0f / Math::Sqrt((yz * yz) + (xz * xz) + (xy * xy));
|
||||
|
||||
Normal.X = yz * invPyth;
|
||||
Normal.Y = xz * invPyth;
|
||||
Normal.Z = xy * invPyth;
|
||||
D = -((Normal.X * point1.X) + (Normal.Y * point1.Y) + (Normal.Z * point1.Z));
|
||||
}
|
||||
|
||||
|
||||
Plane::Plane(const Vector4 value)
|
||||
: D(value.W), Normal(value.X, value.Y, value.Z)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
Plane::Plane(const Plane &obj)
|
||||
: D(obj.D), Normal(obj.Normal)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
Plane::Plane()
|
||||
: D(0), Normal(Vector3::Zero)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
float Plane::Dot(const Vector4 value) const
|
||||
{
|
||||
return (Normal.X * value.X) + (Normal.Y * value.Y) + (Normal.Z * value.Z) + (D * value.W);
|
||||
}
|
||||
|
||||
|
||||
void Plane::Dot(const Vector4 value, out float& result) const
|
||||
{
|
||||
result = (Normal.X * value.X) + (Normal.Y * value.Y) + (Normal.Z * value.Z) + (D * value.W);
|
||||
}
|
||||
|
||||
|
||||
float Plane::DotCoordinate(const Vector3 value) const
|
||||
{
|
||||
return (Normal.X * value.X) + (Normal.Y * value.Y) + (Normal.Z * value.Z) + D;
|
||||
}
|
||||
|
||||
|
||||
void Plane::DotCoordinate(const Vector3 value, out float& result) const
|
||||
{
|
||||
result = (Normal.X * value.X) + (Normal.Y * value.Y) + (Normal.Z * value.Z) + D;
|
||||
}
|
||||
|
||||
|
||||
float Plane::DotNormal(const Vector3 value) const
|
||||
{
|
||||
return (Normal.X * value.X) + (Normal.Y * value.Y) + (Normal.Z * value.Z);
|
||||
}
|
||||
|
||||
|
||||
void Plane::DotNormal(const Vector3 value, out float& result) const
|
||||
{
|
||||
result = (Normal.X * value.X) + (Normal.Y * value.Y) + (Normal.Z * value.Z);
|
||||
@ -117,158 +120,158 @@ namespace XFX
|
||||
{
|
||||
return is(this, obj) ? *this == *(Plane *)obj : false;
|
||||
}
|
||||
|
||||
|
||||
bool Plane::Equals(const Plane obj) const
|
||||
{
|
||||
return (*this == obj);
|
||||
}
|
||||
|
||||
|
||||
int Plane::GetHashCode() const
|
||||
{
|
||||
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 result;
|
||||
Intersects(boundingbox, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
void Plane::Intersects(const BoundingBox boundingbox, out PlaneIntersectionType_t& result) const
|
||||
{
|
||||
Vector3 min;
|
||||
Vector3 max;
|
||||
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.Z = (Normal.Z >= 0.0f) ? boundingbox.Min.Z : boundingbox.Max.Z;
|
||||
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.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);
|
||||
|
||||
if(dot + D > 0.0f)
|
||||
result = PlaneIntersectionType::Front;
|
||||
|
||||
dot = (Normal.X * min.X) + (Normal.Y * min.Y) + (Normal.Z * min.Z);
|
||||
|
||||
if(dot + D < 0.0f)
|
||||
result = PlaneIntersectionType::Back;
|
||||
|
||||
result = PlaneIntersectionType::Intersecting;
|
||||
Vector3 min;
|
||||
Vector3 max;
|
||||
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.Z = (Normal.Z >= 0.0f) ? boundingbox.Min.Z : boundingbox.Max.Z;
|
||||
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.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);
|
||||
|
||||
if(dot + D > 0.0f)
|
||||
result = PlaneIntersectionType::Front;
|
||||
|
||||
dot = (Normal.X * min.X) + (Normal.Y * min.Y) + (Normal.Z * min.Z);
|
||||
|
||||
if(dot + D < 0.0f)
|
||||
result = PlaneIntersectionType::Back;
|
||||
|
||||
result = PlaneIntersectionType::Intersecting;
|
||||
}
|
||||
|
||||
|
||||
PlaneIntersectionType_t Plane::Intersects(const BoundingSphere sphere) const
|
||||
{
|
||||
PlaneIntersectionType_t result;
|
||||
Intersects(sphere, result);
|
||||
return result;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
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)
|
||||
result = PlaneIntersectionType::Front;
|
||||
|
||||
if(dot < -sphere.Radius)
|
||||
result = PlaneIntersectionType::Back;
|
||||
|
||||
result = PlaneIntersectionType::Intersecting;
|
||||
if(dot > sphere.Radius)
|
||||
result = PlaneIntersectionType::Front;
|
||||
|
||||
if(dot < -sphere.Radius)
|
||||
result = PlaneIntersectionType::Back;
|
||||
|
||||
result = PlaneIntersectionType::Intersecting;
|
||||
}
|
||||
|
||||
|
||||
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.Y *= magnitude;
|
||||
Normal.Z *= magnitude;
|
||||
D *= magnitude;
|
||||
}
|
||||
|
||||
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));
|
||||
|
||||
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)
|
||||
{
|
||||
result = Normalize(plane);
|
||||
}
|
||||
Normal.X *= magnitude;
|
||||
Normal.Y *= magnitude;
|
||||
Normal.Z *= magnitude;
|
||||
D *= magnitude;
|
||||
}
|
||||
|
||||
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));
|
||||
|
||||
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)
|
||||
{
|
||||
result = Normalize(plane);
|
||||
}
|
||||
|
||||
const String Plane::ToString() const
|
||||
{
|
||||
return String::Format("{Normal:%s D:%g}", (const char*)Normal.ToString(), D);
|
||||
}
|
||||
|
||||
|
||||
Plane Plane::Transform(Plane plane, Matrix matrix)
|
||||
{
|
||||
Plane result;
|
||||
Transform(plane, matrix, result);
|
||||
return result;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
void Plane::Transform(Plane plane, Matrix matrix, out Plane& result)
|
||||
{
|
||||
float x = plane.Normal.X;
|
||||
float y = plane.Normal.Y;
|
||||
float z = plane.Normal.Z;
|
||||
float d = plane.D;
|
||||
|
||||
matrix = Matrix::Invert(matrix);
|
||||
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.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);
|
||||
float x = plane.Normal.X;
|
||||
float y = plane.Normal.Y;
|
||||
float z = plane.Normal.Z;
|
||||
float d = plane.D;
|
||||
|
||||
matrix = Matrix::Invert(matrix);
|
||||
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.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);
|
||||
}
|
||||
|
||||
|
||||
Plane Plane::Transform(Plane plane, Quaternion quaternion)
|
||||
{
|
||||
Plane result;
|
||||
Transform(plane, quaternion, result);
|
||||
return result;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
void Plane::Transform(Plane plane, Quaternion quaternion, out Plane& result)
|
||||
{
|
||||
float x2 = quaternion.X + quaternion.X;
|
||||
float y2 = quaternion.Y + quaternion.Y;
|
||||
float z2 = quaternion.Z + quaternion.Z;
|
||||
float wx = quaternion.W * x2;
|
||||
float wy = quaternion.W * y2;
|
||||
float wz = quaternion.W * z2;
|
||||
float xx = quaternion.X * x2;
|
||||
float xy = quaternion.X * y2;
|
||||
float xz = quaternion.X * z2;
|
||||
float yy = quaternion.Y * y2;
|
||||
float yz = quaternion.Y * z2;
|
||||
float zz = quaternion.Z * z2;
|
||||
|
||||
float x = plane.Normal.X;
|
||||
float y = plane.Normal.Y;
|
||||
float z = plane.Normal.Z;
|
||||
|
||||
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.Z = ((x * (xz - wy)) + (y * (yz + wx))) + (z * ((1.0f - xx) - yy));
|
||||
result.D = plane.D;
|
||||
float x2 = quaternion.X + quaternion.X;
|
||||
float y2 = quaternion.Y + quaternion.Y;
|
||||
float z2 = quaternion.Z + quaternion.Z;
|
||||
float wx = quaternion.W * x2;
|
||||
float wy = quaternion.W * y2;
|
||||
float wz = quaternion.W * z2;
|
||||
float xx = quaternion.X * x2;
|
||||
float xy = quaternion.X * y2;
|
||||
float xz = quaternion.X * z2;
|
||||
float yy = quaternion.Y * y2;
|
||||
float yz = quaternion.Y * z2;
|
||||
float zz = quaternion.Z * z2;
|
||||
|
||||
float x = plane.Normal.X;
|
||||
float y = plane.Normal.Y;
|
||||
float z = plane.Normal.Z;
|
||||
|
||||
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.Z = ((x * (xz - wy)) + (y * (yz + wx))) + (z * ((1.0f - xx) - yy));
|
||||
result.D = plane.D;
|
||||
}
|
||||
|
||||
|
||||
bool Plane::operator==(const Plane& other) const
|
||||
{
|
||||
return ((D == other.D) && (Normal == other.Normal));
|
||||
}
|
||||
|
||||
|
||||
bool Plane::operator!=(const Plane& other) const
|
||||
{
|
||||
return ((D != other.D) || (Normal != other.Normal));
|
||||
|
@ -27,10 +27,12 @@
|
||||
|
||||
#include "Point.h"
|
||||
#include <System/String.h>
|
||||
#include <System/Type.h>
|
||||
|
||||
namespace XFX
|
||||
{
|
||||
const Point Point::Zero = Point();
|
||||
const Type PointTypeInfo("Point", "XFX::Point", TypeCode::Object);
|
||||
|
||||
Point::Point(int x, int y)
|
||||
: X(x), Y(y)
|
||||
@ -62,9 +64,9 @@ namespace XFX
|
||||
return (X + Y);
|
||||
}
|
||||
|
||||
int Point::GetType()
|
||||
const Type& Point::GetType()
|
||||
{
|
||||
// TODO: implement
|
||||
return PointTypeInfo;
|
||||
}
|
||||
|
||||
const String Point::ToString() const
|
||||
|
@ -27,15 +27,17 @@
|
||||
|
||||
#include <Rectangle.h>
|
||||
#include <Graphics/PresentationParameters.h>
|
||||
#include <System/Type.h>
|
||||
|
||||
namespace XFX
|
||||
{
|
||||
namespace Graphics
|
||||
{
|
||||
const Type PresentationParametersTypeInfo("PresentationParameters", "XFX::Graphics::PresentationParameters", TypeCode::Object);
|
||||
|
||||
PresentationParameters::PresentationParameters()
|
||||
: BackBufferFormat(SurfaceFormat::Color),
|
||||
BackBufferHeight(0), BackBufferWidth(0),
|
||||
IsFullScreen(true), MultiSampleCount(0),
|
||||
: BackBufferFormat(SurfaceFormat::Color), BackBufferHeight(0),
|
||||
BackBufferWidth(0), IsFullScreen(true), MultiSampleCount(0),
|
||||
PresentationInterval(PresentInterval::Default),
|
||||
RenderTargetUsage(RenderTargetUsage::DiscardContents)
|
||||
{
|
||||
@ -45,10 +47,10 @@ namespace XFX
|
||||
{
|
||||
return Rectangle(0, 0, BackBufferWidth, BackBufferHeight);
|
||||
}
|
||||
|
||||
PresentationParameters* PresentationParameters::Clone() const
|
||||
{
|
||||
PresentationParameters* clone = new PresentationParameters();
|
||||
|
||||
PresentationParameters* PresentationParameters::Clone() const
|
||||
{
|
||||
PresentationParameters* clone = new PresentationParameters();
|
||||
clone->BackBufferFormat = this->BackBufferFormat;
|
||||
clone->BackBufferHeight = this->BackBufferHeight;
|
||||
clone->BackBufferWidth = this->BackBufferWidth;
|
||||
@ -58,37 +60,37 @@ namespace XFX
|
||||
clone->PresentationInterval = this->PresentationInterval;
|
||||
clone->RenderTargetUsage = this->RenderTargetUsage;
|
||||
return clone;
|
||||
}
|
||||
}
|
||||
|
||||
bool PresentationParameters::Equals(Object const * const obj) const
|
||||
{
|
||||
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
|
||||
{
|
||||
return ((other.BackBufferFormat != BackBufferFormat) ||
|
||||
(other.BackBufferHeight != BackBufferHeight) ||
|
||||
(other.BackBufferWidth != BackBufferWidth) ||
|
||||
(other.IsFullScreen != IsFullScreen) ||
|
||||
(other.MultiSampleCount != MultiSampleCount) ||
|
||||
(other.PresentationInterval != this->PresentationInterval) ||
|
||||
(other.RenderTargetUsage != this->RenderTargetUsage));
|
||||
}
|
||||
|
||||
|
||||
bool PresentationParameters::operator!=(const PresentationParameters& other) const
|
||||
{
|
||||
return ((other.BackBufferFormat != BackBufferFormat) ||
|
||||
(other.BackBufferHeight != BackBufferHeight) ||
|
||||
(other.BackBufferWidth != BackBufferWidth) ||
|
||||
(other.IsFullScreen != IsFullScreen) ||
|
||||
(other.MultiSampleCount != MultiSampleCount) ||
|
||||
(other.PresentationInterval != this->PresentationInterval) ||
|
||||
(other.RenderTargetUsage != this->RenderTargetUsage));
|
||||
}
|
||||
|
||||
bool PresentationParameters::operator==(const PresentationParameters& other) const
|
||||
{
|
||||
return ((other.BackBufferFormat == BackBufferFormat) &&
|
||||
(other.BackBufferHeight == BackBufferHeight) &&
|
||||
(other.BackBufferWidth == BackBufferWidth) &&
|
||||
(other.IsFullScreen == IsFullScreen) &&
|
||||
(other.MultiSampleCount == MultiSampleCount) &&
|
||||
(other.PresentationInterval == this->PresentationInterval) &&
|
||||
(other.BackBufferHeight == BackBufferHeight) &&
|
||||
(other.BackBufferWidth == BackBufferWidth) &&
|
||||
(other.IsFullScreen == IsFullScreen) &&
|
||||
(other.MultiSampleCount == MultiSampleCount) &&
|
||||
(other.PresentationInterval == this->PresentationInterval) &&
|
||||
(other.RenderTargetUsage == this->RenderTargetUsage));
|
||||
}
|
||||
}
|
||||
|
@ -25,17 +25,19 @@
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#include <System/Math.h>
|
||||
#include <MathHelper.h>
|
||||
#include <Matrix.h>
|
||||
#include <Quaternion.h>
|
||||
#include <System/Type.h>
|
||||
#include <Vector3.h>
|
||||
#include <System/Math.h>
|
||||
|
||||
using namespace System;
|
||||
|
||||
namespace XFX
|
||||
{
|
||||
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)
|
||||
: W(w), X(x), Y(y), Z(z)
|
||||
@ -76,215 +78,215 @@ namespace XFX
|
||||
Quaternion Quaternion::Concatenate(Quaternion quaternion1, Quaternion quaternion2)
|
||||
{
|
||||
Quaternion quaternion;
|
||||
float rx = quaternion2.X;
|
||||
float ry = quaternion2.Y;
|
||||
float rz = quaternion2.Z;
|
||||
float rw = quaternion2.W;
|
||||
float lx = quaternion1.X;
|
||||
float ly = quaternion1.Y;
|
||||
float lz = quaternion1.Z;
|
||||
float lw = quaternion1.W;
|
||||
float yz = (ry * lz) - (rz * ly);
|
||||
float xz = (rz * lx) - (rx * lz);
|
||||
float xy = (rx * ly) - (ry * lx);
|
||||
float lengthSq = ((rx * lx) + (ry * ly)) + (rz * lz);
|
||||
|
||||
quaternion.X = ((rx * lw) + (lx * rw)) + yz;
|
||||
quaternion.Y = ((ry * lw) + (ly * rw)) + xz;
|
||||
quaternion.Z = ((rz * lw) + (lz * rw)) + xy;
|
||||
quaternion.W = (rw * lw) - lengthSq;
|
||||
|
||||
return quaternion;
|
||||
}
|
||||
float rx = quaternion2.X;
|
||||
float ry = quaternion2.Y;
|
||||
float rz = quaternion2.Z;
|
||||
float rw = quaternion2.W;
|
||||
float lx = quaternion1.X;
|
||||
float ly = quaternion1.Y;
|
||||
float lz = quaternion1.Z;
|
||||
float lw = quaternion1.W;
|
||||
float yz = (ry * lz) - (rz * ly);
|
||||
float xz = (rz * lx) - (rx * lz);
|
||||
float xy = (rx * ly) - (ry * lx);
|
||||
float lengthSq = ((rx * lx) + (ry * ly)) + (rz * lz);
|
||||
|
||||
quaternion.X = ((rx * lw) + (lx * rw)) + yz;
|
||||
quaternion.Y = ((ry * lw) + (ly * rw)) + xz;
|
||||
quaternion.Z = ((rz * lw) + (lz * rw)) + xy;
|
||||
quaternion.W = (rw * lw) - lengthSq;
|
||||
|
||||
return quaternion;
|
||||
}
|
||||
|
||||
void Quaternion::Concatenate(Quaternion quaternion1, Quaternion quaternion2, out Quaternion& result)
|
||||
{
|
||||
float rx = quaternion2.X;
|
||||
float ry = quaternion2.Y;
|
||||
float rz = quaternion2.Z;
|
||||
float rw = quaternion2.W;
|
||||
float lx = quaternion1.X;
|
||||
float ly = quaternion1.Y;
|
||||
float lz = quaternion1.Z;
|
||||
float lw = quaternion1.W;
|
||||
float yz = (ry * lz) - (rz * ly);
|
||||
float xz = (rz * lx) - (rx * lz);
|
||||
float xy = (rx * ly) - (ry * lx);
|
||||
float lengthSq = ((rx * lx) + (ry * ly)) + (rz * lz);
|
||||
|
||||
result.X = ((rx * lw) + (lx * rw)) + yz;
|
||||
result.Y = ((ry * lw) + (ly * rw)) + xz;
|
||||
result.Z = ((rz * lw) + (lz * rw)) + xy;
|
||||
result.W = (rw * lw) - lengthSq;
|
||||
float rx = quaternion2.X;
|
||||
float ry = quaternion2.Y;
|
||||
float rz = quaternion2.Z;
|
||||
float rw = quaternion2.W;
|
||||
float lx = quaternion1.X;
|
||||
float ly = quaternion1.Y;
|
||||
float lz = quaternion1.Z;
|
||||
float lw = quaternion1.W;
|
||||
float yz = (ry * lz) - (rz * ly);
|
||||
float xz = (rz * lx) - (rx * lz);
|
||||
float xy = (rx * ly) - (ry * lx);
|
||||
float lengthSq = ((rx * lx) + (ry * ly)) + (rz * lz);
|
||||
|
||||
result.X = ((rx * lw) + (lx * rw)) + yz;
|
||||
result.Y = ((ry * lw) + (ly * rw)) + xz;
|
||||
result.Z = ((rz * lw) + (lz * rw)) + xy;
|
||||
result.W = (rw * lw) - lengthSq;
|
||||
}
|
||||
|
||||
|
||||
void Quaternion::Conjugate()
|
||||
{
|
||||
X = -X;
|
||||
Y = -Y;
|
||||
Z = -Z;
|
||||
}
|
||||
|
||||
|
||||
Quaternion Quaternion::Conjugate(Quaternion value)
|
||||
{
|
||||
Quaternion result;
|
||||
result.X = -value.X;
|
||||
result.Y = -value.Y;
|
||||
result.Z = -value.Z;
|
||||
result.W = value.W;
|
||||
return result;
|
||||
Quaternion result;
|
||||
result.X = -value.X;
|
||||
result.Y = -value.Y;
|
||||
result.Z = -value.Z;
|
||||
result.W = value.W;
|
||||
return result;
|
||||
}
|
||||
|
||||
void Quaternion::Conjugate(Quaternion value, out Quaternion& result)
|
||||
{
|
||||
result.X = -value.X;
|
||||
result.Y = -value.Y;
|
||||
result.Z = -value.Z;
|
||||
result.W = value.W;
|
||||
result.X = -value.X;
|
||||
result.Y = -value.Y;
|
||||
result.Z = -value.Z;
|
||||
result.W = value.W;
|
||||
}
|
||||
|
||||
|
||||
Quaternion Quaternion::CreateFromAxisAngle(Vector3 axis, float angle)
|
||||
{
|
||||
Quaternion result;
|
||||
|
||||
Vector3::Normalize(axis, axis);
|
||||
|
||||
float half = angle * 0.5f;
|
||||
float Sin = Math::Sin(half);
|
||||
float Cos = Math::Cos(half);
|
||||
|
||||
result.X = axis.X * Sin;
|
||||
result.Y = axis.Y * Sin;
|
||||
result.Z = axis.Z * Sin;
|
||||
result.W = Cos;
|
||||
|
||||
return result;
|
||||
float half = angle * 0.5f;
|
||||
float Sin = Math::Sin(half);
|
||||
float Cos = Math::Cos(half);
|
||||
|
||||
result.X = axis.X * Sin;
|
||||
result.Y = axis.Y * Sin;
|
||||
result.Z = axis.Z * Sin;
|
||||
result.W = Cos;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
void Quaternion::CreateFromAxisAngle(Vector3 axis, float angle, out Quaternion& result)
|
||||
{
|
||||
Vector3::Normalize(axis, axis);
|
||||
|
||||
float half = angle * 0.5f;
|
||||
float Sin = Math::Sin(half);
|
||||
float Cos = Math::Cos(half);
|
||||
|
||||
result.X = axis.X * Sin;
|
||||
result.Y = axis.Y * Sin;
|
||||
result.Z = axis.Z * Sin;
|
||||
result.W = Cos;
|
||||
float half = angle * 0.5f;
|
||||
float Sin = Math::Sin(half);
|
||||
float Cos = Math::Cos(half);
|
||||
|
||||
result.X = axis.X * Sin;
|
||||
result.Y = axis.Y * Sin;
|
||||
result.Z = axis.Z * Sin;
|
||||
result.W = Cos;
|
||||
}
|
||||
|
||||
|
||||
Quaternion Quaternion::CreateFromRotationMatrix(Matrix matrix)
|
||||
{
|
||||
Quaternion result;
|
||||
float scale = matrix.M11 + matrix.M22 + matrix.M33;
|
||||
|
||||
|
||||
if(scale > 0.0f)
|
||||
{
|
||||
float Sqrt = Math::Sqrt(scale + 1.0f);
|
||||
|
||||
result.W = Sqrt + 0.5f;
|
||||
Sqrt = 0.5f / Sqrt;
|
||||
|
||||
|
||||
result.X = (matrix.M23 - matrix.M32) * Sqrt;
|
||||
result.Y = (matrix.M31 - matrix.M13) * Sqrt;
|
||||
result.Z = (matrix.M12 - matrix.M21) * Sqrt;
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
if((matrix.M11 >= matrix.M22) && (matrix.M11 >= matrix.M33))
|
||||
{
|
||||
float Sqrt = Math::Sqrt(1.0f + matrix.M11 - matrix.M22 - matrix.M33);
|
||||
float half = 0.f / Sqrt;
|
||||
|
||||
|
||||
result.X = 0.5f * Sqrt;
|
||||
result.Y = (matrix.M12 + matrix.M21) * half;
|
||||
result.Z = (matrix.M13 + matrix.M31) * half;
|
||||
result.W = (matrix.M23 - matrix.M32) * half;
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
if(matrix.M22 > matrix.M33)
|
||||
{
|
||||
float Sqrt = Math::Sqrt(1.0f + matrix.M22 - matrix.M11 - matrix.M33);
|
||||
float half = 0.5f / Sqrt;
|
||||
|
||||
|
||||
result.X = (matrix.M21 + matrix.M12) * half;
|
||||
result.Y = 0.5f * Sqrt;
|
||||
result.Z = (matrix.M32 + matrix.M23) * half;
|
||||
result.W = (matrix.M31 - matrix.M21) * half;
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
float Sqrt = Math::Sqrt(1.0f + matrix.M33 - matrix.M11 - matrix.M22);
|
||||
float half = 0.5f / Sqrt;
|
||||
|
||||
|
||||
result.X = (matrix.M31 + matrix.M13) * half;
|
||||
result.Y = (matrix.M32 + matrix.M23) * half;
|
||||
result.Z = 0.5f * Sqrt;
|
||||
result.W = (matrix.M12 - matrix.M21) * half;
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
void Quaternion::CreateFromRotationMatrix(Matrix matrix, out Quaternion& result)
|
||||
{
|
||||
float scale = matrix.M11 + matrix.M22 + matrix.M33;
|
||||
|
||||
|
||||
if(scale >0.0f)
|
||||
{
|
||||
float Sqrt = Math::Sqrt(scale + 1.0f);
|
||||
|
||||
|
||||
result.W = Sqrt + 0.5f;
|
||||
Sqrt = 0.5f / Sqrt;
|
||||
|
||||
|
||||
result.X = (matrix.M23 - matrix.M32) * Sqrt;
|
||||
result.Y = (matrix.M31 - matrix.M13) * Sqrt;
|
||||
result.Z = (matrix.M12 - matrix.M21) * Sqrt;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if((matrix.M11 >= matrix.M22) && (matrix.M11 >= matrix.M33))
|
||||
{
|
||||
float Sqrt = Math::Sqrt(1.0f + matrix.M11 - matrix.M22 - matrix.M33);
|
||||
float half = 0.f / Sqrt;
|
||||
|
||||
|
||||
result.X = 0.5f * Sqrt;
|
||||
result.Y = (matrix.M12 + matrix.M21) * half;
|
||||
result.Z = (matrix.M13 + matrix.M31) * half;
|
||||
result.W = (matrix.M23 - matrix.M32) * half;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if(matrix.M22 > matrix.M33)
|
||||
{
|
||||
float Sqrt = Math::Sqrt(1.0f + matrix.M22 - matrix.M11 - matrix.M33);
|
||||
float half = 0.5f / Sqrt;
|
||||
|
||||
|
||||
result.X = (matrix.M21 + matrix.M12) * half;
|
||||
result.Y = 0.5f * Sqrt;
|
||||
result.Z = (matrix.M32 + matrix.M23) * half;
|
||||
result.W = (matrix.M31 - matrix.M21) * half;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
float Sqrt = Math::Sqrt(1.0f + matrix.M33 - matrix.M11 - matrix.M22);
|
||||
float half = 0.5f / Sqrt;
|
||||
|
||||
|
||||
result.X = (matrix.M31 + matrix.M13) * half;
|
||||
result.Y = (matrix.M32 + matrix.M23) * half;
|
||||
result.Z = 0.5f * Sqrt;
|
||||
result.W = (matrix.M12 - matrix.M21) * half;
|
||||
}
|
||||
|
||||
|
||||
Quaternion Quaternion::CreateFromYawPitchRoll(float yaw, float pitch, float roll)
|
||||
{
|
||||
Quaternion result;
|
||||
|
||||
|
||||
float halfRoll = roll * 0.5f;
|
||||
float sinRoll = Math::Sin(halfRoll);
|
||||
float cosRoll = Math::Cos(halfRoll);
|
||||
@ -294,15 +296,15 @@ namespace XFX
|
||||
float halfYaw = yaw * 0.5f;
|
||||
float sinYaw = Math::Sin(halfYaw);
|
||||
float cosYaw = Math::Cos(halfYaw);
|
||||
|
||||
|
||||
result.X = (cosYaw * sinPitch * cosRoll) + (sinYaw * cosPitch * sinRoll);
|
||||
result.Y = (sinYaw * cosPitch * cosRoll) + (cosYaw * sinPitch * sinRoll);
|
||||
result.Z = (cosYaw * cosPitch * sinRoll) + (sinYaw * sinPitch * cosRoll);
|
||||
result.W = (cosYaw * cosPitch * cosRoll) + (sinYaw * sinPitch * sinRoll);
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
void Quaternion::CreateFromYawPitchRoll(float yaw, float pitch, float roll, out Quaternion& result)
|
||||
{
|
||||
float halfRoll = roll * 0.5f;
|
||||
@ -314,13 +316,13 @@ namespace XFX
|
||||
float halfYaw = yaw * 0.5f;
|
||||
float sinYaw = Math::Sin(halfYaw);
|
||||
float cosYaw = Math::Cos(halfYaw);
|
||||
|
||||
|
||||
result.X = (cosYaw * sinPitch * cosRoll) + (sinYaw * cosPitch * sinRoll);
|
||||
result.Y = (sinYaw * cosPitch * cosRoll) + (cosYaw * sinPitch * sinRoll);
|
||||
result.Z = (cosYaw * cosPitch * sinRoll) + (sinYaw * sinPitch * cosRoll);
|
||||
result.W = (cosYaw * cosPitch * cosRoll) + (sinYaw * sinPitch * sinRoll);
|
||||
}
|
||||
|
||||
|
||||
Quaternion Quaternion::Divide(Quaternion quaternion1, Quaternion quaternion2)
|
||||
{
|
||||
Quaternion result;
|
||||
@ -338,12 +340,12 @@ namespace XFX
|
||||
result.Z = quaternion1.Z / quaternion2.Z;
|
||||
result.W = quaternion1.W / quaternion2.W;
|
||||
}
|
||||
|
||||
|
||||
float Quaternion::Dot(Quaternion quaternion1, Quaternion quaternion2)
|
||||
{
|
||||
return (quaternion1.X * quaternion2.X) + (quaternion1.Y * quaternion2.Y) + (quaternion1.Z * quaternion2.Z) + (quaternion1.W * quaternion2.W);
|
||||
}
|
||||
|
||||
|
||||
void Quaternion::Dot(Quaternion quaternion1, Quaternion quaternion2, out float& result)
|
||||
{
|
||||
result = (quaternion1.X * quaternion2.X) + (quaternion1.Y * quaternion2.Y) + (quaternion1.Z * quaternion2.Z) + (quaternion1.W * quaternion2.W);
|
||||
@ -353,7 +355,7 @@ namespace XFX
|
||||
{
|
||||
return is(this, obj) ? *this == *(Quaternion *)obj : false;
|
||||
}
|
||||
|
||||
|
||||
bool Quaternion::Equals(const Quaternion obj) const
|
||||
{
|
||||
return (*this == obj);
|
||||
@ -364,104 +366,104 @@ namespace XFX
|
||||
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 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;
|
||||
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 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;
|
||||
return result;
|
||||
}
|
||||
|
||||
float Quaternion::Length()
|
||||
{
|
||||
return Math::Sqrt((X * X) + (Y * Y) + (Z * Z) + (W * W));
|
||||
}
|
||||
|
||||
float Quaternion::LengthSquared()
|
||||
{
|
||||
return (X * X) + (Y * Y) + (Z * Z) + (W * W);
|
||||
}
|
||||
|
||||
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)
|
||||
|
||||
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()
|
||||
{
|
||||
return Math::Sqrt((X * X) + (Y * Y) + (Z * Z) + (W * W));
|
||||
}
|
||||
|
||||
float Quaternion::LengthSquared()
|
||||
{
|
||||
return (X * X) + (Y * Y) + (Z * Z) + (W * W);
|
||||
}
|
||||
|
||||
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.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);
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
Quaternion Quaternion::Multiply(Quaternion quaternion1, Quaternion quaternion2)
|
||||
{
|
||||
Quaternion result;
|
||||
float rx = quaternion2.X;
|
||||
float ry = quaternion2.Y;
|
||||
float rz = quaternion2.Z;
|
||||
float rw = quaternion2.W;
|
||||
float lx = quaternion1.X;
|
||||
float ly = quaternion1.Y;
|
||||
float lz = quaternion1.Z;
|
||||
float lw = quaternion1.W;
|
||||
float yz = (ry * lz) - (rz * ly);
|
||||
float xz = (rz * lx) - (rx * lz);
|
||||
float xy = (rx * ly) - (ry * lx);
|
||||
float lengthSq = ((rx * lx) + (ry * ly)) + (rz * lz);
|
||||
|
||||
result.X = ((rx * lw) + (lx * rw)) + yz;
|
||||
result.Y = ((ry * lw) + (ly * rw)) + xz;
|
||||
result.Z = ((rz * lw) + (lz * rw)) + xy;
|
||||
result.W = (rw * lw) - lengthSq;
|
||||
|
||||
return result;
|
||||
Quaternion result;
|
||||
float rx = quaternion2.X;
|
||||
float ry = quaternion2.Y;
|
||||
float rz = quaternion2.Z;
|
||||
float rw = quaternion2.W;
|
||||
float lx = quaternion1.X;
|
||||
float ly = quaternion1.Y;
|
||||
float lz = quaternion1.Z;
|
||||
float lw = quaternion1.W;
|
||||
float yz = (ry * lz) - (rz * ly);
|
||||
float xz = (rz * lx) - (rx * lz);
|
||||
float xy = (rx * ly) - (ry * lx);
|
||||
float lengthSq = ((rx * lx) + (ry * ly)) + (rz * lz);
|
||||
|
||||
result.X = ((rx * lw) + (lx * rw)) + yz;
|
||||
result.Y = ((ry * lw) + (ly * rw)) + xz;
|
||||
result.Z = ((rz * lw) + (lz * rw)) + xy;
|
||||
result.W = (rw * lw) - lengthSq;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
void Quaternion::Multiply(Quaternion quaternion1, Quaternion quaternion2, out Quaternion& result)
|
||||
{
|
||||
float rx = quaternion2.X;
|
||||
float ry = quaternion2.Y;
|
||||
float rz = quaternion2.Z;
|
||||
float rw = quaternion2.W;
|
||||
float lx = quaternion1.X;
|
||||
float ly = quaternion1.Y;
|
||||
float lz = quaternion1.Z;
|
||||
float lw = quaternion1.W;
|
||||
float yz = (ry * lz) - (rz * ly);
|
||||
float xz = (rz * lx) - (rx * lz);
|
||||
float xy = (rx * ly) - (ry * lx);
|
||||
float lengthSq = ((rx * lx) + (ry * ly)) + (rz * lz);
|
||||
|
||||
result.X = ((rx * lw) + (lx * rw)) + yz;
|
||||
result.Y = ((ry * lw) + (ly * rw)) + xz;
|
||||
result.Z = ((rz * lw) + (lz * rw)) + xy;
|
||||
result.W = (rw * lw) - lengthSq;
|
||||
float rx = quaternion2.X;
|
||||
float ry = quaternion2.Y;
|
||||
float rz = quaternion2.Z;
|
||||
float rw = quaternion2.W;
|
||||
float lx = quaternion1.X;
|
||||
float ly = quaternion1.Y;
|
||||
float lz = quaternion1.Z;
|
||||
float lw = quaternion1.W;
|
||||
float yz = (ry * lz) - (rz * ly);
|
||||
float xz = (rz * lx) - (rx * lz);
|
||||
float xy = (rx * ly) - (ry * lx);
|
||||
float lengthSq = ((rx * lx) + (ry * ly)) + (rz * lz);
|
||||
|
||||
result.X = ((rx * lw) + (lx * rw)) + yz;
|
||||
result.Y = ((ry * lw) + (ly * rw)) + xz;
|
||||
result.Z = ((rz * lw) + (lz * rw)) + xy;
|
||||
result.W = (rw * lw) - lengthSq;
|
||||
}
|
||||
|
||||
|
||||
Quaternion Quaternion::Multiply(Quaternion quaternion, float scaleFactor)
|
||||
{
|
||||
Quaternion result;
|
||||
@ -471,7 +473,7 @@ namespace XFX
|
||||
result.W = quaternion.W * scaleFactor;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
void Quaternion::Multiply(Quaternion quaternion, float scaleFactor, out Quaternion& result)
|
||||
{
|
||||
result.X = quaternion.X * scaleFactor;
|
||||
@ -479,7 +481,7 @@ namespace XFX
|
||||
result.Z = quaternion.Z * scaleFactor;
|
||||
result.W = quaternion.W * scaleFactor;
|
||||
}
|
||||
|
||||
|
||||
Quaternion Quaternion::Negate(Quaternion quaternion)
|
||||
{
|
||||
Quaternion result;
|
||||
@ -489,7 +491,7 @@ namespace XFX
|
||||
result.W = -quaternion.W;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
void Quaternion::Negate(Quaternion quaternion, out Quaternion& result)
|
||||
{
|
||||
result.X = -quaternion.X;
|
||||
@ -497,85 +499,85 @@ namespace XFX
|
||||
result.Z = -quaternion.Z;
|
||||
result.W = -quaternion.W;
|
||||
}
|
||||
|
||||
void Quaternion::Normalize()
|
||||
{
|
||||
float length = 1.0f / Length();
|
||||
X *= length;
|
||||
Y *= length;
|
||||
Z *= length;
|
||||
W *= length;
|
||||
}
|
||||
|
||||
Quaternion Quaternion::Slerp(Quaternion quaternion1, Quaternion quaternion2, float amount)
|
||||
{
|
||||
Quaternion result;
|
||||
|
||||
float opposite;
|
||||
float inverse;
|
||||
float dot = (quaternion1.X * quaternion2.X) + (quaternion1.Y * quaternion2.Y) + (quaternion1.Z * quaternion2.Z) + (quaternion1.W * quaternion2.W);
|
||||
int flag = false;
|
||||
|
||||
if( dot < 0.0f )
|
||||
{
|
||||
flag = true;
|
||||
dot = -dot;
|
||||
}
|
||||
|
||||
if( dot > 0.999999f )
|
||||
{
|
||||
inverse = 1.0f - amount;
|
||||
opposite = flag ? -amount : amount;
|
||||
}
|
||||
else
|
||||
{
|
||||
float Acos = Math::Acos(dot);
|
||||
float invSin = (1.0f / Math::Sin(Acos));
|
||||
|
||||
inverse = (Math::Sin((1.0f - amount) * Acos)* invSin);
|
||||
opposite = flag ? ( -Math::Sin(amount * Acos ) * invSin) : (Math::Sin(amount * Acos) * invSin);
|
||||
}
|
||||
|
||||
result.X = (inverse * quaternion1.X) + (opposite * quaternion2.X);
|
||||
result.Y = (inverse * quaternion1.Y) + (opposite * quaternion2.Y);
|
||||
result.Z = (inverse * quaternion1.Z) + (opposite * quaternion2.Z);
|
||||
result.W = (inverse * quaternion1.W) + (opposite * quaternion2.W);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void Quaternion::Slerp(Quaternion quaternion1, Quaternion quaternion2, float amount, out Quaternion& result)
|
||||
{
|
||||
float opposite;
|
||||
float inverse;
|
||||
float dot = (quaternion1.X * quaternion2.X) + (quaternion1.Y * quaternion2.Y) + (quaternion1.Z * quaternion2.Z) + (quaternion1.W * quaternion2.W);
|
||||
int flag = false;
|
||||
|
||||
if( dot < 0.0f )
|
||||
{
|
||||
flag = true;
|
||||
dot = -dot;
|
||||
}
|
||||
|
||||
if( dot > 0.999999f )
|
||||
{
|
||||
inverse = 1.0f - amount;
|
||||
opposite = flag ? -amount : amount;
|
||||
}
|
||||
else
|
||||
{
|
||||
float Acos = Math::Acos(dot);
|
||||
float invSin = (1.0f / Math::Sin(Acos));
|
||||
|
||||
inverse = (Math::Sin((1.0f - amount) * Acos)* invSin);
|
||||
opposite = flag ? ( -Math::Sin(amount * Acos ) * invSin) : (Math::Sin(amount * Acos) * invSin);
|
||||
}
|
||||
|
||||
result.X = (inverse * quaternion1.X) + (opposite * quaternion2.X);
|
||||
result.Y = (inverse * quaternion1.Y) + (opposite * quaternion2.Y);
|
||||
result.Z = (inverse * quaternion1.Z) + (opposite * quaternion2.Z);
|
||||
result.W = (inverse * quaternion1.W) + (opposite * quaternion2.W);
|
||||
}
|
||||
|
||||
void Quaternion::Normalize()
|
||||
{
|
||||
float length = 1.0f / Length();
|
||||
X *= length;
|
||||
Y *= length;
|
||||
Z *= length;
|
||||
W *= length;
|
||||
}
|
||||
|
||||
Quaternion Quaternion::Slerp(Quaternion quaternion1, Quaternion quaternion2, float amount)
|
||||
{
|
||||
Quaternion result;
|
||||
|
||||
float opposite;
|
||||
float inverse;
|
||||
float dot = (quaternion1.X * quaternion2.X) + (quaternion1.Y * quaternion2.Y) + (quaternion1.Z * quaternion2.Z) + (quaternion1.W * quaternion2.W);
|
||||
int flag = false;
|
||||
|
||||
if( dot < 0.0f )
|
||||
{
|
||||
flag = true;
|
||||
dot = -dot;
|
||||
}
|
||||
|
||||
if( dot > 0.999999f )
|
||||
{
|
||||
inverse = 1.0f - amount;
|
||||
opposite = flag ? -amount : amount;
|
||||
}
|
||||
else
|
||||
{
|
||||
float Acos = Math::Acos(dot);
|
||||
float invSin = (1.0f / Math::Sin(Acos));
|
||||
|
||||
inverse = (Math::Sin((1.0f - amount) * Acos)* invSin);
|
||||
opposite = flag ? ( -Math::Sin(amount * Acos ) * invSin) : (Math::Sin(amount * Acos) * invSin);
|
||||
}
|
||||
|
||||
result.X = (inverse * quaternion1.X) + (opposite * quaternion2.X);
|
||||
result.Y = (inverse * quaternion1.Y) + (opposite * quaternion2.Y);
|
||||
result.Z = (inverse * quaternion1.Z) + (opposite * quaternion2.Z);
|
||||
result.W = (inverse * quaternion1.W) + (opposite * quaternion2.W);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void Quaternion::Slerp(Quaternion quaternion1, Quaternion quaternion2, float amount, out Quaternion& result)
|
||||
{
|
||||
float opposite;
|
||||
float inverse;
|
||||
float dot = (quaternion1.X * quaternion2.X) + (quaternion1.Y * quaternion2.Y) + (quaternion1.Z * quaternion2.Z) + (quaternion1.W * quaternion2.W);
|
||||
int flag = false;
|
||||
|
||||
if( dot < 0.0f )
|
||||
{
|
||||
flag = true;
|
||||
dot = -dot;
|
||||
}
|
||||
|
||||
if( dot > 0.999999f )
|
||||
{
|
||||
inverse = 1.0f - amount;
|
||||
opposite = flag ? -amount : amount;
|
||||
}
|
||||
else
|
||||
{
|
||||
float Acos = Math::Acos(dot);
|
||||
float invSin = (1.0f / Math::Sin(Acos));
|
||||
|
||||
inverse = (Math::Sin((1.0f - amount) * Acos)* invSin);
|
||||
opposite = flag ? ( -Math::Sin(amount * Acos ) * invSin) : (Math::Sin(amount * Acos) * invSin);
|
||||
}
|
||||
|
||||
result.X = (inverse * quaternion1.X) + (opposite * quaternion2.X);
|
||||
result.Y = (inverse * quaternion1.Y) + (opposite * quaternion2.Y);
|
||||
result.Z = (inverse * quaternion1.Z) + (opposite * quaternion2.Z);
|
||||
result.W = (inverse * quaternion1.W) + (opposite * quaternion2.W);
|
||||
}
|
||||
|
||||
Quaternion Quaternion::Subtract(Quaternion quaternion1, Quaternion quaternion2)
|
||||
{
|
||||
@ -612,26 +614,26 @@ namespace XFX
|
||||
|
||||
Quaternion Quaternion::operator*(const Quaternion& other)
|
||||
{
|
||||
Quaternion result;
|
||||
float rx = other.X;
|
||||
float ry = other.Y;
|
||||
float rz = other.Z;
|
||||
float rw = other.W;
|
||||
float lx = X;
|
||||
float ly = Y;
|
||||
float lz = Z;
|
||||
float lw = W;
|
||||
float yz = (ry * lz) - (rz * ly);
|
||||
float xz = (rz * lx) - (rx * lz);
|
||||
float xy = (rx * ly) - (ry * lx);
|
||||
float lengthSq = ((rx * lx) + (ry * ly)) + (rz * lz);
|
||||
|
||||
result.X = ((rx * lw) + (lx * rw)) + yz;
|
||||
result.Y = ((ry * lw) + (ly * rw)) + xz;
|
||||
result.Z = ((rz * lw) + (lz * rw)) + xy;
|
||||
result.W = (rw * lw) - lengthSq;
|
||||
|
||||
return result;
|
||||
Quaternion result;
|
||||
float rx = other.X;
|
||||
float ry = other.Y;
|
||||
float rz = other.Z;
|
||||
float rw = other.W;
|
||||
float lx = X;
|
||||
float ly = Y;
|
||||
float lz = Z;
|
||||
float lw = W;
|
||||
float yz = (ry * lz) - (rz * ly);
|
||||
float xz = (rz * lx) - (rx * lz);
|
||||
float xy = (rx * ly) - (ry * lx);
|
||||
float lengthSq = ((rx * lx) + (ry * ly)) + (rz * lz);
|
||||
|
||||
result.X = ((rx * lw) + (lx * rw)) + yz;
|
||||
result.Y = ((ry * lw) + (ly * rw)) + xz;
|
||||
result.Z = ((rz * lw) + (lz * rw)) + xy;
|
||||
result.W = (rw * lw) - lengthSq;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
Quaternion Quaternion::operator*(const float scaleFactor)
|
||||
|
@ -32,12 +32,15 @@
|
||||
#include <System/Math.h>
|
||||
#include <System/Single.h>
|
||||
#include <System/String.h>
|
||||
#include <System/Type.h>
|
||||
#include <Vector3.h>
|
||||
|
||||
using namespace System;
|
||||
|
||||
namespace XFX
|
||||
{
|
||||
const Type RayTypeInfo("Ray", "XFX::Ray", TypeCode::Object);
|
||||
|
||||
Ray::Ray(Vector3 direction, Vector3 position)
|
||||
: Direction(direction), Position(position)
|
||||
{
|
||||
@ -68,9 +71,9 @@ namespace XFX
|
||||
return (Direction.GetHashCode() ^ Position.GetHashCode());
|
||||
}
|
||||
|
||||
int Ray::GetType()
|
||||
const Type& Ray::GetType()
|
||||
{
|
||||
// TODO: implement
|
||||
return RayTypeInfo;
|
||||
}
|
||||
|
||||
float Ray::Intersects(BoundingBox boundingbox) const
|
||||
@ -78,102 +81,102 @@ namespace XFX
|
||||
float distance;
|
||||
float d = 0.0f;
|
||||
float MAXValue = Single::MaxValue;
|
||||
|
||||
|
||||
if (Math::Abs(Direction.X) < 0.0000001)
|
||||
{
|
||||
if (Position.X < boundingbox.Min.X || Position.X > boundingbox.Max.X)
|
||||
{
|
||||
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;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
distance = d;
|
||||
return distance;
|
||||
{
|
||||
if (Position.X < boundingbox.Min.X || Position.X > boundingbox.Max.X)
|
||||
{
|
||||
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;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
distance = d;
|
||||
return distance;
|
||||
}
|
||||
|
||||
void Ray::Intersects(BoundingBox boundingbox, out float& distance) const
|
||||
@ -184,34 +187,34 @@ namespace XFX
|
||||
float Ray::Intersects(BoundingSphere sphere) const
|
||||
{
|
||||
float distance;
|
||||
float x = sphere.Center.X - Position.X;
|
||||
float y = sphere.Center.Y - Position.Y;
|
||||
float z = sphere.Center.Z - Position.Z;
|
||||
float pyth = (x * x) + (y * y) + (z * z);
|
||||
float rr = sphere.Radius * sphere.Radius;
|
||||
|
||||
if (pyth <= rr)
|
||||
{
|
||||
distance = 0.0f;
|
||||
return distance;
|
||||
}
|
||||
|
||||
float dot = (x * Direction.X) + (y * Direction.Y) + (z * Direction.Z);
|
||||
if (dot < 0.0f)
|
||||
{
|
||||
distance = 0.0f;
|
||||
return distance;
|
||||
}
|
||||
|
||||
float temp = pyth - (dot * dot);
|
||||
if (temp > rr)
|
||||
{
|
||||
distance = 0.0f;
|
||||
return distance;
|
||||
}
|
||||
|
||||
distance = dot - Math::Sqrt(rr - temp);
|
||||
return distance;
|
||||
float x = sphere.Center.X - Position.X;
|
||||
float y = sphere.Center.Y - Position.Y;
|
||||
float z = sphere.Center.Z - Position.Z;
|
||||
float pyth = (x * x) + (y * y) + (z * z);
|
||||
float rr = sphere.Radius * sphere.Radius;
|
||||
|
||||
if (pyth <= rr)
|
||||
{
|
||||
distance = 0.0f;
|
||||
return distance;
|
||||
}
|
||||
|
||||
float dot = (x * Direction.X) + (y * Direction.Y) + (z * Direction.Z);
|
||||
if (dot < 0.0f)
|
||||
{
|
||||
distance = 0.0f;
|
||||
return distance;
|
||||
}
|
||||
|
||||
float temp = pyth - (dot * dot);
|
||||
if (temp > rr)
|
||||
{
|
||||
distance = 0.0f;
|
||||
return distance;
|
||||
}
|
||||
|
||||
distance = dot - Math::Sqrt(rr - temp);
|
||||
return distance;
|
||||
}
|
||||
|
||||
void Ray::Intersects(BoundingSphere sphere, out float& distance) const
|
||||
@ -221,30 +224,30 @@ namespace XFX
|
||||
|
||||
float Ray::Intersects(Plane plane) const
|
||||
{
|
||||
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;
|
||||
|
||||
if (Math::Abs(dotDirection) < 0.000001f)
|
||||
{
|
||||
distance = 0.0f;
|
||||
return distance;
|
||||
}
|
||||
|
||||
float dotPosition = (plane.Normal.X * Position.X) + (plane.Normal.Y * Position.Y) + (plane.Normal.Z * Position.Z);
|
||||
float num = (-plane.D - dotPosition) / dotDirection;
|
||||
|
||||
if (num < 0.0f)
|
||||
{
|
||||
if (num < -0.000001f)
|
||||
{
|
||||
distance = 0.0f;
|
||||
return distance;
|
||||
}
|
||||
num = 0.0f;
|
||||
}
|
||||
|
||||
distance = num;
|
||||
return distance;
|
||||
|
||||
if (Math::Abs(dotDirection) < 0.000001f)
|
||||
{
|
||||
distance = 0.0f;
|
||||
return distance;
|
||||
}
|
||||
|
||||
float dotPosition = (plane.Normal.X * Position.X) + (plane.Normal.Y * Position.Y) + (plane.Normal.Z * Position.Z);
|
||||
float num = (-plane.D - dotPosition) / dotDirection;
|
||||
|
||||
if (num < 0.0f)
|
||||
{
|
||||
if (num < -0.000001f)
|
||||
{
|
||||
distance = 0.0f;
|
||||
return distance;
|
||||
}
|
||||
num = 0.0f;
|
||||
}
|
||||
|
||||
distance = num;
|
||||
return distance;
|
||||
}
|
||||
|
||||
void Ray::Intersects(Plane plane, out float& distance) const
|
||||
|
@ -27,10 +27,12 @@
|
||||
|
||||
#include <Point.h>
|
||||
#include <Rectangle.h>
|
||||
#include <System/Type.h>
|
||||
|
||||
namespace XFX
|
||||
{
|
||||
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)
|
||||
: Height(height), Width(width), X(x), Y(y)
|
||||
@ -107,9 +109,9 @@ namespace XFX
|
||||
return X ^ Y ^ Width ^ Height;
|
||||
}
|
||||
|
||||
int Rectangle::GetType()
|
||||
const Type& Rectangle::GetType()
|
||||
{
|
||||
// TODO: implement
|
||||
return RectangleTypeInfo;
|
||||
}
|
||||
|
||||
void Rectangle::Inflate(int horizontalAmount, int verticalAmount)
|
||||
|
@ -34,6 +34,8 @@ namespace XFX
|
||||
{
|
||||
namespace Audio
|
||||
{
|
||||
const Type SoundEffectInstanceTypeInfo("SoundEffectInstance", "XFX::Audio::SoundEffectInstance", TypeCode::Object);
|
||||
|
||||
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->referenceCount++;
|
||||
@ -83,6 +85,7 @@ namespace XFX
|
||||
|
||||
SoundEffectInstance::~SoundEffectInstance()
|
||||
{
|
||||
_parent->referenceCount--;
|
||||
}
|
||||
|
||||
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()
|
||||
@ -124,6 +128,7 @@ namespace XFX
|
||||
|
||||
void SoundEffectInstance::Stop()
|
||||
{
|
||||
Stop(true);
|
||||
}
|
||||
|
||||
void SoundEffectInstance::Stop(bool immediate)
|
||||
|
@ -89,7 +89,7 @@ namespace XFX
|
||||
return;
|
||||
}
|
||||
}
|
||||
*cDriveLetter = 0;
|
||||
*cDriveLetter = 0;
|
||||
}
|
||||
|
||||
StorageDevice* StorageContainer::getStorageDevice() const
|
||||
@ -141,7 +141,7 @@ namespace XFX
|
||||
// copy the XeImageFileName to tmp, and strip the \default.xbe
|
||||
//char *tmp = strncpy(tmp, XeImageFileName->Buffer, XeImageFileName->Length - 12);
|
||||
|
||||
char* szTemp = (char*)malloc(256);
|
||||
char* szTemp = (char *)malloc(256);
|
||||
char cDriveLetter = 0;
|
||||
char* szDest;
|
||||
|
||||
|
34
src/libXFX/StorageDeviceAsyncResult.h
Normal file
34
src/libXFX/StorageDeviceAsyncResult.h
Normal 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_
|
@ -32,7 +32,7 @@ namespace XFX
|
||||
{
|
||||
namespace Graphics
|
||||
{
|
||||
const VertexElement vertexArray[] =
|
||||
const VertexElement VertexPositionColor::vertexArray[] =
|
||||
{
|
||||
VertexElement(0, VertexElementFormat::Vector3, VertexElementUsage::Position, 0),
|
||||
VertexElement(12, VertexElementFormat::Color, VertexElementUsage::Color, 0)
|
||||
|
@ -26,6 +26,7 @@
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#include <System/String.h>
|
||||
#include <System/Type.h>
|
||||
#include <Vector2.h>
|
||||
#include <Vector3.h>
|
||||
#include <Graphics/VertexPositionTexture.h>
|
||||
@ -34,6 +35,8 @@ namespace XFX
|
||||
{
|
||||
namespace Graphics
|
||||
{
|
||||
const Type VertexPositionTextureTypeInfo("VertexPositionTexture", "XFX::Graphics::VertexPositionTexture", TypeCode::Object);
|
||||
|
||||
const VertexElement VertexPositionTexture::vertexArray[] =
|
||||
{
|
||||
VertexElement(0, VertexElementFormat::Vector3, VertexElementUsage::Position, 0),
|
||||
@ -57,7 +60,7 @@ namespace XFX
|
||||
|
||||
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
|
||||
@ -65,9 +68,9 @@ namespace XFX
|
||||
return Position.GetHashCode() ^ TextureCoordinate.GetHashCode();
|
||||
}
|
||||
|
||||
int VertexPositionTexture::GetType()
|
||||
const Type& VertexPositionTexture::GetType()
|
||||
{
|
||||
// TODO: implement
|
||||
return VertexPositionTextureTypeInfo;
|
||||
}
|
||||
|
||||
const String VertexPositionTexture::ToString() const
|
||||
|
62
src/libXFX/Video.cpp
Normal file
62
src/libXFX/Video.cpp
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
@ -47,6 +47,7 @@ namespace XFX
|
||||
|
||||
Video* VideoPlayer::getVideo()
|
||||
{
|
||||
return playingVideo;
|
||||
}
|
||||
|
||||
VideoPlayer::VideoPlayer()
|
||||
@ -64,6 +65,7 @@ namespace XFX
|
||||
|
||||
Texture2D* VideoPlayer::GetTexture()
|
||||
{
|
||||
// TODO: return current video frame
|
||||
}
|
||||
|
||||
void VideoPlayer::Pause()
|
||||
@ -72,6 +74,7 @@ namespace XFX
|
||||
|
||||
void VideoPlayer::Play(Video * const video)
|
||||
{
|
||||
sassert(video != null, String::Format("value; %s", FrameworkResources::ArgumentNull_Generic));
|
||||
}
|
||||
|
||||
void VideoPlayer::Resume()
|
||||
|
@ -25,23 +25,26 @@
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#include <Graphics/Viewport.h>
|
||||
#include <System/String.h>
|
||||
#include <Matrix.h>
|
||||
#include <Rectangle.h>
|
||||
#include <System/String.h>
|
||||
#include <System/Type.h>
|
||||
#include <Vector3.h>
|
||||
#include <Graphics/Viewport.h>
|
||||
|
||||
namespace XFX
|
||||
{
|
||||
namespace Graphics
|
||||
{
|
||||
const Type ViewportTypeInfo("Viewport", "XFX::Graphics::Viewport", TypeCode::Object);
|
||||
|
||||
float Viewport::getAspectRatio() const
|
||||
{
|
||||
if ((Height != 0) && (Width != 0))
|
||||
{
|
||||
return (((float)Width) / ((float)Height));
|
||||
}
|
||||
return 0.0f;
|
||||
{
|
||||
return (((float)Width) / ((float)Height));
|
||||
}
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
Rectangle Viewport::getBounds() const
|
||||
@ -99,8 +102,9 @@ namespace XFX
|
||||
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
|
||||
|
@ -1,3 +1,9 @@
|
||||
/*****************************************************************************
|
||||
* XNBFile.h *
|
||||
* *
|
||||
* XNA Binary Resource file header definition *
|
||||
* Copyright (c) XFX Team. All rights reserved *
|
||||
*****************************************************************************/
|
||||
#ifndef _XNBFILE_
|
||||
#define _XNBFILE_
|
||||
|
||||
@ -9,6 +15,9 @@ namespace XFX
|
||||
{
|
||||
namespace Content
|
||||
{
|
||||
/**
|
||||
* Represents the header of an *.xnb file
|
||||
*/
|
||||
struct XNBFile
|
||||
{
|
||||
byte FormatID1;
|
||||
|
@ -119,6 +119,7 @@
|
||||
<ClCompile Include="VertexPositionColor.cpp" />
|
||||
<ClCompile Include="VertexPositionNormalTexture.cpp" />
|
||||
<ClCompile Include="VertexPositionTexture.cpp" />
|
||||
<ClCompile Include="Video.cpp" />
|
||||
<ClCompile Include="Viewport.cpp" />
|
||||
<ClCompile Include="GamePad.cpp" />
|
||||
<ClCompile Include="Keyboard.cpp" />
|
||||
@ -242,6 +243,7 @@
|
||||
<ClInclude Include="BlendState.cpp" />
|
||||
<ClInclude Include="Enums.h" />
|
||||
<ClInclude Include="ModelReader.h" />
|
||||
<ClInclude Include="StorageDeviceAsyncResult.h" />
|
||||
<ClInclude Include="Texture2DReader.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
@ -206,9 +206,6 @@
|
||||
<ClCompile Include="Guide.cpp">
|
||||
<Filter>Source Files\GamerServices</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="StorageDeviceAsyncResult.cpp">
|
||||
<Filter>Source Files\GamerServices</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="PacketReader.cpp">
|
||||
<Filter>Source Files\Net</Filter>
|
||||
</ClCompile>
|
||||
@ -236,6 +233,12 @@
|
||||
<ClCompile Include="Model.cpp">
|
||||
<Filter>Source Files\Graphics</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Video.cpp">
|
||||
<Filter>Source Files\Media</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="StorageDeviceAsyncResult.cpp">
|
||||
<Filter>Source Files\Storage</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\include\BoundingBox.h">
|
||||
@ -568,6 +571,9 @@
|
||||
<ClInclude Include="..\..\include\Graphics\ModelMeshPartCollection.h">
|
||||
<Filter>Header Files\Graphics</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="StorageDeviceAsyncResult.h">
|
||||
<Filter>Source Files\Storage</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="makefile" />
|
||||
|
Loading…
x
Reference in New Issue
Block a user