Jo Engine Forum

Sega Saturn Development => General Jo Engine Help => Topic started by: SuperReye on January 27, 2019, 11:07:47 pm

Title: Help: rendering 3D mesh with different colors
Post by: SuperReye on January 27, 2019, 11:07:47 pm
I have problems when drawing one mesh multiple times on screen, but with different colors.
When I try to change mesh color, draw it, and than change it again and draw it again not all quads change their color
(http://saturn.reye.me/balloons_broken.png)

Is there a proper way on how to do this?

Current source code: Source.zip (https://www.dropbox.com/s/2sugnxsh0coa4hj/source.zip?dl=0)
(Its currently setup for VSCode and i have jo engine on my NAS, so you need to change some paths in compile.bat and makefile to compile it)

Edit: I also have troubles with light being weird, but I'll probably figure out that eventually
Title: Re: Help: rendering 3D mesh with different colors
Post by: SuperReye on February 02, 2019, 12:13:03 pm
So I got some more free time to mess with this, and I probably figured it out.
Only thing what I had to do is to wait for some small amount of time, before saturn finishes drawing of the mesh and than continue with another one.

(http://saturn.reye.me/works.png)

Code: [Select]
jo_3d_set_mesh_color(&MeshBalloon, balloon->Color);

// Draw balloon
jo_3d_push_matrix();
{
    jo_3d_translate_matrix_z(10);
    jo_3d_translate_matrixf(balloon->PositionX, (balloon->PopFrame * dropPerFrame) + woble + balloonYOffset, 0.0f);
    jo_3d_rotate_matrix_x(90);
       
    display_balloon_mesh(balloon->Air < balloonLifeTime ? JO_MIN(balloon->Air + baseLife, totalLife) / totalLife : 0.0f);
}
jo_3d_pop_matrix();

// wait here, makes colors work
for(int wait = 0; wait < 4000; wait++) {}

That opens another question, is there an interupt or some way to tell when mesh drawing has ended?