work on android port
This commit is contained in:
7
.fpccfg
7
.fpccfg
@@ -6,3 +6,10 @@ sysroot = "/home/kotofyt/Downloads/xcode/Xcode_26.1_Apple_silicon/Xcode.app/Cont
|
|||||||
|
|
||||||
[x86_64-apple-ios]
|
[x86_64-apple-ios]
|
||||||
sysroot = "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk"
|
sysroot = "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk"
|
||||||
|
|
||||||
|
[x86_64-linux-android]
|
||||||
|
sysroot = "/home/kotofyt/Android/Sdk/ndk/29.0.13599879/toolchains/llvm/prebuilt/linux-x86_64/sysroot"
|
||||||
|
"clang++" = "/home/kotofyt/Android/Sdk/ndk/29.0.13599879/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++"
|
||||||
|
|
||||||
|
[Android_Build_Tools]
|
||||||
|
path = "/home/kotofyt/Android/Sdk/build-tools/36.0.0"
|
||||||
|
|||||||
@@ -25,5 +25,11 @@ DECLARE_BUILD_STAGE(config)
|
|||||||
ADD_OUTPUT_VALUE("steam", "true");
|
ADD_OUTPUT_VALUE("steam", "true");
|
||||||
ADD_OUTPUT_OBJECT("steam_lib", EXTERNAL"steamworks/redistributable_bin/win64/steam_api64.dll");
|
ADD_OUTPUT_OBJECT("steam_lib", EXTERNAL"steamworks/redistributable_bin/win64/steam_api64.dll");
|
||||||
}
|
}
|
||||||
|
if (Target_t::DefaultTarget().kernel == TARGET_KERNEL_ANDROID)
|
||||||
|
{
|
||||||
|
ADD_OUTPUT_VALUE("static", "true");
|
||||||
|
ADD_OUTPUT_VALUE("bundle", "true");
|
||||||
|
ADD_OUTPUT_VALUE("steam", "false");
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ DECLARE_BUILD_STAGE(engine)
|
|||||||
EXTERNAL"steamworks/public",
|
EXTERNAL"steamworks/public",
|
||||||
EXTERNAL"Vulkan-Headers/include",
|
EXTERNAL"Vulkan-Headers/include",
|
||||||
EXTERNAL"Vulkan-Utility-Libraries/include",
|
EXTERNAL"Vulkan-Utility-Libraries/include",
|
||||||
|
EXTERNAL"OpenXR-SDK/include",
|
||||||
EXTERNAL
|
EXTERNAL
|
||||||
};
|
};
|
||||||
if ( GET_PROJECT_VALUE(config, "steam") == "true" )
|
if ( GET_PROJECT_VALUE(config, "steam") == "true" )
|
||||||
|
|||||||
2
external/funnystdlib
vendored
2
external/funnystdlib
vendored
Submodule external/funnystdlib updated: df40d74b9b...ecb21ea0c4
@@ -137,7 +137,6 @@ FunnyMesh_t *CAssetManager::GetMeshByIndex( uint32_t uIndex )
|
|||||||
|
|
||||||
uint32_t CAssetManager::LoadModel( const char *szName )
|
uint32_t CAssetManager::LoadModel( const char *szName )
|
||||||
{
|
{
|
||||||
V_printf("LOADING %s\n", szName);
|
|
||||||
bool bHasBeenCreated = false;
|
bool bHasBeenCreated = false;
|
||||||
HFunnyModel hModel = m_models.GetOrCreateObject(szName, &bHasBeenCreated);
|
HFunnyModel hModel = m_models.GetOrCreateObject(szName, &bHasBeenCreated);
|
||||||
if (!bHasBeenCreated)
|
if (!bHasBeenCreated)
|
||||||
@@ -296,7 +295,6 @@ void CAssetManager::UnrefMaterial( uint32_t uIndex )
|
|||||||
|
|
||||||
HFunnyMesh CAssetManager::LoadMesh( const char *szName )
|
HFunnyMesh CAssetManager::LoadMesh( const char *szName )
|
||||||
{
|
{
|
||||||
V_printf("LOADING %s\n", szName);
|
|
||||||
bool bHasBeenCreated = false;
|
bool bHasBeenCreated = false;
|
||||||
HFunnyMesh hAsset = m_meshes.GetOrCreateObject(szName, &bHasBeenCreated);
|
HFunnyMesh hAsset = m_meshes.GetOrCreateObject(szName, &bHasBeenCreated);
|
||||||
if (!bHasBeenCreated)
|
if (!bHasBeenCreated)
|
||||||
@@ -310,7 +308,6 @@ HFunnyMesh CAssetManager::LoadMesh( const char *szName )
|
|||||||
m_meshes.UnrefObject(hAsset);
|
m_meshes.UnrefObject(hAsset);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
V_printf("V_LOADING %s %llu\n", szName, filesystem->Size(hMesh));
|
|
||||||
|
|
||||||
IVertexBuffer *pVertexBuffer = g_pRenderContext->CreateVertexBuffer(filesystem->Size(hMesh));
|
IVertexBuffer *pVertexBuffer = g_pRenderContext->CreateVertexBuffer(filesystem->Size(hMesh));
|
||||||
pVertexBuffer->Lock();
|
pVertexBuffer->Lock();
|
||||||
|
|||||||
@@ -14,9 +14,9 @@
|
|||||||
|
|
||||||
static C_BaseEntity *s_pLocalEntity;
|
static C_BaseEntity *s_pLocalEntity;
|
||||||
|
|
||||||
CEntitySystem *EntitySystem()
|
C_EntitySystem *EntitySystem()
|
||||||
{
|
{
|
||||||
static CEntitySystem s_entitySystem;
|
static C_EntitySystem s_entitySystem;
|
||||||
return &s_entitySystem;
|
return &s_entitySystem;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -27,7 +27,7 @@ static struct EntityRegistry_t
|
|||||||
struct EntityRegistry_t *m_pNext;
|
struct EntityRegistry_t *m_pNext;
|
||||||
} *s_pEntitiesRegistry = NULL;
|
} *s_pEntitiesRegistry = NULL;
|
||||||
|
|
||||||
CEntitySystem::CEntitySystem()
|
C_EntitySystem::C_EntitySystem()
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for ( i = 0; i < MAX_EDICTS; i++ )
|
for ( i = 0; i < MAX_EDICTS; i++ )
|
||||||
@@ -37,7 +37,7 @@ CEntitySystem::CEntitySystem()
|
|||||||
m_nEntityCount = 0;
|
m_nEntityCount = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CEntitySystem::RegisterEntityClass( IEntityFactory *pEntityFactory, const char *szClassName )
|
void C_EntitySystem::RegisterEntityClass( IEntityFactory *pEntityFactory, const char *szClassName )
|
||||||
{
|
{
|
||||||
IEntityFactory *pFactory;
|
IEntityFactory *pFactory;
|
||||||
EntityRegistry_t *pRegistry;
|
EntityRegistry_t *pRegistry;
|
||||||
@@ -57,7 +57,7 @@ void CEntitySystem::RegisterEntityClass( IEntityFactory *pEntityFactory, const c
|
|||||||
s_pEntitiesRegistry = pRegistry;
|
s_pEntitiesRegistry = pRegistry;
|
||||||
}
|
}
|
||||||
|
|
||||||
C_BaseEntity *CEntitySystem::CreateByClassname( const char *szName )
|
C_BaseEntity *C_EntitySystem::CreateByClassname( const char *szName )
|
||||||
{
|
{
|
||||||
IEntityFactory *pFactory;
|
IEntityFactory *pFactory;
|
||||||
C_BaseEntity *pEntity;
|
C_BaseEntity *pEntity;
|
||||||
@@ -89,7 +89,7 @@ C_BaseEntity *CEntitySystem::CreateByClassname( const char *szName )
|
|||||||
m_nEntityCount++;
|
m_nEntityCount++;
|
||||||
return pEntity;
|
return pEntity;
|
||||||
}
|
}
|
||||||
C_BaseEntity *CEntitySystem::CreateByClassnameWithIndex( const char *szName, uint32_t uIndex )
|
C_BaseEntity *C_EntitySystem::CreateByClassnameWithIndex( const char *szName, uint32_t uIndex )
|
||||||
{
|
{
|
||||||
IEntityFactory *pFactory;
|
IEntityFactory *pFactory;
|
||||||
C_BaseEntity *pEntity;
|
C_BaseEntity *pEntity;
|
||||||
@@ -109,7 +109,7 @@ C_BaseEntity *CEntitySystem::CreateByClassnameWithIndex( const char *szName, uin
|
|||||||
return pEntity;
|
return pEntity;
|
||||||
}
|
}
|
||||||
|
|
||||||
IEntityFactory *CEntitySystem::GetFactoryByClassname( const char *szName )
|
IEntityFactory *C_EntitySystem::GetFactoryByClassname( const char *szName )
|
||||||
{
|
{
|
||||||
EntityRegistry_t *pEntity;
|
EntityRegistry_t *pEntity;
|
||||||
|
|
||||||
@@ -124,7 +124,7 @@ IEntityFactory *CEntitySystem::GetFactoryByClassname( const char *szName )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CEntitySystem::DestroyEntityByIndex( uint32_t uIndex )
|
void C_EntitySystem::DestroyEntityByIndex( uint32_t uIndex )
|
||||||
{
|
{
|
||||||
if ( uIndex >= MAX_EDICTS )
|
if ( uIndex >= MAX_EDICTS )
|
||||||
return;
|
return;
|
||||||
@@ -138,12 +138,12 @@ void CEntitySystem::DestroyEntityByIndex( uint32_t uIndex )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CEntitySystem::DestroyEntityByPtr( C_BaseEntity *pEntity )
|
void C_EntitySystem::DestroyEntityByPtr( C_BaseEntity *pEntity )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CEntitySystem::Think()
|
void C_EntitySystem::Think()
|
||||||
{
|
{
|
||||||
C_BaseEntity *pEntity;
|
C_BaseEntity *pEntity;
|
||||||
int i;
|
int i;
|
||||||
@@ -180,7 +180,7 @@ searchIndex:
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CEntitySystem::NetRecvPacket( NetPacket_t *pPacket )
|
void C_EntitySystem::NetRecvPacket( NetPacket_t *pPacket )
|
||||||
{
|
{
|
||||||
PlayerPacket_t *pPlayerPacket = (PlayerPacket_t*)pPacket->pData;
|
PlayerPacket_t *pPlayerPacket = (PlayerPacket_t*)pPacket->pData;
|
||||||
C_BaseEntity *pEntity;
|
C_BaseEntity *pEntity;
|
||||||
@@ -249,7 +249,7 @@ void CEntitySystem::NetRecvPacket( NetPacket_t *pPacket )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CEntitySystem::NetSendThink( INetworkBase *pBase )
|
void C_EntitySystem::NetSendThink( INetworkBase *pBase )
|
||||||
{
|
{
|
||||||
C_BaseEntity *pEntity;
|
C_BaseEntity *pEntity;
|
||||||
int i;
|
int i;
|
||||||
@@ -320,12 +320,12 @@ void CEntitySystem::NetSendThink( INetworkBase *pBase )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
C_BaseEntity **CEntitySystem::GetEntities()
|
C_BaseEntity **C_EntitySystem::GetEntities()
|
||||||
{
|
{
|
||||||
return m_pEntities;
|
return m_pEntities;
|
||||||
};
|
};
|
||||||
|
|
||||||
C_BaseEntity *CEntitySystem::GetEntityByIndex( int idx )
|
C_BaseEntity *C_EntitySystem::GetEntityByIndex( int idx )
|
||||||
{
|
{
|
||||||
if (idx < 0 || idx >= MAX_EDICTS)
|
if (idx < 0 || idx >= MAX_EDICTS)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|||||||
@@ -16,10 +16,10 @@ class C_BaseEntity;
|
|||||||
#define MAX_EDICTS 8192
|
#define MAX_EDICTS 8192
|
||||||
#define EDICT_INDEX_UNDEFINED (-1U)
|
#define EDICT_INDEX_UNDEFINED (-1U)
|
||||||
|
|
||||||
class CEntitySystem
|
class C_EntitySystem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CEntitySystem();
|
C_EntitySystem();
|
||||||
|
|
||||||
virtual void RegisterEntityClass( IEntityFactory *pEntityFactory, const char *szClassName );
|
virtual void RegisterEntityClass( IEntityFactory *pEntityFactory, const char *szClassName );
|
||||||
virtual C_BaseEntity *CreateByClassname( const char *szName );
|
virtual C_BaseEntity *CreateByClassname( const char *szName );
|
||||||
@@ -43,7 +43,7 @@ private:
|
|||||||
int m_nEntityCount;
|
int m_nEntityCount;
|
||||||
};
|
};
|
||||||
|
|
||||||
CEntitySystem *EntitySystem();
|
C_EntitySystem *EntitySystem();
|
||||||
|
|
||||||
C_BaseEntity *UTIL_GetLocalPlayer();
|
C_BaseEntity *UTIL_GetLocalPlayer();
|
||||||
|
|
||||||
|
|||||||
@@ -28,6 +28,8 @@ class CFunnyGameBridge: public IEngineBridge
|
|||||||
bool m_bIsConnectedToServer;
|
bool m_bIsConnectedToServer;
|
||||||
|
|
||||||
float m_fNetUpdateTimer;
|
float m_fNetUpdateTimer;
|
||||||
|
|
||||||
|
IViewport *m_pMainViewport;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -47,7 +49,6 @@ void CFunnyGameBridge::Init()
|
|||||||
Console()->AddCommand("exec game/core/default.cfg\n");
|
Console()->AddCommand("exec game/core/default.cfg\n");
|
||||||
Console()->Execute();
|
Console()->Execute();
|
||||||
|
|
||||||
g_pWorldRenderer->Init();
|
|
||||||
#ifdef STEAM
|
#ifdef STEAM
|
||||||
if (g_pEngineConstants->m_bIsSteam)
|
if (g_pEngineConstants->m_bIsSteam)
|
||||||
{
|
{
|
||||||
@@ -89,6 +90,12 @@ void CFunnyGameBridge::Init()
|
|||||||
g_pRenderContext->ConnectInterface(g_pXRManager, XR_INTERFACE_VERSION);
|
g_pRenderContext->ConnectInterface(g_pXRManager, XR_INTERFACE_VERSION);
|
||||||
|
|
||||||
|
|
||||||
|
g_pWorldRenderer->Init();
|
||||||
|
m_pMainViewport = g_pWorldRenderer->CreateViewport(g_pMainWindow->GetRenderWidth(), g_pMainWindow->GetRenderHeight());
|
||||||
|
m_pMainViewport->SetFOV(90);
|
||||||
|
m_pMainViewport->SetPosition({0,0,0});
|
||||||
|
m_pMainViewport->SetRotation({0,0,0,1});
|
||||||
|
|
||||||
IXRHeadset *pHeadSet = g_pXRManager->GetHeadset(0);
|
IXRHeadset *pHeadSet = g_pXRManager->GetHeadset(0);
|
||||||
if (pHeadSet)
|
if (pHeadSet)
|
||||||
{
|
{
|
||||||
@@ -150,6 +157,11 @@ void CFunnyGameBridge::TryToConnectToServer()
|
|||||||
|
|
||||||
void CFunnyGameBridge::Frame( float fDelta )
|
void CFunnyGameBridge::Frame( float fDelta )
|
||||||
{
|
{
|
||||||
|
|
||||||
|
if (g_pMainWindow->GetRenderWidth() != m_pMainViewport->GetWidth())
|
||||||
|
if (g_pMainWindow->GetRenderHeight() != m_pMainViewport->GetHeight())
|
||||||
|
m_pMainViewport->UpdateResolution(g_pMainWindow->GetRenderWidth(), g_pMainWindow->GetRenderHeight());
|
||||||
|
|
||||||
g_pEngineVars->m_fTime += fDelta;
|
g_pEngineVars->m_fTime += fDelta;
|
||||||
g_pEngineVars->m_fDeltaTime = fDelta;
|
g_pEngineVars->m_fDeltaTime = fDelta;
|
||||||
|
|
||||||
@@ -158,13 +170,6 @@ void CFunnyGameBridge::Frame( float fDelta )
|
|||||||
|
|
||||||
g_pXRManager->Frame();
|
g_pXRManager->Frame();
|
||||||
|
|
||||||
IXRHeadset *pHeadSet = g_pXRManager->GetHeadset(0);
|
|
||||||
if (pHeadSet) {
|
|
||||||
XRRenderSurface_t s = pHeadSet->GetSurface(0);
|
|
||||||
g_pWorldRenderer->SetCameraPosition(s.m_vPosition);
|
|
||||||
g_pWorldRenderer->SetCameraRotation(s.m_vRotation);
|
|
||||||
}
|
|
||||||
|
|
||||||
INetworkBase *pCurrentServer = g_pServerBridge;
|
INetworkBase *pCurrentServer = g_pServerBridge;
|
||||||
pCurrentServer = g_pServerBridge;
|
pCurrentServer = g_pServerBridge;
|
||||||
if (m_bIsConnectedToServer)
|
if (m_bIsConnectedToServer)
|
||||||
@@ -217,6 +222,7 @@ void CFunnyGameBridge::Frame( float fDelta )
|
|||||||
EntitySystem()->NetSendThink(pCurrentServer);
|
EntitySystem()->NetSendThink(pCurrentServer);
|
||||||
}
|
}
|
||||||
g_pWorldRenderer->Frame(fDelta);
|
g_pWorldRenderer->Frame(fDelta);
|
||||||
|
g_pMainWindow->SetOutputImage(m_pMainViewport->GetRenderImage());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CFunnyGameBridge::Shutdown()
|
void CFunnyGameBridge::Shutdown()
|
||||||
|
|||||||
16
game/client/kbt_vr_psy/experience.h
Normal file
16
game/client/kbt_vr_psy/experience.h
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
#include "baseentity.h"
|
||||||
|
|
||||||
|
class C_KBTExperience: public C_BaseEntity
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
DECLARE_CLASS(C_KBTExperience, C_BaseEntity)
|
||||||
|
DECLARE_CLIENTCLASS()
|
||||||
|
|
||||||
|
virtual ~C_KBTExperience() override;
|
||||||
|
virtual void Precache() override;
|
||||||
|
virtual void Spawn() override;
|
||||||
|
void Frame( float fDelta );
|
||||||
|
};
|
||||||
|
|
||||||
|
C_KBTExperience *GetExperience();
|
||||||
|
|
||||||
0
game/client/kbt_vr_psy/interactable.cpp
Normal file
0
game/client/kbt_vr_psy/interactable.cpp
Normal file
39
game/client/kbt_vr_psy/materials.cpp
Normal file
39
game/client/kbt_vr_psy/materials.cpp
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
#include "materials.h"
|
||||||
|
#include "worldrender.h"
|
||||||
|
#include "tier0/lib.h"
|
||||||
|
|
||||||
|
class CBasicPBR: public CBaseMaterial
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
DECLARE_CLASS(CBasicPBR, CBaseMaterial)
|
||||||
|
DECLARE_DATADESC()
|
||||||
|
DECLARE_SHADER("game/core/shaders/funny_basic_pbr.shader_c")
|
||||||
|
virtual void SetUpMesh( MaterialData_t *pData ) override {
|
||||||
|
pData->m_vAlbedoColor = m_vAlbedo;
|
||||||
|
pData->m_uAlbedo = m_tAlbedo;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
FMat::XMFLOAT4 m_vAlbedo = { 1, 1, 1, 1 };
|
||||||
|
FMat::XMTexture m_tAlbedo = TEXTURE_NO_TEXTURE;
|
||||||
|
};
|
||||||
|
|
||||||
|
BEGIN_DATADESC(CBasicPBR)
|
||||||
|
DEFINE_KEYFIELD(m_vAlbedo, FIELD_SHADER_COLOR_FLOAT4, "AlbedoMultiplier")
|
||||||
|
DEFINE_KEYFIELD(m_tAlbedo, FIELD_SHADER_TEXTURE, "AlbedoTexture")
|
||||||
|
END_DATADESC()
|
||||||
|
DEFINE_MATERIAL(CBasicPBR, "funny_basic_pbr")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class CBasicError: public CBaseMaterial
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
DECLARE_CLASS(CBasicError, CBaseMaterial)
|
||||||
|
DECLARE_DATADESC()
|
||||||
|
DECLARE_SHADER("game/core/shaders/funny_error.shader_c")
|
||||||
|
};
|
||||||
|
|
||||||
|
BEGIN_DATADESC(CBasicError)
|
||||||
|
END_DATADESC()
|
||||||
|
DEFINE_MATERIAL(CBasicError, "funny_error")
|
||||||
0
game/client/kbt_vr_psy/observer_http.cpp
Normal file
0
game/client/kbt_vr_psy/observer_http.cpp
Normal file
25
game/client/kbt_vr_psy/player.cpp
Normal file
25
game/client/kbt_vr_psy/player.cpp
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
#include "baseentity.h"
|
||||||
|
|
||||||
|
class C_KBTPlayer: public C_BaseEntity
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
DECLARE_CLASS(C_KBTPlayer, C_BaseEntity)
|
||||||
|
DECLARE_CLIENTCLASS()
|
||||||
|
|
||||||
|
virtual ~C_KBTPlayer() override;
|
||||||
|
virtual void Precache() override;
|
||||||
|
virtual void Spawn() override;
|
||||||
|
void Frame( float fDelta );
|
||||||
|
};
|
||||||
|
|
||||||
|
class C_KBRPlayer_Controller: public C_BaseEntity
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
DECLARE_CLASS(C_KBTPlayer, C_BaseEntity)
|
||||||
|
DECLARE_CLIENTCLASS()
|
||||||
|
|
||||||
|
virtual ~C_KBRPlayer_Controller() override;
|
||||||
|
virtual void Precache() override;
|
||||||
|
virtual void Spawn() override;
|
||||||
|
void Frame( float fDelta );
|
||||||
|
};
|
||||||
0
game/client/kbt_vr_psy/stop_button.cpp
Normal file
0
game/client/kbt_vr_psy/stop_button.cpp
Normal file
0
game/client/kbt_vr_psy/ui/settings.cpp
Normal file
0
game/client/kbt_vr_psy/ui/settings.cpp
Normal file
@@ -6,6 +6,108 @@
|
|||||||
#include "cglm/mat4.h"
|
#include "cglm/mat4.h"
|
||||||
#include "game.h"
|
#include "game.h"
|
||||||
|
|
||||||
|
class CFunnyViewport: public IViewport
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void UpdateResolution( uint32_t uX, uint32_t uY ) override;
|
||||||
|
|
||||||
|
virtual IImage *GetRenderImage() override;
|
||||||
|
virtual IImage *GetDepthImage() override;
|
||||||
|
virtual IImage *GetNormalImage() override;
|
||||||
|
|
||||||
|
virtual void SetFOV( float f ) override;
|
||||||
|
virtual void SetPosition( Vector v ) override;
|
||||||
|
virtual void SetRotation( Quat q ) override;
|
||||||
|
|
||||||
|
virtual uint32_t GetWidth() override;
|
||||||
|
virtual uint32_t GetHeight() override;
|
||||||
|
|
||||||
|
|
||||||
|
IImage *m_pColor = 0;
|
||||||
|
IImage *m_pNormal = 0;
|
||||||
|
IImage *m_pWorldCoords = 0;
|
||||||
|
IImage *m_pDepth = 0;
|
||||||
|
IImage *m_pColorResolved = 0;
|
||||||
|
IImage *m_pRenderImage = 0;
|
||||||
|
|
||||||
|
uint32_t m_uX;
|
||||||
|
uint32_t m_uY;
|
||||||
|
float m_fFov;
|
||||||
|
vec3 m_vPos;
|
||||||
|
versor m_qRot;
|
||||||
|
};
|
||||||
|
|
||||||
|
void CFunnyViewport::UpdateResolution( uint32_t uX, uint32_t uY )
|
||||||
|
{
|
||||||
|
if (m_pColor)
|
||||||
|
{
|
||||||
|
g_pRenderContext->DestroyImage(m_pColor);
|
||||||
|
g_pRenderContext->DestroyImage(m_pNormal);
|
||||||
|
g_pRenderContext->DestroyImage(m_pWorldCoords);
|
||||||
|
g_pRenderContext->DestroyImage(m_pDepth);
|
||||||
|
g_pRenderContext->DestroyImage(m_pColorResolved);
|
||||||
|
g_pRenderContext->DestroyImage(m_pRenderImage);
|
||||||
|
}
|
||||||
|
m_pColor = g_pRenderContext->CreateRenderTarget(uX, uY, IMAGE_FORMAT_RGBA8_UNORM, MULTISAMPLE_TYPE_4_SAMPLES);
|
||||||
|
m_pNormal = g_pRenderContext->CreateRenderTarget(uX, uY, IMAGE_FORMAT_RGBA16_SNORM, MULTISAMPLE_TYPE_4_SAMPLES);
|
||||||
|
m_pWorldCoords = g_pRenderContext->CreateRenderTarget(uX, uY, IMAGE_FORMAT_RGBA32_SFLOAT, MULTISAMPLE_TYPE_4_SAMPLES);
|
||||||
|
m_pDepth = g_pRenderContext->CreateRenderTarget(uX, uY, IMAGE_FORMAT_D32_SFLOAT, MULTISAMPLE_TYPE_4_SAMPLES);
|
||||||
|
m_pColorResolved = g_pRenderContext->CreateRenderTarget(uX, uY, IMAGE_FORMAT_RGBA8_UNORM, MULTISAMPLE_TYPE_1_SAMPLES);
|
||||||
|
m_pRenderImage = g_pRenderContext->CreateStorageImage(uX, uY, IMAGE_FORMAT_RGBA16_SFLOAT, MULTISAMPLE_TYPE_1_SAMPLES);
|
||||||
|
m_uX = uX;
|
||||||
|
m_uY = uY;
|
||||||
|
}
|
||||||
|
|
||||||
|
IImage *CFunnyViewport::GetRenderImage()
|
||||||
|
{
|
||||||
|
return m_pRenderImage;
|
||||||
|
}
|
||||||
|
|
||||||
|
IImage *CFunnyViewport::GetDepthImage()
|
||||||
|
{
|
||||||
|
return m_pDepth;
|
||||||
|
}
|
||||||
|
|
||||||
|
IImage *CFunnyViewport::GetNormalImage()
|
||||||
|
{
|
||||||
|
return m_pNormal;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFunnyViewport::SetFOV( float f )
|
||||||
|
{
|
||||||
|
m_fFov = f;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFunnyViewport::SetPosition( Vector v )
|
||||||
|
{
|
||||||
|
m_vPos[0] = v.x;
|
||||||
|
m_vPos[1] = v.y;
|
||||||
|
m_vPos[2] = v.z;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFunnyViewport::SetRotation( Quat q )
|
||||||
|
{
|
||||||
|
m_qRot[0] = q.x;
|
||||||
|
m_qRot[1] = q.y;
|
||||||
|
m_qRot[2] = q.z;
|
||||||
|
m_qRot[3] = q.w;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t CFunnyViewport::GetWidth()
|
||||||
|
{
|
||||||
|
return m_uX;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t CFunnyViewport::GetHeight()
|
||||||
|
{
|
||||||
|
return m_uY;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
struct ViewBuffer_t
|
struct ViewBuffer_t
|
||||||
{
|
{
|
||||||
mat4 m_matCameraProjection;
|
mat4 m_matCameraProjection;
|
||||||
@@ -122,9 +224,6 @@ public:
|
|||||||
virtual void Frame( float fDelta ) override;
|
virtual void Frame( float fDelta ) override;
|
||||||
virtual void Shutdown() override;
|
virtual void Shutdown() override;
|
||||||
|
|
||||||
virtual void SetCameraRotation( Quat vRotation ) override;
|
|
||||||
virtual void SetCameraPosition( Vector vPosition ) override;
|
|
||||||
|
|
||||||
virtual IMesh *CreateMesh( const char *szName ) override;
|
virtual IMesh *CreateMesh( const char *szName ) override;
|
||||||
virtual IMeshInstance *CreateInstance( IMesh *pMesh ) override;
|
virtual IMeshInstance *CreateInstance( IMesh *pMesh ) override;
|
||||||
virtual void DestroyMeshInstance( IMesh *pMesh, IMeshInstance *pInstance ) override;
|
virtual void DestroyMeshInstance( IMesh *pMesh, IMeshInstance *pInstance ) override;
|
||||||
@@ -132,15 +231,12 @@ public:
|
|||||||
|
|
||||||
virtual void ConfigureShader( IShader *pShader ) override;
|
virtual void ConfigureShader( IShader *pShader ) override;
|
||||||
|
|
||||||
|
virtual IViewport *CreateViewport( uint32_t uX, uint32_t uY ) override;
|
||||||
|
virtual void DestroyViewport( IViewport *pViewport ) override;
|
||||||
|
|
||||||
virtual ITextureArray *GetTextures() override;
|
virtual ITextureArray *GetTextures() override;
|
||||||
private:
|
private:
|
||||||
CUtlVector<CFunnyMesh*> m_pMeshes;
|
CUtlVector<CFunnyMesh*> m_pMeshes;
|
||||||
IImage *m_pOutputImage = NULL;
|
|
||||||
IImage *m_pResolvedOutputImage = NULL;
|
|
||||||
IImage *m_pDepthImage = NULL;
|
|
||||||
IImage *m_pNormalImage = NULL;
|
|
||||||
IImage *m_pWorldSpaceImage = NULL;
|
|
||||||
IImage *m_pStorageOutputImage = NULL;
|
|
||||||
IRenderCommandList *m_pRasterCommandList = NULL;
|
IRenderCommandList *m_pRasterCommandList = NULL;
|
||||||
IBuffer *m_pViewBuffer;
|
IBuffer *m_pViewBuffer;
|
||||||
ViewBuffer_t *m_pViewBufferData;
|
ViewBuffer_t *m_pViewBufferData;
|
||||||
@@ -152,8 +248,7 @@ private:
|
|||||||
IComputeShader *m_pPostProcessing;
|
IComputeShader *m_pPostProcessing;
|
||||||
IMaterial *m_pPostProcessingMaterial;
|
IMaterial *m_pPostProcessingMaterial;
|
||||||
|
|
||||||
vec3 m_vPos;
|
CUtlVector<CFunnyViewport*> m_viewports;
|
||||||
versor m_vRot;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
void CFunnyWorldRenderer::ConfigureShader( IShader *pShader )
|
void CFunnyWorldRenderer::ConfigureShader( IShader *pShader )
|
||||||
@@ -164,7 +259,7 @@ void CFunnyWorldRenderer::ConfigureShader( IShader *pShader )
|
|||||||
pShader->AddAttribute(0, 2, VERTEX_FORMAT_XYZ32_SFLOAT, 20);
|
pShader->AddAttribute(0, 2, VERTEX_FORMAT_XYZ32_SFLOAT, 20);
|
||||||
// albedo
|
// albedo
|
||||||
pShader->AddOutputImage(0, IMAGE_FORMAT_RGBA8_UNORM);
|
pShader->AddOutputImage(0, IMAGE_FORMAT_RGBA8_UNORM);
|
||||||
pShader->AddOutputImage(1, IMAGE_FORMAT_RGBA16_SFLOAT);
|
pShader->AddOutputImage(1, IMAGE_FORMAT_RGBA16_SNORM);
|
||||||
pShader->AddOutputImage(2, IMAGE_FORMAT_RGBA32_SFLOAT);
|
pShader->AddOutputImage(2, IMAGE_FORMAT_RGBA32_SFLOAT);
|
||||||
|
|
||||||
pShader->SetMultisampling(MULTISAMPLE_TYPE_4_SAMPLES);
|
pShader->SetMultisampling(MULTISAMPLE_TYPE_4_SAMPLES);
|
||||||
@@ -178,43 +273,6 @@ IWorldRenderer *g_pWorldRenderer = &s_renderer;
|
|||||||
|
|
||||||
void CFunnyWorldRenderer::Init()
|
void CFunnyWorldRenderer::Init()
|
||||||
{
|
{
|
||||||
m_pOutputImage = g_pRenderContext->CreateRenderTarget(
|
|
||||||
100,
|
|
||||||
100,
|
|
||||||
IMAGE_FORMAT_RGBA8_UNORM,
|
|
||||||
MULTISAMPLE_TYPE_4_SAMPLES
|
|
||||||
);
|
|
||||||
m_pResolvedOutputImage = g_pRenderContext->CreateRenderTarget(
|
|
||||||
100,
|
|
||||||
100,
|
|
||||||
IMAGE_FORMAT_RGBA8_UNORM,
|
|
||||||
MULTISAMPLE_TYPE_1_SAMPLES
|
|
||||||
);
|
|
||||||
m_pNormalImage = g_pRenderContext->CreateRenderTarget(
|
|
||||||
100,
|
|
||||||
100,
|
|
||||||
IMAGE_FORMAT_RGBA16_SFLOAT,
|
|
||||||
MULTISAMPLE_TYPE_4_SAMPLES
|
|
||||||
);
|
|
||||||
m_pWorldSpaceImage = g_pRenderContext->CreateRenderTarget(
|
|
||||||
100,
|
|
||||||
100,
|
|
||||||
IMAGE_FORMAT_RGBA32_SFLOAT,
|
|
||||||
MULTISAMPLE_TYPE_4_SAMPLES
|
|
||||||
);
|
|
||||||
|
|
||||||
m_pDepthImage = g_pRenderContext->CreateRenderTarget(
|
|
||||||
100,
|
|
||||||
100,
|
|
||||||
IMAGE_FORMAT_D32_SFLOAT,
|
|
||||||
MULTISAMPLE_TYPE_4_SAMPLES
|
|
||||||
);
|
|
||||||
m_pStorageOutputImage = g_pRenderContext->CreateStorageImage(
|
|
||||||
100,
|
|
||||||
100,
|
|
||||||
IMAGE_FORMAT_RGBA16_SFLOAT,
|
|
||||||
MULTISAMPLE_TYPE_1_SAMPLES
|
|
||||||
);
|
|
||||||
m_pRasterShader = g_pRenderContext->CreateShader("game/core/shaders/mesh_raster.shader_c");
|
m_pRasterShader = g_pRenderContext->CreateShader("game/core/shaders/mesh_raster.shader_c");
|
||||||
ConfigureShader(m_pRasterShader);
|
ConfigureShader(m_pRasterShader);
|
||||||
m_pRasterShader->Build();
|
m_pRasterShader->Build();
|
||||||
@@ -232,8 +290,6 @@ void CFunnyWorldRenderer::Init()
|
|||||||
m_pPostProcessing->Build();
|
m_pPostProcessing->Build();
|
||||||
|
|
||||||
m_pPostProcessingMaterial = g_pRenderContext->CreateMaterial(m_pPostProcessing);
|
m_pPostProcessingMaterial = g_pRenderContext->CreateMaterial(m_pPostProcessing);
|
||||||
|
|
||||||
g_pMainWindow->SetOutputImage(m_pResolvedOutputImage);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CFunnyWorldRenderer::Tick( float fDelta )
|
void CFunnyWorldRenderer::Tick( float fDelta )
|
||||||
@@ -242,136 +298,94 @@ void CFunnyWorldRenderer::Tick( float fDelta )
|
|||||||
|
|
||||||
void CFunnyWorldRenderer::Frame( float fDelta )
|
void CFunnyWorldRenderer::Frame( float fDelta )
|
||||||
{
|
{
|
||||||
uint32_t uWidth = g_pMainWindow->GetRenderWidth();
|
for (auto &v: m_viewports)
|
||||||
uint32_t uHeight = g_pMainWindow->GetRenderHeight();
|
|
||||||
mat4 matCamera;
|
|
||||||
mat4 matCamera2;
|
|
||||||
glm_mat4_identity(matCamera);
|
|
||||||
glm_mat4_identity(matCamera2);
|
|
||||||
glm_translate(matCamera2, m_vPos);
|
|
||||||
glm_quat_rotate(matCamera2, m_vRot, matCamera2);
|
|
||||||
glm_mat4_inv(matCamera2, matCamera2);
|
|
||||||
glm_perspective(glm_rad(75), uWidth/(float)uHeight, 0.01, 10000, matCamera);
|
|
||||||
glm_mul(matCamera, matCamera2, matCamera);
|
|
||||||
m_pViewBufferData = (ViewBuffer_t*)m_pViewBuffer->Map();
|
|
||||||
m_pViewBuffer->Lock();
|
|
||||||
V_memcpy(&m_pViewBufferData->m_matCameraProjection, matCamera, sizeof(matCamera));
|
|
||||||
V_memcpy(&m_pViewBufferData->m_vCameraPosition, m_vPos, sizeof(vec3));
|
|
||||||
m_pViewBuffer->Unlock();
|
|
||||||
m_pViewBuffer->Unmap();
|
|
||||||
|
|
||||||
if (g_pMainWindow->BRenderSizeUpdated())
|
|
||||||
{
|
{
|
||||||
g_pRenderContext->DestroyImage(m_pOutputImage);
|
uint32_t uWidth = v->m_uX;
|
||||||
g_pRenderContext->DestroyImage(m_pResolvedOutputImage);
|
uint32_t uHeight = v->m_uY;
|
||||||
g_pRenderContext->DestroyImage(m_pNormalImage);
|
mat4 matCamera;
|
||||||
g_pRenderContext->DestroyImage(m_pWorldSpaceImage);
|
mat4 matCamera2;
|
||||||
g_pRenderContext->DestroyImage(m_pDepthImage);
|
glm_mat4_identity(matCamera);
|
||||||
g_pRenderContext->DestroyImage(m_pStorageOutputImage);
|
glm_mat4_identity(matCamera2);
|
||||||
|
glm_translate(matCamera2, v->m_vPos);
|
||||||
|
glm_quat_rotate(matCamera2, v->m_qRot, matCamera2);
|
||||||
|
glm_mat4_inv(matCamera2, matCamera2);
|
||||||
|
glm_perspective(glm_rad(v->m_fFov), uWidth/(float)uHeight, 0.01, 10000, matCamera);
|
||||||
|
glm_mul(matCamera, matCamera2, matCamera);
|
||||||
|
m_pViewBufferData = (ViewBuffer_t*)m_pViewBuffer->Map();
|
||||||
|
m_pViewBuffer->Lock();
|
||||||
|
V_memcpy(&m_pViewBufferData->m_matCameraProjection, matCamera, sizeof(matCamera));
|
||||||
|
V_memcpy(&m_pViewBufferData->m_vCameraPosition, v->m_vPos, sizeof(vec3));
|
||||||
|
m_pViewBuffer->Unlock();
|
||||||
|
m_pViewBuffer->Unmap();
|
||||||
|
|
||||||
m_pOutputImage = g_pRenderContext->CreateRenderTarget(
|
m_pRasterCommandList->StartRecording();
|
||||||
g_pMainWindow->GetRenderWidth(),
|
m_pRasterCommandList->SetRenderResolution(uWidth, uHeight);
|
||||||
g_pMainWindow->GetRenderHeight(),
|
m_pRasterCommandList->SetRenderTarget(0, v->m_pColor);
|
||||||
IMAGE_FORMAT_RGBA8_UNORM,
|
m_pRasterCommandList->SetRenderTarget(1, v->m_pNormal);
|
||||||
MULTISAMPLE_TYPE_4_SAMPLES);
|
m_pRasterCommandList->SetRenderTarget(2, v->m_pWorldCoords);
|
||||||
m_pResolvedOutputImage = g_pRenderContext->CreateRenderTarget(
|
m_pRasterCommandList->SetDepthTarget(v->m_pDepth);
|
||||||
g_pMainWindow->GetRenderWidth(),
|
m_pRasterCommandList->SetViewport(0, 0, uWidth, uHeight, 0, 1);
|
||||||
g_pMainWindow->GetRenderHeight(),
|
m_pRasterCommandList->SetScissors(0, 0, uWidth, uHeight);
|
||||||
IMAGE_FORMAT_RGBA8_UNORM,
|
m_pRasterCommandList->SetClearColor(0, 0, 0, 0, 0);
|
||||||
MULTISAMPLE_TYPE_1_SAMPLES);
|
m_pRasterCommandList->SetClearColor(1, 0, 0, 0, 0);
|
||||||
|
m_pRasterCommandList->SetClearColor(2, 0, 0, 0, 0);
|
||||||
m_pNormalImage = g_pRenderContext->CreateRenderTarget(
|
m_pRasterCommandList->SetClearDepth(1);
|
||||||
g_pMainWindow->GetRenderWidth(),
|
m_pRasterCommandList->SetLoadStoreModes(0, LOAD_MODE_CLEAR, STORE_MODE_STORE);
|
||||||
g_pMainWindow->GetRenderHeight(),
|
m_pRasterCommandList->SetLoadStoreModes(1, LOAD_MODE_CLEAR, STORE_MODE_STORE);
|
||||||
IMAGE_FORMAT_RGBA16_SFLOAT,
|
m_pRasterCommandList->SetLoadStoreModes(2, LOAD_MODE_CLEAR, STORE_MODE_STORE);
|
||||||
MULTISAMPLE_TYPE_4_SAMPLES
|
uint32_t uTotalMeshes = 0;
|
||||||
);
|
uint32_t u = 0;
|
||||||
m_pWorldSpaceImage = g_pRenderContext->CreateRenderTarget(
|
for ( auto mesh: m_pMeshes)
|
||||||
g_pMainWindow->GetRenderWidth(),
|
|
||||||
g_pMainWindow->GetRenderHeight(),
|
|
||||||
IMAGE_FORMAT_RGBA32_SFLOAT,
|
|
||||||
MULTISAMPLE_TYPE_4_SAMPLES
|
|
||||||
);
|
|
||||||
m_pDepthImage = g_pRenderContext->CreateRenderTarget(
|
|
||||||
g_pMainWindow->GetRenderWidth(),
|
|
||||||
g_pMainWindow->GetRenderHeight(),
|
|
||||||
IMAGE_FORMAT_D32_SFLOAT,
|
|
||||||
MULTISAMPLE_TYPE_4_SAMPLES);
|
|
||||||
m_pStorageOutputImage = g_pRenderContext->CreateStorageImage(
|
|
||||||
g_pMainWindow->GetRenderWidth(),
|
|
||||||
g_pMainWindow->GetRenderHeight(),
|
|
||||||
IMAGE_FORMAT_RGBA16_SFLOAT,
|
|
||||||
MULTISAMPLE_TYPE_1_SAMPLES
|
|
||||||
);
|
|
||||||
g_pMainWindow->SetOutputImage(m_pStorageOutputImage);
|
|
||||||
}
|
|
||||||
m_pRasterCommandList->StartRecording();
|
|
||||||
m_pRasterCommandList->SetRenderResolution(uWidth, uHeight);
|
|
||||||
m_pRasterCommandList->SetRenderTarget(0, m_pOutputImage);
|
|
||||||
m_pRasterCommandList->SetRenderTarget(1, m_pNormalImage);
|
|
||||||
m_pRasterCommandList->SetRenderTarget(2, m_pWorldSpaceImage);
|
|
||||||
m_pRasterCommandList->SetDepthTarget(m_pDepthImage);
|
|
||||||
m_pRasterCommandList->SetViewport(0, 0, uWidth, uHeight, 0, 1);
|
|
||||||
m_pRasterCommandList->SetScissors(0, 0, uWidth, uHeight);
|
|
||||||
m_pRasterCommandList->SetClearColor(0, 0, 0, 0, 0);
|
|
||||||
m_pRasterCommandList->SetClearColor(1, 0, 0, 0, 0);
|
|
||||||
m_pRasterCommandList->SetClearColor(2, 0, 0, 0, 0);
|
|
||||||
m_pRasterCommandList->SetClearDepth(1);
|
|
||||||
m_pRasterCommandList->SetLoadStoreModes(0, LOAD_MODE_CLEAR, STORE_MODE_STORE);
|
|
||||||
m_pRasterCommandList->SetLoadStoreModes(1, LOAD_MODE_CLEAR, STORE_MODE_STORE);
|
|
||||||
m_pRasterCommandList->SetLoadStoreModes(2, LOAD_MODE_CLEAR, STORE_MODE_STORE);
|
|
||||||
uint32_t uTotalMeshes = 0;
|
|
||||||
uint32_t u = 0;
|
|
||||||
for ( auto mesh: m_pMeshes)
|
|
||||||
{
|
|
||||||
uTotalMeshes+=mesh->m_instances.GetSize();
|
|
||||||
}
|
|
||||||
if (!uTotalMeshes)
|
|
||||||
return;
|
|
||||||
IBuffer *pDataBuffer = g_pRenderContext->CreateStorageBuffer(uTotalMeshes*sizeof(PerMeshData_t));
|
|
||||||
pDataBuffer->Lock();
|
|
||||||
void *pData = pDataBuffer->Map();
|
|
||||||
for ( auto mesh: m_pMeshes)
|
|
||||||
{
|
|
||||||
if (mesh->m_instances.GetSize()==0)
|
|
||||||
continue;
|
|
||||||
for ( uint32_t i = 0; i < mesh->m_instances.GetSize(); i++ )
|
|
||||||
{
|
{
|
||||||
mesh->m_instances[i]->Frame();
|
uTotalMeshes+=mesh->m_instances.GetSize();
|
||||||
V_memcpy(&((PerMeshData_t*)pData)[i+u], &mesh->m_instances[i]->m_data, sizeof(PerMeshData_t));
|
|
||||||
}
|
}
|
||||||
u+=mesh->m_instances.GetSize();
|
if (!uTotalMeshes)
|
||||||
|
return;
|
||||||
|
IBuffer *pDataBuffer = g_pRenderContext->CreateStorageBuffer(uTotalMeshes*sizeof(PerMeshData_t));
|
||||||
|
pDataBuffer->Lock();
|
||||||
|
void *pData = pDataBuffer->Map();
|
||||||
|
for ( auto mesh: m_pMeshes)
|
||||||
|
{
|
||||||
|
if (mesh->m_instances.GetSize()==0)
|
||||||
|
continue;
|
||||||
|
for ( uint32_t i = 0; i < mesh->m_instances.GetSize(); i++ )
|
||||||
|
{
|
||||||
|
mesh->m_instances[i]->Frame();
|
||||||
|
V_memcpy(&((PerMeshData_t*)pData)[i+u], &mesh->m_instances[i]->m_data, sizeof(PerMeshData_t));
|
||||||
|
}
|
||||||
|
u+=mesh->m_instances.GetSize();
|
||||||
|
}
|
||||||
|
pDataBuffer->Unmap();
|
||||||
|
pDataBuffer->Unlock();
|
||||||
|
g_pRenderContext->DestroyBuffer(pDataBuffer);
|
||||||
|
|
||||||
|
m_pRasterMaterial->VSSetConstantsBuffer(0, m_pViewBuffer);
|
||||||
|
m_pRasterMaterial->VSSetConstantsBuffer(1, pDataBuffer);
|
||||||
|
m_pRasterMaterial->PSSetTextureArray(1, m_pTextures);
|
||||||
|
|
||||||
|
m_pRasterCommandList->SetMaterial(m_pRasterMaterial);
|
||||||
|
u = 0;
|
||||||
|
for ( auto mesh: m_pMeshes)
|
||||||
|
{
|
||||||
|
if (mesh->m_instances.GetSize()==0)
|
||||||
|
continue;
|
||||||
|
m_pRasterCommandList->SetVertexBuffer(0, mesh->m_pVertexBuffer);
|
||||||
|
m_pRasterCommandList->DrawPrimitives(mesh->m_pVertexBuffer->GetSize()/32, 0, mesh->m_instances.GetSize(), u);
|
||||||
|
u += mesh->m_instances.GetSize();
|
||||||
|
}
|
||||||
|
|
||||||
|
m_pRasterCommandList->ResolveImage(v->m_pColor, v->m_pColorResolved);
|
||||||
|
|
||||||
|
m_pPostProcessingMaterial->CSSetTexture(0, 0, v->m_pColorResolved);
|
||||||
|
m_pPostProcessingMaterial->CSSetTexture(1, 0, v->m_pRenderImage);
|
||||||
|
m_pRasterCommandList->SetMaterial(m_pPostProcessingMaterial);
|
||||||
|
m_pRasterCommandList->Barrier(v->m_pColorResolved, true, false);
|
||||||
|
m_pRasterCommandList->Barrier(v->m_pRenderImage, false, true);
|
||||||
|
m_pRasterCommandList->DispatchCompute(uWidth, uHeight, 1);
|
||||||
|
m_pRasterCommandList->EndRecording();
|
||||||
|
|
||||||
|
g_pRenderContext->SubmitCommandList(m_pRasterCommandList);
|
||||||
}
|
}
|
||||||
pDataBuffer->Unmap();
|
|
||||||
pDataBuffer->Unlock();
|
|
||||||
g_pRenderContext->DestroyBuffer(pDataBuffer);
|
|
||||||
|
|
||||||
m_pRasterMaterial->VSSetConstantsBuffer(0, m_pViewBuffer);
|
|
||||||
m_pRasterMaterial->VSSetConstantsBuffer(1, pDataBuffer);
|
|
||||||
m_pRasterMaterial->PSSetTextureArray(1, m_pTextures);
|
|
||||||
|
|
||||||
m_pRasterCommandList->SetMaterial(m_pRasterMaterial);
|
|
||||||
u = 0;
|
|
||||||
for ( auto mesh: m_pMeshes)
|
|
||||||
{
|
|
||||||
if (mesh->m_instances.GetSize()==0)
|
|
||||||
continue;
|
|
||||||
m_pRasterCommandList->SetVertexBuffer(0, mesh->m_pVertexBuffer);
|
|
||||||
m_pRasterCommandList->DrawPrimitives(mesh->m_pVertexBuffer->GetSize()/32, 0, mesh->m_instances.GetSize(), u);
|
|
||||||
u += mesh->m_instances.GetSize();
|
|
||||||
}
|
|
||||||
|
|
||||||
m_pRasterCommandList->ResolveImage(m_pOutputImage, m_pResolvedOutputImage);
|
|
||||||
|
|
||||||
m_pPostProcessingMaterial->CSSetTexture(0, 0, m_pResolvedOutputImage);
|
|
||||||
m_pPostProcessingMaterial->CSSetTexture(1, 0, m_pStorageOutputImage);
|
|
||||||
m_pRasterCommandList->SetMaterial(m_pPostProcessingMaterial);
|
|
||||||
m_pRasterCommandList->Barrier(m_pResolvedOutputImage, true, false);
|
|
||||||
m_pRasterCommandList->Barrier(m_pStorageOutputImage, false, true);
|
|
||||||
m_pRasterCommandList->DispatchCompute(uWidth, uHeight, 1);
|
|
||||||
m_pRasterCommandList->EndRecording();
|
|
||||||
|
|
||||||
g_pRenderContext->SubmitCommandList(m_pRasterCommandList);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CFunnyWorldRenderer::Shutdown()
|
void CFunnyWorldRenderer::Shutdown()
|
||||||
@@ -379,23 +393,6 @@ void CFunnyWorldRenderer::Shutdown()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CFunnyWorldRenderer::SetCameraRotation( Quat vRotation )
|
|
||||||
{
|
|
||||||
m_vRot[0] = vRotation.x;
|
|
||||||
m_vRot[1] = vRotation.y;
|
|
||||||
m_vRot[2] = vRotation.z;
|
|
||||||
m_vRot[3] = vRotation.w;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CFunnyWorldRenderer::SetCameraPosition( Vector vPosition )
|
|
||||||
{
|
|
||||||
m_vPos[0] = vPosition.x;
|
|
||||||
m_vPos[1] = vPosition.y;
|
|
||||||
m_vPos[2] = vPosition.z;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
IMesh *CFunnyWorldRenderer::CreateMesh( const char *szName )
|
IMesh *CFunnyWorldRenderer::CreateMesh( const char *szName )
|
||||||
{
|
{
|
||||||
CFunnyMesh *pMesh = new CFunnyMesh;
|
CFunnyMesh *pMesh = new CFunnyMesh;
|
||||||
@@ -440,3 +437,26 @@ ITextureArray *CFunnyWorldRenderer::GetTextures()
|
|||||||
return m_pTextures;
|
return m_pTextures;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IViewport *CFunnyWorldRenderer::CreateViewport( uint32_t uX, uint32_t uY )
|
||||||
|
{
|
||||||
|
CFunnyViewport *pViewport = new CFunnyViewport;
|
||||||
|
pViewport->UpdateResolution(uX, uY);
|
||||||
|
m_viewports.AppendTail(pViewport);
|
||||||
|
return pViewport;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFunnyWorldRenderer::DestroyViewport( IViewport *pViewport )
|
||||||
|
{
|
||||||
|
for ( uint32_t i = 0; i < m_viewports.GetSize(); i++ )
|
||||||
|
{
|
||||||
|
if (m_viewports[i] == pViewport)
|
||||||
|
{
|
||||||
|
m_viewports.RemoveAt(i);
|
||||||
|
delete (CFunnyViewport*)pViewport;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,22 @@
|
|||||||
|
|
||||||
#include "cglm/mat4.h"
|
#include "cglm/mat4.h"
|
||||||
|
|
||||||
|
abstract_class IViewport
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void UpdateResolution( uint32_t uX, uint32_t uY ) = 0;
|
||||||
|
|
||||||
|
virtual IImage *GetRenderImage() = 0;
|
||||||
|
virtual IImage *GetDepthImage() = 0;
|
||||||
|
virtual IImage *GetNormalImage() = 0;
|
||||||
|
|
||||||
|
virtual void SetFOV( float f ) = 0;
|
||||||
|
virtual void SetPosition( Vector v ) = 0;
|
||||||
|
virtual void SetRotation( Quat q ) = 0;
|
||||||
|
|
||||||
|
virtual uint32_t GetWidth() = 0;
|
||||||
|
virtual uint32_t GetHeight() = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
abstract_class IMesh
|
abstract_class IMesh
|
||||||
@@ -27,8 +43,6 @@ public:
|
|||||||
virtual void SetColor( Vector vColor ) = 0;
|
virtual void SetColor( Vector vColor ) = 0;
|
||||||
virtual void SetRadius( Vector vColor ) = 0;
|
virtual void SetRadius( Vector vColor ) = 0;
|
||||||
virtual void SetPosition( Vector vPosition ) = 0;
|
virtual void SetPosition( Vector vPosition ) = 0;
|
||||||
virtual void SetRotation( Quat vRotation ) = 0;
|
|
||||||
virtual void SetScale( Vector vScale ) = 0;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
abstract_class IMeshInstance
|
abstract_class IMeshInstance
|
||||||
@@ -43,19 +57,20 @@ public:
|
|||||||
abstract_class IWorldRenderer: public IGameSystem
|
abstract_class IWorldRenderer: public IGameSystem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual void SetCameraRotation( Quat vRotation ) = 0;
|
|
||||||
virtual void SetCameraPosition( Vector vPosition ) = 0;
|
|
||||||
|
|
||||||
virtual IMesh *CreateMesh( const char *szName ) = 0;
|
virtual IMesh *CreateMesh( const char *szName ) = 0;
|
||||||
virtual IMeshInstance *CreateInstance( IMesh *pMesh ) = 0;
|
virtual IMeshInstance *CreateInstance( IMesh *pMesh ) = 0;
|
||||||
virtual void DestroyMeshInstance( IMesh *pMesh, IMeshInstance *pInstance ) = 0;
|
virtual void DestroyMeshInstance( IMesh *pMesh, IMeshInstance *pInstance ) = 0;
|
||||||
virtual void DestroyMesh( IMesh *pMesh ) = 0;
|
virtual void DestroyMesh( IMesh *pMesh ) = 0;
|
||||||
|
|
||||||
|
virtual IViewport *CreateViewport( uint32_t uX, uint32_t uY ) = 0;
|
||||||
|
virtual void DestroyViewport( IViewport *pViewport ) = 0;
|
||||||
|
|
||||||
virtual void ConfigureShader( IShader *pShader ) = 0;
|
virtual void ConfigureShader( IShader *pShader ) = 0;
|
||||||
|
|
||||||
virtual ITextureArray *GetTextures() = 0;
|
virtual ITextureArray *GetTextures() = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
extern IWorldRenderer *g_pWorldRenderer;
|
extern IWorldRenderer *g_pWorldRenderer;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -9,27 +9,48 @@ ADD_DEPENDENCY_BUILD_FILE(cfg, ROOT"buildcfg.cpp");
|
|||||||
ADD_DEPENDENCY_BUILD_FILE(tier0, FUNNYSTDLIB"tier0/build.cpp");
|
ADD_DEPENDENCY_BUILD_FILE(tier0, FUNNYSTDLIB"tier0/build.cpp");
|
||||||
ADD_DEPENDENCY_BUILD_FILE(tier1, FUNNYSTDLIB"tier1/build.cpp");
|
ADD_DEPENDENCY_BUILD_FILE(tier1, FUNNYSTDLIB"tier1/build.cpp");
|
||||||
ADD_DEPENDENCY_BUILD_FILE(tier2, FUNNYSTDLIB"tier2/build.cpp");
|
ADD_DEPENDENCY_BUILD_FILE(tier2, FUNNYSTDLIB"tier2/build.cpp");
|
||||||
|
|
||||||
|
CUtlVector<CUtlString> milmoba = {
|
||||||
|
"../shared/game.cpp",
|
||||||
|
"../shared/boneanimation.cpp",
|
||||||
|
|
||||||
|
"game.cpp",
|
||||||
|
"assetmgr.cpp",
|
||||||
|
"worldsystem.cpp",
|
||||||
|
|
||||||
|
"entitysystem.cpp",
|
||||||
|
"baseentity.cpp",
|
||||||
|
"basemodelentity.cpp",
|
||||||
|
"physicsprop.cpp",
|
||||||
|
|
||||||
|
"milmoba/player.cpp",
|
||||||
|
};
|
||||||
|
CUtlVector<CUtlString> kbt_vt_psy = {
|
||||||
|
"../shared/game.cpp",
|
||||||
|
"../shared/boneanimation.cpp",
|
||||||
|
|
||||||
|
"game.cpp",
|
||||||
|
"assetmgr.cpp",
|
||||||
|
"worldsystem.cpp",
|
||||||
|
|
||||||
|
"entitysystem.cpp",
|
||||||
|
"baseentity.cpp",
|
||||||
|
"basemodelentity.cpp",
|
||||||
|
"physicsprop.cpp",
|
||||||
|
|
||||||
|
"kbt_vr_psy/events.cpp",
|
||||||
|
"kbt_vr_psy/pickable.cpp",
|
||||||
|
"kbt_vr_psy/interactable.cpp",
|
||||||
|
"kbt_vr_psy/player.cpp",
|
||||||
|
};
|
||||||
|
|
||||||
DECLARE_BUILD_STAGE(Server)
|
DECLARE_BUILD_STAGE(Server)
|
||||||
{
|
{
|
||||||
CProject_t compileProject = {};
|
CProject_t compileProject = {};
|
||||||
LinkProject_t ldProject = {};
|
LinkProject_t ldProject = {};
|
||||||
|
|
||||||
compileProject.m_szName = "server";
|
compileProject.m_szName = "server";
|
||||||
compileProject.files = {
|
compileProject.files = milmoba;
|
||||||
"../shared/game.cpp",
|
|
||||||
"../shared/boneanimation.cpp",
|
|
||||||
|
|
||||||
"game.cpp",
|
|
||||||
"assetmgr.cpp",
|
|
||||||
"worldsystem.cpp",
|
|
||||||
|
|
||||||
"entitysystem.cpp",
|
|
||||||
"baseentity.cpp",
|
|
||||||
"basemodelentity.cpp",
|
|
||||||
"physicsprop.cpp",
|
|
||||||
|
|
||||||
"milmoba/player.cpp",
|
|
||||||
};
|
|
||||||
compileProject.includeDirectories = {
|
compileProject.includeDirectories = {
|
||||||
"../../public",
|
"../../public",
|
||||||
".",
|
".",
|
||||||
|
|||||||
0
game/server/kbt_vr_psy/experience.cpp
Normal file
0
game/server/kbt_vr_psy/experience.cpp
Normal file
0
game/server/kbt_vr_psy/interactable.cpp
Normal file
0
game/server/kbt_vr_psy/interactable.cpp
Normal file
0
game/server/kbt_vr_psy/observer_ingame.cpp
Normal file
0
game/server/kbt_vr_psy/observer_ingame.cpp
Normal file
0
game/server/kbt_vr_psy/player.cpp
Normal file
0
game/server/kbt_vr_psy/player.cpp
Normal file
@@ -37,6 +37,7 @@ void *pEngineLib = NULL;
|
|||||||
void *pTier0Lib = NULL;
|
void *pTier0Lib = NULL;
|
||||||
typedef void (*EngineMainFn)(int argc, char** argv);
|
typedef void (*EngineMainFn)(int argc, char** argv);
|
||||||
EngineMainFn pEngineMain;
|
EngineMainFn pEngineMain;
|
||||||
|
extern void FunnyMain(int argc, char** argv);
|
||||||
|
|
||||||
int main( int argc, char **argv ) {
|
int main( int argc, char **argv ) {
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
@@ -99,6 +100,6 @@ int main( int argc, char **argv ) {
|
|||||||
SetCurrentDirectoryA(szLauncherPath);
|
SetCurrentDirectoryA(szLauncherPath);
|
||||||
pEngineMain(argc, argv);
|
pEngineMain(argc, argv);
|
||||||
#endif
|
#endif
|
||||||
//FunnyMain(argc, argv);
|
FunnyMain(argc, argv);
|
||||||
//return 0;
|
return 0;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -46,9 +46,9 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
VkSurfaceKHR m_hSurface;
|
VkSurfaceKHR m_hSurface = NULL;
|
||||||
SDL_Window *m_pWindow;
|
SDL_Window *m_pWindow = NULL;
|
||||||
IImage *m_pOutputImage;
|
IImage *m_pOutputImage = NULL;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -750,7 +750,6 @@ IImage *CVkRenderContext::CreateImageFromVkImage( void *pVkImage, uint32_t x, ui
|
|||||||
}
|
}
|
||||||
|
|
||||||
VkPipelineLayout g_pLibraryEmptyLayout;
|
VkPipelineLayout g_pLibraryEmptyLayout;
|
||||||
static IVkCommandBuffer *s_pPresentCommandBuffer;
|
|
||||||
void CVkRenderContext::Init()
|
void CVkRenderContext::Init()
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -984,13 +983,12 @@ void CVkRenderContext::Frame( float fDeltaTime )
|
|||||||
if (m_pXRManager)
|
if (m_pXRManager)
|
||||||
m_pXRManager->PreRender();
|
m_pXRManager->PreRender();
|
||||||
|
|
||||||
|
IRenderCommandList *pList = CreateCommandList();
|
||||||
|
pList->StartRecording();
|
||||||
|
|
||||||
s_pPresentCommandBuffer = m_pCommandBufferManager->CreateCommandBuffer();
|
|
||||||
s_pPresentCommandBuffer->Reset();
|
|
||||||
|
|
||||||
double a = Plat_GetTime();
|
double a = Plat_GetTime();
|
||||||
i = 0;
|
i = 0;
|
||||||
CVkEmptyCommand *pEmptyCommand = CREATE_COMMAND(m_pCommandBufferManager, Empty);
|
|
||||||
for ( auto &s: m_renderWindows )
|
for ( auto &s: m_renderWindows )
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -998,30 +996,24 @@ void CVkRenderContext::Frame( float fDeltaTime )
|
|||||||
CVkBlitCommand *pBlitCommand = NULL;
|
CVkBlitCommand *pBlitCommand = NULL;
|
||||||
if (s.m_pWindow->GetOutputImage())
|
if (s.m_pWindow->GetOutputImage())
|
||||||
{
|
{
|
||||||
pBlitCommand = CREATE_COMMAND(m_pCommandBufferManager, Blit);
|
|
||||||
pBlitCommand->AddDependency(s.m_pWindow->GetOutputImage(), DEPENDENCY_MODE_BLIT_IMAGE_SOURCE);
|
|
||||||
pBlitCommand->AddDependency((IRenderingObject*)s.m_images[uSwapchainImageIndexes[i]], DEPENDENCY_MODE_BLIT_IMAGE_DESTINATION);
|
|
||||||
pBlitCommand->stInputImage.m_eObjectType = FRAME_OBJECT_TYPE_SINGLE;
|
|
||||||
pBlitCommand->stInputImage.m_pSingle = s.m_pWindow->GetOutputImage();
|
|
||||||
pBlitCommand->stOutputImage.m_eObjectType = FRAME_OBJECT_TYPE_SINGLE;
|
|
||||||
pBlitCommand->stOutputImage.m_pSingle = (IRenderingObject*)s.m_images[uSwapchainImageIndexes[i]];
|
|
||||||
pBlitCommand->iSrcMax[0] = s.m_pWindow->GetOutputImage()->GetImageWidth();
|
|
||||||
pBlitCommand->iSrcMax[1] = s.m_pWindow->GetOutputImage()->GetImageHeight();
|
|
||||||
pBlitCommand->iSrcMax[2] = 1;
|
|
||||||
pBlitCommand->iDstMax[0] = s.m_pWindow->GetRenderWidth();
|
|
||||||
pBlitCommand->iDstMax[1] = s.m_pWindow->GetRenderHeight();
|
|
||||||
pBlitCommand->iDstMax[2] = 1;
|
|
||||||
|
|
||||||
pEmptyCommand->AddDependency((IRenderingObject*)s.m_images[uSwapchainImageIndexes[i]], DEPENDENCY_MODE_IMAGE_PRESENT);
|
ImageSector_t src = {};
|
||||||
|
src.m_iWidth = s.m_pWindow->GetOutputImage()->GetImageWidth();
|
||||||
|
src.m_iHeight = s.m_pWindow->GetOutputImage()->GetImageHeight();
|
||||||
|
src.m_iX = 0;
|
||||||
|
src.m_iY = 0;
|
||||||
|
ImageSector_t dst = {};
|
||||||
|
dst.m_iWidth = s.m_pWindow->GetRenderWidth();
|
||||||
|
dst.m_iHeight = s.m_pWindow->GetRenderHeight();
|
||||||
|
dst.m_iX = 0;
|
||||||
|
dst.m_iY = 0;
|
||||||
|
pList->BlitImageToImage(s.m_pWindow->GetOutputImage(), src, s.m_images[uSwapchainImageIndexes[i]], dst);
|
||||||
}
|
}
|
||||||
if (pBlitCommand != NULL)
|
|
||||||
s_pPresentCommandBuffer->AddCommand(pBlitCommand);
|
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
s_pPresentCommandBuffer->AddCommand(pEmptyCommand);
|
pList->EndRecording();
|
||||||
|
SubmitCommandList(pList);
|
||||||
s_pPresentCommandBuffer->Render();
|
DestroyCommandList(pList);
|
||||||
s_pPresentCommandBuffer->Submit(0);
|
|
||||||
|
|
||||||
if (m_pXRManager)
|
if (m_pXRManager)
|
||||||
m_pXRManager->CopySwapchain();
|
m_pXRManager->CopySwapchain();
|
||||||
@@ -1066,13 +1058,22 @@ void CVkRenderContext::Frame( float fDeltaTime )
|
|||||||
{
|
{
|
||||||
delete a;
|
delete a;
|
||||||
}
|
}
|
||||||
|
for (auto &a: m_scheduledRemovalImages)
|
||||||
|
{
|
||||||
|
delete a;
|
||||||
|
}
|
||||||
|
for (auto &a: m_scheduledRemovalTextureArrays)
|
||||||
|
{
|
||||||
|
delete a;
|
||||||
|
}
|
||||||
for (auto &a: m_scheduledRemovalLists)
|
for (auto &a: m_scheduledRemovalLists)
|
||||||
{
|
{
|
||||||
delete a;
|
delete a;
|
||||||
}
|
}
|
||||||
m_scheduledRemovalLists = {};
|
m_scheduledRemovalLists = {};
|
||||||
|
m_scheduledRemovalImages = {};
|
||||||
|
m_scheduledRemovalTextureArrays = {};
|
||||||
m_scheduledRemovalBuffers = {};
|
m_scheduledRemovalBuffers = {};
|
||||||
m_pCommandBufferManager->FreeCommandBufferWithCommands(s_pPresentCommandBuffer);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -44,6 +44,24 @@ void CVkShader::DisablePixelShader( bool bDisable )
|
|||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
void CVkShader::SetBlendingMode( int iImageIndex,
|
||||||
|
EBlendingFactor eSrcColor,
|
||||||
|
EBlendingFactor eDstColor,
|
||||||
|
EBlendingOp eColorOp,
|
||||||
|
EBlendingFactor eSrcAlpha,
|
||||||
|
EBlendingFactor eDstAlpha,
|
||||||
|
EBlendingOp eAlphaOp
|
||||||
|
)
|
||||||
|
{
|
||||||
|
m_formats[iImageIndex].eSrcColor = eSrcColor;
|
||||||
|
m_formats[iImageIndex].eDstColor = eDstColor;
|
||||||
|
m_formats[iImageIndex].eColorOp = eColorOp;
|
||||||
|
|
||||||
|
m_formats[iImageIndex].eSrcAlpha = eSrcAlpha;
|
||||||
|
m_formats[iImageIndex].eDstAlpha = eDstAlpha;
|
||||||
|
m_formats[iImageIndex].eAlphaOp = eAlphaOp;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void CVkShader::Build()
|
void CVkShader::Build()
|
||||||
|
|||||||
@@ -276,6 +276,12 @@ struct VkOutputImageConfig_t
|
|||||||
{
|
{
|
||||||
VkFormat m_eFormat;
|
VkFormat m_eFormat;
|
||||||
bool m_bIsBlendingEnabled;
|
bool m_bIsBlendingEnabled;
|
||||||
|
EBlendingFactor eSrcColor;
|
||||||
|
EBlendingFactor eDstColor;
|
||||||
|
EBlendingOp eColorOp;
|
||||||
|
EBlendingFactor eSrcAlpha;
|
||||||
|
EBlendingFactor eDstAlpha;
|
||||||
|
EBlendingOp eAlphaOp;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CVkShader : public IShader
|
class CVkShader : public IShader
|
||||||
@@ -289,6 +295,15 @@ public:
|
|||||||
virtual void SetDepthImage( EImageFormat eFormat ) override;
|
virtual void SetDepthImage( EImageFormat eFormat ) override;
|
||||||
virtual void SetMultisampling( EMultisampleType eFormat ) override;
|
virtual void SetMultisampling( EMultisampleType eFormat ) override;
|
||||||
virtual void DisablePixelShader( bool bDisable ) override;
|
virtual void DisablePixelShader( bool bDisable ) override;
|
||||||
|
virtual void SetBlendingMode( int iImageIndex,
|
||||||
|
EBlendingFactor eSrcColor,
|
||||||
|
EBlendingFactor eDstColor,
|
||||||
|
EBlendingOp eColorOp,
|
||||||
|
EBlendingFactor eSrcAlpha,
|
||||||
|
EBlendingFactor eDstAlpha,
|
||||||
|
EBlendingOp eAlphaOp
|
||||||
|
) override;
|
||||||
|
|
||||||
virtual void Build() override;
|
virtual void Build() override;
|
||||||
|
|
||||||
VkPipeline m_hPipeline = NULL;
|
VkPipeline m_hPipeline = NULL;
|
||||||
|
|||||||
@@ -126,6 +126,37 @@ enum ETopologyMode
|
|||||||
TOPOLOGY_MODE_TRIANGLE_STRIP,
|
TOPOLOGY_MODE_TRIANGLE_STRIP,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum EBlendingFactor
|
||||||
|
{
|
||||||
|
BLENDING_FACTOR_ZERO,
|
||||||
|
BLENDING_FACTOR_ONE,
|
||||||
|
BLENDING_FACTOR_SRC_COLOR,
|
||||||
|
BLENDING_FACTOR_ONE_MINUS_SRC_COLOR,
|
||||||
|
BLENDING_FACTOR_DST_COLOR,
|
||||||
|
BLENDING_FACTOR_ONE_MINUS_DST_COLOR,
|
||||||
|
BLENDING_FACTOR_SRC_ALPHA,
|
||||||
|
BLENDING_FACTOR_ONE_MINUS_SRC_ALPHA ,
|
||||||
|
BLENDING_FACTOR_DST_ALPHA,
|
||||||
|
BLENDING_FACTOR_ONE_MINUS_DST_ALPHA,
|
||||||
|
BLENDING_FACTOR_CONSTANT_COLOR,
|
||||||
|
BLENDING_FACTOR_ONE_MINUS_CONSTANT_COLOR ,
|
||||||
|
BLENDING_FACTOR_CONSTANT_ALPHA,
|
||||||
|
BLENDING_FACTOR_ONE_MINUS_CONSTANT_ALPHA,
|
||||||
|
BLENDING_FACTOR_SRC_ALPHA_SATURATE,
|
||||||
|
BLENDING_FACTOR_SRC1_COLOR,
|
||||||
|
BLENDING_FACTOR_ONE_MINUS_SRC1_COLOR,
|
||||||
|
BLENDING_FACTOR_SRC1_ALPHA,
|
||||||
|
BLENDING_FACTOR_ONE_MINUS_SRC1_ALPHA,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum EBlendingOp
|
||||||
|
{
|
||||||
|
BLENDING_OP_ADD,
|
||||||
|
BLENDING_OP_SUBTRACT,
|
||||||
|
BLENDING_OP_REVERSE_SUBTRACT,
|
||||||
|
BLENDING_OP_MIN,
|
||||||
|
BLENDING_OP_MAX,
|
||||||
|
};
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Basic rendering object
|
// Basic rendering object
|
||||||
@@ -225,6 +256,14 @@ public:
|
|||||||
virtual void SetDepthImage( EImageFormat eFormat ) = 0;
|
virtual void SetDepthImage( EImageFormat eFormat ) = 0;
|
||||||
virtual void SetMultisampling( EMultisampleType eFormat ) = 0;
|
virtual void SetMultisampling( EMultisampleType eFormat ) = 0;
|
||||||
virtual void DisablePixelShader( bool bDisable) = 0;
|
virtual void DisablePixelShader( bool bDisable) = 0;
|
||||||
|
virtual void SetBlendingMode( int iImageIndex,
|
||||||
|
EBlendingFactor eSrcColor,
|
||||||
|
EBlendingFactor eDstColor,
|
||||||
|
EBlendingOp eColorOp,
|
||||||
|
EBlendingFactor eSrcAlpha,
|
||||||
|
EBlendingFactor eDstAlpha,
|
||||||
|
EBlendingOp eAlphaOp
|
||||||
|
) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
abstract_class IComputeShader: public IBaseShader
|
abstract_class IComputeShader: public IBaseShader
|
||||||
|
|||||||
Reference in New Issue
Block a user