Minor changes
This commit is contained in:
Vendored
+1
-1
Submodule external/vcpkg updated: f9a99aa79c...ce35b1a53a
@@ -1,3 +1,5 @@
|
|||||||
|
import Frustum;
|
||||||
|
|
||||||
const static float PI = 3.1415926535897932f;
|
const static float PI = 3.1415926535897932f;
|
||||||
const static uint BLOCK_SIZE = 32;
|
const static uint BLOCK_SIZE = 32;
|
||||||
static const uint64_t MAX_TEXCOORDS = 8;
|
static const uint64_t MAX_TEXCOORDS = 8;
|
||||||
@@ -96,51 +98,3 @@ float4 clipToScreen(float4 clip)
|
|||||||
float zf = pz * ndc.z + oz;
|
float zf = pz * ndc.z + oz;
|
||||||
return float4(texCoords * pViewParams.screenDimensions, zf, 1.0f);
|
return float4(texCoords * pViewParams.screenDimensions, zf, 1.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Plane
|
|
||||||
{
|
|
||||||
float4 nd;
|
|
||||||
float3 getNormal()
|
|
||||||
{
|
|
||||||
return nd.xyz;
|
|
||||||
}
|
|
||||||
float getDistance()
|
|
||||||
{
|
|
||||||
return nd.w;
|
|
||||||
}
|
|
||||||
bool pointInside(float3 point)
|
|
||||||
{
|
|
||||||
return dot(getNormal(), point) - getDistance() > 0.0f;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
struct Frustum
|
|
||||||
{
|
|
||||||
Plane sides[4];
|
|
||||||
bool pointInside(float3 point)
|
|
||||||
{
|
|
||||||
for(int p = 0; p < 4; ++p)
|
|
||||||
{
|
|
||||||
if(!sides[p].pointInside(point))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
Plane computePlane(float3 p0, float3 p1, float3 p2)
|
|
||||||
{
|
|
||||||
Plane plane;
|
|
||||||
|
|
||||||
float3 v0 = p1 - p0;
|
|
||||||
float3 v2 = p2 - p0;
|
|
||||||
|
|
||||||
float3 n = normalize(cross(v0, v2));
|
|
||||||
|
|
||||||
float d = dot(n, p0);
|
|
||||||
|
|
||||||
plane.nd = float4(n, d);
|
|
||||||
|
|
||||||
return plane;
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -0,0 +1,47 @@
|
|||||||
|
struct Plane
|
||||||
|
{
|
||||||
|
float4 nd;
|
||||||
|
float3 getNormal()
|
||||||
|
{
|
||||||
|
return nd.xyz;
|
||||||
|
}
|
||||||
|
float getDistance()
|
||||||
|
{
|
||||||
|
return nd.w;
|
||||||
|
}
|
||||||
|
bool pointInside(float3 point)
|
||||||
|
{
|
||||||
|
return dot(getNormal(), point) - getDistance() > 0.0f;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
struct Frustum
|
||||||
|
{
|
||||||
|
Plane sides[4];
|
||||||
|
bool pointInside(float3 point)
|
||||||
|
{
|
||||||
|
for(int p = 0; p < 4; ++p)
|
||||||
|
{
|
||||||
|
if(!sides[p].pointInside(point))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
Plane computePlane(float3 p0, float3 p1, float3 p2)
|
||||||
|
{
|
||||||
|
Plane plane;
|
||||||
|
|
||||||
|
float3 v0 = p1 - p0;
|
||||||
|
float3 v2 = p2 - p0;
|
||||||
|
|
||||||
|
float3 n = normalize(cross(v0, v2));
|
||||||
|
|
||||||
|
float d = dot(n, p0);
|
||||||
|
|
||||||
|
plane.nd = float4(n, d);
|
||||||
|
|
||||||
|
return plane;
|
||||||
|
}
|
||||||
@@ -1,11 +1,7 @@
|
|||||||
#include "Asset/AssetRegistry.h"
|
#include "Asset/AssetRegistry.h"
|
||||||
#include "Graphics/Initializer.h"
|
#include "Graphics/Initializer.h"
|
||||||
#include "Graphics/StaticMeshVertexData.h"
|
#include "Graphics/StaticMeshVertexData.h"
|
||||||
#ifdef __APPLE__
|
|
||||||
#include "Graphics/Metal/Graphics.h"
|
|
||||||
#else
|
|
||||||
#include "Graphics/Vulkan/Graphics.h"
|
#include "Graphics/Vulkan/Graphics.h"
|
||||||
#endif
|
|
||||||
#include "PlayView.h"
|
#include "PlayView.h"
|
||||||
#include "Window/WindowManager.h"
|
#include "Window/WindowManager.h"
|
||||||
#include <fmt/core.h>
|
#include <fmt/core.h>
|
||||||
@@ -29,11 +25,7 @@ int main(int argc, char** argv) {
|
|||||||
|
|
||||||
std::filesystem::path binaryPath = "MeshShadingDemo.dll";
|
std::filesystem::path binaryPath = "MeshShadingDemo.dll";
|
||||||
|
|
||||||
#ifdef __APPLE__
|
graphics = new Vulkan::Graphics();
|
||||||
graphics = new Metal::Graphics();
|
|
||||||
#else
|
|
||||||
graphics = new Vulkan::Graphics();
|
|
||||||
#endif
|
|
||||||
GraphicsInitializer initializer;
|
GraphicsInitializer initializer;
|
||||||
graphics->init(initializer);
|
graphics->init(initializer);
|
||||||
StaticMeshVertexData* vd = StaticMeshVertexData::getInstance();
|
StaticMeshVertexData* vd = StaticMeshVertexData::getInstance();
|
||||||
|
|||||||
@@ -36,11 +36,7 @@ int main() {
|
|||||||
std::filesystem::path binaryPath = sourcePath / "bin" / fmt::format("{}.{}", gameName, libraryEnding);
|
std::filesystem::path binaryPath = sourcePath / "bin" / fmt::format("{}.{}", gameName, libraryEnding);
|
||||||
std::filesystem::path cmakePath = outputPath / "cmake";
|
std::filesystem::path cmakePath = outputPath / "cmake";
|
||||||
if (true) {
|
if (true) {
|
||||||
#ifdef __APPLE__
|
|
||||||
graphics = new Metal::Graphics();
|
|
||||||
#else
|
|
||||||
graphics = new Vulkan::Graphics();
|
graphics = new Vulkan::Graphics();
|
||||||
#endif
|
|
||||||
GraphicsInitializer initializer;
|
GraphicsInitializer initializer;
|
||||||
graphics->init(initializer);
|
graphics->init(initializer);
|
||||||
StaticMeshVertexData* vd = StaticMeshVertexData::getInstance();
|
StaticMeshVertexData* vd = StaticMeshVertexData::getInstance();
|
||||||
|
|||||||
Reference in New Issue
Block a user