diff options
Diffstat (limited to 'Source/Asura.Engine/Graphics')
40 files changed, 1043 insertions, 0 deletions
diff --git a/Source/Asura.Engine/Graphics/Animation.cpp b/Source/Asura.Engine/Graphics/Animation.cpp new file mode 100644 index 0000000..47643aa --- /dev/null +++ b/Source/Asura.Engine/Graphics/Animation.cpp @@ -0,0 +1,21 @@ +#include "Animation.h" + +namespace AsuraEngine +{ + namespace Graphics + { + + void Animation::OnEnable() + { + mSpriteRenderer = mGameObject->GetComponent<SpriteRenderer*>(); + } + + void Animation::OnUpdate(uint32 milliseconds) + { + if (!mSpriteRenderer) + return; + mSpriteRenderer->SetSprite(NULL); + } + + } +} diff --git a/Source/Asura.Engine/Graphics/Animation.h b/Source/Asura.Engine/Graphics/Animation.h new file mode 100644 index 0000000..391da22 --- /dev/null +++ b/Source/Asura.Engine/Graphics/Animation.h @@ -0,0 +1,128 @@ +#ifndef __AE_ANIMATION_H__ +#define __AE_ANIMATION_H__ + +#include "Sprite.h" +#include "Component.h" +#include "Manager.hpp" +#include "SpriteRenderer.h" +#include "Containers/Map.h" +#include "Containers/Vector.hpp" +#include "Containers/StringMap.hpp" +#include "Filesystem/Asset.h" + +namespace AsuraEngine +{ + namespace Graphics + { + + /// + /// ¹Ø¼üÖ¡ + /// + struct Frame + { + uint mask; // + float time; + Sprite* sprite; + }; + + /// + /// Sprite¶¯»£¬¿ÉÒԸıäµÄÓÐspriteµÄ´óС¡¢Ðýת¡¢Ëõ·Å¡¢image¡£Animationͨ¹ýanimatorÐ޸ġ£ + /// + class Animation final : public Filesystem::Asset + { + public: + + enum UpdateMask + { + Scale = 1, + Position = 1 << 1, + Rotation = 1 << 2, + Sprite = 1 << 3 + }; + + struct Definition + { + + }; + + /// + /// ¸ù¾Ýʱ¼ä»ñµÃÒ»Ö¡ + /// + Frame GetFrame(float t); + + /// + /// »ñµÃ¹Ø¼üÖ¡ÊýÁ¿ + /// + uint GetKeyFrameCount(); + + /// + /// ÊÇ·ñÑ»· + /// + uint GetLoop(); + + /// + /// »ñÈ¡×Üʱ¼ä + /// + uint GetDuration(); + + private: + + /// + /// ¹Ø¼üÖ¡ + /// + Containers::Vector<Frame> mFrames; + + /// + /// ×Üʱ³¤ + /// + float mDuration; + + /// + /// ÊÇ·ñÑ»· + /// + bool mLoop; + + /// + /// ID + /// + uint mID; + + UpdateMask mUpdateMask; + + }; + + class AnimationManager : public Manager + { + public: + + Containers::String GetAnimationName(uint ID); + + uint GetAnimationID(const Containers::String& name); + + Animation* GetAnimation(uint ID); + + Animation* GetAnimation(const Containers::String& name); + + /// + /// Ìí¼Ó¶¯»²¢·µ»ØID + /// + uint AddAnimation(Animation* animation); + + private: + + /// + /// Ó³ÉäIDµ½animation + /// + Containers::StringMap<uint> mAnimationIDs; + + /// + /// Ó³Éäkeyµ½animation + /// + Containers::Map<uint, Animation*> mAnimations; + + }; + + } +} + +#endif
\ No newline at end of file diff --git a/Source/Asura.Engine/Graphics/Animator.cpp b/Source/Asura.Engine/Graphics/Animator.cpp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Source/Asura.Engine/Graphics/Animator.cpp diff --git a/Source/Asura.Engine/Graphics/Animator.h b/Source/Asura.Engine/Graphics/Animator.h new file mode 100644 index 0000000..4d3d269 --- /dev/null +++ b/Source/Asura.Engine/Graphics/Animator.h @@ -0,0 +1,96 @@ +#ifndef __AE_ANIMATOR_H__ +#define __AE_ANIMATOR_H__ + +#include "Component.h" +#include "Animation.h" + +namespace AsuraEngine +{ + namespace Graphics + { + + /// + /// ¿ØÖÆanimationµÄ×é¼þ£¬Ö÷ÒªÊÇ×÷ΪanimationµÄ´úÀí + /// + class Animator final : public Component + { + public: + + void OnEnable() override; + void OnUpdate(uint32 milliseconds) override; + + /// + /// ÉèÖÃanimation + /// + void SetAnimation(uint ID); + + /// + /// ÉèÖÃanimation + /// + void SetAnimation(Animation* animation); + + /// + /// ¸ù¾ÝÉèÖÃanimation״̬ + /// + void SetTime(float time); + + /// + /// Ð޸IJ¥·ÅËÙ¶È + /// + void SetSpeed(float speed); + + /// + /// ÉèÖÃÊÇ·ñÑ»· + /// + void SetLoop(bool isloop); + + /// + /// ¸ù¾Ý¹Ø¼üÖ¡ÐÞ¸Äanimation + /// + void SetKeyFrame(uint keyFrame); + + /// + /// ÉèÖõ½½áÊø + /// + void SetToBegin(); + + /// + /// ÉèÖõ½¿ªÊ¼ + /// + void SetToEnd(); + + /// + /// ÔÝÍ£ + /// + void Pause(); + + private: + + /// + /// µ±Ç°µÄanimation + /// + Animation* mAnimation; + + /// + /// AnimationÒªÇóÎïÌ屨ÐëÓÐÒ»¸ösprite renderer×é¼þ + /// + SpriteRenderer* mSpriteRenderer; + + /// + /// ²¥·ÅËÙ¶È£¬Ä¬ÈÏΪ1£¬dt = mSpeed * DELTA_TIME + /// + float mSpeed; + + /// + /// µ±Ç°Ö´ÐеÄʱ¼ä + /// + float mTime; + + bool mLoop; + + }; + + } +} + +#endif
\ No newline at end of file diff --git a/Source/Asura.Engine/Graphics/Camera.cpp b/Source/Asura.Engine/Graphics/Camera.cpp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Source/Asura.Engine/Graphics/Camera.cpp diff --git a/Source/Asura.Engine/Graphics/Camera.h b/Source/Asura.Engine/Graphics/Camera.h new file mode 100644 index 0000000..699d342 --- /dev/null +++ b/Source/Asura.Engine/Graphics/Camera.h @@ -0,0 +1,42 @@ +#ifndef __AE_CAMERA_H__ +#define __AE_CAMERA_H__ + +#include "RenderTarget.h" +#include "Component.h" + +namespace AsuraEngine +{ + namespace Graphics + { + + /// + /// Orthographic Camera. + /// + class Camera : public Component + { + public: + + + private: + + /// + /// äÖȾµÄÄ¿±ê + /// + RenderTarget* mRenderTarget; + + /// + /// ÊÇ·ñäÖȾµ½ÆÁÄ»ÉÏ + /// + bool mIsOnScreen; + + /// + /// ²Ã¼ô + /// + bool mIsCulling; + + }; + + } +} + +#endif diff --git a/Source/Asura.Engine/Graphics/Canvas.cpp b/Source/Asura.Engine/Graphics/Canvas.cpp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Source/Asura.Engine/Graphics/Canvas.cpp diff --git a/Source/Asura.Engine/Graphics/Canvas.h b/Source/Asura.Engine/Graphics/Canvas.h new file mode 100644 index 0000000..cd78194 --- /dev/null +++ b/Source/Asura.Engine/Graphics/Canvas.h @@ -0,0 +1,20 @@ +#ifndef __AE_Canvas_H__ +#define __AE_Canvas_H__ + +#include "Component.h" +#include "Texture.h" + +namespace AsuraEngine +{ + namespace Graphics + { + + class Canvas : public Texture, public Component + { + + }; + + } +} + +#endif
\ No newline at end of file diff --git a/Source/Asura.Engine/Graphics/CanvasRenderer.cpp b/Source/Asura.Engine/Graphics/CanvasRenderer.cpp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Source/Asura.Engine/Graphics/CanvasRenderer.cpp diff --git a/Source/Asura.Engine/Graphics/CanvasRenderer.h b/Source/Asura.Engine/Graphics/CanvasRenderer.h new file mode 100644 index 0000000..ef188a5 --- /dev/null +++ b/Source/Asura.Engine/Graphics/CanvasRenderer.h @@ -0,0 +1,30 @@ +#ifndef __AE_CANVAS_RENDERER_H__ +#define __AE_CANVAS_RENDERER_H__ + +#include "Canvas.h" +#include "Renderer.h" + +namespace AsuraEngine +{ + namespace Graphics + { + + class CanvasRenderer : public Renderer + { + public: + + void SetCanvas(Canvas* canvas); + Canvas* GetCanvas(); + + void SetBlendMode(); + + private: + + Canvas * mCanvas; + + }; + + } +} + +#endif
\ No newline at end of file diff --git a/Source/Asura.Engine/Graphics/Color.cpp b/Source/Asura.Engine/Graphics/Color.cpp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Source/Asura.Engine/Graphics/Color.cpp diff --git a/Source/Asura.Engine/Graphics/Color.h b/Source/Asura.Engine/Graphics/Color.h new file mode 100644 index 0000000..f172156 --- /dev/null +++ b/Source/Asura.Engine/Graphics/Color.h @@ -0,0 +1,30 @@ +#ifndef __AE_COLOR_H__ +#define __AE_COLOR_H__ + +#include "Type.h" + +namespace AsuraEngine +{ + namespace Graphics + { + + /// + /// 32bitsÑÕÉ« + /// + class Color + { + public: + + Color(byte r, byte g, byte b, byte a); + ~Color(); + + private: + + byte mR, mG, mB, mA; + + }; + + } +} + +#endif
\ No newline at end of file diff --git a/Source/Asura.Engine/Graphics/Image.cpp b/Source/Asura.Engine/Graphics/Image.cpp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Source/Asura.Engine/Graphics/Image.cpp diff --git a/Source/Asura.Engine/Graphics/Image.h b/Source/Asura.Engine/Graphics/Image.h new file mode 100644 index 0000000..5b27079 --- /dev/null +++ b/Source/Asura.Engine/Graphics/Image.h @@ -0,0 +1,119 @@ +#ifndef __AE_IMAGE_H__ +#define __AE_IMAGE_H__ + +#include "Math/Vector2.h" +#include "Manager.hpp" +#include "Texture.h" +#include "Color.h" +#include "Factory.h" + +namespace AsuraEngine +{ + namespace Graphics + { + + class ImageFactory; + + /// + /// ImageÊÇͼƬ´ÓÄÚ´æÖÐÔØÈëºó£¬¶ÁÈ¡½øÓÎÏ·ºó±£´æµÄ½á¹û¡£Ò»¸öImageÔÚÄÚ´æ¡¢ÏÔ´æÖÐÖ»»á±£´æÒ»·Ý£¬²»»á²úÉú¸±±¾¡£ÐèÒªÌØÕ÷ + /// »¯µÄÇø±ðimage£¬ÈçêµãλÖã¬Ëõ·ÅºÍÐýת½Ç¶È£¬Ê¹ÓÃsprite¡£»ù±¾ÊÇÒ»¸öÖ»¶ÁÀà¡£ + /// + class Image final : public Texture, public Filesystem::Asset + { + public: + + uint GetWidth(); + uint GetHeight(); + + /// + /// »ñµÃijһ¸öλÖõÄÏñËØ + /// + Color GetPixel(uint x, uint y); + + private: + + friend class ImageFactory; + + Image(Color* pixels, int width, int height); + ~Image(); + + /// + /// ´óС£¨ÒÔÏñËØÎªµ¥Î»£© + /// + uint mWidth, mHeight; + Color* mPixels; + + /// + /// ID + /// + uint mID; + + }; + + /// + /// + /// + class ImageManager : public Manager + { + public: + + /// + /// ͨ¹ýID»ñȡ·¾¶£¬Èç¹ûÊdzÌÐò´´½¨µÄͼƬ£¬·µ»ØString::Null + /// + Containers::String GetImagePath(uint ID); + + /// + /// ͨ¹ýID·¾¶»ñÈ¡ID£¬Èç¹ûûÕÒµ½£¬·µ»Ø0 + /// + uint GetImageID(const Containers::String& path); + + Image* GetImage(const Containers::String& path); + + Image* GetImage(const Containers::String& ID); + + uint AddImage(const Containers::String& path, Image* image); + + uint AddImage(Image* image); + + bool RemoveImage(uint ID); + + bool RemoveImage(Image* image); + + private: + + /// + /// ËùÓеÄimage + /// + Containers::Map<uint, Image*> mImages; + + /// + /// image£¬Â·¾¶ºÍIDµÄÓ³Éä¡£Õë¶Ô´Ó.asrµ¼ÈëµÄimage£¬Í¨¹ý·¾¶¿ÉÒÔÄõ½image¡£ËùÒÔ²¢²»ÊÇËùÓеÄimage¶¼ÔÚ´ËmapÖС£ + /// ÓɳÌÐò´´½¨µÄimageÖ»ÄÜͨ¹ýIDÀ´»ñÈ¡£¬ËùÒÔ³ÌÐòÖÐÐèÒª±£ÁôID¡£ + /// + Containers::StringMap<uint> mImageIDs; + + }; + + /// + /// + /// + class ImageFactory : public Factory + { + public: + + /// + /// ´Óimage pixelÊý¾ÝÖй¹½¨image + /// + Image* ReadBuffer(Color* pixels, int width, int height); + + /// + /// ´Óimage externÊý¾Ý²¢·µ»Ø + /// + Image* Decode(); + + }; + + } +} + +#endif
\ No newline at end of file diff --git a/Source/Asura.Engine/Graphics/Material.cpp b/Source/Asura.Engine/Graphics/Material.cpp new file mode 100644 index 0000000..eaf9742 --- /dev/null +++ b/Source/Asura.Engine/Graphics/Material.cpp @@ -0,0 +1,18 @@ +#include "Material.h" + +namespace AsuraEngine +{ + namespace Graphics + { + + + + //-------------------------------------------------------------------------------------------------------- + + int Material::l_SetColor(lua_State* L) + { + + } + + } +} diff --git a/Source/Asura.Engine/Graphics/Material.h b/Source/Asura.Engine/Graphics/Material.h new file mode 100644 index 0000000..1cb3c88 --- /dev/null +++ b/Source/Asura.Engine/Graphics/Material.h @@ -0,0 +1,189 @@ +#ifndef __AE_MATERIAL_H__ +#define __AE_MATERIAL_H__ + +#include "Containers/Vector.hpp" +#include "Containers/String.h" +#include "Math/Vector2.h" +#include "Math/Vector3.h" +#include "Math/Vector4.h" +#include "Math/Matrix44.h" +#include "Scripting/Luax.hpp" + +#include "Shader.h" +#include "Texture.h" +#include "Manager.hpp" + +namespace AsuraEngine +{ + namespace Graphics + { + + class MaterialFactory; + + /// + /// ͨ¹ý²ÄÖʵ÷ÕûShaderÖеÄuniforms±äÁ¿¡£Shader½«¿ÉÒÔÐ޸ĵıäÁ¿±©Â¶¸ømaterial£¬Ã¿¸ö²ÄÖÊ¿ÉÒÔ²îÒ컯ÅäÖÃÏàͬ×ÅÉ«Æ÷µÄ + /// ²»Í¬²ÎÊý£¬Í¨¹ýÊý¾ÝÎļþ(.mat)ʵÏÖ£¬¶ø²»ÊÇÔÚ´úÂëÀïÅäÖá£ËùÒÔÔÚAsuraÖУ¬ShaderÎÞ·¨Ö±½ÓÓ¦Óõ½äÖȾÁ÷³Ì¶ø±ØÐëºÍÒ»¸ö + /// ²ÄÖʹØÁª£¬ÓɲÄÖÊÐÞ¸ÄshaderµÄuniforms£¬material³äµ±ÁËshaderµÄ´úÀí¡£ + /// + class Material final : public Filesystem::Asset + { + public: + + enum class UniformsType + { + None = 0, + Float, + Int, + Vector2, + Vector3, + Vector4, + Matrix44, + Texture, + Color, + }; + + struct UniformsInfo + { + uint ID; // uniform±äÁ¿µÄID + UniformsType type; // uniform±äÁ¿µÄÀàÐÍ + union + { + float f; + int i; + Math::Vector2 v2; + Math::Vector3 v3; + Math::Vector4 v4; + Math::Matrix44 m44; + Texture* tex; + Color col; + }value; // uniform±äÁ¿µÄÖµ + }; + + void SetShader(Shader* shader); + + // ÉèÖÃUniform±äÁ¿£¬±£´æÔÚ²ÄÖÊÖУ¬äÖȾʱÉÏ´«µ½GPU + + /// + /// »ñµÃuniform±äÁ¿µÄID£¬IDºÍnameµÄmapÔÚshader¼ä¹²Ïí¡£ÉèÖÃuniform±äÁ¿µÄֵʱ£¬Í¨¹ýID²éѯuniform±äÁ¿Ãû£¬ÔÚ + /// shaderÖÐÕÒµ½uniform location²¢¶ÔÕâ¸ölocation¸³Öµ¡£ + /// + static int GetUniformID(const Containers::String& name); + + void SetTexture(uint ID, Texture* texture); + void SetVector2(uint ID, Math::Vector2* vector2); + void SetVector3(uint ID, Math::Vector3* vector3); + void SetVector4(uint ID, Math::Vector4* vector4); + void SetMatrix44(uint ID, Math::Matrix44* matrix44); + void SetFloat(uint ID, float value); + void SetInteger(uint ID, int value); + void SetColor(uint ID, Color color); + + UniformsInfo GetUniformInfo(uint ID); + float GetUniformInfof(uint ID); + int GetUniformInfoi(uint ID); + Math::Vector2 GetUniformInfov2(uint ID); + Math::Vector3 GetUniformInfov3(uint ID); + Math::Vector4 GetUniformInfov4(uint ID); + Math::Matrix44 GetUniformInfom44(uint ID); + Texture* GetUniformInfotex(uint ID); + Color GetUniformInfocol(uint ID); + + // ÉÏ´«¶¥µãÊý¾Ý + + void SetVertexAttributes(); + + private: + + friend class MaterialFactory; + + Material(); + Material(const Material& src); + ~Material(); + + /// + /// + /// + uint mID; + + /// + /// + /// + Shader* mShader; + + /// + /// Uniforms±äÁ¿µÄÖµ£¬Ó³ÉäIDµ½Öµ + /// + Containers::Map<int, UniformsInfo> mUniforms; + + /// + /// ÊÇ·ñÊǹ²ÏíµÄ²ÄÖÊ + /// + bool mIsShared; + + //---------------------------------------------------------------------------------------------------- + + LUAX_DECL_FACTORY(Material); + + LUAX_DECL_METHOD(l_Clone); + + LUAX_DECL_METHOD(l_SetShader); + + LUAX_DECL_METHOD(l_SetTexture); + LUAX_DECL_METHOD(l_SetVector2); + LUAX_DECL_METHOD(l_SetVector3); + LUAX_DECL_METHOD(l_SetVector4); + LUAX_DECL_METHOD(l_SetMatrix44); + LUAX_DECL_METHOD(l_SetFloat); + LUAX_DECL_METHOD(l_SetInteger); + LUAX_DECL_METHOD(l_SetColor); + + LUAX_DECL_METHOD(l_GetUniformInfo); + LUAX_DECL_METHOD(l_GetUniformInfof); + LUAX_DECL_METHOD(l_GetUniformInfoi); + LUAX_DECL_METHOD(l_GetUniformInfov2); + LUAX_DECL_METHOD(l_GetUniformInfov3); + LUAX_DECL_METHOD(l_GetUniformInfov4); + LUAX_DECL_METHOD(l_GetUniformInfom44); + LUAX_DECL_METHOD(l_GetUniformInfotex); + LUAX_DECL_METHOD(l_GetUniformInfocol); + + LUAX_DECL_METHOD(l_SetVertexAttributes); + + }; + + class MaterialManager : public Manager + { + public: + + private: + + /// + /// ËùÓеÄimage + /// + Containers::Map<uint, Image*> mImages; + + /// + /// image£¬Â·¾¶ºÍIDµÄÓ³Éä¡£Õë¶Ô´Ó.asrµ¼ÈëµÄimage£¬Í¨¹ý·¾¶¿ÉÒÔÄõ½image¡£ËùÒÔ²¢²»ÊÇËùÓеÄimage¶¼ÔÚ´ËmapÖС£ + /// ÓɳÌÐò´´½¨µÄimageÖ»ÄÜͨ¹ýIDÀ´»ñÈ¡£¬ËùÒÔ³ÌÐòÖÐÐèÒª±£ÁôID¡£ + /// + Containers::StringMap<uint> mImageIDs; + + }; + + class MaterialFactory : public Factory + { + public: + + /// + /// ¿½±´Ò»¸ömaterial + /// + Material* Clone(Material* src); + + Material* Create(); + + }; + + } +} + +#endif
\ No newline at end of file diff --git a/Source/Asura.Engine/Graphics/Mesh2D.cpp b/Source/Asura.Engine/Graphics/Mesh2D.cpp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Source/Asura.Engine/Graphics/Mesh2D.cpp diff --git a/Source/Asura.Engine/Graphics/Mesh2D.h b/Source/Asura.Engine/Graphics/Mesh2D.h new file mode 100644 index 0000000..a113f4c --- /dev/null +++ b/Source/Asura.Engine/Graphics/Mesh2D.h @@ -0,0 +1,20 @@ +#ifndef __AE_MESH2D_H__ +#define __AE_MESH2D_H__ + +namespace AsuraEngine +{ + namespace Graphics + { + + /// + /// 2D mesh£¬ÓÃÓÚ×öһЩUV¶¯» + /// + class Mesh2D + { + + }; + + } +} + +#endif
\ No newline at end of file diff --git a/Source/Asura.Engine/Graphics/Mesh2DRenderer.cpp b/Source/Asura.Engine/Graphics/Mesh2DRenderer.cpp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Source/Asura.Engine/Graphics/Mesh2DRenderer.cpp diff --git a/Source/Asura.Engine/Graphics/Mesh2DRenderer.h b/Source/Asura.Engine/Graphics/Mesh2DRenderer.h new file mode 100644 index 0000000..fcbfd2c --- /dev/null +++ b/Source/Asura.Engine/Graphics/Mesh2DRenderer.h @@ -0,0 +1,19 @@ +#ifndef __AE_MESH2D_H__ +#define __AE_MESH2D_H__ + +#include "FileSystem/Asset.h" + +namespace AsuraEngine +{ + namespace Graphics + { + + class Mesh2D : public Filesystem::Asset + { + + }; + + } +} + +#endif
\ No newline at end of file diff --git a/Source/Asura.Engine/Graphics/OpenGL.cpp b/Source/Asura.Engine/Graphics/OpenGL.cpp new file mode 100644 index 0000000..ec23f52 --- /dev/null +++ b/Source/Asura.Engine/Graphics/OpenGL.cpp @@ -0,0 +1,11 @@ +#include "OpenGL.h" + +namespace AsuraEngine +{ + namespace Graphics + { + + + + } +}
\ No newline at end of file diff --git a/Source/Asura.Engine/Graphics/OpenGL.h b/Source/Asura.Engine/Graphics/OpenGL.h new file mode 100644 index 0000000..f46497b --- /dev/null +++ b/Source/Asura.Engine/Graphics/OpenGL.h @@ -0,0 +1,17 @@ +#ifndef __AE_OPENGL_H__ +#define __AE_OPENGL_H__ + +namespace AsuraEngine +{ + namespace Graphics + { + + class OpenGL + { + + }; + + } +} + +#endif
\ No newline at end of file diff --git a/Source/Asura.Engine/Graphics/ParticleSystem.cpp b/Source/Asura.Engine/Graphics/ParticleSystem.cpp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Source/Asura.Engine/Graphics/ParticleSystem.cpp diff --git a/Source/Asura.Engine/Graphics/ParticleSystem.h b/Source/Asura.Engine/Graphics/ParticleSystem.h new file mode 100644 index 0000000..078427a --- /dev/null +++ b/Source/Asura.Engine/Graphics/ParticleSystem.h @@ -0,0 +1,22 @@ +#ifndef __AE_PARTICLESYSTEM_H__ +#define __AE_PARTICLESYSTEM_H__ + +#include "Component.h" + +namespace AsuraEngine +{ + namespace Graphics + { + + /// + /// Á£×Óϵͳ + /// + class ParticleSystem final : public Component + { + + }; + + } +} + +#endif
\ No newline at end of file diff --git a/Source/Asura.Engine/Graphics/Prefab.cpp b/Source/Asura.Engine/Graphics/Prefab.cpp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Source/Asura.Engine/Graphics/Prefab.cpp diff --git a/Source/Asura.Engine/Graphics/Prefab.h b/Source/Asura.Engine/Graphics/Prefab.h new file mode 100644 index 0000000..82a8da2 --- /dev/null +++ b/Source/Asura.Engine/Graphics/Prefab.h @@ -0,0 +1,30 @@ +#ifndef __AE_PREFAB_H__ +#define __AE_PREFAB_H__ + +#include "Manager.hpp" +#include "FileSystem/Asset.h" + +namespace AsuraEngine +{ + + /// + /// PrefabÓÃÀ´¹¹½¨GameObject + /// + class Prefab : public Filesystem::Asset + { + + }; + + class PrefabManager : public Manager + { + + }; + + class PrefabFactory + { + + }; + +} + +#endif
\ No newline at end of file diff --git a/Source/Asura.Engine/Graphics/Renderer.cpp b/Source/Asura.Engine/Graphics/Renderer.cpp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Source/Asura.Engine/Graphics/Renderer.cpp diff --git a/Source/Asura.Engine/Graphics/Renderer.h b/Source/Asura.Engine/Graphics/Renderer.h new file mode 100644 index 0000000..c3677a7 --- /dev/null +++ b/Source/Asura.Engine/Graphics/Renderer.h @@ -0,0 +1,39 @@ +#ifndef __AE_RENDERER_H__ +#define __AE_RENDERER_H__ + +#include "Component.h" +#include "Material.h" + +namespace AsuraEngine +{ + namespace Graphics + { + + /// + /// ³éÏó»ùÀ࣬äÖȾÓÉRendererÀà´¦Àí£¬Ã¿¸öRenderer±ØÐë¾ß±¸Ò»¸ö²ÄÖÊ¡£ + /// + class Renderer : public Component + { + public: + + /// + /// Ò»µ©µ÷Óô˷½·¨£¬¾Í»á¿½±´shared material£¬µ÷Óô˷½·¨Òâζ×ÅÒª¶ÔmaterialµÄÅäÖýøÐÐÐ޸ģ¬Èç¹û´ËʱʹÓõIJÄÖÊÊÇ + /// shared material£¬ÔòÐèÒª¿½±´Ò»·Ý£¬±ÜÃâÓ°ÏìÆäËû¹²ÏíµÄrenderer¡£ + /// + Material* GetMaterial(); + + /// + /// äÖȾ»Øµ÷º¯Êý + /// + virtual void OnRender() = 0; + + protected: + + Material* mMaterial; + + }; + + } +} + +#endif
\ No newline at end of file diff --git a/Source/Asura.Engine/Graphics/Shader.cpp b/Source/Asura.Engine/Graphics/Shader.cpp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Source/Asura.Engine/Graphics/Shader.cpp diff --git a/Source/Asura.Engine/Graphics/Shader.h b/Source/Asura.Engine/Graphics/Shader.h new file mode 100644 index 0000000..c3c67ad --- /dev/null +++ b/Source/Asura.Engine/Graphics/Shader.h @@ -0,0 +1,67 @@ +#ifndef __AE_SHADER_H__ +#define __AE_SHADER_H__ + +#include "luax/luax.h" + +#include "FileSystem/Asset.h" +#include "Containers/Map.h" +#include "Containers/StringMap.hpp" +#include "Object.h" +#include "Color.h" +#include "Manager.hpp" + +namespace AsuraEngine +{ + namespace Graphics + { + + class Material; + + /// + /// Ò»¸öshaderÊÇÒ»¸öÔÚ²ÄÖʼ乲ÏíµÄ³ÌÐò¡£Shader±¾Éí²»±£´æuniformsºÍ¶¥µãÊý¾Ý£¬Ö»±£´æuniforms location¡£ + /// + class Shader final : public Filesystem::Asset + { + public: + + Shader(); + ~Shader(); + + private: + + friend class Material; + + /// + /// ±£´æÁËËùÓÐshaderµÄuniforms±äÁ¿µÄIDÓ³Éä¡£ + /// + static Containers::StringMap<int> sUniformsID; + + /// + /// »ñµÃuniform±äÁ¿µÄID¡£ + /// + static int GetUniformID(const Containers::String& name); + + /// + /// ÉèÖÃÄÚÖñäÁ¿£º + /// vec2 Asura_Time xֵΪ½øÈ뵱ǰ³¡¾°¿ªÊ¼µÄʱ¼ä£¬yֵΪÉÏÒ»Ö¡µÄʱ¼ä¼ä¸ô + /// vec2 Asura_RenderTargetSize RTµÄ´óС£¬ÒÔÏñËØÎªµ¥Î» + /// Texture Asura_MainTexture Ö÷ÎÆÀí + /// + void SetBuiltInUniforms(); + + /// + /// Ó³Éäuniforms IDµ½location¡£ + /// + Containers::Map<int, int> mLocations; + + }; + + class ShaderManager final : public Manager + { + + }; + + } +} + +#endif
\ No newline at end of file diff --git a/Source/Asura.Engine/Graphics/ShapeRenderer.cpp b/Source/Asura.Engine/Graphics/ShapeRenderer.cpp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Source/Asura.Engine/Graphics/ShapeRenderer.cpp diff --git a/Source/Asura.Engine/Graphics/ShapeRenderer.h b/Source/Asura.Engine/Graphics/ShapeRenderer.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Source/Asura.Engine/Graphics/ShapeRenderer.h diff --git a/Source/Asura.Engine/Graphics/Sprite.cpp b/Source/Asura.Engine/Graphics/Sprite.cpp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Source/Asura.Engine/Graphics/Sprite.cpp diff --git a/Source/Asura.Engine/Graphics/Sprite.h b/Source/Asura.Engine/Graphics/Sprite.h new file mode 100644 index 0000000..b621f1b --- /dev/null +++ b/Source/Asura.Engine/Graphics/Sprite.h @@ -0,0 +1,71 @@ +#ifndef __AE_SPRITE_H__ +#define __AE_SPRITE_H__ + +#include "Math/Vector2.h" +#include "Transform.h" +#include "Component.h" +#include "Image.h" + +namespace AsuraEngine +{ + namespace Graphics + { + + /// + /// SpriteÊÇ¿ØÖÆimageµÄ´úÀí£¬imageÊÇÔÚsprite¼ä¹²ÏíµÄÊý¾Ý£¬sprite¿ÉÒÔÇø±ð»¯´¦ÀíimageµÄÊôÐÔ£¬ÈçÐýת£¬Ëõ·ÅµÈ¡£ + /// + class Sprite final : public Filesystem::Asset + { + public: + + enum Type + { + + }; + + /// + /// ¶ÔÆë·½Ê½ + /// + enum Align + { + + }; + + struct SpriteDef + { + Image* image; + Align align; + Math::Vector2 anchor; + Math::Vector2 size; + }; + + Sprite(SpriteDef definition); + ~Sprite(); + + private: + + /// + /// êµã×ø±ê + /// + Math::Vector2 mAnchor; + + /// + /// ´óС + /// + Math::Vector2 mSize; + + /// + /// °ó¶¨µÄimage + /// + Image* mImage; + + //---------------------------------------------------------------------------------------------------- + + + + }; + + } +} + +#endif
\ No newline at end of file diff --git a/Source/Asura.Engine/Graphics/SpriteBatch.cpp b/Source/Asura.Engine/Graphics/SpriteBatch.cpp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Source/Asura.Engine/Graphics/SpriteBatch.cpp diff --git a/Source/Asura.Engine/Graphics/SpriteBatch.h b/Source/Asura.Engine/Graphics/SpriteBatch.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Source/Asura.Engine/Graphics/SpriteBatch.h diff --git a/Source/Asura.Engine/Graphics/SpriteRenderer.cpp b/Source/Asura.Engine/Graphics/SpriteRenderer.cpp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Source/Asura.Engine/Graphics/SpriteRenderer.cpp diff --git a/Source/Asura.Engine/Graphics/SpriteRenderer.h b/Source/Asura.Engine/Graphics/SpriteRenderer.h new file mode 100644 index 0000000..bd81509 --- /dev/null +++ b/Source/Asura.Engine/Graphics/SpriteRenderer.h @@ -0,0 +1,32 @@ +#ifndef __AE_SPRITE_RENDERER_H__ +#define __AE_SPRITE_RENDERER_H__ + +#include "Renderer.h" +#include "Sprite.h" + +namespace AsuraEngine +{ + namespace Graphics + { + + class SpriteRenderer final : public Renderer + { + public: + + void SetSprite(Sprite* sprite); + + void OnRender() override; + + private: + + /// + /// ÓÃÀ´äÖȾµÄsprite + /// + Sprite* mSprite; + + }; + + } +} + +#endif
\ No newline at end of file diff --git a/Source/Asura.Engine/Graphics/Texture.cpp b/Source/Asura.Engine/Graphics/Texture.cpp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Source/Asura.Engine/Graphics/Texture.cpp diff --git a/Source/Asura.Engine/Graphics/Texture.h b/Source/Asura.Engine/Graphics/Texture.h new file mode 100644 index 0000000..8195fc9 --- /dev/null +++ b/Source/Asura.Engine/Graphics/Texture.h @@ -0,0 +1,22 @@ +#ifndef __AE_TEXTURE_H__ +#define __AE_TEXTURE_H__ + +#include "Object.h" + +namespace AsuraEngine +{ + namespace Graphics + { + + /// + /// 2DÎÆÀí£¨³éÏóÀࣩ£¬ÔÚ2d meshºÍrender targetÖб»Ê¹Óà + /// + class Texture : public Object + { + + }; + + } +} + +#endif
\ No newline at end of file |
