Open celsowm opened 2 months ago
I am seeing some output on Yabause v0.9.14. Red lines are moving across the screen.
Still note quite right, but I see a set of dots circling a center dot:
1) in my_draw() move "jo_3d_camera_look_at(&cam);" to jo_main(), right after initing the camera. I don't believe you should be setting the camera every frame? 2) There's definitely an issue with how you are generating x, y, z. I tried something like this (not correct, but seeing output):
void create_sphere_mesh(int stacks, int slices, int radius)
{
int i, j;
float theta, phi;
jo_fixed x, y, z;
int vertex_index = 0;
sphere_mesh = jo_3d_create_mesh(stacks * slices);
for (i = 0; i < stacks; ++i)
{
theta = (float)(i / (stacks - 1) * JO_PI);
jo_fixed theta_fixed = jo_float2fixed(theta);
for (j = 0; j < slices; ++j)
{
phi = (float)j / (slices - 1) * JO_PI * 2;
jo_fixed phi_fixed = jo_float2fixed(phi);
x = jo_float2fixed(radius * jo_cosf(theta_fixed >> 16) * jo_sinf(phi_fixed >> 16));
y = jo_float2fixed(radius * jo_sinf(theta_fixed >> 16) * jo_sinf(phi_fixed >> 16));
z = jo_float2fixed(radius * jo_cosf(phi_fixed >> 16));
jo_3d_set_mesh_vertice(sphere_mesh, x, y, z, vertex_index++);
}
}
for (i = 0; i < stacks * slices; ++i)
{
jo_3d_set_mesh_polygon_color(sphere_mesh, JO_COLOR_Red, i);
}
}
Long story short you are mixing floats, ints, and jo_fixed. The bug is there somewhere.
thanks @slinga-homebrew , I hope @johannes-fetz give me some light
Hi @celsowm I'll look this weekend
Hi Johannes !
I am trying to create a sphere programmaticaly:
but the result is empty :(
1- What I did wrong? 2- What do you think about a new 3d.c function called "create_sphere" ?
Thanks in advance !