This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Pages: « 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 »
1666
Off-Topic / Re: Hey guys, thanx.
« on: October 17, 2010, 12:42:40 pm »
Our d3d_ functions probably won't suck. r9k implemented some of those sometime last Thursday.
1667
Function Peer Review / Re: GML: draw_sprite_tiled_area + draw_sprite_tiled_area_ext (Custom, not in GM)
« on: October 17, 2010, 08:23:37 am »
Well, that's a mistake in itself. You could have the most outstandingly efficient piece of GML fathomable, and on the optimization scale, it'd be a steaming pile of shit and rusted bolts compared to the equivalent in a real language. Not just because GM's interpreter is slow, but because GM's pointerless, classless system makes you do all sorts of running around to get something simple done. Compare a C Brainfuck interpreter to a JavaScript one. There's no comparison.
But yes, your purpose is legal, then; as Ism said, it's just common courtesy to let him know we're using them. (Even though I don't find anything particularly insightful about his code, it's the idea that counts). But, seeing as that site is full of people taking such scripts and running with them without credit, I suppose it'd only be annoying if everyone that found use for them emailed him. So do what you like.
Anyway, yes, I'm a proponent of integral coordinates. Except one thing:
All vars are double. To call your function, they are cast as int.
You then invoke glTexCoord2f, casting them back to float.
I do the same thing; I've been waiting for someone to help me decide what to do about it. I think at this point swapping them all for 2i would be our best bet.
But yes, your purpose is legal, then; as Ism said, it's just common courtesy to let him know we're using them. (Even though I don't find anything particularly insightful about his code, it's the idea that counts). But, seeing as that site is full of people taking such scripts and running with them without credit, I suppose it'd only be annoying if everyone that found use for them emailed him. So do what you like.
Anyway, yes, I'm a proponent of integral coordinates. Except one thing:
All vars are double. To call your function, they are cast as int.
You then invoke glTexCoord2f, casting them back to float.
I do the same thing; I've been waiting for someone to help me decide what to do about it. I think at this point swapping them all for 2i would be our best bet.
1668
Announcements / Re: What's happening now
« on: October 17, 2010, 08:18:25 am »
We're working on that. By which I mean, I'm hinting to Ism every week or so that I hate it when that thing covers my game window.
1669
Function Peer Review / Re: GML: draw_sprite_tiled + draw_sprite_tiled_ext
« on: October 17, 2010, 08:15:30 am »
What am I never minding?
1670
Function Peer Review / Re: GML: draw_sprite_tiled + draw_sprite_tiled_ext
« on: October 16, 2010, 09:55:24 pm »
Oh, don't worry about that. I replaced your use of room_width and height with a simple ternary expression. Views are inefficient as dog in GM anyway.
This is the code I ended up including, which I will assume to work until further notice:
I have one bone left to pick with it, being that it does not account for a special-case optimization in which the bind mode can be set to GL_WRAP and the sprite can just be drawn large. This can be checked for simply by testing that both spr->texbordx and texbordy are 1. In this case, the entirety of the allocated space is used, and there is no need to loop anything (The GPU is, of course, much more proficient at menial looping than the CPU).
My recommendation, as I will soon implement if no one else does, is a pattern like so:
if (spr->texbordx == 1)
{
if (spr->texbordy == 1)
{
Draw single quad with appropriate texture bounds. Negative and extremely large bounds are both valid.
}
else
for (all Y coordinates)
draw a large horizontal quad with appropriate x bounds, but with texbordy as the y bound.
}
else
if (spr->texbordy == 1)
for (all X coordinates)
draw a large horizontal quad with appropriate Y bounds, but with texbordy as the Y bound.
else
Exactly what you do now.
Granted, that's a "fucking large function," and with two branches, no less. The average time saving becomes a question, and we have to wonder if it was worth it for the extra checks and the extra memory. (Both of which are relatively negligible; it's all a matter of weight).
And this is the shit I mull over all day and night.
This is the code I ended up including, which I will assume to work until further notice:
Code: [Select]
int draw_sprite_tiled(int spr,int subimg,double x,double y)
{
enigma::sprite *spr2d = enigma::spritestructarray[spr];
if (!spr2d)
return -1;
if (enigma::cur_bou_tha_noo_sho_eve_cha_eve != spr2d->texturearray[subimg % spr2d->subcount])
{
glBindTexture(GL_TEXTURE_2D,spr2d->texturearray[subimg % spr2d->subcount]);
enigma::cur_bou_tha_noo_sho_eve_cha_eve = spr2d->texturearray[subimg % spr2d->subcount];
}
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_CLAMP);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_CLAMP);
glPushAttrib(GL_CURRENT_BIT);
glColor4f(1,1,1,1);
const float
tbx = spr2d->texbordx, tby = spr2d->texbordy,
xoff = spr2d->xoffset+x, yoff = spr2d->yoffset+y;
const int
hortil = int (ceil( (view_enabled ? view_xview[view_current] + view_wview[view_current] : room_width) / (spr2d->width*tbx))),
vertil = int (ceil( (view_enabled ? view_yview[view_current] + view_hview[view_current] : room_height) / (spr2d->height*tby)));
glBegin(GL_QUADS);
for (int i=0; i<hortil; i++)
{
for (int c=0; c<vertil; c++)
{
glTexCoord2f(0,0);
glVertex2f(i*spr2d->width-xoff,c*spr2d->height-yoff);
glTexCoord2f(tbx,0);
glVertex2f((i+1)*spr2d->width-xoff,c*spr2d->height-yoff);
glTexCoord2f(tbx,tby);
glVertex2f((i+1)*spr2d->width-xoff,(c+1)*spr2d->height-yoff);
glTexCoord2f(0,tby);
glVertex2f(i*spr2d->width-xoff,(c+1)*spr2d->height-yoff);
}
}
glEnd();
glPopAttrib();
return 0;
}
int draw_sprite_tiled_ext(int spr,int subimg,double x,double y, double xscale,double yscale,int color,double alpha)
{
enigma::sprite *spr2d = enigma::spritestructarray[spr];
if (!spr2d)
return -1;
if (enigma::cur_bou_tha_noo_sho_eve_cha_eve != spr2d->texturearray[subimg % spr2d->subcount])
{
glBindTexture(GL_TEXTURE_2D,spr2d->texturearray[subimg % spr2d->subcount]);
enigma::cur_bou_tha_noo_sho_eve_cha_eve = spr2d->texturearray[subimg % spr2d->subcount];
}
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_CLAMP);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_CLAMP);
glPushAttrib(GL_CURRENT_BIT);
glColor4ub(__GETR(color),__GETG(color),__GETB(color),char(alpha*255));
const float
tbx = spr2d->texbordx, tby = spr2d->texbordy,
xoff = spr2d->xoffset*xscale+x, yoff = spr2d->yoffset*yscale+y;
const int
hortil= int (ceil( (view_enabled ? view_xview[view_current] + view_wview[view_current] : room_width) / (spr2d->width*tbx*xscale))),
vertil= int (ceil( (view_enabled ? view_yview[view_current] + view_hview[view_current] : room_height) / (spr2d->height*tby*yscale)));
glBegin(GL_QUADS);
for (int i=0; i<hortil; i++)
{
for (int c=0; c<vertil; c++)
{
glTexCoord2f(0,0);
glVertex2f(i*spr2d->width*xscale-xoff,c*spr2d->height*yscale-yoff);
glTexCoord2f(tbx,0);
glVertex2f((i+1)*spr2d->width*xscale-xoff,c*spr2d->height*yscale-yoff);
glTexCoord2f(tbx,tby);
glVertex2f((i+1)*spr2d->width*xscale-xoff,(c+1)*spr2d->height*yscale-yoff);
glTexCoord2f(0,tby);
glVertex2f(i*spr2d->width*xscale-xoff,(c+1)*spr2d->height*yscale-yoff);
}
}
glEnd();
glPopAttrib();
return 0;
}
I have one bone left to pick with it, being that it does not account for a special-case optimization in which the bind mode can be set to GL_WRAP and the sprite can just be drawn large. This can be checked for simply by testing that both spr->texbordx and texbordy are 1. In this case, the entirety of the allocated space is used, and there is no need to loop anything (The GPU is, of course, much more proficient at menial looping than the CPU).
My recommendation, as I will soon implement if no one else does, is a pattern like so:
if (spr->texbordx == 1)
{
if (spr->texbordy == 1)
{
Draw single quad with appropriate texture bounds. Negative and extremely large bounds are both valid.
}
else
for (all Y coordinates)
draw a large horizontal quad with appropriate x bounds, but with texbordy as the y bound.
}
else
if (spr->texbordy == 1)
for (all X coordinates)
draw a large horizontal quad with appropriate Y bounds, but with texbordy as the Y bound.
else
Exactly what you do now.
Granted, that's a "fucking large function," and with two branches, no less. The average time saving becomes a question, and we have to wonder if it was worth it for the extra checks and the extra memory. (Both of which are relatively negligible; it's all a matter of weight).
And this is the shit I mull over all day and night.
1671
Off-Topic / Re: Hey guys, thanx.
« on: October 16, 2010, 09:16:41 pm »
You know, DLLs are somewhat prototyped already. They should work, but I hear they don't, and simply haven't had the time (read, "patience for Windows") to look into the matter. And yes, HaRRi, you hit the nail on the head with the surface issue. But since Ism is working on YAML, we should stop running into compatibility issues altogether, as now we can fork a DirectX port that can be switched in and out at the push of a button (That's my number one logical defense for keeping GML).
I happen to be working on fonts as we speak, and Ism randomly took a liking to the issue and did the backend, so I can integrate her work as soon as I have a good rectangle packing algorithm.
I happen to be working on fonts as we speak, and Ism randomly took a liking to the issue and did the backend, so I can integrate her work as soon as I have a good rectangle packing algorithm.
1672
Function Peer Review / Re: GML: draw_sprite_tiled + draw_sprite_tiled_ext
« on: October 16, 2010, 01:55:48 pm »
Your choice to use room_width and height disregards views. Other than that, I guess I don't find fault with this.
I should also mention that I appreciate your single use of GL_QUADS, as opposed to one each for() iteration.
I should also mention that I appreciate your single use of GL_QUADS, as opposed to one each for() iteration.
1673
Function Peer Review / Re: GML: All draw_background functions + 2 custom ones
« on: October 16, 2010, 01:39:30 pm »
Because serp just felt like shortening it nonsensically.
1674
Function Peer Review / Re: GML: draw_sprite_tiled_area + draw_sprite_tiled_area_ext (Custom, not in GM)
« on: October 16, 2010, 01:38:32 pm »
I'm not sure what to do with the licensing for these. I can see these being useful, though. Is any license associated with them on that site?
1675
Function Peer Review / Re: GML: draw_sprite_stretched_ext
« on: October 16, 2010, 01:34:54 pm »
Integrated for next revision.
1676
Function Peer Review / Re: GML: All draw_background functions + 2 custom ones
« on: October 16, 2010, 01:27:02 pm »
Okay, seeing those corrections (especially in comparison to TGMG's original code) I am happy with the look of things. These functions will appear in ENIGMA's next revision.
1677
Issues Help Desk / Re: Can someone explain how to use enigma
« on: October 13, 2010, 02:29:03 pm »
No worries. It really is our fault; the download process of the installation takes far too long to go without a progress bar. People in general--myself included--are used to waiting seconds for something to propagate out unless they can see a progress dialog. I'd have closed it out myself in your shoes.
From here, I Just hope others see this topic instead of asking until we actually have an indicator going for that.
From here, I Just hope others see this topic instead of asking until we actually have an indicator going for that.
1678
Issues Help Desk / Re: Can someone explain how to use enigma
« on: October 12, 2010, 07:08:20 pm »
The SVN error is because you interrupted the checkout while the directory was locked and it was downloading. ENIGMA's installation takes a while, and Ism has yet to respond to my request to show a progress pane for its entirety. During the first couple minutes of ENIGMA's first run, it is downloading files it needs to work; a process Ism only vaguely hints is about to transpire. After that, it pops up a progress pane for actually working with those files and setting up ENIGMA.
Try redownloading (or unpacking the zip anew) and letting it run from start until it tells you it's all done. You'll probably get a small error at the end where it wants you to restart LGM--But errors instead of asking politely.
The process is messy,but Ism's free time lately is apparently scarce, and we're trying to ration it on more important matters than the installation.
Try redownloading (or unpacking the zip anew) and letting it run from start until it tells you it's all done. You'll probably get a small error at the end where it wants you to restart LGM--But errors instead of asking politely.
The process is messy,but Ism's free time lately is apparently scarce, and we're trying to ration it on more important matters than the installation.
1679
Issues Help Desk / Re: Can someone explain how to use enigma
« on: October 12, 2010, 03:14:46 pm »
Yeah, it's installing. Just give it plenty of time to finish before you run something.
1680
Issues Help Desk / Re: Can someone explain how to use enigma
« on: October 12, 2010, 07:50:16 am »
If you are on Windows, it may be that ENIGMA is still installing without telling you (Ism has yet to add a progress box during checkout).
But to compile, indeed you go to Enigma->Run.
The Compile button only works in the latest revisions, so if you are running from "Stable," I'd recommend sticking to "Run." (It was difficult coordinating an output filename, but our latest implementation made it a bit easier).
"Debug" doesn't do anything because its behavior is still subject to debate (and few things made in ENIGMA thus far have really needed debugging that wasn't done in GM), and Design mode is off because the set of functions used to create its interface became obsolete when we ported ENIGMA to many different operating systems. They will be reimplemented as soon as possible.
I haven't heard much from our Windows testers lately, and will probably make a trip back to Windows long enough to test the new build system on it shortly, but if you did choose "Stable" as the release version, that doesn't really affect you.
I'll see about putting out some kind of tutorial with our next update, which I hope won't be too long from now.
But to compile, indeed you go to Enigma->Run.
The Compile button only works in the latest revisions, so if you are running from "Stable," I'd recommend sticking to "Run." (It was difficult coordinating an output filename, but our latest implementation made it a bit easier).
"Debug" doesn't do anything because its behavior is still subject to debate (and few things made in ENIGMA thus far have really needed debugging that wasn't done in GM), and Design mode is off because the set of functions used to create its interface became obsolete when we ported ENIGMA to many different operating systems. They will be reimplemented as soon as possible.
I haven't heard much from our Windows testers lately, and will probably make a trip back to Windows long enough to test the new build system on it shortly, but if you did choose "Stable" as the release version, that doesn't really affect you.
I'll see about putting out some kind of tutorial with our next update, which I hope won't be too long from now.
Pages: « 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 »