Selaa lähdekoodia

Commit before move to x64

Marko Pintera 13 vuotta sitten
vanhempi
sitoutus
2dc16772b6

+ 3 - 0
CamelotRenderer/TODO.txt

@@ -16,6 +16,7 @@ High-level TODO:
 
 
 Command buffer TODO:
+ - Redo OpenGL shaders as they seem to be using pretty old methods (glCreateShaderObjectARB seems to be deprectated for example)
  - When importing a resource, and registering it with Resources I don't think it properly gets added to the loaded resources array? For some reason shaders get created twice.
  - My current approach doesn't allow multiple threads to use the RenderSystem (contexts should be handled differently)
    - Instead of requiring the user to constantly call setActiveContext, make the call peristent per thread. 
@@ -57,6 +58,7 @@ HIGH PRIORITY TODO:
  - HLSL & Cg don't handle include files yet
 
 Mid priority TODO:
+ - Resource handle should store a unique integer ID, which just points to a table of GUIDs. Keeping GUID string everywhere in not efficient.
  - Add a field that tracks % of resource deserialization in BinarySerializer
  - GpuProgram default parameters might not be needed. The parameters change with each use of the gpu program anyway
  - Mesh loading:
@@ -98,6 +100,7 @@ Optional TODO:
 After everything is polished
  - Get 64bit version working
  - DX11 render system
+ - How do I handle multiple mesh formats? Some files need animation, other don't. Some would mabye like to use QTangent, others the proper tangent frame.
  - Load texture mips separately so we can unload HQ textures from far away objects (like UE3)
  - Add Unified shader so I can easily switch between HLSL and GLSL shaders (they need same parameters usually, just different code)
     - Maybe just add support for Cg and force everyone to use that? - I'd like to be able to just switch out renderer in a single location and that everything keeps on working without 

+ 0 - 98
CamelotUtility/Include/CmTextureData.h

@@ -1,98 +0,0 @@
-#pragma once
-
-#include "CmPrerequisitesUtil.h"
-#include "CmPixelUtil.h"
-#include "CmIReflectable.h"
-
-namespace CamelotEngine
-{
-	enum TextureDataFlags
-	{
-		TDF_COMPRESSED = 0x00000001,
-		TDF_CUBEMAP    = 0x00000002,
-		TDF_3D_TEXTURE = 0x00000004
-	};
-
-	class CM_UTILITY_EXPORT TextureData : public IReflectable
-	{
-	public:
-		TextureData(UINT32 width, UINT32 height, UINT32 size, 
-			PixelFormat format, UINT8* data, UINT32 depth = 1, INT32 flags = 0, UINT32 numMipmaps = 1);
-		~TextureData();
-
-		/** Returns a pointer to the internal image buffer.
-		@remarks
-			Be careful with this method. You will almost certainly
-			prefer to use getPixels, especially with complex images
-			which include custom mipmaps.
-        */
-        UINT8* getData(void) { return mData; }
-
-        /** Returns a const pointer to the internal image buffer.
-		@remarks
-			Be careful with this method. You will almost certainly
-			prefer to use getPixels, especially with complex images
-			which include custom mipmaps.
-        */
-        const UINT8* getData() const { return mData; } 
-
-        /** Returns the size of the data buffer.
-        */
-		UINT32 getSize() const { return mSize; }
-
-        /** Returns the number of mipmaps contained in the image.
-        */
-		UINT32 getNumMipmaps() const { return mNumMipmaps; }
-
-        /** Returns true if the image has the appropriate flag set.
-        */
-		bool hasFlag(const TextureDataFlags flag) const { return (mFlags & flag) != 0; }
-
-        /** Gets the width of the image in pixels.
-        */
-        UINT32 getWidth(void) const { return mWidth; }
-
-        /** Gets the height of the image in pixels.
-        */
-        UINT32 getHeight(void) const { return mHeight; }
-
-        /** Gets the depth of the image.
-        */
-        UINT32 getDepth(void) const { return mDepth; }
-
-        /** Returns the image format.
-        */
-        PixelFormat getFormat() const { return mFormat; }
-
-        /** Returns the number of bits per pixel.
-        */
-        UINT8 getBPP() const { return mBPP; }
-
-        /** Returns true if the image has an alpha component.
-        */
-        bool getHasAlpha() const { return PixelUtil::getFlags(mFormat) & PFF_HASALPHA; }
-
-		PixelData getPixels(UINT32 mip);
-
-	private:
-		UINT32 mNumMipmaps;
-		UINT32 mWidth;
-		UINT32 mHeight;
-		UINT32 mSize;
-		UINT32 mDepth;
-		INT32 mFlags;
-		UINT8 mBPP;
-		PixelFormat mFormat;
-		UINT8* mData;
-
-	/************************************************************************/
-	/* 								SERIALIZATION                      		*/
-	/************************************************************************/
-	public:
-		friend class TextureDataRTTI;
-		static RTTITypeBase* getRTTIStatic();
-		virtual RTTITypeBase* getRTTI() const;
-	private:
-		TextureData() {} // Only for serialization
-	};
-}

+ 0 - 63
CamelotUtility/Include/CmTextureDataRTTI.h

@@ -1,63 +0,0 @@
-#pragma once
-
-#include "CmPrerequisitesUtil.h"
-#include "CmTextureData.h"
-#include "CmRTTIType.h"
-#include "CmManagedDataBlock.h"
-
-namespace CamelotEngine
-{
-	class CM_UTILITY_EXPORT TextureDataRTTI : public RTTIType<TextureData, IReflectable, TextureDataRTTI>
-	{
-		CM_SETGET_MEMBER(mNumMipmaps, UINT32, TextureData)
-		CM_SETGET_MEMBER(mWidth, UINT32, TextureData)
-		CM_SETGET_MEMBER(mHeight, UINT32, TextureData)
-		CM_SETGET_MEMBER(mSize, UINT32, TextureData)
-		CM_SETGET_MEMBER(mDepth, UINT32, TextureData)
-		CM_SETGET_MEMBER(mFlags, INT32, TextureData)
-		CM_SETGET_MEMBER(mBPP, UINT8, TextureData)
-		CM_SETGET_MEMBER(mFormat, PixelFormat, TextureData)
-
-		ManagedDataBlock getData(TextureData* obj) 
-		{
-			return ManagedDataBlock(obj->mData, obj->mSize, false);
-		}
-
-		void setData(TextureData* obj, ManagedDataBlock val) 
-		{ 
-			obj->mData = val.getData();
-			obj->mSize = val.getSize();
-		} 
-
-	public:
-		TextureDataRTTI()
-		{
-			CM_ADD_PLAINFIELD(mNumMipmaps, 0, TextureDataRTTI);
-			CM_ADD_PLAINFIELD(mWidth, 1, TextureDataRTTI);
-			CM_ADD_PLAINFIELD(mHeight, 2, TextureDataRTTI);
-			CM_ADD_PLAINFIELD(mSize, 3, TextureDataRTTI);
-			CM_ADD_PLAINFIELD(mDepth, 4, TextureDataRTTI);
-			CM_ADD_PLAINFIELD(mFlags, 5, TextureDataRTTI);
-			CM_ADD_PLAINFIELD(mBPP, 6, TextureDataRTTI);
-			CM_ADD_PLAINFIELD(mFormat, 7, TextureDataRTTI);
-
-			addDataBlockField("Data", 8, &TextureDataRTTI::getData, &TextureDataRTTI::setData);
-		}
-
-		virtual const String& getRTTIName()
-		{
-			static String name = "TextureData";
-			return name;
-		}
-
-		virtual UINT32 getRTTIId()
-		{
-			return 102;
-		}
-
-		virtual std::shared_ptr<IReflectable> newRTTIObject()
-		{
-			return std::shared_ptr<TextureData>(new TextureData());
-		}
-	};
-}

+ 0 - 72
CamelotUtility/Source/CmTextureData.cpp

@@ -1,72 +0,0 @@
-#include "CmTextureData.h"
-#include "CmException.h"
-#include "CmTextureDataRTTI.h"
-
-namespace CamelotEngine
-{
-	TextureData::TextureData(UINT32 width, UINT32 height, UINT32 size, 
-		PixelFormat format, UINT8* data, UINT32 depth, INT32 flags, UINT32 numMipmaps)
-		:mWidth(width), mHeight(height), mDepth(depth), mSize(size), mFormat(format),
-		mFlags(flags), mNumMipmaps(numMipmaps), mData(data)
-	{
-		mBPP = static_cast<UINT8>(PixelUtil::getNumElemBytes(mFormat)) * 8;
-	}
-
-	TextureData::~TextureData()
-	{
-		if(mData != nullptr)
-			delete[] mData;
-	}
-
-	PixelData TextureData::getPixels(UINT32 mip)
-	{
-		if(mip < 0 || mip > mNumMipmaps)
-		{
-			CM_EXCEPT(InvalidParametersException, "Mip out of range: " + toString(mip) + ". While maximum available mip is: " + toString((mNumMipmaps)));
-		}
-
-		// Calculate mipmap offset and size
-		UINT8 *offset = const_cast<UINT8*>(getData());
-		UINT8 offsetSoFar = 0;
-
-		UINT32 width = getWidth(), height = getHeight(), depth = getDepth();
-		UINT32 numMips = getNumMipmaps();
-
-		// Figure out the offsets 
-		UINT32 finalWidth = 0, finalHeight = 0, finalDepth = 0;
-		for(UINT32 curMip = 0; curMip <= numMips; ++curMip)
-		{
-			if (curMip == mip)
-			{
-				offset += offsetSoFar;
-				finalWidth = width;
-				finalHeight = height;
-				finalDepth = depth;
-			}
-			offsetSoFar += PixelUtil::getMemorySize(width, height, depth, getFormat());
-
-			/// Half size in each dimension
-			if(width!=1) width /= 2;
-			if(height!=1) height /= 2;
-			if(depth!=1) depth /= 2;
-		}
-
-		// Return subface as pixelbox
-		PixelData src(finalWidth, finalHeight, finalDepth, getFormat(), offset);
-		return src;
-	}
-
-	/************************************************************************/
-	/* 								SERIALIZATION                      		*/
-	/************************************************************************/
-
-	RTTITypeBase* TextureData::getRTTIStatic()
-	{
-		return TextureDataRTTI::instance();
-	}
-
-	RTTITypeBase* TextureData::getRTTI() const
-	{
-		return TextureData::getRTTIStatic();
-	}
-}