Pages: 1
  Print  
Author Topic: Model Index Buffers  (Read 1448 times)
Offline (Male) Goombert
Posted on: August 03, 2013, 12:39:50 AM

Developer
Location: Cappuccino, CA
Joined: Jan 2013
Posts: 3110

View Profile
Quote
//Are these functions really needed? They just break stuff!

Whoever left me that gold fucking nugget in the source code, here is my response: Yes

Game Maker traditionally does not provide functions for passing indices to the index buffer, making it pretty awful for optimized models. If you don't know how an index buffer works, then Google it. I would prefer that topics be posted here under "General ENIGMA" for discussion by all developers, lets try to avoid comments like this in the source code from now on guys, ok? Please proceed to discuss a change in the function specification if you like, I am open to other idea's.

I am also wanting us to add a...
Code: [Select]
void d3d_model_push_colordata(gs_scalar* data);
void d3d_model_push_texturedata(gs_scalar* data);
and also maybe like this...
Code: [Select]
void d3d_model_push_colordata(int dslist);
So that a pointer to an array can be passed by the end programmer to push an entire array or data structure list of color data into the model, avoiding for loops and shit.
« Last Edit: August 03, 2013, 12:44:50 AM by Robert B Colton » Logged
I think it was Leonardo da Vinci who once said something along the lines of "If you build the robots, they will make games." or something to that effect.

Offline (Unknown gender) TheExDeus
Reply #1 Posted on: August 03, 2013, 09:00:12 AM

Developer
Joined: Apr 2008
Posts: 1872

View Profile
Quote
Whoever left me that gold fucking nugget in the source code, here is my response: Yes
It was me in the last VBO commit. The reason why I added that is because we at least need to rename them to d3d_add_vertex() and d3d_add_index() and so on. The color compatibility change (discussed in the other topic) just break this as it is. When you do d3d_model_vertex() then it automatically fills color buffer with the bound color and so if you do d3d_model_color() afterwards, then it just break the whole thing.

Quote
Game Maker traditionally does not provide functions for passing indices to the index buffer, making it pretty awful for optimized models. If you don't know how an index buffer works, then Google it.
They are already used in the sprite drawing now.

Quote
I would prefer that topics be posted here under "General ENIGMA" for discussion by all developers, lets try to avoid comments like this in the source code from now on guys, ok? Please proceed to discuss a change in the function specification if you like, I am open to other idea's.
Well apparently the comment worked. I didn't think of it being a big deal so I didn't make a topic. Basically it was a "TODO: THIS DON'T WORK" kind of comment.

Quote
I am also wanting us to add a...
This is how it's done in GL3shapes now. We could maybe give that plane2D_rotated(gs_scalar* data) function to enigma_user. But I get why functions like that could be useful.

So basically I will just rename the functions not to cause conflicts.
Logged
Offline (Male) Goombert
Reply #2 Posted on: August 03, 2013, 09:11:24 AM

Developer
Location: Cappuccino, CA
Joined: Jan 2013
Posts: 3110

View Profile
Quote
It was me in the last VBO commit. The reason why I added that is because we at least need to rename them to d3d_add_vertex() and d3d_add_index() and so on. The color compatibility change (discussed in the other topic) just break this as it is. When you do d3d_model_vertex() then it automatically fills color buffer with the bound color and so if you do d3d_model_color() afterwards, then it just break the whole thing.
Yes, we are going to have to remove all those functions I added except the index one, go look at how I had to write the D3D9 model class and you'll see why.
https://github.com/RobertBColton/enigma-dev/blob/master/ENIGMAsystem/SHELL/Graphics_Systems/Direct3D9/DX9model.cpp
This is why we need to just implement Studio's new vertex format and vertex functions for special model formats that can accommodate animation, multitexturing, and be passed to shaders.
http://docs.yoyogames.com/source/dadiospice/002_reference/shaders/vertex%20formats/index.html

Quote
They are already used in the sprite drawing now.
Yes but I meant a function for the end user of ENIGMA to add indexing to their d3d models.

Quote
Well apparently the comment worked. I didn't think of it being a big deal so I didn't make a topic. Basically it was a "TODO: THIS DON'T WORK" kind of comment.
It's cool, I just would have preferred you to make a topic about something like that for us all to discuss, because it did need discussed anyway.

Quote
This is how it's done in GL3shapes now. We could maybe give that plane2D_rotated(gs_scalar* data) function to enigma_user. But I get why functions like that could be useful.
I don't think you get what I mean, I am also wanting to add a surface_get_data() function which returns a pointer to an array of color data for surfaces. This avoids things like passing shit one at a time, eg. surface_getpixel()


I would also appreciate if I could get you to merge my pull request Harri...
https://github.com/enigma-dev/enigma-dev/pull/291
Logged
I think it was Leonardo da Vinci who once said something along the lines of "If you build the robots, they will make games." or something to that effect.

Offline (Unknown gender) TheExDeus
Reply #3 Posted on: August 03, 2013, 11:57:41 AM

Developer
Joined: Apr 2008
Posts: 1872

View Profile
Quote
Yes, we are going to have to remove all those functions I added except the index one, go look at how I had to write the D3D9 model class and you'll see why.
I still think you don't need these:
Code: [Select]
void d3d_model_normal(const unsigned int id, gs_scalar nx, gs_scalar ny, gs_scalar nz)
{
  meshes[id]->VertexVector(0, 0, 0, nx, ny, nz, 0, 0, 0, 1);
}

void d3d_model_texture(const unsigned int id, gs_scalar u, gs_scalar v)
{
  meshes[id]->VertexVector(0, 0, 0, 0, 0, 0, u, v, 0, 1);
}

void d3d_model_color(const unsigned int id, int col, double alpha)
{
  meshes[id]->VertexVector(0, 0, 0, 0, 0, 0, 0, 0, col, alpha);
}
And you must change d3d_model_vertex() to pass bound color and alpha.
Quote
This is why we need to just implement Studio's new vertex format and vertex functions for special model formats that can accommodate animation, multitexturing, and be passed to shaders.
I am not really interested in that now. But the guys who wrote YYG wiki is a little drunk, as this sentence makes no sense:
Quote
However, if you are only using (for example) the shader to manipulate the color of the vertex, then there would be no need to pass through colour or texture data. In this case you would create your own format as so:
While at the same time having two different spellings of color.
Logged
Offline (Male) Goombert
Reply #4 Posted on: August 03, 2013, 06:56:31 PM

Developer
Location: Cappuccino, CA
Joined: Jan 2013
Posts: 3110

View Profile
Quote
And you must change d3d_model_vertex() to pass bound color and alpha.
What?

Quote
While at the same time having two different spellings of color.
I hate those stupid dutch bastards, they have made it literally impossible to figure out there new shit, the majority of everything Studio has added is so clusterfucked and perplexed beyond reality. But anyway, I am still interested in it because it is multitexturing capable, so I am thinking to just remove my added functions accept for d3d_model_index
Logged
I think it was Leonardo da Vinci who once said something along the lines of "If you build the robots, they will make games." or something to that effect.

Offline (Unknown gender) TheExDeus
Reply #5 Posted on: August 04, 2013, 07:00:32 AM

Developer
Joined: Apr 2008
Posts: 1872

View Profile
Quote
What?
Like it is done now in GL3. Right now you just pass c_black and 1, but it should be the draw_get_color() and draw_get_alpha(), so that when you use the functions in d3d_primitive() functions, then the color is correct.
Logged
Offline (Male) Goombert
Reply #6 Posted on: August 04, 2013, 07:19:51 AM

Developer
Location: Cappuccino, CA
Joined: Jan 2013
Posts: 3110

View Profile
Oh I see, yes, ok.
Logged
I think it was Leonardo da Vinci who once said something along the lines of "If you build the robots, they will make games." or something to that effect.

Pages: 1
  Print