Skip to content

Commit

Permalink
Merge pull request #53 from bluesky013/dev_editor
Browse files Browse the repository at this point in the history
Merge from Dev editor.
  • Loading branch information
bluesky013 authored Sep 25, 2024
2 parents bfc6492 + c90fc79 commit e144e37
Show file tree
Hide file tree
Showing 1,144 changed files with 23,378 additions and 13,648 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@
/assets/shaders/output/
/build_release/
/active_project
/test/assets/assets.db
/test/products/
13 changes: 2 additions & 11 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,8 @@ if (SKY_BUILD_TEST)
add_subdirectory(test)
endif()

add_subdirectory(framework)
add_subdirectory(core)
add_subdirectory(engine)
add_subdirectory(render)
add_subdirectory(sample)
add_subdirectory(Launcher)

set(ACTIVE_PROJECT_PATH ${CMAKE_SOURCE_DIR}/active_project/native)
if (EXISTS ${ACTIVE_PROJECT_PATH})
add_subdirectory(${ACTIVE_PROJECT_PATH})
endif ()
add_subdirectory(runtime)
add_subdirectory(launcher)

if (SKY_BUILD_EDITOR)
add_subdirectory(editor)
Expand Down
10 changes: 0 additions & 10 deletions asset.json

This file was deleted.

Binary file added assets/fonts/OpenSans-Bold.ttf
Binary file not shown.
Binary file added assets/fonts/OpenSans-BoldItalic.ttf
Binary file not shown.
Binary file added assets/fonts/OpenSans-Italic.ttf
Binary file not shown.
Binary file added assets/fonts/OpenSans-Regular.ttf
Binary file not shown.
Binary file removed assets/images/test.png
Binary file not shown.
3 changes: 2 additions & 1 deletion assets/materials/standard_pbr.mat
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"techniques": [
"techniques/standard_forward.tech"
"techniques/standard_forward.tech",
"techniques/depth.tech"
]
}
12 changes: 6 additions & 6 deletions assets/shaders/common/random.hlsl
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
float Random(float2 co)
{
float a = 12.9898;
float b = 78.233;
float c = 43758.5453;
float dt= dot(co.xy ,float2(a,b));
float sn= fmod(dt,3.14);
return frac(sin(sn) * c);
float a = 12.9898;
float b = 78.233;
float c = 43758.5453;
float dt= dot(co.xy ,float2(a,b));
float sn= fmod(dt,3.14);
return frac(sin(sn) * c);
}
36 changes: 36 additions & 0 deletions assets/shaders/debug.hlsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
struct VSInput
{
float4 Pos : POSITION;
float4 Color : COLOR;
};

struct VSOutput
{
float4 Pos : SV_POSITION;
float4 Color : COLOR;
};

#include "shaders/layout/default_pass.hlsl"
#include "shaders/layout/default_local.hlsl"

#if VIEW_COUNT > 1
#define VIEW_INFO View[ViewIndex]
#else
#define VIEW_INFO View
#endif

VSOutput VSMain(VSInput input)
{
VSOutput output = (VSOutput)0;

float4 WorldPos = mul(World, input.Pos);
output.Pos = mul(VIEW_INFO.ViewProj, float4(WorldPos.xyz, 1.0));

output.COLOR = input.Color;
return output;
}

float4 FSMain(VSOutput input) : SV_TARGET
{
return input.Color;
}
24 changes: 24 additions & 0 deletions assets/shaders/depth_only.hlsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#include "shaders/vertex/position_only.hlsl"

#include "shaders/layout/default_pass.hlsl"
#include "shaders/layout/default_local.hlsl"

#if VIEW_COUNT > 1
#define VIEW_INFO View[ViewIndex]
#else
#define VIEW_INFO View
#endif

VSOutput VSMain(VSInput input)
{
VSOutput output = (VSOutput)0;

float4 WorldPos = mul(World, input.Pos);
output.Pos = mul(VIEW_INFO.ViewProj, float4(WorldPos.xyz, 1.0));
return output;
}

float4 FSMain() : SV_TARGET
{
return float4(0.0, 0.0, 0.0, 0.0);
}
24 changes: 24 additions & 0 deletions assets/shaders/error.hlsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#include "shaders/vertex/position_only.hlsl"

#include "shaders/layout/default_pass.hlsl"
#include "shaders/layout/default_local.hlsl"

#if VIEW_COUNT > 1
#define VIEW_INFO View[ViewIndex]
#else
#define VIEW_INFO View
#endif

VSOutput VSMain(VSInput input)
{
VSOutput output = (VSOutput)0;

float4 WorldPos = mul(World, input.Pos);
output.Pos = mul(VIEW_INFO.ViewProj, float4(WorldPos.xyz, 1.0));
return output;
}

float4 FSMain() : SV_TARGET
{
return float4(245.0 / 255.0, 66.0 / 255.0, 206.0 / 255.0, 1.0);
}
12 changes: 11 additions & 1 deletion assets/shaders/layout/default_local.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,14 @@
{
float4x4 World;
float4x4 InverseTrans;
}
}

#ifdef ENABLE_SKIN

#define MAX_BONE_NUM (80)
[[vk::binding(1, 2)]] cbuffer skin : register(b1, space2)
{
float4x4 Bones[MAX_BONE_NUM];
}

#endif
15 changes: 9 additions & 6 deletions assets/shaders/layout/default_pass.hlsl
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
struct ViewInfo {
float4x4 ViewToWorld;
float4x4 ViewToClip;
float4x4 WorldToView;
float4x4 WorldToClip;
float4x4 World;
float4x4 View;
float4x4 Project;
float4x4 ViewProj;
};

#define VIEW_COUNT 1
[[vk::binding(0, 0)]] cbuffer global : register(b0, space0)
{
float4x4 LightMatrix;
float4 Viewport;
}

Expand All @@ -21,4 +21,7 @@ struct ViewInfo {
{
ViewInfo View;
}
#endif
#endif

// [[vk::binding(2, 0)]] Texture2D ShadowMap : register(t1, space0);
// [[vk::binding(3, 0)]] SamplerState ShadowMapSampler : register(t1, space0);
61 changes: 38 additions & 23 deletions assets/shaders/lighting/brdf_lut.hlsl
Original file line number Diff line number Diff line change
@@ -1,34 +1,49 @@
#include "shaders/vertex/full_screen.hlsl"

struct VSOutput
{
float4 Pos : SV_POSITION;
float2 UV : TEXCOORD;
};

VSOutput VSMain(uint vid : SV_VertexID)
{
VSOutput res;

res.Pos = float4(FT_POSITIONS[vid], 0.0, 1.0);
res.UV = FT_UVS[vid];
return res;
}

#include "shaders/lighting/pbr.hlsl"

float2 BRDF_SAMPLE(float NoV, float roughness)
{
const uint NUM_SAMPLES = 1024;

// Normal always points along z-axis for the 2D lookup
const float3 N = float3(0.0, 0.0, 1.0);
float3 V = float3(sqrt(1.0 - NoV * NoV), 0.0, NoV);

float2 LUT = float2(0.0, 0.0);
for(uint i = 0u; i < NUM_SAMPLES; i++) {
float2 Xi = Hammersley2d(i, NUM_SAMPLES);
float3 H = ImportanceSample_GGX(Xi, roughness, N);
float3 L = 2.0 * dot(V, H) * H - V;

float dotNL = max(dot(N, L), 0.0);
float dotNV = max(dot(N, V), 0.0);
float dotVH = max(dot(V, H), 0.0);
float dotNH = max(dot(H, N), 0.0);

if (dotNL > 0.0) {
float G = G_SchlicksmithGGX(dotNL, dotNV, roughness);
float G_Vis = (G * dotVH) / (dotNH * dotNV);
float Fc = pow(1.0 - dotVH, 5.0);
LUT += float2((1.0 - Fc) * G_Vis, Fc * G_Vis);
}
}
return LUT / float(NUM_SAMPLES);
// Normal always points along z-axis for the 2D lookup
const float3 N = float3(0.0, 0.0, 1.0);
float3 V = float3(sqrt(1.0 - NoV * NoV), 0.0, NoV);

float2 LUT = float2(0.0, 0.0);
for(uint i = 0u; i < NUM_SAMPLES; i++) {
float2 Xi = Hammersley2d(i, NUM_SAMPLES);
float3 H = ImportanceSample_GGX(Xi, roughness, N);
float3 L = 2.0 * dot(V, H) * H - V;

float dotNL = max(dot(N, L), 0.0);
float dotNV = max(dot(N, V), 0.0);
float dotVH = max(dot(V, H), 0.0);
float dotNH = max(dot(H, N), 0.0);

if (dotNL > 0.0) {
float G = G_SchlickSmithGGX(dotNL, dotNV, roughness);
float G_Vis = (G * dotVH) / (dotNH * dotNV);
float Fc = pow(1.0 - dotVH, 5.0);
LUT += float2((1.0 - Fc) * G_Vis, Fc * G_Vis);
}
}
return LUT / float(NUM_SAMPLES);
}

float4 FSMain(VSOutput input) : SV_TARGET
Expand Down
6 changes: 0 additions & 6 deletions assets/shaders/lighting/light.hlsl
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
struct LightInfo {
float4 Direction; // xyz: dir
float4 Color; // xyz: rgb w: intensity
};

struct StandardPBR {
float Metallic;
float Roughness;
float3 Albedo;
};
Loading

0 comments on commit e144e37

Please sign in to comment.