56 lines
1.6 KiB
Zig
56 lines
1.6 KiB
Zig
const std = @import("std");
|
|
pub const core = @import("core");
|
|
|
|
// meshes api
|
|
pub const meshes = @import("meshes/meshes.zig");
|
|
pub const JointNameEntry = meshes.JointNameEntry;
|
|
pub const MeshUpdate = meshes.MeshUpdate;
|
|
pub const MeshVertex = meshes.MeshVertex;
|
|
pub const IndexedMesh = meshes.IndexedMesh;
|
|
|
|
// components exports
|
|
pub const MeshComponent = @import("meshes/MeshComponent.zig");
|
|
pub const CameraComponent = @import("camera/CameraComponent.zig");
|
|
|
|
// asset loaders
|
|
pub const gltfLoader = @import("meshes/gltfLoader.zig");
|
|
|
|
// switch out based on backend implementation
|
|
pub const renderer = @import("sgpu/renderer.zig");
|
|
pub const context = renderer.context; // context getter func
|
|
|
|
pub const MeshPool = renderer.MeshPool;
|
|
|
|
pub const getMesh = renderer.getMesh;
|
|
pub const getMeshByName = renderer.getMeshByName;
|
|
|
|
// camera API
|
|
pub const setActiveCamera = renderer.setActiveCamera;
|
|
|
|
var rendAllocator: std.mem.Allocator = undefined;
|
|
pub fn getAllocator() std.mem.Allocator {
|
|
return rendAllocator;
|
|
}
|
|
|
|
// controls glfw and general windowing
|
|
// graphics depends on this one
|
|
pub const Module: core.ModuleDescription = .{
|
|
.name = "rend",
|
|
.enabledByDefault = true,
|
|
};
|
|
|
|
pub fn start_module(comptime programSpec: anytype, args: anytype, allocator: std.mem.Allocator) !void {
|
|
_ = args;
|
|
_ = programSpec;
|
|
rendAllocator = allocator;
|
|
try renderer.createInstance();
|
|
try renderer.start();
|
|
}
|
|
|
|
pub fn shutdown_module(allocator: std.mem.Allocator) void {
|
|
core.undefineComponent(MeshComponent);
|
|
core.undefineComponent(CameraComponent);
|
|
_ = allocator;
|
|
renderer.shutdown();
|
|
}
|