├── resources ├── small.ico ├── critter.rc ├── critter.res ├── resource.h └── windowIcon.ico ├── dependencies ├── nanovg │ └── makefile ├── imgui │ ├── LICENSE │ └── imconfig.h ├── MurmerHash │ └── MurmurHash.h └── pugixml │ └── src │ └── pugiconfig.hpp ├── .gitmodules ├── newui └── ocornut_imgui.h ├── rendererD3D11 ├── effectsD3D11 │ ├── d3dx11dbg.cpp │ ├── pchfx.h │ ├── IUnknownImp.h │ ├── Inc │ │ └── d3dx11dbg.h │ └── Binary │ │ └── EffectStateBase11.h ├── errorD3D11 │ └── DxErr.h ├── CtrFormatConversionD3D11.h ├── CtrBackbufferSurfaceD3D11.h ├── CtrEffectD3D11.h ├── CtrRenderWindowD3D11.h ├── CtrRenderWindowD3D11.cpp ├── CtrRenderWindow.h ├── CtrEffectD3D11.cpp └── CtrTexture2DD3D11.h ├── renderAPI ├── CtrIEffect.cpp ├── CtrIIndexBuffer.cpp ├── CtrISurface.cpp ├── CtrIDepthSurface.cpp ├── CtrIGpuBuffer.cpp ├── CtrGpuTechnique.cpp ├── CtrIVertexDeclaration.cpp ├── CtrGpuConstantBuffer.cpp ├── CtrIComputeShader.cpp ├── CtrColorPass.h ├── CtrRenderRequest.cpp ├── CtrIEffect.h ├── CtrGpuTechnique.h ├── CtrIVertexBuffer.cpp ├── CtrRenderRequest.h ├── CtrScreenOrientedQuad.h ├── CtrIIndexBuffer.h ├── CtrShaderParameterValue.cpp ├── CtrFileChangeWatcher.h ├── CtrViewport.h ├── CtrIDepthSurface.h ├── CtrPresentationPolicy.cpp ├── CtrIGpuBuffer.h ├── CtrIVertexBuffer.h ├── CtrISurface.h └── CtrViewport.cpp ├── nodes ├── CtrRenderNode.cpp ├── CtrEntity.h ├── CtrRenderTargetQuad.h ├── CtrRenderNode.h └── CtrEntity.cpp ├── application ├── CtrNonCopyable.h ├── CtrApplication.cpp ├── CtrHash.h └── CtrLog.cpp └── input ├── CtrInputManager.h ├── CtrX360Controller.h ├── CtrFocusedInput.h └── CtrFocusedInput.cpp /resources/small.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/derkreature/critter/HEAD/resources/small.ico -------------------------------------------------------------------------------- /resources/critter.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/derkreature/critter/HEAD/resources/critter.rc -------------------------------------------------------------------------------- /resources/critter.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/derkreature/critter/HEAD/resources/critter.res -------------------------------------------------------------------------------- /resources/resource.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/derkreature/critter/HEAD/resources/resource.h -------------------------------------------------------------------------------- /resources/windowIcon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/derkreature/critter/HEAD/resources/windowIcon.ico -------------------------------------------------------------------------------- /dependencies/nanovg/makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2011-2015 Branimir Karadzic. All rights reserved. 3 | # License: http://www.opensource.org/licenses/BSD-2-Clause 4 | # 5 | 6 | include ../../../scripts/shader-embeded.mk 7 | 8 | rebuild: 9 | @make -s --no-print-directory clean all 10 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "dependencies/assimp"] 2 | path = dependencies/assimp 3 | url = https://github.com/derkreature/assimp.git 4 | [submodule "dependencies/FreeImage"] 5 | path = dependencies/FreeImage 6 | url = https://github.com/derkreature/FreeImage.git 7 | [submodule "dependencies/libzip"] 8 | path = dependencies/libzip 9 | url = https://github.com/derkreature/libzip.git 10 | [submodule "dependencies/zlib"] 11 | path = dependencies/zlib 12 | url = https://github.com/derkreature/zlib.git 13 | -------------------------------------------------------------------------------- /newui/ocornut_imgui.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 Daniel Collin. All rights reserved. 3 | * License: http://www.opensource.org/licenses/BSD-2-Clause 4 | */ 5 | 6 | #ifndef OCORNUT_IMGUI_H_HEADER_GUARD 7 | #define OCORNUT_IMGUI_H_HEADER_GUARD 8 | 9 | #include 10 | #include 11 | 12 | namespace Ctr 13 | { 14 | class InputState; 15 | } 16 | 17 | void IMGUI_create(const void* _data, uint32_t _size, float _fontSize); 18 | void IMGUI_destroy(); 19 | void IMGUI_beginFrame(Ctr::InputState* inputState, int32_t _mx, int32_t _my, uint8_t _button, int _width, int _height, char _inputChar, uint8_t _viewId); 20 | void IMGUI_endFrame(); 21 | 22 | #endif // OCORNUT_IMGUI_H_HEADER_GUARD 23 | -------------------------------------------------------------------------------- /dependencies/imgui/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Omar Cornut 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /dependencies/MurmerHash/MurmurHash.h: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // MurmurHash3 was written by Austin Appleby, and is placed in the public 3 | // domain. The author hereby disclaims copyright to this source code. 4 | 5 | #ifndef _MURMURHASH3_H_ 6 | #define _MURMURHASH3_H_ 7 | 8 | //----------------------------------------------------------------------------- 9 | // Platform-specific functions and macros 10 | 11 | // Microsoft Visual Studio 12 | 13 | #if defined(_MSC_VER) && (_MSC_VER < 1600) 14 | 15 | typedef unsigned char uint8_t; 16 | typedef unsigned int uint32_t; 17 | typedef unsigned __int64 uint64_t; 18 | 19 | // Other compilers 20 | 21 | #else // defined(_MSC_VER) 22 | 23 | #include 24 | 25 | #endif // !defined(_MSC_VER) 26 | 27 | //----------------------------------------------------------------------------- 28 | 29 | void MurmurHash3_x86_32(const void * key, int len, uint32_t seed, void * out); 30 | void MurmurHash3_x86_128(const void * key, int len, uint32_t seed, void * out); 31 | void MurmurHash3_x64_128(const void * key, int len, uint32_t seed, void * out); 32 | 33 | //----------------------------------------------------------------------------- 34 | 35 | #endif // _MURMURHASH3_H_ 36 | 37 | -------------------------------------------------------------------------------- /rendererD3D11/effectsD3D11/d3dx11dbg.cpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Copyright (C) 2009 Microsoft Corporation. All Rights Reserved. 4 | // 5 | // File: d3dx11dbg.cpp 6 | // Content: D3DX11 Effects debugging functions 7 | // 8 | /////////////////////////////////////////////////////////////////////////// 9 | 10 | #include "pchfx.h" 11 | 12 | 13 | #ifdef FXDPF 14 | 15 | // 16 | // DPF 17 | // 18 | 19 | void cdecl D3DXDebugPrintf(UINT lvl, LPCSTR szFormat, ...) 20 | { 21 | static UINT uDebugLevel = (UINT) -1; 22 | 23 | char strA[4096]; 24 | char strB[4096]; 25 | 26 | va_list ap; 27 | va_start(ap, szFormat); 28 | StringCchVPrintfA(strA, sizeof(strA), szFormat, ap); 29 | strA[4095] = '\0'; 30 | va_end(ap); 31 | 32 | StringCchPrintfA(strB, sizeof(strB), "Effects11: %s\r\n", strA); 33 | 34 | strB[4095] = '\0'; 35 | 36 | OutputDebugStringA(strB); 37 | } 38 | #else 39 | // This is defined so warning LNK4211 is not generated (object file has no public symbols) 40 | void cdecl D3DXDebugPrintf(UINT lvl, LPCSTR szFormat, ...) {} 41 | #endif 42 | 43 | 44 | // 45 | // D3DXASSERT 46 | // 47 | 48 | #ifdef _DEBUG 49 | 50 | int WINAPI D3DXDebugAssert(LPCSTR szFile, int nLine, LPCSTR szCondition) 51 | { 52 | char str[512]; 53 | 54 | // Print message to debug console 55 | StringCchPrintfA(str, sizeof(str), "Assertion failure! (%s %d): %s\r\n", szFile, nLine, szCondition); 56 | str[511] = 0; 57 | OutputDebugStringA(str); 58 | 59 | return 0; 60 | } 61 | #endif 62 | 63 | -------------------------------------------------------------------------------- /rendererD3D11/effectsD3D11/pchfx.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // File: pchfx.h 3 | // 4 | // Direct3D 11 shader effects precompiled header 5 | // 6 | // THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF 7 | // ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO 8 | // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A 9 | // PARTICULAR PURPOSE. 10 | // 11 | // Copyright (c) Microsoft Corporation. All rights reserved. 12 | // 13 | // http://go.microsoft.com/fwlink/p/?LinkId=271568 14 | //-------------------------------------------------------------------------------------- 15 | 16 | #pragma once 17 | 18 | #pragma warning(disable : 4102 4127 4201 4505 4616 4706 6326) 19 | 20 | #ifndef NOMINMAX 21 | #define NOMINMAX 22 | #endif 23 | 24 | #include 25 | 26 | #if defined(_XBOX_ONE) && defined(_TITLE) 27 | #include 28 | #include 29 | #define DCOMMON_H_INCLUDED 30 | #define NO_D3D11_DEBUG_NAME 31 | #elif (_WIN32_WINNT >= 0x0602) || defined(_WIN7_PLATFORM_UPDATE) 32 | #include 33 | #include 34 | #else 35 | #include 36 | #include 37 | #endif 38 | 39 | #ifndef _WIN32_WINNT_WIN8 40 | #define _WIN32_WINNT_WIN8 0x0602 41 | #endif 42 | 43 | #undef DEFINE_GUID 44 | #include "INITGUID.h" 45 | 46 | #include "d3dx11effect.h" 47 | 48 | #define UNUSED -1 49 | 50 | ////////////////////////////////////////////////////////////////////////// 51 | 52 | #define offsetof_fx( a, b ) (uint32_t)offsetof( a, b ) 53 | 54 | #include "d3dxGlobal.h" 55 | 56 | #include 57 | #include 58 | 59 | #include "Effect.h" 60 | #include "EffectStateBase11.h" 61 | #include "EffectLoad.h" 62 | 63 | -------------------------------------------------------------------------------- /rendererD3D11/effectsD3D11/IUnknownImp.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // File: IUnknownImp.h 3 | // 4 | // Direct3D 11 Effects Helper for COM interop 5 | // 6 | // Lifetime for most Effects objects is based on the the lifetime of the master 7 | // effect, so the reference count is not used. 8 | // 9 | // THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF 10 | // ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO 11 | // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A 12 | // PARTICULAR PURPOSE. 13 | // 14 | // Copyright (c) Microsoft Corporation. All rights reserved. 15 | // 16 | // http://go.microsoft.com/fwlink/p/?LinkId=271568 17 | //-------------------------------------------------------------------------------------- 18 | 19 | #pragma once 20 | 21 | #define IUNKNOWN_IMP(Class, Interface, BaseInterface) \ 22 | \ 23 | HRESULT STDMETHODCALLTYPE Class##::QueryInterface(REFIID iid, _COM_Outptr_ LPVOID *ppv) override \ 24 | { \ 25 | if( !ppv ) \ 26 | return E_INVALIDARG; \ 27 | \ 28 | *ppv = nullptr; \ 29 | if(IsEqualIID(iid, IID_IUnknown)) \ 30 | { \ 31 | *ppv = (IUnknown*)((Interface*)this); \ 32 | } \ 33 | else if(IsEqualIID(iid, IID_##Interface)) \ 34 | { \ 35 | *ppv = (Interface *)this; \ 36 | } \ 37 | else if(IsEqualIID(iid, IID_##BaseInterface)) \ 38 | { \ 39 | *ppv = (BaseInterface *)this; \ 40 | } \ 41 | else \ 42 | { \ 43 | return E_NOINTERFACE; \ 44 | } \ 45 | \ 46 | return S_OK; \ 47 | } \ 48 | \ 49 | ULONG STDMETHODCALLTYPE Class##::AddRef() override \ 50 | { \ 51 | return 1; \ 52 | } \ 53 | \ 54 | ULONG STDMETHODCALLTYPE Class##::Release() override \ 55 | { \ 56 | return 0; \ 57 | } 58 | -------------------------------------------------------------------------------- /rendererD3D11/effectsD3D11/Inc/d3dx11dbg.h: -------------------------------------------------------------------------------- 1 | ////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Copyright (C) 2009 Microsoft Corporation. All Rights Reserved. 4 | // 5 | // File: d3dx11dbg.h 6 | // Content: D3DX11 debugging functions 7 | // 8 | ////////////////////////////////////////////////////////////////////////////// 9 | 10 | 11 | #ifndef __D3DX11DBG_H__ 12 | #define __D3DX11DBG_H__ 13 | 14 | #ifndef _PREFAST_ 15 | 16 | #pragma warning( disable: 4068 ) 17 | 18 | #endif 19 | 20 | 21 | #include 22 | #include 23 | 24 | #undef NEW 25 | #undef DELETE 26 | 27 | #define NEW new (std::nothrow) 28 | #define NEW_PROTO_ARGS size_t s, const std::nothrow_t& t 29 | 30 | 31 | 32 | typedef signed char INT8; 33 | typedef signed short INT16; 34 | typedef unsigned char UINT8; 35 | typedef unsigned short UINT16; 36 | 37 | 38 | //---------------------------------------------------------------------------- 39 | // DPF 40 | //---------------------------------------------------------------------------- 41 | 42 | #ifdef FXDPF 43 | void cdecl D3DXDebugPrintf(UINT lvl, LPCSTR szFormat, ...); 44 | #define DPF D3DXDebugPrintf 45 | #else // !FXDPF 46 | #pragma warning(disable:4002) 47 | #define DPF() 0 48 | #endif // !FXDPF 49 | 50 | 51 | //---------------------------------------------------------------------------- 52 | // D3DXASSERT 53 | //---------------------------------------------------------------------------- 54 | 55 | #if _DEBUG 56 | int WINAPI D3DXDebugAssert(LPCSTR szFile, int nLine, LPCSTR szCondition); 57 | #define D3DXASSERT(condition) \ 58 | do { if(!(condition)) D3DXDebugAssert(__FILE__, __LINE__, #condition); } while(0) 59 | #else // !_DEBUG 60 | #define D3DXASSERT(condition) 0 61 | #endif // !_DEBUG 62 | 63 | 64 | 65 | #endif // __D3DX11DBG_H__ 66 | 67 | -------------------------------------------------------------------------------- /dependencies/imgui/imconfig.h: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // USER IMPLEMENTATION 3 | // This file contains compile-time options for ImGui. 4 | // Other options (memory allocation overrides, callbacks, etc.) can be set at runtime via the ImGuiIO structure - ImGui::GetIO(). 5 | //----------------------------------------------------------------------------- 6 | 7 | #pragma once 8 | 9 | //---- Define your own ImVector<> type if you don't want to use the provided implementation defined in imgui.h 10 | //#include 11 | //#define ImVector std::vector 12 | //#define ImVector MyVector 13 | 14 | //---- Define assertion handler. Defaults to calling assert(). 15 | //#define IM_ASSERT(_EXPR) MyAssert(_EXPR) 16 | 17 | //---- Don't implement default clipboard handlers for Windows (so as not to link with OpenClipboard() and others Win32 functions) 18 | //#define IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCS 19 | 20 | //---- Include imgui_user.inl at the end of imgui.cpp so you can include code that extends ImGui using its private data/functions. 21 | //#define IMGUI_INCLUDE_IMGUI_USER_INL 22 | 23 | //---- Include imgui_user.h at the end of imgui.h 24 | //#define IMGUI_INCLUDE_IMGUI_USER_H 25 | 26 | //---- Define implicit cast operators to convert back<>forth from your math types and ImVec2/ImVec4. 27 | /* 28 | #define IM_VEC2_CLASS_EXTRA \ 29 | ImVec2(const MyVec2& f) { x = f.x; y = f.y; } \ 30 | operator MyVec2() const { return MyVec2(x,y); } 31 | 32 | #define IM_VEC4_CLASS_EXTRA \ 33 | ImVec4(const MyVec4& f) { x = f.x; y = f.y; z = f.z; w = f.w; } \ 34 | operator MyVec4() const { return MyVec4(x,y,z,w); } 35 | */ 36 | 37 | //---- Freely implement extra functions within the ImGui:: namespace. 38 | //---- Declare helpers or widgets implemented in imgui_user.inl or elsewhere, so end-user doesn't need to include multiple files. 39 | //---- e.g. you can create variants of the ImGui::Value() helper for your low-level math types. 40 | /* 41 | namespace ImGui 42 | { 43 | void Value(const char* prefix, const MyVec2& v, const char* float_format = NULL); 44 | void Value(const char* prefix, const MyVec4& v, const char* float_format = NULL); 45 | } 46 | */ 47 | 48 | -------------------------------------------------------------------------------- /rendererD3D11/effectsD3D11/Binary/EffectStateBase11.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // File: EffectStateBase11.h 3 | // 4 | // Direct3D 11 Effects States Header 5 | // 6 | // THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF 7 | // ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO 8 | // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A 9 | // PARTICULAR PURPOSE. 10 | // 11 | // Copyright (c) Microsoft Corporation. All rights reserved. 12 | // 13 | // http://go.microsoft.com/fwlink/p/?LinkId=271568 14 | //-------------------------------------------------------------------------------------- 15 | 16 | #pragma once 17 | 18 | namespace D3DX11Effects 19 | { 20 | 21 | ////////////////////////////////////////////////////////////////////////// 22 | // Effect HLSL states and late resolve lists 23 | ////////////////////////////////////////////////////////////////////////// 24 | 25 | struct RValue 26 | { 27 | const char *m_pName; 28 | uint32_t m_Value; 29 | }; 30 | 31 | #define RVALUE_END() { nullptr, 0U } 32 | #define RVALUE_ENTRY(prefix, x) { #x, (uint32_t)prefix##x } 33 | 34 | enum ELhsType; 35 | 36 | struct LValue 37 | { 38 | const char *m_pName; // name of the LHS side of expression 39 | EBlockType m_BlockType; // type of block it can appear in 40 | D3D_SHADER_VARIABLE_TYPE m_Type; // data type allows 41 | uint32_t m_Cols; // number of [m_Type]'s required (1 for a scalar, 4 for a vector) 42 | uint32_t m_Indices; // max index allowable (if LHS is an array; otherwise this is 1) 43 | bool m_VectorScalar; // can be both vector and scalar (setting as a scalar sets all m_Indices values simultaneously) 44 | const RValue *m_pRValue; // pointer to table of allowable RHS "late resolve" values 45 | ELhsType m_LhsType; // ELHS_* enum value that corresponds to this entry 46 | uint32_t m_Offset; // offset into the given block type where this value should be written 47 | uint32_t m_Stride; // for vectors, byte stride between two consecutive values. if 0, m_Type's size is used 48 | }; 49 | 50 | #define LVALUE_END() { nullptr, D3D_SVT_UINT, 0, 0, 0, nullptr } 51 | 52 | extern const LValue g_lvGeneral[]; 53 | extern const uint32_t g_lvGeneralCount; 54 | 55 | } // end namespace D3DX11Effects 56 | -------------------------------------------------------------------------------- /dependencies/pugixml/src/pugiconfig.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * pugixml parser - version 0.5 3 | * -------------------------------------------------------- 4 | * Copyright (C) 2006-2009, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com) 5 | * Report bugs and download new versions at http://code.google.com/p/pugixml/ 6 | * 7 | * This library is distributed under the MIT License. See notice at the end 8 | * of this file. 9 | * 10 | * This work is based on the pugxml parser, which is: 11 | * Copyright (C) 2003, by Kristen Wegner (kristen@tima.net) 12 | */ 13 | 14 | #ifndef HEADER_PUGICONFIG_HPP 15 | #define HEADER_PUGICONFIG_HPP 16 | 17 | // Uncomment this to disable STL 18 | // #define PUGIXML_NO_STL 19 | 20 | // Uncomment this to disable XPath 21 | // #define PUGIXML_NO_XPATH 22 | 23 | // Uncomment this to disable exceptions 24 | // Note: you can't use XPath with PUGIXML_NO_EXCEPTIONS 25 | // #define PUGIXML_NO_EXCEPTIONS 26 | 27 | // Set this to control attributes for public classes/functions, i.e.: 28 | // #define PUGIXML_API __declspec(dllexport) // to export all public symbols from DLL 29 | // #define PUGIXML_CLASS __declspec(dllimport) // to import all classes from DLL 30 | // #define PUGIXML_FUNCTION __fastcall // to set calling conventions to all public functions to fastcall 31 | // In absence of PUGIXML_CLASS/PUGIXML_FUNCTION definitions PUGIXML_API is used instead 32 | 33 | #endif 34 | 35 | /** 36 | * Copyright (c) 2006-2009 Arseny Kapoulkine 37 | * 38 | * Permission is hereby granted, free of charge, to any person 39 | * obtaining a copy of this software and associated documentation 40 | * files (the "Software"), to deal in the Software without 41 | * restriction, including without limitation the rights to use, 42 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 43 | * copies of the Software, and to permit persons to whom the 44 | * Software is furnished to do so, subject to the following 45 | * conditions: 46 | * 47 | * The above copyright notice and this permission notice shall be 48 | * included in all copies or substantial portions of the Software. 49 | * 50 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 51 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 52 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 53 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 54 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 55 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 56 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 57 | * OTHER DEALINGS IN THE SOFTWARE. 58 | */ 59 | -------------------------------------------------------------------------------- /rendererD3D11/errorD3D11/DxErr.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // File: DXErr.h 3 | // 4 | // DirectX Error Library 5 | // 6 | // THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF 7 | // ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO 8 | // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A 9 | // PARTICULAR PURPOSE. 10 | // 11 | // Copyright (c) Microsoft Corporation. All rights reserved. 12 | //-------------------------------------------------------------------------------------- 13 | 14 | // This version only supports UNICODE. 15 | 16 | #pragma once 17 | 18 | #if !defined(NOMINMAX) 19 | #define NOMINMAX 20 | #endif 21 | 22 | #include 23 | #include 24 | 25 | #ifdef __cplusplus 26 | extern "C" { 27 | #endif 28 | 29 | //-------------------------------------------------------------------------------------- 30 | // DXGetErrorString 31 | //-------------------------------------------------------------------------------------- 32 | const WCHAR* WINAPI DXGetErrorStringW(_In_ HRESULT hr); 33 | 34 | #define DXGetErrorString DXGetErrorStringW 35 | 36 | //-------------------------------------------------------------------------------------- 37 | // DXGetErrorDescription has to be modified to return a copy in a buffer rather than 38 | // the original static string. 39 | //-------------------------------------------------------------------------------------- 40 | void WINAPI DXGetErrorDescriptionW(_In_ HRESULT hr, _Out_cap_(count) WCHAR* desc, _In_ size_t count); 41 | 42 | #define DXGetErrorDescription DXGetErrorDescriptionW 43 | 44 | //-------------------------------------------------------------------------------------- 45 | // DXTrace 46 | // 47 | // Desc: Outputs a formatted error message to the debug stream 48 | // 49 | // Args: WCHAR* strFile The current file, typically passed in using the 50 | // __FILEW__ macro. 51 | // DWORD dwLine The current line number, typically passed in using the 52 | // __LINE__ macro. 53 | // HRESULT hr An HRESULT that will be traced to the debug stream. 54 | // CHAR* strMsg A string that will be traced to the debug stream (may be NULL) 55 | // BOOL bPopMsgBox If TRUE, then a message box will popup also containing the passed info. 56 | // 57 | // Return: The hr that was passed in. 58 | //-------------------------------------------------------------------------------------- 59 | HRESULT WINAPI DXTraceW(_In_z_ const WCHAR* strFile, _In_ DWORD dwLine, _In_ HRESULT hr, _In_opt_ const WCHAR* strMsg, _In_ bool bPopMsgBox); 60 | 61 | #define DXTrace DXTraceW 62 | 63 | //-------------------------------------------------------------------------------------- 64 | // 65 | // Helper macros 66 | // 67 | //-------------------------------------------------------------------------------------- 68 | #if defined(DEBUG) || defined(_DEBUG) 69 | #define DXTRACE_MSG(str) DXTrace( __FILEW__, (DWORD)__LINE__, 0, str, false ) 70 | #define DXTRACE_ERR(str,hr) DXTrace( __FILEW__, (DWORD)__LINE__, hr, str, false ) 71 | #define DXTRACE_ERR_MSGBOX(str,hr) DXTrace( __FILEW__, (DWORD)__LINE__, hr, str, true ) 72 | #else 73 | #define DXTRACE_MSG(str) (0L) 74 | #define DXTRACE_ERR(str,hr) (hr) 75 | #define DXTRACE_ERR_MSGBOX(str,hr) (hr) 76 | #endif 77 | 78 | #ifdef __cplusplus 79 | } 80 | #endif //__cplusplus 81 | -------------------------------------------------------------------------------- /renderAPI/CtrIEffect.cpp: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------------// 2 | // // 3 | // _________ .__ __ __ // 4 | // \_ ___ \_______|__|/ |__/ |_ ___________ // 5 | // / \ \/\_ __ \ \ __\ __\/ __ \_ __ \ // 6 | // \ \____| | \/ || | | | \ ___/| | \/ // 7 | // \______ /|__| |__||__| |__| \___ >__| // 8 | // \/ \/ // 9 | // // 10 | // Critter is provided under the MIT License(MIT) // 11 | // Critter uses portions of other open source software. // 12 | // Please review the LICENSE file for further details. // 13 | // // 14 | // Copyright(c) 2015 Matt Davidson // 15 | // // 16 | // Permission is hereby granted, free of charge, to any person obtaining a copy // 17 | // of this software and associated documentation files(the "Software"), to deal // 18 | // in the Software without restriction, including without limitation the rights // 19 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell // 20 | // copies of the Software, and to permit persons to whom the Software is // 21 | // furnished to do so, subject to the following conditions : // 22 | // // 23 | // 1. Redistributions of source code must retain the above copyright notice, // 24 | // this list of conditions and the following disclaimer. // 25 | // 2. Redistributions in binary form must reproduce the above copyright notice, // 26 | // this list of conditions and the following disclaimer in the // 27 | // documentation and / or other materials provided with the distribution. // 28 | // 3. Neither the name of the copyright holder nor the names of its // 29 | // contributors may be used to endorse or promote products derived // 30 | // from this software without specific prior written permission. // 31 | // // 32 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // 33 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // 34 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE // 35 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // 36 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // 37 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // 38 | // THE SOFTWARE. // 39 | // // 40 | //------------------------------------------------------------------------------------// 41 | #include 42 | namespace Ctr 43 | { 44 | IEffect::IEffect (Ctr::IDevice* device) : IRenderResource (device) 45 | { 46 | } 47 | 48 | IEffect::~IEffect() 49 | { 50 | } 51 | 52 | } -------------------------------------------------------------------------------- /renderAPI/CtrIIndexBuffer.cpp: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------------// 2 | // // 3 | // _________ .__ __ __ // 4 | // \_ ___ \_______|__|/ |__/ |_ ___________ // 5 | // / \ \/\_ __ \ \ __\ __\/ __ \_ __ \ // 6 | // \ \____| | \/ || | | | \ ___/| | \/ // 7 | // \______ /|__| |__||__| |__| \___ >__| // 8 | // \/ \/ // 9 | // // 10 | // Critter is provided under the MIT License(MIT) // 11 | // Critter uses portions of other open source software. // 12 | // Please review the LICENSE file for further details. // 13 | // // 14 | // Copyright(c) 2015 Matt Davidson // 15 | // // 16 | // Permission is hereby granted, free of charge, to any person obtaining a copy // 17 | // of this software and associated documentation files(the "Software"), to deal // 18 | // in the Software without restriction, including without limitation the rights // 19 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell // 20 | // copies of the Software, and to permit persons to whom the Software is // 21 | // furnished to do so, subject to the following conditions : // 22 | // // 23 | // 1. Redistributions of source code must retain the above copyright notice, // 24 | // this list of conditions and the following disclaimer. // 25 | // 2. Redistributions in binary form must reproduce the above copyright notice, // 26 | // this list of conditions and the following disclaimer in the // 27 | // documentation and / or other materials provided with the distribution. // 28 | // 3. Neither the name of the copyright holder nor the names of its // 29 | // contributors may be used to endorse or promote products derived // 30 | // from this software without specific prior written permission. // 31 | // // 32 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // 33 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // 34 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE // 35 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // 36 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // 37 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // 38 | // THE SOFTWARE. // 39 | // // 40 | //------------------------------------------------------------------------------------// 41 | #include 42 | namespace Ctr 43 | { 44 | IIndexBuffer::IIndexBuffer (Ctr::IDevice* device) : IRenderResource (device) {} 45 | IIndexBuffer::~IIndexBuffer() {} 46 | 47 | } -------------------------------------------------------------------------------- /nodes/CtrRenderNode.cpp: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------------// 2 | // // 3 | // _________ .__ __ __ // 4 | // \_ ___ \_______|__|/ |__/ |_ ___________ // 5 | // / \ \/\_ __ \ \ __\ __\/ __ \_ __ \ // 6 | // \ \____| | \/ || | | | \ ___/| | \/ // 7 | // \______ /|__| |__||__| |__| \___ >__| // 8 | // \/ \/ // 9 | // // 10 | // Critter is provided under the MIT License(MIT) // 11 | // Critter uses portions of other open source software. // 12 | // Please review the LICENSE file for further details. // 13 | // // 14 | // Copyright(c) 2015 Matt Davidson // 15 | // // 16 | // Permission is hereby granted, free of charge, to any person obtaining a copy // 17 | // of this software and associated documentation files(the "Software"), to deal // 18 | // in the Software without restriction, including without limitation the rights // 19 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell // 20 | // copies of the Software, and to permit persons to whom the Software is // 21 | // furnished to do so, subject to the following conditions : // 22 | // // 23 | // 1. Redistributions of source code must retain the above copyright notice, // 24 | // this list of conditions and the following disclaimer. // 25 | // 2. Redistributions in binary form must reproduce the above copyright notice, // 26 | // this list of conditions and the following disclaimer in the // 27 | // documentation and / or other materials provided with the distribution. // 28 | // 3. Neither the name of the copyright holder nor the names of its // 29 | // contributors may be used to endorse or promote products derived // 30 | // from this software without specific prior written permission. // 31 | // // 32 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // 33 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // 34 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE // 35 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // 36 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // 37 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // 38 | // THE SOFTWARE. // 39 | // // 40 | //------------------------------------------------------------------------------------// 41 | 42 | #include 43 | 44 | namespace Ctr 45 | { 46 | RenderNode::RenderNode(Ctr::IDevice* device) : 47 | _device (device) 48 | { 49 | } 50 | 51 | RenderNode::~RenderNode() 52 | { 53 | } 54 | } -------------------------------------------------------------------------------- /renderAPI/CtrISurface.cpp: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------------// 2 | // // 3 | // _________ .__ __ __ // 4 | // \_ ___ \_______|__|/ |__/ |_ ___________ // 5 | // / \ \/\_ __ \ \ __\ __\/ __ \_ __ \ // 6 | // \ \____| | \/ || | | | \ ___/| | \/ // 7 | // \______ /|__| |__||__| |__| \___ >__| // 8 | // \/ \/ // 9 | // // 10 | // Critter is provided under the MIT License(MIT) // 11 | // Critter uses portions of other open source software. // 12 | // Please review the LICENSE file for further details. // 13 | // // 14 | // Copyright(c) 2015 Matt Davidson // 15 | // // 16 | // Permission is hereby granted, free of charge, to any person obtaining a copy // 17 | // of this software and associated documentation files(the "Software"), to deal // 18 | // in the Software without restriction, including without limitation the rights // 19 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell // 20 | // copies of the Software, and to permit persons to whom the Software is // 21 | // furnished to do so, subject to the following conditions : // 22 | // // 23 | // 1. Redistributions of source code must retain the above copyright notice, // 24 | // this list of conditions and the following disclaimer. // 25 | // 2. Redistributions in binary form must reproduce the above copyright notice, // 26 | // this list of conditions and the following disclaimer in the // 27 | // documentation and / or other materials provided with the distribution. // 28 | // 3. Neither the name of the copyright holder nor the names of its // 29 | // contributors may be used to endorse or promote products derived // 30 | // from this software without specific prior written permission. // 31 | // // 32 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // 33 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // 34 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE // 35 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // 36 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // 37 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // 38 | // THE SOFTWARE. // 39 | // // 40 | //------------------------------------------------------------------------------------// 41 | #include 42 | namespace Ctr 43 | { 44 | ISurface::ISurface (Ctr::IDevice* device) : 45 | IRenderResource (device) 46 | { 47 | } 48 | 49 | ISurface::~ISurface() 50 | { 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /renderAPI/CtrIDepthSurface.cpp: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------------// 2 | // // 3 | // _________ .__ __ __ // 4 | // \_ ___ \_______|__|/ |__/ |_ ___________ // 5 | // / \ \/\_ __ \ \ __\ __\/ __ \_ __ \ // 6 | // \ \____| | \/ || | | | \ ___/| | \/ // 7 | // \______ /|__| |__||__| |__| \___ >__| // 8 | // \/ \/ // 9 | // // 10 | // Critter is provided under the MIT License(MIT) // 11 | // Critter uses portions of other open source software. // 12 | // Please review the LICENSE file for further details. // 13 | // // 14 | // Copyright(c) 2015 Matt Davidson // 15 | // // 16 | // Permission is hereby granted, free of charge, to any person obtaining a copy // 17 | // of this software and associated documentation files(the "Software"), to deal // 18 | // in the Software without restriction, including without limitation the rights // 19 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell // 20 | // copies of the Software, and to permit persons to whom the Software is // 21 | // furnished to do so, subject to the following conditions : // 22 | // // 23 | // 1. Redistributions of source code must retain the above copyright notice, // 24 | // this list of conditions and the following disclaimer. // 25 | // 2. Redistributions in binary form must reproduce the above copyright notice, // 26 | // this list of conditions and the following disclaimer in the // 27 | // documentation and / or other materials provided with the distribution. // 28 | // 3. Neither the name of the copyright holder nor the names of its // 29 | // contributors may be used to endorse or promote products derived // 30 | // from this software without specific prior written permission. // 31 | // // 32 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // 33 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // 34 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE // 35 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // 36 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // 37 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // 38 | // THE SOFTWARE. // 39 | // // 40 | //------------------------------------------------------------------------------------// 41 | #include 42 | namespace Ctr 43 | { 44 | IDepthSurface::IDepthSurface (Ctr::IDevice* device) : IRenderResource (device) 45 | { 46 | } 47 | 48 | IDepthSurface::~IDepthSurface() 49 | { 50 | } 51 | 52 | } -------------------------------------------------------------------------------- /renderAPI/CtrIGpuBuffer.cpp: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------------// 2 | // // 3 | // _________ .__ __ __ // 4 | // \_ ___ \_______|__|/ |__/ |_ ___________ // 5 | // / \ \/\_ __ \ \ __\ __\/ __ \_ __ \ // 6 | // \ \____| | \/ || | | | \ ___/| | \/ // 7 | // \______ /|__| |__||__| |__| \___ >__| // 8 | // \/ \/ // 9 | // // 10 | // Critter is provided under the MIT License(MIT) // 11 | // Critter uses portions of other open source software. // 12 | // Please review the LICENSE file for further details. // 13 | // // 14 | // Copyright(c) 2015 Matt Davidson // 15 | // // 16 | // Permission is hereby granted, free of charge, to any person obtaining a copy // 17 | // of this software and associated documentation files(the "Software"), to deal // 18 | // in the Software without restriction, including without limitation the rights // 19 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell // 20 | // copies of the Software, and to permit persons to whom the Software is // 21 | // furnished to do so, subject to the following conditions : // 22 | // // 23 | // 1. Redistributions of source code must retain the above copyright notice, // 24 | // this list of conditions and the following disclaimer. // 25 | // 2. Redistributions in binary form must reproduce the above copyright notice, // 26 | // this list of conditions and the following disclaimer in the // 27 | // documentation and / or other materials provided with the distribution. // 28 | // 3. Neither the name of the copyright holder nor the names of its // 29 | // contributors may be used to endorse or promote products derived // 30 | // from this software without specific prior written permission. // 31 | // // 32 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // 33 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // 34 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE // 35 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // 36 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // 37 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // 38 | // THE SOFTWARE. // 39 | // // 40 | //------------------------------------------------------------------------------------// 41 | #include 42 | 43 | namespace Ctr 44 | { 45 | IGpuBuffer::IGpuBuffer (Ctr::IDevice* device) : 46 | IRenderResource (device) 47 | { 48 | } 49 | 50 | IGpuBuffer::~IGpuBuffer() 51 | { 52 | 53 | } 54 | 55 | } -------------------------------------------------------------------------------- /renderAPI/CtrGpuTechnique.cpp: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------------// 2 | // // 3 | // _________ .__ __ __ // 4 | // \_ ___ \_______|__|/ |__/ |_ ___________ // 5 | // / \ \/\_ __ \ \ __\ __\/ __ \_ __ \ // 6 | // \ \____| | \/ || | | | \ ___/| | \/ // 7 | // \______ /|__| |__||__| |__| \___ >__| // 8 | // \/ \/ // 9 | // // 10 | // Critter is provided under the MIT License(MIT) // 11 | // Critter uses portions of other open source software. // 12 | // Please review the LICENSE file for further details. // 13 | // // 14 | // Copyright(c) 2015 Matt Davidson // 15 | // // 16 | // Permission is hereby granted, free of charge, to any person obtaining a copy // 17 | // of this software and associated documentation files(the "Software"), to deal // 18 | // in the Software without restriction, including without limitation the rights // 19 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell // 20 | // copies of the Software, and to permit persons to whom the Software is // 21 | // furnished to do so, subject to the following conditions : // 22 | // // 23 | // 1. Redistributions of source code must retain the above copyright notice, // 24 | // this list of conditions and the following disclaimer. // 25 | // 2. Redistributions in binary form must reproduce the above copyright notice, // 26 | // this list of conditions and the following disclaimer in the // 27 | // documentation and / or other materials provided with the distribution. // 28 | // 3. Neither the name of the copyright holder nor the names of its // 29 | // contributors may be used to endorse or promote products derived // 30 | // from this software without specific prior written permission. // 31 | // // 32 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // 33 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // 34 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE // 35 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // 36 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // 37 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // 38 | // THE SOFTWARE. // 39 | // // 40 | //------------------------------------------------------------------------------------// 41 | 42 | #include 43 | namespace Ctr 44 | { 45 | 46 | GpuTechnique::GpuTechnique (Ctr::IDevice* device) : IRenderResource (device) 47 | { 48 | } 49 | 50 | GpuTechnique::~GpuTechnique() 51 | { 52 | } 53 | 54 | } -------------------------------------------------------------------------------- /renderAPI/CtrIVertexDeclaration.cpp: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------------// 2 | // // 3 | // _________ .__ __ __ // 4 | // \_ ___ \_______|__|/ |__/ |_ ___________ // 5 | // / \ \/\_ __ \ \ __\ __\/ __ \_ __ \ // 6 | // \ \____| | \/ || | | | \ ___/| | \/ // 7 | // \______ /|__| |__||__| |__| \___ >__| // 8 | // \/ \/ // 9 | // // 10 | // Critter is provided under the MIT License(MIT) // 11 | // Critter uses portions of other open source software. // 12 | // Please review the LICENSE file for further details. // 13 | // // 14 | // Copyright(c) 2015 Matt Davidson // 15 | // // 16 | // Permission is hereby granted, free of charge, to any person obtaining a copy // 17 | // of this software and associated documentation files(the "Software"), to deal // 18 | // in the Software without restriction, including without limitation the rights // 19 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell // 20 | // copies of the Software, and to permit persons to whom the Software is // 21 | // furnished to do so, subject to the following conditions : // 22 | // // 23 | // 1. Redistributions of source code must retain the above copyright notice, // 24 | // this list of conditions and the following disclaimer. // 25 | // 2. Redistributions in binary form must reproduce the above copyright notice, // 26 | // this list of conditions and the following disclaimer in the // 27 | // documentation and / or other materials provided with the distribution. // 28 | // 3. Neither the name of the copyright holder nor the names of its // 29 | // contributors may be used to endorse or promote products derived // 30 | // from this software without specific prior written permission. // 31 | // // 32 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // 33 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // 34 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE // 35 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // 36 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // 37 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // 38 | // THE SOFTWARE. // 39 | // // 40 | //------------------------------------------------------------------------------------// 41 | #include 42 | 43 | namespace Ctr 44 | { 45 | IVertexDeclaration::IVertexDeclaration(Ctr::IDevice* device) : 46 | IRenderResource (device) 47 | { 48 | } 49 | 50 | IVertexDeclaration::~IVertexDeclaration() 51 | { 52 | }; 53 | 54 | } -------------------------------------------------------------------------------- /renderAPI/CtrGpuConstantBuffer.cpp: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------------// 2 | // // 3 | // _________ .__ __ __ // 4 | // \_ ___ \_______|__|/ |__/ |_ ___________ // 5 | // / \ \/\_ __ \ \ __\ __\/ __ \_ __ \ // 6 | // \ \____| | \/ || | | | \ ___/| | \/ // 7 | // \______ /|__| |__||__| |__| \___ >__| // 8 | // \/ \/ // 9 | // // 10 | // Critter is provided under the MIT License(MIT) // 11 | // Critter uses portions of other open source software. // 12 | // Please review the LICENSE file for further details. // 13 | // // 14 | // Copyright(c) 2015 Matt Davidson // 15 | // // 16 | // Permission is hereby granted, free of charge, to any person obtaining a copy // 17 | // of this software and associated documentation files(the "Software"), to deal // 18 | // in the Software without restriction, including without limitation the rights // 19 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell // 20 | // copies of the Software, and to permit persons to whom the Software is // 21 | // furnished to do so, subject to the following conditions : // 22 | // // 23 | // 1. Redistributions of source code must retain the above copyright notice, // 24 | // this list of conditions and the following disclaimer. // 25 | // 2. Redistributions in binary form must reproduce the above copyright notice, // 26 | // this list of conditions and the following disclaimer in the // 27 | // documentation and / or other materials provided with the distribution. // 28 | // 3. Neither the name of the copyright holder nor the names of its // 29 | // contributors may be used to endorse or promote products derived // 30 | // from this software without specific prior written permission. // 31 | // // 32 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // 33 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // 34 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE // 35 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // 36 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // 37 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // 38 | // THE SOFTWARE. // 39 | // // 40 | //------------------------------------------------------------------------------------// 41 | 42 | #include 43 | 44 | namespace Ctr 45 | { 46 | 47 | GpuConstantBuffer::GpuConstantBuffer (Ctr::IDevice* device) : IRenderResource (device) 48 | { 49 | _valueIndex = 0; 50 | } 51 | 52 | GpuConstantBuffer::~GpuConstantBuffer() 53 | { 54 | } 55 | 56 | } -------------------------------------------------------------------------------- /application/CtrNonCopyable.h: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------------// 2 | // // 3 | // _________ .__ __ __ // 4 | // \_ ___ \_______|__|/ |__/ |_ ___________ // 5 | // / \ \/\_ __ \ \ __\ __\/ __ \_ __ \ // 6 | // \ \____| | \/ || | | | \ ___/| | \/ // 7 | // \______ /|__| |__||__| |__| \___ >__| // 8 | // \/ \/ // 9 | // // 10 | // Critter is provided under the MIT License(MIT) // 11 | // Critter uses portions of other open source software. // 12 | // Please review the LICENSE file for further details. // 13 | // // 14 | // Copyright(c) 2015 Matt Davidson // 15 | // // 16 | // Permission is hereby granted, free of charge, to any person obtaining a copy // 17 | // of this software and associated documentation files(the "Software"), to deal // 18 | // in the Software without restriction, including without limitation the rights // 19 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell // 20 | // copies of the Software, and to permit persons to whom the Software is // 21 | // furnished to do so, subject to the following conditions : // 22 | // // 23 | // 1. Redistributions of source code must retain the above copyright notice, // 24 | // this list of conditions and the following disclaimer. // 25 | // 2. Redistributions in binary form must reproduce the above copyright notice, // 26 | // this list of conditions and the following disclaimer in the // 27 | // documentation and / or other materials provided with the distribution. // 28 | // 3. Neither the name of the copyright holder nor the names of its // 29 | // contributors may be used to endorse or promote products derived // 30 | // from this software without specific prior written permission. // 31 | // // 32 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // 33 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // 34 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE // 35 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // 36 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // 37 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // 38 | // THE SOFTWARE. // 39 | // // 40 | //------------------------------------------------------------------------------------// 41 | 42 | #ifndef INCLUDED_NON_COPYABLE 43 | #define INCLDUED_NON_COPYABLE 44 | 45 | namespace Ctr 46 | { 47 | // Thinner than inheriting from yet another class. 48 | #define NON_COPYABLE(Type) \ 49 | Type(const Type&) {} \ 50 | void operator=(const Type&){} 51 | } 52 | 53 | #endif -------------------------------------------------------------------------------- /renderAPI/CtrIComputeShader.cpp: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------------// 2 | // // 3 | // _________ .__ __ __ // 4 | // \_ ___ \_______|__|/ |__/ |_ ___________ // 5 | // / \ \/\_ __ \ \ __\ __\/ __ \_ __ \ // 6 | // \ \____| | \/ || | | | \ ___/| | \/ // 7 | // \______ /|__| |__||__| |__| \___ >__| // 8 | // \/ \/ // 9 | // // 10 | // Critter is provided under the MIT License(MIT) // 11 | // Critter uses portions of other open source software. // 12 | // Please review the LICENSE file for further details. // 13 | // // 14 | // Copyright(c) 2015 Matt Davidson // 15 | // // 16 | // Permission is hereby granted, free of charge, to any person obtaining a copy // 17 | // of this software and associated documentation files(the "Software"), to deal // 18 | // in the Software without restriction, including without limitation the rights // 19 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell // 20 | // copies of the Software, and to permit persons to whom the Software is // 21 | // furnished to do so, subject to the following conditions : // 22 | // // 23 | // 1. Redistributions of source code must retain the above copyright notice, // 24 | // this list of conditions and the following disclaimer. // 25 | // 2. Redistributions in binary form must reproduce the above copyright notice, // 26 | // this list of conditions and the following disclaimer in the // 27 | // documentation and / or other materials provided with the distribution. // 28 | // 3. Neither the name of the copyright holder nor the names of its // 29 | // contributors may be used to endorse or promote products derived // 30 | // from this software without specific prior written permission. // 31 | // // 32 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // 33 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // 34 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE // 35 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // 36 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // 37 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // 38 | // THE SOFTWARE. // 39 | // // 40 | //------------------------------------------------------------------------------------// 41 | #include 42 | 43 | namespace Ctr 44 | { 45 | IComputeShader::IComputeShader (Ctr::IDevice* device) : 46 | IRenderResource (device) 47 | { 48 | } 49 | 50 | IComputeShader::~IComputeShader() 51 | { 52 | } 53 | 54 | const Hash& 55 | IComputeShader::hash() const 56 | { 57 | return _hash; 58 | } 59 | 60 | } 61 | 62 | -------------------------------------------------------------------------------- /renderAPI/CtrColorPass.h: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------------// 2 | // // 3 | // _________ .__ __ __ // 4 | // \_ ___ \_______|__|/ |__/ |_ ___________ // 5 | // / \ \/\_ __ \ \ __\ __\/ __ \_ __ \ // 6 | // \ \____| | \/ || | | | \ ___/| | \/ // 7 | // \______ /|__| |__||__| |__| \___ >__| // 8 | // \/ \/ // 9 | // // 10 | // Critter is provided under the MIT License(MIT) // 11 | // Critter uses portions of other open source software. // 12 | // Please review the LICENSE file for further details. // 13 | // // 14 | // Copyright(c) 2015 Matt Davidson // 15 | // // 16 | // Permission is hereby granted, free of charge, to any person obtaining a copy // 17 | // of this software and associated documentation files(the "Software"), to deal // 18 | // in the Software without restriction, including without limitation the rights // 19 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell // 20 | // copies of the Software, and to permit persons to whom the Software is // 21 | // furnished to do so, subject to the following conditions : // 22 | // // 23 | // 1. Redistributions of source code must retain the above copyright notice, // 24 | // this list of conditions and the following disclaimer. // 25 | // 2. Redistributions in binary form must reproduce the above copyright notice, // 26 | // this list of conditions and the following disclaimer in the // 27 | // documentation and / or other materials provided with the distribution. // 28 | // 3. Neither the name of the copyright holder nor the names of its // 29 | // contributors may be used to endorse or promote products derived // 30 | // from this software without specific prior written permission. // 31 | // // 32 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // 33 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // 34 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE // 35 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // 36 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // 37 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // 38 | // THE SOFTWARE. // 39 | // // 40 | //------------------------------------------------------------------------------------// 41 | #ifndef INCLUDED_CRT_COLOR_PASS 42 | #define INCLUDED_CRT_COLOR_PASS 43 | 44 | #include 45 | #include 46 | 47 | namespace Ctr 48 | { 49 | 50 | class ColorPass : public Ctr::RenderPass 51 | { 52 | public: 53 | ColorPass (Ctr::IDevice* device); 54 | virtual ~ColorPass (); 55 | virtual void render(Ctr::Scene* scene); 56 | }; 57 | } 58 | 59 | #endif -------------------------------------------------------------------------------- /renderAPI/CtrRenderRequest.cpp: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------------// 2 | // // 3 | // _________ .__ __ __ // 4 | // \_ ___ \_______|__|/ |__/ |_ ___________ // 5 | // / \ \/\_ __ \ \ __\ __\/ __ \_ __ \ // 6 | // \ \____| | \/ || | | | \ ___/| | \/ // 7 | // \______ /|__| |__||__| |__| \___ >__| // 8 | // \/ \/ // 9 | // // 10 | // Critter is provided under the MIT License(MIT) // 11 | // Critter uses portions of other open source software. // 12 | // Please review the LICENSE file for further details. // 13 | // // 14 | // Copyright(c) 2015 Matt Davidson // 15 | // // 16 | // Permission is hereby granted, free of charge, to any person obtaining a copy // 17 | // of this software and associated documentation files(the "Software"), to deal // 18 | // in the Software without restriction, including without limitation the rights // 19 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell // 20 | // copies of the Software, and to permit persons to whom the Software is // 21 | // furnished to do so, subject to the following conditions : // 22 | // // 23 | // 1. Redistributions of source code must retain the above copyright notice, // 24 | // this list of conditions and the following disclaimer. // 25 | // 2. Redistributions in binary form must reproduce the above copyright notice, // 26 | // this list of conditions and the following disclaimer in the // 27 | // documentation and / or other materials provided with the distribution. // 28 | // 3. Neither the name of the copyright holder nor the names of its // 29 | // contributors may be used to endorse or promote products derived // 30 | // from this software without specific prior written permission. // 31 | // // 32 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // 33 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // 34 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE // 35 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // 36 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // 37 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // 38 | // THE SOFTWARE. // 39 | // // 40 | //------------------------------------------------------------------------------------// 41 | #include 42 | #include 43 | 44 | namespace Ctr 45 | { 46 | RenderRequest::RenderRequest() 47 | { 48 | } 49 | 50 | RenderRequest::RenderRequest(const Ctr::GpuTechnique* techniqueIn, const Ctr::Scene* scene, const Ctr::Camera* cameraIn, const Ctr::Mesh* meshIn) : 51 | technique(techniqueIn), 52 | scene (scene), 53 | camera(cameraIn), 54 | mesh (meshIn) 55 | { 56 | material = meshIn->material(); 57 | } 58 | 59 | } 60 | -------------------------------------------------------------------------------- /renderAPI/CtrIEffect.h: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------------// 2 | // // 3 | // _________ .__ __ __ // 4 | // \_ ___ \_______|__|/ |__/ |_ ___________ // 5 | // / \ \/\_ __ \ \ __\ __\/ __ \_ __ \ // 6 | // \ \____| | \/ || | | | \ ___/| | \/ // 7 | // \______ /|__| |__||__| |__| \___ >__| // 8 | // \/ \/ // 9 | // // 10 | // Critter is provided under the MIT License(MIT) // 11 | // Critter uses portions of other open source software. // 12 | // Please review the LICENSE file for further details. // 13 | // // 14 | // Copyright(c) 2015 Matt Davidson // 15 | // // 16 | // Permission is hereby granted, free of charge, to any person obtaining a copy // 17 | // of this software and associated documentation files(the "Software"), to deal // 18 | // in the Software without restriction, including without limitation the rights // 19 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell // 20 | // copies of the Software, and to permit persons to whom the Software is // 21 | // furnished to do so, subject to the following conditions : // 22 | // // 23 | // 1. Redistributions of source code must retain the above copyright notice, // 24 | // this list of conditions and the following disclaimer. // 25 | // 2. Redistributions in binary form must reproduce the above copyright notice, // 26 | // this list of conditions and the following disclaimer in the // 27 | // documentation and / or other materials provided with the distribution. // 28 | // 3. Neither the name of the copyright holder nor the names of its // 29 | // contributors may be used to endorse or promote products derived // 30 | // from this software without specific prior written permission. // 31 | // // 32 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // 33 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // 34 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE // 35 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // 36 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // 37 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // 38 | // THE SOFTWARE. // 39 | // // 40 | //------------------------------------------------------------------------------------// 41 | #ifndef INCLUDED_CRT_IEFFECT_INTERFACE 42 | #define INCLUDED_CRT_IEFFECT_INTERFACE 43 | 44 | #include 45 | 46 | namespace Ctr 47 | { 48 | class ITexture; 49 | class GpuVariable; 50 | class GpuConstantBuffer; 51 | class IDepthSurface; 52 | class IVertexBuffer; 53 | class IIndexBuffer; 54 | class IGpuBuffer; 55 | 56 | class IEffect : public IRenderResource 57 | { 58 | public: 59 | IEffect (Ctr::IDevice* device); 60 | virtual ~IEffect(); 61 | }; 62 | } 63 | 64 | #endif -------------------------------------------------------------------------------- /renderAPI/CtrGpuTechnique.h: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------------// 2 | // // 3 | // _________ .__ __ __ // 4 | // \_ ___ \_______|__|/ |__/ |_ ___________ // 5 | // / \ \/\_ __ \ \ __\ __\/ __ \_ __ \ // 6 | // \ \____| | \/ || | | | \ ___/| | \/ // 7 | // \______ /|__| |__||__| |__| \___ >__| // 8 | // \/ \/ // 9 | // // 10 | // Critter is provided under the MIT License(MIT) // 11 | // Critter uses portions of other open source software. // 12 | // Please review the LICENSE file for further details. // 13 | // // 14 | // Copyright(c) 2015 Matt Davidson // 15 | // // 16 | // Permission is hereby granted, free of charge, to any person obtaining a copy // 17 | // of this software and associated documentation files(the "Software"), to deal // 18 | // in the Software without restriction, including without limitation the rights // 19 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell // 20 | // copies of the Software, and to permit persons to whom the Software is // 21 | // furnished to do so, subject to the following conditions : // 22 | // // 23 | // 1. Redistributions of source code must retain the above copyright notice, // 24 | // this list of conditions and the following disclaimer. // 25 | // 2. Redistributions in binary form must reproduce the above copyright notice, // 26 | // this list of conditions and the following disclaimer in the // 27 | // documentation and / or other materials provided with the distribution. // 28 | // 3. Neither the name of the copyright holder nor the names of its // 29 | // contributors may be used to endorse or promote products derived // 30 | // from this software without specific prior written permission. // 31 | // // 32 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // 33 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // 34 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE // 35 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // 36 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // 37 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // 38 | // THE SOFTWARE. // 39 | // // 40 | //------------------------------------------------------------------------------------// 41 | #ifndef INCLUDED_CRT_TECHNIQUE_INTERFACE 42 | #define INCLUDED_CRT_TECHNIQUE_INTERFACE 43 | 44 | #include 45 | 46 | namespace Ctr 47 | { 48 | class IEffect; 49 | 50 | class GpuTechnique : public IRenderResource 51 | { 52 | public: 53 | GpuTechnique (Ctr::IDevice* device); 54 | virtual ~GpuTechnique(); 55 | 56 | virtual IEffect* effect() const = 0; 57 | virtual const std::string& name() const = 0; 58 | virtual bool hasTessellationStage() const = 0; 59 | }; 60 | 61 | } 62 | 63 | 64 | #endif -------------------------------------------------------------------------------- /renderAPI/CtrIVertexBuffer.cpp: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------------// 2 | // // 3 | // _________ .__ __ __ // 4 | // \_ ___ \_______|__|/ |__/ |_ ___________ // 5 | // / \ \/\_ __ \ \ __\ __\/ __ \_ __ \ // 6 | // \ \____| | \/ || | | | \ ___/| | \/ // 7 | // \______ /|__| |__||__| |__| \___ >__| // 8 | // \/ \/ // 9 | // // 10 | // Critter is provided under the MIT License(MIT) // 11 | // Critter uses portions of other open source software. // 12 | // Please review the LICENSE file for further details. // 13 | // // 14 | // Copyright(c) 2015 Matt Davidson // 15 | // // 16 | // Permission is hereby granted, free of charge, to any person obtaining a copy // 17 | // of this software and associated documentation files(the "Software"), to deal // 18 | // in the Software without restriction, including without limitation the rights // 19 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell // 20 | // copies of the Software, and to permit persons to whom the Software is // 21 | // furnished to do so, subject to the following conditions : // 22 | // // 23 | // 1. Redistributions of source code must retain the above copyright notice, // 24 | // this list of conditions and the following disclaimer. // 25 | // 2. Redistributions in binary form must reproduce the above copyright notice, // 26 | // this list of conditions and the following disclaimer in the // 27 | // documentation and / or other materials provided with the distribution. // 28 | // 3. Neither the name of the copyright holder nor the names of its // 29 | // contributors may be used to endorse or promote products derived // 30 | // from this software without specific prior written permission. // 31 | // // 32 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // 33 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // 34 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE // 35 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // 36 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // 37 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // 38 | // THE SOFTWARE. // 39 | // // 40 | //------------------------------------------------------------------------------------// 41 | #include 42 | namespace Ctr 43 | { 44 | IVertexBuffer::IVertexBuffer (Ctr::IDevice* device) : 45 | IRenderResource (device) 46 | { 47 | } 48 | 49 | IVertexBuffer::~IVertexBuffer() {} 50 | 51 | void 52 | IVertexBuffer::setVertexDeclaration (const IVertexDeclaration* decl) 53 | { 54 | _vertexDeclaration = decl; 55 | } 56 | 57 | bool 58 | IVertexBuffer::bindToStreamOut() const { return false; } 59 | 60 | const IVertexDeclaration* 61 | IVertexBuffer::vertexDeclaration() const 62 | { 63 | return _vertexDeclaration; 64 | } 65 | 66 | } -------------------------------------------------------------------------------- /nodes/CtrEntity.h: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------------// 2 | // // 3 | // _________ .__ __ __ // 4 | // \_ ___ \_______|__|/ |__/ |_ ___________ // 5 | // / \ \/\_ __ \ \ __\ __\/ __ \_ __ \ // 6 | // \ \____| | \/ || | | | \ ___/| | \/ // 7 | // \______ /|__| |__||__| |__| \___ >__| // 8 | // \/ \/ // 9 | // // 10 | // Critter is provided under the MIT License(MIT) // 11 | // Critter uses portions of other open source software. // 12 | // Please review the LICENSE file for further details. // 13 | // // 14 | // Copyright(c) 2015 Matt Davidson // 15 | // // 16 | // Permission is hereby granted, free of charge, to any person obtaining a copy // 17 | // of this software and associated documentation files(the "Software"), to deal // 18 | // in the Software without restriction, including without limitation the rights // 19 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell // 20 | // copies of the Software, and to permit persons to whom the Software is // 21 | // furnished to do so, subject to the following conditions : // 22 | // // 23 | // 1. Redistributions of source code must retain the above copyright notice, // 24 | // this list of conditions and the following disclaimer. // 25 | // 2. Redistributions in binary form must reproduce the above copyright notice, // 26 | // this list of conditions and the following disclaimer in the // 27 | // documentation and / or other materials provided with the distribution. // 28 | // 3. Neither the name of the copyright holder nor the names of its // 29 | // contributors may be used to endorse or promote products derived // 30 | // from this software without specific prior written permission. // 31 | // // 32 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // 33 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // 34 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE // 35 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // 36 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // 37 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // 38 | // THE SOFTWARE. // 39 | // // 40 | //------------------------------------------------------------------------------------// 41 | #ifndef INCLUDED_ENTITY 42 | #define INCLUDED_ENTITY 43 | 44 | #include 45 | #include 46 | #include 47 | 48 | namespace Ctr 49 | { 50 | class Entity : public RenderNode 51 | { 52 | public: 53 | Entity(Ctr::IDevice* device); 54 | virtual ~Entity(); 55 | 56 | void addMesh(Mesh* mesh); 57 | const std::vector& meshes() const; 58 | Mesh* mesh(size_t index); 59 | size_t numMeshes() const; 60 | 61 | private: 62 | std::vector _meshes; 63 | }; 64 | 65 | } 66 | 67 | #endif -------------------------------------------------------------------------------- /rendererD3D11/CtrFormatConversionD3D11.h: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------------// 2 | // // 3 | // _________ .__ __ __ // 4 | // \_ ___ \_______|__|/ |__/ |_ ___________ // 5 | // / \ \/\_ __ \ \ __\ __\/ __ \_ __ \ // 6 | // \ \____| | \/ || | | | \ ___/| | \/ // 7 | // \______ /|__| |__||__| |__| \___ >__| // 8 | // \/ \/ // 9 | // // 10 | // Critter is provided under the MIT License(MIT) // 11 | // Critter uses portions of other open source software. // 12 | // Please review the LICENSE file for further details. // 13 | // // 14 | // Copyright(c) 2015 Matt Davidson // 15 | // // 16 | // Permission is hereby granted, free of charge, to any person obtaining a copy // 17 | // of this software and associated documentation files(the "Software"), to deal // 18 | // in the Software without restriction, including without limitation the rights // 19 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell // 20 | // copies of the Software, and to permit persons to whom the Software is // 21 | // furnished to do so, subject to the following conditions : // 22 | // // 23 | // 1. Redistributions of source code must retain the above copyright notice, // 24 | // this list of conditions and the following disclaimer. // 25 | // 2. Redistributions in binary form must reproduce the above copyright notice, // 26 | // this list of conditions and the following disclaimer in the // 27 | // documentation and / or other materials provided with the distribution. // 28 | // 3. Neither the name of the copyright holder nor the names of its // 29 | // contributors may be used to endorse or promote products derived // 30 | // from this software without specific prior written permission. // 31 | // // 32 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // 33 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // 34 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE // 35 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // 36 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // 37 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // 38 | // THE SOFTWARE. // 39 | // // 40 | //------------------------------------------------------------------------------------// 41 | 42 | #ifndef INCLUDED_CRT_FORMAT_CONVERSION 43 | #define INCLUDED_CRT_FORMAT_CONVERSION 44 | 45 | #include 46 | #include 47 | #include 48 | 49 | namespace Ctr 50 | { 51 | PixelFormat findFormat(DXGI_FORMAT format); 52 | DXGI_FORMAT findFormat(PixelFormat format); 53 | size_t formatByteStride(const Ctr::PixelFormat& format); 54 | DXGI_FORMAT findTypelessFormat(const Ctr::PixelFormat& format); 55 | size_t bitsPerPixel(DXGI_FORMAT fmt); 56 | } 57 | 58 | #endif -------------------------------------------------------------------------------- /nodes/CtrRenderTargetQuad.h: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------------// 2 | // // 3 | // _________ .__ __ __ // 4 | // \_ ___ \_______|__|/ |__/ |_ ___________ // 5 | // / \ \/\_ __ \ \ __\ __\/ __ \_ __ \ // 6 | // \ \____| | \/ || | | | \ ___/| | \/ // 7 | // \______ /|__| |__||__| |__| \___ >__| // 8 | // \/ \/ // 9 | // // 10 | // Critter is provided under the MIT License(MIT) // 11 | // Critter uses portions of other open source software. // 12 | // Please review the LICENSE file for further details. // 13 | // // 14 | // Copyright(c) 2015 Matt Davidson // 15 | // // 16 | // Permission is hereby granted, free of charge, to any person obtaining a copy // 17 | // of this software and associated documentation files(the "Software"), to deal // 18 | // in the Software without restriction, including without limitation the rights // 19 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell // 20 | // copies of the Software, and to permit persons to whom the Software is // 21 | // furnished to do so, subject to the following conditions : // 22 | // // 23 | // 1. Redistributions of source code must retain the above copyright notice, // 24 | // this list of conditions and the following disclaimer. // 25 | // 2. Redistributions in binary form must reproduce the above copyright notice, // 26 | // this list of conditions and the following disclaimer in the // 27 | // documentation and / or other materials provided with the distribution. // 28 | // 3. Neither the name of the copyright holder nor the names of its // 29 | // contributors may be used to endorse or promote products derived // 30 | // from this software without specific prior written permission. // 31 | // // 32 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // 33 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // 34 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE // 35 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // 36 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // 37 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // 38 | // THE SOFTWARE. // 39 | // // 40 | //------------------------------------------------------------------------------------// 41 | #ifndef INCLUDED_CRT_RENDERTARGETQUAD 42 | #define INCLUDED_CRT_RENDERTARGETQUAD 43 | 44 | #include 45 | #include 46 | #include 47 | 48 | namespace Ctr 49 | { 50 | class RenderTargetQuad : public IndexedMesh 51 | { 52 | public: 53 | RenderTargetQuad(Ctr::IDevice* device); 54 | virtual ~RenderTargetQuad(); 55 | 56 | bool initialize(const Ctr::Region2f&); 57 | 58 | private: 59 | Ctr::Region2f _screenLocation; 60 | Ctr::VertexStream* _positionStream; 61 | Ctr::VertexStream* _texCoordStream; 62 | }; 63 | } 64 | 65 | #endif -------------------------------------------------------------------------------- /input/CtrInputManager.h: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------------// 2 | // // 3 | // _________ .__ __ __ // 4 | // \_ ___ \_______|__|/ |__/ |_ ___________ // 5 | // / \ \/\_ __ \ \ __\ __\/ __ \_ __ \ // 6 | // \ \____| | \/ || | | | \ ___/| | \/ // 7 | // \______ /|__| |__||__| |__| \___ >__| // 8 | // \/ \/ // 9 | // // 10 | // Critter is provided under the MIT License(MIT) // 11 | // Critter uses portions of other open source software. // 12 | // Please review the LICENSE file for further details. // 13 | // // 14 | // Copyright(c) 2015 Matt Davidson // 15 | // // 16 | // Permission is hereby granted, free of charge, to any person obtaining a copy // 17 | // of this software and associated documentation files(the "Software"), to deal // 18 | // in the Software without restriction, including without limitation the rights // 19 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell // 20 | // copies of the Software, and to permit persons to whom the Software is // 21 | // furnished to do so, subject to the following conditions : // 22 | // // 23 | // 1. Redistributions of source code must retain the above copyright notice, // 24 | // this list of conditions and the following disclaimer. // 25 | // 2. Redistributions in binary form must reproduce the above copyright notice, // 26 | // this list of conditions and the following disclaimer in the // 27 | // documentation and / or other materials provided with the distribution. // 28 | // 3. Neither the name of the copyright holder nor the names of its // 29 | // contributors may be used to endorse or promote products derived // 30 | // from this software without specific prior written permission. // 31 | // // 32 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // 33 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // 34 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE // 35 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // 36 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // 37 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // 38 | // THE SOFTWARE. // 39 | // // 40 | //------------------------------------------------------------------------------------// 41 | 42 | #ifndef BB_INPUT_MANAGER 43 | #define BB_INPUT_MANAGER 44 | 45 | #include 46 | #include 47 | namespace Ctr 48 | { 49 | class Application; 50 | 51 | class InputManager 52 | { 53 | public: 54 | InputManager(Ctr::Application*); 55 | virtual ~InputManager(); 56 | 57 | virtual bool create (); 58 | virtual bool update(); 59 | 60 | InputState* inputState(); 61 | 62 | static InputManager* mgr(); 63 | Input& input(); 64 | 65 | private: 66 | Input _input; 67 | Application * _application; 68 | }; 69 | } 70 | 71 | #endif 72 | -------------------------------------------------------------------------------- /rendererD3D11/CtrBackbufferSurfaceD3D11.h: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------------// 2 | // // 3 | // _________ .__ __ __ // 4 | // \_ ___ \_______|__|/ |__/ |_ ___________ // 5 | // / \ \/\_ __ \ \ __\ __\/ __ \_ __ \ // 6 | // \ \____| | \/ || | | | \ ___/| | \/ // 7 | // \______ /|__| |__||__| |__| \___ >__| // 8 | // \/ \/ // 9 | // // 10 | // Critter is provided under the MIT License(MIT) // 11 | // Critter uses portions of other open source software. // 12 | // Please review the LICENSE file for further details. // 13 | // // 14 | // Copyright(c) 2015 Matt Davidson // 15 | // // 16 | // Permission is hereby granted, free of charge, to any person obtaining a copy // 17 | // of this software and associated documentation files(the "Software"), to deal // 18 | // in the Software without restriction, including without limitation the rights // 19 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell // 20 | // copies of the Software, and to permit persons to whom the Software is // 21 | // furnished to do so, subject to the following conditions : // 22 | // // 23 | // 1. Redistributions of source code must retain the above copyright notice, // 24 | // this list of conditions and the following disclaimer. // 25 | // 2. Redistributions in binary form must reproduce the above copyright notice, // 26 | // this list of conditions and the following disclaimer in the // 27 | // documentation and / or other materials provided with the distribution. // 28 | // 3. Neither the name of the copyright holder nor the names of its // 29 | // contributors may be used to endorse or promote products derived // 30 | // from this software without specific prior written permission. // 31 | // // 32 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // 33 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // 34 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE // 35 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // 36 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // 37 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // 38 | // THE SOFTWARE. // 39 | // // 40 | //------------------------------------------------------------------------------------// 41 | 42 | #ifndef INCLUDED_CRT_BACKBUFFER_SURFACE_D3D11 43 | #define INCLUDED_CRT_BACKBUFFER_SURFACE_D3D11 44 | 45 | #include 46 | #include 47 | 48 | namespace Ctr 49 | { 50 | class ITexture; 51 | class BackbufferSurfaceD3D11 : public SurfaceD3D11 52 | { 53 | public: 54 | BackbufferSurfaceD3D11(Ctr::IDevice* device, IDXGISwapChain* swapChain); 55 | virtual ~BackbufferSurfaceD3D11(); 56 | 57 | virtual bool create(); 58 | virtual bool free(); 59 | virtual bool recreateOnResize(); 60 | 61 | private: 62 | IDXGISwapChain* _swapChain; 63 | }; 64 | 65 | } 66 | 67 | #endif -------------------------------------------------------------------------------- /input/CtrX360Controller.h: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------------// 2 | // // 3 | // _________ .__ __ __ // 4 | // \_ ___ \_______|__|/ |__/ |_ ___________ // 5 | // / \ \/\_ __ \ \ __\ __\/ __ \_ __ \ // 6 | // \ \____| | \/ || | | | \ ___/| | \/ // 7 | // \______ /|__| |__||__| |__| \___ >__| // 8 | // \/ \/ // 9 | // // 10 | // Critter is provided under the MIT License(MIT) // 11 | // Critter uses portions of other open source software. // 12 | // Please review the LICENSE file for further details. // 13 | // // 14 | // Copyright(c) 2015 Matt Davidson // 15 | // // 16 | // Permission is hereby granted, free of charge, to any person obtaining a copy // 17 | // of this software and associated documentation files(the "Software"), to deal // 18 | // in the Software without restriction, including without limitation the rights // 19 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell // 20 | // copies of the Software, and to permit persons to whom the Software is // 21 | // furnished to do so, subject to the following conditions : // 22 | // // 23 | // 1. Redistributions of source code must retain the above copyright notice, // 24 | // this list of conditions and the following disclaimer. // 25 | // 2. Redistributions in binary form must reproduce the above copyright notice, // 26 | // this list of conditions and the following disclaimer in the // 27 | // documentation and / or other materials provided with the distribution. // 28 | // 3. Neither the name of the copyright holder nor the names of its // 29 | // contributors may be used to endorse or promote products derived // 30 | // from this software without specific prior written permission. // 31 | // // 32 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // 33 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // 34 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE // 35 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // 36 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // 37 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // 38 | // THE SOFTWARE. // 39 | // // 40 | //------------------------------------------------------------------------------------// 41 | 42 | #ifndef INCLUDED_CRT_X360_CONTROLLER 43 | #define INCLUDED_CRT_X360_CONTROLLER 44 | 45 | #include 46 | #include 47 | 48 | #define MAX_THUMBSTICK 32768; 49 | 50 | namespace Ctr 51 | { 52 | class InputState; 53 | 54 | class X360Controller 55 | { 56 | public: 57 | X360Controller(); 58 | virtual ~X360Controller(); 59 | 60 | bool create(Ctr::InputState* state); 61 | bool update(); 62 | 63 | void setMotorSpeeds (uint32_t gamePadIndex, float left, float right); 64 | 65 | protected: 66 | InputState* _inputState; 67 | XINPUT_STATE _currentInputState; 68 | }; 69 | } 70 | 71 | #endif -------------------------------------------------------------------------------- /renderAPI/CtrRenderRequest.h: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------------// 2 | // // 3 | // _________ .__ __ __ // 4 | // \_ ___ \_______|__|/ |__/ |_ ___________ // 5 | // / \ \/\_ __ \ \ __\ __\/ __ \_ __ \ // 6 | // \ \____| | \/ || | | | \ ___/| | \/ // 7 | // \______ /|__| |__||__| |__| \___ >__| // 8 | // \/ \/ // 9 | // // 10 | // Critter is provided under the MIT License(MIT) // 11 | // Critter uses portions of other open source software. // 12 | // Please review the LICENSE file for further details. // 13 | // // 14 | // Copyright(c) 2015 Matt Davidson // 15 | // // 16 | // Permission is hereby granted, free of charge, to any person obtaining a copy // 17 | // of this software and associated documentation files(the "Software"), to deal // 18 | // in the Software without restriction, including without limitation the rights // 19 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell // 20 | // copies of the Software, and to permit persons to whom the Software is // 21 | // furnished to do so, subject to the following conditions : // 22 | // // 23 | // 1. Redistributions of source code must retain the above copyright notice, // 24 | // this list of conditions and the following disclaimer. // 25 | // 2. Redistributions in binary form must reproduce the above copyright notice, // 26 | // this list of conditions and the following disclaimer in the // 27 | // documentation and / or other materials provided with the distribution. // 28 | // 3. Neither the name of the copyright holder nor the names of its // 29 | // contributors may be used to endorse or promote products derived // 30 | // from this software without specific prior written permission. // 31 | // // 32 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // 33 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // 34 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE // 35 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // 36 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // 37 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // 38 | // THE SOFTWARE. // 39 | // // 40 | //------------------------------------------------------------------------------------// 41 | #ifndef INCLUDED_CRT_RENDER_REQUEST 42 | #define INCLUDED_CRT_RENDER_REQUEST 43 | 44 | #include 45 | 46 | namespace Ctr 47 | { 48 | class GpuTechnique; 49 | class Scene; 50 | class Camera; 51 | class Mesh; 52 | class Material; 53 | 54 | class 55 | RenderRequest 56 | { 57 | public: 58 | RenderRequest(); 59 | RenderRequest(const Ctr::GpuTechnique* techniqueIn, const Ctr::Scene* scene, const Ctr::Camera* cameraIn, const Ctr::Mesh* meshIn); 60 | 61 | const Ctr::GpuTechnique* technique; 62 | const Ctr::Camera* camera; 63 | const Ctr::Mesh* mesh; 64 | const Ctr::Material* material; 65 | const Ctr::Scene* scene; 66 | 67 | }; 68 | 69 | } 70 | 71 | 72 | #endif 73 | -------------------------------------------------------------------------------- /renderAPI/CtrScreenOrientedQuad.h: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------------// 2 | // // 3 | // _________ .__ __ __ // 4 | // \_ ___ \_______|__|/ |__/ |_ ___________ // 5 | // / \ \/\_ __ \ \ __\ __\/ __ \_ __ \ // 6 | // \ \____| | \/ || | | | \ ___/| | \/ // 7 | // \______ /|__| |__||__| |__| \___ >__| // 8 | // \/ \/ // 9 | // // 10 | // Critter is provided under the MIT License(MIT) // 11 | // Critter uses portions of other open source software. // 12 | // Please review the LICENSE file for further details. // 13 | // // 14 | // Copyright(c) 2015 Matt Davidson // 15 | // // 16 | // Permission is hereby granted, free of charge, to any person obtaining a copy // 17 | // of this software and associated documentation files(the "Software"), to deal // 18 | // in the Software without restriction, including without limitation the rights // 19 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell // 20 | // copies of the Software, and to permit persons to whom the Software is // 21 | // furnished to do so, subject to the following conditions : // 22 | // // 23 | // 1. Redistributions of source code must retain the above copyright notice, // 24 | // this list of conditions and the following disclaimer. // 25 | // 2. Redistributions in binary form must reproduce the above copyright notice, // 26 | // this list of conditions and the following disclaimer in the // 27 | // documentation and / or other materials provided with the distribution. // 28 | // 3. Neither the name of the copyright holder nor the names of its // 29 | // contributors may be used to endorse or promote products derived // 30 | // from this software without specific prior written permission. // 31 | // // 32 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // 33 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // 34 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE // 35 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // 36 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // 37 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // 38 | // THE SOFTWARE. // 39 | // // 40 | //------------------------------------------------------------------------------------// 41 | #ifndef INCLUDED_CRT_SCREENORIENTEDQUAD 42 | #define INCLUDED_CRT_SCREENORIENTEDQUAD 43 | 44 | #include 45 | #include 46 | #include 47 | 48 | namespace Ctr 49 | { 50 | class ScreenOrientedQuad : public StreamedMesh 51 | { 52 | public: 53 | ScreenOrientedQuad(Ctr::IDevice* device); 54 | virtual ~ScreenOrientedQuad(); 55 | 56 | bool initialize(const Ctr::Region2f&, bool background = false); 57 | virtual bool create(); 58 | 59 | private: 60 | Ctr::Region2f _screenLocation; 61 | Ctr::VertexStream* _positionStream; 62 | Ctr::VertexStream* _texCoordStream; 63 | }; 64 | } 65 | 66 | #endif -------------------------------------------------------------------------------- /application/CtrApplication.cpp: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------------// 2 | // // 3 | // _____ _________ .__ .__ // 4 | // / \_______/ _____/_ _ _|__|______________| | ____ // 5 | // / \ / \_ __ \_____ \\ \/ \/ / \___ /\___ / | _/ __ \ // 6 | // / Y \ | \/ \\ /| |/ / / /| |_\ ___/ // 7 | // \____|__ /__| /_______ / \/\_/ |__/_____ \/_____ \____/\___ > // 8 | // \/ \/ \/ \/ \/ // 9 | // // 10 | // MrSwizzle is provided under the MIT License(MIT) // 11 | // MrSwizzle uses portions of other open source software. // 12 | // Please review the LICENSE file for further details. // 13 | // // 14 | // Copyright(c) 2015 Matt Davidson // 15 | // // 16 | // Permission is hereby granted, free of charge, to any person obtaining a copy // 17 | // of this software and associated documentation files(the "Software"), to deal // 18 | // in the Software without restriction, including without limitation the rights // 19 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell // 20 | // copies of the Software, and to permit persons to whom the Software is // 21 | // furnished to do so, subject to the following conditions : // 22 | // // 23 | // 1. Redistributions of source code must retain the above copyright notice, // 24 | // this list of conditions and the following disclaimer. // 25 | // 2. Redistributions in binary form must reproduce the above copyright notice, // 26 | // this list of conditions and the following disclaimer in the // 27 | // documentation and / or other materials provided with the distribution. // 28 | // 3. Neither the name of the copyright holder nor the names of its // 29 | // contributors may be used to endorse or promote products derived // 30 | // from this software without specific prior written permission. // 31 | // // 32 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // 33 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // 34 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE // 35 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // 36 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // 37 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // 38 | // THE SOFTWARE. // 39 | // // 40 | //------------------------------------------------------------------------------------// 41 | 42 | #include 43 | #include 44 | 45 | namespace Ctr 46 | { 47 | Application::Application(ApplicationHandle instance) : 48 | Node(), 49 | _instance (instance), 50 | _mainWindow(nullptr), 51 | _device(nullptr) 52 | { 53 | #ifdef _DEBUG 54 | assert (_instance); 55 | #endif 56 | } 57 | 58 | Application::~Application() 59 | { 60 | _instance = nullptr; 61 | safedelete(_device); 62 | } 63 | 64 | ApplicationHandle 65 | Application::instance() const 66 | { 67 | return _instance; 68 | } 69 | 70 | Window* 71 | Application::window() 72 | { 73 | return _mainWindow; 74 | } 75 | 76 | const Window* 77 | Application::window() const 78 | { 79 | return _mainWindow; 80 | } 81 | 82 | } -------------------------------------------------------------------------------- /nodes/CtrRenderNode.h: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------------// 2 | // // 3 | // _________ .__ __ __ // 4 | // \_ ___ \_______|__|/ |__/ |_ ___________ // 5 | // / \ \/\_ __ \ \ __\ __\/ __ \_ __ \ // 6 | // \ \____| | \/ || | | | \ ___/| | \/ // 7 | // \______ /|__| |__||__| |__| \___ >__| // 8 | // \/ \/ // 9 | // // 10 | // Critter is provided under the MIT License(MIT) // 11 | // Critter uses portions of other open source software. // 12 | // Please review the LICENSE file for further details. // 13 | // // 14 | // Copyright(c) 2015 Matt Davidson // 15 | // // 16 | // Permission is hereby granted, free of charge, to any person obtaining a copy // 17 | // of this software and associated documentation files(the "Software"), to deal // 18 | // in the Software without restriction, including without limitation the rights // 19 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell // 20 | // copies of the Software, and to permit persons to whom the Software is // 21 | // furnished to do so, subject to the following conditions : // 22 | // // 23 | // 1. Redistributions of source code must retain the above copyright notice, // 24 | // this list of conditions and the following disclaimer. // 25 | // 2. Redistributions in binary form must reproduce the above copyright notice, // 26 | // this list of conditions and the following disclaimer in the // 27 | // documentation and / or other materials provided with the distribution. // 28 | // 3. Neither the name of the copyright holder nor the names of its // 29 | // contributors may be used to endorse or promote products derived // 30 | // from this software without specific prior written permission. // 31 | // // 32 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // 33 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // 34 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE // 35 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // 36 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // 37 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // 38 | // THE SOFTWARE. // 39 | // // 40 | //------------------------------------------------------------------------------------// 41 | #ifndef BB_RENDER_NODE 42 | #define BB_RENDER_NODE 43 | 44 | #include 45 | #include 46 | #include 47 | #include 48 | 49 | namespace Ctr 50 | { 51 | class RenderNode : public Node 52 | { 53 | public: 54 | RenderNode(Ctr::IDevice* device); 55 | virtual ~RenderNode(); 56 | 57 | virtual bool free() {return true;} 58 | virtual bool create() {return true;} 59 | virtual bool cache() {return true;} 60 | 61 | const Ctr::IDevice* device() const { return _device; } 62 | Ctr::IDevice* device() { return _device; } 63 | 64 | protected: 65 | Ctr::IDevice* _device; 66 | }; 67 | } 68 | 69 | #endif 70 | -------------------------------------------------------------------------------- /nodes/CtrEntity.cpp: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------------// 2 | // // 3 | // _________ .__ __ __ // 4 | // \_ ___ \_______|__|/ |__/ |_ ___________ // 5 | // / \ \/\_ __ \ \ __\ __\/ __ \_ __ \ // 6 | // \ \____| | \/ || | | | \ ___/| | \/ // 7 | // \______ /|__| |__||__| |__| \___ >__| // 8 | // \/ \/ // 9 | // // 10 | // Critter is provided under the MIT License(MIT) // 11 | // Critter uses portions of other open source software. // 12 | // Please review the LICENSE file for further details. // 13 | // // 14 | // Copyright(c) 2015 Matt Davidson // 15 | // // 16 | // Permission is hereby granted, free of charge, to any person obtaining a copy // 17 | // of this software and associated documentation files(the "Software"), to deal // 18 | // in the Software without restriction, including without limitation the rights // 19 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell // 20 | // copies of the Software, and to permit persons to whom the Software is // 21 | // furnished to do so, subject to the following conditions : // 22 | // // 23 | // 1. Redistributions of source code must retain the above copyright notice, // 24 | // this list of conditions and the following disclaimer. // 25 | // 2. Redistributions in binary form must reproduce the above copyright notice, // 26 | // this list of conditions and the following disclaimer in the // 27 | // documentation and / or other materials provided with the distribution. // 28 | // 3. Neither the name of the copyright holder nor the names of its // 29 | // contributors may be used to endorse or promote products derived // 30 | // from this software without specific prior written permission. // 31 | // // 32 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // 33 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // 34 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE // 35 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // 36 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // 37 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // 38 | // THE SOFTWARE. // 39 | // // 40 | //------------------------------------------------------------------------------------// 41 | 42 | #include 43 | 44 | namespace Ctr 45 | { 46 | Entity::Entity(Ctr::IDevice* device) : 47 | RenderNode(device) 48 | { 49 | } 50 | 51 | Entity::~Entity() 52 | { 53 | for (auto it = _meshes.begin(); it != _meshes.end(); it++) 54 | { 55 | delete *it; 56 | } 57 | _meshes.clear(); 58 | } 59 | 60 | void 61 | Entity::addMesh(Mesh* mesh) 62 | { 63 | // Resolve should probably go here. 64 | _meshes.push_back(mesh); 65 | } 66 | 67 | const std::vector& 68 | Entity::meshes() const 69 | { 70 | return _meshes; 71 | } 72 | 73 | Mesh* 74 | Entity::mesh(size_t index) 75 | { 76 | return _meshes[index]; 77 | } 78 | 79 | size_t 80 | Entity::numMeshes() const 81 | { 82 | return _meshes.size(); 83 | } 84 | 85 | } 86 | 87 | -------------------------------------------------------------------------------- /rendererD3D11/CtrEffectD3D11.h: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------------// 2 | // // 3 | // _________ .__ __ __ // 4 | // \_ ___ \_______|__|/ |__/ |_ ___________ // 5 | // / \ \/\_ __ \ \ __\ __\/ __ \_ __ \ // 6 | // \ \____| | \/ || | | | \ ___/| | \/ // 7 | // \______ /|__| |__||__| |__| \___ >__| // 8 | // \/ \/ // 9 | // // 10 | // Critter is provided under the MIT License(MIT) // 11 | // Critter uses portions of other open source software. // 12 | // Please review the LICENSE file for further details. // 13 | // // 14 | // Copyright(c) 2015 Matt Davidson // 15 | // // 16 | // Permission is hereby granted, free of charge, to any person obtaining a copy // 17 | // of this software and associated documentation files(the "Software"), to deal // 18 | // in the Software without restriction, including without limitation the rights // 19 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell // 20 | // copies of the Software, and to permit persons to whom the Software is // 21 | // furnished to do so, subject to the following conditions : // 22 | // // 23 | // 1. Redistributions of source code must retain the above copyright notice, // 24 | // this list of conditions and the following disclaimer. // 25 | // 2. Redistributions in binary form must reproduce the above copyright notice, // 26 | // this list of conditions and the following disclaimer in the // 27 | // documentation and / or other materials provided with the distribution. // 28 | // 3. Neither the name of the copyright holder nor the names of its // 29 | // contributors may be used to endorse or promote products derived // 30 | // from this software without specific prior written permission. // 31 | // // 32 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // 33 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // 34 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE // 35 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // 36 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // 37 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // 38 | // THE SOFTWARE. // 39 | // // 40 | //------------------------------------------------------------------------------------// 41 | 42 | #ifndef INCLUDED_CRT_EFFECT_D3D11 43 | #define INCLUDED_CRT_EFFECT_D3D11 44 | 45 | #include 46 | #include 47 | #include 48 | #include 49 | #include 50 | 51 | namespace Ctr 52 | { 53 | class EffectD3D11 : public Ctr::IEffect 54 | { 55 | public: 56 | 57 | EffectD3D11 (ID3DX11Effect* effect); 58 | virtual ~EffectD3D11(); 59 | 60 | const ID3DX11Effect* effect() const; 61 | ID3DX11Effect* effect(); 62 | 63 | virtual bool free(); 64 | virtual bool create(); 65 | virtual bool cache(); 66 | 67 | private: 68 | ID3DX11Effect* _effect; 69 | }; 70 | } 71 | 72 | #endif -------------------------------------------------------------------------------- /input/CtrFocusedInput.h: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------------// 2 | // // 3 | // _________ .__ __ __ // 4 | // \_ ___ \_______|__|/ |__/ |_ ___________ // 5 | // / \ \/\_ __ \ \ __\ __\/ __ \_ __ \ // 6 | // \ \____| | \/ || | | | \ ___/| | \/ // 7 | // \______ /|__| |__||__| |__| \___ >__| // 8 | // \/ \/ // 9 | // // 10 | // Critter is provided under the MIT License(MIT) // 11 | // Critter uses portions of other open source software. // 12 | // Please review the LICENSE file for further details. // 13 | // // 14 | // Copyright(c) 2015 Matt Davidson // 15 | // // 16 | // Permission is hereby granted, free of charge, to any person obtaining a copy // 17 | // of this software and associated documentation files(the "Software"), to deal // 18 | // in the Software without restriction, including without limitation the rights // 19 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell // 20 | // copies of the Software, and to permit persons to whom the Software is // 21 | // furnished to do so, subject to the following conditions : // 22 | // // 23 | // 1. Redistributions of source code must retain the above copyright notice, // 24 | // this list of conditions and the following disclaimer. // 25 | // 2. Redistributions in binary form must reproduce the above copyright notice, // 26 | // this list of conditions and the following disclaimer in the // 27 | // documentation and / or other materials provided with the distribution. // 28 | // 3. Neither the name of the copyright holder nor the names of its // 29 | // contributors may be used to endorse or promote products derived // 30 | // from this software without specific prior written permission. // 31 | // // 32 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // 33 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // 34 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE // 35 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // 36 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // 37 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // 38 | // THE SOFTWARE. // 39 | // // 40 | //------------------------------------------------------------------------------------// 41 | 42 | #ifndef INCLUDED_FOCUSED_INPUT_HANDLER 43 | #define INCLUDED_FOCUSED_INPUT_HANDLER 44 | 45 | #include 46 | #include 47 | #include 48 | 49 | namespace Ctr 50 | { 51 | class FocusedInput 52 | { 53 | public: 54 | FocusedInput (Ctr::InputState* pState); 55 | ~FocusedInput(); 56 | 57 | public: 58 | bool update (float fElapsedTime, 59 | Ctr::Vector3f& translation, 60 | Ctr::Vector3f& rotate, 61 | bool& updatecamerainput); 62 | private: 63 | Ctr::InputState* _inputState; 64 | float _distancePerSecond; 65 | 66 | }; 67 | } 68 | 69 | #endif -------------------------------------------------------------------------------- /rendererD3D11/CtrRenderWindowD3D11.h: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------------// 2 | // // 3 | // _________ .__ __ __ // 4 | // \_ ___ \_______|__|/ |__/ |_ ___________ // 5 | // / \ \/\_ __ \ \ __\ __\/ __ \_ __ \ // 6 | // \ \____| | \/ || | | | \ ___/| | \/ // 7 | // \______ /|__| |__||__| |__| \___ >__| // 8 | // \/ \/ // 9 | // // 10 | // Critter is provided under the MIT License(MIT) // 11 | // Critter uses portions of other open source software. // 12 | // Please review the LICENSE file for further details. // 13 | // // 14 | // Copyright(c) 2015 Matt Davidson // 15 | // // 16 | // Permission is hereby granted, free of charge, to any person obtaining a copy // 17 | // of this software and associated documentation files(the "Software"), to deal // 18 | // in the Software without restriction, including without limitation the rights // 19 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell // 20 | // copies of the Software, and to permit persons to whom the Software is // 21 | // furnished to do so, subject to the following conditions : // 22 | // // 23 | // 1. Redistributions of source code must retain the above copyright notice, // 24 | // this list of conditions and the following disclaimer. // 25 | // 2. Redistributions in binary form must reproduce the above copyright notice, // 26 | // this list of conditions and the following disclaimer in the // 27 | // documentation and / or other materials provided with the distribution. // 28 | // 3. Neither the name of the copyright holder nor the names of its // 29 | // contributors may be used to endorse or promote products derived // 30 | // from this software without specific prior written permission. // 31 | // // 32 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // 33 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // 34 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE // 35 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // 36 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // 37 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // 38 | // THE SOFTWARE. // 39 | // // 40 | //------------------------------------------------------------------------------------// 41 | 42 | #ifndef BB_RENDER_WINDOW_D3D11 43 | #define BB_RENDER_WINDOW_D3D11 44 | 45 | #include 46 | 47 | namespace Ctr 48 | { 49 | class DeviceD3D11; 50 | 51 | class RenderWindowD3D11 : public Ctr::RenderWindow 52 | { 53 | public: 54 | RenderWindowD3D11 (const Ctr::Application*, 55 | Ctr::DeviceD3D11* device); 56 | virtual ~RenderWindowD3D11(); 57 | 58 | protected: 59 | 60 | virtual void handleSizeChanged(); 61 | 62 | virtual LRESULT callback (HWND window, 63 | UINT msg, 64 | WPARAM wParam, 65 | LPARAM lParam); 66 | private: 67 | Ctr::DeviceD3D11* _device; 68 | }; 69 | } 70 | 71 | #endif -------------------------------------------------------------------------------- /renderAPI/CtrIIndexBuffer.h: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------------// 2 | // // 3 | // _________ .__ __ __ // 4 | // \_ ___ \_______|__|/ |__/ |_ ___________ // 5 | // / \ \/\_ __ \ \ __\ __\/ __ \_ __ \ // 6 | // \ \____| | \/ || | | | \ ___/| | \/ // 7 | // \______ /|__| |__||__| |__| \___ >__| // 8 | // \/ \/ // 9 | // // 10 | // Critter is provided under the MIT License(MIT) // 11 | // Critter uses portions of other open source software. // 12 | // Please review the LICENSE file for further details. // 13 | // // 14 | // Copyright(c) 2015 Matt Davidson // 15 | // // 16 | // Permission is hereby granted, free of charge, to any person obtaining a copy // 17 | // of this software and associated documentation files(the "Software"), to deal // 18 | // in the Software without restriction, including without limitation the rights // 19 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell // 20 | // copies of the Software, and to permit persons to whom the Software is // 21 | // furnished to do so, subject to the following conditions : // 22 | // // 23 | // 1. Redistributions of source code must retain the above copyright notice, // 24 | // this list of conditions and the following disclaimer. // 25 | // 2. Redistributions in binary form must reproduce the above copyright notice, // 26 | // this list of conditions and the following disclaimer in the // 27 | // documentation and / or other materials provided with the distribution. // 28 | // 3. Neither the name of the copyright holder nor the names of its // 29 | // contributors may be used to endorse or promote products derived // 30 | // from this software without specific prior written permission. // 31 | // // 32 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // 33 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // 34 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE // 35 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // 36 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // 37 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // 38 | // THE SOFTWARE. // 39 | // // 40 | //------------------------------------------------------------------------------------// 41 | #ifndef INCLUDED_CRT_INDEXBUFFER_INTERFACE_ 42 | #define INCLUDED_CRT_INDEXBUFFER_INTERFACE_ 43 | 44 | #include 45 | #include 46 | 47 | namespace Ctr 48 | { 49 | class IEffect; 50 | class IVertexDeclaration; 51 | 52 | class IIndexBuffer : public IRenderResource 53 | { 54 | public: 55 | IIndexBuffer (Ctr::IDevice* device); 56 | virtual ~IIndexBuffer(); 57 | 58 | virtual bool initialize (const IndexBufferParameters* data) = 0; 59 | virtual bool create() = 0; 60 | virtual bool free() = 0; 61 | virtual bool bind(uint32_t bufferOffset = 0) const = 0; 62 | 63 | virtual void* lock(size_t size = 0) = 0; 64 | virtual bool unlock() = 0; 65 | }; 66 | } 67 | 68 | 69 | #endif -------------------------------------------------------------------------------- /rendererD3D11/CtrRenderWindowD3D11.cpp: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------------// 2 | // // 3 | // _________ .__ __ __ // 4 | // \_ ___ \_______|__|/ |__/ |_ ___________ // 5 | // / \ \/\_ __ \ \ __\ __\/ __ \_ __ \ // 6 | // \ \____| | \/ || | | | \ ___/| | \/ // 7 | // \______ /|__| |__||__| |__| \___ >__| // 8 | // \/ \/ // 9 | // // 10 | // Critter is provided under the MIT License(MIT) // 11 | // Critter uses portions of other open source software. // 12 | // Please review the LICENSE file for further details. // 13 | // // 14 | // Copyright(c) 2015 Matt Davidson // 15 | // // 16 | // Permission is hereby granted, free of charge, to any person obtaining a copy // 17 | // of this software and associated documentation files(the "Software"), to deal // 18 | // in the Software without restriction, including without limitation the rights // 19 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell // 20 | // copies of the Software, and to permit persons to whom the Software is // 21 | // furnished to do so, subject to the following conditions : // 22 | // // 23 | // 1. Redistributions of source code must retain the above copyright notice, // 24 | // this list of conditions and the following disclaimer. // 25 | // 2. Redistributions in binary form must reproduce the above copyright notice, // 26 | // this list of conditions and the following disclaimer in the // 27 | // documentation and / or other materials provided with the distribution. // 28 | // 3. Neither the name of the copyright holder nor the names of its // 29 | // contributors may be used to endorse or promote products derived // 30 | // from this software without specific prior written permission. // 31 | // // 32 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // 33 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // 34 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE // 35 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // 36 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // 37 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // 38 | // THE SOFTWARE. // 39 | // // 40 | //------------------------------------------------------------------------------------// 41 | 42 | #include 43 | #include 44 | #include 45 | 46 | namespace Ctr 47 | { 48 | 49 | RenderWindowD3D11::RenderWindowD3D11 (const Ctr::Application* application, 50 | Ctr::DeviceD3D11* device) : 51 | RenderWindow (application), 52 | _device (device) 53 | { 54 | } 55 | 56 | RenderWindowD3D11::~RenderWindowD3D11() 57 | { 58 | } 59 | 60 | void 61 | RenderWindowD3D11::handleSizeChanged() 62 | { 63 | _device->resizeDevice (clientRect().size()); 64 | } 65 | 66 | LRESULT 67 | RenderWindowD3D11::callback (HWND window, 68 | UINT msg, 69 | WPARAM wParam, 70 | LPARAM lParam) 71 | { 72 | return RenderWindow::callback (window, msg, wParam, lParam); 73 | } 74 | 75 | } -------------------------------------------------------------------------------- /renderAPI/CtrShaderParameterValue.cpp: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------------// 2 | // // 3 | // _________ .__ __ __ // 4 | // \_ ___ \_______|__|/ |__/ |_ ___________ // 5 | // / \ \/\_ __ \ \ __\ __\/ __ \_ __ \ // 6 | // \ \____| | \/ || | | | \ ___/| | \/ // 7 | // \______ /|__| |__||__| |__| \___ >__| // 8 | // \/ \/ // 9 | // // 10 | // Critter is provided under the MIT License(MIT) // 11 | // Critter uses portions of other open source software. // 12 | // Please review the LICENSE file for further details. // 13 | // // 14 | // Copyright(c) 2015 Matt Davidson // 15 | // // 16 | // Permission is hereby granted, free of charge, to any person obtaining a copy // 17 | // of this software and associated documentation files(the "Software"), to deal // 18 | // in the Software without restriction, including without limitation the rights // 19 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell // 20 | // copies of the Software, and to permit persons to whom the Software is // 21 | // furnished to do so, subject to the following conditions : // 22 | // // 23 | // 1. Redistributions of source code must retain the above copyright notice, // 24 | // this list of conditions and the following disclaimer. // 25 | // 2. Redistributions in binary form must reproduce the above copyright notice, // 26 | // this list of conditions and the following disclaimer in the // 27 | // documentation and / or other materials provided with the distribution. // 28 | // 3. Neither the name of the copyright holder nor the names of its // 29 | // contributors may be used to endorse or promote products derived // 30 | // from this software without specific prior written permission. // 31 | // // 32 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // 33 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // 34 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE // 35 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // 36 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // 37 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // 38 | // THE SOFTWARE. // 39 | // // 40 | //------------------------------------------------------------------------------------// 41 | 42 | 43 | #include 44 | #include 45 | #include 46 | #include 47 | 48 | namespace Ctr 49 | { 50 | ShaderParameterValue::ShaderParameterValue (const GpuVariable* variable, 51 | Ctr::IEffect*effect) : 52 | _variable (variable), 53 | _effect (effect), 54 | _parameterScope (PerMesh), 55 | _parameterIndex (0) 56 | { 57 | } 58 | 59 | ShaderParameterValue::~ShaderParameterValue() 60 | { 61 | } 62 | 63 | ShaderParameter 64 | ShaderParameterValue::parameterType() 65 | { 66 | return _parameterType; 67 | } 68 | 69 | void 70 | ShaderParameterValue::unbind() const 71 | { _variable->unbind(); } 72 | 73 | void 74 | ShaderParameterValue::setParameterType (ShaderParameter parameterType) 75 | { 76 | _parameterType = parameterType; 77 | } 78 | 79 | } -------------------------------------------------------------------------------- /application/CtrHash.h: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------------// 2 | // // 3 | // _________ .__ __ __ // 4 | // \_ ___ \_______|__|/ |__/ |_ ___________ // 5 | // / \ \/\_ __ \ \ __\ __\/ __ \_ __ \ // 6 | // \ \____| | \/ || | | | \ ___/| | \/ // 7 | // \______ /|__| |__||__| |__| \___ >__| // 8 | // \/ \/ // 9 | // // 10 | // Critter is provided under the MIT License(MIT) // 11 | // Critter uses portions of other open source software. // 12 | // Please review the LICENSE file for further details. // 13 | // // 14 | // Copyright(c) 2015 Matt Davidson // 15 | // // 16 | // Permission is hereby granted, free of charge, to any person obtaining a copy // 17 | // of this software and associated documentation files(the "Software"), to deal // 18 | // in the Software without restriction, including without limitation the rights // 19 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell // 20 | // copies of the Software, and to permit persons to whom the Software is // 21 | // furnished to do so, subject to the following conditions : // 22 | // // 23 | // 1. Redistributions of source code must retain the above copyright notice, // 24 | // this list of conditions and the following disclaimer. // 25 | // 2. Redistributions in binary form must reproduce the above copyright notice, // 26 | // this list of conditions and the following disclaimer in the // 27 | // documentation and / or other materials provided with the distribution. // 28 | // 3. Neither the name of the copyright holder nor the names of its // 29 | // contributors may be used to endorse or promote products derived // 30 | // from this software without specific prior written permission. // 31 | // // 32 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // 33 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // 34 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE // 35 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // 36 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // 37 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // 38 | // THE SOFTWARE. // 39 | // // 40 | //------------------------------------------------------------------------------------// 41 | 42 | #ifndef INCLUDED_CRT_HASH 43 | #define INCLUDED_CRT_HASH 44 | 45 | #include 46 | 47 | namespace Ctr 48 | { 49 | class Hash 50 | { 51 | public: 52 | Hash(); 53 | Hash(const std::string&); 54 | Hash(const Hash& other); 55 | ~Hash(); 56 | 57 | bool valid() const; 58 | bool operator==(const Hash& other) const; 59 | bool operator!=(const Hash& other) const; 60 | bool operator<(const Hash& other) const; 61 | const Hash& operator=(const Hash& other); 62 | 63 | 64 | void build(const std::string& string); 65 | void build(const std::wstring& string); 66 | void append(const Hash& hash); 67 | 68 | private: 69 | static const size_t HashSize = sizeof(uint64_t)* 2; 70 | uint64_t _hash[2]; 71 | }; 72 | } 73 | 74 | #endif -------------------------------------------------------------------------------- /renderAPI/CtrFileChangeWatcher.h: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------------// 2 | // // 3 | // _________ .__ __ __ // 4 | // \_ ___ \_______|__|/ |__/ |_ ___________ // 5 | // / \ \/\_ __ \ \ __\ __\/ __ \_ __ \ // 6 | // \ \____| | \/ || | | | \ ___/| | \/ // 7 | // \______ /|__| |__||__| |__| \___ >__| // 8 | // \/ \/ // 9 | // // 10 | // Critter is provided under the MIT License(MIT) // 11 | // Critter uses portions of other open source software. // 12 | // Please review the LICENSE file for further details. // 13 | // // 14 | // Copyright(c) 2015 Matt Davidson // 15 | // // 16 | // Permission is hereby granted, free of charge, to any person obtaining a copy // 17 | // of this software and associated documentation files(the "Software"), to deal // 18 | // in the Software without restriction, including without limitation the rights // 19 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell // 20 | // copies of the Software, and to permit persons to whom the Software is // 21 | // furnished to do so, subject to the following conditions : // 22 | // // 23 | // 1. Redistributions of source code must retain the above copyright notice, // 24 | // this list of conditions and the following disclaimer. // 25 | // 2. Redistributions in binary form must reproduce the above copyright notice, // 26 | // this list of conditions and the following disclaimer in the // 27 | // documentation and / or other materials provided with the distribution. // 28 | // 3. Neither the name of the copyright holder nor the names of its // 29 | // contributors may be used to endorse or promote products derived // 30 | // from this software without specific prior written permission. // 31 | // // 32 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // 33 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // 34 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE // 35 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // 36 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // 37 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // 38 | // THE SOFTWARE. // 39 | // // 40 | //------------------------------------------------------------------------------------// 41 | #ifndef INCLUDED_FILE_CHANGE_WATCHER 42 | #define INCLUDED_FILE_CHANGE_WATCHER 43 | 44 | #include 45 | #include 46 | #include 47 | 48 | namespace Ctr 49 | { 50 | struct DIRECTORY_INFO; 51 | class FileChangeWatcher 52 | { 53 | public: 54 | FileChangeWatcher(); 55 | virtual ~FileChangeWatcher(); 56 | 57 | bool initialize(); 58 | bool hasChanges() const; 59 | std::set changeList() const; 60 | 61 | void addChange(const std::string& filename); 62 | 63 | protected: 64 | bool destroy(); 65 | 66 | protected: 67 | HANDLE _processHandle; 68 | HANDLE _processCompletionHandle; 69 | 70 | private: 71 | mutable std::set _changeList; 72 | 73 | mutable std::recursive_mutex _taskLock; 74 | DIRECTORY_INFO * _dirInfo; 75 | }; 76 | } 77 | 78 | #endif -------------------------------------------------------------------------------- /renderAPI/CtrViewport.h: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------------// 2 | // // 3 | // _________ .__ __ __ // 4 | // \_ ___ \_______|__|/ |__/ |_ ___________ // 5 | // / \ \/\_ __ \ \ __\ __\/ __ \_ __ \ // 6 | // \ \____| | \/ || | | | \ ___/| | \/ // 7 | // \______ /|__| |__||__| |__| \___ >__| // 8 | // \/ \/ // 9 | // // 10 | // Critter is provided under the MIT License(MIT) // 11 | // Critter uses portions of other open source software. // 12 | // Please review the LICENSE file for further details. // 13 | // // 14 | // Copyright(c) 2015 Matt Davidson // 15 | // // 16 | // Permission is hereby granted, free of charge, to any person obtaining a copy // 17 | // of this software and associated documentation files(the "Software"), to deal // 18 | // in the Software without restriction, including without limitation the rights // 19 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell // 20 | // copies of the Software, and to permit persons to whom the Software is // 21 | // furnished to do so, subject to the following conditions : // 22 | // // 23 | // 1. Redistributions of source code must retain the above copyright notice, // 24 | // this list of conditions and the following disclaimer. // 25 | // 2. Redistributions in binary form must reproduce the above copyright notice, // 26 | // this list of conditions and the following disclaimer in the // 27 | // documentation and / or other materials provided with the distribution. // 28 | // 3. Neither the name of the copyright holder nor the names of its // 29 | // contributors may be used to endorse or promote products derived // 30 | // from this software without specific prior written permission. // 31 | // // 32 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // 33 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // 34 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE // 35 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // 36 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // 37 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // 38 | // THE SOFTWARE. // 39 | // // 40 | //------------------------------------------------------------------------------------// 41 | 42 | #ifndef INCLUDED_CRT_VIEWPORT 43 | #define INCLUDED_CRT_VIEWPORT 44 | 45 | #include 46 | 47 | namespace Ctr 48 | { 49 | class Viewport 50 | { 51 | public: 52 | Viewport (); 53 | Viewport (float x, float Y, float width, float height, float minz, float maxz); 54 | Viewport (uint32_t x, uint32_t Y, uint32_t width, uint32_t height, float minz, float maxz); 55 | Viewport(int32_t x, int32_t Y, int32_t width, int32_t height, int32_t minz, int32_t maxz); 56 | Viewport (const Viewport&); 57 | 58 | // More for the product graph than anything. 59 | inline bool operator==(const Viewport& other) const 60 | { 61 | return memcmp(&_x, &other._x, sizeof(float) * 6) == 0; 62 | } 63 | 64 | float _x; 65 | float _y; 66 | float _width; 67 | float _height; 68 | float _minZ; 69 | float _maxZ; 70 | }; 71 | } 72 | #endif -------------------------------------------------------------------------------- /renderAPI/CtrIDepthSurface.h: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------------// 2 | // // 3 | // _________ .__ __ __ // 4 | // \_ ___ \_______|__|/ |__/ |_ ___________ // 5 | // / \ \/\_ __ \ \ __\ __\/ __ \_ __ \ // 6 | // \ \____| | \/ || | | | \ ___/| | \/ // 7 | // \______ /|__| |__||__| |__| \___ >__| // 8 | // \/ \/ // 9 | // // 10 | // Critter is provided under the MIT License(MIT) // 11 | // Critter uses portions of other open source software. // 12 | // Please review the LICENSE file for further details. // 13 | // // 14 | // Copyright(c) 2015 Matt Davidson // 15 | // // 16 | // Permission is hereby granted, free of charge, to any person obtaining a copy // 17 | // of this software and associated documentation files(the "Software"), to deal // 18 | // in the Software without restriction, including without limitation the rights // 19 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell // 20 | // copies of the Software, and to permit persons to whom the Software is // 21 | // furnished to do so, subject to the following conditions : // 22 | // // 23 | // 1. Redistributions of source code must retain the above copyright notice, // 24 | // this list of conditions and the following disclaimer. // 25 | // 2. Redistributions in binary form must reproduce the above copyright notice, // 26 | // this list of conditions and the following disclaimer in the // 27 | // documentation and / or other materials provided with the distribution. // 28 | // 3. Neither the name of the copyright holder nor the names of its // 29 | // contributors may be used to endorse or promote products derived // 30 | // from this software without specific prior written permission. // 31 | // // 32 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // 33 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // 34 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE // 35 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // 36 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // 37 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // 38 | // THE SOFTWARE. // 39 | // // 40 | //------------------------------------------------------------------------------------// 41 | #ifndef INCLUDED_CRT_DEPTHSURFACE_INTERFACE 42 | #define INCLUDED_CRT_DEPTHSURFACE_INTERFACE 43 | 44 | #include 45 | #include 46 | 47 | namespace Ctr 48 | { 49 | class IEffect; 50 | class GpuVariable; 51 | class DepthSurfaceParameters; 52 | 53 | class IDepthSurface : public IRenderResource 54 | { 55 | public: 56 | IDepthSurface (Ctr::IDevice* device); 57 | 58 | virtual ~IDepthSurface(); 59 | virtual bool initialize (const DepthSurfaceParameters*) = 0; 60 | virtual bool bind (uint32_t index) const = 0; 61 | virtual void setSize (const Ctr::Vector2i& size) = 0; 62 | virtual bool clear() = 0; 63 | virtual bool clearStencil() = 0; 64 | virtual int multiSampleCount() const = 0; 65 | virtual int multiSampleQuality() const = 0; 66 | virtual int width() const = 0; 67 | virtual int height() const = 0; 68 | }; 69 | } 70 | 71 | #endif -------------------------------------------------------------------------------- /renderAPI/CtrPresentationPolicy.cpp: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------------// 2 | // // 3 | // _________ .__ __ __ // 4 | // \_ ___ \_______|__|/ |__/ |_ ___________ // 5 | // / \ \/\_ __ \ \ __\ __\/ __ \_ __ \ // 6 | // \ \____| | \/ || | | | \ ___/| | \/ // 7 | // \______ /|__| |__||__| |__| \___ >__| // 8 | // \/ \/ // 9 | // // 10 | // Critter is provided under the MIT License(MIT) // 11 | // Critter uses portions of other open source software. // 12 | // Please review the LICENSE file for further details. // 13 | // // 14 | // Copyright(c) 2015 Matt Davidson // 15 | // // 16 | // Permission is hereby granted, free of charge, to any person obtaining a copy // 17 | // of this software and associated documentation files(the "Software"), to deal // 18 | // in the Software without restriction, including without limitation the rights // 19 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell // 20 | // copies of the Software, and to permit persons to whom the Software is // 21 | // furnished to do so, subject to the following conditions : // 22 | // // 23 | // 1. Redistributions of source code must retain the above copyright notice, // 24 | // this list of conditions and the following disclaimer. // 25 | // 2. Redistributions in binary form must reproduce the above copyright notice, // 26 | // this list of conditions and the following disclaimer in the // 27 | // documentation and / or other materials provided with the distribution. // 28 | // 3. Neither the name of the copyright holder nor the names of its // 29 | // contributors may be used to endorse or promote products derived // 30 | // from this software without specific prior written permission. // 31 | // // 32 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // 33 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // 34 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE // 35 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // 36 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // 37 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // 38 | // THE SOFTWARE. // 39 | // // 40 | //------------------------------------------------------------------------------------// 41 | #include 42 | #include 43 | #include 44 | 45 | namespace Ctr 46 | { 47 | PresentationPolicy::PresentationPolicy(Ctr::IDevice* device) : 48 | PostEffect (device) 49 | { 50 | } 51 | 52 | PresentationPolicy::~PresentationPolicy() 53 | { 54 | } 55 | 56 | 57 | 58 | bool 59 | PresentationPolicy::prepareForBackBuffer(const Camera*) 60 | { 61 | return true; 62 | } 63 | 64 | bool 65 | PresentationPolicy::syncToBackBuffer(const Camera* camera, const ISurface* surface) 66 | { 67 | const ISurface* syncSurface = nullptr; 68 | 69 | if (surface) 70 | { 71 | syncSurface = surface; 72 | } 73 | else 74 | { 75 | syncSurface = displayTargetSurface(); 76 | } 77 | 78 | _device->setNullTarget(0); 79 | 80 | _device->blitSurfaces (_device->backbuffer(), 81 | syncSurface, 82 | TEXFILTER_LINEAR); 83 | 84 | _device->backbuffer()->bind(false); 85 | 86 | return true; 87 | } 88 | 89 | } -------------------------------------------------------------------------------- /renderAPI/CtrIGpuBuffer.h: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------------// 2 | // // 3 | // _________ .__ __ __ // 4 | // \_ ___ \_______|__|/ |__/ |_ ___________ // 5 | // / \ \/\_ __ \ \ __\ __\/ __ \_ __ \ // 6 | // \ \____| | \/ || | | | \ ___/| | \/ // 7 | // \______ /|__| |__||__| |__| \___ >__| // 8 | // \/ \/ // 9 | // // 10 | // Critter is provided under the MIT License(MIT) // 11 | // Critter uses portions of other open source software. // 12 | // Please review the LICENSE file for further details. // 13 | // // 14 | // Copyright(c) 2015 Matt Davidson // 15 | // // 16 | // Permission is hereby granted, free of charge, to any person obtaining a copy // 17 | // of this software and associated documentation files(the "Software"), to deal // 18 | // in the Software without restriction, including without limitation the rights // 19 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell // 20 | // copies of the Software, and to permit persons to whom the Software is // 21 | // furnished to do so, subject to the following conditions : // 22 | // // 23 | // 1. Redistributions of source code must retain the above copyright notice, // 24 | // this list of conditions and the following disclaimer. // 25 | // 2. Redistributions in binary form must reproduce the above copyright notice, // 26 | // this list of conditions and the following disclaimer in the // 27 | // documentation and / or other materials provided with the distribution. // 28 | // 3. Neither the name of the copyright holder nor the names of its // 29 | // contributors may be used to endorse or promote products derived // 30 | // from this software without specific prior written permission. // 31 | // // 32 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // 33 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // 34 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE // 35 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // 36 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // 37 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // 38 | // THE SOFTWARE. // 39 | // // 40 | //------------------------------------------------------------------------------------// 41 | #ifndef INCLUDED_CRT_BUFFER_RESOURCE_INTERFACE 42 | #define INCLUDED_CRT_BUFFER_RESOURCE_INTERFACE 43 | 44 | #include 45 | #include 46 | 47 | namespace Ctr 48 | { 49 | class IEffect; 50 | class IVertexDeclaration; 51 | 52 | class 53 | IGpuBuffer : public IRenderResource 54 | { 55 | public: 56 | IGpuBuffer (Ctr::IDevice* device); 57 | 58 | virtual ~IGpuBuffer(); 59 | 60 | virtual bool initialize (const GpuBufferParameters* data) = 0; 61 | 62 | virtual bool create() = 0; 63 | virtual bool free() = 0; 64 | 65 | virtual void* lock() = 0; 66 | virtual bool unlock() = 0; 67 | 68 | virtual bool bind() const = 0; 69 | virtual bool bindToStreamOut() const = 0; 70 | 71 | virtual void clearUnorderedAccessViewFloat(float clearValue) = 0; 72 | virtual void clearUnorderedAccessViewUint(uint32_t clearValue) = 0; 73 | 74 | virtual size_t size() const = 0; 75 | }; 76 | } 77 | 78 | #endif -------------------------------------------------------------------------------- /input/CtrFocusedInput.cpp: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------------// 2 | // // 3 | // _________ .__ __ __ // 4 | // \_ ___ \_______|__|/ |__/ |_ ___________ // 5 | // / \ \/\_ __ \ \ __\ __\/ __ \_ __ \ // 6 | // \ \____| | \/ || | | | \ ___/| | \/ // 7 | // \______ /|__| |__||__| |__| \___ >__| // 8 | // \/ \/ // 9 | // // 10 | // Critter is provided under the MIT License(MIT) // 11 | // Critter uses portions of other open source software. // 12 | // Please review the LICENSE file for further details. // 13 | // // 14 | // Copyright(c) 2015 Matt Davidson // 15 | // // 16 | // Permission is hereby granted, free of charge, to any person obtaining a copy // 17 | // of this software and associated documentation files(the "Software"), to deal // 18 | // in the Software without restriction, including without limitation the rights // 19 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell // 20 | // copies of the Software, and to permit persons to whom the Software is // 21 | // furnished to do so, subject to the following conditions : // 22 | // // 23 | // 1. Redistributions of source code must retain the above copyright notice, // 24 | // this list of conditions and the following disclaimer. // 25 | // 2. Redistributions in binary form must reproduce the above copyright notice, // 26 | // this list of conditions and the following disclaimer in the // 27 | // documentation and / or other materials provided with the distribution. // 28 | // 3. Neither the name of the copyright holder nor the names of its // 29 | // contributors may be used to endorse or promote products derived // 30 | // from this software without specific prior written permission. // 31 | // // 32 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // 33 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // 34 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE // 35 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // 36 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // 37 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // 38 | // THE SOFTWARE. // 39 | // // 40 | //------------------------------------------------------------------------------------// 41 | 42 | #include 43 | 44 | namespace Ctr 45 | { 46 | FocusedInput::FocusedInput(Ctr::InputState* state) : 47 | _inputState(state) 48 | { 49 | } 50 | 51 | FocusedInput::~FocusedInput(void) 52 | { 53 | } 54 | 55 | bool 56 | FocusedInput::update (float elapsedTime, 57 | Ctr::Vector3f &translation, 58 | Ctr::Vector3f &rotate, 59 | bool &updatecamerainput) 60 | { 61 | Ctr::Vector3f ttrans = translation; 62 | Ctr::Vector3f trotate = rotate; 63 | 64 | if (_inputState->leftMouseDown() && !_inputState->hasGUIFocus() && !_inputState->getKeyState(DIK_LCONTROL)) 65 | { 66 | rotate += Ctr::Vector3f ( 0, ((float)-_inputState->_y), ((float)-_inputState->_x)); 67 | if (_inputState->getKeyState(DIK_UP)) 68 | translation.y += -255 * elapsedTime; 69 | 70 | if (_inputState->getKeyState(DIK_DOWN)) 71 | translation.y += 255 * elapsedTime; 72 | 73 | translation.y += 0.2f * -_inputState->_z; 74 | } 75 | 76 | return !(ttrans == translation) || !(trotate == rotate); 77 | } 78 | 79 | } -------------------------------------------------------------------------------- /renderAPI/CtrIVertexBuffer.h: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------------// 2 | // // 3 | // _________ .__ __ __ // 4 | // \_ ___ \_______|__|/ |__/ |_ ___________ // 5 | // / \ \/\_ __ \ \ __\ __\/ __ \_ __ \ // 6 | // \ \____| | \/ || | | | \ ___/| | \/ // 7 | // \______ /|__| |__||__| |__| \___ >__| // 8 | // \/ \/ // 9 | // // 10 | // Critter is provided under the MIT License(MIT) // 11 | // Critter uses portions of other open source software. // 12 | // Please review the LICENSE file for further details. // 13 | // // 14 | // Copyright(c) 2015 Matt Davidson // 15 | // // 16 | // Permission is hereby granted, free of charge, to any person obtaining a copy // 17 | // of this software and associated documentation files(the "Software"), to deal // 18 | // in the Software without restriction, including without limitation the rights // 19 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell // 20 | // copies of the Software, and to permit persons to whom the Software is // 21 | // furnished to do so, subject to the following conditions : // 22 | // // 23 | // 1. Redistributions of source code must retain the above copyright notice, // 24 | // this list of conditions and the following disclaimer. // 25 | // 2. Redistributions in binary form must reproduce the above copyright notice, // 26 | // this list of conditions and the following disclaimer in the // 27 | // documentation and / or other materials provided with the distribution. // 28 | // 3. Neither the name of the copyright holder nor the names of its // 29 | // contributors may be used to endorse or promote products derived // 30 | // from this software without specific prior written permission. // 31 | // // 32 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // 33 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // 34 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE // 35 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // 36 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // 37 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // 38 | // THE SOFTWARE. // 39 | // // 40 | //------------------------------------------------------------------------------------// 41 | 42 | #ifndef INCLUDED_CRT_VERTEXBUFFER_INTERFACE 43 | #define INCLUDED_CRT_VERTEXBUFFER_INTERFACE 44 | 45 | #include 46 | #include 47 | 48 | namespace Ctr 49 | { 50 | class IEffect; 51 | class IVertexDeclaration; 52 | 53 | class IVertexBuffer : public IRenderResource 54 | { 55 | public: 56 | IVertexBuffer (Ctr::IDevice* device); 57 | 58 | virtual ~IVertexBuffer(); 59 | 60 | virtual bool initialize (const VertexBufferParameters* data) = 0; 61 | virtual bool create() = 0; 62 | virtual bool free() = 0; 63 | 64 | virtual void* lock(size_t byteSize) = 0; 65 | virtual bool unlock() = 0; 66 | 67 | virtual void setVertexDeclaration (const IVertexDeclaration* decl); 68 | virtual bool bind(uint32_t bufferOffset = 0) const = 0; 69 | 70 | virtual bool bindToStreamOut() const; 71 | 72 | const IVertexDeclaration* vertexDeclaration() const; 73 | 74 | protected: 75 | const IVertexDeclaration* _vertexDeclaration; 76 | }; 77 | 78 | } 79 | 80 | #endif -------------------------------------------------------------------------------- /rendererD3D11/CtrRenderWindow.h: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------------// 2 | // // 3 | // _________ .__ __ __ // 4 | // \_ ___ \_______|__|/ |__/ |_ ___________ // 5 | // / \ \/\_ __ \ \ __\ __\/ __ \_ __ \ // 6 | // \ \____| | \/ || | | | \ ___/| | \/ // 7 | // \______ /|__| |__||__| |__| \___ >__| // 8 | // \/ \/ // 9 | // // 10 | // Critter is provided under the MIT License(MIT) // 11 | // Critter uses portions of other open source software. // 12 | // Please review the LICENSE file for further details. // 13 | // // 14 | // Copyright(c) 2015 Matt Davidson // 15 | // // 16 | // Permission is hereby granted, free of charge, to any person obtaining a copy // 17 | // of this software and associated documentation files(the "Software"), to deal // 18 | // in the Software without restriction, including without limitation the rights // 19 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell // 20 | // copies of the Software, and to permit persons to whom the Software is // 21 | // furnished to do so, subject to the following conditions : // 22 | // // 23 | // 1. Redistributions of source code must retain the above copyright notice, // 24 | // this list of conditions and the following disclaimer. // 25 | // 2. Redistributions in binary form must reproduce the above copyright notice, // 26 | // this list of conditions and the following disclaimer in the // 27 | // documentation and / or other materials provided with the distribution. // 28 | // 3. Neither the name of the copyright holder nor the names of its // 29 | // contributors may be used to endorse or promote products derived // 30 | // from this software without specific prior written permission. // 31 | // // 32 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // 33 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // 34 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE // 35 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // 36 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // 37 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // 38 | // THE SOFTWARE. // 39 | // // 40 | //------------------------------------------------------------------------------------// 41 | 42 | #ifndef INCLUDED_RENDER_WINDOW 43 | #define INCLUDED_RENDER_WINDOW 44 | 45 | #include 46 | #include 47 | 48 | namespace Ctr 49 | { 50 | class RenderWindow : public Window 51 | { 52 | public: 53 | RenderWindow(const Application*); 54 | virtual ~RenderWindow(); 55 | 56 | virtual bool create(const Application* application, 57 | const std::string& name, 58 | bool windowed, 59 | int width, 60 | int height, 61 | bool headless); 62 | 63 | 64 | bool rendererHasFocus() const; 65 | 66 | protected: 67 | virtual LRESULT callback (WindowHandle window, 68 | uint32_t msg, 69 | WPARAM wParam, 70 | LPARAM lParam); 71 | bool _rendererHasFocus; 72 | HBRUSH _solidBrush; 73 | }; 74 | } 75 | #endif -------------------------------------------------------------------------------- /renderAPI/CtrISurface.h: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------------// 2 | // // 3 | // _________ .__ __ __ // 4 | // \_ ___ \_______|__|/ |__/ |_ ___________ // 5 | // / \ \/\_ __ \ \ __\ __\/ __ \_ __ \ // 6 | // \ \____| | \/ || | | | \ ___/| | \/ // 7 | // \______ /|__| |__||__| |__| \___ >__| // 8 | // \/ \/ // 9 | // // 10 | // Critter is provided under the MIT License(MIT) // 11 | // Critter uses portions of other open source software. // 12 | // Please review the LICENSE file for further details. // 13 | // // 14 | // Copyright(c) 2015 Matt Davidson // 15 | // // 16 | // Permission is hereby granted, free of charge, to any person obtaining a copy // 17 | // of this software and associated documentation files(the "Software"), to deal // 18 | // in the Software without restriction, including without limitation the rights // 19 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell // 20 | // copies of the Software, and to permit persons to whom the Software is // 21 | // furnished to do so, subject to the following conditions : // 22 | // // 23 | // 1. Redistributions of source code must retain the above copyright notice, // 24 | // this list of conditions and the following disclaimer. // 25 | // 2. Redistributions in binary form must reproduce the above copyright notice, // 26 | // this list of conditions and the following disclaimer in the // 27 | // documentation and / or other materials provided with the distribution. // 28 | // 3. Neither the name of the copyright holder nor the names of its // 29 | // contributors may be used to endorse or promote products derived // 30 | // from this software without specific prior written permission. // 31 | // // 32 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // 33 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // 34 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE // 35 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // 36 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // 37 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // 38 | // THE SOFTWARE. // 39 | // // 40 | //------------------------------------------------------------------------------------// 41 | #ifndef INCLUDED_CRT_SURFACE_INTERFACE 42 | #define INCLUDED_CRT_SURFACE_INTERFACE 43 | 44 | #include 45 | #include 46 | 47 | namespace Ctr 48 | { 49 | class ITexture; 50 | class IDevice; 51 | class ISurface : public IRenderResource 52 | { 53 | public: 54 | ISurface (Ctr::IDevice* device); 55 | virtual ~ISurface(); 56 | 57 | // Initialize from the specified surface level. 58 | virtual bool initialize (int firstLevel = 0, 59 | int numberOfLevels = 1, 60 | ITexture* texture = 0, 61 | int mipLevel = -1) = 0; 62 | 63 | // bind to the specified surface 64 | virtual bool bind (uint32_t level) const = 0; 65 | virtual bool bindAndClear (uint32_t level = 0) const = 0; 66 | 67 | virtual unsigned int width() const = 0; 68 | virtual unsigned int height() const = 0; 69 | virtual bool writeToFile (const std::string& filename) const = 0; 70 | virtual const Ctr::ITexture* texture() const = 0; 71 | }; 72 | } 73 | 74 | #endif -------------------------------------------------------------------------------- /rendererD3D11/CtrEffectD3D11.cpp: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------------// 2 | // // 3 | // _________ .__ __ __ // 4 | // \_ ___ \_______|__|/ |__/ |_ ___________ // 5 | // / \ \/\_ __ \ \ __\ __\/ __ \_ __ \ // 6 | // \ \____| | \/ || | | | \ ___/| | \/ // 7 | // \______ /|__| |__||__| |__| \___ >__| // 8 | // \/ \/ // 9 | // // 10 | // Critter is provided under the MIT License(MIT) // 11 | // Critter uses portions of other open source software. // 12 | // Please review the LICENSE file for further details. // 13 | // // 14 | // Copyright(c) 2015 Matt Davidson // 15 | // // 16 | // Permission is hereby granted, free of charge, to any person obtaining a copy // 17 | // of this software and associated documentation files(the "Software"), to deal // 18 | // in the Software without restriction, including without limitation the rights // 19 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell // 20 | // copies of the Software, and to permit persons to whom the Software is // 21 | // furnished to do so, subject to the following conditions : // 22 | // // 23 | // 1. Redistributions of source code must retain the above copyright notice, // 24 | // this list of conditions and the following disclaimer. // 25 | // 2. Redistributions in binary form must reproduce the above copyright notice, // 26 | // this list of conditions and the following disclaimer in the // 27 | // documentation and / or other materials provided with the distribution. // 28 | // 3. Neither the name of the copyright holder nor the names of its // 29 | // contributors may be used to endorse or promote products derived // 30 | // from this software without specific prior written permission. // 31 | // // 32 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // 33 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // 34 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE // 35 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // 36 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // 37 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // 38 | // THE SOFTWARE. // 39 | // // 40 | //------------------------------------------------------------------------------------// 41 | 42 | #include 43 | #include 44 | #include 45 | #include 46 | #include 47 | #include 48 | #include 49 | #include 50 | #include 51 | #include 52 | #include 53 | #include 54 | 55 | namespace Ctr 56 | { 57 | EffectD3D11::EffectD3D11(ID3DX11Effect* effect) : 58 | IEffect (0), 59 | _effect (effect) 60 | { 61 | } 62 | 63 | EffectD3D11::~EffectD3D11() 64 | { 65 | free(); 66 | } 67 | 68 | bool 69 | EffectD3D11::free() 70 | { 71 | saferelease(_effect); 72 | return true; 73 | } 74 | 75 | bool 76 | EffectD3D11::create() 77 | { 78 | return true; 79 | } 80 | 81 | bool 82 | EffectD3D11::cache() 83 | { 84 | return true; 85 | } 86 | 87 | const ID3DX11Effect* 88 | EffectD3D11::effect() const 89 | { 90 | return _effect; 91 | } 92 | 93 | ID3DX11Effect* 94 | EffectD3D11::effect() 95 | { 96 | return _effect; 97 | } 98 | 99 | } 100 | -------------------------------------------------------------------------------- /application/CtrLog.cpp: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------------// 2 | // // 3 | // _________ .__ __ __ // 4 | // \_ ___ \_______|__|/ |__/ |_ ___________ // 5 | // / \ \/\_ __ \ \ __\ __\/ __ \_ __ \ // 6 | // \ \____| | \/ || | | | \ ___/| | \/ // 7 | // \______ /|__| |__||__| |__| \___ >__| // 8 | // \/ \/ // 9 | // // 10 | // Critter is provided under the MIT License(MIT) // 11 | // Critter uses portions of other open source software. // 12 | // Please review the LICENSE file for further details. // 13 | // // 14 | // Copyright(c) 2015 Matt Davidson // 15 | // // 16 | // Permission is hereby granted, free of charge, to any person obtaining a copy // 17 | // of this software and associated documentation files(the "Software"), to deal // 18 | // in the Software without restriction, including without limitation the rights // 19 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell // 20 | // copies of the Software, and to permit persons to whom the Software is // 21 | // furnished to do so, subject to the following conditions : // 22 | // // 23 | // 1. Redistributions of source code must retain the above copyright notice, // 24 | // this list of conditions and the following disclaimer. // 25 | // 2. Redistributions in binary form must reproduce the above copyright notice, // 26 | // this list of conditions and the following disclaimer in the // 27 | // documentation and / or other materials provided with the distribution. // 28 | // 3. Neither the name of the copyright holder nor the names of its // 29 | // contributors may be used to endorse or promote products derived // 30 | // from this software without specific prior written permission. // 31 | // // 32 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // 33 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // 34 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE // 35 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // 36 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // 37 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // 38 | // THE SOFTWARE. // 39 | // // 40 | //------------------------------------------------------------------------------------// 41 | 42 | #include 43 | 44 | namespace Ctr 45 | { 46 | std::string Log::_filePathName = std::string("IblLog.log"); 47 | bool Log::_initialized = false; 48 | LoggingLevel Log::_logLevel = LogCritical; 49 | 50 | namespace 51 | { 52 | Log applicationLog; 53 | } 54 | 55 | void Log::initialize(const std::string& filePathName) 56 | { 57 | { 58 | std::cout.precision (4); 59 | _filePathName = filePathName; 60 | DeleteFileA(_filePathName.c_str()); 61 | _initialized = true; 62 | } 63 | } 64 | 65 | void 66 | Log::write (const std::string& buffer, LogEntryLevel level) 67 | { 68 | if (level < _logLevel) 69 | return; 70 | 71 | if (!_initialized) 72 | { 73 | Log::initialize(Log::_filePathName); 74 | } 75 | 76 | FILE* file = 0; 77 | int result; 78 | if((result = fopen_s(&file, Log::_filePathName.c_str(), "a+"))!=0) 79 | return; 80 | 81 | std::ostringstream _file; 82 | _file.precision (4); 83 | _file << buffer << std::endl; 84 | std::cout << buffer << "\n"; 85 | fwrite (_file.str().c_str(), sizeof (char), strlen (_file.str().c_str()), file); 86 | fclose (file); 87 | } 88 | 89 | } -------------------------------------------------------------------------------- /rendererD3D11/CtrTexture2DD3D11.h: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------------// 2 | // // 3 | // _________ .__ __ __ // 4 | // \_ ___ \_______|__|/ |__/ |_ ___________ // 5 | // / \ \/\_ __ \ \ __\ __\/ __ \_ __ \ // 6 | // \ \____| | \/ || | | | \ ___/| | \/ // 7 | // \______ /|__| |__||__| |__| \___ >__| // 8 | // \/ \/ // 9 | // // 10 | // Critter is provided under the MIT License(MIT) // 11 | // Critter uses portions of other open source software. // 12 | // Please review the LICENSE file for further details. // 13 | // // 14 | // Copyright(c) 2015 Matt Davidson // 15 | // // 16 | // Permission is hereby granted, free of charge, to any person obtaining a copy // 17 | // of this software and associated documentation files(the "Software"), to deal // 18 | // in the Software without restriction, including without limitation the rights // 19 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell // 20 | // copies of the Software, and to permit persons to whom the Software is // 21 | // furnished to do so, subject to the following conditions : // 22 | // // 23 | // 1. Redistributions of source code must retain the above copyright notice, // 24 | // this list of conditions and the following disclaimer. // 25 | // 2. Redistributions in binary form must reproduce the above copyright notice, // 26 | // this list of conditions and the following disclaimer in the // 27 | // documentation and / or other materials provided with the distribution. // 28 | // 3. Neither the name of the copyright holder nor the names of its // 29 | // contributors may be used to endorse or promote products derived // 30 | // from this software without specific prior written permission. // 31 | // // 32 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // 33 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // 34 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE // 35 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // 36 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // 37 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // 38 | // THE SOFTWARE. // 39 | // // 40 | //------------------------------------------------------------------------------------// 41 | 42 | #ifndef INCLUDED_CRT_TEXTURE2D 43 | #define INCLUDED_CRT_TEXTURE2D 44 | 45 | #include 46 | #include 47 | 48 | namespace Ctr 49 | { 50 | class DeviceD3D11; 51 | class TextureMgr; 52 | class GpuVariable; 53 | 54 | //---------------------------------- 55 | // Base interface class for textures 56 | //---------------------------------- 57 | class Texture2DD3D11 : public TextureD3D11 58 | { 59 | public: 60 | Texture2DD3D11(Ctr::DeviceD3D11*); 61 | virtual ~Texture2DD3D11(); 62 | 63 | virtual bool create(); 64 | virtual bool free(); 65 | virtual bool mapForRead() const; 66 | virtual bool unmapFromRead() const; 67 | virtual bool map(uint32_t imageLevel = 0, uint32_t mipLevel = 0) const; 68 | virtual bool unmap() const; 69 | virtual bool isCubeMap() const; 70 | const D3D11_TEXTURE2D_DESC desc() const { return _desc; } 71 | 72 | private: 73 | D3D11_TEXTURE2D_DESC _desc; 74 | mutable ID3D11Texture2D * _stagingTexture; 75 | mutable int32_t _mappedSubresourceId; 76 | }; 77 | } 78 | #endif -------------------------------------------------------------------------------- /renderAPI/CtrViewport.cpp: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------------// 2 | // // 3 | // _________ .__ __ __ // 4 | // \_ ___ \_______|__|/ |__/ |_ ___________ // 5 | // / \ \/\_ __ \ \ __\ __\/ __ \_ __ \ // 6 | // \ \____| | \/ || | | | \ ___/| | \/ // 7 | // \______ /|__| |__||__| |__| \___ >__| // 8 | // \/ \/ // 9 | // // 10 | // Critter is provided under the MIT License(MIT) // 11 | // Critter uses portions of other open source software. // 12 | // Please review the LICENSE file for further details. // 13 | // // 14 | // Copyright(c) 2015 Matt Davidson // 15 | // // 16 | // Permission is hereby granted, free of charge, to any person obtaining a copy // 17 | // of this software and associated documentation files(the "Software"), to deal // 18 | // in the Software without restriction, including without limitation the rights // 19 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell // 20 | // copies of the Software, and to permit persons to whom the Software is // 21 | // furnished to do so, subject to the following conditions : // 22 | // // 23 | // 1. Redistributions of source code must retain the above copyright notice, // 24 | // this list of conditions and the following disclaimer. // 25 | // 2. Redistributions in binary form must reproduce the above copyright notice, // 26 | // this list of conditions and the following disclaimer in the // 27 | // documentation and / or other materials provided with the distribution. // 28 | // 3. Neither the name of the copyright holder nor the names of its // 29 | // contributors may be used to endorse or promote products derived // 30 | // from this software without specific prior written permission. // 31 | // // 32 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // 33 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // 34 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE // 35 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // 36 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // 37 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // 38 | // THE SOFTWARE. // 39 | // // 40 | //------------------------------------------------------------------------------------// 41 | 42 | #include 43 | 44 | namespace Ctr 45 | { 46 | Viewport::Viewport () : 47 | _x (0), 48 | _y (0), 49 | _width (1), 50 | _height (1), 51 | _minZ (0), 52 | _maxZ (1) 53 | { 54 | } 55 | 56 | Viewport::Viewport (float x, float y, float width, float height, float minz, float maxz) : 57 | _x (x), 58 | _y (y), 59 | _width (width), 60 | _height (height), 61 | _minZ (minz), 62 | _maxZ (maxz) 63 | { 64 | } 65 | 66 | 67 | Viewport::Viewport (uint32_t x, uint32_t y, uint32_t width, uint32_t height, float minz, float maxz) : 68 | _x (float(x)), 69 | _y (float(y)), 70 | _width (float(width)), 71 | _height (float(height)), 72 | _minZ (minz), 73 | _maxZ (maxz) 74 | { 75 | } 76 | 77 | Viewport::Viewport(int32_t x, int32_t y, int32_t width, int32_t height, int32_t minz, int32_t maxz) : 78 | _x(float(x)), 79 | _y(float(y)), 80 | _width(float(width)), 81 | _height(float(height)), 82 | _minZ(float(minz)), 83 | _maxZ(float(maxz)) 84 | { 85 | } 86 | 87 | Viewport::Viewport (const Viewport& viewport) 88 | { 89 | _x = viewport._x; 90 | _y = viewport._y; 91 | _width = viewport._width; 92 | _height = viewport._height; 93 | _minZ = viewport._minZ; 94 | _maxZ = viewport._maxZ; 95 | } 96 | } --------------------------------------------------------------------------------