saving
This commit is contained in:
parent
ebe207170b
commit
99c11b8d28
|
|
@ -63,6 +63,10 @@ pub fn main() !void {
|
||||||
\\ }} else {{
|
\\ }} else {{
|
||||||
\\ try Struct.start_module(spec, NwArgs{{}}, allocator);
|
\\ try Struct.start_module(spec, NwArgs{{}}, allocator);
|
||||||
\\ }}
|
\\ }}
|
||||||
|
\\ if(core.MemoryTracker.MTGet()) |_|
|
||||||
|
\\ {{
|
||||||
|
\\ core.MemoryTracker.MTPrintStatsDelta();
|
||||||
|
\\ }}
|
||||||
\\ try shutdownList.append(allocator, Struct.shutdown_module);
|
\\ try shutdownList.append(allocator, Struct.shutdown_module);
|
||||||
\\ try shutdownModuleNames.append(allocator, feature);
|
\\ try shutdownModuleNames.append(allocator, feature);
|
||||||
\\ core.engine_logs("module started >>>> " ++ feature ++ " <<<<");
|
\\ core.engine_logs("module started >>>> " ++ feature ++ " <<<<");
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,9 @@ allocationsCount: u32 = 0,
|
||||||
totalAllocSize: usize = 0,
|
totalAllocSize: usize = 0,
|
||||||
eventsCount: usize = 0,
|
eventsCount: usize = 0,
|
||||||
|
|
||||||
|
untrackedAllocationsCount: u32 = 0,
|
||||||
|
untrackedAllocationsSize: usize = 0,
|
||||||
|
|
||||||
peakAllocations: u32 = 0,
|
peakAllocations: u32 = 0,
|
||||||
peakAllocSize: usize = 0,
|
peakAllocSize: usize = 0,
|
||||||
|
|
||||||
|
|
@ -258,11 +261,19 @@ pub fn deinit(self: *@This()) void {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn addUntrackedAllocation(self: *@This(), allocatedSize: usize) void {
|
pub fn addUntrackedAllocation(self: *@This(), allocatedSize: usize) void {
|
||||||
|
self.lock.lock();
|
||||||
|
self.untrackedAllocationsCount += 1;
|
||||||
|
self.untrackedAllocationsSize += allocatedSize;
|
||||||
self.totalAllocSize += allocatedSize;
|
self.totalAllocSize += allocatedSize;
|
||||||
|
self.lock.unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn removeUntrackedAllocation(self: *@This(), allocatedSize: usize) void {
|
pub fn removeUntrackedAllocation(self: *@This(), allocatedSize: usize) void {
|
||||||
|
self.lock.lock();
|
||||||
self.totalAllocSize -= allocatedSize;
|
self.totalAllocSize -= allocatedSize;
|
||||||
|
self.untrackedAllocationsCount -= 1;
|
||||||
|
self.untrackedAllocationsSize -= allocatedSize;
|
||||||
|
self.lock.unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
var gMemTracker: ?*@This() = null;
|
var gMemTracker: ?*@This() = null;
|
||||||
|
|
|
||||||
|
|
@ -116,6 +116,11 @@ pub const script = @import("script.zig");
|
||||||
pub const stacks = @import("stacks.zig");
|
pub const stacks = @import("stacks.zig");
|
||||||
pub const walkAndPrintStack = stacks.walkAndPrintStack;
|
pub const walkAndPrintStack = stacks.walkAndPrintStack;
|
||||||
|
|
||||||
|
pub const gameObject = @import("gameObject.zig");
|
||||||
|
|
||||||
|
pub const GameObject = gameObject.GameObject;
|
||||||
|
pub const GameObjectSystem = gameObject.GameObjectSystem;
|
||||||
|
|
||||||
pub fn fs() *PackerFS {
|
pub fn fs() *PackerFS {
|
||||||
return gPackerFS;
|
return gPackerFS;
|
||||||
}
|
}
|
||||||
|
|
@ -143,6 +148,7 @@ pub fn getSessionStamp() i64 {
|
||||||
// a struct can be used like a list of types in this way
|
// a struct can be used like a list of types in this way
|
||||||
pub const ComponentList = struct {
|
pub const ComponentList = struct {
|
||||||
pub const Scene = scene.Scene;
|
pub const Scene = scene.Scene;
|
||||||
|
pub const GameObject = gameObject.GameObject;
|
||||||
};
|
};
|
||||||
|
|
||||||
pub const ModuleStartupError = error{StartupFailed};
|
pub const ModuleStartupError = error{StartupFailed};
|
||||||
|
|
|
||||||
|
|
@ -1 +1,84 @@
|
||||||
|
// ok
|
||||||
|
//
|
||||||
|
// lets really cook a good API here
|
||||||
|
|
||||||
|
pub const GameObjectInterfaceVTable = struct {
|
||||||
|
destroy: *const fn (*anyopaque) void,
|
||||||
|
tick: ?*const fn (*anyopaque, f64) void,
|
||||||
|
getEntity: ?*const fn (*anyopaque) core.Entity,
|
||||||
|
objectBaseName: core.Name = core.DefineName("UnknownObject"),
|
||||||
|
create: *const fn (allocator: std.mem.Allocator, entity: core.Entity) *@This(),
|
||||||
|
|
||||||
|
messageHandlers: std.AutoHashMapUnmanaged(u32, MessageHandlerFunc) = .{},
|
||||||
|
|
||||||
|
pub const MessageHandlerFunc = *const fn (*anyopaque, *const MessageInfo, *anyopaque) void;
|
||||||
|
// fn onCustomMessage(self, meta: core.MessageInfo, m: *const MyCustomMessage) void
|
||||||
|
};
|
||||||
|
|
||||||
|
pub const MessageInfo = struct {
|
||||||
|
tag: core.Name,
|
||||||
|
sourceEntity: ?core.Entity = null,
|
||||||
|
sourceSystem: ?core.Name = null,
|
||||||
|
// maybe add like a filter type? or an invoker?
|
||||||
|
};
|
||||||
|
|
||||||
|
pub const GameObjectRef = struct {
|
||||||
|
table: *GameObjectInterfaceVTable,
|
||||||
|
ptr: *anyopaque,
|
||||||
|
};
|
||||||
|
|
||||||
|
pub const GameObject = struct {
|
||||||
|
pub var BaseContainer: *core.SparseSet(GameObject) = undefined;
|
||||||
|
pub const ComponentName = "core.GameObject";
|
||||||
|
pub const ScriptExports: []const []const u8 = &.{};
|
||||||
|
|
||||||
|
// set by GameObjectSystem when it calls Entity
|
||||||
|
objectRef: GameObjectRef = undefined,
|
||||||
|
|
||||||
|
pub fn setObjectReference(self: *@This(), table: *GameObjectInterfaceVTable, object: *anyopaque) void {
|
||||||
|
self.objectRef.table = table;
|
||||||
|
self.objectRef.ptr = object;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
pub const GameObjectSystem = struct {
|
||||||
|
|
||||||
|
// this is the new one, GameObjectList should be deleted after this passes initial usability
|
||||||
|
pub var NeonObjectTable = core.EngineObjectVTable.from(@This(), "core.GameObjectSystem");
|
||||||
|
|
||||||
|
allocator: std.mem.Allocator,
|
||||||
|
objectDefinitions: *core.SparseMap(GameObjectInterfaceVTable),
|
||||||
|
|
||||||
|
pub fn create(allocator: std.mem.Allocator) !*@This() {
|
||||||
|
const self = try allocator.create(*@This());
|
||||||
|
|
||||||
|
self.* = .{
|
||||||
|
.allocator = allocator,
|
||||||
|
.sparseMap = try core.SparseMap(GameObjectInterfaceVTable).create(allocator),
|
||||||
|
};
|
||||||
|
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn spawnObjectByType(self: *@This(), comptime T: type) !*T {
|
||||||
|
_ = self;
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn tick(self: *@This(), dt: f64) void {
|
||||||
|
// for (self.objects.items) |object| {
|
||||||
|
//if (object.vtable.tick) |tick_fn| {
|
||||||
|
//tick_fn(object.ptr, dt);
|
||||||
|
//}
|
||||||
|
//}
|
||||||
|
_ = self;
|
||||||
|
_ = dt;
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn destroy(self: *@This()) void {
|
||||||
|
self.objects.deinit();
|
||||||
|
self.allocator.destroy(self);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const core = @import("core.zig");
|
||||||
|
const std = @import("std");
|
||||||
|
|
|
||||||
|
|
@ -565,6 +565,13 @@ pub const InputStack = struct {
|
||||||
|
|
||||||
keysDown: std.AutoHashMapUnmanaged(Key, bool) = .{},
|
keysDown: std.AutoHashMapUnmanaged(Key, bool) = .{},
|
||||||
|
|
||||||
|
mousePosition: core.Vector2f = .{},
|
||||||
|
|
||||||
|
pub fn setMousePosition(self: *@This(), x: f32, y: f32) void {
|
||||||
|
self.mousePosition.x = x;
|
||||||
|
self.mousePosition.y = y;
|
||||||
|
}
|
||||||
|
|
||||||
pub var NeonObjectTable: core.EngineObjectVTable = core.EngineObjectVTable.from(@This(), "core.InputStack");
|
pub var NeonObjectTable: core.EngineObjectVTable = core.EngineObjectVTable.from(@This(), "core.InputStack");
|
||||||
|
|
||||||
pub fn init(allocator: std.mem.Allocator) !*@This() {
|
pub fn init(allocator: std.mem.Allocator) !*@This() {
|
||||||
|
|
|
||||||
|
|
@ -159,6 +159,18 @@ pub fn Vector2Type(comptime T: type, comptime typeName: []const u8) type {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub inline fn negate(self: @This()) @This() {
|
||||||
|
return .{ .x = -self.x, .y = self.y };
|
||||||
|
}
|
||||||
|
|
||||||
|
pub inline fn cross(self: @This(), other: @This()) T {
|
||||||
|
return self.x * other.y - self.y * other.x;
|
||||||
|
}
|
||||||
|
|
||||||
|
pub inline fn removeComponent(self: @This(), other: @This()) @This() {
|
||||||
|
return self.sub(other.fmul(self.dot(other)));
|
||||||
|
}
|
||||||
|
|
||||||
pub inline fn from(o: anytype) @This() {
|
pub inline fn from(o: anytype) @This() {
|
||||||
const OType: std.builtin.Type = @typeInfo(@TypeOf(o.x));
|
const OType: std.builtin.Type = @typeInfo(@TypeOf(o.x));
|
||||||
switch (@typeInfo(T)) {
|
switch (@typeInfo(T)) {
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// helper, add this to your game manager class and invoke it's tick,
|
// helper, add this to your game manager class and invoke it's tick.
|
||||||
//
|
//
|
||||||
// will automatically manage spawning and despawning entities and manage de-initialization for you
|
// will automatically manage spawning and despawning entities and manage de-initialization for you
|
||||||
// i actually don't reccomend using this for the most part for more serious games
|
// i actually don't reccomend using this for the most part for more serious games
|
||||||
|
|
@ -8,7 +8,9 @@
|
||||||
//
|
//
|
||||||
// however if you want to define prefabs, then something like this might be useful.
|
// however if you want to define prefabs, then something like this might be useful.
|
||||||
//
|
//
|
||||||
// Like i said, more geared towards gamejams and toys than serious work.
|
// if this were to be a bit more serious...
|
||||||
|
//
|
||||||
|
// how would i use it.
|
||||||
|
|
||||||
pub const GameObjectInterfaceVTable = struct {
|
pub const GameObjectInterfaceVTable = struct {
|
||||||
destroy: *const fn (*anyopaque) void,
|
destroy: *const fn (*anyopaque) void,
|
||||||
|
|
@ -42,6 +44,7 @@ pub const GameObjectList = struct {
|
||||||
allocator: std.mem.Allocator,
|
allocator: std.mem.Allocator,
|
||||||
|
|
||||||
// slots might be better? allow for stable indexes?
|
// slots might be better? allow for stable indexes?
|
||||||
|
// index pool?
|
||||||
objects: std.ArrayListUnmanaged(GameObjectInterface) = .{},
|
objects: std.ArrayListUnmanaged(GameObjectInterface) = .{},
|
||||||
|
|
||||||
pub fn create(allocator: std.mem.Allocator) !*@This() {
|
pub fn create(allocator: std.mem.Allocator) !*@This() {
|
||||||
|
|
|
||||||
|
|
@ -1206,7 +1206,7 @@ pub const Context = struct {
|
||||||
const defaultHeight = 16;
|
const defaultHeight = 16;
|
||||||
const sizePerLine: f32 = defaultHeight + 2;
|
const sizePerLine: f32 = defaultHeight + 2;
|
||||||
const yOffsetPerLine: f32 = defaultHeight + 1;
|
const yOffsetPerLine: f32 = defaultHeight + 1;
|
||||||
var yOffset: f32 = sizePerLine;
|
var yOffset: f32 = sizePerLine * 2;
|
||||||
const width = defaultHeight / 2 * 120;
|
const width = defaultHeight / 2 * 120;
|
||||||
|
|
||||||
const fontHandle = self.fontCache.defaultMonoFont.atlas.fontHandle;
|
const fontHandle = self.fontCache.defaultMonoFont.atlas.fontHandle;
|
||||||
|
|
|
||||||
|
|
@ -209,8 +209,13 @@ pub const PlatformInstance = struct {
|
||||||
if (self.imguiMouseConsumed and (event.type == sdl3.events.mouse_button_down or event.type == sdl3.events.mouse_button_up)) {
|
if (self.imguiMouseConsumed and (event.type == sdl3.events.mouse_button_down or event.type == sdl3.events.mouse_button_up)) {
|
||||||
shouldSkip = true;
|
shouldSkip = true;
|
||||||
}
|
}
|
||||||
if (!shouldSkip)
|
if (!shouldSkip) {
|
||||||
inputStack.routeEvent(converted);
|
inputStack.routeEvent(converted);
|
||||||
|
|
||||||
|
if (event.type == sdl3.events.mouse_motion) {
|
||||||
|
inputStack.setMousePosition(self.cursorPos.x, self.cursorPos.y);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (event.type) {
|
switch (event.type) {
|
||||||
|
|
|
||||||
|
|
@ -375,6 +375,7 @@ pub const ParticleEmitter = struct {
|
||||||
self.entity = core.Entity{ .handle = handle };
|
self.entity = core.Entity{ .handle = handle };
|
||||||
|
|
||||||
self.texture = rend.getTexture(&t_whiteName).?;
|
self.texture = rend.getTexture(&t_whiteName).?;
|
||||||
|
core.engine_logs("wtf");
|
||||||
self.mesh = rend.getMeshByName(&m_quad).?;
|
self.mesh = rend.getMeshByName(&m_quad).?;
|
||||||
|
|
||||||
if (self.entity.fetch(core.Scene)) |scene| {
|
if (self.entity.fetch(core.Scene)) |scene| {
|
||||||
|
|
|
||||||
|
|
@ -155,7 +155,7 @@ pub fn createBuffers(self: *@This()) !void {
|
||||||
.props = 0,
|
.props = 0,
|
||||||
});
|
});
|
||||||
|
|
||||||
self.ssobUpload = self.device.createGPUTransferBuffer(&.{
|
self.ssobUpload = rend.renderer.createGPUTransferBuffer(&.{
|
||||||
.usage = .transferbufferusageUpload,
|
.usage = .transferbufferusageUpload,
|
||||||
.size = MaxObjectCount * @sizeOf(debug_vert.Scene),
|
.size = MaxObjectCount * @sizeOf(debug_vert.Scene),
|
||||||
.props = 0,
|
.props = 0,
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ pub fn create(allocator: std.mem.Allocator) !*@This() {
|
||||||
.props = 0,
|
.props = 0,
|
||||||
});
|
});
|
||||||
|
|
||||||
self.ssboSceneUpload = device.createGPUTransferBuffer(&.{
|
self.ssboSceneUpload = rend.renderer.createGPUTransferBuffer(&.{
|
||||||
.usage = .transferbufferusageUpload,
|
.usage = .transferbufferusageUpload,
|
||||||
.size = MaxParticleCount * @sizeOf(meshes_vert.Scene),
|
.size = MaxParticleCount * @sizeOf(meshes_vert.Scene),
|
||||||
.props = 0,
|
.props = 0,
|
||||||
|
|
|
||||||
|
|
@ -101,13 +101,14 @@ pub fn uploadCubeFromPaths(self: *@This(), name: core.Name, paths: []const []con
|
||||||
try core.assert(cubeList.items[0].size.x == cubeList.items[0].size.y);
|
try core.assert(cubeList.items[0].size.x == cubeList.items[0].size.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
const transferBuffer = self.device.createGPUTransferBuffer(&.{
|
const transferBufferSize = textureSize * textureSize * @sizeOf(u32);
|
||||||
|
const transferBuffer = rend.renderer.createGPUTransferBuffer(&.{
|
||||||
.usage = .transferbufferusageUpload,
|
.usage = .transferbufferusageUpload,
|
||||||
.size = textureSize * textureSize * @sizeOf(u32),
|
.size = textureSize * textureSize * @sizeOf(u32),
|
||||||
.props = 0,
|
.props = 0,
|
||||||
});
|
});
|
||||||
|
|
||||||
defer self.device.releaseGPUTransferBuffer(transferBuffer);
|
defer rend.renderer.releaseGPUTransferBuffer(transferBuffer, transferBufferSize);
|
||||||
|
|
||||||
const gtti: gpu.GPUTextureTransferInfo = .{
|
const gtti: gpu.GPUTextureTransferInfo = .{
|
||||||
.transfer_buffer = transferBuffer,
|
.transfer_buffer = transferBuffer,
|
||||||
|
|
@ -199,9 +200,10 @@ pub fn uploadTextureFromBytes(self: *@This(), name: *core.Name, opts: UploadText
|
||||||
.num_levels = mipLevelCount,
|
.num_levels = mipLevelCount,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
const transferBuffer = self.device.createGPUTransferBuffer(&.{
|
const transferBufferSize = opts.size.x * opts.size.y * @sizeOf(u32);
|
||||||
|
const transferBuffer = rend.renderer.createGPUTransferBuffer(&.{
|
||||||
.usage = .transferbufferusageUpload,
|
.usage = .transferbufferusageUpload,
|
||||||
.size = opts.size.x * opts.size.y * @sizeOf(u32),
|
.size = transferBufferSize,
|
||||||
.props = 0,
|
.props = 0,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -240,7 +242,7 @@ pub fn uploadTextureFromBytes(self: *@This(), name: *core.Name, opts: UploadText
|
||||||
if (!cmd.submitGPUCommandBuffer()) {
|
if (!cmd.submitGPUCommandBuffer()) {
|
||||||
return error.CopyFailed;
|
return error.CopyFailed;
|
||||||
}
|
}
|
||||||
self.device.releaseGPUTransferBuffer(transferBuffer);
|
rend.renderer.releaseGPUTransferBuffer(transferBuffer, transferBufferSize);
|
||||||
|
|
||||||
const tex = try self.allocator.create(Texture);
|
const tex = try self.allocator.create(Texture);
|
||||||
tex.* = .{
|
tex.* = .{
|
||||||
|
|
@ -277,9 +279,10 @@ pub fn uploadTextureFromPath(self: *@This(), name: core.Name, path: []const u8)
|
||||||
.num_levels = mipLevelCount,
|
.num_levels = mipLevelCount,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
const transferBuffer = self.device.createGPUTransferBuffer(&.{
|
const transferBufferSize = png.size.x * png.size.y * @sizeOf(u32);
|
||||||
|
const transferBuffer = rend.renderer.createGPUTransferBuffer(&.{
|
||||||
.usage = .transferbufferusageUpload,
|
.usage = .transferbufferusageUpload,
|
||||||
.size = png.size.x * png.size.y * @sizeOf(u32),
|
.size = transferBufferSize,
|
||||||
.props = 0,
|
.props = 0,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -318,7 +321,7 @@ pub fn uploadTextureFromPath(self: *@This(), name: core.Name, path: []const u8)
|
||||||
if (!cmd.submitGPUCommandBuffer()) {
|
if (!cmd.submitGPUCommandBuffer()) {
|
||||||
return error.CopyFailed;
|
return error.CopyFailed;
|
||||||
}
|
}
|
||||||
self.device.releaseGPUTransferBuffer(transferBuffer);
|
rend.renderer.releaseGPUTransferBuffer(transferBuffer, transferBufferSize);
|
||||||
|
|
||||||
const tex = try self.allocator.create(Texture);
|
const tex = try self.allocator.create(Texture);
|
||||||
tex.* = .{
|
tex.* = .{
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ pub const MeshPool = struct {
|
||||||
device: *gpu.GPUDevice,
|
device: *gpu.GPUDevice,
|
||||||
|
|
||||||
destroyList: std.ArrayList(*gpu.GPUTransferBuffer),
|
destroyList: std.ArrayList(*gpu.GPUTransferBuffer),
|
||||||
|
destroyListSizes: std.ArrayList(usize),
|
||||||
|
|
||||||
installedMeshes: std.AutoHashMapUnmanaged(u32, meshes.IndexedMesh) = .{},
|
installedMeshes: std.AutoHashMapUnmanaged(u32, meshes.IndexedMesh) = .{},
|
||||||
|
|
||||||
|
|
@ -26,6 +27,7 @@ pub const MeshPool = struct {
|
||||||
.vertexSpans = try core.MergedSpans.init(allocator, settings.vertexCount),
|
.vertexSpans = try core.MergedSpans.init(allocator, settings.vertexCount),
|
||||||
.meshUpdates = try core.RingQueue(rend.MeshUpdate).init(allocator, 128),
|
.meshUpdates = try core.RingQueue(rend.MeshUpdate).init(allocator, 128),
|
||||||
.destroyList = std.ArrayList(*gpu.GPUTransferBuffer).init(allocator),
|
.destroyList = std.ArrayList(*gpu.GPUTransferBuffer).init(allocator),
|
||||||
|
.destroyListSizes = std.ArrayList(usize).init(allocator),
|
||||||
.device = device,
|
.device = device,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -67,11 +69,12 @@ pub const MeshPool = struct {
|
||||||
pub fn onUploadCleanup(p: *anyopaque) void {
|
pub fn onUploadCleanup(p: *anyopaque) void {
|
||||||
const self: *@This() = @ptrCast(@alignCast(p));
|
const self: *@This() = @ptrCast(@alignCast(p));
|
||||||
|
|
||||||
for (self.destroyList.items) |transferBuffer| {
|
for (self.destroyList.items, 0..) |transferBuffer, i| {
|
||||||
self.device.releaseGPUTransferBuffer(transferBuffer);
|
rend.renderer.releaseGPUTransferBuffer(transferBuffer, self.destroyListSizes.items[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
self.destroyList.clearRetainingCapacity();
|
self.destroyList.clearRetainingCapacity();
|
||||||
|
self.destroyListSizes.clearRetainingCapacity();
|
||||||
}
|
}
|
||||||
|
|
||||||
pub const JointMap = std.AutoHashMapUnmanaged(u32, u32);
|
pub const JointMap = std.AutoHashMapUnmanaged(u32, u32);
|
||||||
|
|
@ -170,8 +173,10 @@ pub const MeshPool = struct {
|
||||||
uploadSlice: []const T,
|
uploadSlice: []const T,
|
||||||
) !core.Span {
|
) !core.Span {
|
||||||
const newSpan = try mergedSpans.allocate(@intCast(uploadSlice.len));
|
const newSpan = try mergedSpans.allocate(@intCast(uploadSlice.len));
|
||||||
const upload = self.device.createGPUTransferBuffer(&.{ .usage = .transferbufferusageUpload, .size = @sizeOf(T) * newSpan.size, .props = 0 });
|
const uploadSize = @sizeOf(T) * newSpan.size;
|
||||||
|
const upload = rend.renderer.createGPUTransferBuffer(&.{ .usage = .transferbufferusageUpload, .size = uploadSize, .props = 0 });
|
||||||
try self.destroyList.append(upload);
|
try self.destroyList.append(upload);
|
||||||
|
try self.destroyListSizes.append(uploadSize);
|
||||||
|
|
||||||
var mappedSlice: []T = undefined;
|
var mappedSlice: []T = undefined;
|
||||||
mappedSlice.ptr = @ptrCast(@alignCast(self.device.mapGPUTransferBuffer(upload, false)));
|
mappedSlice.ptr = @ptrCast(@alignCast(self.device.mapGPUTransferBuffer(upload, false)));
|
||||||
|
|
@ -207,6 +212,7 @@ pub const MeshPool = struct {
|
||||||
|
|
||||||
self.installedMeshes.deinit(self.allocator);
|
self.installedMeshes.deinit(self.allocator);
|
||||||
self.destroyList.deinit();
|
self.destroyList.deinit();
|
||||||
|
self.destroyListSizes.deinit();
|
||||||
self.indexSpans.deinit();
|
self.indexSpans.deinit();
|
||||||
self.meshUpdates.deinit();
|
self.meshUpdates.deinit();
|
||||||
self.vertexSpans.deinit();
|
self.vertexSpans.deinit();
|
||||||
|
|
|
||||||
|
|
@ -623,7 +623,7 @@ pub const Renderer = struct {
|
||||||
.props = 0,
|
.props = 0,
|
||||||
});
|
});
|
||||||
|
|
||||||
self.ssboSceneUpload = self.device.createGPUTransferBuffer(&.{
|
self.ssboSceneUpload = createGPUTransferBuffer(&.{
|
||||||
.usage = .transferbufferusageUpload,
|
.usage = .transferbufferusageUpload,
|
||||||
.size = MaxObjectCount * @sizeOf(meshes_vert.Scene),
|
.size = MaxObjectCount * @sizeOf(meshes_vert.Scene),
|
||||||
.props = 0,
|
.props = 0,
|
||||||
|
|
@ -638,7 +638,7 @@ pub const Renderer = struct {
|
||||||
.props = 0,
|
.props = 0,
|
||||||
});
|
});
|
||||||
|
|
||||||
self.ssboAnimationUpload = self.device.createGPUTransferBuffer(&.{
|
self.ssboAnimationUpload = createGPUTransferBuffer(&.{
|
||||||
.usage = .transferbufferusageUpload,
|
.usage = .transferbufferusageUpload,
|
||||||
.size = MaxObjectCount * @sizeOf(meshes_vert.BoneTransform),
|
.size = MaxObjectCount * @sizeOf(meshes_vert.BoneTransform),
|
||||||
.props = 0,
|
.props = 0,
|
||||||
|
|
@ -1284,6 +1284,16 @@ pub fn getTexture(name: *core.Name) ?*rend.Texture {
|
||||||
return context().textureList.map.get(name.handle());
|
return context().textureList.map.get(name.handle());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn createGPUTransferBuffer(createInfo: *const gpu.GPUTransferBufferCreateInfo) *gpu.GPUTransferBuffer {
|
||||||
|
core.MemoryTracker.MTAddUntrackedAllocation(@intCast(createInfo.size));
|
||||||
|
return context().device.createGPUTransferBuffer(createInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn releaseGPUTransferBuffer(transferBuffer: *gpu.GPUTransferBuffer, size: usize) void {
|
||||||
|
core.MemoryTracker.MTRemoveAllocation(size);
|
||||||
|
context().device.releaseGPUTransferBuffer(transferBuffer);
|
||||||
|
}
|
||||||
|
|
||||||
pub const RendererState = struct {
|
pub const RendererState = struct {
|
||||||
copyPass: ?*gpu.GPURenderPass = null,
|
copyPass: ?*gpu.GPURenderPass = null,
|
||||||
pass: ?*gpu.GPURenderPass = null,
|
pass: ?*gpu.GPURenderPass = null,
|
||||||
|
|
|
||||||
|
|
@ -70,12 +70,13 @@ pub fn createNoiseTexture(self: *@This()) !void {
|
||||||
});
|
});
|
||||||
self.noiseTexture = ctx.device.createGPUTexture(&tci);
|
self.noiseTexture = ctx.device.createGPUTexture(&tci);
|
||||||
|
|
||||||
const transferBuffer = ctx.device.createGPUTransferBuffer(&.{
|
const transferBufferSize = textureSize * textureSize * @sizeOf(f32) * 4;
|
||||||
|
const transferBuffer = rend.renderer.createGPUTransferBuffer(&.{
|
||||||
.usage = .transferbufferusageUpload,
|
.usage = .transferbufferusageUpload,
|
||||||
.size = textureSize * textureSize * @sizeOf(f32) * 4,
|
.size = transferBufferSize,
|
||||||
.props = 0,
|
.props = 0,
|
||||||
});
|
});
|
||||||
defer ctx.device.releaseGPUTransferBuffer(transferBuffer);
|
defer rend.renderer.releaseGPUTransferBuffer(transferBuffer, transferBufferSize);
|
||||||
|
|
||||||
const gtti: gpu.GPUTextureTransferInfo = .{
|
const gtti: gpu.GPUTextureTransferInfo = .{
|
||||||
.transfer_buffer = transferBuffer,
|
.transfer_buffer = transferBuffer,
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,8 @@ textRenderers: std.AutoHashMapUnmanaged(*papyrus.Context, *TextRenderer) = .{},
|
||||||
|
|
||||||
reloadingShaders: bool = false,
|
reloadingShaders: bool = false,
|
||||||
|
|
||||||
|
lastEventsCount: u64 = 0,
|
||||||
|
|
||||||
const DrawCommand = union(enum(u8)) {
|
const DrawCommand = union(enum(u8)) {
|
||||||
rect: struct {
|
rect: struct {
|
||||||
ssboIndex: u32,
|
ssboIndex: u32,
|
||||||
|
|
@ -66,7 +68,7 @@ const SsboBuffer = struct {
|
||||||
.props = 0,
|
.props = 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
self.staging = device.createGPUTransferBuffer(&bci);
|
self.staging = rend.renderer.createGPUTransferBuffer(&bci);
|
||||||
}
|
}
|
||||||
|
|
||||||
core.engine_log("buffer created elementSize: {d} count: {d}", .{ elementSize, count });
|
core.engine_log("buffer created elementSize: {d} count: {d}", .{ elementSize, count });
|
||||||
|
|
@ -129,9 +131,27 @@ pub fn create(allocator: std.mem.Allocator) !*@This() {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn tick(self: *@This(), dt: f64) void {
|
pub fn tick(self: *@This(), dt: f64) void {
|
||||||
|
const inputStack = core.getInputStack();
|
||||||
|
self.screenContext.setCursorLocation(.{
|
||||||
|
.x = @floatCast(inputStack.mousePosition.x),
|
||||||
|
.y = @floatCast(inputStack.mousePosition.y),
|
||||||
|
});
|
||||||
|
|
||||||
self.screenContext.tick(dt) catch {
|
self.screenContext.tick(dt) catch {
|
||||||
core.engine_errs("unable to tick papyrus");
|
core.engine_errs("unable to tick papyrus");
|
||||||
};
|
};
|
||||||
|
|
||||||
|
self.screenContext.pushDebugText("fps: {d:.2} ({d:.4}ms)", .{ 1 / core.getEngine().averageFrameTime, core.getEngine().averageFrameTime }) catch {};
|
||||||
|
|
||||||
|
if (core.MemoryTracker.MTGet()) |tracker| {
|
||||||
|
self.screenContext.pushDebugText("memory used: {d:.4} MiB in {d} allocations {d} events per frame", .{
|
||||||
|
@as(f64, @floatFromInt(tracker.totalAllocSize)) / 1024 / 1024,
|
||||||
|
tracker.allocationsCount,
|
||||||
|
tracker.eventsCount - self.lastEventsCount,
|
||||||
|
}) catch {};
|
||||||
|
|
||||||
|
self.lastEventsCount = tracker.eventsCount;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn setup(self: *@This()) !void {
|
pub fn setup(self: *@This()) !void {
|
||||||
|
|
|
||||||
|
|
@ -383,7 +383,9 @@ pub const TextMeshBuffer = struct {
|
||||||
indexBuffer: *gpu.GPUBuffer = undefined,
|
indexBuffer: *gpu.GPUBuffer = undefined,
|
||||||
vertexBuffer: *gpu.GPUBuffer = undefined,
|
vertexBuffer: *gpu.GPUBuffer = undefined,
|
||||||
indexTransferBuffer: *gpu.GPUTransferBuffer = undefined,
|
indexTransferBuffer: *gpu.GPUTransferBuffer = undefined,
|
||||||
|
indexTransferBufferSize: usize,
|
||||||
vertexTransferBuffer: *gpu.GPUTransferBuffer = undefined,
|
vertexTransferBuffer: *gpu.GPUTransferBuffer = undefined,
|
||||||
|
vertexTransferBufferSize: usize,
|
||||||
indexCount: u32 = 0,
|
indexCount: u32 = 0,
|
||||||
isSDF: bool = true,
|
isSDF: bool = true,
|
||||||
fontHandle: u32 = 0,
|
fontHandle: u32 = 0,
|
||||||
|
|
@ -395,15 +397,18 @@ pub const TextMeshBuffer = struct {
|
||||||
const vertexBufferCount: u32 = maxChars * 4;
|
const vertexBufferCount: u32 = maxChars * 4;
|
||||||
const indexBufferCount: u32 = maxChars * 6;
|
const indexBufferCount: u32 = maxChars * 6;
|
||||||
|
|
||||||
|
self.vertexTransferBufferSize = vertexBufferCount * @sizeOf(TextMeshVertex);
|
||||||
|
self.indexTransferBufferSize = indexBufferCount * @sizeOf(u32);
|
||||||
|
|
||||||
const ctx = rend.context();
|
const ctx = rend.context();
|
||||||
|
|
||||||
self.vertexTransferBuffer = ctx.device.createGPUTransferBuffer(&.{
|
self.vertexTransferBuffer = rend.renderer.createGPUTransferBuffer(&.{
|
||||||
.usage = .transferbufferusageUpload,
|
.usage = .transferbufferusageUpload,
|
||||||
.size = vertexBufferCount * @sizeOf(TextMeshVertex),
|
.size = vertexBufferCount * @sizeOf(TextMeshVertex),
|
||||||
.props = 0,
|
.props = 0,
|
||||||
});
|
});
|
||||||
|
|
||||||
self.indexTransferBuffer = ctx.device.createGPUTransferBuffer(&.{
|
self.indexTransferBuffer = rend.renderer.createGPUTransferBuffer(&.{
|
||||||
.usage = .transferbufferusageUpload,
|
.usage = .transferbufferusageUpload,
|
||||||
.size = indexBufferCount * @sizeOf(u32),
|
.size = indexBufferCount * @sizeOf(u32),
|
||||||
.props = 0,
|
.props = 0,
|
||||||
|
|
@ -429,8 +434,8 @@ pub const TextMeshBuffer = struct {
|
||||||
|
|
||||||
ctx.device.releaseGPUBuffer(self.indexBuffer);
|
ctx.device.releaseGPUBuffer(self.indexBuffer);
|
||||||
ctx.device.releaseGPUBuffer(self.vertexBuffer);
|
ctx.device.releaseGPUBuffer(self.vertexBuffer);
|
||||||
ctx.device.releaseGPUTransferBuffer(self.indexTransferBuffer);
|
rend.renderer.releaseGPUTransferBuffer(self.indexTransferBuffer, self.indexTransferBufferSize);
|
||||||
ctx.device.releaseGPUTransferBuffer(self.vertexTransferBuffer);
|
rend.renderer.releaseGPUTransferBuffer(self.vertexTransferBuffer, self.vertexTransferBufferSize);
|
||||||
|
|
||||||
allocator.destroy(self);
|
allocator.destroy(self);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -66,6 +66,26 @@ pub fn windowOpen(entry: *igu.MenuEntry, dt: f64) void {
|
||||||
rend.setSkyboxTexture(name.utf8());
|
rend.setSkyboxTexture(name.utf8());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ig.textFmt("textures", .{}) catch unreachable;
|
||||||
|
ig.separator();
|
||||||
|
|
||||||
|
{
|
||||||
|
var iter = rend.context().textureList.map.iterator();
|
||||||
|
while (iter.next()) |n| {
|
||||||
|
ig.textFmt("{s}", .{n.value_ptr.*.name.utf8()}) catch unreachable;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ig.textFmt("meshes", .{}) catch unreachable;
|
||||||
|
ig.separator();
|
||||||
|
|
||||||
|
{
|
||||||
|
var iter = rend.context().meshPool.installedMeshes.iterator();
|
||||||
|
while (iter.next()) |n| {
|
||||||
|
ig.textFmt("{s}", .{n.value_ptr.*.name.utf8()}) catch unreachable;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ig.end();
|
ig.end();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
pub const FpCamera = @import("gameplay/FpCamera.zig");
|
pub const FpCamera = @import("gameplay/FpCamera.zig");
|
||||||
pub const pawns = @import("gameplay/pawns.zig");
|
|
||||||
pub const games = @import("gameplay/games.zig");
|
pub const games = @import("gameplay/games.zig");
|
||||||
|
|
||||||
pub const inputDebugger = @import("debuggers/inputDebugger.zig");
|
pub const inputDebugger = @import("debuggers/inputDebugger.zig");
|
||||||
|
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
// creates a
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
// this is an implementation of
|
|
||||||
|
|
@ -175,16 +175,16 @@ pub const Name = struct {
|
||||||
return getRegistry().pagedVector.get(self.index.?).*;
|
return getRegistry().pagedVector.get(self.index.?).*;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn eql(self: *const @This(), other: *const @This()) bool {
|
pub fn eql(self: *@This(), other: *@This()) bool {
|
||||||
if (self.index == null) {
|
if (self.index == null) {
|
||||||
const index = getRegistry().InstallNameInner(self.string, false);
|
const index = getRegistry().InstallNameInner(self.string, false);
|
||||||
const mutableThis = @as(*@This(), @ptrCast(@constCast(self)));
|
const mutableThis = self;
|
||||||
mutableThis.*.index = index;
|
mutableThis.*.index = index;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (other.index == null) {
|
if (other.index == null) {
|
||||||
const index = getRegistry().InstallNameInner(self.string, false);
|
const index = getRegistry().InstallNameInner(self.string, false);
|
||||||
const mutableThis = @as(*@This(), @ptrCast(@constCast(self)));
|
const mutableThis = self;
|
||||||
mutableThis.*.index = index;
|
mutableThis.*.index = index;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -555,6 +555,10 @@ pub fn SparseSetAdvanced(comptime T: type, comptime SparseSize: u32) type {
|
||||||
self.dense.deinit(self.allocator);
|
self.dense.deinit(self.allocator);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn denseList(self: @This()) []const T {
|
||||||
|
return self.dense.items;
|
||||||
|
}
|
||||||
|
|
||||||
pub const EcsContainerInterfaceVTable = EcsContainerInterface.Implement(@This());
|
pub const EcsContainerInterfaceVTable = EcsContainerInterface.Implement(@This());
|
||||||
|
|
||||||
pub fn handleExists(self: @This(), handle: SetHandle) bool {
|
pub fn handleExists(self: @This(), handle: SetHandle) bool {
|
||||||
|
|
|
||||||
|
|
@ -164,7 +164,6 @@ pub const PackerFS = struct {
|
||||||
|
|
||||||
pub fn watchCallback(path: [*c]const u8, ctx: ?*anyopaque) callconv(.C) void {
|
pub fn watchCallback(path: [*c]const u8, ctx: ?*anyopaque) callconv(.C) void {
|
||||||
const self: *@This() = @ptrCast(@alignCast(ctx));
|
const self: *@This() = @ptrCast(@alignCast(ctx));
|
||||||
// std.debug.print("WE GOT OURSELFS A FUCKIN CALLBAKC FOR A PATH MOTHERF- {s} {p} {d}\n", .{ path, ctx.?, self.pakMountings.items.len });
|
|
||||||
|
|
||||||
for (self.fileWatchCallbacks.items) |*watch| {
|
for (self.fileWatchCallbacks.items) |*watch| {
|
||||||
// std.debug.print("checking {s} {s}\n", .{ watch.path, path });
|
// std.debug.print("checking {s} {s}\n", .{ watch.path, path });
|
||||||
|
|
|
||||||
|
|
@ -55,13 +55,20 @@ pub const ExternGameObject = struct {
|
||||||
|
|
||||||
//lmao: bool = false,
|
//lmao: bool = false,
|
||||||
//lmao2: bool = true,
|
//lmao2: bool = true,
|
||||||
a: bool = false,
|
|
||||||
// lib: bool = false,
|
// lib: bool = false,
|
||||||
//s: u32 = 0x42,
|
//s: u32 = 0x42,
|
||||||
|
|
||||||
fireInput: ?*core.ActionBinding = null,
|
fireInput: ?*core.ActionBinding = null,
|
||||||
altFireInput: ?*core.ActionBinding = null,
|
altFireInput: ?*core.ActionBinding = null,
|
||||||
|
|
||||||
|
a: core.Vector2f = .{ .x = 1, .y = 4 },
|
||||||
|
b: core.Vector2f = .{ .x = 4, .y = 1 },
|
||||||
|
|
||||||
|
Anormal: core.Vector2f = .{ .x = -1, .y = 3 },
|
||||||
|
Bnormal: core.Vector2f = .{ .x = -1, .y = -3 },
|
||||||
|
|
||||||
|
displayVectorsTest: bool = false,
|
||||||
|
|
||||||
pub fn beginPlay(p: *anyopaque) void {
|
pub fn beginPlay(p: *anyopaque) void {
|
||||||
const self = core.cast(*@This(), p);
|
const self = core.cast(*@This(), p);
|
||||||
self._beginPlay() catch {
|
self._beginPlay() catch {
|
||||||
|
|
@ -149,6 +156,83 @@ pub const ExternGameObject = struct {
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn editVector2(comptime Name: []const u8, v: *core.Vector2f) void {
|
||||||
|
const ItemWidth = 120;
|
||||||
|
|
||||||
|
ig.textFmt(Name, .{}) catch {};
|
||||||
|
ig.sameLine(0, 10);
|
||||||
|
ig.setNextItemWidth(ItemWidth);
|
||||||
|
_ = ig.inputFloat("X##particleEd" ++ Name, &v.x, 1.0, 5.0, null, .{});
|
||||||
|
ig.sameLine(0, 10);
|
||||||
|
ig.setNextItemWidth(ItemWidth);
|
||||||
|
_ = ig.inputFloat("Y##particleEd" ++ Name, &v.y, 1.0, 5.0, null, .{});
|
||||||
|
}
|
||||||
|
|
||||||
|
fn v2ToV3(v: core.Vector2f) core.Vectorf {
|
||||||
|
return core.Vectorf{ .x = v.x, .z = v.y, .y = 0 };
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn intersectLine(p1: core.Vector2f, v1: core.Vector2f, p2: core.Vector2f, v2: core.Vector2f) ?core.Vector2f {
|
||||||
|
const denom = v1.x * v2.y - v1.y * v2.x;
|
||||||
|
|
||||||
|
if (@abs(denom) < 0.00001) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
const t = ((p2.x - p1.x) * v2.y - (p2.y - p1.y) * v2.x) / denom;
|
||||||
|
|
||||||
|
return .{
|
||||||
|
.x = p1.x + t * v1.x,
|
||||||
|
.y = p1.y + t * v1.y,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn drawVector2Test(self: *@This()) void {
|
||||||
|
if (ig.begin("vector2Test", null, .{})) {
|
||||||
|
editVector2("a", &self.a);
|
||||||
|
editVector2("Anormal", &self.Anormal);
|
||||||
|
ig.separator();
|
||||||
|
editVector2("b", &self.b);
|
||||||
|
editVector2("Bnormal", &self.Bnormal);
|
||||||
|
}
|
||||||
|
ig.end();
|
||||||
|
|
||||||
|
const a = core.Vectorf{ .x = self.a.x, .z = self.a.y, .y = 0 };
|
||||||
|
const b = core.Vectorf{ .x = self.b.x, .z = self.b.y, .y = 0 };
|
||||||
|
|
||||||
|
const A = core.Vectorf{ .x = self.Anormal.x, .z = self.Anormal.y, .y = 0 };
|
||||||
|
const B = core.Vectorf{ .x = self.Bnormal.x, .z = self.Bnormal.y, .y = 0 };
|
||||||
|
|
||||||
|
core.debugSphere(a, 0.1, .{});
|
||||||
|
core.debugSphere(b, 0.1, .{});
|
||||||
|
|
||||||
|
core.debugLine(a, a.add(A), .{ .color = .{ .y = 0, .x = 1.0 } });
|
||||||
|
core.debugLine(b, b.add(B), .{ .color = .{ .y = 0, .x = 1.0 } });
|
||||||
|
|
||||||
|
const Vab = self.b.sub(self.a);
|
||||||
|
const Vba = Vab.negate();
|
||||||
|
|
||||||
|
core.debugLine(a, a.add(v2ToV3(Vab)), .{ .color = .{ .x = 1.0, .z = 1.0 } });
|
||||||
|
// const ADwall = Vab.dot(self.Anormal.removeComponent(Vab.normalize()).normalize());
|
||||||
|
// const BDwall = Vba.dot(self.Anormal.removeComponent(Vba.normalize()).normalize());
|
||||||
|
|
||||||
|
//const Awall = Vab.removeComponent(self.Anormal.normalize()).normalize().fmul(ADwall).normalize();
|
||||||
|
const Awall = Vab.removeComponent(self.Anormal.normalize()).normalize();
|
||||||
|
const Bwall = Vba.removeComponent(self.Bnormal.normalize()).normalize();
|
||||||
|
|
||||||
|
//ig.textFmt("Awall: {d} {d}", .{ Awall.x, Awall.y }) catch {};
|
||||||
|
core.debugLine(a.sub(v2ToV3(Awall).fmul(10)), a.add(v2ToV3(Awall).fmul(10)), .{ .color = .{ .y = 1.0, .z = 1.0 } });
|
||||||
|
|
||||||
|
// ig.textFmt("Bwall: {d} {d}", .{ Bwall.x, Bwall.y }) catch {};
|
||||||
|
core.debugLine(b.sub(v2ToV3(Bwall).fmul(10)), b.add(v2ToV3(Bwall).fmul(10)), .{ .color = .{ .y = 1.0, .z = 1.0 } });
|
||||||
|
|
||||||
|
const vp = intersectLine(self.a, Awall.normalize(), self.b, Bwall.normalize()) orelse {
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
|
||||||
|
// ig.textFmt("p, y: {d} {d}", .{ vp.x, vp.y }) catch {};
|
||||||
|
core.debugSphere(v2ToV3(vp), 0.1, .{ .color = .{ .y = 1.0, .z = 1.0, .x = 1.0 } });
|
||||||
|
}
|
||||||
|
|
||||||
pub fn addBox(position: core.Vectorf) !void {
|
pub fn addBox(position: core.Vectorf) !void {
|
||||||
const box2 = try core.createEntity();
|
const box2 = try core.createEntity();
|
||||||
const scene = box2.addComponent(core.Scene).?;
|
const scene = box2.addComponent(core.Scene).?;
|
||||||
|
|
@ -223,6 +307,10 @@ pub const ExternGameObject = struct {
|
||||||
topbar.menuOpen = platform.context().isCursorEnabled();
|
topbar.menuOpen = platform.context().isCursorEnabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (self.displayVectorsTest) {
|
||||||
|
self.drawVector2Test();
|
||||||
|
}
|
||||||
|
|
||||||
if (platform.context().isCursorEnabled()) {
|
if (platform.context().isCursorEnabled()) {
|
||||||
if (ig.begin("meh", null, .{})) {
|
if (ig.begin("meh", null, .{})) {
|
||||||
// if (ig.checkbox("move lights ", null)) {}
|
// if (ig.checkbox("move lights ", null)) {}
|
||||||
|
|
@ -247,6 +335,9 @@ pub const ExternGameObject = struct {
|
||||||
if (ig.smallButton("dumpTimeline")) {
|
if (ig.smallButton("dumpTimeline")) {
|
||||||
core.MemoryTracker.dumpTimeline("timeline.txt") catch unreachable;
|
core.MemoryTracker.dumpTimeline("timeline.txt") catch unreachable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ig.checkbox("vectors test", &self.displayVectorsTest)) {}
|
||||||
|
if (ig.checkbox("showdebug", &ui.context().screenContext.drawDebug)) {}
|
||||||
}
|
}
|
||||||
ig.end();
|
ig.end();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue