| 1 | //************************************ bs::framework - Copyright 2018 Marko Pintera **************************************// |
|---|---|
| 2 | //*********** Licensed under the MIT license. See LICENSE.md for full terms. This notice is not to be removed. ***********// |
| 3 | #include "Material/BsShaderInclude.h" |
| 4 | #include "Resources/BsResources.h" |
| 5 | #include "Private/RTTI/BsShaderIncludeRTTI.h" |
| 6 | |
| 7 | namespace bs |
| 8 | { |
| 9 | ShaderInclude::ShaderInclude(const String& includeString) |
| 10 | :Resource(false), mString(includeString) |
| 11 | { |
| 12 | |
| 13 | } |
| 14 | |
| 15 | HShaderInclude ShaderInclude::create(const String& includeString) |
| 16 | { |
| 17 | return static_resource_cast<ShaderInclude>(gResources()._createResourceHandle(_createPtr(includeString))); |
| 18 | } |
| 19 | |
| 20 | SPtr<ShaderInclude> ShaderInclude::_createPtr(const String& includeString) |
| 21 | { |
| 22 | SPtr<ShaderInclude> shaderIncludePtr = bs_core_ptr<ShaderInclude>( |
| 23 | new (bs_alloc<ShaderInclude>()) ShaderInclude(includeString)); |
| 24 | shaderIncludePtr->_setThisPtr(shaderIncludePtr); |
| 25 | shaderIncludePtr->initialize(); |
| 26 | |
| 27 | return shaderIncludePtr; |
| 28 | } |
| 29 | |
| 30 | RTTITypeBase* ShaderInclude::getRTTIStatic() |
| 31 | { |
| 32 | return ShaderIncludeRTTI::instance(); |
| 33 | } |
| 34 | |
| 35 | RTTITypeBase* ShaderInclude::getRTTI() const |
| 36 | { |
| 37 | return ShaderInclude::getRTTIStatic(); |
| 38 | } |
| 39 | } |