-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This update drastically changed the project. It now uses wgpu as a backend and some of the functions are gone. For now all the draw_decal functions are gone. Instead, just draw to Image Layers and set them to update.
- Loading branch information
1 parent
d24d63d
commit 2b93bd1
Showing
37 changed files
with
18,666 additions
and
2,771 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[build] | ||
target = "wasm32-unknown-unknown" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/target | ||
/.idea/ | ||
/.idea/codeStyles/ | ||
/.idea/misc.xml | ||
/.idea/modules.xml | ||
/.idea/vcs.xml | ||
/.idea/workspace.xml | ||
/olc_3d_engine.iml | ||
/Cargo.lock | ||
/main.rs | ||
#* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,195 @@ | ||
[package] | ||
name = "rust_olc_pge" | ||
version = "0.1.0" | ||
version = "0.2.0" | ||
authors = ["Jonny Kenyon <[email protected]>"] | ||
edition = "2018" | ||
[profile.dev] | ||
opt-level = 3 | ||
|
||
[profile.test] | ||
opt-level = 2 | ||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
[lib] | ||
name = "rust_olc_pge" | ||
crate-type = ["rlib"] | ||
|
||
[target.'cfg(windows)'.dependencies] | ||
winapi = { version = "0.3.9", features = ["winuser", "windef","minwindef","dwmapi", "libloaderapi", "ntdef", "wingdi"] } | ||
widestring = "0.4.2" | ||
pretty-hex ="0.2.0" | ||
[target.'cfg(target_arch = "windows")'.dependencies] | ||
lazy_static = "*" | ||
bmp = "0.5.0" | ||
rand = "*" | ||
rand = "*" | ||
|
||
[dependencies] | ||
itertools = "0.10" | ||
image = "0.23" | ||
blend = "0.6.1" | ||
bmp = "0.5.0" | ||
cgmath = "0.17" | ||
env_logger = "0.7" | ||
log = "0.4" | ||
wgpu = { version = "0.9" , features = ["webgl"] } | ||
futures = "0.3" | ||
num-traits = "0.2.14" | ||
pretty-hex ="0.2.0" | ||
lazy_static = "*" | ||
winit = { version = "0.25.0" } | ||
inline-spirv = "0.1.2" | ||
bytemuck = { version = "1.4", features = [ "derive" ] } | ||
gltf = { version = "0.16.0", features = ["import"] } | ||
bitflags = "1.2.1" | ||
|
||
[target.'cfg(target_arch="wasm32")'.dependencies] | ||
wasm-bindgen = "0.2.74" | ||
wasm-bindgen-futures = "*" | ||
winit = { version = "0.25.0", features = ["web-sys"] } | ||
console_log = "0.1.2" | ||
instant = "0.1.9" | ||
console_error_panic_hook = "*" | ||
js-sys = "*" | ||
|
||
[target.'cfg(target_arch="wasm32")'.dev-dependencies] | ||
console_error_panic_hook = "0.1.6" | ||
console_log = "0.1.2" | ||
|
||
[features] | ||
js = [] | ||
|
||
[target.'cfg(target_arch="wasm32")'.dependencies.web-sys] | ||
version = "^0.3.50" | ||
optional = false | ||
features = [ | ||
"console", | ||
"WebGlBuffer", | ||
"WebGlRenderingContext", | ||
"WebGl2RenderingContext", | ||
"WebGlProgram", | ||
"WebGlSampler", | ||
"WebGlTexture", | ||
"WebGlProgram", | ||
"WebGlShader", | ||
"Document", | ||
"Navigator", | ||
"Node", | ||
"NodeList", | ||
"Gpu", | ||
"GpuAdapter", | ||
"GpuAdapterFeatures", | ||
"GpuAdapterLimits", | ||
"GpuAddressMode", | ||
"GpuBindGroup", | ||
"GpuBindGroupDescriptor", | ||
"GpuBindGroupEntry", | ||
"GpuBindGroupLayout", | ||
"GpuBindGroupLayoutDescriptor", | ||
"GpuBindGroupLayoutEntry", | ||
"GpuBlendComponent", | ||
"GpuBlendFactor", | ||
"GpuBlendOperation", | ||
"GpuBlendState", | ||
"GpuBuffer", | ||
"GpuBufferBinding", | ||
"GpuBufferBindingLayout", | ||
"GpuBufferBindingType", | ||
"GpuBufferDescriptor", | ||
"GpuBufferUsage", | ||
"GpuCanvasContext", | ||
"GpuColorDict", | ||
"GpuColorTargetState", | ||
"GpuColorWrite", | ||
"GpuCommandBuffer", | ||
"GpuCommandBufferDescriptor", | ||
"GpuCommandEncoder", | ||
"GpuCommandEncoderDescriptor", | ||
"GpuCompareFunction", | ||
"GpuCompilationInfo", | ||
"GpuCompilationMessage", | ||
"GpuCompilationMessageType", | ||
"GpuComputePassDescriptor", | ||
"GpuComputePassEncoder", | ||
"GpuComputePipeline", | ||
"GpuComputePipelineDescriptor", | ||
"GpuCullMode", | ||
"GpuDepthStencilState", | ||
"GpuDevice", | ||
"GpuDeviceDescriptor", | ||
"GpuDeviceLostInfo", | ||
"GpuDeviceLostReason", | ||
"GpuErrorFilter", | ||
"GpuExtent3dDict", | ||
"GpuFeatureName", | ||
"GpuFilterMode", | ||
"GpuFragmentState", | ||
"GpuFrontFace", | ||
"GpuImageCopyBuffer", | ||
"GpuImageCopyImageBitmap", | ||
"GpuImageCopyTexture", | ||
"GpuImageDataLayout", | ||
"GpuIndexFormat", | ||
"GpuInputStepMode", | ||
"GpuLoadOp", | ||
"GpuMapMode", | ||
"GpuMultisampleState", | ||
"GpuObjectDescriptorBase", | ||
"GpuOrigin2dDict", | ||
"GpuOrigin3dDict", | ||
"GpuOutOfMemoryError", | ||
"GpuPipelineDescriptorBase", | ||
"GpuPipelineLayout", | ||
"GpuPipelineLayoutDescriptor", | ||
"GpuPipelineStatisticName", | ||
"GpuPowerPreference", | ||
"GpuPrimitiveState", | ||
"GpuPrimitiveTopology", | ||
"GpuProgrammableStage", | ||
"GpuQuerySet", | ||
"GpuQuerySetDescriptor", | ||
"GpuQueryType", | ||
"GpuQueue", | ||
"GpuRenderBundle", | ||
"GpuRenderBundleDescriptor", | ||
"GpuRenderBundleEncoder", | ||
"GpuRenderBundleEncoderDescriptor", | ||
"GpuRenderPassColorAttachment", | ||
"GpuRenderPassDepthStencilAttachment", | ||
"GpuRenderPassDescriptor", | ||
"GpuRenderPassEncoder", | ||
"GpuRenderPipeline", | ||
"GpuRenderPipelineDescriptor", | ||
"GpuRequestAdapterOptions", | ||
"GpuSampler", | ||
"GpuSamplerBindingLayout", | ||
"GpuSamplerBindingType", | ||
"GpuSamplerDescriptor", | ||
"GpuShaderModule", | ||
"GpuShaderModuleDescriptor", | ||
"GpuShaderStage", | ||
"GpuStencilFaceState", | ||
"GpuStencilOperation", | ||
"GpuStorageTextureAccess", | ||
"GpuStorageTextureBindingLayout", | ||
"GpuStoreOp", | ||
"GpuSwapChain", | ||
"GpuSwapChainDescriptor", | ||
"GpuTexture", | ||
"GpuTextureAspect", | ||
"GpuTextureBindingLayout", | ||
"GpuTextureDescriptor", | ||
"GpuTextureDimension", | ||
"GpuTextureFormat", | ||
"GpuTextureSampleType", | ||
"GpuTextureUsage", | ||
"GpuTextureView", | ||
"GpuTextureViewDescriptor", | ||
"GpuTextureViewDimension", | ||
"GpuUncapturedErrorEvent", | ||
"GpuUncapturedErrorEventInit", | ||
"GpuValidationError", | ||
"GpuVertexAttribute", | ||
"GpuVertexBufferLayout", | ||
"GpuVertexFormat", | ||
"GpuVertexState", | ||
"HtmlCanvasElement", | ||
"Window", | ||
"Element", | ||
"FileReader", | ||
"Headers", | ||
"Request", | ||
"RequestInit", | ||
"RequestMode", | ||
"Response", | ||
"ReadableStream", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
asyncify::wait_for<T: FnMut() | ||
|
||
wait_for will unwind the call stack and return execution to JS |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" | ||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | ||
|
||
<html xmlns="http://www.w3.org/1999/xhtml"> | ||
|
||
<head> | ||
<title>plan.html</title> | ||
<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"/> | ||
|
||
</head> | ||
|
||
<body> | ||
|
||
|
||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
# Eldritch # | ||
|
||
## TODO ## | ||
* Change movement mode to use the edges of the screen. | ||
* Have 2 renders of the world, one using an "Eldritch" flag and one using "normal" | ||
* "Normal" renders first and "Eldritch renders on top | ||
* Modify the Eldritch shader depending on player stats | ||
|
||
## GamePlay ## | ||
* Choose your character | ||
* Get your story prompt | ||
* Spawn into the world | ||
* Investigate for clues and collect evidence | ||
- Interrogate citizens | ||
- Search for supernatural signs | ||
- Try to find the next destination | ||
- Avoid cultists | ||
- Avoid creatures | ||
- Collect the clues and artifacts you find in various ways | ||
* Maybe there's a "hub" where you need certain artifacts and/or experience to enter different "dimensions" | ||
* Some Combat? | ||
* When the clues have been solved, the players have the chance to stop the event. | ||
* Any low stat causes Insanity to rise faster | ||
* Insanity is visual | ||
- There is another render of the world that warps at the edges | ||
- Words are harder to read when insane, and start to turn to glyphs | ||
- People in the corner of your eye look monstrous | ||
- You can find otherworldly clues easier | ||
- Enemies are more easily drawn to you | ||
|
||
## Player Actions ## | ||
* Walk | ||
* Run (Consumes stamina) | ||
* Turn using screen edges | ||
* Sacrifice sanity to find clues and pierce the veil | ||
* Mouse interactions | ||
- Inspect (Visual) | ||
- Inspect (Physical) | ||
- Take | ||
- Talk | ||
- Make Note (In Journal) | ||
* Combat (Pseudo turn-based) | ||
- Actions are limited by stats | ||
- Attacking makes you unable to run for a time | ||
- Use environmental hazards | ||
* Push off roof | ||
* Set traps ahead of time | ||
* Have teammates hit enemy from behind | ||
|
||
## Engine Features ## | ||
* ~~Run on WebGL~~ | ||
* Multiple light sources | ||
- | ||
* First Person movement | ||
- Edge of screen turning | ||
* UI framework | ||
- This is a really big ask | ||
- egui? | ||
* Texture Sampling | ||
- Edge of screen turning | ||
* PBR Support? | ||
* Blender File support | ||
|
||
## JavaScript <--> Rust ## | ||
* Load files from Server | ||
* Networking Sockets | ||
|
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
use super::math_3d::Rotor3; | ||
use super::transform::Transform3; | ||
|
||
#[derive(Copy, Clone, Debug, Default)] | ||
pub struct Camera { | ||
pub clip_far: f32, | ||
pub clip_near: f32, | ||
pub h_w: f32, | ||
pub h_h: f32, | ||
pub transform: Transform3, | ||
pub inv_camera_rot: Rotor3, | ||
pub aspect: f32, | ||
pub fov: f32, | ||
pub mat: RawMat, | ||
} | ||
|
||
|
||
#[repr(C)] | ||
// This is so we can store this in a buffer | ||
#[derive(Debug, Copy, Clone, bytemuck::Pod, bytemuck::Zeroable)] | ||
pub struct RawMat { | ||
pub view_proj: [[f32; 4]; 4], | ||
pub view_inv_proj: [[f32; 4]; 4], | ||
pub position: [f32; 3], | ||
} | ||
|
||
impl Default for RawMat { | ||
fn default() -> Self { | ||
Self { | ||
view_proj: [[0.0; 4]; 4], | ||
view_inv_proj: [[0.0; 4]; 4], | ||
position: [0.0; 3], | ||
} | ||
} | ||
} | ||
|
||
impl Camera { | ||
pub fn new() -> Self{ | ||
Self{ | ||
clip_far: 500.0, | ||
clip_near: 1.0, | ||
fov: 90.0, | ||
aspect: 4.0 / 3.0, | ||
..Default::default() | ||
} | ||
} | ||
pub fn build_view_projection_matrix(&self) -> cgmath::Matrix4<f32> { | ||
let proj = cgmath::perspective( | ||
cgmath::Deg(self.fov), | ||
self.aspect, | ||
self.clip_near, | ||
self.clip_far, | ||
); | ||
OPENGL_TO_WGPU_MATRIX * proj * self.transform.to_transform_matrix() | ||
} | ||
pub fn build_reverse_projection_matrix(&self) -> cgmath::Matrix4<f32> { | ||
use cgmath::SquareMatrix; | ||
let proj = cgmath::perspective( | ||
cgmath::Deg(self.fov), | ||
self.aspect, | ||
self.clip_near, | ||
self.clip_far, | ||
); | ||
OPENGL_TO_WGPU_MATRIX * proj.invert().unwrap() | ||
} | ||
} | ||
|
||
#[rustfmt::skip] | ||
pub const OPENGL_TO_WGPU_MATRIX: cgmath::Matrix4<f32> = cgmath::Matrix4::new( | ||
1.0, 0.0, 0.0, 0.0, | ||
0.0, 1.0, 0.0, 0.0, | ||
0.0, 0.0, 0.5, 0.0, | ||
0.0, 0.0, 0.5, 1.0, | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
|
Oops, something went wrong.