Why isnt this working....

This commit is contained in:
Dynamitos
2023-11-13 13:23:16 +01:00
parent a545426b32
commit 9a26fd75ca
6 changed files with 8 additions and 10 deletions
+3 -4
View File
@@ -15,12 +15,11 @@ layout(set=2)
ParameterBlock<Scene> pScene; ParameterBlock<Scene> pScene;
[shader("vertex")] [shader("vertex")]
void vertexMain( FragmentParameter vertexMain(
uint vertexId: SV_VertexID, uint vertexId: SV_VertexID,
uint instanceId: SV_InstanceID, uint instanceId: SV_InstanceID,
out FragmentParameter params: PARAMETER, ) : PARAMETER{
){
InstanceData inst = pScene.instances[instanceId]; InstanceData inst = pScene.instances[instanceId];
VertexAttributes attr = pVertexData.getAttributes(vertexId, inst.transformMatrix); VertexAttributes attr = pVertexData.getAttributes(vertexId, inst.transformMatrix);
params = attr.getParameter(inst.transformMatrix); return attr.getParameter(inst.transformMatrix);
} }
+2 -1
View File
@@ -20,13 +20,14 @@ struct LightingParameter
// data passed to fragment shader // data passed to fragment shader
struct FragmentParameter struct FragmentParameter
{ {
// clip position has to be the first attribute for some reason????
float4 position_CS : SV_Position;
float3 position_TS; float3 position_TS;
float3 viewDir_TS; float3 viewDir_TS;
float3 normal_WS; float3 normal_WS;
float3 tangent_WS; float3 tangent_WS;
float3 biTangent_WS; float3 biTangent_WS;
float3 position_WS; float3 position_WS;
float4 position_CS : SV_Position;
float2 texCoords; float2 texCoords;
float3 vertexColor; float3 vertexColor;
MaterialParameter getMaterialParameter() MaterialParameter getMaterialParameter()
+1 -2
View File
@@ -54,8 +54,7 @@ void Camera::buildViewMatrix()
{ {
Vector eyePos = getTransform().getPosition();//getAbsoluteTransform().getPosition(); Vector eyePos = getTransform().getPosition();//getAbsoluteTransform().getPosition();
Vector lookAt = eyePos + glm::normalize(Vector(cos(yaw) * cos(pitch), sin(pitch), sin(yaw) * cos(pitch))); Vector lookAt = eyePos + glm::normalize(Vector(cos(yaw) * cos(pitch), sin(pitch), sin(yaw) * cos(pitch)));
//std::cout << "Eye: " << eyePos << " lookAt: " << lookAt << std::endl; viewMatrix = glm::lookAt(eyePos, lookAt, Vector(0, 1, 0));
viewMatrix = glm::lookAt(Vector(100, 0, 10), Vector(0, 0, 0), Vector(0, 1, 0));//glm::lookAt(eyePos, lookAt, Vector(0, 1, 0));
bNeedsViewBuild = false; bNeedsViewBuild = false;
} }
+1 -1
View File
@@ -32,7 +32,7 @@ struct Camera
//Transforms relative to actor //Transforms relative to actor
float yaw; float yaw;
float pitch; float pitch;
bool mainCamera = true; bool mainCamera = false;
private: private:
bool bNeedsViewBuild; bool bNeedsViewBuild;
}; };
+1 -1
View File
@@ -29,7 +29,7 @@ void VertexData::updateMesh(const Component::Transform& transform, PMesh mesh)
matInstanceData.meshes.add(MeshInstanceData{ matInstanceData.meshes.add(MeshInstanceData{
.id = mesh->id, .id = mesh->id,
.instance = InstanceData { .instance = InstanceData {
.transformMatrix = Matrix4(1),//transform.toMatrix(), .transformMatrix = transform.toMatrix(),
}, },
.indexBuffer = mesh->indexBuffer, .indexBuffer = mesh->indexBuffer,
}); });
-1
View File
@@ -16,7 +16,6 @@ Semaphore::Semaphore(PGraphics graphics)
Semaphore::~Semaphore() Semaphore::~Semaphore()
{ {
graphics = nullptr;
vkDestroySemaphore(graphics->getDevice(), handle, nullptr); vkDestroySemaphore(graphics->getDevice(), handle, nullptr);
} }