Added KRSampler and KRSamplerManager classes. Marked stub functions to be implemented.

This commit is contained in:
2022-08-18 17:57:11 -07:00
parent cef2372ce8
commit 42e8365751
7 changed files with 233 additions and 0 deletions

View File

@@ -81,6 +81,8 @@ add_sources(KRSource.cpp)
add_sources(KRSourceManager.cpp) add_sources(KRSourceManager.cpp)
add_sources(KRPipeline.cpp) add_sources(KRPipeline.cpp)
add_sources(KRPipelineManager.cpp) add_sources(KRPipelineManager.cpp)
add_sources(KRSampler.cpp)
add_sources(KRSamplerManager.cpp)
add_sources(KRSpotLight.cpp) add_sources(KRSpotLight.cpp)
add_sources(KRSprite.cpp) add_sources(KRSprite.cpp)
add_sources(KRTexture.cpp) add_sources(KRTexture.cpp)

View File

@@ -101,6 +101,7 @@ KRContext::KRContext(const KrInitializeInfo* initializeInfo)
m_pBundleManager = std::make_unique<KRBundleManager>(*this); m_pBundleManager = std::make_unique<KRBundleManager>(*this);
m_pPipelineManager = std::make_unique<KRPipelineManager>(*this); m_pPipelineManager = std::make_unique<KRPipelineManager>(*this);
m_pSamplerManager = std::make_unique<KRSamplerManager>(*this);
m_pTextureManager = std::make_unique<KRTextureManager>(*this); m_pTextureManager = std::make_unique<KRTextureManager>(*this);
m_pMaterialManager = std::make_unique<KRMaterialManager>(*this, m_pTextureManager.get(), m_pPipelineManager.get()); m_pMaterialManager = std::make_unique<KRMaterialManager>(*this, m_pTextureManager.get(), m_pPipelineManager.get());
m_pMeshManager = std::make_unique<KRMeshManager>(*this); m_pMeshManager = std::make_unique<KRMeshManager>(*this);
@@ -148,6 +149,7 @@ KRContext::~KRContext()
m_pTextureManager->destroy(); m_pTextureManager->destroy();
m_pTextureManager.reset(); m_pTextureManager.reset();
m_pPipelineManager.reset(); m_pPipelineManager.reset();
m_pSamplerManager.reset();
m_pAnimationManager.reset(); m_pAnimationManager.reset();
m_pAnimationCurveManager.reset(); m_pAnimationCurveManager.reset();
m_pSoundManager->destroy(); m_pSoundManager->destroy();
@@ -214,6 +216,10 @@ KRPipelineManager* KRContext::getPipelineManager()
{ {
return m_pPipelineManager.get(); return m_pPipelineManager.get();
} }
KRSamplerManager* KRContext::getSamplerManager()
{
return m_pSamplerManager.get();
}
KRMeshManager* KRContext::getMeshManager() KRMeshManager* KRContext::getMeshManager()
{ {
return m_pMeshManager.get(); return m_pMeshManager.get();

View File

@@ -37,6 +37,7 @@
#include "KRTextureManager.h" #include "KRTextureManager.h"
#include "KRMaterialManager.h" #include "KRMaterialManager.h"
#include "KRPipelineManager.h" #include "KRPipelineManager.h"
#include "KRSamplerManager.h"
#include "KRMeshManager.h" #include "KRMeshManager.h"
#include "KRAnimationManager.h" #include "KRAnimationManager.h"
#include "KRAnimationCurveManager.h" #include "KRAnimationCurveManager.h"
@@ -53,6 +54,7 @@ class KRPresentationThread;
class KRStreamerThread; class KRStreamerThread;
class KRDeviceManager; class KRDeviceManager;
class KRSurfaceManager; class KRSurfaceManager;
class KRSamplerManager;
class KRContext class KRContext
{ {
@@ -106,6 +108,7 @@ public:
KRTextureManager* getTextureManager(); KRTextureManager* getTextureManager();
KRMaterialManager* getMaterialManager(); KRMaterialManager* getMaterialManager();
KRPipelineManager* getPipelineManager(); KRPipelineManager* getPipelineManager();
KRSamplerManager* getSamplerManager();
KRMeshManager* getMeshManager(); KRMeshManager* getMeshManager();
KRAnimationManager* getAnimationManager(); KRAnimationManager* getAnimationManager();
KRAnimationCurveManager* getAnimationCurveManager(); KRAnimationCurveManager* getAnimationCurveManager();
@@ -158,6 +161,7 @@ private:
std::unique_ptr<KRTextureManager> m_pTextureManager; std::unique_ptr<KRTextureManager> m_pTextureManager;
std::unique_ptr<KRMaterialManager> m_pMaterialManager; std::unique_ptr<KRMaterialManager> m_pMaterialManager;
std::unique_ptr<KRPipelineManager> m_pPipelineManager; std::unique_ptr<KRPipelineManager> m_pPipelineManager;
std::unique_ptr<KRSamplerManager> m_pSamplerManager;
std::unique_ptr<KRMeshManager> m_pMeshManager; std::unique_ptr<KRMeshManager> m_pMeshManager;
std::unique_ptr<KRAnimationManager> m_pAnimationManager; std::unique_ptr<KRAnimationManager> m_pAnimationManager;
std::unique_ptr<KRAnimationCurveManager> m_pAnimationCurveManager; std::unique_ptr<KRAnimationCurveManager> m_pAnimationCurveManager;

48
kraken/KRSampler.cpp Normal file
View File

@@ -0,0 +1,48 @@
//
// KRSampler.cpp
// Kraken Engine
//
// Copyright 2022 Kearwood Gilbert. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification, are
// permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this list of
// conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice, this list
// of conditions and the following disclaimer in the documentation and/or other materials
// provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY KEARWOOD GILBERT ''AS IS'' AND ANY EXPRESS OR IMPLIED
// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
// FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL KEARWOOD GILBERT OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// The views and conclusions contained in the software and documentation are those of the
// authors and should not be interpreted as representing official policies, either expressed
// or implied, of Kearwood Gilbert.
//
#include "KRSampler.h"
KRSampler::KRSampler(KRContext& context, KRSurface& surface, const SamplerInfo& info)
: KRContextObject(context)
{
// TODO - Implement stub function
}
KRSampler::~KRSampler()
{
// TODO - Implement stub function
}
VkSampler& KRSampler::getSampler()
{
return m_sampler;
}

57
kraken/KRSampler.h Normal file
View File

@@ -0,0 +1,57 @@
//
// KRSampler.h
// Kraken Engine
//
// Copyright 2022 Kearwood Gilbert. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification, are
// permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this list of
// conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice, this list
// of conditions and the following disclaimer in the documentation and/or other materials
// provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY KEARWOOD GILBERT ''AS IS'' AND ANY EXPRESS OR IMPLIED
// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
// FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL KEARWOOD GILBERT OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// The views and conclusions contained in the software and documentation are those of the
// authors and should not be interpreted as representing official policies, either expressed
// or implied, of Kearwood Gilbert.
//
#pragma once
#include "KREngine-common.h"
#include "KRContextObject.h"
#include "KRSurface.h"
class SamplerInfo
{
public:
VkSamplerCreateInfo createInfo;
};
class KRSampler : public KRContextObject
{
public:
KRSampler(KRContext& context, KRSurface& surface, const SamplerInfo& info);
virtual ~KRSampler();
VkSampler& getSampler();
private:
VkSampler m_sampler;
};

View File

@@ -0,0 +1,56 @@
//
// KRSamplerManager.cpp
// Kraken Engine
//
// Copyright 2022 Kearwood Gilbert. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification, are
// permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this list of
// conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice, this list
// of conditions and the following disclaimer in the documentation and/or other materials
// provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY KEARWOOD GILBERT ''AS IS'' AND ANY EXPRESS OR IMPLIED
// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
// FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL KEARWOOD GILBERT OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// The views and conclusions contained in the software and documentation are those of the
// authors and should not be interpreted as representing official policies, either expressed
// or implied, of Kearwood Gilbert.
//
#include "KREngine-common.h"
#include "KRSamplerManager.h"
KRSamplerManager::KRSamplerManager(KRContext& context)
: KRContextObject(context)
{
// TODO - Implement stub function
}
KRSamplerManager::~KRSamplerManager()
{
// TODO - Implement stub function
}
KRSampler* KRSamplerManager::getSampler(KRSurface& surface, const SamplerInfo& info)
{
// TODO - Implement stub function
return nullptr;
}
size_t KRSamplerManager::getSamplerHandlesUsed()
{
// TODO - Implement stub function
}

60
kraken/KRSamplerManager.h Normal file
View File

@@ -0,0 +1,60 @@
//
// KRSamplerManager.h
// Kraken Engine
//
// Copyright 2022 Kearwood Gilbert. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification, are
// permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this list of
// conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice, this list
// of conditions and the following disclaimer in the documentation and/or other materials
// provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY KEARWOOD GILBERT ''AS IS'' AND ANY EXPRESS OR IMPLIED
// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
// FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL KEARWOOD GILBERT OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// The views and conclusions contained in the software and documentation are those of the
// authors and should not be interpreted as representing official policies, either expressed
// or implied, of Kearwood Gilbert.
//
#pragma once
#include "KREngine-common.h"
#include "KRDataBlock.h"
using std::map;
using std::vector;
#include "KRSampler.h"
class KRSampler;
class SamplerInfo;
class KRSamplerManager : public KRContextObject
{
public:
KRSamplerManager(KRContext& context);
virtual ~KRSamplerManager();
KRSampler* getSampler(KRSurface& surface, const SamplerInfo& info);
size_t getSamplerHandlesUsed();
private:
typedef std::map<std::pair<std::string, std::vector<int> >, KRSampler*> SamplerMap;
SamplerMap m_samplers;
};