+++ /dev/null
-# ignore built files
-build/*
-Littlest.xcodeproj/*.pbxuser
-Littlest.xcodeproj/*.mode1v3
+++ /dev/null
-#pragma once\r
-\r
-#if defined(DEBUG)\r
-\r
-#include <assert.h>\r
-#include <stdbool.h>\r
-#include <signal.h>\r
-#include <sys/types.h>\r
-#include <sys/sysctl.h>\r
-#include <unistd.h>\r
-\r
-#include "GlobalDefines.h"\r
-\r
-#if defined(__WINDOWS__)\r
-\r
- #define Assert(expression) if (!(expression)) __debugbreak();\r
-\r
-#elif defined(__iOS__)\r
-\r
- // Returns true if the current process is being debugged (either\r
- // running under the debugger or has a debugger attached post facto).\r
- static bool AmIBeingDebugged(void)\r
- {\r
- int junk;\r
- int mib[4];\r
- struct kinfo_proc info;\r
- size_t size;\r
-\r
- // Initialize the flags so that, if sysctl fails for some bizarre\r
- // reason, we get a predictable result.\r
- info.kp_proc.p_flag = 0;\r
-\r
- // Initialize mib, which tells sysctl the info we want, in this case\r
- // we're looking for information about a specific process ID.\r
- mib[0] = CTL_KERN;\r
- mib[1] = KERN_PROC;\r
- mib[2] = KERN_PROC_PID;\r
- mib[3] = getpid();\r
-\r
- // Call sysctl.\r
- size = sizeof(info);\r
- junk = sysctl(mib, sizeof(mib) / sizeof(*mib), &info, &size, NULL, 0);\r
- assert(junk == 0);\r
-\r
- // We're being debugged if the P_TRACED flag is set.\r
- return ( (info.kp_proc.p_flag & P_TRACED) != 0 );\r
- }\r
-\r
- // http://iphone.m20.nl/wp/?p=1#more-1\r
- //#define DEBUGSTOP(signal) __asm__ __volatile__ ("mov r0, %0\nmov r1, %1\nmov r12, #37\nswi 128\n" : : "r" (getpid ()), "r" (signal) : "r12", "r0", "r1", "cc");\r
- //#define DEBUGGER do { int trapSignal = AmIBeingDebugged () ? SIGINT : SIGSTOP; DEBUGSTOP(trapSignal); if (trapSignal == SIGSTOP) { DEBUGSTOP (SIGINT); } } while (false);\r
-\r
- // Graciously copied from http://cocoawithlove.com/2008/03/break-into-debugger.html\r
- #define DebugBreak() if (AmIBeingDebugged()) { DebugBreak(); }\r
-\r
- #define Assert(expression) if (!(expression)) raise(SIGTRAP);\r
-\r
-#endif\r
-\r
-#define AssertMessage(expression, message, ...) \\r
- if (!(expression)) Printf(message, ##__VA_ARGS__)\r
-\r
-#else\r
-\r
-// Note that the expression is still evaluated, since we declared this as an inlined function, rather than a macro.\r
-slInline void Assert(bool expression) {}\r
-slInline void AssertMsg(bool expression, char* msg, ...) {}\r
-\r
-#endif\r
+++ /dev/null
-#pragma once\r
-\r
-namespace Foundation\r
-{\r
- class CBase\r
- {\r
- public:\r
- CBase() {}\r
- ~CBase() {}\r
- };\r
-}\r
+++ /dev/null
-#pragma once\r
-\r
-#include "Foundation/Common/GlobalTypes.h"\r
-\r
-//----------------------------------------------------------------------------------------\r
-// OS and CPU architecture defines\r
-#if defined(_WINDOWS)\r
- #define __WINDOWS__\r
- #define __X86__\r
-#elif defined(__iOS__)\r
- #include <TargetConditionals.h>\r
- #if TARGET_IPHONE_SIMULATOR\r
- #define __X86__\r
- #elif TARGET_OS_IPHONE\r
- #define __ARM__\r
- #else\r
- #error undefined architecture!\r
- #endif\r
-#endif\r
-\r
-//----------------------------------------------------------------------------------------\r
-// configuration defines\r
-#if defined(_DEBUG) && !defined(DEBUG)\r
- #define DEBUG\r
-#endif\r
-\r
-#if defined(_NDEBUG) && !defined(RELEASE)\r
- #define RELEASE\r
-#endif\r
-\r
-//----------------------------------------------------------------------------------------\r
-// some type defines that may or may not be defined already?\r
-#if !defined(NULL)\r
- #define NULL 0\r
-#endif\r
-\r
-#if !defined(FALSE)\r
- #define FALSE 0\r
-#endif\r
-\r
-#if !defined(TRUE)\r
- #define TRUE 1\r
-#endif\r
-\r
-//----------------------------------------------------------------------------------------\r
-// cache information\r
-#if !defined(CACHE_LINE_SIZE)\r
- #if defined(__X86__)\r
- #define CACHE_LINE_SIZE 128 // normally equals to 2 lines for intel\r
- #elif defined(__ARM__)\r
- #define CACHE_LINE_SIZE 32\r
- #else\r
- #define CACHE_LINE_SIZE 32\r
- #endif\r
-#endif\r
-\r
-//----------------------------------------------------------------------------------------\r
-// force inline on non-debug, might make code explode\r
-#if defined(DEBUG)\r
- #define slInline inline\r
-#else\r
- #define slInline __forceinline\r
-#endif\r
-\r
-// compiler determined inline\r
-#define clInline inline\r
-\r
-#define slRestrict __restrict\r
-\r
-//----------------------------------------------------------------------------------------\r
-// alignment macros\r
-#if defined(__WINDOWS__)\r
-#define MEM_ALIGN(N) __declspec(align(N))\r
-#elif defined(__iOS__)\r
-#define MEM_ALIGN(N) __attribute__((aligned (N)))\r
-#endif\r
-\r
-#define IS_POWER_OF_TWO(x) ( ((x) & -(x)) == (x) )\r
-\r
-//#pragma warning(disable:4146) // =(\r
-#define ALIGN_UP(x, ALIGNMENT) ( ((x) + (ALIGNMENT) - 1) & -(ALIGNMENT) )\r
-#define ALIGN_DOWN(x, ALIGNMENT) ( (x) & -(ALIGNMENT) )\r
-\r
-#define POWER_OF_TWO_MOD(x, N) ( (x) & ((N) - 1) )\r
-\r
-#define ALIGN_CACHE ( ALIGN( CACHE_LINE_SIZE ) )\r
-\r
-//----------------------------------------------------------------------------------------\r
-// cache macros\r
-#if defined(__X86__)\r
-// uhh, nothing?\r
-#elif defined(__ARM__)\r
-#define DCBT(x) __asm__("pld %[input]" : : [input] "r" ((x)))\r
-#else\r
-#error Not implemented yet!\r
-#endif\r
-\r
-//----------------------------------------------------------------------------------------\r
-// string and memory functions\r
-#if defined(__WINDOWS__)\r
- #pragma intrinsic(memcpy)\r
- #pragma intrinsic(memset)\r
- #pragma intrinsic(strcmp)\r
- #pragma intrinsic(strcpy)\r
- #pragma intrinsic(strlen)\r
- #pragma intrinsic(strcat)\r
-#endif\r
-\r
-//----------------------------------------------------------------------------------------\r
-// color constants...this probably needs to consider endianness?\r
-#define NULL_COLOR 0x00000000\r
-#define BLACK_COLOR 0x000000ff\r
-#define RED_COLOR 0xff0000ff\r
-#define GREEN_COLOR 0x00ff00ff\r
-#define BLUE_COLOR 0x0000ffff\r
-#define WHITE_COLOR 0xffffffff\r
-\r
-//----------------------------------------------------------------------------------------\r
-// some intrinsic/asm/fast stuff stuffs -- maybe this should be moved to another file\r
-#define RightMostEnabledBit(x) ((x) & -(x))\r
-\r
-\r
-#if defined(__ARM__)\r
-\r
-slInline uint8_t LZCount(uint64_t x)\r
-{\r
- uint8_t result;\r
- __asm__("clz %[result] %[input]" : [result] "=r" (result) : [input] "r" (x));\r
- return result;\r
-}\r
-\r
-#else\r
-\r
-slInline uint8_t LZCount(uint64_t x)\r
-{\r
- uint8_t leading_zero_count = 0;\r
- uint8_t next_shift = 32;\r
- uint64_t copy = x;\r
- while (next_shift != 0)\r
- {\r
- bool non_zero = copy >= (0x1ULL << next_shift);\r
- uint8_t actual_shift = (uint8_t)non_zero * next_shift;\r
- leading_zero_count += actual_shift;\r
- copy >>= actual_shift;\r
- next_shift >>= 1;\r
- }\r
- leading_zero_count += (copy == 0x1ULL);\r
- \r
- return leading_zero_count;\r
-}\r
-\r
-#endif\r
+++ /dev/null
-#pragma once\r
-\r
-#include <string.h>\r
-#include "GlobalDefines.h"\r
-#include "GlobalTypes.h"\r
-#include "Assert.h"\r
-#include "Print.h"\r
+++ /dev/null
-#pragma once\r
-\r
-#if defined(uint32_t)\r
-#undef uint32_t\r
-#endif\r
-\r
-typedef signed char int8_t;\r
-typedef unsigned char uint8_t;\r
-typedef short int16_t;\r
-typedef unsigned short uint16_t;\r
-typedef int int32_t;\r
-typedef unsigned int uint32_t;\r
-typedef long long int64_t;\r
-typedef unsigned long long uint64_t;\r
-typedef uint32_t color32_t;\r
-\r
-union IntFloat\r
-{\r
- int8_t m_Int8[4];\r
- uint8_t m_UInt8[4];\r
- int16_t m_Int16[2];\r
- uint16_t m_UInt16[2];\r
- int32_t m_Int32;\r
- uint32_t m_UInt32;\r
- float m_Float;\r
-};\r
-\r
-union LongDouble\r
-{\r
- int8_t m_Int8[8];\r
- uint8_t m_UInt8[8];\r
- int16_t m_Int16[4];\r
- uint16_t m_UInt16[4];\r
- int32_t m_Int32[2];\r
- uint32_t m_UInt32[2];\r
- int64_t m_Int64;\r
- uint64_t m_UInt64;\r
- float m_Float[2];\r
- double m_Double;\r
-};\r
+++ /dev/null
-#pragma once\r
-\r
-#include "GlobalDefines.h"\r
-#include <stdio.h>\r
-\r
-#if defined(DEBUG)\r
- #define Printf(message, ...) printf(message, ##__VA_ARGS__)\r
-#else\r
- #define Printf(message, ...) {}\r
-#endif\r
+++ /dev/null
-#pragma once\r
-\r
-#include "Foundation/Common/GlobalInclude.h"\r
-\r
-//----------------------------------------------------------------------------------------\r
-namespace Foundation\r
-{\r
-\r
-template <typename T> \r
-class Singleton\r
-{\r
-private:\r
- static T* m_Instance; \r
-\r
-protected:\r
- Singleton() { m_Instance = NULL; }\r
-\r
-public:\r
- static T* Init()\r
- {\r
- Assert( m_Instance == NULL);\r
- m_Instance = new (16) T();\r
- return m_Instance;\r
- }\r
-\r
- slInline static T* GetInstance()\r
- {\r
- return m_Instance;\r
- }\r
-\r
- static void DestroyInstance()\r
- {\r
- if ( m_Instance )\r
- {\r
- delete m_Instance;\r
- }\r
- }\r
-};\r
-\r
-template<typename T> T* Singleton<T>::m_Instance = NULL;\r
-\r
-}\r
+++ /dev/null
-#pragma once\r
-\r
-#include "Foundation/Common/GlobalInclude.h"\r
-\r
-#define SET_BITS(x, new_val, shift, mask) ((x) = (((x) & ~(mask)) | (((new_val) << (shift)) & (mask))))\r
-#define ZERO_BITS(x, mask) ((x) &= ~(mask))\r
-#define OR_BITS (x, new_val, shift, mask) ((x) |= (((new_val) << (shift)) & (mask)))\r
-#define AND_BITS(x, new_val, shift, mask) ((x) &= (((new_val) << (shift)) & (mask)))\r
-#define GET_BITS(x, mask) ((x) & (mask))\r
-#define GET_BITS_RIGHT(x, shift, mask) (((x) & (mask)) >> (shift))\r
+++ /dev/null
-#include "LocklessRingBuffer.h"\r
-#include "Foundation/Synchronization/MemorySync.h"\r
-\r
-//----------------------------------------------------------------------------------------\r
-void LocklessRingBuffer::Init(void* buffer, uint32_t buffer_size)\r
-{\r
- m_Base = (uint8_t*)buffer;\r
- m_BufferSize = buffer_size;\r
- m_WriteOffset = 0;\r
- m_ReadOffset = 0;\r
-}\r
-\r
-//----------------------------------------------------------------------------------------\r
-void LocklessRingBuffer::Destroy()\r
-{\r
- m_Base = NULL;\r
- m_BufferSize = 0;\r
- m_WriteOffset = 0;\r
- m_ReadOffset = 0;\r
-}\r
-\r
-//----------------------------------------------------------------------------------------\r
-bool LocklessRingBuffer::Write(void* entry, uint32_t entry_size)\r
-{\r
- Assert(entry_size < m_BufferSize);\r
-\r
- uint32_t new_write_offset = m_WriteOffset;\r
- uint32_t remaining_space = m_WriteOffset < m_ReadOffset ? m_ReadOffset - m_WriteOffset - 1 : m_ReadOffset + m_BufferSize - m_WriteOffset;\r
- if (remaining_space < entry_size)\r
- {\r
- return false;\r
- }\r
-\r
- bool write_will_end_lower = new_write_offset + entry_size >= m_BufferSize;\r
-\r
- uint32_t distance_to_top = (entry_size > m_BufferSize - new_write_offset) ? (m_BufferSize - new_write_offset) : entry_size;\r
- memcpy(m_Base + new_write_offset, entry, distance_to_top);\r
- new_write_offset += distance_to_top;\r
-\r
- if (write_will_end_lower)\r
- {\r
- uint32_t remainder = entry_size - distance_to_top;\r
- memcpy(m_Base, (uint8_t*)entry + distance_to_top, remainder);\r
- new_write_offset = remainder;\r
- }\r
-\r
- ReadWriteSync();\r
-\r
- m_WriteOffset = new_write_offset;\r
- return true;\r
-}\r
-\r
-//----------------------------------------------------------------------------------------\r
-bool LocklessRingBuffer::Write(void* entries[], uint32_t entry_sizes[], uint32_t entry_count)\r
-{\r
- uint32_t total_size = 0;\r
- for (uint32_t i = 0; i < entry_count; i++)\r
- {\r
- total_size += entry_sizes[i];\r
- }\r
-\r
- Assert(total_size < m_BufferSize);\r
-\r
- uint32_t new_write_offset = m_WriteOffset;\r
- uint32_t remaining_space = m_WriteOffset < m_ReadOffset ? m_ReadOffset - m_WriteOffset - 1 : m_ReadOffset + m_BufferSize - m_WriteOffset;\r
- if (remaining_space < total_size)\r
- {\r
- return false;\r
- }\r
-\r
- for (uint32_t i = 0; i < entry_count; i++)\r
- {\r
- bool write_will_end_lower = new_write_offset + entry_sizes[i] >= m_BufferSize;\r
- uint32_t distance_to_top = (entry_sizes[i] > m_BufferSize - new_write_offset) ? (m_BufferSize - new_write_offset) : entry_sizes[i];\r
- memcpy(m_Base + new_write_offset, entries[i], distance_to_top);\r
- new_write_offset += distance_to_top;\r
-\r
- if (write_will_end_lower)\r
- {\r
- uint32_t remainder = entry_sizes[i] - distance_to_top;\r
- memcpy(m_Base, (uint8_t*)entries[i] + distance_to_top, remainder);\r
- new_write_offset = remainder;\r
- }\r
- }\r
-\r
- ReadWriteSync();\r
-\r
- m_WriteOffset = new_write_offset;\r
- return true;\r
-}\r
-\r
-//----------------------------------------------------------------------------------------\r
-bool LocklessRingBuffer::Peek(void* read_buffer, uint32_t read_size)\r
-{\r
- uint32_t read_remaining = m_WriteOffset < m_ReadOffset ? m_BufferSize - m_ReadOffset + m_WriteOffset : m_WriteOffset - m_ReadOffset;\r
- if (read_remaining < read_size)\r
- {\r
- return false;\r
- }\r
-\r
- uint32_t read_to_top = m_BufferSize - m_ReadOffset <= read_size ? m_BufferSize - m_ReadOffset : read_size;\r
- memcpy(read_buffer, m_Base + m_ReadOffset, read_to_top);\r
- if (m_BufferSize - m_ReadOffset <= read_size)\r
- {\r
- memcpy((uint8_t*)read_buffer + read_to_top, m_Base, read_remaining - read_to_top);\r
- }\r
-\r
- return true;\r
-}\r
-\r
-//----------------------------------------------------------------------------------------\r
-bool LocklessRingBuffer::Read(void* read_buffer, uint32_t read_size)\r
-{\r
- uint32_t read_remaining = m_WriteOffset < m_ReadOffset ? m_BufferSize - m_ReadOffset + m_WriteOffset : m_WriteOffset - m_ReadOffset;\r
- if (read_remaining < read_size)\r
- {\r
- return false;\r
- }\r
-\r
- uint32_t read_to_top = m_BufferSize - m_ReadOffset <= read_size ? m_BufferSize - m_ReadOffset : read_size;\r
- memcpy(read_buffer, m_Base + m_ReadOffset, read_to_top);\r
- uint32_t new_read_offset = m_ReadOffset + read_to_top;\r
-\r
- if (m_BufferSize - m_ReadOffset <= read_size)\r
- {\r
- memcpy((uint8_t*)read_buffer + read_to_top, m_Base, read_remaining - read_to_top);\r
- new_read_offset = read_remaining - read_to_top;\r
- }\r
-\r
- ReadWriteSync();\r
-\r
- m_ReadOffset = new_read_offset;\r
-\r
- return true;\r
-}\r
-\r
-//----------------------------------------------------------------------------------------\r
-bool LocklessRingBuffer::ReadDiscard(uint32_t read_size)\r
-{\r
- uint32_t read_remaining = m_WriteOffset < m_ReadOffset ? m_BufferSize - m_ReadOffset + m_WriteOffset : m_WriteOffset - m_ReadOffset;\r
- if (read_remaining < read_size)\r
- {\r
- return false;\r
- }\r
-\r
- uint32_t read_to_top = m_BufferSize - m_ReadOffset <= read_size ? m_BufferSize - m_ReadOffset : read_size;\r
- uint32_t new_read_offset = m_ReadOffset + read_to_top;\r
-\r
- if (m_BufferSize - m_ReadOffset <= read_size)\r
- {\r
- new_read_offset = read_remaining - read_to_top;\r
- }\r
-\r
- ReadWriteSync();\r
-\r
- m_ReadOffset = new_read_offset;\r
-\r
- return true;\r
-}\r
+++ /dev/null
-#pragma once\r
-\r
-#include "Foundation/Common/GlobalInclude.h"\r
-\r
-class LocklessRingBuffer\r
-{\r
-private:\r
- uint8_t* m_Base;\r
- uint32_t m_BufferSize;\r
- uint32_t m_WriteOffset;\r
- uint32_t m_ReadOffset;\r
-\r
-public:\r
- void Init(void* buffer, uint32_t buffer_size);\r
- void Destroy();\r
-\r
- bool Write(void* entry, uint32_t entry_size);\r
- bool Write(void* entries[], uint32_t entry_sizes[], uint32_t entry_count);\r
-\r
- bool Peek(void* read_buffer, uint32_t read_size);\r
- bool Read(void* read_buffer, uint32_t read_size);\r
- bool ReadDiscard(uint32_t read_size);\r
-};\r
+++ /dev/null
-#pragma once
-
-#include "Foundation/Common/GlobalInclude.h"
-#include "Foundation/Math/MathInclude.h"
-
-//#include <OpenGLES/ES1/gl.h>
-#include <OpenGLES/ES2/gl.h>
-
-//----------------------------------------------------------------------------------------
-struct Basic2DPrimitive
-{
-protected:
- Basic2DPrimitive(); // Only the children classes can call this.
- ~Basic2DPrimitive();
-
- GLuint mVertexBuffer;
- uint16_t mX, mY;
-};
-
-//----------------------------------------------------------------------------------------
-struct Rectangle : public Basic2DPrimitive
-{
-public:
- GLuint mWidth, mHeight;
-
- Rectangle( uint16_t width, uint16_t height, uint16_t anchorX, uint16_t anchorY );
-};
+++ /dev/null
-#include "BasicPrimitives.h"
-
-//----------------------------------------------------------------------------------------
-Basic2DPrimitive::Basic2DPrimitive() : mVertexBuffer(0), mX(0), mY(0)
-{
- glGenBuffers( 1, &mVertexBuffer );
-}
-
-//----------------------------------------------------------------------------------------
-Basic2DPrimitive::~Basic2DPrimitive()
-{
- glDeleteBuffers( 1, &mVertexBuffer );
-}
-
-//----------------------------------------------------------------------------------------
-Rectangle::Rectangle( uint16_t width, uint16_t height, uint16_t anchorX, uint16_t anchorY ) : Basic2DPrimitive()
-{
- Assert( mVertexBuffer );
- glBindBuffer( GL_ARRAY_BUFFER, mVertexBuffer );
-
- mWidth = width;
- mHeight = height;
-
- uint16_t values[4 * 2] = {-anchorX, height + anchorY, -anchorX, };
- glBufferData( GL_ARRAY_BUFFER, 4 * 2 * sizeof(uint16_t), values, GL_STATIC_DRAW );
-}
+++ /dev/null
-#pragma once
-
-/*****************************************************************************************
- * This is a wrapper class around all OpenGL API calls in iOS. This completely abstracts
- * away all mixes between the OS-specific calls in Objective-C and the C-style inteface of
- * OpenGL.
- *
- * Since iPhone/iPad will be single/dual cores for the near-term future, we'll basically
- * only allow a single rendering context to exist at any given point in time. Therefore,
- * we should never need to set context other than during startup or shutdown.
- *****************************************************************************************/
-
-//#include <OpenGLES/ES1/gl.h>
-//#include <OpenGLES/ES1/glext.h>
-#include <OpenGLES/ES2/gl.h>
-#include <OpenGLES/ES2/glext.h>
-
-#include "Foundation/Common/GlobalInclude.h"
-
-//----------------------------------------------------------------------------------------
-// Some forward declarations
-@class EAGLContext;
-struct RenderTarget;
-
-//----------------------------------------------------------------------------------------
-// Some typedefs for handles. May want to move this to a separate file.
-typedef GLuint TextureHandle;
-
-//----------------------------------------------------------------------------------------
-// Complete C(++) OpenGL wrapper. We will use this to wrap
-class OpenGLServices
-{
-public:
- enum
- {
- kMaxTextureSize = 512 * 512 * 4,
- };
-
- OpenGLServices();
-
- bool init( EAGLContext* mainContext );
- void destroy();
-
- bool initScratchMem();
- void destroyScratchMem();
-
- bool setRenderTarget( RenderTarget& renderTarget );
- bool present( RenderTarget& renderTarget );
-
- TextureHandle loadPNGTexture( const char* fileName );
- void destroyTexture( TextureHandle texture );
-
-private:
- EAGLContext* mGLContext;
- void* mScratchMem;
-
- void setContext( EAGLContext* newContext );
-};
+++ /dev/null
-#import <QuartzCore/QuartzCore.h>
-#import <CoreGraphics/CoreGraphics.h>
-
-#include "OpenGLServices.h"
-#include "RenderTarget.h"
-
-//----------------------------------------------------------------------------------------
-OpenGLServices::OpenGLServices() : mGLContext(NULL), mScratchMem(NULL)
-{
-}
-
-//----------------------------------------------------------------------------------------
-bool OpenGLServices::init( EAGLContext* mainContext )
-{
- if ( mGLContext )
- {
- return false;
- }
-
- mGLContext = [mainContext retain];
- Assert( [EAGLContext setCurrentContext:mGLContext] );
-
- initScratchMem();
-
- // Enable some common states and set their parameters.
- glEnable( GL_TEXTURE_2D );
- glEnable( GL_BLEND );
- // We will premultiply alpha into the color channels of all textures (so no alpha animation).
- // This is basically the A over B alpha scheme.
- glBlendFunc( GL_ONE, GL_ONE_MINUS_SRC_ALPHA );
- glEnable( GL_DEPTH_TEST );
- glDepthFunc( GL_LEQUAL );
- glFrontFace( GL_CCW );
- glCullFace( GL_BACK );
-
- // Disable unused stuff.
- glDisable( GL_STENCIL_TEST );
- glDisable( GL_SCISSOR_TEST );
- glDisable( GL_DITHER );
-
- return true;
-}
-
-//----------------------------------------------------------------------------------------
-void OpenGLServices::destroy()
-{
- if ( !mGLContext )
- {
- return;
- }
-
- destroyScratchMem();
- [mGLContext release];
- [EAGLContext setCurrentContext:nil];
-}
-
-//----------------------------------------------------------------------------------------
-bool OpenGLServices::initScratchMem()
-{
- if (!mScratchMem)
- {
- mScratchMem = malloc( kMaxTextureSize );
- return mScratchMem != NULL;
- }
- return true;
-}
-
-//----------------------------------------------------------------------------------------
-void OpenGLServices::destroyScratchMem()
-{
- if (mScratchMem)
- {
- free( mScratchMem );
- mScratchMem = NULL;
- }
-}
-
-//----------------------------------------------------------------------------------------
-bool OpenGLServices::setRenderTarget( RenderTarget& renderTarget )
-{
- if (!renderTarget.getFramebuffer() || !glIsFramebuffer( renderTarget.getFramebuffer() ))
- {
- return false;
- }
-
- glBindFramebuffer( GL_FRAMEBUFFER, renderTarget.getFramebuffer() );
- return true;
-}
-
-//----------------------------------------------------------------------------------------
-bool OpenGLServices::present( RenderTarget& renderTarget )
-{
- GLuint colorBuffer = renderTarget.getColorBuffer();
- if (!colorBuffer || !glIsRenderbuffer( colorBuffer ))
- {
- return false;
- }
-
- glBindRenderbuffer( GL_RENDERBUFFER, colorBuffer );
- return [renderTarget.getContext() presentRenderbuffer:GL_RENDERBUFFER];
-}
-
-//----------------------------------------------------------------------------------------
-TextureHandle OpenGLServices::loadPNGTexture( const char* fileName )
-{
- GLuint textureHandle;
- glGenTextures( 1, &textureHandle );
- if (!textureHandle)
- {
- return textureHandle;
- }
-
- glBindTexture( GL_TEXTURE_2D, textureHandle );
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR );
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE );
-
- // http://iphonedevelopment.blogspot.com/2009/05/opengl-es-from-ground-up-part-6_25.html
- NSString* nsFileName = [NSString stringWithUTF8String:fileName];
- NSString* nsPath = [[NSBundle mainBundle] pathForResource:nsFileName ofType:@"png"];
- NSData* fileData = [[NSData alloc] initWithContentsOfFile:nsPath];
- UIImage* image = [[UIImage alloc] initWithData:fileData];
- AssertMessage( image != nil, "Image failed to load!\n" );
-
- GLuint width = CGImageGetWidth( image.CGImage );
- GLuint height = CGImageGetHeight( image.CGImage );
- CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
- Assert( width * height * 4 <= kMaxTextureSize );
- CGContextRef context = CGBitmapContextCreate( mScratchMem, width, height, 8, 4 * width, colorSpace, kCGImageAlphaPremultipliedLast | kCGBitmapByteOrder32Big );
- CGColorSpaceRelease( colorSpace );
- CGContextClearRect( context, CGRectMake( 0, 0, width, height ) );
- CGContextTranslateCTM( context, 0, 0 );
- CGContextDrawImage( context, CGRectMake( 0, 0, width, height ), image.CGImage );
-
- glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, mScratchMem );
- glGenerateMipmap( GL_TEXTURE_2D );
-
- CGContextRelease(context);
- [image release];
- [fileData release];
-
- return textureHandle;
-}
-
-//----------------------------------------------------------------------------------------
-void OpenGLServices::destroyTexture( TextureHandle texture )
-{
- glDeleteTextures( 1, &texture );
-}
-
-//----------------------------------------------------------------------------------------
-void OpenGLServices::setContext( EAGLContext* newContext )
-{
- if (mGLContext != newContext)
- {
- mGLContext = newContext;
- [EAGLContext setCurrentContext:newContext];
- }
-}
+++ /dev/null
-#pragma once
-
-#include <OpenGLES/ES1/gl.h>
-#include <OpenGLES/ES1/glext.h>
-#include <OpenGLES/ES2/gl.h>
-#include <OpenGLES/ES2/glext.h>
-
-#include "Foundation/Common/GlobalInclude.h"
-
-@class EAGLContext;
-@class CAEAGLLayer;
-
-//----------------------------------------------------------------------------------------
-struct RenderTargetInitParams
-{
- RenderTargetInitParams();
-
- EAGLContext* mContext;
- CAEAGLLayer* mCALayer;
-
- // Width and height of color vs. depth buffers have to be the same. We don't resize in iOS.
- int32_t mBufferWidth;
- int32_t mBufferHeight;
-
- GLenum mColorFormat;
- GLenum mDepthStencilFormat;
-
- uint32_t mFlags;
-};
-
-//----------------------------------------------------------------------------------------
-class RenderTarget
-{
-public:
- enum RenderTargetFlags
- {
- kSystemFramebuffer = 0x1 << 0,
- };
-
- const static uint32_t MAX_RENDER_BUFFERS = 2;
-
- RenderTarget();
- ~RenderTarget();
-
- bool init( RenderTargetInitParams& params );
- void destroy();
-
- EAGLContext* getContext() const { return mContext; }
- uint32_t getWidth() const { return mRenderBufferWidth; }
- uint32_t getHeight() const { return mRenderBufferHeight; }
- GLuint getFramebuffer() const { return mFramebuffer; }
- GLuint getColorBuffer() const { return mColorBuffer; }
-
-protected:
- EAGLContext* mContext;
- GLuint mFramebuffer;
-
- GLuint mColorBuffer;
- GLuint mDepthStencilBuffer;
-
- int32_t mRenderBufferWidth;
- int32_t mRenderBufferHeight;
-
- uint32_t mFlags;
-};
+++ /dev/null
-#include "RenderTarget.h"
-
-#import <QuartzCore/QuartzCore.h>
-
-//----------------------------------------------------------------------------------------
-RenderTargetInitParams::RenderTargetInitParams() : mContext(NULL),
- mCALayer(NULL),
- mBufferWidth(0),
- mBufferHeight(0),
- mColorFormat(GL_NONE),
- mDepthStencilFormat(GL_NONE),
- mFlags(0)
-{
-}
-
-//----------------------------------------------------------------------------------------
-RenderTarget::RenderTarget() : mContext(NULL),
- mFramebuffer(0),
- mColorBuffer(0),
- mDepthStencilBuffer(0),
- mRenderBufferWidth(0),
- mRenderBufferHeight(0),
- mFlags(0)
-{
-};
-
-//----------------------------------------------------------------------------------------
-RenderTarget::~RenderTarget()
-{
- if ( mFramebuffer )
- {
- AssertMessage( !mFramebuffer, "RenderTarget has not been destroyed yet!" );
- destroy();
- }
- else
- {
- mContext = NULL;
- mFramebuffer = 0;
- mColorBuffer = 0;
- mDepthStencilBuffer = 0;
- mRenderBufferWidth = 0;
- mRenderBufferHeight = 0;
- mFlags = 0;
- }
-};
-
-//----------------------------------------------------------------------------------------
-bool RenderTarget::init( RenderTargetInitParams& params )
-{
- if (mFramebuffer)
- {
- AssertMessage( 0, "RenderTarget already initialized.\n" );
- return false;
- }
-
- mContext = params.mContext;
- AssertMessage( mContext, "Invalid context provided.\n" );
-
- // Set the context first.
- [EAGLContext setCurrentContext:mContext];
-
- mRenderBufferWidth = params.mBufferWidth;
- mRenderBufferHeight = params.mBufferHeight;
-
- if (params.mFlags & kSystemFramebuffer)
- {
- [mContext renderbufferStorage:GL_RENDERBUFFER fromDrawable:params.mCALayer];
- glGetRenderbufferParameteriv( GL_RENDERBUFFER, GL_RENDERBUFFER_WIDTH, &mRenderBufferWidth );
- glGetRenderbufferParameteriv( GL_RENDERBUFFER, GL_RENDERBUFFER_HEIGHT, &mRenderBufferHeight );
- }
- else
- {
- if (params.mColorFormat != GL_NONE)
- {
- glGenRenderbuffers( 1, &mColorBuffer );
- Assert( mColorBuffer );
- glBindRenderbuffer( GL_RENDERBUFFER, mColorBuffer );
- glRenderbufferStorage( GL_RENDERBUFFER, params.mColorFormat, mRenderBufferWidth, mRenderBufferHeight );
- }
- }
-
- if (params.mDepthStencilFormat != GL_NONE)
- {
- // If a depth/stencil buffer is needed, we'll create one with the same dimensions as the color buffer.
- glGenRenderbuffers( 1, &mDepthStencilBuffer );
- Assert( mDepthStencilBuffer );
- glBindRenderbuffer( GL_RENDERBUFFER, mDepthStencilBuffer );
- glRenderbufferStorage( GL_RENDERBUFFER, params.mDepthStencilFormat, mRenderBufferWidth, mRenderBufferHeight );
- }
-
- if (mColorBuffer || mDepthStencilBuffer)
- {
- // Create framebuffer object.
- glGenFramebuffers( 1, &mFramebuffer );
- glBindFramebuffer( GL_FRAMEBUFFER, mFramebuffer );
-
- if (mColorBuffer)
- {
- glFramebufferRenderbuffer( GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, mColorBuffer );
- }
-
- if (mDepthStencilBuffer)
- {
- glFramebufferRenderbuffer( GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, mDepthStencilBuffer );
- }
-
- AssertMessage( glCheckFramebufferStatus(GL_FRAMEBUFFER) == GL_FRAMEBUFFER_COMPLETE, "Failed to make complete framebuffer object: %x", glCheckFramebufferStatus(GL_FRAMEBUFFER) );
- }
- else
- {
- return false;
- }
-
-
- return true;
-}
-
-//----------------------------------------------------------------------------------------
-void RenderTarget::destroy()
-{
- if (!mContext)
- {
- return;
- }
-
- [EAGLContext setCurrentContext:mContext];
-
- if (mColorBuffer && glIsRenderbuffer(mColorBuffer))
- {
- glDeleteRenderbuffers( 1, &mColorBuffer );
- }
-
- if (mDepthStencilBuffer && glIsRenderbuffer(mDepthStencilBuffer))
- {
- glDeleteRenderbuffers( 1, &mDepthStencilBuffer );
- }
-
- if (mFramebuffer)
- {
- glDeleteFramebuffers( 1, &mFramebuffer );
- }
-
- mContext = NULL;
- mFramebuffer = 0;
- mColorBuffer = 0;
- mDepthStencilBuffer = 0;
- mRenderBufferWidth = 0;
- mRenderBufferHeight = 0;
- mFlags = 0;
-}
+++ /dev/null
-#pragma once\r
-\r
-#include "Foundation/Common/GlobalInclude.h"\r
-\r
-//----------------------------------------------------------------------------------------\r
-// djb2 string hash function\r
-static slInline uint32_t StrHash(const char* str)\r
-{\r
- uint32_t hash = 5381; // seed value\r
- int32_t c = *str;\r
-\r
- if(!str)\r
- {\r
- Assert(false);\r
- return 0;\r
- }\r
-\r
- while ( (*str != 0) )\r
- {\r
- hash = ((hash << 5) + hash) + c; /* hash * 33 + c == ((hash * 32) + hash) + c */\r
- c = *(str++);\r
- }\r
-\r
- return hash; \r
-}
\ No newline at end of file
+++ /dev/null
-#pragma once\r
-\r
-#define kEpsilon 1e-6\r
-#define kSqrtEpsilon 1e-3\r
-\r
-#define kPi 3.1415926535897932384626433832795\r
-#define kPi_2 1.5707963267948966192313216916398\r
-#define kPi_3 1.0471975511965977461542144610932\r
-#define kPi_4 0.78539816339744830961566084581988\r
-#define k2Pi_3 2.0943951023931954923084289221863\r
-#define k3Pi_4 2.3561944901923449288469825374596\r
-#define k2Pi 6.283185307179586476925286766559\r
-\r
-#define kE 2.7182818284590452353602874713527\r
+++ /dev/null
-#pragma once\r
-\r
-#include "Foundation/Math/MathDefines.h"\r
-#include "Foundation/Math/MathOperations.h"\r
-#include "Foundation/Math/MathTypes.h"\r
-#include "Foundation/Math/Vector.h"\r
-#include "Foundation/Math/Quaternion.h"\r
-#include "Foundation/Math/Matrix.h"\r
+++ /dev/null
-#pragma once\r
-\r
-#include <math.h>\r
-#include "Foundation/Common/GlobalInclude.h"\r
-\r
-#if defined(__WINDOWS__)\r
-\r
-#pragma intrinsic(sin)\r
-#pragma intrinsic(cos)\r
-#pragma intrinsic(tan)\r
-#pragma intrinsic(abs)\r
-#pragma intrinsic(fabs)\r
-#pragma intrinsic(asin)\r
-#pragma intrinsic(acos)\r
-#pragma intrinsic(atan)\r
-#pragma intrinsic(atan2)\r
-#pragma intrinsic(exp)\r
-#pragma intrinsic(sqrt)\r
-#pragma intrinsic(log)\r
-#pragma intrinsic(log10)\r
-\r
-#endif\r
-\r
-#define Sinf(x) sin(x)\r
-#define Cosf(x) cos(x)\r
-#define Tanf(x) tan(x)\r
-#define Sqrtf(x) sqrt(x)\r
-\r
-//----------------------------------------------------------------------------------------\r
-#define Min2(x, y) ( (x) <= (y) ? (x) : (y) )\r
-#define Max2(x, y) ( (x) >= (y) ? (x) : (y) )\r
-#define Min3(x, y, z) ( (x) <= (y) ? ((x) <= (z) ? (x) : (z)) : ((y) <= (z) ? (y) : (z)) )\r
-#define Max3(x, y, z) ( (x) >= (y) ? ((x) >= (z) ? (x) : (z)) : ((y) >= (z) ? (y) : (z)) )\r
-\r
-//----------------------------------------------------------------------------------------\r
-slInline float Absf(const float& f)\r
-{\r
- IntFloat int_float;\r
- int_float.m_Float = f;\r
- int_float.m_Int32 &= 0x7fffffff;\r
- return int_float.m_Float;\r
-}\r
-\r
-//----------------------------------------------------------------------------------------\r
-slInline bool EpsilonEquals(const float& a, const float& b, const float& epsilon)\r
-{\r
- return Absf(a - b) <= epsilon;\r
-}\r
-\r
-//----------------------------------------------------------------------------------------\r
-slInline uint16_t ConvertFloatToHalf( unsigned int f )\r
-{\r
- unsigned int s = f & 0x80000000;\r
- signed int e = ((f & 0x7f800000) >> 23) - (127 - 15);\r
- if (e < 0) return 0;\r
- else if (e > 31)\r
- {\r
- e = 31;\r
- }\r
- unsigned int fo = f & 0x7fffff;\r
- return (uint16_t)((s >> 16) | ((e << 10) & 0x7c00) | (fo >> 13));\r
-}\r
-\r
-//----------------------------------------------------------------------------------------\r
-slInline float ConvertHalfToFloat( unsigned short h )\r
-{\r
- unsigned int s = h & 0x8000;\r
- unsigned int e = ((h & 0x7c00) >> 10) - 15 + 127;\r
- unsigned int f = h & 0x3ff;\r
-\r
- IntFloat int_float;\r
- int_float.m_UInt32 = ((s << 16) | ((e << 23) & 0x7f800000) | (f << 13));\r
-\r
- return int_float.m_Float;\r
-}\r
+++ /dev/null
-#pragma once\r
-\r
-#include "Foundation/Common/GlobalInclude.h"\r
-#include "Foundation/Math/MathOperations.h"\r
-\r
-//----------------------------------------------------------------------------------------\r
-struct Vec2\r
-{\r
- float x;\r
- float y;\r
-\r
- slInline explicit Vec2() {}\r
- slInline explicit Vec2(const float xy) {x = xy; y = xy;}\r
- slInline explicit Vec2(const float ix, const float iy) {x = ix; y = iy;}\r
-\r
- slInline Vec2(const Vec2& v) {x = v.x; y = v.y;} // copy constructor\r
-\r
- slInline float* AsFloatArray() {return &x;}\r
- slInline const float* AsFloatArray() const {return &x;}\r
-\r
- slInline float GetComponent(int index) const {return AsFloatArray()[index];}\r
-};\r
-\r
-\r
-//----------------------------------------------------------------------------------------\r
-struct Vec3\r
-{\r
- float x;\r
- float y;\r
- float z;\r
-\r
- slInline explicit Vec3() {}\r
- slInline explicit Vec3(const float xyz) {x = xyz; y = xyz; z = xyz;}\r
- slInline explicit Vec3(const float ix, const float iy, const float iz) {x = ix; y = iy; z = iz;}\r
-\r
- slInline explicit Vec3(const Vec2& v, const float iz) {x = v.x; y = v.y; z = iz;}\r
-\r
- slInline Vec3(const Vec3& v) {x = v.x; y = v.y; z = v.z;} // copy constructor\r
-\r
- slInline Vec2 AsVec2() const {return Vec2(x, y);}\r
-\r
- slInline float* AsFloatArray() {return &x;}\r
- slInline const float* AsFloatArray() const {return &x;}\r
-\r
- slInline float GetComponent(int index) const {return AsFloatArray()[index];}\r
-};\r
-\r
-\r
-//----------------------------------------------------------------------------------------\r
-struct Vec4\r
-{\r
- float x;\r
- float y;\r
- float z;\r
- float w;\r
-\r
- slInline explicit Vec4() {}\r
- slInline explicit Vec4(const float xyzw) {x = xyzw; y = xyzw; z = xyzw; w = xyzw;}\r
- slInline explicit Vec4(const float xyz, const float iw) {x = xyz; y = xyz; z = xyz; w = iw;}\r
- slInline explicit Vec4(const float ix, const float iy, const float iz, const float iw) {x = ix; y = iy; z = iz; w = iw;}\r
-\r
- slInline explicit Vec4(const Vec2& u, const Vec2& v) {x = u.x; y = u.y; z = v.x; w = v.y;}\r
- slInline explicit Vec4(const Vec2& v, const float iz, const float iw) {x = v.x; y = v.y; z = iz; w = iw;}\r
-\r
- slInline explicit Vec4(const Vec3& v, const float iw) {x = v.x; y = v.y; z = v.z; w = iw;}\r
-\r
- slInline Vec4(const Vec4& v) {x = v.x; y = v.y; z = v.z; w = v.w;} // copy constructor\r
-\r
- slInline Vec2 AsVec2() const {return Vec2(x, y);}\r
- slInline Vec3 AsVec3() const {return Vec3(x, y, z);}\r
-\r
- slInline float* AsFloatArray() {return &x;}\r
- slInline const float* AsFloatArray() const {return &x;}\r
-\r
- slInline float GetComponent(int index) const {return AsFloatArray()[index];}\r
-};\r
-\r
-\r
-//----------------------------------------------------------------------------------------\r
-struct Quaternion\r
-{\r
- float i;\r
- float j;\r
- float k;\r
- float s;\r
-\r
- slInline explicit Quaternion() {}\r
- explicit Quaternion(const float angle, const Vec3& normalized_axis);\r
- explicit Quaternion(const float angle, const float x, const float y, const float z);\r
-\r
- slInline Quaternion(const Quaternion& q) {i = q.i; j = q.j; k = q.k; s = q.s;}\r
-\r
- Vec4 AsVec4();\r
- slInline float* AsFloatArray() {return &i;}\r
-\r
- Vec3 GetImaginary();\r
- slInline float GetReal() {return s;}\r
-};\r
-\r
-slInline Quaternion::Quaternion(const float angle, const Vec3& normalized_axis)\r
-{\r
- Assert( EpsilonEquals(normalized_axis.x * normalized_axis.x + normalized_axis.y * normalized_axis.y + normalized_axis.z * normalized_axis.z, 1.0f, kSqrtEpsilon) );\r
- float half_angle = angle * 0.5f;\r
- float sin_half_angle = (float)Sinf(half_angle);\r
- i = normalized_axis.x * sin_half_angle;\r
- j = normalized_axis.y * sin_half_angle;\r
- k = normalized_axis.z * sin_half_angle;\r
- s = (float)Cosf(half_angle);\r
-}\r
-\r
-slInline Quaternion::Quaternion(const float angle, const float x, const float y, const float z)\r
-{\r
- Assert( EpsilonEquals(x * x + y * y + z * z, 1.0f, kSqrtEpsilon) );\r
- float half_angle = angle * 0.5f;\r
- float sin_half_angle = (float)Sinf(half_angle);\r
- i = x * sin_half_angle;\r
- j = y * sin_half_angle;\r
- k = z * sin_half_angle;\r
- s = (float)Cosf(half_angle);\r
-}\r
-\r
-Vec4 Quaternion::AsVec4()\r
-{\r
- Vec4 r;\r
- r.x = i;\r
- r.y = j;\r
- r.z = k;\r
- r.w = s;\r
- return r;\r
-}\r
-\r
-Vec3 Quaternion::GetImaginary()\r
-{\r
- Vec3 r;\r
- r.x = i;\r
- r.y = j;\r
- r.z = k;\r
- return r;\r
-}\r
-\r
-\r
-//----------------------------------------------------------------------------------------\r
-struct Mat3\r
-{\r
- Vec3 v[3];\r
-\r
- slInline explicit Mat3() {}\r
- explicit Mat3(const Vec3& v0, const Vec3& v1, const Vec3& v2);\r
- explicit Mat3(const float v00, const float v01, const float v02,\r
- const float v10, const float v11, const float v12,\r
- const float v20, const float v21, const float v22);\r
- Mat3(const Mat3& m); // copy constructor\r
-\r
- float* AsFloatArray() {return &v[0].x;}\r
-};\r
-\r
-slInline Mat3::Mat3(const Vec3& v0, const Vec3& v1, const Vec3& v2)\r
-{\r
- v[0] = v0;\r
- v[1] = v1;\r
- v[2] = v2;\r
-}\r
-\r
-slInline Mat3::Mat3(const float v00, const float v01, const float v02, const float v10, const float v11, const float v12, const float v20, const float v21, const float v22)\r
-{\r
- v[0].x = v00; v[0].y = v01; v[0].z = v02;\r
- v[1].x = v10; v[1].y = v11; v[1].z = v12;\r
- v[2].x = v20; v[2].y = v21; v[2].z = v22;\r
-}\r
-\r
-slInline Mat3::Mat3(const Mat3& m)\r
-{\r
- v[0] = m.v[0];\r
- v[1] = m.v[1];\r
- v[2] = m.v[2];\r
-}\r
-\r
-\r
-//----------------------------------------------------------------------------------------\r
-struct Mat4\r
-{\r
- Vec4 v[4];\r
-\r
- slInline explicit Mat4() {}\r
- explicit Mat4(const Vec4& v0, const Vec4& v1, const Vec4& v2, const Vec4& v3);\r
- explicit Mat4(const float v00, const float v01, const float v02, const float v03,\r
- const float v10, const float v11, const float v12, const float v13,\r
- const float v20, const float v21, const float v22, const float v23,\r
- const float v30, const float v31, const float v32, const float v33);\r
- explicit Mat4(const Mat3& m);\r
- Mat4(const Mat4& m); // copy constructor\r
-\r
- float* AsFloatArray() {return &v[0].x;}\r
-};\r
-\r
-slInline Mat4::Mat4(const Vec4& v0, const Vec4& v1, const Vec4& v2, const Vec4& v3)\r
-{\r
- v[0] = v0;\r
- v[1] = v1;\r
- v[2] = v2;\r
- v[3] = v3;\r
-}\r
-\r
-slInline Mat4::Mat4(const float v00, const float v01, const float v02, const float v03, const float v10, const float v11, const float v12, const float v13, const float v20, const float v21, const float v22, const float v23, const float v30, const float v31, const float v32, const float v33)\r
-{\r
- v[0].x = v00; v[0].y = v01; v[0].z = v02; v[0].w = v03;\r
- v[1].x = v10; v[1].y = v11; v[1].z = v12; v[1].w = v13;\r
- v[2].x = v20; v[2].y = v21; v[2].z = v22; v[2].w = v23;\r
- v[3].x = v30; v[3].y = v31; v[3].z = v32; v[3].w = v33;\r
-}\r
-\r
-slInline Mat4::Mat4(const Mat3& m)\r
-{\r
- v[0].x = m.v[0].x; v[0].y = m.v[0].y; v[0].z = m.v[0].z; v[0].w = 0.0f;