added doom to the build lol
This commit is contained in:
parent
35e6905ed8
commit
8c12242304
|
|
@ -315,11 +315,11 @@ pub const SceneSystem = struct {
|
||||||
// });
|
// });
|
||||||
repr.transform = core.zm.mul(
|
repr.transform = core.zm.mul(
|
||||||
core.zm.mul(
|
core.zm.mul(
|
||||||
core.zm.translationV(posRot.position.toZm()),
|
|
||||||
core.zm.mul(
|
core.zm.mul(
|
||||||
core.zm.scalingV(posRot.scale.toZm()),
|
core.zm.scalingV(posRot.scale.toZm()),
|
||||||
core.zm.matFromQuat(posRot.rotation.quat),
|
core.zm.matFromQuat(posRot.rotation.quat),
|
||||||
),
|
),
|
||||||
|
core.zm.translationV(posRot.position.toZm()),
|
||||||
),
|
),
|
||||||
final,
|
final,
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ const core = @import("core");
|
||||||
const platform = @import("platform.zig");
|
const platform = @import("platform.zig");
|
||||||
|
|
||||||
const RingQueue = core.RingQueue;
|
const RingQueue = core.RingQueue;
|
||||||
const sdl3 = @import("sdl3");
|
pub const sdl3 = @import("sdl3");
|
||||||
const tracy = core.tracy;
|
const tracy = core.tracy;
|
||||||
|
|
||||||
pub const InputListenerError = error{
|
pub const InputListenerError = error{
|
||||||
|
|
|
||||||
|
|
@ -191,7 +191,7 @@ float4 main(
|
||||||
float4 s;
|
float4 s;
|
||||||
|
|
||||||
int texMode = scene[Instance].textureMode;
|
int texMode = scene[Instance].textureMode;
|
||||||
if (texMode == 0x10) // YUV
|
if ((texMode & 0xf0) == 0x10) // YUV
|
||||||
{
|
{
|
||||||
float3 offset = float3(-0.0625, -0.5, -0.5);
|
float3 offset = float3(-0.0625, -0.5, -0.5);
|
||||||
float3 Rcoeff = float3(1.164, 0.000, 1.793);
|
float3 Rcoeff = float3(1.164, 0.000, 1.793);
|
||||||
|
|
@ -213,11 +213,16 @@ float4 main(
|
||||||
|
|
||||||
s = float4(rgb, 1.0);
|
s = float4(rgb, 1.0);
|
||||||
}
|
}
|
||||||
else if(texMode == 0)
|
else if((texMode & 0xf0) == 0x0)
|
||||||
{
|
{
|
||||||
s = Texture0.Sample(Sampler0, UV);
|
s = Texture0.Sample(Sampler0, UV);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if((texMode & 0x1) == 1) // srgb correction bit
|
||||||
|
{
|
||||||
|
s = pow(s, 2.2);
|
||||||
|
}
|
||||||
|
|
||||||
float alpha = s.w;
|
float alpha = s.w;
|
||||||
if(alpha < 0.01)
|
if(alpha < 0.01)
|
||||||
{
|
{
|
||||||
|
|
@ -235,6 +240,7 @@ float4 main(
|
||||||
+ col * BlinnPhong(Normal, WorldPos, lightPos, lightColor)
|
+ col * BlinnPhong(Normal, WorldPos, lightPos, lightColor)
|
||||||
+ col * DirectionalLight(Normal, WorldPos, DirectionalShadowFragPos);
|
+ col * DirectionalLight(Normal, WorldPos, DirectionalShadowFragPos);
|
||||||
|
|
||||||
|
|
||||||
float4 rv = float4(pow(c2, 1.0 / 2.2), alpha);
|
float4 rv = float4(pow(c2, 1.0 / 2.2), alpha);
|
||||||
|
|
||||||
// === debug bone zone
|
// === debug bone zone
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ texture: ?*Texture = null,
|
||||||
|
|
||||||
entity: core.Entity = undefined,
|
entity: core.Entity = undefined,
|
||||||
|
|
||||||
textureMode: u32 = 0,
|
textureMode: u32 = 0, // bit
|
||||||
// DEBUG for-fun function, completely override what happens when the renderer tries to render this mesh.
|
// DEBUG for-fun function, completely override what happens when the renderer tries to render this mesh.
|
||||||
cmrf: ?rend.renderer.CustomMeshRenderFunc = null,
|
cmrf: ?rend.renderer.CustomMeshRenderFunc = null,
|
||||||
cmrf_ctx: ?*anyopaque = null,
|
cmrf_ctx: ?*anyopaque = null,
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -19,4 +19,5 @@ pub fn build(b: *std.Build) void {
|
||||||
|
|
||||||
blbuild.addExtraModule(sampleGame, "gameExtras");
|
blbuild.addExtraModule(sampleGame, "gameExtras");
|
||||||
blbuild.addExtraModule(sampleGame, "videoplayer");
|
blbuild.addExtraModule(sampleGame, "videoplayer");
|
||||||
|
blbuild.addExtraModule(sampleGame, "doomplayer");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,8 @@
|
||||||
.Backlog = .{ .path = "../" },
|
.Backlog = .{ .path = "../" },
|
||||||
.SpirvReflect = .{ .path = "../lib/spirv-reflect-zig" },
|
.SpirvReflect = .{ .path = "../lib/spirv-reflect-zig" },
|
||||||
.gameExtras = .{.path = "../extras/gameExtras"},
|
.gameExtras = .{.path = "../extras/gameExtras"},
|
||||||
.videoplayer = .{.path = "../extras/videoplayer"}
|
.videoplayer = .{.path = "../extras/videoplayer"},
|
||||||
|
.doomplayer = .{.path = "../extras/doomplayer"},
|
||||||
},
|
},
|
||||||
.paths = .{
|
.paths = .{
|
||||||
"",
|
"",
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -27,8 +27,8 @@ struct type_StructuredBuffer_Scene
|
||||||
Scene _m0[1];
|
Scene _m0[1];
|
||||||
};
|
};
|
||||||
|
|
||||||
constant float4 _83 = {};
|
constant float4 _86 = {};
|
||||||
constant float3 _85 = {};
|
constant float3 _88 = {};
|
||||||
|
|
||||||
struct main0_out
|
struct main0_out
|
||||||
{
|
{
|
||||||
|
|
@ -47,91 +47,101 @@ struct main0_in
|
||||||
fragment main0_out main0(main0_in in [[stage_in]], constant type_Uniforms& Uniforms [[buffer(0)]], const device type_StructuredBuffer_Scene& scene [[buffer(1)]], texture2d<float> Texture0 [[texture(0)]], texture2d<float> Texture1 [[texture(1)]], texture2d<float> Texture2 [[texture(2)]], texture2d<float> DirectionalShadowDepthMap [[texture(3)]], sampler Sampler0 [[sampler(0)]], sampler Sampler1 [[sampler(1)]], sampler Sampler2 [[sampler(2)]], sampler DirectionalShadowSampler [[sampler(3)]])
|
fragment main0_out main0(main0_in in [[stage_in]], constant type_Uniforms& Uniforms [[buffer(0)]], const device type_StructuredBuffer_Scene& scene [[buffer(1)]], texture2d<float> Texture0 [[texture(0)]], texture2d<float> Texture1 [[texture(1)]], texture2d<float> Texture2 [[texture(2)]], texture2d<float> DirectionalShadowDepthMap [[texture(3)]], sampler Sampler0 [[sampler(0)]], sampler Sampler1 [[sampler(1)]], sampler Sampler2 [[sampler(2)]], sampler DirectionalShadowSampler [[sampler(3)]])
|
||||||
{
|
{
|
||||||
main0_out out = {};
|
main0_out out = {};
|
||||||
int _94 = int(scene._m0[in.in_var_TEXCOORD4].textureMode);
|
int _97 = int(scene._m0[in.in_var_TEXCOORD4].textureMode);
|
||||||
float4 _128;
|
int _98 = _97 & 240;
|
||||||
if (_94 == 16)
|
float4 _132;
|
||||||
|
if (_98 == 16)
|
||||||
{
|
{
|
||||||
float3 _115 = float3(Texture0.sample(Sampler0, in.in_var_TEXCOORD0).x, Texture1.sample(Sampler1, in.in_var_TEXCOORD0).x, Texture2.sample(Sampler2, in.in_var_TEXCOORD0).x) + float3(-0.0625, -0.5, -0.5);
|
float3 _119 = float3(Texture0.sample(Sampler0, in.in_var_TEXCOORD0).x, Texture1.sample(Sampler1, in.in_var_TEXCOORD0).x, Texture2.sample(Sampler2, in.in_var_TEXCOORD0).x) + float3(-0.0625, -0.5, -0.5);
|
||||||
_128 = float4(dot(_115, float3(1.164000034332275390625, 0.0, 1.7929999828338623046875)), dot(_115, float3(1.164000034332275390625, -0.212999999523162841796875, -0.53299999237060546875)), dot(_115, float3(1.164000034332275390625, 2.111999988555908203125, 0.0)), 1.0);
|
_132 = float4(dot(_119, float3(1.164000034332275390625, 0.0, 1.7929999828338623046875)), dot(_119, float3(1.164000034332275390625, -0.212999999523162841796875, -0.53299999237060546875)), dot(_119, float3(1.164000034332275390625, 2.111999988555908203125, 0.0)), 1.0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
float4 _127;
|
float4 _131;
|
||||||
if (_94 == 0)
|
if (_98 == 0)
|
||||||
{
|
{
|
||||||
_127 = Texture0.sample(Sampler0, in.in_var_TEXCOORD0);
|
_131 = Texture0.sample(Sampler0, in.in_var_TEXCOORD0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_127 = _83;
|
_131 = _86;
|
||||||
}
|
}
|
||||||
_128 = _127;
|
_132 = _131;
|
||||||
}
|
}
|
||||||
if (_128.w < 0.00999999977648258209228515625)
|
float4 _138;
|
||||||
|
if ((_97 & 1) == 1)
|
||||||
|
{
|
||||||
|
_138 = powr(_132, float4(2.2000000476837158203125));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_138 = _132;
|
||||||
|
}
|
||||||
|
if (_138.w < 0.00999999977648258209228515625)
|
||||||
{
|
{
|
||||||
discard_fragment();
|
discard_fragment();
|
||||||
}
|
}
|
||||||
float3 _182;
|
float3 _192;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
float3 _139 = Uniforms.lightPosition.xyz - in.in_var_TEXCOORD1;
|
float3 _149 = Uniforms.lightPosition.xyz - in.in_var_TEXCOORD1;
|
||||||
float _140 = length(_139);
|
float _150 = length(_149);
|
||||||
float _141 = _140 * _140;
|
float _151 = _150 * _150;
|
||||||
float _147;
|
float _157;
|
||||||
if (_140 > 2.0)
|
if (_150 > 2.0)
|
||||||
{
|
{
|
||||||
_147 = 0.5 / _141;
|
_157 = 0.5 / _151;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_147 = 1.0 / _141;
|
_157 = 1.0 / _151;
|
||||||
}
|
}
|
||||||
float _152;
|
float _162;
|
||||||
if (_140 > 4.0)
|
if (_150 > 4.0)
|
||||||
{
|
{
|
||||||
_152 = _147 * 0.5;
|
_162 = _157 * 0.5;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_152 = _147;
|
_162 = _157;
|
||||||
}
|
}
|
||||||
float _154 = (_140 > 15.0) ? 0.0 : _152;
|
float _164 = (_150 > 15.0) ? 0.0 : _162;
|
||||||
float _156 = (_154 > 1.0) ? 1.0 : _154;
|
float _166 = (_164 > 1.0) ? 1.0 : _164;
|
||||||
if (length(in.in_var_TEXCOORD2) < 0.100000001490116119384765625)
|
if (length(in.in_var_TEXCOORD2) < 0.100000001490116119384765625)
|
||||||
{
|
{
|
||||||
_182 = (in.in_var_TEXCOORD1 * float3(0.800000011920928955078125, 0.800000011920928955078125, 0.5)) * _156;
|
_192 = (in.in_var_TEXCOORD1 * float3(0.800000011920928955078125, 0.800000011920928955078125, 0.5)) * _166;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
float3 _163 = fast::normalize(_139);
|
float3 _173 = fast::normalize(_149);
|
||||||
_182 = ((float3(0.800000011920928955078125, 0.800000011920928955078125, 0.5) * precise::max(dot(_163, in.in_var_TEXCOORD2), 0.0)) * _156) + (((float3(0.800000011920928955078125, 0.800000011920928955078125, 0.5) * powr(precise::max(dot(in.in_var_TEXCOORD2, fast::normalize(_163 + fast::normalize(in.in_var_TEXCOORD1 - Uniforms.viewPos.xyz))), 0.0), 30.0)) * 2.0) * _156);
|
_192 = ((float3(0.800000011920928955078125, 0.800000011920928955078125, 0.5) * precise::max(dot(_173, in.in_var_TEXCOORD2), 0.0)) * _166) + (((float3(0.800000011920928955078125, 0.800000011920928955078125, 0.5) * powr(precise::max(dot(in.in_var_TEXCOORD2, fast::normalize(_173 + fast::normalize(in.in_var_TEXCOORD1 - Uniforms.viewPos.xyz))), 0.0), 30.0)) * 2.0) * _166);
|
||||||
break;
|
break;
|
||||||
} while(false);
|
} while(false);
|
||||||
float3 _199 = ((in.in_var_TEXCOORD3.xyz / float3(in.in_var_TEXCOORD3.w)) * 0.5) + float3(0.5);
|
float3 _209 = ((in.in_var_TEXCOORD3.xyz / float3(in.in_var_TEXCOORD3.w)) * 0.5) + float3(0.5);
|
||||||
float3 _201;
|
float3 _211;
|
||||||
_201.x = _199.x;
|
_211.x = _209.x;
|
||||||
float2 _202 = _201.xy;
|
float2 _212 = _211.xy;
|
||||||
_202.y = -_199.y;
|
_212.y = -_209.y;
|
||||||
float _209;
|
float _219;
|
||||||
int _212;
|
int _222;
|
||||||
int _214;
|
int _224;
|
||||||
_209 = 0.0;
|
_219 = 0.0;
|
||||||
_212 = 0;
|
_222 = 0;
|
||||||
_214 = -4;
|
_224 = -4;
|
||||||
float _210;
|
float _220;
|
||||||
int _213;
|
int _223;
|
||||||
for (; _214 <= 4; _209 = _210, _212 = _213, _214++)
|
for (; _224 <= 4; _219 = _220, _222 = _223, _224++)
|
||||||
{
|
{
|
||||||
_213 = _212;
|
_223 = _222;
|
||||||
_210 = _209;
|
_220 = _219;
|
||||||
for (int _223 = -4; _223 <= 4; )
|
for (int _233 = -4; _233 <= 4; )
|
||||||
{
|
{
|
||||||
_213++;
|
|
||||||
_210 += float((in.in_var_TEXCOORD3.z - 0.004999999888241291046142578125) > DirectionalShadowDepthMap.sample(DirectionalShadowSampler, (_202 + float2(float(_223) * 0.000244140625, float(_214) * 0.000244140625))).x);
|
|
||||||
_223++;
|
_223++;
|
||||||
|
_220 += float((in.in_var_TEXCOORD3.z - 0.004999999888241291046142578125) > DirectionalShadowDepthMap.sample(DirectionalShadowSampler, (_212 + float2(float(_233) * 0.000244140625, float(_224) * 0.000244140625))).x);
|
||||||
|
_233++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
out.out_var_SV_Target0 = float4(powr(_128.xyz * ((float3(0.100000001490116119384765625) + _182) + ((Uniforms.directionalLightColor.xyz * precise::max(dot(Uniforms.directionalLight.xyz, in.in_var_TEXCOORD2), 0.0)) * (1.0 - (_209 / float(_212))))), float3(0.4545454680919647216796875)), _128.w);
|
out.out_var_SV_Target0 = float4(powr(_138.xyz * ((float3(0.100000001490116119384765625) + _192) + ((Uniforms.directionalLightColor.xyz * precise::max(dot(Uniforms.directionalLight.xyz, in.in_var_TEXCOORD2), 0.0)) * (1.0 - (_219 / float(_222))))), float3(0.4545454680919647216796875)), _138.w);
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -16,7 +16,9 @@ showWindow: bool = true,
|
||||||
fpcamera: *FpCamera = undefined,
|
fpcamera: *FpCamera = undefined,
|
||||||
|
|
||||||
videoplayer: *VideoPlayer = undefined,
|
videoplayer: *VideoPlayer = undefined,
|
||||||
|
doomplayer: *DoomPlayer = undefined,
|
||||||
videoplayerObject: core.Entity = undefined,
|
videoplayerObject: core.Entity = undefined,
|
||||||
|
doomplayerObject: core.Entity = undefined,
|
||||||
|
|
||||||
pub var NeonObjectTable: core.EngineObjectVTable = core.EngineObjectVTable.from(@This());
|
pub var NeonObjectTable: core.EngineObjectVTable = core.EngineObjectVTable.from(@This());
|
||||||
|
|
||||||
|
|
@ -82,9 +84,11 @@ pub fn prepare(self: *@This()) !void {
|
||||||
try assets.loadList(assetReferences);
|
try assets.loadList(assetReferences);
|
||||||
self.videoplayer = try VideoPlayer.create(self.allocator);
|
self.videoplayer = try VideoPlayer.create(self.allocator);
|
||||||
try self.videoplayer.startPlayback("LAPWING2.ogv");
|
try self.videoplayer.startPlayback("LAPWING2.ogv");
|
||||||
|
|
||||||
self.videoplayerObject = try self.videoplayer.createVideoPlayerEntity();
|
self.videoplayerObject = try self.videoplayer.createVideoPlayerEntity();
|
||||||
|
|
||||||
|
self.doomplayer = try DoomPlayer.create(self.allocator);
|
||||||
|
self.doomplayerObject = try self.doomplayer.createEntity();
|
||||||
|
|
||||||
// rend.setSkyboxTexture("t_skybox");
|
// rend.setSkyboxTexture("t_skybox");
|
||||||
|
|
||||||
const exitInput = try core.ActionBinding.create(core.MakeName("exit"));
|
const exitInput = try core.ActionBinding.create(core.MakeName("exit"));
|
||||||
|
|
@ -266,6 +270,7 @@ pub fn tick(self: *@This(), dt: f64) void {
|
||||||
const fdt: f32 = @floatCast(dt);
|
const fdt: f32 = @floatCast(dt);
|
||||||
|
|
||||||
self.videoplayer.tick(dt);
|
self.videoplayer.tick(dt);
|
||||||
|
self.doomplayer.tick(dt);
|
||||||
self.fpcamera.tick(dt);
|
self.fpcamera.tick(dt);
|
||||||
|
|
||||||
var movement = self.fpcamera.getForwardXZ().fmul(self.moveVector.z * fdt * self.cameraSpeed);
|
var movement = self.fpcamera.getForwardXZ().fmul(self.moveVector.z * fdt * self.cameraSpeed);
|
||||||
|
|
@ -294,7 +299,9 @@ pub fn tick(self: *@This(), dt: f64) void {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn deinit(self: *@This()) void {
|
pub fn deinit(self: *@This()) void {
|
||||||
|
self.doomplayer.destroy();
|
||||||
self.fpcamera.destroy();
|
self.fpcamera.destroy();
|
||||||
|
|
||||||
self.videoplayer.destroy();
|
self.videoplayer.destroy();
|
||||||
self.allocator.destroy(self);
|
self.allocator.destroy(self);
|
||||||
}
|
}
|
||||||
|
|
@ -309,6 +316,7 @@ pub fn main() anyerror!void {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const DoomPlayer = @import("doomplayer");
|
||||||
const VideoPlayer = @import("videoplayer");
|
const VideoPlayer = @import("videoplayer");
|
||||||
const FpCamera = @import("gameExtras").FpCamera;
|
const FpCamera = @import("gameExtras").FpCamera;
|
||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue