Yah just a heads up everybody, Studio removed the draw_set_color function, well, the way it used to be anyway. I recently readded it the Game Maker 8.1 way with Direct3D where you can call it to change the color of a model or the alpha, but listen here is the funny thing. YoYoGames decided to store current color for every vertice, making their code redundant one would assume, and making it run slower and also making it less flexible to use, eg. drawing transparent models, when they simply could have replaced the blend operation in the FFP with HLSL. But never the less ENIGMA will continue the old expected draw_set_color behavior because it is rather useful to draw transparent models and the likes.
void draw_set_color(int col) { enigma::currentcolor[0] = __GETR(col); enigma::currentcolor[1] = __GETG(col); enigma::currentcolor[2] = __GETB(col); D3DCOLOR D3DColor = D3DCOLOR_RGBA(__GETR(col), __GETG(col), __GETB(col), 155); d3ddev->SetRenderState(D3DRS_BLENDOP, D3DBLENDOP_ADD); d3ddev->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_BLENDFACTOR); d3ddev->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA); d3ddev->SetRenderState(D3DRS_BLENDFACTOR, D3DColor); d3ddev->SetRenderState(D3DRS_TEXTUREFACTOR, D3DCOLOR_RGBA(155, 155, 155, 155)); }
Also, this means that stupid cubes demo of their's won't work right out of the box. And listen how dumb this is, here is why...
draw_set_color(c_red); d3d_set_lighting(true); d3d_light_define_direction(0, 0.5,0,1, c_white); d3d_light_enable(0,true); d3d_transform_set_rotation_z( d3d.x ); d3d_transform_add_rotation_y( d3d.x/2 );
if( global.cube>=0 ) d3d_model_draw(global.cube, 0,0,0, -1); d3d_set_lighting(false); d3d_model_draw(global.wirecube, 0,0,0, -1 );
They put draw_set_color(c_red); directly before drawing the cubes. Which doesn't even change anything in Studio since set color was stored in the model but yet it does work in ENIGMA. Which makes me wonder why the fuck that code is even their in there demo, if they were just testing it or testing if it was removed or what. But at any rate, ENIGMA will keep the easy to use expected behavior and sprite batching will render on the state change since it is simply a blend op.
|