├── .gitignore
├── README.md
└── RcEngine
├── 3rdParty
├── FastDelegate
│ ├── Demo.cpp
│ ├── FastDelegate.h
│ └── FastDelegateBind.h
├── HBAO+
│ ├── GFSDK_SSAO.h
│ ├── GFSDK_SSAO.win32.dll
│ ├── GFSDK_SSAO.win32.lib
│ ├── GFSDK_SSAO.win64.dll
│ └── GFSDK_SSAO.win64.lib
└── rapidxml
│ ├── license.txt
│ ├── manual.html
│ ├── rapidxml.hpp
│ ├── rapidxml_iterators.hpp
│ ├── rapidxml_print.hpp
│ └── rapidxml_utils.hpp
├── Config.xml
├── Direct3D11RenderSystem
├── D3D11Buffer.cpp
├── D3D11Buffer.h
├── D3D11DepthStencilView.cpp
├── D3D11Device.cpp
├── D3D11Device.h
├── D3D11Factory.cpp
├── D3D11Factory.h
├── D3D11FrameBuffer.cpp
├── D3D11FrameBuffer.h
├── D3D11GraphicCommon.cpp
├── D3D11GraphicCommon.h
├── D3D11HBAO.cpp
├── D3D11HBAO.h
├── D3D11Module.cpp
├── D3D11Module.h
├── D3D11Prerequisites.h
├── D3D11RenderTargetView.cpp
├── D3D11RenderWindow.cpp
├── D3D11RenderWindow.h
├── D3D11Shader.cpp
├── D3D11Shader.h
├── D3D11ShaderPipeline.cpp
├── D3D11State.cpp
├── D3D11State.h
├── D3D11Texture.cpp
├── D3D11Texture.h
├── D3D11Texture1D.cpp
├── D3D11Texture2D.cpp
├── D3D11Texture3D.cpp
├── D3D11TextureCube.cpp
├── D3D11VertexDeclaration.cpp
├── D3D11VertexDeclaration.h
├── D3D11View.cpp
├── D3D11View.h
├── Direct3D11Query.cpp
├── Direct3D11Query.h
├── Direct3D11RenderSystem.vcxproj
├── Direct3D11RenderSystem.vcxproj.filters
├── Direct3D11RenderSystem.vcxproj.user
├── DllMain.cpp
└── PixelFormatMapping.h
├── InputSystem
├── DllMain.cpp
├── InputSystem.vcxproj
├── InputSystem.vcxproj.filters
├── OISInputKeyboard.cpp
├── OISInputKeyboard.h
├── OISInputModule.cpp
├── OISInputModule.h
├── OISInputMouse.cpp
├── OISInputMouse.h
├── OISInputPrerequisites.h
├── OISInputSystem.cpp
└── OISInputSystem.h
├── Media
├── Effect
│ ├── AlphaTest.effect.xml
│ ├── AmbientOcclusion.effect.xml
│ ├── DebugView.effect.xml
│ ├── DeepGBufferRadiosity
│ │ ├── DeepGBufferBlur.effect.xml
│ │ ├── DeepGBufferRadiosity.effect.xml
│ │ ├── DeepGBufferShading.effect.xml
│ │ ├── LambertianOnly.effect.xml
│ │ ├── MipmapGen.effect.xml
│ │ ├── Reconstruct.effect.xml
│ │ └── TemporalFilter.effect.xml
│ ├── DeferredLighting.effect.xml
│ ├── FSQuad.effect.xml
│ ├── Font.effect.xml
│ ├── FontOutline.effect.xml
│ ├── GLSL
│ │ ├── BezierCurve - 副本.glsl
│ │ ├── BezierCurve.glsl
│ │ ├── DebugView.glsl
│ │ ├── DeferredLighting.glsl
│ │ ├── DeferredUtil.glsl
│ │ ├── FSQuad.glsl
│ │ ├── Font.glsl
│ │ ├── ForwardLighting.glsl
│ │ ├── ForwardPlus.glsl
│ │ ├── FullscreenTriangle.glsl
│ │ ├── GBuffer.glsl
│ │ ├── HDR.glsl
│ │ ├── Instancing.glsl
│ │ ├── LightingUtil.glsl
│ │ ├── MipmapMinify.glsl
│ │ ├── Model.glsl
│ │ ├── ModelCommon.glsl
│ │ ├── ModelMaterialFactory.glsl
│ │ ├── ModelVertexFactory.glsl
│ │ ├── PCF.glsl
│ │ ├── PSSM.glsl
│ │ ├── SSAO.glsl
│ │ ├── ShadowMapBlur.glsl
│ │ ├── ShadowMapGen.glsl
│ │ ├── Sprite.glsl
│ │ ├── TessQuad.glsl
│ │ ├── TessTeapot.glsl
│ │ ├── Tessellation.glsl
│ │ └── TiledDeferredShading.glsl
│ ├── HDR.effect.xml
│ ├── HLSL
│ │ ├── AmbientOcclusion.hlsl
│ │ ├── AmbientOcclusionBlur.hlsl
│ │ ├── BRDF.hlsl
│ │ ├── DebugView.hlsl
│ │ ├── DeepGBufferRadiosity
│ │ │ ├── ColorBoost.hlsl
│ │ │ ├── DeepGBuffer.hlsl
│ │ │ ├── DeepGBufferBlur.hlsl
│ │ │ ├── DeepGBufferRadiosity.hlsl
│ │ │ ├── Deferred.hlsl
│ │ │ ├── LambertianOnly.hlsl
│ │ │ ├── MipmapMinify.hlsl
│ │ │ ├── PCF.hlsl
│ │ │ ├── PSSM.hlsl
│ │ │ ├── ReconstructCSZ.hlsl
│ │ │ ├── TemporalFilter.hlsl
│ │ │ └── oct.hlsl
│ │ ├── DeferredLighting.hlsl
│ │ ├── DeferredUtil.hlsl
│ │ ├── DepthPeel.hlsl
│ │ ├── FSQuad.hlsl
│ │ ├── Font.hlsl
│ │ ├── ForwardLighting.hlsl
│ │ ├── ForwardPlus.hlsl
│ │ ├── FullscreenTriangle.hlsl
│ │ ├── GBuffer.hlsl
│ │ ├── HDR.hlsl
│ │ ├── LightCommon.hlsl
│ │ ├── LightingUtil.hlsl
│ │ ├── Math.hlsl
│ │ ├── Model.hlsl
│ │ ├── ModelMaterialFactory.hlsl
│ │ ├── ModelVertexFactory.hlsl
│ │ ├── PCF.hlsl
│ │ ├── PSSM.hlsl
│ │ ├── ReconstructCSZ.hlsl
│ │ ├── RenderCascadeScene.hlsl
│ │ ├── ShadowMapBlur.hlsl
│ │ ├── ShadowMapGen.hlsl
│ │ ├── Sky.hlsl
│ │ ├── Sprite.hlsl
│ │ ├── TessQuad.hlsl
│ │ ├── TessTeapot.hlsl
│ │ ├── TiledDeferredShading.hlsl
│ │ ├── VSM.hlsl
│ │ └── fxc.exe
│ ├── Model.effect.xml
│ ├── ShadowMapBlur.effect.xml
│ ├── Sky.effect.xml
│ ├── Sprite.effect.xml
│ ├── Tessellation.effect.xml
│ ├── TiledDeferredShading.effect.xml
│ └── TiledLightCull.effect.xml
├── Font
│ ├── Consolas Regular.sdff.dds
│ ├── Consolas Regular.sdff.txt
│ └── SDFont.exe
├── GuiSkin
│ ├── Controls
│ │ ├── Button
│ │ │ ├── close.png
│ │ │ ├── custombutton1.png
│ │ │ ├── default_left.png
│ │ │ ├── default_right.png
│ │ │ ├── maximize.png
│ │ │ ├── minimize.png
│ │ │ └── restore.png
│ │ ├── Checkbox
│ │ │ ├── checked.png
│ │ │ └── unchecked.png
│ │ ├── ComboBox
│ │ │ └── button.png
│ │ ├── Form
│ │ │ ├── default_lowercenter.png
│ │ │ ├── default_lowerleft.png
│ │ │ ├── default_lowerright.png
│ │ │ ├── default_lowerright_resize.png
│ │ │ ├── default_midcenter.png
│ │ │ ├── default_midleft.png
│ │ │ ├── default_midright.png
│ │ │ ├── default_uppercenter.png
│ │ │ ├── default_upperleft.png
│ │ │ └── default_upperright.png
│ │ ├── RadioButton
│ │ │ ├── checked.png
│ │ │ └── unchecked.png
│ │ ├── Scrollbar
│ │ │ ├── base.png
│ │ │ ├── button.png
│ │ │ ├── hscrollbar_back.png
│ │ │ ├── hscrollbar_button_left.png
│ │ │ ├── hscrollbar_button_right.png
│ │ │ ├── hscrollbar_cursor.png
│ │ │ ├── hscrollbar_highlight_left.png
│ │ │ ├── hscrollbar_highlight_middle.png
│ │ │ ├── hscrollbar_highlight_right.png
│ │ │ ├── hscrollbar_left.png
│ │ │ ├── hscrollbar_middle.png
│ │ │ ├── hscrollbar_right.png
│ │ │ ├── scrollbar_cursor.png
│ │ │ ├── scroller.png
│ │ │ ├── vscrollbar_back.png
│ │ │ ├── vscrollbar_bottom.png
│ │ │ ├── vscrollbar_button_down.png
│ │ │ ├── vscrollbar_button_up.png
│ │ │ ├── vscrollbar_cursor.png
│ │ │ ├── vscrollbar_highlight_bottom.png
│ │ │ ├── vscrollbar_highlight_middle.png
│ │ │ ├── vscrollbar_highlight_top.png
│ │ │ ├── vscrollbar_middle.png
│ │ │ └── vscrollbar_top.png
│ │ ├── Slider
│ │ │ ├── slider_center.png
│ │ │ ├── slider_cursor.png
│ │ │ ├── slider_left.png
│ │ │ └── slider_right.png
│ │ ├── arrow.png
│ │ ├── potentiometer.png
│ │ ├── textbox_left.png
│ │ └── textbox_right.png
│ ├── dxutcontrols.dds
│ ├── xWinForm.dds
│ ├── xWinForm.png
│ ├── xWinForm.skin.xml
│ ├── xWinForm1.png
│ └── xWinForm1.xml
└── Material
│ ├── DebugView.material.xml
│ ├── Font.material.xml
│ ├── LightShape.material.xml
│ ├── LightTextured.material.xml
│ ├── Lighting.material.xml
│ ├── Model.material.xml
│ ├── ShadowMapBlur.material.xml
│ ├── SkinModel.material.xml
│ ├── SkinModelUBO.material.xml
│ ├── SkyCubeMap.material.xml
│ ├── SkyNormal.material.xml
│ ├── Sprite.material.xml
│ ├── TangentFrame.material.xml
│ └── WireFrame.material.xml
├── OpenGLRenderSystem
├── DllMain.cpp
├── OpenGLBuffer.cpp
├── OpenGLBuffer.h
├── OpenGLDepthStencilView.cpp
├── OpenGLDevice.cpp
├── OpenGLDevice.h
├── OpenGLFactory.cpp
├── OpenGLFactory.h
├── OpenGLFrameBuffer.cpp
├── OpenGLFrameBuffer.h
├── OpenGLGraphicBuffer.cpp
├── OpenGLGraphicBuffer.h
├── OpenGLGraphicCommon.cpp
├── OpenGLGraphicCommon.h
├── OpenGLHBAO.cpp
├── OpenGLHBAO.h
├── OpenGLModule.cpp
├── OpenGLModule.h
├── OpenGLPrerequisites.h
├── OpenGLQuery.cpp
├── OpenGLQuery.h
├── OpenGLRenderSystem.vcxproj
├── OpenGLRenderSystem.vcxproj.filters
├── OpenGLRenderSystem.vcxproj.user
├── OpenGLRenderTargetView.cpp
├── OpenGLRenderWindow.cpp
├── OpenGLRenderWindow.h
├── OpenGLSampleStater.cpp
├── OpenGLSamplerState.h
├── OpenGLShader.cpp
├── OpenGLShader.h
├── OpenGLShaderPipeline.cpp
├── OpenGLShaderUtil.h
├── OpenGLTexture.cpp
├── OpenGLTexture.h
├── OpenGLTexture1D.cpp
├── OpenGLTexture2D.cpp
├── OpenGLTexture3D.cpp
├── OpenGLTextureCube.cpp
├── OpenGLVertexDeclaration.cpp
├── OpenGLVertexDeclaration.h
├── OpenGLView.cpp
├── OpenGLView.h
├── pfm.cpp
└── pfm.h
├── RcEngine.sln
├── RcEngine.v11.suo
├── RcEngine
├── Core
│ ├── CompileConfig.h
│ ├── DynLib.cpp
│ ├── DynLib.h
│ ├── Environment.cpp
│ ├── Environment.h
│ ├── Exception.cpp
│ ├── Exception.h
│ ├── IModule.cpp
│ ├── IModule.h
│ ├── Loger.cpp
│ ├── Loger.h
│ ├── ModuleManager.cpp
│ ├── ModuleManager.h
│ ├── Prerequisites.h
│ ├── Profiler.cpp
│ ├── Profiler.h
│ ├── Singleton.h
│ ├── StringHash.cpp
│ ├── StringHash.h
│ ├── Timer.cpp
│ ├── Timer.h
│ ├── Utility.cpp
│ ├── Utility.h
│ ├── Variant.cpp
│ ├── Variant.h
│ ├── XMLDom.cpp
│ └── XMLDom.h
├── GUI
│ ├── Button.cpp
│ ├── Button.h
│ ├── CheckBox.cpp
│ ├── CheckBox.h
│ ├── ComboBox.cpp
│ ├── ComboBox.h
│ ├── Console.cpp
│ ├── Console.h
│ ├── Cursor.cpp
│ ├── Cursor.h
│ ├── GuiSkin.cpp
│ ├── GuiSkin.h
│ ├── Label.cpp
│ ├── Label.h
│ ├── LineEdit.cpp
│ ├── LineEdit.h
│ ├── ListBox.cpp
│ ├── ListBox.h
│ ├── Menu.cpp
│ ├── Menu.h
│ ├── RadioButton.cpp
│ ├── RadioButton.h
│ ├── ScrollBar.cpp
│ ├── ScrollBar.h
│ ├── Slider.cpp
│ ├── Slider.h
│ ├── TextEdit.cpp
│ ├── TextEdit.h
│ ├── UIAll.h
│ ├── UIElement.cpp
│ ├── UIElement.h
│ ├── UIManager.cpp
│ ├── UIManager.h
│ ├── UIWindow.cpp
│ └── UIWindow.h
├── Graphics
│ ├── AmbientOcclusion.cpp
│ ├── AmbientOcclusion.h
│ ├── Animation.cpp
│ ├── Animation.h
│ ├── AnimationClip.cpp
│ ├── AnimationClip.h
│ ├── AnimationController.cpp
│ ├── AnimationController.h
│ ├── AnimationState.cpp
│ ├── AnimationState.h
│ ├── Camera.cpp
│ ├── Camera.h
│ ├── CameraControler.cpp
│ ├── CameraControler.h
│ ├── CameraController1.cpp
│ ├── CameraController1.h
│ ├── CascadedShadowMap.cpp
│ ├── CascadedShadowMap.h
│ ├── DDSImage.cpp
│ ├── DDSLoader.cpp
│ ├── DebugDrawManager.cpp
│ ├── DebugDrawManager.h
│ ├── Effect.cpp
│ ├── Effect.h
│ ├── EffectParameter.cpp
│ ├── EffectParameter.h
│ ├── Font.cpp
│ ├── Font.h
│ ├── ForwardPath.cpp
│ ├── FrameBuffer.cpp
│ ├── FrameBuffer.h
│ ├── Geometry.cpp
│ ├── Geometry.h
│ ├── GpuQuery.h
│ ├── GraphicsCommon.h
│ ├── GraphicsResource.cpp
│ ├── GraphicsResource.h
│ ├── GraphicsScriptLoader.cpp
│ ├── GraphicsScriptLoader.h
│ ├── Image.cpp
│ ├── Image.h
│ ├── Material.cpp
│ ├── Material.h
│ ├── Mesh.cpp
│ ├── Mesh.h
│ ├── MeshPart.cpp
│ ├── MeshPart.h
│ ├── PixelFormat.cpp
│ ├── PixelFormat.h
│ ├── RenderDevice.cpp
│ ├── RenderDevice.h
│ ├── RenderFactory.cpp
│ ├── RenderFactory.h
│ ├── RenderOperation.cpp
│ ├── RenderOperation.h
│ ├── RenderPath.cpp
│ ├── RenderPath.h
│ ├── RenderQueue.cpp
│ ├── RenderQueue.h
│ ├── RenderState.cpp
│ ├── RenderState.h
│ ├── Renderable.cpp
│ ├── Renderable.h
│ ├── SimpleGeometry.cpp
│ ├── SimpleGeometry.h
│ ├── Skeleton.cpp
│ ├── Skeleton.h
│ ├── Sky.cpp
│ ├── Sky.h
│ ├── SpriteBatch.cpp
│ ├── SpriteBatch.h
│ ├── TextureResource.cpp
│ ├── TextureResource.h
│ ├── VertexDeclaration.cpp
│ ├── VertexDeclaration.h
│ ├── pfm.cpp
│ └── pfm.h
├── IO
│ ├── FileStream.cpp
│ ├── FileStream.h
│ ├── FileSystem.cpp
│ ├── FileSystem.h
│ ├── MemoryStream.cpp
│ ├── MemoryStream.h
│ ├── PathUtil.cpp
│ ├── PathUtil.h
│ ├── Stream.cpp
│ └── Stream.h
├── Input
│ ├── InputEvent.h
│ ├── InputSystem.cpp
│ └── InputSystem.h
├── MainApp
│ ├── AppSettings.h
│ ├── Application.cpp
│ ├── Application.h
│ ├── Window.cpp
│ ├── Window.h
│ ├── Window_Android.cpp
│ └── Window_Win32.cpp
├── Math
│ ├── BoundingBox.h
│ ├── BoundingBox.inl
│ ├── BoundingSphere.h
│ ├── BoundingSphere.inl
│ ├── ColorRGBA.cpp
│ ├── ColorRGBA.h
│ ├── ColorRGBA.inl
│ ├── Frustum.h
│ ├── Frustum.inl
│ ├── Math.h
│ ├── Math.inl
│ ├── MathUtil.h
│ ├── MathUtil.inl
│ ├── Matrix.h
│ ├── Matrix.inl
│ ├── Plane.h
│ ├── Plane.inl
│ ├── Quaternion.h
│ ├── Quaternion.inl
│ ├── Ray.h
│ ├── Rectangle.h
│ ├── Rectangle.inl
│ ├── Vector.h
│ └── Vector.inl
├── RcEngine.vcxproj
├── RcEngine.vcxproj.filters
├── RcEngine.vcxproj.user
├── Resource
│ ├── Resource.cpp
│ ├── Resource.h
│ ├── ResourceManage.cpp
│ └── ResourceManager.h
└── Scene
│ ├── Entity.cpp
│ ├── Entity.h
│ ├── Light.cpp
│ ├── Light.h
│ ├── Node.cpp
│ ├── Node.h
│ ├── SceneManager.cpp
│ ├── SceneManager.h
│ ├── SceneNode.cpp
│ ├── SceneNode.h
│ ├── SceneObject.cpp
│ ├── SceneObject.h
│ ├── SubEntity.cpp
│ └── SubEntity.h
├── Samples
├── AnimationApp
│ ├── AnimationApp.cpp
│ ├── AnimationApp.vcxproj
│ ├── AnimationApp.vcxproj.filters
│ └── AnimationApp.vcxproj.user
├── Character
│ ├── Character.vcxproj
│ ├── Character.vcxproj.filters
│ ├── Character.vcxproj.user
│ ├── CharacterApp.cpp
│ ├── CharacterApp.h
│ ├── SinbadCharacterController.cpp
│ ├── SinbadCharacterController.h
│ ├── ThirdPersonCamera.cpp
│ └── ThirdPersonCamera.h
├── FastGlobalIllumination
│ ├── DeepGBufferRadiosity.cpp
│ ├── DeepGBufferRadiosity.h
│ ├── DeepGBufferRadiosityApp.cpp
│ ├── DeepGBufferRadiositySettings.cpp
│ ├── DeepGBufferRadiositySettings.h
│ ├── FastGlobalIllumination.vcxproj
│ ├── FastGlobalIllumination.vcxproj.filters
│ └── FastGlobalIllumination.vcxproj.user
├── GIRoomApp
│ ├── GIRoomApp.cpp
│ ├── GIRoomApp.h
│ ├── GIRoomApp.vcxproj
│ ├── GIRoomApp.vcxproj.filters
│ └── GIRoomApp.vcxproj.user
├── GUIApp.png
├── GUIApp
│ ├── GUIApp.vcxproj
│ ├── GUIApp.vcxproj.filters
│ ├── GUIApp.vcxproj.user
│ └── Main.cpp
├── RenderPath
│ ├── LightAnimation.cpp
│ ├── LightAnimation.h
│ ├── RenderPath.vcxproj
│ ├── RenderPath.vcxproj.filters
│ ├── RenderPath.vcxproj.user
│ ├── RenderPathApp.cpp
│ └── RenderPathApp.h
├── RenderPathApp.png
└── ShadowMapApp
│ ├── ShadowMapApp.cpp
│ ├── ShadowMapApp.h
│ ├── ShadowMapApp.vcxproj
│ ├── ShadowMapApp.vcxproj.filters
│ └── ShadowMapApp.vcxproj.user
├── Test
├── FbxTest
│ ├── App.cpp
│ ├── App.h
│ ├── FbxTest.vcxproj
│ ├── FbxTest.vcxproj.filters
│ └── FbxTest.vcxproj.user
├── MeshTest
│ ├── LightAnimation.h
│ ├── Main.cpp
│ ├── MeshTest.vcxproj
│ ├── MeshTest.vcxproj.filters
│ └── MeshTest.vcxproj.user
├── PSSMTest
│ ├── Main.cpp
│ ├── PSSMTest.vcxproj
│ ├── PSSMTest.vcxproj.filters
│ └── PSSMTest.vcxproj.user
└── TessellationTest
│ ├── Main.cpp
│ ├── Teapot.h
│ ├── TessellationTest.vcxproj
│ ├── TessellationTest.vcxproj.filters
│ └── TessellationTest.vcxproj.user
└── Tools
├── FbxImporter
├── ExportLog.cpp
├── ExportLog.h
├── FbxImporter.cpp
├── FbxImporter.h
├── FbxImporter.vcxproj
├── FbxImporter.vcxproj.filters
├── FbxImporter.vcxproj.user
├── Main.cpp
├── OgreImporter.cpp
└── OgreMeshFileFormat.h
├── FontImporter
├── Common.cpp
├── Common.h
├── Font.cpp
├── Font.h
├── FontImporter.cpp
├── FontImporter.vcxproj
├── FontImporter.vcxproj.filters
├── FontImporter.vcxproj.user
├── Main.cpp
├── SDFont.exe
├── distance-field-3.frag
├── distance-field.frag
├── distance-field.vert
├── edtaa3func.c
├── pfm.cpp
└── pfm.h
├── LOLImporter
├── LOLExporter.cpp
├── LOLExporter.h
├── LOLImporter.vcxproj
├── LOLImporter.vcxproj.filters
└── LOLImporter.vcxproj.user
├── MeshImporter
├── AssimpProcesser.cpp
├── AssimpProcesser.h
├── Main.cpp
├── MaterialData.h
├── MeshData.h
├── MeshImporter.vcxproj
├── MeshImporter.vcxproj.filters
└── MeshImporter.vcxproj.user
└── SDFont.zip
/.gitignore:
--------------------------------------------------------------------------------
1 | # Compiled Object files
2 | *.slo
3 | *.lo
4 | *.o
5 | *.obj
6 | *.tlog
7 |
8 | # Compiled Dynamic libraries
9 | *.so
10 | *.dylib
11 |
12 | # Compiled Static libraries
13 | *.lai
14 | *.la
15 | *.a
16 |
17 | # Visual Studio files
18 | *.opensdf
19 | *.sdf
20 |
21 | # Debug
22 | */Debug/*
23 | */*/Debug/*
24 | */*/*/Debug/*
25 |
26 | # Release
27 | */Release/*
28 | */*/Release/*
29 | */*/*/Release/*
30 |
31 | # Medie
32 | */Media/Mesh/*
33 |
34 | /RcEngine/*.suo
35 | /RcEngine/*.suo
36 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | RcEngine
2 | ========
3 |
4 | RcEngine is a graphics engine implemented in C++, inspired by OGRE and [KlayGE].
5 |
6 | ###Features:
7 |
8 | - Direct3D11 or OpenGL 4.2+ rendering system.
9 | - XML baded Effect system, HLSL or GLSL shaders, caching of bytecode (not finished).
10 | - Support all kinds of shader, including vertex, geometry, tesselation, pixel, compute shaders.
11 | - Multiple render path, including forward, light pre-pass deferred lighting, tile based deferred shading, Forward+.
12 | - Hardware skeletal animation, animation blend, crossfade.
13 | - Shadow map for directional light and spot light, including PSSM, VSM, PCF.
14 | - Inbuilt simple UI system, distance field font (not finished).
15 | - Model/Animation/Material import from FBX or OGRE Binary mesh format.
16 |
17 | ###Todo:
18 | - Change to Entity-Componment architecture.
19 | - Add support for physical engine.
20 | - Add support for lua script.
21 |
22 | ###Samples:
23 |
24 | **Tile Based Deferred Shading**
25 | 
26 |
27 | **GUI**
28 | 
29 |
30 |
31 |
32 | [KlayGE]: http://www.klayge.org/
33 |
--------------------------------------------------------------------------------
/RcEngine/3rdParty/HBAO+/GFSDK_SSAO.win32.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hustruan/RcEngine/4ee06618efc0ed2dfaf81a775b44cc08c2f0a34b/RcEngine/3rdParty/HBAO+/GFSDK_SSAO.win32.dll
--------------------------------------------------------------------------------
/RcEngine/3rdParty/HBAO+/GFSDK_SSAO.win32.lib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hustruan/RcEngine/4ee06618efc0ed2dfaf81a775b44cc08c2f0a34b/RcEngine/3rdParty/HBAO+/GFSDK_SSAO.win32.lib
--------------------------------------------------------------------------------
/RcEngine/3rdParty/HBAO+/GFSDK_SSAO.win64.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hustruan/RcEngine/4ee06618efc0ed2dfaf81a775b44cc08c2f0a34b/RcEngine/3rdParty/HBAO+/GFSDK_SSAO.win64.dll
--------------------------------------------------------------------------------
/RcEngine/3rdParty/HBAO+/GFSDK_SSAO.win64.lib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hustruan/RcEngine/4ee06618efc0ed2dfaf81a775b44cc08c2f0a34b/RcEngine/3rdParty/HBAO+/GFSDK_SSAO.win64.lib
--------------------------------------------------------------------------------
/RcEngine/Config.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/RcEngine/Direct3D11RenderSystem/D3D11Buffer.h:
--------------------------------------------------------------------------------
1 | #ifndef D3D11Buffer_h__
2 | #define D3D11Buffer_h__
3 | #pragma once
4 |
5 | #include "D3D11Prerequisites.h"
6 | #include
7 |
8 | namespace RcEngine {
9 |
10 | class _D3D11Export D3D11Buffer : public GraphicsBuffer
11 | {
12 | public:
13 | D3D11Buffer(uint32_t bufferSize, uint32_t accessHint, uint32_t flags, uint32_t structSize, ElementInitData* initData);
14 | ~D3D11Buffer(void);
15 |
16 | void* Map(uint32_t offset, uint32_t length, ResourceMapAccess options);
17 | void UnMap();
18 |
19 | public:
20 | ID3D11Buffer* BufferD3D11;
21 |
22 | private:
23 | ID3D11Buffer* mStagingBufferD3D11;
24 | ResourceMapAccess mBufferMapAccess;
25 | D3D11_USAGE mBufferUsage;
26 | };
27 |
28 | }
29 | #endif // D3D11Buffer_h__
--------------------------------------------------------------------------------
/RcEngine/Direct3D11RenderSystem/D3D11Device.h:
--------------------------------------------------------------------------------
1 | #ifndef D3D11RenderDevice_h__
2 | #define D3D11RenderDevice_h__
3 |
4 | #include "D3D11Prerequisites.h"
5 | #include
6 |
7 | namespace RcEngine {
8 |
9 | class D3D11Device;
10 | extern D3D11Device* gD3D11Device;
11 |
12 | class _D3D11Export D3D11Device : public RenderDevice
13 | {
14 | public:
15 | D3D11Device();
16 | ~D3D11Device();
17 |
18 | void CreateRenderWindow();
19 | void OnWindowResize(uint32_t width, uint32_t height);
20 | void ToggleFullscreen(bool fs);
21 | void AdjustProjectionMatrix(float4x4& pOut);
22 | void SetSamplerState(ShaderType stage, uint32_t unit, const shared_ptr& state);
23 | void SetBlendState(const shared_ptr& state, const ColorRGBA& blendFactor, uint32_t sampleMask);
24 | void SetRasterizerState(const shared_ptr& state);
25 | void SetDepthStencilState(const shared_ptr& state, uint16_t frontStencilRef = 0, uint16_t backStencilRef = 0);
26 | void SetViewports(const std::vector& vp);
27 | void DispatchCompute(const EffectTechnique* technique, uint32_t threadGroupCountX, uint32_t threadGroupCountY, uint32_t threadGroupCounZ);
28 |
29 | protected:
30 | void DoBindShaderPipeline(const shared_ptr& pipeline);
31 | void DoDraw(const EffectTechnique* technique, const RenderOperation& operation);
32 |
33 | public:
34 | ID3D11DeviceContext* DeviceContextD3D11;
35 | ID3D11Device* DeviceD3D11;
36 |
37 | private:
38 | typedef std::pair SamplerSlot;
39 | std::map> mCurrentSamplers;
40 | };
41 |
42 | }
43 |
44 |
45 |
46 | #endif // D3D11RenderDevice_h__
47 |
--------------------------------------------------------------------------------
/RcEngine/Direct3D11RenderSystem/D3D11GraphicCommon.h:
--------------------------------------------------------------------------------
1 | #ifndef D3D11GraphicCommon_h__
2 | #define D3D11GraphicCommon_h__
3 |
4 | #include "D3D11Prerequisites.h"
5 | #include
6 | #include
7 |
8 | namespace RcEngine {
9 |
10 | class _D3D11Export D3D11Mapping
11 | {
12 | public:
13 |
14 | static void Mapping(uint32_t accessHint, D3D11_USAGE& usage, UINT& CPUAccessFlags);
15 | static DXGI_FORMAT Mapping(VertexElementFormat format);
16 | static DXGI_FORMAT Mapping(PixelFormat inPixelFormat);
17 | static D3D11_COMPARISON_FUNC Mapping(CompareFunction cmpFunc);
18 | static D3D11_STENCIL_OP Mapping(StencilOperation sop);
19 | static D3D11_BLEND_OP Mapping(BlendOperation bop);
20 | static D3D11_BLEND Mapping(AlphaBlendFactor blend);
21 | static D3D11_CULL_MODE Mapping(CullMode mode);
22 | static D3D11_FILL_MODE Mapping(FillMode mode);
23 | static D3D11_TEXTURE_ADDRESS_MODE Mapping(TextureAddressMode mode);
24 | static D3D11_FILTER Mapping(TextureFilter filter, bool compare = false);
25 | static uint32_t Mapping(uint32_t bufferCreateFlags);
26 | static D3D10_PRIMITIVE_TOPOLOGY Mapping(PrimitiveType primType);
27 | static D3D11_MAP Mapping(ResourceMapAccess map);
28 |
29 | static DXGI_FORMAT GetDepthTextureFormat(PixelFormat inPixelFormat);
30 | static DXGI_FORMAT GetDepthShaderResourceFormat(PixelFormat inPixelFormat);
31 | static UINT GetCPUAccessFlags(ResourceMapAccess map);
32 |
33 | static void UnMapping(D3D10_SRV_DIMENSION dimension, EffectParameterType& oTexType);
34 | };
35 |
36 | }
37 |
38 |
39 |
40 |
41 | #endif // D3D11GraphicCommon_h__
42 |
--------------------------------------------------------------------------------
/RcEngine/Direct3D11RenderSystem/D3D11HBAO.h:
--------------------------------------------------------------------------------
1 | #ifndef D3D11SSAO_h__
2 | #define D3D11SSAO_h__
3 |
4 | #include "D3D11Prerequisites.h"
5 | #include
6 | #include
7 |
8 | namespace RcEngine {
9 |
10 | class _D3D11Export D3D11HBAOImpl : public AmbientOcclusion::HBAOImpl
11 | {
12 | public:
13 | D3D11HBAOImpl(uint32_t aoWidth, uint32_t aoHeight);
14 | ~D3D11HBAOImpl();
15 |
16 | virtual void RenderSSAO(const AmbientOcclusionSettings& settings,
17 | const Camera& viewCamera,
18 | const shared_ptr& outAOFrameBuffer,
19 | const shared_ptr& depthBuffer,
20 | const shared_ptr& normalBuffer);
21 |
22 | private:
23 | D3D11_VIEWPORT mViewport;
24 |
25 | GFSDK_SSAO_RenderMask mRenderMask;
26 | GFSDK_SSAO_Parameters_D3D11 mAOParams;
27 | GFSDK_SSAO_Context_D3D11* mAOContext;
28 | };
29 |
30 |
31 | }
32 |
33 |
34 |
35 |
36 | #endif // D3D11SSAO_h__
37 |
--------------------------------------------------------------------------------
/RcEngine/Direct3D11RenderSystem/D3D11Module.cpp:
--------------------------------------------------------------------------------
1 | #include "D3D11Module.h"
2 | #include "D3D11Device.h"
3 |
4 | namespace RcEngine {
5 |
6 | D3D11Module::D3D11Module(void)
7 | : mRenderDevice(0)
8 | {
9 |
10 | }
11 |
12 | D3D11Module::~D3D11Module(void)
13 | {
14 | }
15 |
16 | const String& D3D11Module::GetName() const
17 | {
18 | static String DeviceName("Direct3D 11");
19 | return DeviceName;
20 | }
21 |
22 |
23 | void D3D11Module::Initialise()
24 | {
25 | mRenderDevice = new D3D11Device();
26 | mRenderDevice->CreateRenderWindow();
27 | }
28 |
29 | void D3D11Module::Shutdown()
30 | {
31 | delete mRenderDevice;
32 | mRenderDevice = 0;
33 | }
34 |
35 | }
--------------------------------------------------------------------------------
/RcEngine/Direct3D11RenderSystem/D3D11Module.h:
--------------------------------------------------------------------------------
1 | #ifndef D3D11RenderModule_h__
2 | #define D3D11RenderModule_h__
3 |
4 | #include "D3D11Prerequisites.h"
5 | #include
6 |
7 | namespace RcEngine {
8 |
9 | class D3D11Device;
10 |
11 | class _D3D11Export D3D11Module : public IModule
12 | {
13 | public:
14 | D3D11Module(void);
15 | ~D3D11Module(void);
16 |
17 | const String& GetName() const;
18 | void Initialise();
19 | void Shutdown();
20 |
21 | private:
22 | D3D11Device* mRenderDevice;
23 | };
24 |
25 | }
26 |
27 | #endif // D3D11RenderModule_h__
28 |
--------------------------------------------------------------------------------
/RcEngine/Direct3D11RenderSystem/D3D11Prerequisites.h:
--------------------------------------------------------------------------------
1 | #ifndef D3D11Prerequisites_h__
2 | #define D3D11Prerequisites_h__
3 |
4 | #include
5 | #include
6 | #include
7 |
8 | //////////////////////////////////////////////////////////////////////////
9 | #ifndef BUILD_STATIC
10 | # ifdef D3D11ENGINEDLL_EXPORTS
11 | # define _D3D11Export __declspec(dllexport)
12 | # else
13 | # define _D3D11Export __declspec(dllimport)
14 | # endif
15 | #else
16 | # define _D3D11Export
17 | #endif
18 |
19 | #if defined(DEBUG) || defined(_DEBUG)
20 | #ifndef D3D11_VERRY
21 | #define D3D11_VERRY(x) \
22 | { \
23 | HRESULT hr = (x); \
24 | if (FAILED(hr)) \
25 | { \
26 | fprintf(stderr, "File:%s\nLine:%d\nCalling:%s\n\n", __FILE__, __LINE__, __FUNCTION__); \
27 | assert(false);\
28 | } \
29 | }
30 | #endif
31 | #else
32 | #define D3D11_VERRY(x) (x)
33 | #endif
34 |
35 | #ifndef SAFE_RELEASE
36 | #define SAFE_RELEASE(p) { if (p) { (p)->Release(); (p)=NULL; } }
37 | #endif
38 |
39 |
40 | #endif // D3D11Prerequisites_h__
41 |
--------------------------------------------------------------------------------
/RcEngine/Direct3D11RenderSystem/D3D11RenderWindow.h:
--------------------------------------------------------------------------------
1 | #ifndef D3D11RenderWindow_h__
2 | #define D3D11RenderWindow_h__
3 | #pragma once
4 |
5 | #include "D3D11Prerequisites.h"
6 | #include "D3D11FrameBuffer.h"
7 |
8 | namespace RcEngine {
9 |
10 | struct RenderSettings;
11 |
12 | class _D3D11Export D3D11RenderWindow : public D3D11FrameBuffer
13 | {
14 | public:
15 | D3D11RenderWindow(uint32_t width, uint32_t height);
16 | ~D3D11RenderWindow();
17 |
18 | void ToggleFullscreen(bool fs);
19 | void SwapBuffers();
20 | public:
21 | IDXGISwapChain* SwapChainD3D11;
22 | D3D_FEATURE_LEVEL FeatureLevelD3D11;
23 |
24 | private:
25 | std::string mDescription;
26 | uint32_t mSyncInterval;
27 | };
28 |
29 | }
30 |
31 |
32 | #endif // D3D11RenderWindow_h__
33 |
--------------------------------------------------------------------------------
/RcEngine/Direct3D11RenderSystem/D3D11State.h:
--------------------------------------------------------------------------------
1 | #ifndef D3D11RenderState_h__
2 | #define D3D11RenderState_h__
3 | #pragma once
4 |
5 | #include "D3D11Prerequisites.h"
6 | #include
7 |
8 | namespace RcEngine {
9 |
10 | class _D3D11Export D3D11DepthStencilState : public DepthStencilState
11 | {
12 | public:
13 | D3D11DepthStencilState(const DepthStencilStateDesc& desc);
14 | ~D3D11DepthStencilState();
15 |
16 | public:
17 | ID3D11DepthStencilState* StateD3D11;
18 | };
19 |
20 | class _D3D11Export D3D11BlendState : public BlendState
21 | {
22 | public:
23 | D3D11BlendState(const BlendStateDesc& desc);
24 | ~D3D11BlendState();
25 |
26 | public:
27 | ID3D11BlendState* StateD3D11;
28 | };
29 |
30 | class _D3D11Export D3D11RasterizerState : public RasterizerState
31 | {
32 | public:
33 | D3D11RasterizerState(const RasterizerStateDesc& desc);
34 | ~D3D11RasterizerState();
35 |
36 | public:
37 | ID3D11RasterizerState* StateD3D11;
38 | };
39 |
40 | class _D3D11Export D3D11SamplerState : public SamplerState
41 | {
42 | public:
43 | D3D11SamplerState(const SamplerStateDesc& desc);
44 | ~D3D11SamplerState();
45 |
46 | public:
47 | ID3D11SamplerState* StateD3D11;
48 | };
49 |
50 | }
51 |
52 |
53 |
54 | #endif // D3D11RenderState_h__
--------------------------------------------------------------------------------
/RcEngine/Direct3D11RenderSystem/D3D11Texture3D.cpp:
--------------------------------------------------------------------------------
1 | #include "D3D11Texture.h"
2 | #include "D3D11GraphicCommon.h"
3 |
4 | namespace RcEngine {
5 |
6 | D3D11Texture3D::D3D11Texture3D( PixelFormat format, uint32_t numMipMaps, uint32_t width, uint32_t height, uint32_t depth, uint32_t accessHint, uint32_t flags, ElementInitData* initData )
7 | : D3D11Texture(TT_Texture3D, format, 1, numMipMaps, 1, 0, accessHint, flags),
8 | TextureD3D11(nullptr)
9 | {
10 |
11 | }
12 |
13 | D3D11Texture3D::~D3D11Texture3D()
14 | {
15 | SAFE_RELEASE(TextureD3D11);
16 | }
17 |
18 | //void* D3D11Texture3D::Map3D( uint32_t arrayIndex, uint32_t level, ResourceMapAccess mapType, uint32_t& rowPitch, uint32_t& slicePitch )
19 | //{
20 | // return 0;
21 | //}
22 | //void D3D11Texture3D::Unmap3D( uint32_t arrayIndex, uint32_t level )
23 | //{
24 | //
25 | //}
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 | }
--------------------------------------------------------------------------------
/RcEngine/Direct3D11RenderSystem/D3D11VertexDeclaration.h:
--------------------------------------------------------------------------------
1 | #ifndef D3D11VertexDeclaration_h__
2 | #define D3D11VertexDeclaration_h__
3 | #pragma once
4 |
5 | #include "D3D11Prerequisites.h"
6 | #include
7 |
8 | namespace RcEngine {
9 |
10 | class _D3D11Export D3D11VertexDeclaration : public VertexDeclaration
11 | {
12 | public:
13 | D3D11VertexDeclaration(const VertexElement* element, uint32_t count);
14 | ~D3D11VertexDeclaration(void);
15 |
16 | void CreateInputLayout(const RenderOperation& operation, const Shader& vertexShader);
17 |
18 | public:
19 |
20 | /**
21 | * Hack: InputLayoutD3D11 will be created if it used in draw call
22 | * and InputLayoutD3D11 is still NULL.
23 | */
24 | ID3D11InputLayout* InputLayoutD3D11;
25 | };
26 |
27 | }
28 |
29 |
30 |
31 |
32 | #endif // D3D11VertexDeclaration_h__
--------------------------------------------------------------------------------
/RcEngine/Direct3D11RenderSystem/Direct3D11Query.cpp:
--------------------------------------------------------------------------------
1 | #include "Direct3D11Query.h"
2 | #include "D3D11Device.h"
3 |
4 | namespace RcEngine {
5 |
6 | D3D11TimeQuery::D3D11TimeQuery()
7 | : mQueryD3D11(nullptr)
8 | {
9 | D3D11_QUERY_DESC desc;
10 | desc.Query = D3D11_QUERY_TIMESTAMP;
11 | desc.MiscFlags = 0;
12 |
13 | ID3D11Device* deviceD3D11 = gD3D11Device->DeviceD3D11;
14 | D3D11_VERRY(deviceD3D11->CreateQuery(&desc, &mBeginQueryD3D11));
15 | D3D11_VERRY(deviceD3D11->CreateQuery(&desc, &mEndQueryD3D11));
16 | }
17 |
18 | D3D11Query::~D3D11Query()
19 | {
20 | SAFE_RELEASE(mBeginQueryD3D11);
21 | SAFE_RELEASE(mEndQueryD3D11);
22 | }
23 |
24 | void D3D11Query::BeginQuery()
25 | {
26 | ID3D11DeviceContext* contextD3D11 = gD3D11Device->DeviceContextD3D11;
27 | contextD3D11->End(mBeginQueryD3D11);
28 | }
29 |
30 | void D3D11Query::EndQuery()
31 | {
32 | ID3D11DeviceContext* contextD3D11 = gD3D11Device->DeviceContextD3D11;
33 | contextD3D11->End(mEndQueryD3D11);
34 | }
35 |
36 |
37 |
38 |
39 | }
--------------------------------------------------------------------------------
/RcEngine/Direct3D11RenderSystem/Direct3D11Query.h:
--------------------------------------------------------------------------------
1 | #ifndef Direct3D11Query_h__
2 | #define Direct3D11Query_h__
3 |
4 | #include "D3D11Prerequisites.h"
5 | #include
6 |
7 | namespace RcEngine {
8 |
9 | class _D3D11Export D3D11TimeQuery : public TimeQuery
10 | {
11 | public:
12 | D3D11TimeQuery();
13 | ~D3D11TimeQuery();
14 |
15 | private:
16 | ID3D11Query* mQueryD3D11;
17 | };
18 |
19 | }
20 |
21 | #endif // Direct3D11Query_h__
22 |
--------------------------------------------------------------------------------
/RcEngine/Direct3D11RenderSystem/Direct3D11RenderSystem.vcxproj.user:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/RcEngine/Direct3D11RenderSystem/DllMain.cpp:
--------------------------------------------------------------------------------
1 | #include "D3D11Module.h"
2 |
3 | extern "C" void _D3D11Export dllStartPlugin(RcEngine::IModule** pMoudle)
4 | {
5 | *pMoudle = new RcEngine::D3D11Module();
6 | }
7 |
8 | extern "C" void _D3D11Export dllStopPlugin(RcEngine::IModule** pMoudle)
9 | {
10 | delete (*pMoudle);
11 | }
12 |
--------------------------------------------------------------------------------
/RcEngine/InputSystem/DllMain.cpp:
--------------------------------------------------------------------------------
1 | #include "OISInputModule.h"
2 |
3 | extern "C" void _InputExport dllStartPlugin(RcEngine::IModule** pMoudle)
4 | {
5 | *pMoudle = new RcEngine::OISInputModule();
6 | }
7 |
8 | extern "C" void _InputExport dllStopPlugin(RcEngine::IModule** pMoudle)
9 | {
10 | delete (*pMoudle);
11 | }
12 |
--------------------------------------------------------------------------------
/RcEngine/InputSystem/OISInputKeyboard.cpp:
--------------------------------------------------------------------------------
1 | #include "OISInputKeyboard.h"
2 | #include "OISInputSystem.h"
3 |
4 | namespace RcEngine {
5 |
6 | static String Name = String("OIS Keyboard");
7 |
8 | OISInputKeyboard::OISInputKeyboard( InputSystem* inputSystem )
9 | : Keyboard(inputSystem)
10 | {
11 | assert(inputSystem);
12 | OIS::InputManager* inputManager = (static_cast(mInputSystem))->GetInputManager();
13 | mKeyboard = static_cast(inputManager->createInputObject(OIS::OISKeyboard, false));
14 | }
15 |
16 | OISInputKeyboard::~OISInputKeyboard()
17 | {
18 |
19 | }
20 |
21 | const String& OISInputKeyboard::GetName() const
22 | {
23 | return Name;
24 | }
25 |
26 | void OISInputKeyboard::Update( )
27 | {
28 | mKeyboard->capture();
29 | mIndex = !mIndex;
30 | mKeyboard->copyKeyStates((char*)mKeyBuffer[mIndex]);
31 | }
32 |
33 | }
--------------------------------------------------------------------------------
/RcEngine/InputSystem/OISInputKeyboard.h:
--------------------------------------------------------------------------------
1 | #include "OISInputPrerequisites.h"
2 | #include "Input/InputDevice.h"
3 |
4 | namespace RcEngine {
5 |
6 | class _InputExport OISInputKeyboard : public Keyboard
7 | {
8 | public:
9 | OISInputKeyboard(InputSystem* inputSystem);
10 | ~OISInputKeyboard();
11 |
12 | virtual const String& GetName() const ;
13 | virtual void Update() ;
14 |
15 | private:
16 | OIS::Keyboard* mKeyboard;
17 | };
18 |
19 | }
--------------------------------------------------------------------------------
/RcEngine/InputSystem/OISInputModule.cpp:
--------------------------------------------------------------------------------
1 | #include "OISInputModule.h"
2 |
3 | namespace RcEngine {
4 |
5 | const static std::string ModuleName = "OIS Input System";
6 |
7 | OISInputModule::OISInputModule()
8 | : mInputSystem(nullptr)
9 | {
10 |
11 | }
12 |
13 | OISInputModule::~OISInputModule()
14 | {
15 |
16 | }
17 |
18 | const String& OISInputModule::GetName() const
19 | {
20 | return ModuleName;
21 | }
22 |
23 | void OISInputModule::Initialise()
24 | {
25 | mInputSystem = new OISInputSystem();
26 | }
27 |
28 | void OISInputModule::Shutdown()
29 | {
30 | delete mInputSystem;
31 | mInputSystem = nullptr;
32 | }
33 |
34 | InputSystem* OISInputModule::GetInputSystem()
35 | {
36 | return mInputSystem;
37 | }
38 |
39 | }
40 |
--------------------------------------------------------------------------------
/RcEngine/InputSystem/OISInputModule.h:
--------------------------------------------------------------------------------
1 | #include "OISInputPrerequisites.h"
2 | #include "OISInputSystem.h"
3 | #include "Input/InputModule.h"
4 |
5 | namespace RcEngine {
6 |
7 | class _InputExport OISInputModule : public InputModule
8 | {
9 | public:
10 | OISInputModule();
11 | ~OISInputModule();
12 |
13 | virtual const String& GetName() const;
14 | virtual void Initialise();
15 | virtual void Shutdown();
16 |
17 | virtual InputSystem* GetInputSystem();
18 |
19 | private:
20 | OISInputSystem* mInputSystem;
21 | };
22 |
23 | }
24 |
--------------------------------------------------------------------------------
/RcEngine/InputSystem/OISInputMouse.h:
--------------------------------------------------------------------------------
1 | #include "OISInputPrerequisites.h"
2 | #include "Input/InputDevice.h"
3 |
4 | namespace RcEngine {
5 |
6 | class _InputExport OISInputMouse : public Mouse
7 | {
8 | public:
9 | OISInputMouse(InputSystem* inputSystem, uint32_t width, uint32_t height);
10 | ~OISInputMouse();
11 |
12 | void SetWindowSize(uint32_t width, uint32_t height);
13 | const String& GetName() const;
14 | void Update();
15 |
16 | private:
17 | OIS::Mouse* mMouse;
18 | };
19 |
20 | }
--------------------------------------------------------------------------------
/RcEngine/InputSystem/OISInputPrerequisites.h:
--------------------------------------------------------------------------------
1 | #ifndef OISInputPrerequisites_h__
2 | #define OISInputPrerequisites_h__
3 |
4 | #ifndef BUILD_STATIC
5 | # ifdef OISINPUTSYSTEMDLL_EXPORTS
6 | # define _InputExport __declspec(dllexport)
7 | # else
8 | # define _InputExport __declspec(dllimport)
9 | # endif
10 | #else
11 | # define _InputExport
12 | #endif
13 |
14 | #include
15 | #include
16 | #include
17 |
18 | #endif // OISInputPrerequisites_h__
19 |
--------------------------------------------------------------------------------
/RcEngine/InputSystem/OISInputSystem.h:
--------------------------------------------------------------------------------
1 | #include "OISInputPrerequisites.h"
2 | #include "Input/InputSystem.h"
3 |
4 | namespace RcEngine {
5 |
6 | class _InputExport OISInputSystem : public InputSystem
7 | {
8 | public:
9 | OISInputSystem();
10 | ~OISInputSystem();
11 |
12 | virtual const String& Name() const ;
13 | OIS::InputManager* GetInputManager() const { return mInputManager; }
14 |
15 | private:
16 | OIS::InputManager* mInputManager;
17 | };
18 |
19 | }
--------------------------------------------------------------------------------
/RcEngine/Media/Effect/AmbientOcclusion.effect.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/RcEngine/Media/Effect/DebugView.effect.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/RcEngine/Media/Effect/DeepGBufferRadiosity/DeepGBufferBlur.effect.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/RcEngine/Media/Effect/DeepGBufferRadiosity/DeepGBufferRadiosity.effect.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/RcEngine/Media/Effect/DeepGBufferRadiosity/DeepGBufferShading.effect.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/RcEngine/Media/Effect/DeepGBufferRadiosity/LambertianOnly.effect.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/RcEngine/Media/Effect/DeepGBufferRadiosity/MipmapGen.effect.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/RcEngine/Media/Effect/DeepGBufferRadiosity/Reconstruct.effect.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/RcEngine/Media/Effect/DeepGBufferRadiosity/TemporalFilter.effect.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/RcEngine/Media/Effect/FSQuad.effect.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/RcEngine/Media/Effect/Font.effect.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/RcEngine/Media/Effect/FontOutline.effect.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/RcEngine/Media/Effect/GLSL/BezierCurve.glsl:
--------------------------------------------------------------------------------
1 | [[Vertex=BezierVS]]
2 |
3 | layout (location=0) in vec2 iControlPoint;
4 | layout (location=0) out vec2 oControlPoint;
5 |
6 | void main ()
7 | {
8 | oControlPoint = iControlPoint;
9 | }
10 |
11 | [[TessControl=BezierTCS]]
12 |
13 | layout( vertices=4 ) out;
14 |
15 | uniform int NumSegments;
16 | uniform int NumStrips;
17 |
18 | layout (location=0) in vec2 iControlPoint[];
19 | layout (location=0) out vec2 oControlPoint[];
20 |
21 | void main()
22 | {
23 | // Pass along the vertex position unmodified
24 | oControlPoint[gl_InvocationID] = iControlPoint[gl_InvocationID];
25 |
26 | gl_TessLevelOuter[0] = float(NumStrips);
27 | gl_TessLevelOuter[1] = float(NumSegments);
28 | }
29 |
30 | [[TessEval=BezierTES]]
31 |
32 | layout( isolines ) in;
33 |
34 | uniform vec2 ViewportDim;
35 |
36 | layout (location=0) in vec2 iControlPoint[];
37 |
38 | out gl_PerVertex
39 | {
40 | vec4 gl_Position;
41 | };
42 |
43 | void main()
44 | {
45 | float u = gl_TessCoord.x;
46 |
47 | vec2 p0 = iControlPoint[0];
48 | vec2 p1 = iControlPoint[1];
49 | vec2 p2 = iControlPoint[2];
50 | vec2 p3 = iControlPoint[3];
51 |
52 | float u1 = (1.0 - u);
53 | float u2 = u * u;
54 |
55 | // Bernstein polynomials
56 | float b3 = u2 * u;
57 | float b2 = 3.0 * u2 * u1;
58 | float b1 = 3.0 * u * u1 * u1;
59 | float b0 = u1 * u1 * u1;
60 |
61 | // Cubic Bezier interpolation
62 | vec2 p = p0 * b0 + p1 * b1 + p2 * b2 + p3 * b3;
63 |
64 | gl_Position = vec4(p.xy / ViewportDim * 2.0, 0.0, 1.0);
65 | }
66 |
67 | [[Fragment=BezierePS]]
68 |
69 | layout (location=0) out vec4 oFragColor;
70 |
71 | void main()
72 | {
73 | oFragColor = vec4(1, 0, 0, 1);
74 | }
--------------------------------------------------------------------------------
/RcEngine/Media/Effect/GLSL/DebugView.glsl:
--------------------------------------------------------------------------------
1 | [[Vertex=VSMain]]
2 |
3 | uniform mat4 World;
4 | uniform mat4 ViewProj;
5 |
6 | layout (location = 0) in vec3 iPos;
7 |
8 | out gl_PerVertex {
9 | vec4 gl_Position;
10 | };
11 |
12 | void main()
13 | {
14 | gl_Position = vec4(iPos, 1.0) * World * ViewProj;
15 | }
16 |
17 | [[Fragment=PSMain]]
18 |
19 | uniform vec3 Color;
20 |
21 | layout (location = 0) out vec4 oFragColor;
22 |
23 | void main()
24 | {
25 | oFragColor = vec4(Color, 1.0);
26 | }
--------------------------------------------------------------------------------
/RcEngine/Media/Effect/GLSL/DeferredUtil.glsl:
--------------------------------------------------------------------------------
1 | #ifndef DeferredPath_GLSL__
2 | #define DeferredPath_GLSL__
3 |
4 | uniform vec4 LightPos; // w dimension is spot light inner cone cos angle
5 | uniform vec4 LightDir; // w dimension is spot light outer cone cos angle
6 | uniform vec3 LightColor;
7 | uniform vec3 LightFalloff;
8 |
9 | uniform sampler2D GBuffer0;
10 | uniform sampler2D GBuffer1;
11 | uniform sampler2D DepthBuffer;
12 |
13 | uniform mat4 InvViewProj;
14 | uniform vec3 CameraOrigin;
15 | uniform vec2 ProjRatio;
16 |
17 | float GetLinearDepth(ivec2 texelPos)
18 | {
19 | float zBuffer = texelFetch(DepthBuffer, texelPos, 0).x;
20 | return ProjRatio.y / (zBuffer - ProjRatio.x);
21 | }
22 |
23 | // Reconstruct world position from zbuffer
24 | vec3 ReconstructWorldPosition(ivec2 texelPos, in vec4 clipPos)
25 | {
26 | float zBuffer = texelFetch(DepthBuffer, texelPos, 0).x;
27 | vec4 worldPositionH = vec4(clipPos.xy / clipPos.w, zBuffer, 1.0) * InvViewProj;
28 | return vec3(worldPositionH.xyz / worldPositionH.w);
29 | }
30 |
31 | void GetNormalAndShininess(in ivec2 texelPos, out vec3 oNormal, out float oShininess)
32 | {
33 | vec4 tap = texelFetch(GBuffer0, texelPos, 0);
34 |
35 | // RGBA16F
36 | //oNormal = normalize(tap.xyz * 2.0 - 1.0); // World Space Normal
37 | oNormal = normalize(tap.xyz);
38 | oShininess = tap.a /** 255.0*/; // Specular power
39 | }
40 |
41 | void GetDiffuseAndSpecular(in ivec2 texelPos, out vec3 oDiffuse, out vec3 oSpecular)
42 | {
43 | vec4 tap = texelFetch(GBuffer1, texelPos, 0);
44 | // Get Diffuse Albedo and Specular
45 | oDiffuse = tap.rgb;
46 | oSpecular = tap.aaa;
47 | }
48 |
49 | #endif //DeferredPath_GLSL__
--------------------------------------------------------------------------------
/RcEngine/Media/Effect/GLSL/FSQuad.glsl:
--------------------------------------------------------------------------------
1 | [[Fragment=BlitColor]]
2 | uniform sampler2D SourceMap;
3 |
4 | layout (location = 0) in vec2 iTex;
5 | layout (location = 0) out vec4 oFragColor;
6 |
7 | void main()
8 | {
9 | oFragColor = texelFetch(SourceMap, ivec2(gl_FragCoord.xy), 0);
10 | }
11 |
12 | [[Fragment=BlitDepth]]
13 | uniform sampler2D SourceMap;
14 |
15 | layout (location = 0) in vec2 iTex;
16 |
17 | void main()
18 | {
19 | gl_FragDepth = texelFetch(SourceMap, ivec2(gl_FragCoord.xy), 0).r;
20 | }
21 |
22 |
--------------------------------------------------------------------------------
/RcEngine/Media/Effect/GLSL/Font.glsl:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hustruan/RcEngine/4ee06618efc0ed2dfaf81a775b44cc08c2f0a34b/RcEngine/Media/Effect/GLSL/Font.glsl
--------------------------------------------------------------------------------
/RcEngine/Media/Effect/GLSL/FullscreenTriangle.glsl:
--------------------------------------------------------------------------------
1 | #ifndef FullscreenTriangle_h__
2 | #define FullscreenTriangle_h__
3 |
4 | layout (location = 0) out vec2 oTex;
5 |
6 | out gl_PerVertex
7 | {
8 | vec4 gl_Position;
9 | };
10 |
11 | void main()
12 | {
13 | // Parametrically work out vertex location for full screen triangle
14 | oTex= vec2((gl_VertexID << 1) & 2, gl_VertexID & 2);
15 | gl_Position = vec4(oTex * vec2(2.0, -2.0) + vec2(-1.0, 1.0), 0.0, 1.0);
16 | }
17 |
18 | #endif // FullscreenTriangle__h__
--------------------------------------------------------------------------------
/RcEngine/Media/Effect/GLSL/GBuffer.glsl:
--------------------------------------------------------------------------------
1 | [[Fragment=GBufferPS]]
2 |
3 | #include "/ModelMaterialFactory.glsl"
4 |
5 | // PS Inputs
6 | in vec4 oPosWS;
7 | in vec2 oTex;
8 |
9 | #ifdef _NormalMap
10 | in mat3 oTangentToWorld;
11 | #else
12 | in vec3 oNormalWS;
13 | #endif
14 |
15 | // PS Outputs
16 | layout(location = 0) out vec4 oFragColor0; // Normal + Shininess
17 | layout(location = 1) out vec4 oFragColor1; // Diffuse + Specular
18 |
19 | void main()
20 | {
21 | Material material;
22 | GetMaterial(oTex, material);
23 |
24 | // normal map
25 | #ifdef _NormalMap
26 | vec3 normal = texture2D( NormalMap, oTex ).rgb * 2.0 - 1.0;
27 | //normal = normalize(normal * oTangentToWorld);
28 | normal = normalize(oTangentToWorld[2]);
29 | #else
30 | vec3 normal = normalize(oNormalWS);
31 | #endif
32 |
33 | // Use RGBA16F
34 | //normal = normal * 0.5 + 0.5;
35 | //CompressUnsignedNormalToNormalsBuffer(normal);
36 |
37 | oFragColor0 = vec4(normal, material.Shininess);
38 | oFragColor1 = vec4(material.DiffuseAlbedo, dot(material.SpecularAlbedo, vec3(0.2126, 0.7152, 0.0722))); // Specular luminance
39 | }
--------------------------------------------------------------------------------
/RcEngine/Media/Effect/GLSL/HDR.glsl:
--------------------------------------------------------------------------------
1 | [[Fragment=CopyColor]]
2 |
3 | uniform sampler2D HDRBuffer;
4 | uniform sampler2D DepthBuffer;
5 |
6 | // Output
7 | layout (location = 0) out vec4 oFragColor;
8 |
9 | void main()
10 | {
11 | ivec2 samplePos = ivec2(gl_FragCoord.xy);
12 | oFragColor = texelFetch(HDRBuffer, samplePos, 0);
13 | }
14 |
15 | [[Fragment=CopyColorDepth]]
16 |
17 | uniform sampler2D HDRBuffer;
18 | uniform sampler2D DepthBuffer;
19 |
20 | // Output
21 | layout (location = 0) out vec4 oFragColor;
22 |
23 | void main()
24 | {
25 | ivec2 samplePos = ivec2(gl_FragCoord.xy);
26 | oFragColor = texelFetch(HDRBuffer, samplePos, 0);
27 | gl_FragDepth = texelFetch(DepthBuffer, samplePos, 0).r;
28 | }
29 |
30 |
--------------------------------------------------------------------------------
/RcEngine/Media/Effect/GLSL/Instancing.glsl:
--------------------------------------------------------------------------------
1 | [[Vertex=VSMain]]
2 |
3 | uniform mat4 ViewProj;
4 |
5 | layout(location = 0) in vec3 iPos;
6 | layout(location = 1) in vec3 iNormal;
7 | layout(location = 2) in vec2 iTex;
8 | layout(location = 3) in mat4 iTransfrom; // Per-Instance
9 |
10 | layout(location = 0) out vec4 oPosWS;
11 | layout(location = 1) out vec3 oNormalWS;
12 | layout(location = 2) out vec2 oTex;
13 |
14 | out gl_PerVertex {
15 | vec4 gl_Position;
16 | };
17 |
18 | void main()
19 | {
20 | oPosWS = iPos * iTransfrom;
21 | oNormalWS = iNormal * mat3(iTransfrom);
22 | iTex = oTex;
23 |
24 | gl_Position = oPosWS * ViewProj;
25 | }
26 |
--------------------------------------------------------------------------------
/RcEngine/Media/Effect/GLSL/MipmapMinify.glsl:
--------------------------------------------------------------------------------
1 | [[Fragment=Minify]]
2 | uniform sampler2D SourceMap;
3 | uniform ivec3 PreviousMIP;
4 |
5 | #define PreviousMIPLevel PreviousMIP.x
6 | #define PreviousMIPSize PreviousMIP.yz
7 |
8 | layout (location = 0) in vec2 iTex;
9 | layout (location = 0) out vec4 oFragColor;
10 |
11 | void main()
12 | {
13 | ivec2 ssP = ivec2(gl_FragCoord.xy);
14 | oFragColor = texelFetch(SourceMap, clamp(ssP * 2 + ivec2(ssP.y & 1, ssP.x & 1), ivec2(0), PreviousMIPSize), PreviousMIPLevel);
15 | }
16 |
17 |
18 | [[Fragment=BlitColor]]
19 |
20 | uniform sampler2D SourceMap;
21 | #pragma SourceMap : LinearSampler
22 |
23 | uniform int MipLevel;
24 |
25 | layout (location = 0) in vec2 iTex;
26 | layout (location = 0) out vec4 oFragColor;
27 |
28 | void main()
29 | {
30 | oFragColor = textureLod(SourceMap, iTex, MipLevel);
31 | }
32 |
--------------------------------------------------------------------------------
/RcEngine/Media/Effect/GLSL/Model.glsl:
--------------------------------------------------------------------------------
1 | [[Vertex=ModelVS]]
2 |
3 | #include "/ModelVertexFactory.glsl"
4 |
5 | // Shader uniforms
6 | uniform mat4 World;
7 | uniform mat4 ViewProj;
8 |
9 | // VS Outputs
10 | out vec4 oPosWS;
11 | out vec2 oTex;
12 |
13 | #ifdef _NormalMap
14 | out mat3 oTangentToWorld;
15 | #else
16 | out vec3 oNormalWS;
17 | #endif
18 |
19 | out gl_PerVertex {
20 | vec4 gl_Position;
21 | };
22 |
23 | void main()
24 | {
25 | #ifdef _Skinning
26 |
27 | mat4 Skin = CalculateSkinMatrix();
28 | mat4 SkinWorld = Skin * World;
29 |
30 | oPosWS = vec4(iPos, 1.0)* SkinWorld;
31 | vec3 normal = normalize(iNormal * mat3(SkinWorld));
32 |
33 | #else
34 |
35 | oPosWS = vec4(iPos, 1.0) * World;
36 | vec3 normal = normalize(iNormal * mat3(World));
37 |
38 | #endif
39 |
40 | // calculate tangent and binormal.
41 | #ifdef _NormalMap
42 | #ifdef _Skinning
43 | vec3 tangent = normalize(iTangent * mat3(SkinWorld));
44 | vec3 binormal = normalize(iBinormal * mat3(SkinWorld));
45 | #else
46 | vec3 tangent = normalize(iTangent * mat3(World));
47 | vec3 binormal = normalize(iBinormal * mat3(World));
48 | #endif
49 |
50 | // actualy this is a world to tangent matrix, because we always use V * Mat.
51 | oTangentToWorld = mat3( tangent, binormal, normal);
52 |
53 | // transpose to get tangent to world matrix
54 | //oTangentToWorld = transpose(oTangentToWorld);
55 | #else
56 | oNormalWS = normal;
57 | #endif
58 |
59 | // texcoord
60 | oTex = iTex;
61 | gl_Position = oPosWS * ViewProj;
62 | }
--------------------------------------------------------------------------------
/RcEngine/Media/Effect/GLSL/ModelVertexFactory.glsl:
--------------------------------------------------------------------------------
1 |
2 | // Make sure that attribe location match VertexStream
3 | #define POSISTION 0
4 |
5 | // Attributes
6 | layout (location = POSISTION) in vec3 iPos;
7 |
8 | #ifdef _Skinning
9 | #define BLENDWEIGHTS (POSISTION+1)
10 | #define BLENDINDICES (BLENDWEIGHTS+1)
11 | layout (location = BLENDWEIGHTS) in vec4 iBlendWeights;
12 | layout (location = BLENDINDICES) in uvec4 iBlendIndices;
13 | #endif
14 |
15 | #ifdef _Skinning
16 | #define NORMAL (BLENDINDICES+1)
17 | #else
18 | #define NORMAL (POSISTION+1)
19 | #endif
20 |
21 | layout (location = NORMAL) in vec3 iNormal;
22 |
23 | #define TEXCOORD (NORMAL+1)
24 | layout (location = TEXCOORD) in vec2 iTex;
25 |
26 | #ifdef _NormalMap
27 | #define TANGENT (TEXCOORD+1)
28 | #define BINORMAL (TANGENT+1)
29 | layout (location = TANGENT) in vec3 iTangent;
30 | layout (location = BINORMAL) in vec3 iBinormal;
31 | #endif
32 |
33 | // Helper function for skin mesh
34 | #ifdef _Skinning
35 |
36 | #define MaxNumBone 92
37 | //uniform mat4 SkinMatrices[MaxNumBone];
38 |
39 | layout(std140) uniform SkinCB
40 | {
41 | mat4 SkinMatrices[MaxNumBone];
42 | };
43 |
44 | mat4 CalculateSkinMatrix()
45 | {
46 | return SkinMatrices[iBlendIndices[0]] * iBlendWeights[0] +
47 | SkinMatrices[iBlendIndices[1]] * iBlendWeights[1] +
48 | SkinMatrices[iBlendIndices[2]] * iBlendWeights[2] +
49 | SkinMatrices[iBlendIndices[3]] * iBlendWeights[3];
50 | }
51 |
52 | #endif
53 |
--------------------------------------------------------------------------------
/RcEngine/Media/Effect/GLSL/PCF.glsl:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hustruan/RcEngine/4ee06618efc0ed2dfaf81a775b44cc08c2f0a34b/RcEngine/Media/Effect/GLSL/PCF.glsl
--------------------------------------------------------------------------------
/RcEngine/Media/Effect/GLSL/SSAO.glsl:
--------------------------------------------------------------------------------
1 | [[Fragment=AlchemyAO]]
2 |
3 | // Total number of direct samples to take at each pixel
4 | #define NUM_SAMPLES (11)
5 |
6 | // This is the number of turns around the circle that the spiral pattern makes. This should be prime to prevent
7 | // taps from lining up. This particular choice was tuned for NUM_SAMPLES == 9
8 | #define NUM_SPIRAL_TURNS (7)
9 |
10 |
11 | uniform sampler2D DepthBuffer;
12 |
13 | vec3 ReconstructViewPosition(uvec2 fragCoord)
14 | {
15 | vec2 clipPos = (vec2(fragCoord) + 0.5) * ViewportDim.zw; // InvViewDim
16 | clipPos = clipPos * 2.0 - 1.0;
17 |
18 | vec4 viewPositionH = vec4(clipPos, zBuffer, 1.0) * InvProj;
19 | return viewPositionH.xyz / viewPositionH.w;
20 | }
21 |
22 | void main()
23 | {
24 | ivec2 iFragCoord = ivec2(gl_FragCoord.xy);
25 |
26 | float3 C = FetchEyePos(iTex);
27 |
28 | // Hash function used in the HPG12 AlchemyAO paper
29 | float randomPatternRotationAngle = (3 * iFragCoord.x ^ iFragCoord.y + iFragCoord.x * iFragCoord.y) * 10;
30 |
31 | }
--------------------------------------------------------------------------------
/RcEngine/Media/Effect/GLSL/ShadowMapBlur.glsl:
--------------------------------------------------------------------------------
1 | [[Fragment=ShadowBlurXPS]]
2 |
3 | uniform sampler2DArray ShadowMap;
4 | #pragma ShadowMap : ShadowSampler
5 |
6 | uniform float ArraySlice;
7 |
8 | layout (location = 0) in vec2 iTex;
9 | layout (location = 0) out vec2 oFragColor;
10 |
11 | void main()
12 | {
13 | vec2 filtered = vec2(0.0);
14 |
15 | // box filter
16 | filtered += textureLodOffset(ShadowMap, vec3(iTex, ArraySlice), 0, ivec2(-2, 0)).rg;
17 | filtered += textureLodOffset(ShadowMap, vec3(iTex, ArraySlice), 0, ivec2(-1, 0)).rg;
18 | filtered += textureLodOffset(ShadowMap, vec3(iTex, ArraySlice), 0, ivec2(0, 0)).rg;
19 | filtered += textureLodOffset(ShadowMap, vec3(iTex, ArraySlice), 0, ivec2(1, 0)).rg;
20 | filtered += textureLodOffset(ShadowMap, vec3(iTex, ArraySlice), 0, ivec2(2, 0)).rg;
21 |
22 | oFragColor = filtered * 0.2;
23 | }
24 |
25 | [[Fragment=ShadowBlurYPS]]
26 |
27 | uniform sampler2D ShadowMapBlurX;
28 | #pragma ShadowMapBlurX : ShadowSampler
29 |
30 | layout (location = 0) in vec2 iTex;
31 | layout (location = 0) out vec2 oFragColor;
32 |
33 | void main()
34 | {
35 | vec2 filtered = vec2(0.0);
36 |
37 | // box filter
38 | filtered += textureLodOffset(ShadowMapBlurX, iTex, 0, ivec2(0, -2)).rg;
39 | filtered += textureLodOffset(ShadowMapBlurX, iTex, 0, ivec2(0, -1)).rg;
40 | filtered += textureLodOffset(ShadowMapBlurX, iTex, 0, ivec2(0, 0)).rg;
41 | filtered += textureLodOffset(ShadowMapBlurX, iTex, 0, ivec2(0, 1)).rg;
42 | filtered += textureLodOffset(ShadowMapBlurX, iTex, 0, ivec2(0, 2)).rg;
43 |
44 | oFragColor = filtered * 0.2;
45 | }
--------------------------------------------------------------------------------
/RcEngine/Media/Effect/GLSL/ShadowMapGen.glsl:
--------------------------------------------------------------------------------
1 | [[Vertex=ShadowMapVS]]
2 |
3 | #include "/ModelVertexFactory.glsl"
4 |
5 | uniform mat4 World;
6 | uniform mat4 ViewProj;
7 |
8 | #ifdef _AlphaTest
9 | layout (location = 0) out vec2 oTex;
10 | #endif
11 |
12 | out gl_PerVertex {
13 | vec4 gl_Position;
14 | };
15 |
16 | void main()
17 | {
18 | #ifdef _Skinning
19 | mat4 Skin = CalculateSkinMatrix();
20 | mat4 SkinWorld = Skin * World;
21 | gl_Position = vec4(iPos, 1.0)* SkinWorld * ViewProj;
22 | #else
23 | gl_Position = vec4(iPos, 1.0)* World * ViewProj;
24 | #endif
25 |
26 | #ifdef _AlphaTest
27 | oTex = iTex;
28 | #endif
29 | }
30 |
31 | [[Fragment=ShadowMapVSM]]
32 |
33 | #include "/ModelMaterialFactory.glsl"
34 |
35 | layout (location = 0) in vec2 iTex;
36 | layout (location = 0) out vec2 oFragDepth;
37 |
38 | void main()
39 | {
40 | #ifdef _AlphaTest
41 | vec4 diffuseTap = texture2D(DiffuseMap, iTex);
42 | if( diffuseTap.a < 0.01 ) discard;
43 | #endif
44 |
45 | oFragDepth.x = gl_FragCoord.z;
46 | oFragDepth.y = gl_FragCoord.z * gl_FragCoord.z;
47 | }
--------------------------------------------------------------------------------
/RcEngine/Media/Effect/GLSL/Sprite.glsl:
--------------------------------------------------------------------------------
1 | [[Vertex=SpriteVS]]
2 |
3 | uniform vec2 InvWindowSize;
4 |
5 | // Shader input
6 | layout (location = 0) in vec3 iPos;
7 | layout (location = 1) in vec2 iTex;
8 | layout (location = 2) in vec4 iColor;
9 |
10 | // Shader output
11 | layout (location = 0) out vec2 oTex;
12 | layout (location = 1) out vec4 oColor;
13 |
14 | out gl_PerVertex {
15 | vec4 gl_Position;
16 | };
17 |
18 | void main()
19 | {
20 | vec3 ndcPos = iPos * vec3(InvWindowSize, 1.0);
21 | ndcPos.y = 1.0 - ndcPos.y;
22 |
23 | oTex = iTex;
24 | oColor = iColor;
25 |
26 | // OpenGL NDC z [-1, 1]
27 | gl_Position = vec4(ndcPos * 2.0 - 1.0, 1.0);
28 | }
29 |
30 | [[Fragment=SpritePS]]
31 |
32 | uniform sampler2D SpriteTexture;
33 | #pragma SpriteTexture : LinearSampler // LinearSampler
34 |
35 | layout (location = 0) in vec2 iTex;
36 | layout (location = 1) in vec4 iColor;
37 |
38 | layout (location = 0) out vec4 oFragColor;
39 |
40 | void main()
41 | {
42 | oFragColor = iColor * texture2D(SpriteTexture, iTex);
43 | }
44 |
--------------------------------------------------------------------------------
/RcEngine/Media/Effect/GLSL/Tessellation.glsl:
--------------------------------------------------------------------------------
1 | [[Vertex=VSMain]]
2 | layout (location = 0) in vec3 iPos;
3 |
4 | out VSOutput
5 | {
6 | vec3 Pos;
7 | } vsOutput;
8 |
9 | void main()
10 | {
11 | vsOutput.Pos = iPos;
12 | }
13 |
14 | [[TessControl=TCMain]]
15 | layout(vertices = 3) out;
16 |
17 | uniform float TessLevelInner;
18 | uniform float TessLevelOuter;
19 |
20 | in VSOutput
21 | {
22 | vec3 Pos;
23 | } tcInput[];
24 |
25 | out TCOutput
26 | {
27 | vec3 Pos;
28 | } tcOutput[];
29 |
30 | void main()
31 | {
32 | tcOutput[gl_InvocationID].Pos = tcInput[gl_InvocationID].Pos;
33 | if (gl_InvocationID == 0)
34 | {
35 | gl_TessLevelInner[0] = TessLevelInner;
36 | gl_TessLevelOuter[0] = TessLevelOuter;
37 | gl_TessLevelOuter[1] = TessLevelOuter;
38 | gl_TessLevelOuter[2] = TessLevelOuter;
39 | }
40 | }
41 |
42 | [[TessEval=TEMain]]
43 | layout(triangles, equal_spacing, cw) in;
44 |
45 | uniform mat4 World;
46 | uniform mat4 ViewProj;
47 |
48 | out TCOutput
49 | {
50 | vec3 Pos;
51 | } teInput[];
52 |
53 | out vec4 oPosWS;
54 |
55 | out gl_PerVertex
56 | {
57 | vec4 gl_Position;
58 | };
59 |
60 | void main()
61 | {
62 | vec3 p0 = gl_TessCoord.x * teInput[0].Pos;
63 | vec3 p1 = gl_TessCoord.y * teInput[1].Pos;
64 | vec3 p2 = gl_TessCoord.z * teInput[2].Pos;
65 |
66 | vec3 tePosition = normalize(p0 + p1 + p2);
67 |
68 | oPosWS = vec4(tePosition, 1.0) * World;
69 | gl_Position = oPosWS * ViewProj;
70 | }
71 |
72 |
--------------------------------------------------------------------------------
/RcEngine/Media/Effect/HDR.effect.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/RcEngine/Media/Effect/HLSL/DebugView.hlsl:
--------------------------------------------------------------------------------
1 | float4x4 World;
2 | float4x4 ViewProj;
3 | float3 Color;
4 |
5 | float4 VSMain(in float3 iPos : POSITION) : SV_POSITION
6 | {
7 | float4x4 wvp = mul(World, ViewProj);
8 | return mul( float4(iPos, 1.0), wvp );
9 | }
10 |
11 | float4 PSMain() : SV_Target0
12 | {
13 | return float4(Color, 1.0);
14 | }
15 |
--------------------------------------------------------------------------------
/RcEngine/Media/Effect/HLSL/DeepGBufferRadiosity/ColorBoost.hlsl:
--------------------------------------------------------------------------------
1 | #ifndef colorBoost_hlsl
2 | #define colorBoost_hlsl
3 | float colorBoost(float3 color, float unsaturatedBoost, float saturatedBoost) {
4 | // Avoid computing the HSV transform in the common case
5 | if (unsaturatedBoost == saturatedBoost) {
6 | return unsaturatedBoost;
7 | }
8 |
9 | float ma = max(color.x, max(color.y, color.z));
10 | float mi = min(color.x, min(color.y, color.z));
11 | float saturation = (ma == 0.0f) ? 0.0f : ((ma - mi) / ma);
12 |
13 | return lerp(unsaturatedBoost, saturatedBoost, saturation);
14 | }
15 | #endif
--------------------------------------------------------------------------------
/RcEngine/Media/Effect/HLSL/DeepGBufferRadiosity/MipmapMinify.hlsl:
--------------------------------------------------------------------------------
1 | Texture2D SourceMap;
2 | int3 PreviousMIP;
3 |
4 | #define PreviousMIPLevel PreviousMIP.x
5 | #define PreviousMIPSize PreviousMIP.yz
6 |
7 | void Minify(in float2 iTex : TEXCOORD0,
8 | in float4 iFragCoord : SV_Position,
9 | out float4 oFragColor : SV_Target0)
10 | {
11 | int2 ssP = int2(iFragCoord.xy);
12 |
13 | // Rotated grid subsampling to avoid XY directional bias or Z precision bias while downsampling
14 | oFragColor = SourceMap.Load(int3(clamp(ssP * 2 + int2(ssP.y & 1, ssP.x & 1), int2(0, 0), PreviousMIPSize), PreviousMIPLevel));
15 | }
16 |
17 | SamplerState LinearSampler;
18 | int MipLevel;
19 |
20 | void BlitColor(in float2 iTex : TEXCOORD0,
21 | in float4 iFragCoord : SV_Position,
22 | out float4 oFragColor : SV_Target0)
23 | {
24 | oFragColor = SourceMap.SampleLevel(LinearSampler, iTex, MipLevel);
25 | }
--------------------------------------------------------------------------------
/RcEngine/Media/Effect/HLSL/DeepGBufferRadiosity/PCF.hlsl:
--------------------------------------------------------------------------------
1 | // Random Possion Disk PCF
2 | SamplerComparisonState PCFSampler;
3 |
4 | #define MAX_POSSION_SAMPLES 24
5 |
6 | cbuffer cbPossionDiskSamples
7 | {
8 | int NumPossionSamples : packoffset(c0.x);
9 | float ShadowFilterSize : packoffset(c0.y);
10 | float ShadowBias : packoffset(c0.z);
11 | float padding12 : packoffset(c0.w);
12 | float4 PoissonDiskSamples[MAX_POSSION_SAMPLES] : packoffset(c1.x);
13 | };
14 |
15 | float EvalPossionPCF(Texture2D shadowMap, float3 shadowTexCoord, float filterRadiusUV)
16 | {
17 | float sum = 0.0f;
18 | for(int i=0; i < NumPossionSamples; i++)
19 | {
20 | float2 offset = PoissonDiskSamples[i].xy * filterRadiusUV;
21 | sum += shadowMap.SampleCmpLevelZero(PCFSampler, shadowTexCoord.xy + offset, shadowTexCoord.z-ShadowBias);
22 | }
23 | return sum /NumPossionSamples;
24 | }
25 |
26 | // GIRoom
27 | static const float gShadowBias[4] = { 0.005f, 0.006f, 0.0009f, 0.0009f };
28 |
29 | float EvalPossionPCF(Texture2DArray CSM, float4 shadowTexCoord, float filterRadiusUV)
30 | {
31 | //float shadowBias = 0.003f;
32 | float shadowBias = gShadowBias[(int)shadowTexCoord.w];
33 |
34 | float sum = 0.0f;
35 | for(int i=0; i < NumPossionSamples; i++)
36 | {
37 | float2 offset = PoissonDiskSamples[i].xy * filterRadiusUV;
38 | sum += CSM.SampleCmpLevelZero(PCFSampler, float3(shadowTexCoord.xy + offset, shadowTexCoord.w), shadowTexCoord.z-shadowBias);
39 | }
40 | return sum /NumPossionSamples;
41 | }
42 |
43 |
44 |
--------------------------------------------------------------------------------
/RcEngine/Media/Effect/HLSL/DeepGBufferRadiosity/ReconstructCSZ.hlsl:
--------------------------------------------------------------------------------
1 | Texture2D DepthBuffer;
2 |
3 | #if USE_DEPTH_PEEL
4 | Texture2D PeeledDepthBuffer;
5 | #if USE_OCT16
6 | Texture2D NormalBuffer;
7 | Texture2D PeeledNormalBuffer;
8 | #endif
9 | #endif
10 |
11 | float2 ClipInfo;
12 |
13 | struct PixelOutput
14 | {
15 | #if USE_DEPTH_PEEL == 0
16 | float CSZDepth : SV_Target0;
17 | #else
18 | float2 CSZDepth : SV_Target0;
19 | #if USE_OCT16
20 | float4 Normal : SV_Target1;
21 | #endif
22 | #endif
23 | };
24 |
25 | #if USE_OCT16
26 | #include "oct.hlsl"
27 | float4 FetchAndEncodeNormal(int3 ssP)
28 | {
29 | float2 n0 = encode16(NormalBuffer.Load(ssP).rgb * 2.0 - 1.0) * 0.5 + 0.5;
30 | float2 n1 = encode16(PeeledNormalBuffer.Load(ssP).rgb * 2.0 - 1.0) * 0.5 + 0.5;
31 | return float4(n0, n1);
32 | }
33 | #endif
34 |
35 | PixelOutput ReconstructCSZ(in float2 oTex : TEXCOORD0,
36 | in float4 iFragCoord : SV_Position)
37 | {
38 | PixelOutput output;
39 |
40 | int3 ssP = int3(iFragCoord.xy, 0);
41 | float z0 = DepthBuffer.Load(ssP).r;
42 |
43 | #if USE_DEPTH_PEEL
44 | float z1 = PeeledDepthBuffer.Load(ssP).r;
45 | output.CSZDepth = float2( ClipInfo.y / ( z0 - ClipInfo.x),
46 | ClipInfo.y / ( z1 - ClipInfo.x) );
47 |
48 | #if USE_OCT16
49 | output.Normal = FetchAndEncodeNormal(ssP);
50 | #endif
51 | #else
52 | output.CSZDepth = z0;
53 | #endif
54 |
55 | return output;
56 | }
57 |
--------------------------------------------------------------------------------
/RcEngine/Media/Effect/HLSL/DeepGBufferRadiosity/oct.hlsl:
--------------------------------------------------------------------------------
1 | float signNotZero(in float k) {
2 | return k >= 0.0 ? 1.0 : -1.0;
3 | }
4 |
5 | float2 signNotZero(in float2 v) {
6 | return float2( signNotZero(v.x), signNotZero(v.y) );
7 | }
8 |
9 | float2 octEncode(in float3 v) {
10 | float l1norm = abs(v.x) + abs(v.y) + abs(v.z);
11 | float2 result = v.xy * (1.0/l1norm);
12 | if (v.z < 0.0) {
13 | result = (1.0 - abs(result.yx)) * signNotZero(result.xy);
14 | }
15 | return result;
16 | }
17 |
18 | float3 finalDecode(float x, float y) {
19 | float3 v = float3(x, y, 1.0 - abs(x) - abs(y));
20 | if (v.z < 0) {
21 | v.xy = (1.0 - abs(v.yx)) * signNotZero(v.xy);
22 | }
23 | return normalize(v);
24 | }
25 |
26 | float2 encode16(in float3 v) {
27 | return octEncode(v);
28 | }
29 |
30 | float3 decode16(in float2 p) {
31 | return finalDecode(p.x, p.y);
32 | }
--------------------------------------------------------------------------------
/RcEngine/Media/Effect/HLSL/DeferredUtil.hlsl:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hustruan/RcEngine/4ee06618efc0ed2dfaf81a775b44cc08c2f0a34b/RcEngine/Media/Effect/HLSL/DeferredUtil.hlsl
--------------------------------------------------------------------------------
/RcEngine/Media/Effect/HLSL/DepthPeel.hlsl:
--------------------------------------------------------------------------------
1 | #ifndef DepthPeel_hlsl__
2 | #define DepthPeel_hlsl__
3 |
4 |
5 |
6 |
7 |
8 | #endif
--------------------------------------------------------------------------------
/RcEngine/Media/Effect/HLSL/FSQuad.hlsl:
--------------------------------------------------------------------------------
1 | Texture2D SourceMap;
2 |
3 | void BlitColor(in float2 iTex : TEXCOORD0,
4 | in float4 iFragCoord : SV_Position,
5 | out float4 oFragColor : SV_Target0)
6 | {
7 | oFragColor = SourceMap.Load(int3(iFragCoord.xy, 0));
8 | }
9 |
10 | void BlitDepth(in float2 iTex : TEXCOORD0,
11 | in float4 iFragCoord : SV_Position,
12 | out float oFragDepth : SV_Depth)
13 | {
14 | oFragDepth = SourceMap.Load(int3(iFragCoord.xy, 0)).r;
15 | }
16 |
--------------------------------------------------------------------------------
/RcEngine/Media/Effect/HLSL/Font.hlsl:
--------------------------------------------------------------------------------
1 | Texture2D SpriteTexture;
2 | SamplerState LinearSampler;
3 |
4 | static const float GlyphCenter = 0.46;
5 | static const float OutlineCenter = 0.65;
6 | static const float3 OutlineColor = float3(1, 0, 0);
7 |
8 | void SDFFontPS(in float2 iTex : TEXCOORD0,
9 | in float4 iColor : TEXCOORD1,
10 | out float4 oFragColor : SV_Target0)
11 | {
12 | // retrieve signed distance
13 | float sdf = SpriteTexture.Sample( LinearSampler, iTex).a;
14 |
15 | // perform adaptive anti-aliasing of the edges
16 | float w = fwidth(sdf);
17 | float a = smoothstep(GlyphCenter-w,GlyphCenter+w, sdf);
18 |
19 | // final color
20 | oFragColor = float4(iColor.rgb, iColor.a*a);
21 | }
22 |
23 | void SDFFontOutlinePS(in float2 iTex : TEXCOORD0,
24 | in float4 iColor : TEXCOORD1,
25 | out float4 oFragColor : SV_Target0)
26 | {
27 | // retrieve signed distance
28 | float sdf = SpriteTexture.Sample( LinearSampler, iTex).a;
29 |
30 | // perform adaptive anti-aliasing of the edges
31 | float w = fwidth(sdf);
32 | float a = smoothstep(GlyphCenter-w,GlyphCenter+w, sdf);
33 |
34 | // Outline
35 | float mu = smoothstep(OutlineCenter-w, OutlineCenter+w, sdf);
36 | float3 rgb = lerp(OutlineColor, iColor.rgb, mu);
37 | oFragColor = float4(rgb, max(a, mu));
38 | }
--------------------------------------------------------------------------------
/RcEngine/Media/Effect/HLSL/FullscreenTriangle.hlsl:
--------------------------------------------------------------------------------
1 | #ifndef FullscreenTriangle_h__
2 | #define FullscreenTriangle__h__
3 |
4 | void FullscreenTriangleVS(uint iVertexID : SV_VertexID,
5 | out float2 oTex : TEXCOORD0,
6 | out float4 oPosition : SV_Position)
7 | {
8 | // Parametrically work out vertex location for full screen triangle
9 | float2 grid = float2((iVertexID << 1) & 2, iVertexID & 2);
10 |
11 | oTex = grid;
12 | oPosition = float4(grid * float2(2.0f, -2.0f) + float2(-1.0f, 1.0f), 0.0f, 1.0f);
13 | }
14 |
15 | #endif // FullscreenTriangle__h__
--------------------------------------------------------------------------------
/RcEngine/Media/Effect/HLSL/GBuffer.hlsl:
--------------------------------------------------------------------------------
1 | #include "ModelVertexFactory.hlsl"
2 | #include "ModelMaterialFactory.hlsl"
3 |
4 | void GBufferPS(in VSOutput input,
5 | out float4 oFragColor0 : SV_Target0,
6 | out float4 oFragColor1 : SV_Target1 )
7 | {
8 | Material material;
9 | GetMaterial(input.Tex, material);
10 |
11 | // normal map
12 | #ifdef _NormalMap
13 | float3 normal = NormalMap.Sample(MaterialSampler , input.Tex ).rgb * 2.0 - 1.0;
14 | //normal = normalize( mul(normal, input.TangentToWorld) );
15 | normal = normalize( input.TangentToWorld[2] );
16 | #else
17 | float3 normal = normalize(input.NormalWS);
18 | #endif
19 |
20 | // Use RGBA16F
21 | //normal = normal * 0.5 + 0.5;
22 | //CompressUnsignedNormalToNormalsBuffer(normal);
23 |
24 | oFragColor0 = float4(normal, material.Shininess);
25 | oFragColor1 = float4(material.DiffuseAlbedo, dot(material.SpecularAlbedo, float3(0.2126, 0.7152, 0.0722)) ); // Specular luminance
26 | }
27 |
--------------------------------------------------------------------------------
/RcEngine/Media/Effect/HLSL/HDR.hlsl:
--------------------------------------------------------------------------------
1 | Texture2D HDRBuffer;
2 | Texture2D DepthBuffer;
3 |
4 | float4 CopyColor(in float2 oTex : TEXCOORD0,
5 | in float4 iFragCoord : SV_Position) : SV_Target0
6 | {
7 | int3 samplePos = int3(iFragCoord.xy, 0);
8 | return HDRBuffer.Load(samplePos);
9 | }
10 |
11 | void CopyColorDepth(in float2 oTex : TEXCOORD0 : TEXCOORD0,
12 | in float4 iFragCoord : SV_Position,
13 | out float4 oFragColor : SV_Target0,
14 | out float oDepth : SV_Depth)
15 | {
16 |
17 | int3 samplePos = int3(iFragCoord.xy, 0);
18 | oFragColor = HDRBuffer.Load(samplePos);
19 | oDepth = DepthBuffer.Load(samplePos);
20 | }
--------------------------------------------------------------------------------
/RcEngine/Media/Effect/HLSL/Math.hlsl:
--------------------------------------------------------------------------------
1 | #ifndef Math_hlsl__
2 | #define Math_hlsl__
3 |
4 | /// Compute Schlick's approximation of the Fresnel coefficient.
5 | float3 ComputeFresnel(float3 F0, float cos_i)
6 | {
7 | return lerp(F0, (float3)1.0, pow(1.0 - max(0.0, cos_i), 5.0));
8 | }
9 |
10 |
11 |
12 |
13 | #endif //Math_hlsl__
--------------------------------------------------------------------------------
/RcEngine/Media/Effect/HLSL/ModelMaterialFactory.hlsl:
--------------------------------------------------------------------------------
1 |
2 | #ifdef _DiffuseMap
3 | Texture2D DiffuseMap;
4 | #else
5 | float3 DiffuseColor;
6 | #endif
7 |
8 | #ifdef _SpecularMap
9 | Texture2D SpecularMap;
10 | #else
11 | float3 SpecularColor;
12 | #endif
13 |
14 | #ifndef _GlossyMap
15 | float Shininess;
16 | #endif
17 |
18 | #ifdef _NormalMap
19 | Texture2D NormalMap;
20 | #endif
21 |
22 | #if defined(_DiffuseMap) || defined(_SpecularMap) || defined(_NormalMap)
23 | SamplerState MaterialSampler;
24 | #endif
25 |
26 | // Material definition
27 | struct Material
28 | {
29 | float3 DiffuseAlbedo;
30 | float3 SpecularAlbedo;
31 | float Shininess;
32 | };
33 |
34 | void GetMaterial(in float2 iTex, out Material material)
35 | {
36 | // diffuse material
37 | #ifdef _DiffuseMap
38 | float4 diffuseTap = DiffuseMap.Sample(MaterialSampler, iTex);
39 | #ifdef _AlphaTest
40 | if( diffuseTap.a < 0.01 ) discard;
41 | #endif
42 | material.DiffuseAlbedo = diffuseTap.rgb;
43 | #else
44 | material.DiffuseAlbedo = DiffuseColor;
45 | #endif
46 |
47 | // specular material
48 | #ifdef _SpecularMap
49 | float4 specularTap = SpecularMap.Sample(MaterialSampler, iTex);
50 | //vec3 specular = specularTap.rgb;
51 | material.SpecularAlbedo = specularTap.rrr;
52 | #ifdef _GlossyMap
53 | material.Shininess = specularTap.a * 255;
54 | #else
55 | material.Shininess = Shininess;
56 | #endif
57 | #else
58 | material.SpecularAlbedo = SpecularColor;
59 | material.Shininess = Shininess;
60 | #endif
61 | }
--------------------------------------------------------------------------------
/RcEngine/Media/Effect/HLSL/ModelVertexFactory.hlsl:
--------------------------------------------------------------------------------
1 | struct VSInput
2 | {
3 | float3 Pos : POSITION;
4 |
5 | #ifdef _Skinning
6 | float4 BlendWeights : BLENDWEIGHTS;
7 | uint4 BlendIndices : BLENDINDICES;
8 | #endif
9 |
10 | float3 Normal : NORMAL;
11 |
12 | #if defined(_DiffuseMap) || defined(_DummyMap)
13 | float2 Tex : TEXCOORD0;
14 | #endif
15 |
16 | #ifdef _NormalMap
17 | float3 Tangent : TANGENT;
18 | float3 Binormal : BINORMAL;
19 | #endif
20 | };
21 |
22 | // Outputs
23 | struct VSOutput
24 | {
25 | float4 PosWS : TEXCOORD0;
26 | float2 Tex : TEXCOORD1;
27 |
28 | #ifdef _NormalMap
29 | float3x3 TangentToWorld : TEXCOORD3;
30 | #else
31 | float3 NormalWS : TEXCOORD3;
32 | #endif
33 |
34 | float4 PosCS : SV_POSITION;
35 | };
36 |
37 | // Help function
38 | #ifdef _Skinning
39 |
40 | #define MaxNumBone 92
41 | cbuffer SkinCB
42 | {
43 | float4x4 SkinMatrices[MaxNumBone];
44 | };
45 |
46 | float4x4 CalculateSkinMatrix(in float4 BlendWeights, in float4 BlendIndices)
47 | {
48 | return SkinMatrices[BlendIndices[0]] * BlendWeights[0] +
49 | SkinMatrices[BlendIndices[1]] * BlendWeights[1] +
50 | SkinMatrices[BlendIndices[2]] * BlendWeights[2] +
51 | SkinMatrices[BlendIndices[3]] * BlendWeights[3];
52 | }
53 | #endif
--------------------------------------------------------------------------------
/RcEngine/Media/Effect/HLSL/PCF.hlsl:
--------------------------------------------------------------------------------
1 | // Random Possion Disk PCF
2 | SamplerComparisonState PCFSampler;
3 |
4 | #define MAX_POSSION_SAMPLES 24
5 |
6 | cbuffer cbPossionDiskSamples
7 | {
8 | int NumPossionSamples : packoffset(c0.x);
9 | float ShadowFilterSize : packoffset(c0.y);
10 | float ShadowBias : packoffset(c0.z);
11 | float padding12 : packoffset(c0.w);
12 | float4 PoissonDiskSamples[MAX_POSSION_SAMPLES] : packoffset(c1.x);
13 | };
14 |
15 | float EvalPossionPCF(Texture2D shadowMap, float3 shadowTexCoord, float filterRadiusUV)
16 | {
17 | float sum = 0.0f;
18 | for(int i=0; i < NumPossionSamples; i++)
19 | {
20 | float2 offset = PoissonDiskSamples[i].xy * filterRadiusUV;
21 | sum += shadowMap.SampleCmpLevelZero(PCFSampler, shadowTexCoord.xy + offset, shadowTexCoord.z-ShadowBias);
22 | }
23 | return sum /NumPossionSamples;
24 | }
25 |
26 | //static const float gShadowBias[4] = { 0.003f, 0.003f, 0.003f, 0.003f };
27 |
28 | // GIRoom
29 | static const float gShadowBias[4] = { 0.005f, 0.006f, 0.0009f, 0.0009f };
30 |
31 | float EvalPossionPCF(Texture2DArray CSM, float4 shadowTexCoord, float filterRadiusUV)
32 | {
33 | //float shadowBias = 0.003f;
34 | //float shadowBias = 0.0003f;
35 | float shadowBias = gShadowBias[(int)shadowTexCoord.w];
36 |
37 | float sum = 0.0f;
38 | for(int i=0; i < NumPossionSamples; i++)
39 | {
40 | float2 offset = PoissonDiskSamples[i].xy * filterRadiusUV;
41 | sum += CSM.SampleCmpLevelZero(PCFSampler, float3(shadowTexCoord.xy + offset, shadowTexCoord.w), shadowTexCoord.z-shadowBias);
42 | }
43 | return sum /NumPossionSamples;
44 | }
45 |
46 |
47 |
--------------------------------------------------------------------------------
/RcEngine/Media/Effect/HLSL/ReconstructCSZ.hlsl:
--------------------------------------------------------------------------------
1 | Texture2D DepthBuffer;
2 | float2 ClipInfo;
3 | int PreviousMIPLevel;
4 |
5 | void ReconstructCSZ(in float2 oTex : TEXCOORD0,
6 | in float4 iFragCoord : SV_Position,
7 | out float oCSZDepth : SV_Target0)
8 | {
9 | float z = DepthBuffer.Load(int3(iFragCoord.xy, 0)).r;
10 | oCSZDepth = ClipInfo.y / ( z - ClipInfo.x);
11 | }
12 |
13 | void CSZMinify(in float4 iFragCoord : SV_Position, out float oCSZLevel : SV_Target0)
14 | {
15 | int2 ssP = int2(iFragCoord.xy);
16 |
17 | // Rotated grid subsampling to avoid XY directional bias or Z precision bias while downsampling
18 | //oCSZLevel = DepthBuffer.Load(int3(ssP * 2 + int2((ssP.y & 1) ^ 1, (ssP.x & 1) ^ 1), PreviousMIPLevel)).r;
19 | oCSZLevel = DepthBuffer.Load(int3(ssP, 0)).r;
20 | }
21 |
22 | float4 CopyColor(in float2 oTex : TEXCOORD0,
23 | in float4 iFragCoord : SV_Position) : SV_Target0
24 | {
25 | float z = DepthBuffer.Load(int3(iFragCoord.xy, 0)).r;
26 | return float4(z, z, z, 1.0);
27 | }
28 |
29 |
--------------------------------------------------------------------------------
/RcEngine/Media/Effect/HLSL/ShadowMapBlur.hlsl:
--------------------------------------------------------------------------------
1 |
2 | Texture2DArray ShadowMap; // Texture Array for PSSM
3 | Texture2D ShadowMapBlurX;
4 | SamplerState ShadowSampler;
5 | float ArraySlice;
6 |
7 | void ShadowBlurXPS(in float2 iTex : TEXCOORD0,
8 | out float2 oFragColor : SV_Target0)
9 | {
10 | float2 filtered = 0.0;
11 |
12 | // box filter
13 | filtered += ShadowMap.SampleLevel(ShadowSampler, float3(iTex, ArraySlice), 0, int2(-2, 0)).rg;
14 | filtered += ShadowMap.SampleLevel(ShadowSampler, float3(iTex, ArraySlice), 0, int2(-1, 0)).rg;
15 | filtered += ShadowMap.SampleLevel(ShadowSampler, float3(iTex, ArraySlice), 0, int2(0, 0)).rg;
16 | filtered += ShadowMap.SampleLevel(ShadowSampler, float3(iTex, ArraySlice), 0, int2(1, 0)).rg;
17 | filtered += ShadowMap.SampleLevel(ShadowSampler, float3(iTex, ArraySlice), 0, int2(2, 0)).rg;
18 |
19 | oFragColor = filtered * 0.2;
20 | }
21 |
22 |
23 | void ShadowBlurYPS(in float2 iTex : TEXCOORD0,
24 | out float2 oFragColor : SV_Target0)
25 | {
26 | float2 filtered = 0.0;
27 |
28 | filtered += ShadowMapBlurX.SampleLevel(ShadowSampler, iTex, 0, int2(0, -2)).rg;
29 | filtered += ShadowMapBlurX.SampleLevel(ShadowSampler, iTex, 0, int2(0, -1)).rg;
30 | filtered += ShadowMapBlurX.SampleLevel(ShadowSampler, iTex, 0, int2(0, 0)).rg;
31 | filtered += ShadowMapBlurX.SampleLevel(ShadowSampler, iTex, 0, int2(0, 1)).rg;
32 | filtered += ShadowMapBlurX.SampleLevel(ShadowSampler, iTex, 0, int2(0, 2)).rg;
33 |
34 | oFragColor = filtered * 0.2;
35 | }
36 |
--------------------------------------------------------------------------------
/RcEngine/Media/Effect/HLSL/Sky.hlsl:
--------------------------------------------------------------------------------
1 |
2 | SamplerState EnvSampler;
3 | TextureCube EnvMap;
4 |
5 | float4x4 WorldViewProj;
6 |
7 | void SkyVS(in float3 iPos : POSITION,
8 | out float3 oTex : TEXCOORD0,
9 | out float4 oPosition : SV_Position)
10 | {
11 | oTex = iPos;
12 |
13 | //Set Pos to xyww instead of xyzw, so that z will always be 1 (furthest from camera)
14 | oPosition = mul( float4(iPos, 1.0), WorldViewProj ).xyww;
15 | }
16 |
17 |
18 | float4 SkyPS(in float3 iTex : TEXCOORD0) : SV_Target0
19 | {
20 | return EnvMap.Sample(EnvSampler, iTex);
21 | }
--------------------------------------------------------------------------------
/RcEngine/Media/Effect/HLSL/Sprite.hlsl:
--------------------------------------------------------------------------------
1 | float2 InvWindowSize;
2 | Texture2D SpriteTexture;
3 | SamplerState LinearSampler;
4 |
5 | //--------------------------------------------------------------------------------
6 | void SpriteVS(in float3 iPos : POSITION,
7 | in float2 iTex : TEXCOORD0,
8 | in float4 iColor : COLOR,
9 | out float2 oTex : TEXCOORD0,
10 | out float4 oColor : TEXCOORD1,
11 | out float4 oPosCS : SV_POSITION)
12 | {
13 | float2 normPos = float2(iPos.xy) * InvWindowSize;
14 | normPos.y = 1.0 - normPos.y;
15 |
16 | oTex = iTex;
17 | oColor = iColor;
18 |
19 | oPosCS = float4(normPos * 2.0 - 1.0, iPos.z, 1.0);
20 | }
21 |
22 | //--------------------------------------------------------------------------------
23 | void SpritePS(in float2 iTex : TEXCOORD0,
24 | in float4 iColor : TEXCOORD1,
25 | out float4 oFragColor : SV_Target0)
26 | {
27 | oFragColor = iColor * SpriteTexture.Sample( LinearSampler, iTex);
28 | }
29 |
--------------------------------------------------------------------------------
/RcEngine/Media/Effect/HLSL/VSM.hlsl:
--------------------------------------------------------------------------------
1 | SamplerState VSMSampler;
2 |
3 | float ChebyshevUpperBound(float2 moments, float depth, float minVariance)
4 | {
5 | float mean = moments.x;
6 | float measSquared = moments.y;
7 |
8 | float p = float(depth <= mean);
9 |
10 | float variance = max(minVariance, measSquared - mean*mean);
11 | float d = depth - mean;
12 | float pmax = variance / (variance + d * d);
13 |
14 | // To combat light-bleeding, experiment with raising p_max to some power
15 | // (Try values from 0.1 to 100.0, if you like.)
16 | return pow( max(p, pmax), 100.0f );
17 | }
18 |
19 |
20 | /**
21 | * CascadeShadowTexCoord.2 == cascade index
22 | */
23 | float EvalVSM(Texture2DArray CSM, float4 CascadeShadowTexCoord)
24 | {
25 | float2 moments = CSM.Sample(VSMSampler, CascadeShadowTexCoord).rg;
26 | return ChebyshevUpperBound(moments, CascadeShadowTexCoord.w, 0.0001);
27 | }
28 |
29 |
--------------------------------------------------------------------------------
/RcEngine/Media/Effect/HLSL/fxc.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hustruan/RcEngine/4ee06618efc0ed2dfaf81a775b44cc08c2f0a34b/RcEngine/Media/Effect/HLSL/fxc.exe
--------------------------------------------------------------------------------
/RcEngine/Media/Effect/ShadowMapBlur.effect.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/RcEngine/Media/Effect/Sky.effect.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/RcEngine/Media/Effect/Sprite.effect.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/RcEngine/Media/Effect/Tessellation.effect.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
38 |
39 |
40 |
--------------------------------------------------------------------------------
/RcEngine/Media/Effect/TiledDeferredShading.effect.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/RcEngine/Media/Effect/TiledLightCull.effect.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/RcEngine/Media/Font/Consolas Regular.sdff.dds:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hustruan/RcEngine/4ee06618efc0ed2dfaf81a775b44cc08c2f0a34b/RcEngine/Media/Font/Consolas Regular.sdff.dds
--------------------------------------------------------------------------------
/RcEngine/Media/Font/SDFont.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hustruan/RcEngine/4ee06618efc0ed2dfaf81a775b44cc08c2f0a34b/RcEngine/Media/Font/SDFont.exe
--------------------------------------------------------------------------------
/RcEngine/Media/GuiSkin/Controls/Button/close.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hustruan/RcEngine/4ee06618efc0ed2dfaf81a775b44cc08c2f0a34b/RcEngine/Media/GuiSkin/Controls/Button/close.png
--------------------------------------------------------------------------------
/RcEngine/Media/GuiSkin/Controls/Button/custombutton1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hustruan/RcEngine/4ee06618efc0ed2dfaf81a775b44cc08c2f0a34b/RcEngine/Media/GuiSkin/Controls/Button/custombutton1.png
--------------------------------------------------------------------------------
/RcEngine/Media/GuiSkin/Controls/Button/default_left.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hustruan/RcEngine/4ee06618efc0ed2dfaf81a775b44cc08c2f0a34b/RcEngine/Media/GuiSkin/Controls/Button/default_left.png
--------------------------------------------------------------------------------
/RcEngine/Media/GuiSkin/Controls/Button/default_right.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hustruan/RcEngine/4ee06618efc0ed2dfaf81a775b44cc08c2f0a34b/RcEngine/Media/GuiSkin/Controls/Button/default_right.png
--------------------------------------------------------------------------------
/RcEngine/Media/GuiSkin/Controls/Button/maximize.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hustruan/RcEngine/4ee06618efc0ed2dfaf81a775b44cc08c2f0a34b/RcEngine/Media/GuiSkin/Controls/Button/maximize.png
--------------------------------------------------------------------------------
/RcEngine/Media/GuiSkin/Controls/Button/minimize.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hustruan/RcEngine/4ee06618efc0ed2dfaf81a775b44cc08c2f0a34b/RcEngine/Media/GuiSkin/Controls/Button/minimize.png
--------------------------------------------------------------------------------
/RcEngine/Media/GuiSkin/Controls/Button/restore.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hustruan/RcEngine/4ee06618efc0ed2dfaf81a775b44cc08c2f0a34b/RcEngine/Media/GuiSkin/Controls/Button/restore.png
--------------------------------------------------------------------------------
/RcEngine/Media/GuiSkin/Controls/Checkbox/checked.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hustruan/RcEngine/4ee06618efc0ed2dfaf81a775b44cc08c2f0a34b/RcEngine/Media/GuiSkin/Controls/Checkbox/checked.png
--------------------------------------------------------------------------------
/RcEngine/Media/GuiSkin/Controls/Checkbox/unchecked.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hustruan/RcEngine/4ee06618efc0ed2dfaf81a775b44cc08c2f0a34b/RcEngine/Media/GuiSkin/Controls/Checkbox/unchecked.png
--------------------------------------------------------------------------------
/RcEngine/Media/GuiSkin/Controls/ComboBox/button.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hustruan/RcEngine/4ee06618efc0ed2dfaf81a775b44cc08c2f0a34b/RcEngine/Media/GuiSkin/Controls/ComboBox/button.png
--------------------------------------------------------------------------------
/RcEngine/Media/GuiSkin/Controls/Form/default_lowercenter.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hustruan/RcEngine/4ee06618efc0ed2dfaf81a775b44cc08c2f0a34b/RcEngine/Media/GuiSkin/Controls/Form/default_lowercenter.png
--------------------------------------------------------------------------------
/RcEngine/Media/GuiSkin/Controls/Form/default_lowerleft.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hustruan/RcEngine/4ee06618efc0ed2dfaf81a775b44cc08c2f0a34b/RcEngine/Media/GuiSkin/Controls/Form/default_lowerleft.png
--------------------------------------------------------------------------------
/RcEngine/Media/GuiSkin/Controls/Form/default_lowerright.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hustruan/RcEngine/4ee06618efc0ed2dfaf81a775b44cc08c2f0a34b/RcEngine/Media/GuiSkin/Controls/Form/default_lowerright.png
--------------------------------------------------------------------------------
/RcEngine/Media/GuiSkin/Controls/Form/default_lowerright_resize.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hustruan/RcEngine/4ee06618efc0ed2dfaf81a775b44cc08c2f0a34b/RcEngine/Media/GuiSkin/Controls/Form/default_lowerright_resize.png
--------------------------------------------------------------------------------
/RcEngine/Media/GuiSkin/Controls/Form/default_midcenter.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hustruan/RcEngine/4ee06618efc0ed2dfaf81a775b44cc08c2f0a34b/RcEngine/Media/GuiSkin/Controls/Form/default_midcenter.png
--------------------------------------------------------------------------------
/RcEngine/Media/GuiSkin/Controls/Form/default_midleft.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hustruan/RcEngine/4ee06618efc0ed2dfaf81a775b44cc08c2f0a34b/RcEngine/Media/GuiSkin/Controls/Form/default_midleft.png
--------------------------------------------------------------------------------
/RcEngine/Media/GuiSkin/Controls/Form/default_midright.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hustruan/RcEngine/4ee06618efc0ed2dfaf81a775b44cc08c2f0a34b/RcEngine/Media/GuiSkin/Controls/Form/default_midright.png
--------------------------------------------------------------------------------
/RcEngine/Media/GuiSkin/Controls/Form/default_uppercenter.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hustruan/RcEngine/4ee06618efc0ed2dfaf81a775b44cc08c2f0a34b/RcEngine/Media/GuiSkin/Controls/Form/default_uppercenter.png
--------------------------------------------------------------------------------
/RcEngine/Media/GuiSkin/Controls/Form/default_upperleft.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hustruan/RcEngine/4ee06618efc0ed2dfaf81a775b44cc08c2f0a34b/RcEngine/Media/GuiSkin/Controls/Form/default_upperleft.png
--------------------------------------------------------------------------------
/RcEngine/Media/GuiSkin/Controls/Form/default_upperright.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hustruan/RcEngine/4ee06618efc0ed2dfaf81a775b44cc08c2f0a34b/RcEngine/Media/GuiSkin/Controls/Form/default_upperright.png
--------------------------------------------------------------------------------
/RcEngine/Media/GuiSkin/Controls/RadioButton/checked.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hustruan/RcEngine/4ee06618efc0ed2dfaf81a775b44cc08c2f0a34b/RcEngine/Media/GuiSkin/Controls/RadioButton/checked.png
--------------------------------------------------------------------------------
/RcEngine/Media/GuiSkin/Controls/RadioButton/unchecked.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hustruan/RcEngine/4ee06618efc0ed2dfaf81a775b44cc08c2f0a34b/RcEngine/Media/GuiSkin/Controls/RadioButton/unchecked.png
--------------------------------------------------------------------------------
/RcEngine/Media/GuiSkin/Controls/Scrollbar/base.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hustruan/RcEngine/4ee06618efc0ed2dfaf81a775b44cc08c2f0a34b/RcEngine/Media/GuiSkin/Controls/Scrollbar/base.png
--------------------------------------------------------------------------------
/RcEngine/Media/GuiSkin/Controls/Scrollbar/button.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hustruan/RcEngine/4ee06618efc0ed2dfaf81a775b44cc08c2f0a34b/RcEngine/Media/GuiSkin/Controls/Scrollbar/button.png
--------------------------------------------------------------------------------
/RcEngine/Media/GuiSkin/Controls/Scrollbar/hscrollbar_back.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hustruan/RcEngine/4ee06618efc0ed2dfaf81a775b44cc08c2f0a34b/RcEngine/Media/GuiSkin/Controls/Scrollbar/hscrollbar_back.png
--------------------------------------------------------------------------------
/RcEngine/Media/GuiSkin/Controls/Scrollbar/hscrollbar_button_left.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hustruan/RcEngine/4ee06618efc0ed2dfaf81a775b44cc08c2f0a34b/RcEngine/Media/GuiSkin/Controls/Scrollbar/hscrollbar_button_left.png
--------------------------------------------------------------------------------
/RcEngine/Media/GuiSkin/Controls/Scrollbar/hscrollbar_button_right.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hustruan/RcEngine/4ee06618efc0ed2dfaf81a775b44cc08c2f0a34b/RcEngine/Media/GuiSkin/Controls/Scrollbar/hscrollbar_button_right.png
--------------------------------------------------------------------------------
/RcEngine/Media/GuiSkin/Controls/Scrollbar/hscrollbar_cursor.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hustruan/RcEngine/4ee06618efc0ed2dfaf81a775b44cc08c2f0a34b/RcEngine/Media/GuiSkin/Controls/Scrollbar/hscrollbar_cursor.png
--------------------------------------------------------------------------------
/RcEngine/Media/GuiSkin/Controls/Scrollbar/hscrollbar_highlight_left.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hustruan/RcEngine/4ee06618efc0ed2dfaf81a775b44cc08c2f0a34b/RcEngine/Media/GuiSkin/Controls/Scrollbar/hscrollbar_highlight_left.png
--------------------------------------------------------------------------------
/RcEngine/Media/GuiSkin/Controls/Scrollbar/hscrollbar_highlight_middle.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hustruan/RcEngine/4ee06618efc0ed2dfaf81a775b44cc08c2f0a34b/RcEngine/Media/GuiSkin/Controls/Scrollbar/hscrollbar_highlight_middle.png
--------------------------------------------------------------------------------
/RcEngine/Media/GuiSkin/Controls/Scrollbar/hscrollbar_highlight_right.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hustruan/RcEngine/4ee06618efc0ed2dfaf81a775b44cc08c2f0a34b/RcEngine/Media/GuiSkin/Controls/Scrollbar/hscrollbar_highlight_right.png
--------------------------------------------------------------------------------
/RcEngine/Media/GuiSkin/Controls/Scrollbar/hscrollbar_left.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hustruan/RcEngine/4ee06618efc0ed2dfaf81a775b44cc08c2f0a34b/RcEngine/Media/GuiSkin/Controls/Scrollbar/hscrollbar_left.png
--------------------------------------------------------------------------------
/RcEngine/Media/GuiSkin/Controls/Scrollbar/hscrollbar_middle.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hustruan/RcEngine/4ee06618efc0ed2dfaf81a775b44cc08c2f0a34b/RcEngine/Media/GuiSkin/Controls/Scrollbar/hscrollbar_middle.png
--------------------------------------------------------------------------------
/RcEngine/Media/GuiSkin/Controls/Scrollbar/hscrollbar_right.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hustruan/RcEngine/4ee06618efc0ed2dfaf81a775b44cc08c2f0a34b/RcEngine/Media/GuiSkin/Controls/Scrollbar/hscrollbar_right.png
--------------------------------------------------------------------------------
/RcEngine/Media/GuiSkin/Controls/Scrollbar/scrollbar_cursor.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hustruan/RcEngine/4ee06618efc0ed2dfaf81a775b44cc08c2f0a34b/RcEngine/Media/GuiSkin/Controls/Scrollbar/scrollbar_cursor.png
--------------------------------------------------------------------------------
/RcEngine/Media/GuiSkin/Controls/Scrollbar/scroller.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hustruan/RcEngine/4ee06618efc0ed2dfaf81a775b44cc08c2f0a34b/RcEngine/Media/GuiSkin/Controls/Scrollbar/scroller.png
--------------------------------------------------------------------------------
/RcEngine/Media/GuiSkin/Controls/Scrollbar/vscrollbar_back.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hustruan/RcEngine/4ee06618efc0ed2dfaf81a775b44cc08c2f0a34b/RcEngine/Media/GuiSkin/Controls/Scrollbar/vscrollbar_back.png
--------------------------------------------------------------------------------
/RcEngine/Media/GuiSkin/Controls/Scrollbar/vscrollbar_bottom.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hustruan/RcEngine/4ee06618efc0ed2dfaf81a775b44cc08c2f0a34b/RcEngine/Media/GuiSkin/Controls/Scrollbar/vscrollbar_bottom.png
--------------------------------------------------------------------------------
/RcEngine/Media/GuiSkin/Controls/Scrollbar/vscrollbar_button_down.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hustruan/RcEngine/4ee06618efc0ed2dfaf81a775b44cc08c2f0a34b/RcEngine/Media/GuiSkin/Controls/Scrollbar/vscrollbar_button_down.png
--------------------------------------------------------------------------------
/RcEngine/Media/GuiSkin/Controls/Scrollbar/vscrollbar_button_up.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hustruan/RcEngine/4ee06618efc0ed2dfaf81a775b44cc08c2f0a34b/RcEngine/Media/GuiSkin/Controls/Scrollbar/vscrollbar_button_up.png
--------------------------------------------------------------------------------
/RcEngine/Media/GuiSkin/Controls/Scrollbar/vscrollbar_cursor.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hustruan/RcEngine/4ee06618efc0ed2dfaf81a775b44cc08c2f0a34b/RcEngine/Media/GuiSkin/Controls/Scrollbar/vscrollbar_cursor.png
--------------------------------------------------------------------------------
/RcEngine/Media/GuiSkin/Controls/Scrollbar/vscrollbar_highlight_bottom.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hustruan/RcEngine/4ee06618efc0ed2dfaf81a775b44cc08c2f0a34b/RcEngine/Media/GuiSkin/Controls/Scrollbar/vscrollbar_highlight_bottom.png
--------------------------------------------------------------------------------
/RcEngine/Media/GuiSkin/Controls/Scrollbar/vscrollbar_highlight_middle.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hustruan/RcEngine/4ee06618efc0ed2dfaf81a775b44cc08c2f0a34b/RcEngine/Media/GuiSkin/Controls/Scrollbar/vscrollbar_highlight_middle.png
--------------------------------------------------------------------------------
/RcEngine/Media/GuiSkin/Controls/Scrollbar/vscrollbar_highlight_top.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hustruan/RcEngine/4ee06618efc0ed2dfaf81a775b44cc08c2f0a34b/RcEngine/Media/GuiSkin/Controls/Scrollbar/vscrollbar_highlight_top.png
--------------------------------------------------------------------------------
/RcEngine/Media/GuiSkin/Controls/Scrollbar/vscrollbar_middle.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hustruan/RcEngine/4ee06618efc0ed2dfaf81a775b44cc08c2f0a34b/RcEngine/Media/GuiSkin/Controls/Scrollbar/vscrollbar_middle.png
--------------------------------------------------------------------------------
/RcEngine/Media/GuiSkin/Controls/Scrollbar/vscrollbar_top.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hustruan/RcEngine/4ee06618efc0ed2dfaf81a775b44cc08c2f0a34b/RcEngine/Media/GuiSkin/Controls/Scrollbar/vscrollbar_top.png
--------------------------------------------------------------------------------
/RcEngine/Media/GuiSkin/Controls/Slider/slider_center.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hustruan/RcEngine/4ee06618efc0ed2dfaf81a775b44cc08c2f0a34b/RcEngine/Media/GuiSkin/Controls/Slider/slider_center.png
--------------------------------------------------------------------------------
/RcEngine/Media/GuiSkin/Controls/Slider/slider_cursor.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hustruan/RcEngine/4ee06618efc0ed2dfaf81a775b44cc08c2f0a34b/RcEngine/Media/GuiSkin/Controls/Slider/slider_cursor.png
--------------------------------------------------------------------------------
/RcEngine/Media/GuiSkin/Controls/Slider/slider_left.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hustruan/RcEngine/4ee06618efc0ed2dfaf81a775b44cc08c2f0a34b/RcEngine/Media/GuiSkin/Controls/Slider/slider_left.png
--------------------------------------------------------------------------------
/RcEngine/Media/GuiSkin/Controls/Slider/slider_right.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hustruan/RcEngine/4ee06618efc0ed2dfaf81a775b44cc08c2f0a34b/RcEngine/Media/GuiSkin/Controls/Slider/slider_right.png
--------------------------------------------------------------------------------
/RcEngine/Media/GuiSkin/Controls/arrow.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hustruan/RcEngine/4ee06618efc0ed2dfaf81a775b44cc08c2f0a34b/RcEngine/Media/GuiSkin/Controls/arrow.png
--------------------------------------------------------------------------------
/RcEngine/Media/GuiSkin/Controls/potentiometer.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hustruan/RcEngine/4ee06618efc0ed2dfaf81a775b44cc08c2f0a34b/RcEngine/Media/GuiSkin/Controls/potentiometer.png
--------------------------------------------------------------------------------
/RcEngine/Media/GuiSkin/Controls/textbox_left.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hustruan/RcEngine/4ee06618efc0ed2dfaf81a775b44cc08c2f0a34b/RcEngine/Media/GuiSkin/Controls/textbox_left.png
--------------------------------------------------------------------------------
/RcEngine/Media/GuiSkin/Controls/textbox_right.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hustruan/RcEngine/4ee06618efc0ed2dfaf81a775b44cc08c2f0a34b/RcEngine/Media/GuiSkin/Controls/textbox_right.png
--------------------------------------------------------------------------------
/RcEngine/Media/GuiSkin/dxutcontrols.dds:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hustruan/RcEngine/4ee06618efc0ed2dfaf81a775b44cc08c2f0a34b/RcEngine/Media/GuiSkin/dxutcontrols.dds
--------------------------------------------------------------------------------
/RcEngine/Media/GuiSkin/xWinForm.dds:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hustruan/RcEngine/4ee06618efc0ed2dfaf81a775b44cc08c2f0a34b/RcEngine/Media/GuiSkin/xWinForm.dds
--------------------------------------------------------------------------------
/RcEngine/Media/GuiSkin/xWinForm.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hustruan/RcEngine/4ee06618efc0ed2dfaf81a775b44cc08c2f0a34b/RcEngine/Media/GuiSkin/xWinForm.png
--------------------------------------------------------------------------------
/RcEngine/Media/GuiSkin/xWinForm1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hustruan/RcEngine/4ee06618efc0ed2dfaf81a775b44cc08c2f0a34b/RcEngine/Media/GuiSkin/xWinForm1.png
--------------------------------------------------------------------------------
/RcEngine/Media/Material/DebugView.material.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/RcEngine/Media/Material/Font.material.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/RcEngine/Media/Material/LightShape.material.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/RcEngine/Media/Material/LightTextured.material.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/RcEngine/Media/Material/Model.material.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/RcEngine/Media/Material/ShadowMapBlur.material.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/RcEngine/Media/Material/SkinModel.material.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/RcEngine/Media/Material/SkinModelUBO.material.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/RcEngine/Media/Material/SkyCubeMap.material.xml:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/RcEngine/Media/Material/SkyNormal.material.xml:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/RcEngine/Media/Material/Sprite.material.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/RcEngine/Media/Material/TangentFrame.material.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/RcEngine/Media/Material/WireFrame.material.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/RcEngine/OpenGLRenderSystem/DllMain.cpp:
--------------------------------------------------------------------------------
1 | #include "OpenGLModule.h"
2 |
3 | extern "C" void _OpenGLExport dllStartPlugin(RcEngine::IModule** pMoudle)
4 | {
5 | *pMoudle = new RcEngine::OpenGLModule();
6 | }
7 |
8 | extern "C" void _OpenGLExport dllStopPlugin(RcEngine::IModule** pMoudle)
9 | {
10 | delete (*pMoudle);
11 | }
12 |
--------------------------------------------------------------------------------
/RcEngine/OpenGLRenderSystem/OpenGLBuffer.h:
--------------------------------------------------------------------------------
1 | #ifndef OpenGLBuffer_h__
2 | #define OpenGLBuffer_h__
3 |
4 | #include "OpenGLPrerequisites.h"
5 | #include
6 |
7 | namespace RcEngine {
8 |
9 | class _OpenGLExport OpenGLBuffer : public GraphicsBuffer
10 | {
11 | public:
12 | OpenGLBuffer(uint32_t bufferSize, uint32_t accessHint, uint32_t flags, GLenum target, ElementInitData* initData);
13 | ~OpenGLBuffer(void);
14 |
15 | inline GLuint GetBufferOGL() const { return mBufferOGL; }
16 | inline GLuint GetBufferTarget() const { return mBufferTarget; }
17 |
18 | virtual void* Map(uint32_t offset, uint32_t length, ResourceMapAccess mapType);
19 | virtual void UnMap() ;
20 |
21 | private:
22 | GLenum mBufferTarget;
23 | GLenum mBufferOGL;
24 | };
25 |
26 |
27 | }
28 |
29 |
30 | #endif // OpenGLBuffer_h__
31 |
--------------------------------------------------------------------------------
/RcEngine/OpenGLRenderSystem/OpenGLDevice.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hustruan/RcEngine/4ee06618efc0ed2dfaf81a775b44cc08c2f0a34b/RcEngine/OpenGLRenderSystem/OpenGLDevice.cpp
--------------------------------------------------------------------------------
/RcEngine/OpenGLRenderSystem/OpenGLGraphicBuffer.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #ifndef OpenGLGraphicBuffer_h__
3 | #define OpenGLGraphicBuffer_h__
4 |
5 | #include "OpenGLPrerequisites.h"
6 | #include "OpenGLGraphicCommon.h"
7 | #include
8 |
9 | namespace RcEngine {
10 |
11 | class _OpenGLExport OpenGLGraphicsBuffer : public GraphicsBuffer
12 | {
13 | public:
14 | OpenGLGraphicsBuffer(BufferUsage usage, uint32_t accessHint, GLenum target, ElementInitData* initData);
15 | ~OpenGLGraphicsBuffer(void);
16 |
17 | GLenum GetTarget() const;
18 | GLuint GetBufferID() const;
19 |
20 | void ResizeBuffer(uint32_t sizeInByte);
21 | void* Map(uint32_t offset, uint32_t length, BufferAccess options);
22 | void UnMap();
23 |
24 | private:
25 | GLuint mBufferID;
26 | GLenum mTarget;
27 | };
28 |
29 | }
30 |
31 | #endif // OpenGLGraphicBuffer_h__
--------------------------------------------------------------------------------
/RcEngine/OpenGLRenderSystem/OpenGLGraphicCommon.h:
--------------------------------------------------------------------------------
1 | #ifndef OpenGLGraphicCommon_h__
2 | #define OpenGLGraphicCommon_h__
3 |
4 | #include "OpenGLPrerequisites.h"
5 | #include
6 | #include
7 |
8 | namespace RcEngine {
9 |
10 | class _OpenGLExport OpenGLMapping
11 | {
12 | public:
13 | OpenGLMapping(void);
14 | ~OpenGLMapping(void);
15 |
16 | static GLenum Mapping(FillMode fm);
17 | static GLenum Mapping(VertexElementFormat format);
18 | static GLenum Mapping(PrimitiveType type);
19 | static GLenum Mapping(BlendOperation op);
20 | static GLenum Mapping(AlphaBlendFactor factor);
21 | static GLenum Mapping(CompareFunction cf);
22 | static GLenum Mapping(StencilOperation sop);
23 | static GLenum Mapping(TextureAddressMode mode);
24 | static GLenum Mapping(ShaderType type);
25 | static GLbitfield Mapping(ResourceMapAccess access);
26 |
27 | // OpenGL usage
28 | static GLenum Mapping(uint32_t accessHint);
29 |
30 | static void Mapping(GLenum& min, GLenum& mag, TextureFilter filter);
31 |
32 | // Reference glTexImage* function
33 | static void Mapping(GLenum& outInternalformat, GLenum& outFormat, GLenum& outType, PixelFormat inPixelFormat);
34 |
35 | static void UnMapping(GLenum glType, EffectParameterType& paramType, ShaderParameterClass& paramClass);
36 | static void UnMapping(GLenum glType, VertexElementFormat& oFormat);
37 |
38 | /**
39 | * Return if the opengl type is interger.
40 | */
41 | static bool IsIntegerType(GLenum type);
42 | };
43 |
44 | }
45 |
46 |
47 |
48 | #endif // OpenGLGraphicCommon_h__
--------------------------------------------------------------------------------
/RcEngine/OpenGLRenderSystem/OpenGLHBAO.h:
--------------------------------------------------------------------------------
1 | #ifndef OpenGLHBAO_h__
2 | #define OpenGLHBAO_h__
3 |
4 | #include "OpenGLPrerequisites.h"
5 | #include
6 | #include
7 |
8 | namespace RcEngine {
9 |
10 | class _OpenGLExport OpenGLHBAOImpl : public AmbientOcclusion::HBAOImpl
11 | {
12 | public:
13 | OpenGLHBAOImpl(uint32_t aoWidth, uint32_t aoHeight);
14 | ~OpenGLHBAOImpl();
15 |
16 | virtual void RenderSSAO(const AmbientOcclusionSettings& settings,
17 | const Camera& viewCamera,
18 | const shared_ptr& outAOFrameBuffer,
19 | const shared_ptr& depthBuffer,
20 | const shared_ptr& normalBuffer);
21 |
22 | private:
23 | GFSDK_SSAO_RenderMask mRenderMask;
24 | GFSDK_SSAO_Context_GL* mAOContext;
25 | };
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 | }
34 |
35 |
36 | #endif // OpenGLHBAO_h__
37 |
--------------------------------------------------------------------------------
/RcEngine/OpenGLRenderSystem/OpenGLModule.cpp:
--------------------------------------------------------------------------------
1 | #include "OpenGLModule.h"
2 | #include "OpenGLDevice.h"
3 |
4 | namespace RcEngine {
5 |
6 | const static std::string ModuleName = "GL RenderSystem";
7 |
8 | OpenGLModule::OpenGLModule(void)
9 | : mRenderDevice(0)
10 | {
11 | }
12 |
13 |
14 | OpenGLModule::~OpenGLModule(void)
15 | {
16 | }
17 |
18 | const std::string& OpenGLModule::GetName() const
19 | {
20 | return ModuleName;
21 | }
22 |
23 | void OpenGLModule::Initialise()
24 | {
25 | mRenderDevice = new OpenGLDevice();
26 | mRenderDevice->CreateRenderWindow();
27 | }
28 |
29 | void OpenGLModule::Shutdown()
30 | {
31 | delete mRenderDevice;
32 | mRenderDevice = 0;
33 | }
34 |
35 | }
36 |
37 |
--------------------------------------------------------------------------------
/RcEngine/OpenGLRenderSystem/OpenGLModule.h:
--------------------------------------------------------------------------------
1 | #ifndef OpenGLModule_h__
2 | #define OpenGLModule_h__
3 |
4 | #include "OpenGLPrerequisites.h"
5 | #include
6 |
7 | namespace RcEngine {
8 |
9 | class OpenGLDevice;
10 |
11 | class _OpenGLExport OpenGLModule : public IModule
12 | {
13 | public:
14 | OpenGLModule(void);
15 | ~OpenGLModule(void);
16 |
17 | const String& GetName() const ;
18 | void Initialise();
19 | void Shutdown();
20 |
21 | private:
22 | OpenGLDevice* mRenderDevice;
23 | };
24 |
25 | }
26 |
27 |
28 | #endif // OpenGLModule_h__
--------------------------------------------------------------------------------
/RcEngine/OpenGLRenderSystem/OpenGLPrerequisites.h:
--------------------------------------------------------------------------------
1 | #ifndef OpenGLPrerequisites_h__
2 | #define OpenGLPrerequisites_h__
3 |
4 | //////////////////////////////////////////////////////////////////////////
5 | #include
6 | #include
7 | #include
8 |
9 | //////////////////////////////////////////////////////////////////////////
10 | #include
11 |
12 | //////////////////////////////////////////////////////////////////////////
13 | #ifndef BUILD_STATIC
14 | # ifdef OPENGLENGINEDLL_EXPORTS
15 | # define _OpenGLExport __declspec(dllexport)
16 | # else
17 | # define _OpenGLExport __declspec(dllimport)
18 | # endif
19 | #else
20 | # define _OpenGLExport
21 | #endif
22 |
23 | inline void CheckOpenGLError(const char* func, const char* fname, int line)
24 | {
25 | GLenum err = glGetError();
26 | if (err != GL_NO_ERROR)
27 | {
28 | printf("OpenGL error %s, at %s:%i - for %s\n", gluErrorString(err), fname, line, func);
29 | abort();
30 | }
31 | }
32 |
33 | #ifdef _DEBUG
34 | #define OGL_ERROR_CHECK() do { \
35 | CheckOpenGLError(__FUNCTION__, __FILE__, __LINE__); \
36 | } while(0)
37 | #else
38 | #define OGL_ERROR_CHECK()
39 | #endif
40 |
41 |
42 | #endif // OpenGLPrerequisites_h__
43 |
--------------------------------------------------------------------------------
/RcEngine/OpenGLRenderSystem/OpenGLQuery.cpp:
--------------------------------------------------------------------------------
1 | #include "OpenGLQuery.h"
2 |
3 | namespace RcEngine {
4 |
5 | OpenGLQuery::OpenGLQuery()
6 | {
7 | glGenQueries(2, mQuery);
8 | }
9 |
10 | OpenGLQuery::~OpenGLQuery()
11 | {
12 | glDeleteQueries(2, mQuery);
13 | }
14 |
15 | }
--------------------------------------------------------------------------------
/RcEngine/OpenGLRenderSystem/OpenGLQuery.h:
--------------------------------------------------------------------------------
1 | #ifndef OpenGLQuery_h__
2 | #define OpenGLQuery_h__
3 |
4 | #include "OpenGLPrerequisites.h"
5 | #include
6 |
7 | namespace RcEngine {
8 |
9 | class _OpenGLExport OpenGLQuery : public GpuQuery
10 | {
11 | public:
12 | OpenGLQuery();
13 | ~OpenGLQuery();
14 |
15 | private:
16 | GLuint mQuery[2];
17 | };
18 |
19 |
20 |
21 | }
22 |
23 | #endif // OpenGLQuery_h__
24 |
--------------------------------------------------------------------------------
/RcEngine/OpenGLRenderSystem/OpenGLRenderSystem.vcxproj.user:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/RcEngine/OpenGLRenderSystem/OpenGLRenderWindow.h:
--------------------------------------------------------------------------------
1 | #ifndef OpenGLRenderWindow_h__
2 | #define OpenGLRenderWindow_h__
3 |
4 | #include "OpenGLPrerequisites.h"
5 | #include "OpenGLFrameBuffer.h"
6 |
7 | namespace RcEngine {
8 |
9 | class _OpenGLExport OpenGLRenderWindow : public OpenGLFrameBuffer
10 | {
11 | public:
12 | OpenGLRenderWindow(uint32_t width, uint32_t height);
13 | ~OpenGLRenderWindow();
14 |
15 | void ToggleFullscreen(bool fs);
16 | bool Fullscreen() const;
17 | void SwapBuffers();
18 |
19 | private:
20 | bool mFullscreen;
21 | std::string mDescription;
22 |
23 | #ifdef RcWindows
24 | HDC mHdc;
25 | HGLRC mHrc;
26 | HWND mHwnd;
27 | #endif
28 | };
29 |
30 | }
31 |
32 | #endif // OpenGLRenderWindow_h__
33 |
--------------------------------------------------------------------------------
/RcEngine/OpenGLRenderSystem/OpenGLSamplerState.h:
--------------------------------------------------------------------------------
1 | #ifndef OpenGLSamplerState_h__
2 | #define OpenGLSamplerState_h__
3 |
4 | #include "OpenGLPrerequisites.h"
5 | #include
6 |
7 | namespace RcEngine {
8 |
9 | class _OpenGLExport OpenGLSamplerState : public SamplerState
10 | {
11 | public:
12 | OpenGLSamplerState(const SamplerStateDesc& desc);
13 | ~OpenGLSamplerState();
14 |
15 | inline GLuint GetSamplerOGL() const { return mSamplerOGL; }
16 |
17 | private:
18 | GLuint mSamplerOGL;
19 | };
20 |
21 | }
22 |
23 | #endif // OpenGLSamplerState_h__
24 |
--------------------------------------------------------------------------------
/RcEngine/OpenGLRenderSystem/OpenGLShaderUtil.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hustruan/RcEngine/4ee06618efc0ed2dfaf81a775b44cc08c2f0a34b/RcEngine/OpenGLRenderSystem/OpenGLShaderUtil.h
--------------------------------------------------------------------------------
/RcEngine/OpenGLRenderSystem/OpenGLVertexDeclaration.h:
--------------------------------------------------------------------------------
1 | #ifndef OpenGLVertexDeclaration_h__
2 | #define OpenGLVertexDeclaration_h__
3 |
4 | #include "OpenGLPrerequisites.h"
5 | #include
6 |
7 | namespace RcEngine {
8 |
9 | class _OpenGLExport OpenGLVertexDeclaration : public VertexDeclaration
10 | {
11 | public:
12 | OpenGLVertexDeclaration(const VertexElement* element, uint32_t count);
13 | ~OpenGLVertexDeclaration();
14 |
15 | inline GLuint GetVertexArrayOGL() const { return mVertexArrayOGL; }
16 |
17 | void CreateVertexArrayOGL(const RenderOperation& operation, const Shader& vertexShader);
18 |
19 | private:
20 | GLuint mVertexArrayOGL;
21 | };
22 |
23 | }
24 |
25 | #endif // OpenGLVertexDeclaration_h__
26 |
--------------------------------------------------------------------------------
/RcEngine/OpenGLRenderSystem/pfm.h:
--------------------------------------------------------------------------------
1 | #ifndef _PFM_H_
2 | #define _PFM_H_
3 |
4 | int ReadPfm(const char *fn, int &resX, int &resY, float*& data);
5 | int WritePfm(const char *fn, int resX, int resY, int channels, const float* data);
6 | int WritePfm3D(const char *fn, int resX, int resY, int resZ, int tiles, int channels, const float* data, float* buffer=0);
7 |
8 | #endif
--------------------------------------------------------------------------------
/RcEngine/RcEngine.v11.suo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hustruan/RcEngine/4ee06618efc0ed2dfaf81a775b44cc08c2f0a34b/RcEngine/RcEngine.v11.suo
--------------------------------------------------------------------------------
/RcEngine/RcEngine/Core/CompileConfig.h:
--------------------------------------------------------------------------------
1 | #ifndef CompileConfig_h__
2 | #define CompileConfig_h__
3 |
4 | namespace RcEngine
5 | {
6 |
7 | #if defined(_MSC_VER) && (_MSC_VER >= 1400)
8 | # pragma warning( disable: 4996)
9 | # define _CRT_SECURE_NO_DEPRECATE 1
10 | # define _CRT_NONSTDC_NO_DEPRECATE 1
11 | #endif
12 |
13 | // Disabling compiler warning, which may make no sence
14 | #if _MSC_VER >= 1200
15 | # pragma warning(disable : 4006) // Ignore double defined symbols warning
16 | # pragma warning(disable : 4786)
17 | # pragma warning(disable : 4251)
18 | # pragma warning(disable : 4100)
19 | # pragma warning(disable : 4661)
20 | #endif
21 | }
22 |
23 |
24 | #endif // CompileConfig_h__
25 |
--------------------------------------------------------------------------------
/RcEngine/RcEngine/Core/DynLib.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 |
5 | namespace RcEngine {
6 |
7 |
8 |
9 | } // Namespace RcEngine
--------------------------------------------------------------------------------
/RcEngine/RcEngine/Core/DynLib.h:
--------------------------------------------------------------------------------
1 | #ifndef DynLib_h__
2 | #define DynLib_h__
3 |
4 | #include
5 |
6 | namespace RcEngine {
7 |
8 | class IModule;
9 |
10 |
11 | } // Namespace RcEngine
12 |
13 | #endif // DynLib_h__
14 |
--------------------------------------------------------------------------------
/RcEngine/RcEngine/Core/Environment.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | namespace RcEngine{
4 |
5 | Environment::Environment()
6 | : mApplication(nullptr),
7 | mRenderFactory(nullptr),
8 | mRenderDevice(nullptr)
9 | {
10 |
11 | }
12 |
13 | Environment::~Environment()
14 | {
15 |
16 | }
17 |
18 |
19 | } // Namespace RcEngine
--------------------------------------------------------------------------------
/RcEngine/RcEngine/Core/Environment.h:
--------------------------------------------------------------------------------
1 | #ifndef Environment_h__
2 | #define Environment_h__
3 |
4 | #include
5 | #include
6 |
7 | namespace RcEngine{
8 |
9 | class Application;
10 | class RenderDevice;
11 | class RenderFactory;
12 |
13 | class _ApiExport Environment : public Singleton
14 | {
15 | public:
16 | Environment();
17 | ~Environment();
18 |
19 | inline Application* GetApplication() const { assert(mApplication); return mApplication; }
20 | inline RenderDevice* GetRenderDevice() const { assert(mRenderDevice); return mRenderDevice; }
21 | inline RenderFactory* GetRenderFactory() const { assert(mRenderFactory); return mRenderFactory; }
22 | inline SceneManager* GetSceneManager() const { assert(mRenderFactory); return mSceneManager; }
23 |
24 | private:
25 |
26 | friend class Application;
27 | friend class RenderDevice;
28 | friend class RenderFactory;
29 | friend class SceneManager;
30 |
31 | Application* mApplication;
32 | RenderDevice* mRenderDevice;
33 | RenderFactory* mRenderFactory;
34 | SceneManager* mSceneManager;
35 | };
36 |
37 | } // Namespace RcEngine
38 |
39 | #endif // Environment_h__
40 |
--------------------------------------------------------------------------------
/RcEngine/RcEngine/Core/IModule.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | namespace RcEngine {
4 |
5 | IModule::IModule( )
6 | {
7 |
8 | }
9 |
10 | IModule::~IModule( )
11 | {
12 |
13 | }
14 |
15 |
16 | } // Namespace RcEngine
--------------------------------------------------------------------------------
/RcEngine/RcEngine/Core/IModule.h:
--------------------------------------------------------------------------------
1 | #ifndef IModule_h__
2 | #define IModule_h__
3 |
4 | #include
5 |
6 | namespace RcEngine {
7 |
8 | class _ApiExport IModule
9 | {
10 | protected:
11 | IModule(void);
12 |
13 | public:
14 | virtual ~IModule(void);
15 |
16 | virtual const String& GetName() const = 0;
17 |
18 | // Initialise module
19 | virtual void Initialise() = 0;
20 |
21 | // Shutdown module
22 | virtual void Shutdown() = 0;
23 | };
24 |
25 | } // Namespace RcEngine
26 |
27 | #endif // IModule_h__
--------------------------------------------------------------------------------
/RcEngine/RcEngine/Core/Singleton.h:
--------------------------------------------------------------------------------
1 | #ifndef _Singleton__H
2 | #define _Singleton__H
3 |
4 | namespace RcEngine{
5 |
6 | template
7 | class Singleton
8 | {
9 | public:
10 | static void Initialize()
11 | {
12 | new T();
13 | }
14 |
15 | static void Finalize()
16 | {
17 | delete ms_Singleton;
18 | }
19 |
20 | static T& GetSingleton( void )
21 | {
22 | assert( ms_Singleton );
23 | return ( *ms_Singleton );
24 | }
25 |
26 | static T* GetSingletonPtr( void )
27 | {
28 | return ms_Singleton;
29 | }
30 |
31 | protected:
32 | Singleton( void )
33 | {
34 | assert( !ms_Singleton );
35 | ms_Singleton = static_cast( this );
36 | }
37 |
38 | virtual ~Singleton( void )
39 | {
40 | assert( ms_Singleton );
41 | ms_Singleton = 0;
42 | }
43 |
44 | static T* ms_Singleton;
45 |
46 | private:
47 | Singleton(const Singleton &);
48 | Singleton& operator=(const Singleton &);
49 | };
50 |
51 | template T* Singleton::ms_Singleton = nullptr;
52 |
53 | } // Namespace RcEngine
54 |
55 |
56 | #endif
--------------------------------------------------------------------------------
/RcEngine/RcEngine/Core/StringHash.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | namespace RcEngine {
4 |
5 | StringHash::StringHash()
6 | : mHash(0)
7 | {
8 |
9 | }
10 |
11 | StringHash::StringHash( const StringHash& rhs )
12 | : mHash(rhs.mHash)
13 | {
14 |
15 | }
16 |
17 | StringHash::StringHash( const char* str )
18 | : mHash(CalculateHash(str))
19 | {
20 |
21 | }
22 |
23 | StringHash::StringHash( const String& str )
24 | : mHash(CalculateHash(str.c_str()))
25 | {
26 |
27 | }
28 |
29 | uint32_t StringHash::CalculateHash( const char* str )
30 | {
31 | uint32_t hash = 0;
32 |
33 | if (!str)
34 | return hash;
35 |
36 | int c;
37 | while( c = *str++ )
38 | hash = c + (hash << 6) + (hash << 16) - hash; // SDBM Hash
39 |
40 | return hash;
41 | }
42 |
43 | String StringHash::ToString() const
44 | {
45 | char tempBuffer[128];
46 | sprintf(tempBuffer, "%08X", mHash);
47 | return String(tempBuffer);
48 | }
49 |
50 | }
--------------------------------------------------------------------------------
/RcEngine/RcEngine/Core/StringHash.h:
--------------------------------------------------------------------------------
1 | #ifndef StringHash_h__
2 | #define StringHash_h__
3 |
4 | #include
5 |
6 | namespace RcEngine {
7 |
8 | class _ApiExport StringHash
9 | {
10 | public:
11 | StringHash();
12 | StringHash(const char* str);
13 | StringHash(const String& str);
14 |
15 | StringHash(const StringHash& rhs);
16 |
17 | inline StringHash& operator = (const StringHash& rhs)
18 | {
19 | mHash = rhs.mHash;
20 | return *this;
21 | }
22 |
23 | inline StringHash operator + (const StringHash& rhs) const
24 | {
25 | StringHash ret;
26 | ret.mHash = mHash + rhs.mHash;
27 | return ret;
28 | }
29 |
30 | inline StringHash& operator += (const StringHash& rhs)
31 | {
32 | mHash += rhs.mHash;
33 | return *this;
34 | }
35 |
36 | inline bool operator == (const StringHash& rhs) const { return mHash == rhs.mHash; }
37 | inline bool operator != (const StringHash& rhs) const { return mHash != rhs.mHash; }
38 |
39 | // Used for std::map
40 | inline bool operator< (const StringHash& rhs) const { return mHash < rhs.mHash; }
41 | inline bool operator> (const StringHash& rhs) const { return mHash > rhs.mHash; }
42 |
43 | inline uint32_t ToHash() const { return mHash; }
44 |
45 | String ToString() const;
46 |
47 | private:
48 | uint32_t CalculateHash(const char* str);
49 |
50 | private:
51 | uint32_t mHash;
52 | };
53 |
54 | }
55 |
56 | // For std::unordered_map hash
57 | namespace std
58 | {
59 | template<>
60 | struct hash
61 | {
62 | public:
63 | std::size_t operator()(const RcEngine::StringHash& k) const
64 | {
65 | return k.ToHash();
66 | }
67 | };
68 | }
69 |
70 |
71 | #endif // StringHash_h__
72 |
--------------------------------------------------------------------------------
/RcEngine/RcEngine/Core/Timer.h:
--------------------------------------------------------------------------------
1 | #ifndef Timer_h__
2 | #define Timer_h__
3 |
4 | #include
5 |
6 | namespace RcEngine {
7 |
8 | class _ApiExport SystemClock
9 | {
10 | public:
11 | static void InitClock();
12 | static void ShutClock();
13 |
14 | static uint64_t Now();
15 | static inline double ToSeconds(uint64_t timeCounts) { return timeCounts * SecondsPerCount; }
16 |
17 | private:
18 | static int64_t StartTime;
19 | static double SecondsPerCount;
20 | };
21 |
22 |
23 | /**
24 | * Game Timer
25 | */
26 | class _ApiExport Timer
27 | {
28 | public:
29 | Timer();
30 |
31 | float GetGameTime() const; // in seconds
32 | float GetDeltaTime() const; // in seconds
33 |
34 | void Reset(); // Call before game loop
35 | void Start(); // Call when unpaused
36 | void Stop(); // Call when paused
37 | void Tick(); // Call every frame
38 |
39 | private:
40 | double mSecondsPerCount;
41 | double mDeltaTime;
42 |
43 | __int64 mBaseTime;
44 | __int64 mPausedTime;
45 | __int64 mStopTime;
46 | __int64 mPrevTime;
47 | __int64 mCurrTime;
48 |
49 | bool mStopped;
50 | };
51 |
52 |
53 |
54 |
55 | } // Namespace RcEngine
56 |
57 |
58 | #endif // Timer_h__
59 |
--------------------------------------------------------------------------------
/RcEngine/RcEngine/Core/Utility.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 |
4 | namespace RcEngine {
5 |
6 | //std::wstring& Convert( std::wstring& dest, std::string const & src )
7 | //{
8 | // int32_t const wcs_len = ::MultiByteToWideChar(CP_ACP, 0, src.c_str(), static_cast(src.size()), NULL, 0);
9 | // std::vector tmp(wcs_len + 1);
10 | // MultiByteToWideChar(CP_ACP, 0, src.c_str(), static_cast(src.size()), &tmp[0], wcs_len);
11 | // dest.assign(tmp.begin(), tmp.end() - 1);
12 | // return dest;
13 | //
14 | //}
15 |
16 | }
--------------------------------------------------------------------------------
/RcEngine/RcEngine/GUI/CheckBox.h:
--------------------------------------------------------------------------------
1 | #ifndef CheckBox_h__
2 | #define CheckBox_h__
3 |
4 | #include
5 |
6 | namespace RcEngine {
7 |
8 | class _ApiExport CheckBox : public UIElement
9 | {
10 | public:
11 |
12 | static const String StyleName;
13 |
14 | /**
15 | * CheckBox state changed event.
16 | */
17 | typedef fastdelegate::FastDelegate1 StateChangedEventHandler;
18 | StateChangedEventHandler EventStateChanged;
19 |
20 | public:
21 | CheckBox();
22 | virtual ~CheckBox();
23 |
24 | virtual void InitGuiStyle(const GuiSkin::StyleMap* styles = nullptr);
25 |
26 | virtual bool OnMouseButtonPress(const int2& screenPos, uint32_t button);
27 | virtual bool OnMouseButtonRelease(const int2& screenPos, uint32_t button);
28 |
29 | virtual bool CanHaveFocus() const;
30 |
31 | virtual void Update(float delta);
32 | virtual void Draw(SpriteBatch& spriteBatch, SpriteBatch& spriteBatchFont);
33 |
34 | void SetChecked(bool enalbe);
35 | bool IsChecked() const;
36 |
37 | void SetText(const std::wstring& text);
38 |
39 | protected:
40 |
41 | bool mPressed;
42 | bool mCheched;
43 |
44 | std::wstring mText;
45 |
46 | GuiSkin::GuiStyle* mStyle;
47 | };
48 |
49 |
50 | }
51 |
52 | #endif // CheckBox_h__
53 |
--------------------------------------------------------------------------------
/RcEngine/RcEngine/GUI/ComboBox.h:
--------------------------------------------------------------------------------
1 | #ifndef ComboBox_h__
2 | #define ComboBox_h__
3 |
4 | #include
5 |
6 | namespace RcEngine {
7 |
8 | class _ApiExport ComboBox : public UIElement
9 | {
10 | public:
11 | /**
12 | * ComboBox selected item changed event
13 | */
14 | typedef fastdelegate::FastDelegate1 SelectionChangedEventHandler;
15 | SelectionChangedEventHandler EventSelectionChanged;
16 |
17 | static const String DropButtonStyleName;
18 | static const String ComboBoxStyleName;
19 |
20 | public:
21 | ComboBox();
22 | virtual ~ComboBox();
23 |
24 | virtual void InitGuiStyle(const GuiSkin::StyleMap* styles = nullptr);
25 |
26 | virtual void Update(float dt);
27 | virtual void OnResize();
28 |
29 | virtual void OnHover(const int2& screenPos);
30 |
31 | // Child Control will handle focus
32 | virtual bool CanHaveFocus() const;
33 | virtual bool HasCombinedFocus() const;
34 |
35 | void AddItem(const std::wstring& text);
36 | void InsertItem(int32_t index, const std::wstring& text);
37 |
38 | void SetDropHeight(int32_t height);
39 |
40 | void SetSelectedIndex(int32_t index);
41 | int32_t GetSelectedIndex() const;
42 | const std::wstring& GetSelectedItem() const;
43 |
44 | protected:
45 | void UpdateRect();
46 | void ToggleDropDownList();
47 | void HandleSelection(int32_t selIdx);
48 |
49 | protected:
50 | ListBox* mItemList;
51 | LineEdit* mText;
52 | Button* mDropButton;
53 |
54 | int32_t mSelectedIndex;
55 | int32_t mDropHeight;
56 |
57 | GuiSkin::GuiStyle* mMainStyle;
58 | };
59 |
60 |
61 | }
62 |
63 | #endif // ComboBox_h__
--------------------------------------------------------------------------------
/RcEngine/RcEngine/GUI/Console.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hustruan/RcEngine/4ee06618efc0ed2dfaf81a775b44cc08c2f0a34b/RcEngine/RcEngine/GUI/Console.cpp
--------------------------------------------------------------------------------
/RcEngine/RcEngine/GUI/Console.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hustruan/RcEngine/4ee06618efc0ed2dfaf81a775b44cc08c2f0a34b/RcEngine/RcEngine/GUI/Console.h
--------------------------------------------------------------------------------
/RcEngine/RcEngine/GUI/Cursor.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hustruan/RcEngine/4ee06618efc0ed2dfaf81a775b44cc08c2f0a34b/RcEngine/RcEngine/GUI/Cursor.cpp
--------------------------------------------------------------------------------
/RcEngine/RcEngine/GUI/Cursor.h:
--------------------------------------------------------------------------------
1 | #ifndef Cursor_h__
2 | #define Cursor_h__
3 |
4 | class Cursor
5 | {
6 |
7 | };
8 |
9 |
10 | #endif // Cursor_h__
11 |
--------------------------------------------------------------------------------
/RcEngine/RcEngine/GUI/Label.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 | #include
5 | #include
6 |
7 | namespace RcEngine {
8 |
9 | const String Label::StyleName("Label Style");
10 |
11 | Label::Label()
12 | : mTextAlignment(AlignCenter),
13 | mTextColor(ColorRGBA::Black)
14 | {
15 |
16 | }
17 |
18 | Label::~Label()
19 | {
20 |
21 | }
22 |
23 |
24 | void Label::Draw( SpriteBatch& spriteBatch, SpriteBatch& spriteBatchFont )
25 | {
26 | if (!mFont)
27 | return;
28 |
29 | float zOrder = GetDepthLayer();
30 |
31 | int2 screenPos = GetScreenPosition();
32 |
33 | Rectanglef rect((float)screenPos.X(), (float)screenPos.Y(), (float)mSize.X(), (float)mSize.Y());
34 | mFont->DrawString(spriteBatchFont, mText, mFontSize, mTextAlignment, rect, mTextColor, zOrder);
35 | }
36 |
37 | void Label::InitGuiStyle( const GuiSkin::StyleMap* styles /*= nullptr*/ )
38 | {
39 | if (styles)
40 | {
41 | GuiSkin::StyleMap::const_iterator iter = styles->find(StyleName);
42 | mStyle = iter->second;
43 | }
44 | else
45 | {
46 | GuiSkin* defaultSkin = UIManager::GetSingleton().GetDefaultSkin();
47 | mStyle = &defaultSkin->Label;
48 | }
49 |
50 | mFont = mStyle->Font;
51 | mFontSize = mStyle->FontSize;
52 | mTextColor = mStyle->ForeColor;
53 | }
54 |
55 |
56 | }
--------------------------------------------------------------------------------
/RcEngine/RcEngine/GUI/Label.h:
--------------------------------------------------------------------------------
1 | #ifndef Label_h__
2 | #define Label_h__
3 |
4 | #include
5 | #include
6 |
7 | namespace RcEngine {
8 |
9 | /**
10 | * A text label, label is a non focusable control, no input event
11 | */
12 | class _ApiExport Label : public UIElement
13 | {
14 | public:
15 | const static String StyleName;
16 |
17 | public:
18 | Label();
19 | virtual ~Label();
20 |
21 | virtual void InitGuiStyle(const GuiSkin::StyleMap* styles = nullptr);
22 | virtual void Draw(SpriteBatch& spriteBatch, SpriteBatch& spriteBatchFont);
23 |
24 | void SetTextColor(const ColorRGBA& color) { mTextColor = color; }
25 | const ColorRGBA& GetTextColor() const { return mTextColor; }
26 |
27 | void SetFontSize(float fontSize) { mFontSize = fontSize; }
28 | float GetFontSize() const { return mFontSize; }
29 |
30 | void SetText(const std::wstring& text ) { mText = text; }
31 | const std::wstring& GetText() const { return mText; }
32 |
33 | void SetTextAlignment(uint32_t align) { mTextAlignment = align; }
34 | uint32_t GetTextAlignment() const { return mTextAlignment; }
35 |
36 | protected:
37 | GuiSkin::GuiStyle* mStyle;
38 | shared_ptr mFont;
39 |
40 | std::wstring mText;
41 | uint32_t mTextAlignment;
42 |
43 | ColorRGBA mTextColor;
44 | float mFontSize;
45 | };
46 |
47 |
48 | }
49 |
50 |
51 |
52 | #endif // Label_h__
53 |
--------------------------------------------------------------------------------
/RcEngine/RcEngine/GUI/Menu.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 | #include
5 |
6 | namespace RcEngine {
7 |
8 | }
--------------------------------------------------------------------------------
/RcEngine/RcEngine/GUI/Menu.h:
--------------------------------------------------------------------------------
1 | #ifndef Menu_h__
2 | #define Menu_h__
3 |
4 | #include
5 |
6 | namespace RcEngine {
7 |
8 | class _ApiExport Menu : public UIElement
9 | {
10 | public:
11 |
12 |
13 | protected:
14 |
15 | };
16 |
17 |
18 | }
19 |
20 |
21 | #endif // Menu_h__
22 |
--------------------------------------------------------------------------------
/RcEngine/RcEngine/GUI/UIAll.h:
--------------------------------------------------------------------------------
1 | #ifndef UIAll_h__
2 | #define UIAll_h__
3 |
4 | #include
5 | #include
6 | #include
7 | #include
8 | #include
9 | #include
10 | #include
11 | #include
12 | #include
13 | #include
14 | #include
15 |
16 |
17 | #endif // UIAll_h__
18 |
--------------------------------------------------------------------------------
/RcEngine/RcEngine/GUI/UIElement.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hustruan/RcEngine/4ee06618efc0ed2dfaf81a775b44cc08c2f0a34b/RcEngine/RcEngine/GUI/UIElement.h
--------------------------------------------------------------------------------
/RcEngine/RcEngine/Graphics/Animation.h:
--------------------------------------------------------------------------------
1 | #ifndef Animation_h__
2 | #define Animation_h__
3 |
4 | #include
5 |
6 | namespace RcEngine {
7 |
8 | class Bone;
9 | class Skeleton;
10 |
11 | class _ApiExport AnimationPlayer
12 | {
13 | friend class AnimationState;
14 |
15 | public:
16 | AnimationPlayer();
17 | ~AnimationPlayer();
18 |
19 | bool IsPlaying(const String& clipName) const;
20 |
21 | void PlayClip(const String& clipName);
22 | void PauseClip(const String& clipName);
23 | void ResumeClip(const String& clipName);
24 | void StopClip(const String& clipName);
25 | void StopAll();
26 |
27 | AnimationState* GetClip( const String& clip ) const;
28 | const unordered_map& GetAllClip() const { return mAnimationStates; }
29 |
30 | AnimationState* AddClip( const shared_ptr& clip );
31 |
32 | AnimationController* GetAnimationController() const { return mController; }
33 |
34 | public:
35 | static shared_ptr LoadFrom(Mesh& parentMesh, Stream& source);
36 |
37 | // Events
38 | EventHandler EventAnimationCompleted;
39 |
40 | protected:
41 |
42 | AnimationController* mController;
43 |
44 | AnimationState* mCurrentClipState;
45 |
46 | unordered_map mAnimationStates;
47 |
48 | unordered_map mAnimateTargets;
49 | };
50 |
51 |
52 | class _ApiExport SkinnedAnimationPlayer : public AnimationPlayer
53 | {
54 | public:
55 | SkinnedAnimationPlayer(const shared_ptr& skeleton);
56 | ~SkinnedAnimationPlayer();
57 |
58 | void CrossFade( const String& fadeClip, float fadeLength );
59 |
60 | private:
61 |
62 | };
63 |
64 | }
65 |
66 |
67 |
68 |
69 |
70 | #endif // Animation_h__
71 |
--------------------------------------------------------------------------------
/RcEngine/RcEngine/Graphics/AnimationClip.h:
--------------------------------------------------------------------------------
1 | #ifndef AnimationClip_h__
2 | #define AnimationClip_h__
3 |
4 | #include
5 | #include