Code Monkey home page Code Monkey logo

blueengine's People

Contributors

akowi-sknobloch avatar dependabot-preview[bot] avatar dependabot[bot] avatar elhamaryanpur avatar fromordinarytowonder avatar gipson62 avatar pauldotsh avatar thenoswad avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

blueengine's Issues

Give option to chose backend renderer

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!

Export enum `winit::window::Fullscreen`

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.

Add update and set functions for Objects

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.

Add "grouping" support

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.

When loading the object's size before the object's position , the position seems go off the screen

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:

blue_flame_1m7b3vtwHP

Sizing seems to be adding only

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:

QLQ9PRnhcB

also by hardcoding it and setting the size like this size : (150f32, 100f32, 100f32), still draws a perfect square as shown in this image:

image

I have confirmed that my get_mut resize is not called until I modify the values

Switch Camera to orthographic projection

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.

Change return from tuple to array

For example:

objects
.get(flameobject_label)
.unwrap()
.rotation;

this currently returns tuple (f32, f32, f32), please change this to return array [f32; 3].

RequestDeviceError on macOS Catalina

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

That "Outdated" issue

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.

Moving to workflow task system

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!

Updating scale does not immediately update the scale until the update position is called

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);
                                    }
                                });

image

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:

cmd_6zGYPIiDGB

Depth buffer problems

The depth buffer is not working correctly. Meshes do not render properly. Planes have no issue but shapes like cubes do.

I have attached a screenshot of mangled cubes. Hopefully, this is helpful.
ScreenShot

Inconsistent camera drawing for nearby objects

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.

Screenshots
image
image

Desktop:

  • OS: Windows10

Additional context
The assets I'm using aren't mine and are from Dingaling's awesome game Lisa The Painful.

Changing the scale and size of the object when creating it does nothing

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.
WhatsApp Image 2022-12-28 at 21 02 14

Slow progress of the project

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!

wasm Build Fails

Building BlueEngine targeting wasm does not work! I followed this guide.

This is what I tried

  1. Added the wasm target
    rustup target add wasm32-unknown-unknown
  2. Installed wasm-bindgen-cli
    cargo install -f wasm-bindgen-cli --version 0.2.73
  3. Started the build
    RUSTFLAGS=--cfg=web_sys_unstable_apis cargo build --no-default-features --target wasm32-unknown-unknown --example rotate_around

This is the error

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

running executable fail on wayland

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

Translucid images work at random

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
image
image

Desktop (please complete the following information):

  • OS: Windows 10

Additional context
When instancing copies of objects they seem to get the same effect as the original object.

new keycode key input detection changed/notworking

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

can no longer build at all

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

Z axis not working

The Z-axis for vertices is not working for me. The following screenshot should be a cube but is a plane.
Screen Shot 2021-10-13 at 11 34 55 AM

To reproduce, create an object with vertices that utilize the Z-axis.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.