Skip to content

Texture colors are being changed #112

@Poblo0

Description

@Poblo0

Describe the bug
When displaying textures the engine is changing the color of them

Screenshots
Image

Image

Original images
Image

Image

Desktop (please complete the following information):

  • OS: Windows 10

Code: (As it is only 41 lines long I've decided to paste it whole)

use blue_engine::{
    prelude::{Engine, ObjectSettings}, primitive_shapes::rectangle, EngineSettings,
};

use std::f32::consts::PI;

fn main() -> Result<(), blue_engine::error::Error> {
    // Create the engine
    let mut engine = Engine::new_config(EngineSettings {
        width: 1280,
        height: 720,
        title: "3D File Explorer",
        ..Default::default()
    }).expect("Unexpectedly, the engine couldn't be initialized");

    rectangle(
        6.0,
        8.0,
        "floor",
        ObjectSettings::default(),
        &mut engine.renderer,
        &mut engine.objects,
    )?;
    let floor = engine.objects.get_mut("floor").expect("Unexpectedly, the 'floor' object wasn't found.");
    floor.set_rotation((-PI/2.0, 0.0, 0.0));
    
    let img_floor = blue_engine::image::open("./assets/BirdieIcon.png").expect("Unexpectedly, the floor image wasn't found.");

    floor.set_texture("floor",  blue_engine::TextureData::Image(img_floor), blue_engine::TextureMode::Repeat, &mut engine.renderer).expect("Unexpectedly, the floor texture couldn't be processed.");

    let radius = 2f32;
    let start = std::time::Instant::now();

    engine.update_loop(move |engine| {
        let camx = start.elapsed().as_secs_f32().sin() * radius;
        let camz = start.elapsed().as_secs_f32().cos() * radius;
        engine.camera.set_position([camx, 2.0, camz]);
    })?;

    Ok(())
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions