aryanpurtech / blueengine Goto Github PK
View Code? Open in Web Editor NEWBlue Engine is a general-purpose and easy-to-use graphics engine written in rust.
License: Apache License 2.0
Blue Engine is a general-purpose and easy-to-use graphics engine written in rust.
License: Apache License 2.0
The current format accepts a tuple to replace the tags in ShaderBuilder
. This should be replaced with a closure so that user can change things as wanted.
And I have a very simple project:
use blue_engine::{header::{Engine, Renderer, ObjectStorage, /*ObjectSettings,*/ WindowDescriptor, PowerPreference}, Window};
fn main()
{
println!("Hello, world!");
let mut engine = Engine::new(); // This is where it screws up
}
As soon as I add this line let mut engine = Engine::new();
it "panics" with this error message:
Hello, world!
[2023-05-07T10:19:28Z ERROR wgpu::backend::direct] Handling wgpu errors as fatal by default
thread 'main' panicked at 'wgpu error: Validation Error
Caused by:
In Device::create_texture
note: label = `Default Texture`
Downlevel flags VIEW_FORMATS are required but not supported on the device.
This is not an invalid use of WebGPU: the underlying API or device does not support enough features to be a fully compliant implementation. A subset of the features can still be used. If you are running this program on native and not in a browser and wish to work around this issue, call Adapter::downlevel_properties or Device::downlevel_properties to get a listing of the features the current platform supports.
As indicated by these folks
WebGPU added requirement for being able to specify the view format and wgpu checks against that now. Blue engine probably had an older version of wgpu before that didn't have this requirement yet.
That said, the only place where this feature isn't supported is on wgpu's GLES & WebGL backend. On linux you should always use Vulkan whenever possible.
In any case, this would be a bug with blue engine for not picking the correct backend and/or requiring this feature when they also want to suport GLES/WebGL (?, don't know blue engine at all)
Please give option to chose backend renderer for the user!
Is your feature request related to a problem? Please describe.
To edit a windows fullscreen state we need to access to the Fullscren enum.
This is currently not exported by the library and must be imported from winit
.
Describe the solution you'd like
Export the Fullscreen
enum from winit::window
.
Describe alternatives you've considered
Import Fullscreen
from winit
.
According to later discussions in #30 there is a need for update and set methods in the engine to change values instead of needing to set them directly.
It could be done through trait parameters, and then inline function to capture all the implementations.
Like Unity and Godot we can have a children object to the parent object, when the user moves the parent object, all of its children get affected by it as well.
If I move the object towards the top left hand side and save it and open it up again, it is fine. however when I suddenly change the size of the object, and save and reopen again, the shape goes off the screen, even though the value of the position is the same. It seems like 5.9
on the y axis is something different if I load the size and the size is different from the default.
Have a look at the gif:
Describe the bug
Docs and examples are outdated
inside objects_settings.rs
:
println!("object.1.size[0].value: {}", object.1.size[0].value);
//square(object.0.label.0.clone(), header::ObjectSettings::default(), renderer, gameengine_objects).unwrap();
square(
object.0.label.0.clone(),
header::ObjectSettings
{
//size : (100f32, 100f32, 100f32),
size : (object.1.size[0].value, object.1.size[1].value, object.1.size[2].value),
scale : (1f32, 1f32, 1f32),
position : (object.1.position[0].value, object.1.position[1].value, object.1.position[2].value),
color : Array4{data: utils::default_resources::DEFAULT_COLOR},
camera_effect : true,
shader_settings : ShaderSettings::default(),
},
renderer,
gameengine_objects,
).unwrap();
so this should set the size. The default is set to 1f32
, 1f32
, 1f32
.
so I might set the x
size to 1.3
which sizes just fine. But after saving it and opening the file again while the value is at 1.3
, it is back to the original size and when I move the slider, it will add to it. See the gif to see what is happening:
also by hardcoding it and setting the size like this size : (150f32, 100f32, 100f32),
still draws a perfect square as shown in this image:
I have confirmed that my get_mut resize is not called until I modify the values
Is your feature request related to a problem? Please describe.
I need to layer 2D shapes above each other.
When using perspective projection objects closer to the camera appear larger.
Describe the solution you'd like
Either a config option when setting up the engine and/or a function to switch between perspective and orthographic
Describe alternatives you've considered
Don't know a alternative solution to my problem.
allowing objects to have alpha channel working
For example:
objects
.get(flameobject_label)
.unwrap()
.rotation;
this currently returns tuple (f32, f32, f32)
, please change this to return array [f32; 3]
.
The camera example fails to build on macOS Catalina 10.15.7.
GPU is Intel HD Graphics 6000 1536 MB
Compiling blue-engine-test v0.1.0 (/Users/[redacted]/blue-engine-test)
Finished dev [unoptimized + debuginfo] target(s) in 5.37s
Running `target/debug/blue-engine-test`
[2021-09-27T15:02:10Z ERROR wgpu::backend::direct] Error in Adapter::request_device: unsupported features were requested: NON_FILL_POLYGON_MODE
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: RequestDeviceError', /Users/[redacted]/.cargo/registry/src/github.com-1ecc6299db9ec823/blue_engine-0.1.95/src/render.rs:37:14
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Hello (I'm Derg on Discord),
I see what's going on with the error message:
Resizing the window causes the swapchain to become outdated (specifically, gfx_hal::window::OutOfDate
is the underlying error message).
I'm assuming that, sometime after you attempt to draw to the resized window, the event loop receives a WindowEvent::Resized
, which causes the renderer to recreate the swapchain, and thus resolves the invalidation.
Once you remove that call to resize
in response to the window resize vent, the Outdated
error shows up every frame.
From now on, I'll start a new workflow as GitHub Project to better track and plan things out.
The workflow will have issues moved there, and future plans as well, so that everything is in one tidy and neat place, easier to track things, ...
If you're looking to propose new features, or bugs, or anything, feel free to open an issue!
Currently the color removes the alpha channel of the textures
Export useful libs, like math, winit, wgpu, ... for plugins and other projects using the engine.
Here is my code for updating position and scale
ui.label("Position");
ui.horizontal(|ui|
{
// Has user moved the shape or not
let mut update_position = false;
for position in object.1.position.iter_mut()
{
ui.label(format!("{}:", position.axis as char));
// Use Response::changed or whatever to determine if the value has been changed
if ui.add(egui::DragValue::new(&mut position.value).speed(editor_settings.slider_speed)).changed()
{
//println!("Changed!");
update_position = true;
}
}
// Updates the shape's position if the user has changed its value
if update_position == true
{
//println!("update_position: {update_position}");
gameengine_objects
.get_mut(&object.0.label.0)
//.get_mut("Object 0")
.unwrap()
.position(object.1.position[0].value, object.1.position[1].value, object.1.position[2].value);
}
});
ui.separator();
ui.label("Scale");
ui.horizontal(|ui|
{
let mut update_scale = false;
for scale in object.1.scale.iter_mut()
{
ui.label(format!("{}:", scale.axis as char));
if ui.add(egui::DragValue::new(&mut scale.value).speed(editor_settings.slider_speed)).changed()
{
update_scale = true;
}
}
if update_scale == true
{
println!("object.0.label.0: {}", object.0.label.0);
gameengine_objects
.get_mut(&object.0.label.0)
.unwrap()
.scale(object.1.scale[0].value, object.1.scale[1].value, object.1.scale[2].value);
}
});
So as you can see if I am only moving the scale, it will only update the shape's scale and nothing else. If I am only moving the position, then it will only update the position.
The issue is that if I update the scale property, the scale change does not come into effect until I changed the position.
Here is a gif to explain to you what is going on:
Describe the bug
When instancing tiles that are 1.0 x 1.0 in dimension and putting them appart exactly 1.0 in a certain direction sometimes weird lines appear as if some tiles weren't exactly fitting and when moving the camera the ones that have lines vary.
I'm using an orthographic camera and all tiles have the same value in the z axis.
Also this problem only happen in the y axis.
Desktop:
Additional context
The assets I'm using aren't mine and are from Dingaling's awesome game Lisa The Painful.
Drawing a square with uneven scale
or even size
as in this example:
square(
object.0.label.0.clone(),
blue_engine::header::ObjectSettings
{
size : (0.5f32, 0.5f32, 0.5f32),
//scale : (object.1.scale[0].value, object.1.scale[1].value, object.1.scale[2].value),
scale : (0.1f32, 1f32, 1f32),
position : (object.1.position[0].value, object.1.position[1].value, object.1.position[2].value),
color : Array4{data: utils::default_resources::DEFAULT_COLOR},
camera_effect : false,
shader_settings : ShaderSettings::default(),
},
Does not affect the shape of the square, it will still draw the same size no matter what the parameters are.
The project sometimes might look slow in development, the real reason is that I'm spread thin with personal life and work and open source software. Plus the engine is mostly focused with utilities crate on side, hence it might look slow.
Worry not, as soon as I get a break I'll work on it and bring updates, contributions, suggestions, problems, ... are welcome as always!
A way to share pipeline data without needing to recreate them for each object
Hi is this a fully developed game engine?
Building BlueEngine targeting wasm does not work! I followed this guide.
rustup target add wasm32-unknown-unknown
cargo install -f wasm-bindgen-cli --version 0.2.73
RUSTFLAGS=--cfg=web_sys_unstable_apis cargo build --no-default-features --target wasm32-unknown-unknown --example rotate_around
error[E0432]: unresolved import `libc::c_void`
--> /Users/[redacted]/.cargo/registry/src/github.com-1ecc6299db9ec823/memchr-0.1.11/src/lib.rs:11:5
|
11 | use libc::c_void;
| ^^^^^^^^^^^^ no `c_void` in the root
error[E0432]: unresolved imports `libc::c_int`, `libc::size_t`
--> /Users/[redacted]/.cargo/registry/src/github.com-1ecc6299db9ec823/memchr-0.1.11/src/lib.rs:12:12
|
12 | use libc::{c_int, size_t};
| ^^^^^ ^^^^^^ no `size_t` in the root
| |
| no `c_int` in the root
error[E0432]: unresolved import `libc::memchr`
--> /Users/[redacted]/.cargo/registry/src/github.com-1ecc6299db9ec823/memchr-0.1.11/src/lib.rs:82:13
|
82 | use libc::memchr as libc_memchr;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `memchr` in the root
For more information about this error, try `rustc --explain E0432`.
error: could not compile `memchr` due to 3 previous errors
warning: build failed, waiting for other jobs to finish...
error[E0046]: not all trait items implemented, missing: `encode`
--> /Users/[redacted]/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-serialize-0.3.24/src/serialize.rs:1358:1
|
853 | fn encode<S: Encoder>(&self, s: &mut S) -> Result<(), S::Error>;
| ---------------------------------------------------------------- `encode` from trait
...
1358 | impl Encodable for path::Path {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `encode` in implementation
error[E0046]: not all trait items implemented, missing: `decode`
--> /Users/[redacted]/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-serialize-0.3.24/src/serialize.rs:1382:1
|
904 | fn decode<D: Decoder>(d: &mut D) -> Result<Self, D::Error>;
| ----------------------------------------------------------- `decode` from trait
...
1382 | impl Decodable for path::PathBuf {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `decode` in implementation
For more information about this error, try `rustc --explain E0046`.
error: build failed
Need a way to instance objects
the error thread 'main' panicked at 'Error in Surface::configure: requested format Bgra8UnormSrgb is not in list of supported formats: [Bgra8Unorm]', /home/yzn/.cargo/registry/src/github.com-1ecc6299db9ec823/wgpu-0.10.2/src/backend/direct.rs:188:9
Describe the bug
When displaying images with an alpha different from 0 or 255 the engine sometimes renders them good and other times it renders them with a solid color.
Screenshots
Desktop (please complete the following information):
Additional context
When instancing copies of objects they seem to get the same effect as the original object.
let keyvec = [
blue_engine::KeyCode::ArrowUp,
blue_engine::KeyCode::ArrowDown,
blue_engine::KeyCode::ArrowLeft,
blue_engine::KeyCode::ArrowRight,
blue_engine::KeyCode::KeyA,
etc
let keyname = [ // keymapping naming ( must contain the same size and order as the keymapping!!)
"key.up",
"key.down",
"key.left",
"key.right",
"key.a",
etc
];
// Keyboard-input bridge , registers key.* classproperties to down or up
let mut idx = 0;
for xkey in keyname{
if input.key_pressed(keyvec[idx]) {
vmap.setvar(keyname[idx].to_owned(),"down");
vmap.setvar("key.event".to_owned(),"true");
cwrite(&keyname[idx],"y")
}
else{
vmap.setvar(keyname[idx].to_owned(),"up");
}
idx +=1;
}
--------------------------------------------
key_pressed nor held_down is working, got some idea's ? worked before the last update
Running cargo r
I get this issue:
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', /home/raj/.cargo/registry/src/index.crates.io-6f17d22bba15001f/blue_engine-0.4.28/src/render.rs:59:14
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Hi, is there any way we could create an overlay over a program with this? This is doable with directx11 on Windows, but I need for linux (X11 preferably)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.