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]
|
||||
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_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;
|
||||
}
|
||||
|
||||
@@ -47,6 +47,7 @@ DECLARE_BUILD_STAGE(engine)
|
||||
EXTERNAL"steamworks/public",
|
||||
EXTERNAL"Vulkan-Headers/include",
|
||||
EXTERNAL"Vulkan-Utility-Libraries/include",
|
||||
EXTERNAL"OpenXR-SDK/include",
|
||||
EXTERNAL
|
||||
};
|
||||
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 )
|
||||
{
|
||||
V_printf("LOADING %s\n", szName);
|
||||
bool bHasBeenCreated = false;
|
||||
HFunnyModel hModel = m_models.GetOrCreateObject(szName, &bHasBeenCreated);
|
||||
if (!bHasBeenCreated)
|
||||
@@ -296,7 +295,6 @@ void CAssetManager::UnrefMaterial( uint32_t uIndex )
|
||||
|
||||
HFunnyMesh CAssetManager::LoadMesh( const char *szName )
|
||||
{
|
||||
V_printf("LOADING %s\n", szName);
|
||||
bool bHasBeenCreated = false;
|
||||
HFunnyMesh hAsset = m_meshes.GetOrCreateObject(szName, &bHasBeenCreated);
|
||||
if (!bHasBeenCreated)
|
||||
@@ -310,7 +308,6 @@ HFunnyMesh CAssetManager::LoadMesh( const char *szName )
|
||||
m_meshes.UnrefObject(hAsset);
|
||||
return 0;
|
||||
}
|
||||
V_printf("V_LOADING %s %llu\n", szName, filesystem->Size(hMesh));
|
||||
|
||||
IVertexBuffer *pVertexBuffer = g_pRenderContext->CreateVertexBuffer(filesystem->Size(hMesh));
|
||||
pVertexBuffer->Lock();
|
||||
|
||||
@@ -14,9 +14,9 @@
|
||||
|
||||
static C_BaseEntity *s_pLocalEntity;
|
||||
|
||||
CEntitySystem *EntitySystem()
|
||||
C_EntitySystem *EntitySystem()
|
||||
{
|
||||
static CEntitySystem s_entitySystem;
|
||||
static C_EntitySystem s_entitySystem;
|
||||
return &s_entitySystem;
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ static struct EntityRegistry_t
|
||||
struct EntityRegistry_t *m_pNext;
|
||||
} *s_pEntitiesRegistry = NULL;
|
||||
|
||||
CEntitySystem::CEntitySystem()
|
||||
C_EntitySystem::C_EntitySystem()
|
||||
{
|
||||
int i = 0;
|
||||
for ( i = 0; i < MAX_EDICTS; i++ )
|
||||
@@ -37,7 +37,7 @@ CEntitySystem::CEntitySystem()
|
||||
m_nEntityCount = 0;
|
||||
}
|
||||
|
||||
void CEntitySystem::RegisterEntityClass( IEntityFactory *pEntityFactory, const char *szClassName )
|
||||
void C_EntitySystem::RegisterEntityClass( IEntityFactory *pEntityFactory, const char *szClassName )
|
||||
{
|
||||
IEntityFactory *pFactory;
|
||||
EntityRegistry_t *pRegistry;
|
||||
@@ -57,7 +57,7 @@ void CEntitySystem::RegisterEntityClass( IEntityFactory *pEntityFactory, const c
|
||||
s_pEntitiesRegistry = pRegistry;
|
||||
}
|
||||
|
||||
C_BaseEntity *CEntitySystem::CreateByClassname( const char *szName )
|
||||
C_BaseEntity *C_EntitySystem::CreateByClassname( const char *szName )
|
||||
{
|
||||
IEntityFactory *pFactory;
|
||||
C_BaseEntity *pEntity;
|
||||
@@ -89,7 +89,7 @@ C_BaseEntity *CEntitySystem::CreateByClassname( const char *szName )
|
||||
m_nEntityCount++;
|
||||
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;
|
||||
C_BaseEntity *pEntity;
|
||||
@@ -109,7 +109,7 @@ C_BaseEntity *CEntitySystem::CreateByClassnameWithIndex( const char *szName, uin
|
||||
return pEntity;
|
||||
}
|
||||
|
||||
IEntityFactory *CEntitySystem::GetFactoryByClassname( const char *szName )
|
||||
IEntityFactory *C_EntitySystem::GetFactoryByClassname( const char *szName )
|
||||
{
|
||||
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 )
|
||||
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;
|
||||
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;
|
||||
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;
|
||||
int i;
|
||||
@@ -320,12 +320,12 @@ void CEntitySystem::NetSendThink( INetworkBase *pBase )
|
||||
}
|
||||
|
||||
|
||||
C_BaseEntity **CEntitySystem::GetEntities()
|
||||
C_BaseEntity **C_EntitySystem::GetEntities()
|
||||
{
|
||||
return m_pEntities;
|
||||
};
|
||||
|
||||
C_BaseEntity *CEntitySystem::GetEntityByIndex( int idx )
|
||||
C_BaseEntity *C_EntitySystem::GetEntityByIndex( int idx )
|
||||
{
|
||||
if (idx < 0 || idx >= MAX_EDICTS)
|
||||
return NULL;
|
||||
|
||||
@@ -16,10 +16,10 @@ class C_BaseEntity;
|
||||
#define MAX_EDICTS 8192
|
||||
#define EDICT_INDEX_UNDEFINED (-1U)
|
||||
|
||||
class CEntitySystem
|
||||
class C_EntitySystem
|
||||
{
|
||||
public:
|
||||
CEntitySystem();
|
||||
C_EntitySystem();
|
||||
|
||||
virtual void RegisterEntityClass( IEntityFactory *pEntityFactory, const char *szClassName );
|
||||
virtual C_BaseEntity *CreateByClassname( const char *szName );
|
||||
@@ -43,7 +43,7 @@ private:
|
||||
int m_nEntityCount;
|
||||
};
|
||||
|
||||
CEntitySystem *EntitySystem();
|
||||
C_EntitySystem *EntitySystem();
|
||||
|
||||
C_BaseEntity *UTIL_GetLocalPlayer();
|
||||
|
||||
|
||||
@@ -28,6 +28,8 @@ class CFunnyGameBridge: public IEngineBridge
|
||||
bool m_bIsConnectedToServer;
|
||||
|
||||
float m_fNetUpdateTimer;
|
||||
|
||||
IViewport *m_pMainViewport;
|
||||
};
|
||||
|
||||
|
||||
@@ -47,7 +49,6 @@ void CFunnyGameBridge::Init()
|
||||
Console()->AddCommand("exec game/core/default.cfg\n");
|
||||
Console()->Execute();
|
||||
|
||||
g_pWorldRenderer->Init();
|
||||
#ifdef STEAM
|
||||
if (g_pEngineConstants->m_bIsSteam)
|
||||
{
|
||||
@@ -89,6 +90,12 @@ void CFunnyGameBridge::Init()
|
||||
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);
|
||||
if (pHeadSet)
|
||||
{
|
||||
@@ -150,6 +157,11 @@ void CFunnyGameBridge::TryToConnectToServer()
|
||||
|
||||
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_fDeltaTime = fDelta;
|
||||
|
||||
@@ -158,13 +170,6 @@ void CFunnyGameBridge::Frame( float fDelta )
|
||||
|
||||
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;
|
||||
pCurrentServer = g_pServerBridge;
|
||||
if (m_bIsConnectedToServer)
|
||||
@@ -217,6 +222,7 @@ void CFunnyGameBridge::Frame( float fDelta )
|
||||
EntitySystem()->NetSendThink(pCurrentServer);
|
||||
}
|
||||
g_pWorldRenderer->Frame(fDelta);
|
||||
g_pMainWindow->SetOutputImage(m_pMainViewport->GetRenderImage());
|
||||
}
|
||||
|
||||
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 "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
|
||||
{
|
||||
mat4 m_matCameraProjection;
|
||||
@@ -122,9 +224,6 @@ public:
|
||||
virtual void Frame( float fDelta ) 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 IMeshInstance *CreateInstance( IMesh *pMesh ) override;
|
||||
virtual void DestroyMeshInstance( IMesh *pMesh, IMeshInstance *pInstance ) override;
|
||||
@@ -132,15 +231,12 @@ public:
|
||||
|
||||
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;
|
||||
private:
|
||||
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;
|
||||
IBuffer *m_pViewBuffer;
|
||||
ViewBuffer_t *m_pViewBufferData;
|
||||
@@ -152,8 +248,7 @@ private:
|
||||
IComputeShader *m_pPostProcessing;
|
||||
IMaterial *m_pPostProcessingMaterial;
|
||||
|
||||
vec3 m_vPos;
|
||||
versor m_vRot;
|
||||
CUtlVector<CFunnyViewport*> m_viewports;
|
||||
};
|
||||
|
||||
void CFunnyWorldRenderer::ConfigureShader( IShader *pShader )
|
||||
@@ -164,7 +259,7 @@ void CFunnyWorldRenderer::ConfigureShader( IShader *pShader )
|
||||
pShader->AddAttribute(0, 2, VERTEX_FORMAT_XYZ32_SFLOAT, 20);
|
||||
// albedo
|
||||
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->SetMultisampling(MULTISAMPLE_TYPE_4_SAMPLES);
|
||||
@@ -178,43 +273,6 @@ IWorldRenderer *g_pWorldRenderer = &s_renderer;
|
||||
|
||||
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");
|
||||
ConfigureShader(m_pRasterShader);
|
||||
m_pRasterShader->Build();
|
||||
@@ -232,8 +290,6 @@ void CFunnyWorldRenderer::Init()
|
||||
m_pPostProcessing->Build();
|
||||
|
||||
m_pPostProcessingMaterial = g_pRenderContext->CreateMaterial(m_pPostProcessing);
|
||||
|
||||
g_pMainWindow->SetOutputImage(m_pResolvedOutputImage);
|
||||
}
|
||||
|
||||
void CFunnyWorldRenderer::Tick( float fDelta )
|
||||
@@ -242,75 +298,32 @@ void CFunnyWorldRenderer::Tick( float fDelta )
|
||||
|
||||
void CFunnyWorldRenderer::Frame( float fDelta )
|
||||
{
|
||||
uint32_t uWidth = g_pMainWindow->GetRenderWidth();
|
||||
uint32_t uHeight = g_pMainWindow->GetRenderHeight();
|
||||
for (auto &v: m_viewports)
|
||||
{
|
||||
uint32_t uWidth = v->m_uX;
|
||||
uint32_t uHeight = v->m_uY;
|
||||
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_translate(matCamera2, v->m_vPos);
|
||||
glm_quat_rotate(matCamera2, v->m_qRot, matCamera2);
|
||||
glm_mat4_inv(matCamera2, matCamera2);
|
||||
glm_perspective(glm_rad(75), uWidth/(float)uHeight, 0.01, 10000, matCamera);
|
||||
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, m_vPos, sizeof(vec3));
|
||||
V_memcpy(&m_pViewBufferData->m_vCameraPosition, v->m_vPos, sizeof(vec3));
|
||||
m_pViewBuffer->Unlock();
|
||||
m_pViewBuffer->Unmap();
|
||||
|
||||
if (g_pMainWindow->BRenderSizeUpdated())
|
||||
{
|
||||
g_pRenderContext->DestroyImage(m_pOutputImage);
|
||||
g_pRenderContext->DestroyImage(m_pResolvedOutputImage);
|
||||
g_pRenderContext->DestroyImage(m_pNormalImage);
|
||||
g_pRenderContext->DestroyImage(m_pWorldSpaceImage);
|
||||
g_pRenderContext->DestroyImage(m_pDepthImage);
|
||||
g_pRenderContext->DestroyImage(m_pStorageOutputImage);
|
||||
|
||||
m_pOutputImage = g_pRenderContext->CreateRenderTarget(
|
||||
g_pMainWindow->GetRenderWidth(),
|
||||
g_pMainWindow->GetRenderHeight(),
|
||||
IMAGE_FORMAT_RGBA8_UNORM,
|
||||
MULTISAMPLE_TYPE_4_SAMPLES);
|
||||
m_pResolvedOutputImage = g_pRenderContext->CreateRenderTarget(
|
||||
g_pMainWindow->GetRenderWidth(),
|
||||
g_pMainWindow->GetRenderHeight(),
|
||||
IMAGE_FORMAT_RGBA8_UNORM,
|
||||
MULTISAMPLE_TYPE_1_SAMPLES);
|
||||
|
||||
m_pNormalImage = g_pRenderContext->CreateRenderTarget(
|
||||
g_pMainWindow->GetRenderWidth(),
|
||||
g_pMainWindow->GetRenderHeight(),
|
||||
IMAGE_FORMAT_RGBA16_SFLOAT,
|
||||
MULTISAMPLE_TYPE_4_SAMPLES
|
||||
);
|
||||
m_pWorldSpaceImage = g_pRenderContext->CreateRenderTarget(
|
||||
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->SetRenderTarget(0, v->m_pColor);
|
||||
m_pRasterCommandList->SetRenderTarget(1, v->m_pNormal);
|
||||
m_pRasterCommandList->SetRenderTarget(2, v->m_pWorldCoords);
|
||||
m_pRasterCommandList->SetDepthTarget(v->m_pDepth);
|
||||
m_pRasterCommandList->SetViewport(0, 0, uWidth, uHeight, 0, 1);
|
||||
m_pRasterCommandList->SetScissors(0, 0, uWidth, uHeight);
|
||||
m_pRasterCommandList->SetClearColor(0, 0, 0, 0, 0);
|
||||
@@ -361,17 +374,18 @@ void CFunnyWorldRenderer::Frame( float fDelta )
|
||||
u += mesh->m_instances.GetSize();
|
||||
}
|
||||
|
||||
m_pRasterCommandList->ResolveImage(m_pOutputImage, m_pResolvedOutputImage);
|
||||
m_pRasterCommandList->ResolveImage(v->m_pColor, v->m_pColorResolved);
|
||||
|
||||
m_pPostProcessingMaterial->CSSetTexture(0, 0, m_pResolvedOutputImage);
|
||||
m_pPostProcessingMaterial->CSSetTexture(1, 0, m_pStorageOutputImage);
|
||||
m_pPostProcessingMaterial->CSSetTexture(0, 0, v->m_pColorResolved);
|
||||
m_pPostProcessingMaterial->CSSetTexture(1, 0, v->m_pRenderImage);
|
||||
m_pRasterCommandList->SetMaterial(m_pPostProcessingMaterial);
|
||||
m_pRasterCommandList->Barrier(m_pResolvedOutputImage, true, false);
|
||||
m_pRasterCommandList->Barrier(m_pStorageOutputImage, false, true);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
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 )
|
||||
{
|
||||
CFunnyMesh *pMesh = new CFunnyMesh;
|
||||
@@ -440,3 +437,26 @@ ITextureArray *CFunnyWorldRenderer::GetTextures()
|
||||
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"
|
||||
|
||||
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
|
||||
@@ -27,8 +43,6 @@ public:
|
||||
virtual void SetColor( Vector vColor ) = 0;
|
||||
virtual void SetRadius( Vector vColor ) = 0;
|
||||
virtual void SetPosition( Vector vPosition ) = 0;
|
||||
virtual void SetRotation( Quat vRotation ) = 0;
|
||||
virtual void SetScale( Vector vScale ) = 0;
|
||||
};
|
||||
|
||||
abstract_class IMeshInstance
|
||||
@@ -43,19 +57,20 @@ public:
|
||||
abstract_class IWorldRenderer: public IGameSystem
|
||||
{
|
||||
public:
|
||||
virtual void SetCameraRotation( Quat vRotation ) = 0;
|
||||
virtual void SetCameraPosition( Vector vPosition ) = 0;
|
||||
|
||||
virtual IMesh *CreateMesh( const char *szName ) = 0;
|
||||
virtual IMeshInstance *CreateInstance( IMesh *pMesh ) = 0;
|
||||
virtual void DestroyMeshInstance( IMesh *pMesh, IMeshInstance *pInstance ) = 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 ITextureArray *GetTextures() = 0;
|
||||
};
|
||||
|
||||
|
||||
extern IWorldRenderer *g_pWorldRenderer;
|
||||
|
||||
#endif
|
||||
|
||||
@@ -9,13 +9,8 @@ ADD_DEPENDENCY_BUILD_FILE(cfg, ROOT"buildcfg.cpp");
|
||||
ADD_DEPENDENCY_BUILD_FILE(tier0, FUNNYSTDLIB"tier0/build.cpp");
|
||||
ADD_DEPENDENCY_BUILD_FILE(tier1, FUNNYSTDLIB"tier1/build.cpp");
|
||||
ADD_DEPENDENCY_BUILD_FILE(tier2, FUNNYSTDLIB"tier2/build.cpp");
|
||||
DECLARE_BUILD_STAGE(Server)
|
||||
{
|
||||
CProject_t compileProject = {};
|
||||
LinkProject_t ldProject = {};
|
||||
|
||||
compileProject.m_szName = "server";
|
||||
compileProject.files = {
|
||||
CUtlVector<CUtlString> milmoba = {
|
||||
"../shared/game.cpp",
|
||||
"../shared/boneanimation.cpp",
|
||||
|
||||
@@ -29,7 +24,33 @@ DECLARE_BUILD_STAGE(Server)
|
||||
"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)
|
||||
{
|
||||
CProject_t compileProject = {};
|
||||
LinkProject_t ldProject = {};
|
||||
|
||||
compileProject.m_szName = "server";
|
||||
compileProject.files = milmoba;
|
||||
compileProject.includeDirectories = {
|
||||
"../../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;
|
||||
typedef void (*EngineMainFn)(int argc, char** argv);
|
||||
EngineMainFn pEngineMain;
|
||||
extern void FunnyMain(int argc, char** argv);
|
||||
|
||||
int main( int argc, char **argv ) {
|
||||
#ifdef __linux__
|
||||
@@ -99,6 +100,6 @@ int main( int argc, char **argv ) {
|
||||
SetCurrentDirectoryA(szLauncherPath);
|
||||
pEngineMain(argc, argv);
|
||||
#endif
|
||||
//FunnyMain(argc, argv);
|
||||
//return 0;
|
||||
FunnyMain(argc, argv);
|
||||
return 0;
|
||||
};
|
||||
|
||||
@@ -46,9 +46,9 @@ public:
|
||||
|
||||
private:
|
||||
|
||||
VkSurfaceKHR m_hSurface;
|
||||
SDL_Window *m_pWindow;
|
||||
IImage *m_pOutputImage;
|
||||
VkSurfaceKHR m_hSurface = NULL;
|
||||
SDL_Window *m_pWindow = NULL;
|
||||
IImage *m_pOutputImage = NULL;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -750,7 +750,6 @@ IImage *CVkRenderContext::CreateImageFromVkImage( void *pVkImage, uint32_t x, ui
|
||||
}
|
||||
|
||||
VkPipelineLayout g_pLibraryEmptyLayout;
|
||||
static IVkCommandBuffer *s_pPresentCommandBuffer;
|
||||
void CVkRenderContext::Init()
|
||||
{
|
||||
|
||||
@@ -984,13 +983,12 @@ void CVkRenderContext::Frame( float fDeltaTime )
|
||||
if (m_pXRManager)
|
||||
m_pXRManager->PreRender();
|
||||
|
||||
IRenderCommandList *pList = CreateCommandList();
|
||||
pList->StartRecording();
|
||||
|
||||
s_pPresentCommandBuffer = m_pCommandBufferManager->CreateCommandBuffer();
|
||||
s_pPresentCommandBuffer->Reset();
|
||||
|
||||
double a = Plat_GetTime();
|
||||
i = 0;
|
||||
CVkEmptyCommand *pEmptyCommand = CREATE_COMMAND(m_pCommandBufferManager, Empty);
|
||||
for ( auto &s: m_renderWindows )
|
||||
{
|
||||
|
||||
@@ -998,30 +996,24 @@ void CVkRenderContext::Frame( float fDeltaTime )
|
||||
CVkBlitCommand *pBlitCommand = NULL;
|
||||
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++;
|
||||
}
|
||||
s_pPresentCommandBuffer->AddCommand(pEmptyCommand);
|
||||
|
||||
s_pPresentCommandBuffer->Render();
|
||||
s_pPresentCommandBuffer->Submit(0);
|
||||
pList->EndRecording();
|
||||
SubmitCommandList(pList);
|
||||
DestroyCommandList(pList);
|
||||
|
||||
if (m_pXRManager)
|
||||
m_pXRManager->CopySwapchain();
|
||||
@@ -1066,13 +1058,22 @@ void CVkRenderContext::Frame( float fDeltaTime )
|
||||
{
|
||||
delete a;
|
||||
}
|
||||
for (auto &a: m_scheduledRemovalImages)
|
||||
{
|
||||
delete a;
|
||||
}
|
||||
for (auto &a: m_scheduledRemovalTextureArrays)
|
||||
{
|
||||
delete a;
|
||||
}
|
||||
for (auto &a: m_scheduledRemovalLists)
|
||||
{
|
||||
delete a;
|
||||
}
|
||||
m_scheduledRemovalLists = {};
|
||||
m_scheduledRemovalImages = {};
|
||||
m_scheduledRemovalTextureArrays = {};
|
||||
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()
|
||||
|
||||
@@ -276,6 +276,12 @@ struct VkOutputImageConfig_t
|
||||
{
|
||||
VkFormat m_eFormat;
|
||||
bool m_bIsBlendingEnabled;
|
||||
EBlendingFactor eSrcColor;
|
||||
EBlendingFactor eDstColor;
|
||||
EBlendingOp eColorOp;
|
||||
EBlendingFactor eSrcAlpha;
|
||||
EBlendingFactor eDstAlpha;
|
||||
EBlendingOp eAlphaOp;
|
||||
};
|
||||
|
||||
class CVkShader : public IShader
|
||||
@@ -289,6 +295,15 @@ public:
|
||||
virtual void SetDepthImage( EImageFormat eFormat ) override;
|
||||
virtual void SetMultisampling( EMultisampleType eFormat ) 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;
|
||||
|
||||
VkPipeline m_hPipeline = NULL;
|
||||
|
||||
@@ -126,6 +126,37 @@ enum ETopologyMode
|
||||
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
|
||||
@@ -225,6 +256,14 @@ public:
|
||||
virtual void SetDepthImage( EImageFormat eFormat ) = 0;
|
||||
virtual void SetMultisampling( EMultisampleType eFormat ) = 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
|
||||
|
||||
Reference in New Issue
Block a user