All language subtitles for (auto)(15) 38 - YouTube

af Afrikaans
sq Albanian
am Amharic
ar Arabic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bn Bengali
bs Bosnian
bg Bulgarian
ca Catalan
ceb Cebuano
ny Chichewa
zh-CN Chinese (Simplified) Download
zh-TW Chinese (Traditional)
co Corsican
hr Croatian
cs Czech
da Danish
nl Dutch
en English
eo Esperanto
et Estonian
tl Filipino
fi Finnish
fr French
fy Frisian
gl Galician
ka Georgian
de German
el Greek
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
hu Hungarian
is Icelandic
ig Igbo
id Indonesian
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
km Khmer
ko Korean
ku Kurdish (Kurmanji)
ky Kyrgyz
lo Lao
la Latin
lv Latvian
lt Lithuanian
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mn Mongolian
my Myanmar (Burmese)
ne Nepali
no Norwegian
ps Pashto
fa Persian
pl Polish
pt Portuguese
pa Punjabi
ro Romanian
ru Russian
sm Samoan
gd Scots Gaelic
sr Serbian
st Sesotho
sn Shona
sd Sindhi
si Sinhala
sk Slovak
sl Slovenian
so Somali
es Spanish
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
te Telugu
th Thai
tr Turkish
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu
or Odia (Oriya)
rw Kinyarwanda
tk Turkmen
tt Tatar
ug Uyghur
Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated: 1 00:00:36,240 --> 00:00:40,620 crisis averted yes the crisis has 2 00:00:40,620 --> 00:00:41,430 been averted 3 00:00:41,430 --> 00:00:45,180 hna you the crisis actually has not been 4 00:00:45,180 --> 00:00:47,610 averted unfortunately the reason that 5 00:00:47,610 --> 00:00:48,870 the stream is starting late today is 6 00:00:48,870 --> 00:00:53,340 because well we're having a little bit 7 00:00:53,340 --> 00:00:56,100 of a problem I wanted to get rid of my 8 00:00:56,100 --> 00:00:58,020 taskbar I was talking about this on the 9 00:00:58,020 --> 00:01:02,940 last on the last stream and I thought I 10 00:01:02,940 --> 00:01:05,070 had seen some people say that you could 11 00:01:05,070 --> 00:01:06,540 finally get rid of the taskbar again 12 00:01:06,540 --> 00:01:09,229 used to be able to the taskbar on 13 00:01:09,229 --> 00:01:11,610 Windows XP and of course when they 14 00:01:11,610 --> 00:01:16,460 introduced their improvements to Windows 15 00:01:16,460 --> 00:01:20,190 with Vista and 7 where they improved 16 00:01:20,190 --> 00:01:21,899 everything they improved it so that it 17 00:01:21,899 --> 00:01:24,540 no longer works so you can't actually 18 00:01:24,540 --> 00:01:28,350 hide the taskbar it anymore basically 19 00:01:28,350 --> 00:01:31,380 you only have this thing that basically 20 00:01:31,380 --> 00:01:33,330 it always pops up if you go back up to 21 00:01:33,330 --> 00:01:36,300 the edge of the screen and it's awful 22 00:01:36,300 --> 00:01:38,250 and so you used to be able there was a 23 00:01:38,250 --> 00:01:39,840 thing in here that said taskbar is 24 00:01:39,840 --> 00:01:41,490 always on top or whatever and you could 25 00:01:41,490 --> 00:01:44,340 uncheck that and that was awesome it was 26 00:01:44,340 --> 00:01:47,670 like totally perfect and did exactly 27 00:01:47,670 --> 00:01:48,960 what you want because then all of your 28 00:01:48,960 --> 00:01:50,850 fullscreen windows would just be over it 29 00:01:50,850 --> 00:02:00,240 which is what I wanted but I don't know 30 00:02:00,240 --> 00:02:02,400 what to say so basically I was trying to 31 00:02:02,400 --> 00:02:04,229 get rid of that I was looking on the web 32 00:02:04,229 --> 00:02:06,860 for some of these things basically and 33 00:02:06,860 --> 00:02:13,709 ya couldn't find it there's there's like 34 00:02:13,709 --> 00:02:15,810 some tools you could course they got rid 35 00:02:15,810 --> 00:02:18,290 of it so thoroughly that you have to 36 00:02:18,290 --> 00:02:24,090 taskbar always on top Windows 7 and like 37 00:02:24,090 --> 00:02:25,350 I was trying to find people who were 38 00:02:25,350 --> 00:02:27,890 talking about this sort of thing and 39 00:02:27,890 --> 00:02:30,420 there's like utilities you can install 40 00:02:30,420 --> 00:02:33,230 where I tried installing one of them but 41 00:02:33,230 --> 00:02:37,459 didn't actually work so basically like 42 00:02:37,459 --> 00:02:39,900 you know when you're not using the track 43 00:02:39,900 --> 00:02:41,760 bar Start menu blah blah blah right it 44 00:02:41,760 --> 00:02:43,590 simulates to keep taskbar on top 45 00:02:43,590 --> 00:02:45,000 unchecking that box this is what I 46 00:02:45,000 --> 00:02:47,010 actually wanted like I've been surpassed 47 00:02:47,010 --> 00:02:50,160 the simplest act taskbar Tweaker does 48 00:02:50,160 --> 00:02:51,780 this job better than my code I recommend 49 00:02:51,780 --> 00:02:55,050 you song said I installed this I do not 50 00:02:55,050 --> 00:02:57,570 actually see any option for doing it so 51 00:02:57,570 --> 00:02:59,100 I don't know if I'm just using the tool 52 00:02:59,100 --> 00:03:01,350 wrong I haven't tried this one yet I 53 00:03:01,350 --> 00:03:03,570 guess I could try it just to get a few 54 00:03:03,570 --> 00:03:05,700 more viruses on my machine you know it's 55 00:03:05,700 --> 00:03:09,030 always good but I don't actually know 56 00:03:09,030 --> 00:03:11,970 yeah if it would actually work I could 57 00:03:11,970 --> 00:03:15,900 try it and I don't I just understand why 58 00:03:15,900 --> 00:03:18,060 this guy thinks that this tool does it 59 00:03:18,060 --> 00:03:19,740 but he doesn't actually say how you 60 00:03:19,740 --> 00:03:22,050 would do it you can see here like I've 61 00:03:22,050 --> 00:03:23,700 got this thing installed if you open it 62 00:03:23,700 --> 00:03:25,680 up right I don't even see an option for 63 00:03:25,680 --> 00:03:27,690 it I don't even see I don't even see a 64 00:03:27,690 --> 00:03:31,860 heading where the option would go but I 65 00:03:31,860 --> 00:03:34,200 don't know like there just doesn't seem 66 00:03:34,200 --> 00:03:38,610 to be I got I got nothing there doesn't 67 00:03:38,610 --> 00:03:41,040 seem to be any any actual thing here to 68 00:03:41,040 --> 00:03:44,910 click on you know I'm saying you know 69 00:03:44,910 --> 00:03:51,550 what I'm saying 70 00:03:51,550 --> 00:03:54,470 anyone no no one on the snow one on the 71 00:03:54,470 --> 00:03:57,200 stream probably knows because I'm 72 00:03:57,200 --> 00:03:58,610 guessing that people on the stream 73 00:03:58,610 --> 00:04:00,290 probably have already moved to some 74 00:04:00,290 --> 00:04:01,910 other thing I should probably try to 75 00:04:01,910 --> 00:04:03,380 install a classic shell and see if that 76 00:04:03,380 --> 00:04:04,880 has it or one of those other shell tools 77 00:04:04,880 --> 00:04:06,770 and see if it you know can replace this 78 00:04:06,770 --> 00:04:08,800 whole taskbar was something more usable 79 00:04:08,800 --> 00:04:11,990 but yes so he says install seven-plus 80 00:04:11,990 --> 00:04:13,490 taskbar speaker here is seven plus 81 00:04:13,490 --> 00:04:15,470 taskbar Tweaker I do not actually see 82 00:04:15,470 --> 00:04:19,330 any options that actually would work 83 00:04:19,330 --> 00:04:23,000 dropping hovering thumbnails pin left 84 00:04:23,000 --> 00:04:25,310 click other hi the start button that 85 00:04:25,310 --> 00:04:26,720 actually does Head Start button doesn't 86 00:04:26,720 --> 00:04:28,640 help show desktop button can go away 87 00:04:28,640 --> 00:04:30,500 that doesn't help either although I'd be 88 00:04:30,500 --> 00:04:32,090 fine with having that go I never used 89 00:04:32,090 --> 00:04:34,280 that button display seconds is good but 90 00:04:34,280 --> 00:04:35,870 doesn't help here reserved empty space 91 00:04:35,870 --> 00:04:38,930 doesn't help doesn't do anything in our 92 00:04:38,930 --> 00:04:41,120 case I just I don't know I guess I could 93 00:04:41,120 --> 00:04:43,100 look at the help me the help have 94 00:04:43,100 --> 00:04:46,280 something let's see 95 00:04:46,280 --> 00:04:52,220 search top some of these tend office 96 00:04:52,220 --> 00:04:55,150 with your tuned aspects of the tweeker 97 00:04:55,150 --> 00:05:01,910 disabled tab topmost oh wait so it does 98 00:05:01,910 --> 00:05:05,450 have a setting but how do you access the 99 00:05:05,450 --> 00:05:08,770 setting options e^x 100 00:05:08,770 --> 00:05:11,060 can use the eventual objects is it can 101 00:05:11,060 --> 00:05:14,240 be open from the tray icon okay all 102 00:05:14,240 --> 00:05:17,090 right all right let me see if I 103 00:05:17,090 --> 00:05:19,750 right-click on the tray icon advanced 104 00:05:19,750 --> 00:05:24,140 okay wait for it people this could be 105 00:05:24,140 --> 00:05:25,850 exciting this could be exciting right 106 00:05:25,850 --> 00:05:30,590 here apply okay and I think I also 107 00:05:30,590 --> 00:05:31,970 accidentally shut this thing off so 108 00:05:31,970 --> 00:05:35,840 let's see run that startup okay alright 109 00:05:35,840 --> 00:05:38,710 done there we go 110 00:05:38,710 --> 00:05:43,370 let's take a look that does not appear 111 00:05:43,370 --> 00:05:48,320 to be disabling topmost to me but maybe 112 00:05:48,320 --> 00:05:50,360 it did I don't know it doesn't look like 113 00:05:50,360 --> 00:05:53,360 it let's take a look 114 00:05:53,360 --> 00:05:55,460 my default password to type this option 115 00:05:55,460 --> 00:05:57,260 allows change behavior always on top not 116 00:05:57,260 --> 00:05:58,940 always on top but not over okay so I got 117 00:05:58,940 --> 00:06:02,780 sent it to to RTFM I guess is the answer 118 00:06:02,780 --> 00:06:03,370 there 119 00:06:03,370 --> 00:06:06,040 try it one minute left in the stream can 120 00:06:06,040 --> 00:06:11,710 we do it can we do it to return apply 121 00:06:11,710 --> 00:06:17,740 okay oh my God look at it are you 122 00:06:17,740 --> 00:06:19,930 looking at it look at how beautiful that 123 00:06:19,930 --> 00:06:20,639 is 124 00:06:20,639 --> 00:06:24,729 that is so excellent although it ruins 125 00:06:24,729 --> 00:06:29,919 other top most windows like my top most 126 00:06:29,919 --> 00:06:40,210 windows are now not topmost anymore so 127 00:06:40,210 --> 00:06:42,960 close and yet so far 128 00:06:42,960 --> 00:06:46,650 why would you taught me like that people 129 00:06:46,650 --> 00:06:51,550 why well I guess we could also just 130 00:06:51,550 --> 00:06:54,580 double check trying I could exit the 131 00:06:54,580 --> 00:06:57,400 timer app and then start the timer app 132 00:06:57,400 --> 00:07:03,930 again I suppose let's see if that helps 133 00:07:03,930 --> 00:07:06,520 there we go so I guess it just it did it 134 00:07:06,520 --> 00:07:08,349 to all top level windows it must have 135 00:07:08,349 --> 00:07:10,810 messed up the Z order alright so what 136 00:07:10,810 --> 00:07:13,539 day are we on I don't even know what is 137 00:07:13,539 --> 00:07:16,030 it day 37 I want to say let's take a 138 00:07:16,030 --> 00:07:18,700 look what day what actual day are we at 139 00:07:18,700 --> 00:07:22,810 right now sorry we we may have actually 140 00:07:22,810 --> 00:07:24,340 solved this problem so I'm pretty happy 141 00:07:24,340 --> 00:07:26,590 about that but let's see what make sure 142 00:07:26,590 --> 00:07:28,389 we're on the right day here video 143 00:07:28,389 --> 00:07:31,210 archive day 37 was yesterday so we're on 144 00:07:31,210 --> 00:07:35,289 day 38 today alright well that's pretty 145 00:07:35,289 --> 00:07:37,360 exciting you have to admit that is is 146 00:07:37,360 --> 00:07:39,669 pretty exciting I am relatively excited 147 00:07:39,669 --> 00:07:43,030 about that hmm let's get all this stuff 148 00:07:43,030 --> 00:07:45,039 straightened out again that means we no 149 00:07:45,039 --> 00:07:47,620 longer have this ridiculous unused area 150 00:07:47,620 --> 00:07:49,599 at the top of the screen we can actually 151 00:07:49,599 --> 00:07:51,580 have everything go up to the height that 152 00:07:51,580 --> 00:07:53,020 was supposed to be let's see does our 153 00:07:53,020 --> 00:07:56,530 Emacs go to the hole look at that that's 154 00:07:56,530 --> 00:07:59,560 fantastic well that is just great news I 155 00:07:59,560 --> 00:08:01,870 am very happy about that that is super 156 00:08:01,870 --> 00:08:04,180 cool you know that's the little things 157 00:08:04,180 --> 00:08:06,280 you know I'm saying even if someone else 158 00:08:06,280 --> 00:08:08,139 had to write them for for Microsoft at 159 00:08:08,139 --> 00:08:11,349 least someone did there we go all right 160 00:08:11,349 --> 00:08:15,240 I guess we can start the stream now 161 00:08:15,240 --> 00:08:21,740 I hope everyone shared in that triumph I 162 00:08:21,740 --> 00:08:24,120 don't know if they did or not can't see 163 00:08:24,120 --> 00:08:28,229 what's going on on there yeah yeah I 164 00:08:28,229 --> 00:08:30,780 think everyone's pretty except excited I 165 00:08:30,780 --> 00:08:33,120 know I am so let's go ahead and get the 166 00:08:33,120 --> 00:08:37,500 get the gloves on here and we will we 167 00:08:37,500 --> 00:08:38,700 will go ahead and start the stream now 168 00:08:38,700 --> 00:08:41,550 that we've had that that small victory I 169 00:08:41,550 --> 00:08:44,310 guess I can close the old command prompt 170 00:08:44,310 --> 00:08:46,320 from yesterday as well get back to our 171 00:08:46,320 --> 00:08:50,670 standard standard screen and we can 172 00:08:50,670 --> 00:08:53,300 actually get programming which seems 173 00:08:53,300 --> 00:08:55,529 like a pretty good idea since this is 174 00:08:55,529 --> 00:08:57,540 supposed to be handmade hero not 175 00:08:57,540 --> 00:08:59,279 handmade fighting with the Windows user 176 00:08:59,279 --> 00:09:00,810 interface get the taskbar out of the way 177 00:09:00,810 --> 00:09:02,940 even though sometimes that is what 178 00:09:02,940 --> 00:09:04,290 programming ends up being fighting with 179 00:09:04,290 --> 00:09:05,640 Microsoft to get it out of your way is 180 00:09:05,640 --> 00:09:07,770 often thing that does happen when you're 181 00:09:07,770 --> 00:09:09,510 programming so you know it's not that 182 00:09:09,510 --> 00:09:13,980 far off I suppose but let us go ahead 183 00:09:13,980 --> 00:09:19,350 and return to the program hello everyone 184 00:09:19,350 --> 00:09:22,709 welcome to day 38 of handmade hero the 185 00:09:22,709 --> 00:09:24,480 show where we code a complete game from 186 00:09:24,480 --> 00:09:26,579 scratch using nothing but our typing 187 00:09:26,579 --> 00:09:28,620 little fingers no libraries no engines 188 00:09:28,620 --> 00:09:30,959 so we can actually see the incomplete 189 00:09:30,959 --> 00:09:32,820 process of making game and you can learn 190 00:09:32,820 --> 00:09:36,000 how everything works right from where 191 00:09:36,000 --> 00:09:37,529 the pixels are drawn on the screen all 192 00:09:37,529 --> 00:09:39,390 the way up to how the game code operates 193 00:09:39,390 --> 00:09:43,380 at a high level so today we happen to be 194 00:09:43,380 --> 00:09:46,020 at the point where we are putting 195 00:09:46,020 --> 00:09:48,570 sprites on screen and we are not doing 196 00:09:48,570 --> 00:09:50,459 our full render yet because that's a 197 00:09:50,459 --> 00:09:51,480 little bit more of an involved process 198 00:09:51,480 --> 00:09:52,800 but basically we just wanted to have 199 00:09:52,800 --> 00:09:54,870 something where we could easily put some 200 00:09:54,870 --> 00:09:56,700 graphics up on the screen for our own 201 00:09:56,700 --> 00:09:58,529 testing purposes as we are sort of going 202 00:09:58,529 --> 00:10:00,000 through and figuring out what we want in 203 00:10:00,000 --> 00:10:01,290 our engine architecture and one of the 204 00:10:01,290 --> 00:10:02,490 big parts of that obviously is going to 205 00:10:02,490 --> 00:10:03,510 be what we want for our rendering 206 00:10:03,510 --> 00:10:04,950 architecture and it's kind of hard to 207 00:10:04,950 --> 00:10:06,959 make those decisions without something 208 00:10:06,959 --> 00:10:09,209 to work with so that's what we wrote 209 00:10:09,209 --> 00:10:10,770 yesterday but we have a couple things 210 00:10:10,770 --> 00:10:12,240 left that we need to do to it so that's 211 00:10:12,240 --> 00:10:13,860 what we're gonna be doing today if you'd 212 00:10:13,860 --> 00:10:15,600 like to follow along at home and you 213 00:10:15,600 --> 00:10:16,680 went to hand made here at Oregon 214 00:10:16,680 --> 00:10:17,850 pre-order the source code you should 215 00:10:17,850 --> 00:10:19,260 have gotten a link in your email address 216 00:10:19,260 --> 00:10:22,649 in your email inbox and that link will 217 00:10:22,649 --> 00:10:24,420 allow you to download both the art 218 00:10:24,420 --> 00:10:26,970 assets that we're using and it will also 219 00:10:26,970 --> 00:10:28,400 allow you to download the source 220 00:10:28,400 --> 00:10:29,570 so if you download that source code 221 00:10:29,570 --> 00:10:31,940 today is day 38 so go ahead and unzip 222 00:10:31,940 --> 00:10:34,190 day 37 source code out of the source 223 00:10:34,190 --> 00:10:35,779 code zip file does zip files basically 224 00:10:35,779 --> 00:10:37,250 has a ton of little zip files in it's 225 00:10:37,250 --> 00:10:38,480 like a Russian nesting doll kind of 226 00:10:38,480 --> 00:10:41,300 thing and there you go that will 227 00:10:41,300 --> 00:10:43,040 basically give you the same source code 228 00:10:43,040 --> 00:10:45,640 that I am starting with right now so 229 00:10:45,640 --> 00:10:47,630 let's go ahead we've got a bunch of 230 00:10:47,630 --> 00:10:50,360 stuff to do so let's get to it I'm gonna 231 00:10:50,360 --> 00:10:53,060 open up the debugger here and just point 232 00:10:53,060 --> 00:10:54,980 out where we were before if you remember 233 00:10:54,980 --> 00:10:57,620 we were looking at putting the sprite up 234 00:10:57,620 --> 00:10:58,880 on the screen but the colors were wrong 235 00:10:58,880 --> 00:11:00,920 and so the question was what was going 236 00:11:00,920 --> 00:11:02,660 on there and it turned out that since I 237 00:11:02,660 --> 00:11:05,240 think it was my fault actually I had run 238 00:11:05,240 --> 00:11:07,790 a little resizing tool on some of the I 239 00:11:07,790 --> 00:11:10,580 had run image magic to resize some of 240 00:11:10,580 --> 00:11:12,290 the pit maps and it rode them out in a 241 00:11:12,290 --> 00:11:16,070 different byte order than the ones that 242 00:11:16,070 --> 00:11:18,080 came straight out again and so basically 243 00:11:18,080 --> 00:11:20,390 what we have to do today we figured out 244 00:11:20,390 --> 00:11:22,130 this at the end of last stream but 245 00:11:22,130 --> 00:11:23,750 basically the bitmap header has these 246 00:11:23,750 --> 00:11:25,070 things at the bottom red green and blue 247 00:11:25,070 --> 00:11:26,750 masks that we figured out and we've got 248 00:11:26,750 --> 00:11:28,250 them laid out in here so we know where 249 00:11:28,250 --> 00:11:30,710 they are and then in the files well that 250 00:11:30,710 --> 00:11:33,050 basically tell us where the red green 251 00:11:33,050 --> 00:11:35,029 and blue components go and it's I guess 252 00:11:35,029 --> 00:11:37,880 assumed that the Alpha is just whatever 253 00:11:37,880 --> 00:11:39,709 these aren't because there's obviously 254 00:11:39,709 --> 00:11:41,690 an alpha component as well and there 255 00:11:41,690 --> 00:11:43,459 isn't an alpha mask parameter as far as 256 00:11:43,459 --> 00:11:45,050 I can tell although maybe there actually 257 00:11:45,050 --> 00:11:46,970 is in an extended version of the file 258 00:11:46,970 --> 00:11:48,350 format I'm not sure but well we were 259 00:11:48,350 --> 00:11:50,000 looking on on the website of the 260 00:11:50,000 --> 00:11:51,740 documentation it looks like it was only 261 00:11:51,740 --> 00:11:53,779 red green and blue but doesn't really 262 00:11:53,779 --> 00:11:54,980 matter because we can tell if the Alpha 263 00:11:54,980 --> 00:11:55,940 is because it's where the red green and 264 00:11:55,940 --> 00:12:03,170 blue isn't so what we need to do here is 265 00:12:03,170 --> 00:12:05,060 we need to I don't know if you remember 266 00:12:05,060 --> 00:12:06,950 this but basically we already were doing 267 00:12:06,950 --> 00:12:08,600 a thing where we were swapping around 268 00:12:08,600 --> 00:12:09,950 the order of the stuff that came in 269 00:12:09,950 --> 00:12:11,060 because it wasn't the order that we 270 00:12:11,060 --> 00:12:13,790 wanted so our pixels were packed with a 271 00:12:13,790 --> 00:12:16,100 BGR which is this thing right here and 272 00:12:16,100 --> 00:12:17,720 so this is actually not correct anymore 273 00:12:17,720 --> 00:12:20,330 this comment we've learned is erroneous 274 00:12:20,330 --> 00:12:21,740 and so basically what we need to do is 275 00:12:21,740 --> 00:12:23,270 change this to say what's actually going 276 00:12:23,270 --> 00:12:25,459 on which is the byte order memory is 277 00:12:25,459 --> 00:12:31,970 determined by the header itself so we 278 00:12:31,970 --> 00:12:36,020 have to read out the masks and convert 279 00:12:36,020 --> 00:12:39,540 our pixels ourselves 280 00:12:39,540 --> 00:12:41,460 right and so that's what we're gonna 281 00:12:41,460 --> 00:12:43,380 have to do today so basically now we 282 00:12:43,380 --> 00:12:44,850 assume that when we load one of these 283 00:12:44,850 --> 00:12:47,970 BMP files we have no idea what order the 284 00:12:47,970 --> 00:12:50,250 things are in and we basically have to 285 00:12:50,250 --> 00:12:52,770 go ahead and figure out where they are 286 00:12:52,770 --> 00:12:54,690 yeah we could for we now know we know 287 00:12:54,690 --> 00:12:55,740 that basically none of the files that 288 00:12:55,740 --> 00:12:56,910 we're saving you're gonna have anything 289 00:12:56,910 --> 00:13:00,300 other than 8 bits per channel so we do 290 00:13:00,300 --> 00:13:01,500 know that we're basically looking at an 291 00:13:01,500 --> 00:13:04,080 oxf F kind of a mass but we just don't 292 00:13:04,080 --> 00:13:06,570 know where it actually is in the 32 bits 293 00:13:06,570 --> 00:13:08,790 we don't really know where it shows up 294 00:13:08,790 --> 00:13:10,470 so what we need to do is we basically 295 00:13:10,470 --> 00:13:13,770 need to get a shift value for each of 296 00:13:13,770 --> 00:13:17,580 our components so if you think about it 297 00:13:17,580 --> 00:13:19,980 we basically have a red shift not to be 298 00:13:19,980 --> 00:13:21,360 confused with the kind of red shift that 299 00:13:21,360 --> 00:13:24,300 they use in astronomy obviously that's a 300 00:13:24,300 --> 00:13:25,980 different kind of red ship but we have a 301 00:13:25,980 --> 00:13:27,780 red shift of green shift a blue shift 302 00:13:27,780 --> 00:13:32,670 and an alpha shift right there we go and 303 00:13:32,670 --> 00:13:33,720 so what we're gonna have to do is we 304 00:13:33,720 --> 00:13:35,010 have to figure out what those are and 305 00:13:35,010 --> 00:13:36,270 then we're gonna have to come in here 306 00:13:36,270 --> 00:13:38,340 and actually get them out 307 00:13:38,340 --> 00:13:41,010 right and so when we actually build our 308 00:13:41,010 --> 00:13:43,350 thing we could make this a little simple 309 00:13:43,350 --> 00:13:45,450 by taking the actual color value grab 310 00:13:45,450 --> 00:13:47,880 that and then we could do it this way 311 00:13:47,880 --> 00:13:49,680 just make it a little more easy for us 312 00:13:49,680 --> 00:13:51,630 to write here we basically can figure 313 00:13:51,630 --> 00:13:53,370 that we we know we need to put PAC 314 00:13:53,370 --> 00:13:55,380 things such that the Alpha is on top 315 00:13:55,380 --> 00:13:56,820 then the red then the green and the blue 316 00:13:56,820 --> 00:13:59,670 right so what we need to do essentially 317 00:13:59,670 --> 00:14:06,000 is we need to shift the red hmmm well 318 00:14:06,000 --> 00:14:07,950 you know what unfortunately I don't know 319 00:14:07,950 --> 00:14:09,780 that there's really any way we can do 320 00:14:09,780 --> 00:14:12,390 the shift totally generically in with 321 00:14:12,390 --> 00:14:13,950 only one ship I'd have to think about 322 00:14:13,950 --> 00:14:15,630 that because really we need to shift it 323 00:14:15,630 --> 00:14:17,100 they could have to shift in either 324 00:14:17,100 --> 00:14:19,980 direction right where where the red is 325 00:14:19,980 --> 00:14:21,540 in our source I don't know if you guys 326 00:14:21,540 --> 00:14:24,750 are already on the same page here in 327 00:14:24,750 --> 00:14:26,010 terms of what I want to do but basically 328 00:14:26,010 --> 00:14:28,860 I've got something where I've did you 329 00:14:28,860 --> 00:14:31,500 know I've got a 32-bit value right this 330 00:14:31,500 --> 00:14:34,050 is my 32-bit value and essentially I've 331 00:14:34,050 --> 00:14:37,200 got the eight here the this is 8 bits 8 332 00:14:37,200 --> 00:14:38,940 bits 8 bits 8 bits right this is the low 333 00:14:38,940 --> 00:14:41,670 this is the high and basically what I 334 00:14:41,670 --> 00:14:44,700 need to do is I've got you know some set 335 00:14:44,700 --> 00:14:47,550 of things I've got the reddest some 336 00:14:47,550 --> 00:14:48,630 where the greenest number that blue is 337 00:14:48,630 --> 00:14:50,400 somewhere whatever so I've got my ABCD 338 00:14:50,400 --> 00:14:52,880 and I basically need to rearrange these 339 00:14:52,880 --> 00:14:54,860 right in some arbitrary way like I have 340 00:14:54,860 --> 00:14:57,020 no idea where they actually need to go 341 00:14:57,020 --> 00:14:58,820 but I know that I'm going to determine 342 00:14:58,820 --> 00:15:00,830 where they need to go so what I need to 343 00:15:00,830 --> 00:15:02,300 be able to do is I need to be able to 344 00:15:02,300 --> 00:15:04,610 mask it out and then shift it to the 345 00:15:04,610 --> 00:15:06,200 right location but I don't actually know 346 00:15:06,200 --> 00:15:08,270 which directions gonna have to go it may 347 00:15:08,270 --> 00:15:09,950 be that like this was the green before 348 00:15:09,950 --> 00:15:11,630 and the green now has to go here so the 349 00:15:11,630 --> 00:15:13,250 shift would actually be a left shift 350 00:15:13,250 --> 00:15:15,650 right it'd be getting higher but it 351 00:15:15,650 --> 00:15:17,090 could be the other way around where it's 352 00:15:17,090 --> 00:15:18,080 actually below and so it's actually 353 00:15:18,080 --> 00:15:21,200 gonna be the right shift right and since 354 00:15:21,200 --> 00:15:22,310 I don't actually know if there's really 355 00:15:22,310 --> 00:15:24,650 any way to write that concisely what I 356 00:15:24,650 --> 00:15:26,090 think I'm gonna have to do instead is 357 00:15:26,090 --> 00:15:28,760 first shift it down and then shift it up 358 00:15:28,760 --> 00:15:30,790 so I know that my shifts are always 359 00:15:30,790 --> 00:15:33,740 basically are always going to be to the 360 00:15:33,740 --> 00:15:35,870 right for the parametric amount so 361 00:15:35,870 --> 00:15:37,550 basically my take the C and I'll shift 362 00:15:37,550 --> 00:15:39,710 it down by the alpha shift value right 363 00:15:39,710 --> 00:15:42,610 whatever that alpha shift value is I 364 00:15:42,610 --> 00:15:45,950 will end it with with the mask so that I 365 00:15:45,950 --> 00:15:47,840 know that I've basically now just got 366 00:15:47,840 --> 00:15:49,580 the Alpha sitting in the low eight bits 367 00:15:49,580 --> 00:15:51,740 and then I'll shift it up by 24 to put 368 00:15:51,740 --> 00:15:53,540 it in the position where I actually want 369 00:15:53,540 --> 00:15:56,690 my alpha to be right so that is 370 00:15:56,690 --> 00:15:58,460 basically what I'm gonna do for each of 371 00:15:58,460 --> 00:16:00,710 my values just so I can usually a lot of 372 00:16:00,710 --> 00:16:02,030 times people call this like a Swizzle 373 00:16:02,030 --> 00:16:03,770 I'm not really sure why they call it a 374 00:16:03,770 --> 00:16:05,810 Swizzle but a lot of times they do so i 375 00:16:05,810 --> 00:16:07,130 basically want to get the red the green 376 00:16:07,130 --> 00:16:09,080 and the blue by shifting them down like 377 00:16:09,080 --> 00:16:10,820 this masking them and then putting them 378 00:16:10,820 --> 00:16:12,740 back into the place where i actually 379 00:16:12,740 --> 00:16:16,130 want them to be like that and so really 380 00:16:16,130 --> 00:16:18,290 all i need to do here is figure out what 381 00:16:18,290 --> 00:16:21,050 the shift would be to get whatever the 382 00:16:21,050 --> 00:16:23,180 value is down into the bottom down to 383 00:16:23,180 --> 00:16:27,350 the bottom a bit problem is that only 384 00:16:27,350 --> 00:16:30,980 have that i have the mask and i dont 385 00:16:30,980 --> 00:16:33,200 have an alpha mask technically right 386 00:16:33,200 --> 00:16:37,010 whew hello that was odd what I actually 387 00:16:37,010 --> 00:16:39,500 have I've got the red mask right that 388 00:16:39,500 --> 00:16:41,810 comes out of the header red mask I've 389 00:16:41,810 --> 00:16:45,680 got the green mask I've got the blue 390 00:16:45,680 --> 00:16:48,590 mask but the Alpha mask actually isn't 391 00:16:48,590 --> 00:16:50,600 there as far as we know right I don't 392 00:16:50,600 --> 00:16:53,750 actually have an alpha mask so what I'm 393 00:16:53,750 --> 00:16:55,640 going to do is I'm going to assume that 394 00:16:55,640 --> 00:16:57,470 the Alpha mask is just wherever there 395 00:16:57,470 --> 00:16:59,780 wasn't a red a green or a blue so if I 396 00:16:59,780 --> 00:17:01,700 or the other masks together basically 397 00:17:01,700 --> 00:17:03,440 make a composite mass that would mask 398 00:17:03,440 --> 00:17:05,150 for red green and blue all at the same 399 00:17:05,150 --> 00:17:05,929 time 400 00:17:05,929 --> 00:17:08,360 I'm gonna assume that the knot of that 401 00:17:08,360 --> 00:17:10,189 if I flip all the bits in that then I'm 402 00:17:10,189 --> 00:17:11,779 gonna get basically where the Alpha is 403 00:17:11,779 --> 00:17:13,279 right because that'll basically give us 404 00:17:13,279 --> 00:17:16,549 wherever the other ones aren't right and 405 00:17:16,549 --> 00:17:18,679 I'll just I'll dummy up these values for 406 00:17:18,679 --> 00:17:20,899 a moment just so I can show you what I'm 407 00:17:20,899 --> 00:17:22,490 talking about for those of you who may 408 00:17:22,490 --> 00:17:25,309 not be super comfortable with bit 409 00:17:25,309 --> 00:17:26,269 operations yet 410 00:17:26,269 --> 00:17:30,110 I think it's amusing actually but I 411 00:17:30,110 --> 00:17:32,299 think someone was actually asking just 412 00:17:32,299 --> 00:17:33,830 on like a scream like yesterday or the 413 00:17:33,830 --> 00:17:37,610 day before whether we how if bit 414 00:17:37,610 --> 00:17:39,379 operations normally get used and today 415 00:17:39,379 --> 00:17:41,179 is like all about bid operations right 416 00:17:41,179 --> 00:17:43,730 so so the answer is definitely yes 417 00:17:43,730 --> 00:17:45,710 anyway so if we read out the red green 418 00:17:45,710 --> 00:17:47,539 the blue mask you can see them here 419 00:17:47,539 --> 00:17:49,190 right there's the red mask the green 420 00:17:49,190 --> 00:17:50,509 mask and the blue mask that's saying 421 00:17:50,509 --> 00:17:52,100 it's basically the Reds in the high 422 00:17:52,100 --> 00:17:54,440 greens in the second down the Blues in 423 00:17:54,440 --> 00:17:55,940 the second from the bottom and the and 424 00:17:55,940 --> 00:17:57,950 the Alpha we don't know we don't get get 425 00:17:57,950 --> 00:17:58,999 that right so what I'm going to do is 426 00:17:58,999 --> 00:18:00,320 gonna order them all together which will 427 00:18:00,320 --> 00:18:04,730 basically produce Oh X ffffff right and 428 00:18:04,730 --> 00:18:07,039 then I'm going to not it so you can see 429 00:18:07,039 --> 00:18:08,899 that basically what I get is I get what 430 00:18:08,899 --> 00:18:11,629 the part is that isn't filled in in any 431 00:18:11,629 --> 00:18:13,669 of these other ones right and so that's 432 00:18:13,669 --> 00:18:15,080 what that that's what I want I just want 433 00:18:15,080 --> 00:18:17,179 to fill in that extra value right and I 434 00:18:17,179 --> 00:18:18,679 can do that a little more explicitly if 435 00:18:18,679 --> 00:18:21,110 you guys want just to just to see what 436 00:18:21,110 --> 00:18:23,570 I'm talking about here right I can do it 437 00:18:23,570 --> 00:18:26,240 in two steps I wish they allowed you 438 00:18:26,240 --> 00:18:28,639 step into an expression it'd be so much 439 00:18:28,639 --> 00:18:30,379 nicer god what do all the things 440 00:18:30,379 --> 00:18:32,690 debuggers could do and don't so there's 441 00:18:32,690 --> 00:18:34,460 the alpha mask first before I've knotted 442 00:18:34,460 --> 00:18:35,570 it right you can see basically if I 443 00:18:35,570 --> 00:18:37,909 order them together I get the composite 444 00:18:37,909 --> 00:18:39,889 of all of those masks basically and then 445 00:18:39,889 --> 00:18:42,259 the not just this flips just flips what 446 00:18:42,259 --> 00:18:43,759 the actual values are right so that's 447 00:18:43,759 --> 00:18:46,369 what that's what I was doing there so 448 00:18:46,369 --> 00:18:48,769 that gives you all the masks but now we 449 00:18:48,769 --> 00:18:50,809 have a problem which is basically we 450 00:18:50,809 --> 00:18:53,450 need to actually know essentially what 451 00:18:53,450 --> 00:18:55,850 the lowest bit is that set in these 452 00:18:55,850 --> 00:18:57,470 values right because we need to know how 453 00:18:57,470 --> 00:18:58,789 far down to shift so we're essentially 454 00:18:58,789 --> 00:19:00,409 want to count how many bits there are 455 00:19:00,409 --> 00:19:03,320 that are 0 starting from the first bit 456 00:19:03,320 --> 00:19:04,879 and going up to the very first bit 457 00:19:04,879 --> 00:19:07,970 that's set right now what's interesting 458 00:19:07,970 --> 00:19:09,740 about this is this is actually something 459 00:19:09,740 --> 00:19:11,869 the processor can sometimes actually 460 00:19:11,869 --> 00:19:14,629 just do for you it's called a bit scan 461 00:19:14,629 --> 00:19:18,470 right and basically like well you know 462 00:19:18,470 --> 00:19:19,670 what I can even probably 463 00:19:19,670 --> 00:19:22,250 right here right so if I look in here 464 00:19:22,250 --> 00:19:25,100 it's a bit stand forward there we go if 465 00:19:25,100 --> 00:19:26,540 I take a look at this here you can look 466 00:19:26,540 --> 00:19:29,060 at MSDN it's actually compiler intrinsic 467 00:19:29,060 --> 00:19:30,680 the compiler can actually instructions 468 00:19:30,680 --> 00:19:32,480 for it basically what it says it'll 469 00:19:32,480 --> 00:19:34,220 search from the least significant bit 470 00:19:34,220 --> 00:19:36,650 right which if you remember if I was Li 471 00:19:36,650 --> 00:19:38,360 significance at the bottom right so this 472 00:19:38,360 --> 00:19:39,950 is this is we're talking about the bit 473 00:19:39,950 --> 00:19:41,780 here this is the most significant this 474 00:19:41,780 --> 00:19:43,790 is the least significant bit this is the 475 00:19:43,790 --> 00:19:45,440 most significant one right and just in 476 00:19:45,440 --> 00:19:48,950 our 32-bit value so this is bit 31 and 477 00:19:48,950 --> 00:19:52,070 this is bit zero okay so basically we do 478 00:19:52,070 --> 00:19:54,020 bits can forward what we can do there is 479 00:19:54,020 --> 00:19:56,510 we can say okay what I'd like you to do 480 00:19:56,510 --> 00:19:59,960 is give me back whatever the position 481 00:19:59,960 --> 00:20:03,530 was where the first bit was set right so 482 00:20:03,530 --> 00:20:05,870 tell me which bit was the first one set 483 00:20:05,870 --> 00:20:07,400 which is kind of what we want because up 484 00:20:07,400 --> 00:20:09,320 here somewhere we've got eight bits set 485 00:20:09,320 --> 00:20:13,400 right somewhere and we want to know how 486 00:20:13,400 --> 00:20:15,170 far to shift them down so that they line 487 00:20:15,170 --> 00:20:18,320 up right here so they start here and so 488 00:20:18,320 --> 00:20:19,580 really what we're trying to do is we're 489 00:20:19,580 --> 00:20:21,800 trying to do a bit scan to find where 490 00:20:21,800 --> 00:20:23,990 that value is right so we can implement 491 00:20:23,990 --> 00:20:26,180 this ourselves obviously right we could 492 00:20:26,180 --> 00:20:28,820 go ahead and actually search for it so I 493 00:20:28,820 --> 00:20:30,350 could do for example I could come in 494 00:20:30,350 --> 00:20:33,080 here and say internal and I could 495 00:20:33,080 --> 00:20:36,050 basically have I guess of bool 32 for 496 00:20:36,050 --> 00:20:38,480 example if I guess I don't really know 497 00:20:38,480 --> 00:20:39,440 because this is the way that this 498 00:20:39,440 --> 00:20:41,120 processor I don't actually remember what 499 00:20:41,120 --> 00:20:43,760 the how the actual instruction works but 500 00:20:43,760 --> 00:20:44,780 it looks like the way this thing works 501 00:20:44,780 --> 00:20:47,090 is it basically returns a boolean that 502 00:20:47,090 --> 00:20:49,760 says whether or not it found a bit at 503 00:20:49,760 --> 00:20:51,890 all and then it writes to an index to 504 00:20:51,890 --> 00:20:54,470 tell you where where that index where 505 00:20:54,470 --> 00:20:57,500 where we did actually find it so if we 506 00:20:57,500 --> 00:20:59,420 were going to mirror the way that that 507 00:20:59,420 --> 00:21:01,490 worked basically it's an unsigned care 508 00:21:01,490 --> 00:21:04,010 that it returns and so I don't actually 509 00:21:04,010 --> 00:21:05,270 know that I care about that so much I'm 510 00:21:05,270 --> 00:21:07,520 going to do a UN 32 there and then it's 511 00:21:07,520 --> 00:21:09,500 going to be an unsigned int that's the 512 00:21:09,500 --> 00:21:13,310 that's the index as well so basically it 513 00:21:13,310 --> 00:21:15,730 looks something like this 514 00:21:15,730 --> 00:21:21,470 it's can forward right and if I go ahead 515 00:21:21,470 --> 00:21:24,490 in here and say all right I want to 516 00:21:24,490 --> 00:21:27,200 implement this myself right you can kind 517 00:21:27,200 --> 00:21:28,820 of see how we would do it it's not 518 00:21:28,820 --> 00:21:30,920 particularly complicated right we just 519 00:21:30,920 --> 00:21:33,650 have a UN 32 well I I can actually do 520 00:21:33,650 --> 00:21:35,300 Buhl can beat you here because it's 521 00:21:35,300 --> 00:21:38,090 still 3 2 value and I can you know found 522 00:21:38,090 --> 00:21:41,810 equals false I can then do a search like 523 00:21:41,810 --> 00:21:45,140 literally with a for loop right which is 524 00:21:45,140 --> 00:21:47,990 you know tests equals zero test is less 525 00:21:47,990 --> 00:21:51,170 than 32 plus plus test right and then I 526 00:21:51,170 --> 00:21:55,010 can do value and one shifted up by 527 00:21:55,010 --> 00:21:57,560 whatever the test amount is and if that 528 00:21:57,560 --> 00:22:00,350 turns out to be set right if value and 529 00:22:00,350 --> 00:22:02,270 one should set up test turns out to be 530 00:22:02,270 --> 00:22:05,630 set then I will write the value of the 531 00:22:05,630 --> 00:22:09,890 bit into the result and otherwise I will 532 00:22:09,890 --> 00:22:12,580 not and so that will basically give me 533 00:22:12,580 --> 00:22:17,780 you know which whichever one it hits now 534 00:22:17,780 --> 00:22:21,500 if I find one oh sorry I've I've 535 00:22:21,500 --> 00:22:24,290 actually done that slightly backwards if 536 00:22:24,290 --> 00:22:26,420 we're trying to look for the first bit 537 00:22:26,420 --> 00:22:28,610 that's set not the first myth that's not 538 00:22:28,610 --> 00:22:30,560 set so we actually as soon as we find 539 00:22:30,560 --> 00:22:32,510 one that is set we want to stop looking 540 00:22:32,510 --> 00:22:35,570 and if we didn't hit one we will write 541 00:22:35,570 --> 00:22:37,040 to our index value right so if it's a 542 00:22:37,040 --> 00:22:43,510 zero we count that as a as a as an index 543 00:22:43,510 --> 00:22:46,190 no no okay nevermind no I'm correct I 544 00:22:46,190 --> 00:22:47,990 was correct the first time sorry I got I 545 00:22:47,990 --> 00:22:50,090 confused my own self there as soon as we 546 00:22:50,090 --> 00:22:52,100 find those in set we're actually trying 547 00:22:52,100 --> 00:22:53,810 to return that index so we just set the 548 00:22:53,810 --> 00:22:55,490 index equal to the one we found and we 549 00:22:55,490 --> 00:22:56,960 break out everything should be fine 550 00:22:56,960 --> 00:23:01,190 right and and I guess we set found equal 551 00:23:01,190 --> 00:23:03,260 to true here so that we know that we 552 00:23:03,260 --> 00:23:05,000 actually found one we can return the 553 00:23:05,000 --> 00:23:07,010 value properly now let me take a look 554 00:23:07,010 --> 00:23:08,450 here because since I confused my own 555 00:23:08,450 --> 00:23:10,730 self during the explanation let's 556 00:23:10,730 --> 00:23:12,590 actually go ahead and make sure that we 557 00:23:12,590 --> 00:23:15,370 actually did it correctly so this is 558 00:23:15,370 --> 00:23:16,520 redshift 559 00:23:16,520 --> 00:23:19,940 we passed the address of redshift and we 560 00:23:19,940 --> 00:23:22,580 will basically look and see red found 561 00:23:22,580 --> 00:23:25,730 equals that and we can assert red found 562 00:23:25,730 --> 00:23:30,020 so and then we'll compile that oh right 563 00:23:30,020 --> 00:23:32,410 we already have the redshift there we go 564 00:23:32,410 --> 00:23:39,680 so and what was the problem cannot 565 00:23:39,680 --> 00:23:42,740 convert argument one from int 32 oh yes 566 00:23:42,740 --> 00:23:45,120 right sorry UN 32 there we go 567 00:23:45,120 --> 00:23:49,290 so if I go ahead in here and actually 568 00:23:49,290 --> 00:23:51,930 step into it what I should find is that 569 00:23:51,930 --> 00:23:54,000 I pass in here I've got a value that I'm 570 00:23:54,000 --> 00:23:55,380 checking for it's all the way at the top 571 00:23:55,380 --> 00:23:57,270 so I'm expecting the value to basically 572 00:23:57,270 --> 00:24:01,350 be 24 right so I come in here and I keep 573 00:24:01,350 --> 00:24:04,410 shifting up test to see whether it 574 00:24:04,410 --> 00:24:06,000 actually hits against the value it's not 575 00:24:06,000 --> 00:24:08,250 gonna hit for the first 24 times right 576 00:24:08,250 --> 00:24:10,500 bla bla bla well it's what 23 times I 577 00:24:10,500 --> 00:24:13,890 should say turn off X vessels you can 578 00:24:13,890 --> 00:24:16,680 see 13 testing testing testing testing 579 00:24:16,680 --> 00:24:22,080 testing testing up to 20 22 23 and now 580 00:24:22,080 --> 00:24:24,300 24 should hit it rights back to the 581 00:24:24,300 --> 00:24:26,730 index so now the index gets 24 written 582 00:24:26,730 --> 00:24:28,350 to it at least that's what should happen 583 00:24:28,350 --> 00:24:33,090 find out oops start index right 24 we 584 00:24:33,090 --> 00:24:35,010 say that we did find it and then we 585 00:24:35,010 --> 00:24:37,380 return so there we go we've done the bit 586 00:24:37,380 --> 00:24:39,690 scan forward and we say that red was 587 00:24:39,690 --> 00:24:41,310 found the red shift is 24 which is 588 00:24:41,310 --> 00:24:43,860 exactly what we wanted so that's the bit 589 00:24:43,860 --> 00:24:46,140 scan operation but we're now doing it in 590 00:24:46,140 --> 00:24:47,700 a very slow way so what we'd like to do 591 00:24:47,700 --> 00:24:48,960 is we'd like to actually have the 592 00:24:48,960 --> 00:24:50,490 processor do it and this is the perfect 593 00:24:50,490 --> 00:24:51,510 time to talk a little about the 594 00:24:51,510 --> 00:24:53,400 intrinsics things that I keep alluding 595 00:24:53,400 --> 00:24:54,720 to but haven't actually done yet so 596 00:24:54,720 --> 00:24:58,280 maybe today we will actually do 597 00:24:58,280 --> 00:25:00,780 intrinsic so that we can call the bit 598 00:25:00,780 --> 00:25:12,120 scan forward okay yeah also I should 599 00:25:12,120 --> 00:25:14,070 point out for those of you who aren't 600 00:25:14,070 --> 00:25:15,750 familiar with these there's a bunch of 601 00:25:15,750 --> 00:25:17,100 these sorts of things right so you can 602 00:25:17,100 --> 00:25:18,630 actually count the other way as well 603 00:25:18,630 --> 00:25:21,540 right if you want to do from the from 604 00:25:21,540 --> 00:25:23,610 the high downward to count like the 605 00:25:23,610 --> 00:25:25,560 basically the zeroes that come at the 606 00:25:25,560 --> 00:25:28,440 top you can call the reverse version so 607 00:25:28,440 --> 00:25:30,390 so you know you've got there's yeah 608 00:25:30,390 --> 00:25:31,800 there's a bunch of intrinsic that will 609 00:25:31,800 --> 00:25:33,720 output those sort of things that the 610 00:25:33,720 --> 00:25:36,000 that the CPU can do but that don't 611 00:25:36,000 --> 00:25:38,220 really have any way of specifying them 612 00:25:38,220 --> 00:25:41,850 in C per se so anyway let's go ahead and 613 00:25:41,850 --> 00:25:43,470 get this working first with that but 614 00:25:43,470 --> 00:25:45,240 then what I think we might do is just go 615 00:25:45,240 --> 00:25:46,830 ahead and do that today so we can go 616 00:25:46,830 --> 00:25:49,130 ahead and do move this into the 617 00:25:49,130 --> 00:25:52,970 intrinsics and call the MSB C version 618 00:25:52,970 --> 00:25:55,320 and there we go and we can leave this 619 00:25:55,320 --> 00:25:57,030 you know sort of slow implementation as 620 00:25:57,030 --> 00:25:59,160 the reference implementation as well 621 00:25:59,160 --> 00:26:00,510 which will be nice because that would 622 00:26:00,510 --> 00:26:03,660 basically mean that you know we wouldn't 623 00:26:03,660 --> 00:26:06,240 have sort of a yeah we wouldn't have a 624 00:26:06,240 --> 00:26:09,120 problem if people wanted to compel on an 625 00:26:09,120 --> 00:26:10,830 architecture where the CPU can't do that 626 00:26:10,830 --> 00:26:13,230 and they just need a slow version of it 627 00:26:13,230 --> 00:26:14,880 to make it work that's good too because 628 00:26:14,880 --> 00:26:16,260 remember this isn't really time critical 629 00:26:16,260 --> 00:26:18,600 here so at least for this function it 630 00:26:18,600 --> 00:26:19,950 wouldn't matter if you could you could 631 00:26:19,950 --> 00:26:21,960 use the slowest possible thing and it 632 00:26:21,960 --> 00:26:24,210 wouldn't really matter right so the 633 00:26:24,210 --> 00:26:25,530 other thing too is I wonder if I should 634 00:26:25,530 --> 00:26:27,059 fix the API a little bit because I guess 635 00:26:27,059 --> 00:26:29,309 we can always wrap the intrinsic in our 636 00:26:29,309 --> 00:26:30,929 own in line that just kind of would get 637 00:26:30,929 --> 00:26:33,780 you know kind of felt out a little bit I 638 00:26:33,780 --> 00:26:34,980 could make it so you don't have to pass 639 00:26:34,980 --> 00:26:38,040 an address there basically so I could do 640 00:26:38,040 --> 00:26:40,590 something more like this which is like a 641 00:26:40,590 --> 00:26:43,170 bit scan result or something like that 642 00:26:43,170 --> 00:26:45,330 which is you know whether or not it was 643 00:26:45,330 --> 00:26:48,570 found and the new in 32 that was the 644 00:26:48,570 --> 00:26:50,700 index right something like this and then 645 00:26:50,700 --> 00:26:52,410 that could do something that looks more 646 00:26:52,410 --> 00:26:54,420 like that in line bit scan results so 647 00:26:54,420 --> 00:26:57,660 bit scan result and that would equal you 648 00:26:57,660 --> 00:26:59,720 know nothing at first 649 00:26:59,720 --> 00:27:02,190 having some typing problems today is 650 00:27:02,190 --> 00:27:04,620 true and so then when we actually go 651 00:27:04,620 --> 00:27:07,860 through we will then return the result 652 00:27:07,860 --> 00:27:13,350 here and we will do results that index 653 00:27:13,350 --> 00:27:17,400 equals tests and results ound equals 654 00:27:17,400 --> 00:27:19,170 true like that and break out and then 655 00:27:19,170 --> 00:27:20,520 we'll return the result that way and so 656 00:27:20,520 --> 00:27:23,190 that would be a little handier than them 657 00:27:23,190 --> 00:27:24,900 having to do sort of passing the address 658 00:27:24,900 --> 00:27:28,470 nonsense which doesn't seem particularly 659 00:27:28,470 --> 00:27:30,330 useful to me I don't I don't really 660 00:27:30,330 --> 00:27:31,559 think there's any reason to structure it 661 00:27:31,559 --> 00:27:32,880 like that I was just mirroring the way 662 00:27:32,880 --> 00:27:34,710 they were doing it any other one so now 663 00:27:34,710 --> 00:27:36,030 you can basically do something like this 664 00:27:36,030 --> 00:27:39,750 where we basically have these so we'll 665 00:27:39,750 --> 00:27:42,210 just get the bit scan results out of our 666 00:27:42,210 --> 00:27:44,940 mass values directly like that and we'll 667 00:27:44,940 --> 00:27:48,390 do the bit scan for words here and you 668 00:27:48,390 --> 00:27:49,710 know the other thing I might do since 669 00:27:49,710 --> 00:27:52,290 I'm kind of in charge now in Microsoft 670 00:27:52,290 --> 00:27:55,280 bit scan for words kind of a weird term 671 00:27:55,280 --> 00:28:02,179 maybe I would do something like find 672 00:28:02,179 --> 00:28:09,560 lowest find least significant one 673 00:28:09,560 --> 00:28:13,310 bit person least-significant set bit 674 00:28:13,310 --> 00:28:15,080 something like that right because that 675 00:28:15,080 --> 00:28:16,520 actually says what it is the bits came 676 00:28:16,520 --> 00:28:17,960 forward well what do you mean by forward 677 00:28:17,960 --> 00:28:19,790 at least now we know we're trying to 678 00:28:19,790 --> 00:28:22,310 find the least significant one that's 679 00:28:22,310 --> 00:28:24,830 set and so that actually seems maybe a 680 00:28:24,830 --> 00:28:26,570 little more saying to me I don't know I 681 00:28:26,570 --> 00:28:28,280 guess it would depend on endianness 682 00:28:28,280 --> 00:28:30,170 things and blah blah blah but I think 683 00:28:30,170 --> 00:28:31,150 that might be a little bit better 684 00:28:31,150 --> 00:28:33,500 because at least I understand what that 685 00:28:33,500 --> 00:28:35,360 is when I read it at least on one 686 00:28:35,360 --> 00:28:37,430 architecture it makes sense so that 687 00:28:37,430 --> 00:28:39,530 seems like priced a better idea so let's 688 00:28:39,530 --> 00:28:42,170 go ahead and do that will now get each 689 00:28:42,170 --> 00:28:47,330 of them out blue mask and alpha mask so 690 00:28:47,330 --> 00:28:49,700 now we have found those and now we just 691 00:28:49,700 --> 00:28:53,420 shift those by their indices like so 692 00:28:53,420 --> 00:28:58,850 index index index index and we can also 693 00:28:58,850 --> 00:29:02,810 do an assertion on each of them because 694 00:29:02,810 --> 00:29:05,270 basically we're not supporting loading 695 00:29:05,270 --> 00:29:06,800 anything that doesn't have all of these 696 00:29:06,800 --> 00:29:10,130 panels at the moment maybe in the future 697 00:29:10,130 --> 00:29:11,660 we would but for now we want at least 698 00:29:11,660 --> 00:29:13,100 ensure that we don't actually 699 00:29:13,100 --> 00:29:14,540 accidentally load something that doesn't 700 00:29:14,540 --> 00:29:16,640 have one of these channels so let's take 701 00:29:16,640 --> 00:29:18,140 a look at where that puts us on the 702 00:29:18,140 --> 00:29:21,140 scale of fixing our color problems hey 703 00:29:21,140 --> 00:29:23,600 it looks exactly right to me now the 704 00:29:23,600 --> 00:29:24,740 only thing that we're not handling now 705 00:29:24,740 --> 00:29:26,720 is of course the alpha blending around 706 00:29:26,720 --> 00:29:28,370 those the edges and on the background 707 00:29:28,370 --> 00:29:29,630 and that's the next thing we have to do 708 00:29:29,630 --> 00:29:31,610 anyway so that seems like a pretty good 709 00:29:31,610 --> 00:29:33,500 thing to do I'm gonna go ahead and say 710 00:29:33,500 --> 00:29:35,210 though that since we're we've got a fair 711 00:29:35,210 --> 00:29:36,410 bit of timer I'm just going to go ahead 712 00:29:36,410 --> 00:29:38,570 and give the intrinsic thing a shot just 713 00:29:38,570 --> 00:29:40,100 because it's about time that we started 714 00:29:40,100 --> 00:29:41,750 talking about those sorts of things we 715 00:29:41,750 --> 00:29:43,190 don't have to do very much it's not very 716 00:29:43,190 --> 00:29:44,630 complicated it's a very simple thing to 717 00:29:44,630 --> 00:29:45,860 do so it might be a good one to start 718 00:29:45,860 --> 00:29:47,960 with so basically what I want to do in 719 00:29:47,960 --> 00:29:49,550 here is I want to move this bit scan 720 00:29:49,550 --> 00:29:52,460 result I want to move this out and I 721 00:29:52,460 --> 00:29:54,530 want to move it to here right and so 722 00:29:54,530 --> 00:29:55,970 what I want to do is be able to have 723 00:29:55,970 --> 00:29:59,990 this dysfunction such that if we are on 724 00:29:59,990 --> 00:30:02,570 a compiler that can do it really quickly 725 00:30:02,570 --> 00:30:06,140 it will do it and and not have to go 726 00:30:06,140 --> 00:30:08,000 through this for loop it'll instead just 727 00:30:08,000 --> 00:30:11,750 tell the processor to basically tell the 728 00:30:11,750 --> 00:30:14,390 processor to do it you know in a much 729 00:30:14,390 --> 00:30:16,280 more expedient way if that makes sense 730 00:30:16,280 --> 00:30:18,740 so really what I need to do here is I 731 00:30:18,740 --> 00:30:20,300 need to be able to figure out whether or 732 00:30:20,300 --> 00:30:22,820 not you know basically whether I'm on it 733 00:30:22,820 --> 00:30:23,570 welcome 734 00:30:23,570 --> 00:30:26,950 however I'm alone if that makes sense 735 00:30:26,950 --> 00:30:31,070 and as you know as I said I talked about 736 00:30:31,070 --> 00:30:34,850 quite a bit at the beginning you want to 737 00:30:34,850 --> 00:30:36,590 keep all of your stuff segregated as 738 00:30:36,590 --> 00:30:40,130 much as possible in terms of keeping 739 00:30:40,130 --> 00:30:41,770 platform code out of 740 00:30:41,770 --> 00:30:44,210 platform-independent code right so 741 00:30:44,210 --> 00:30:45,560 you'll notice that we buried everything 742 00:30:45,560 --> 00:30:47,720 inside win32 handmade and you'll notice 743 00:30:47,720 --> 00:30:50,210 none of this stuff leaks out into our 744 00:30:50,210 --> 00:30:52,370 main code all the win32 specific code is 745 00:30:52,370 --> 00:30:55,910 all in here right but there are limits 746 00:30:55,910 --> 00:30:57,860 to what we can do there if we don't want 747 00:30:57,860 --> 00:30:59,180 to sacrifice performance like what I 748 00:30:59,180 --> 00:31:01,400 could do here right is I could call a 749 00:31:01,400 --> 00:31:04,070 function back in the platform layer that 750 00:31:04,070 --> 00:31:06,440 did this operation right and that would 751 00:31:06,440 --> 00:31:07,940 keep it and I could even pass in a 752 00:31:07,940 --> 00:31:09,200 pointer to that function so it was 753 00:31:09,200 --> 00:31:10,940 completely isolated I could do all kinds 754 00:31:10,940 --> 00:31:12,800 of stuff but the problem is the only 755 00:31:12,800 --> 00:31:15,170 reason why you ever care about intrinsic 756 00:31:15,170 --> 00:31:17,210 sin the first place is for a performance 757 00:31:17,210 --> 00:31:18,560 if we didn't care about performance we 758 00:31:18,560 --> 00:31:21,650 just run this for loop right so the 759 00:31:21,650 --> 00:31:23,840 intrinsics file the whole point of this 760 00:31:23,840 --> 00:31:25,910 intrinsics file is going to be the this 761 00:31:25,910 --> 00:31:28,880 is the place where we make a compromise 762 00:31:28,880 --> 00:31:31,760 and say that this is the place where we 763 00:31:31,760 --> 00:31:34,150 allowed to do platform specific stuff 764 00:31:34,150 --> 00:31:37,940 that can be directly included right into 765 00:31:37,940 --> 00:31:41,090 the code of platform nonspecific stuff 766 00:31:41,090 --> 00:31:43,550 if that makes sense and again the only 767 00:31:43,550 --> 00:31:44,630 reason we're doing that is for 768 00:31:44,630 --> 00:31:45,860 performance if we didn't care about 769 00:31:45,860 --> 00:31:47,120 performance at all if we literally just 770 00:31:47,120 --> 00:31:49,010 had no performance concerns then there 771 00:31:49,010 --> 00:31:50,330 would be no reason to do this there'd be 772 00:31:50,330 --> 00:31:52,010 no point you would just always do things 773 00:31:52,010 --> 00:31:54,560 the way we had been doing them but in 774 00:31:54,560 --> 00:31:56,060 the case of intrinsics which are which 775 00:31:56,060 --> 00:31:57,440 you're only using really when you're 776 00:31:57,440 --> 00:31:58,520 caring about performance in the first 777 00:31:58,520 --> 00:32:01,430 place this is where that sort of stuff 778 00:32:01,430 --> 00:32:03,560 that comes in and so what you want to do 779 00:32:03,560 --> 00:32:05,630 is you basically want to have it 780 00:32:05,630 --> 00:32:08,180 isolated again you know even though it's 781 00:32:08,180 --> 00:32:10,250 you're sort of saying it's okay to mix 782 00:32:10,250 --> 00:32:11,750 things up a little bit here you still 783 00:32:11,750 --> 00:32:14,120 want it as isolated as possible and so 784 00:32:14,120 --> 00:32:15,710 you want to basically boil it down to 785 00:32:15,710 --> 00:32:18,530 like a file or two that have compiler 786 00:32:18,530 --> 00:32:21,290 switches in them and that bring in that 787 00:32:21,290 --> 00:32:24,080 sort of non independent parts of the 788 00:32:24,080 --> 00:32:27,080 code right so that's basically what 789 00:32:27,080 --> 00:32:29,300 we're going to do here so what we're 790 00:32:29,300 --> 00:32:31,460 going to do is basically say you know if 791 00:32:31,460 --> 00:32:33,020 the compiler is msec 792 00:32:33,020 --> 00:32:35,780 right then we know that we can issue 793 00:32:35,780 --> 00:32:36,860 this thing because this 794 00:32:36,860 --> 00:32:38,870 compiler happens to support this bits 795 00:32:38,870 --> 00:32:41,480 can forward thing right and we want to 796 00:32:41,480 --> 00:32:45,020 do from lowes LSB to MSB so we're 797 00:32:45,020 --> 00:32:46,820 basically going to call this one we know 798 00:32:46,820 --> 00:32:47,960 that in this case we're scanning a 799 00:32:47,960 --> 00:32:49,760 32-bit value so basically what we're 800 00:32:49,760 --> 00:32:53,630 gonna do here is we're going to to call 801 00:32:53,630 --> 00:32:55,640 this bits can forward the result found 802 00:32:55,640 --> 00:32:57,140 is going to be equal to that return 803 00:32:57,140 --> 00:32:59,540 value we're going to pass the address of 804 00:32:59,540 --> 00:33:01,250 the index that we wanted to be set and 805 00:33:01,250 --> 00:33:02,809 it'll set it and then we're gonna pass 806 00:33:02,809 --> 00:33:04,549 that value and so that's just gonna 807 00:33:04,549 --> 00:33:06,200 allow it to do it right there we're 808 00:33:06,200 --> 00:33:07,970 gonna make sure this is smart to in line 809 00:33:07,970 --> 00:33:09,679 so hopefully if the compiler isn't dumb 810 00:33:09,679 --> 00:33:12,620 it will go ahead and say oh yes we can 811 00:33:12,620 --> 00:33:14,570 go ahead and in line this directly and 812 00:33:14,570 --> 00:33:18,850 turn this into a instruction right so 813 00:33:18,850 --> 00:33:21,049 that's about all we have to do there but 814 00:33:21,049 --> 00:33:22,190 we have to do this compiler of 815 00:33:22,190 --> 00:33:24,470 determination and so I'm gonna go back 816 00:33:24,470 --> 00:33:26,720 to our handmade believe it's have a 817 00:33:26,720 --> 00:33:29,030 platform right yeah in handmade platform 818 00:33:29,030 --> 00:33:31,070 what I'm going to introduce at the top 819 00:33:31,070 --> 00:33:32,540 kind of like you know we have this sort 820 00:33:32,540 --> 00:33:34,400 of basic this is like the basic setup 821 00:33:34,400 --> 00:33:36,169 for the the code this is what has to 822 00:33:36,169 --> 00:33:37,700 happen in the code I'm going to do a 823 00:33:37,700 --> 00:33:39,290 little thing here which basically says 824 00:33:39,290 --> 00:33:43,549 you know compiler m SVC is zero and 825 00:33:43,549 --> 00:33:47,179 maybe compiler LLVM because i know those 826 00:33:47,179 --> 00:33:48,860 are the two things at least that way 827 00:33:48,860 --> 00:33:51,799 we'll compile under right and what we 828 00:33:51,799 --> 00:33:54,020 will do is we'll sort of do an if here 829 00:33:54,020 --> 00:33:58,220 on some kind of thing basically if you 830 00:33:58,220 --> 00:34:02,390 know if not compiler m SVC I should do 831 00:34:02,390 --> 00:34:06,140 this way if n dev compiler MSD C and if 832 00:34:06,140 --> 00:34:12,830 and if and F LLVM this you know I could 833 00:34:12,830 --> 00:34:14,210 write these out a little bit more 834 00:34:14,210 --> 00:34:15,440 cleanly so you can kind of see what 835 00:34:15,440 --> 00:34:16,970 they're doing it's a short if end death 836 00:34:16,970 --> 00:34:20,720 is like a shorthand do you find that so 837 00:34:20,720 --> 00:34:22,639 what I'm going to do is if the compiler 838 00:34:22,639 --> 00:34:24,980 variables and maybe I'll even make a 839 00:34:24,980 --> 00:34:28,669 little section here like this and this 840 00:34:28,669 --> 00:34:34,609 can be you know note AC pipes like this 841 00:34:34,609 --> 00:34:37,369 Thank You Emacs for indenting me it's 842 00:34:37,369 --> 00:34:39,800 finding the C++ bracket they're doing 843 00:34:39,800 --> 00:34:41,149 the indentation but I didn't actually 844 00:34:41,149 --> 00:34:44,379 want to do what are you gonna do 845 00:34:44,379 --> 00:34:47,210 compilers so basically what I want to do 846 00:34:47,210 --> 00:34:50,330 here is I want to basically say okay 847 00:34:50,330 --> 00:34:53,720 if the build system whoever is building 848 00:34:53,720 --> 00:34:56,120 us our batch file whatever if they want 849 00:34:56,120 --> 00:34:57,770 to explicitly set what the compiler is 850 00:34:57,770 --> 00:34:59,630 then we'll just let them set it so 851 00:34:59,630 --> 00:35:01,850 basically we're only going to set these 852 00:35:01,850 --> 00:35:04,970 if they're not already set then so we're 853 00:35:04,970 --> 00:35:06,170 gonna and we're going to clear them to 854 00:35:06,170 --> 00:35:08,390 zero or actually I guess what we could 855 00:35:08,390 --> 00:35:10,660 do is if they're not already set right 856 00:35:10,660 --> 00:35:13,610 then what we do is at the end here no I 857 00:35:13,610 --> 00:35:15,710 still need to do this so we need to do 858 00:35:15,710 --> 00:35:19,550 something like if the if the compiler is 859 00:35:19,550 --> 00:35:21,770 not set at all right if we have no 860 00:35:21,770 --> 00:35:23,840 compiler set whatsoever right this sort 861 00:35:23,840 --> 00:35:27,680 of thing then inside here is where I'm 862 00:35:27,680 --> 00:35:30,200 going to actually try to determine what 863 00:35:30,200 --> 00:35:32,240 the compiler actually is so if neither 864 00:35:32,240 --> 00:35:33,650 the compiler things have been set by 865 00:35:33,650 --> 00:35:35,630 anyone then I'm going to go ahead and 866 00:35:35,630 --> 00:35:37,280 try to see what the compiler actually is 867 00:35:37,280 --> 00:35:39,980 and MSV see for example will 868 00:35:39,980 --> 00:35:42,440 automatically define something that 869 00:35:42,440 --> 00:35:44,180 tells us what it is I don't remember 870 00:35:44,180 --> 00:35:46,280 it's like MS Sivir I mean I think it's 871 00:35:46,280 --> 00:35:49,880 it's something like that but I want to 872 00:35:49,880 --> 00:35:52,010 actually go see what it actually is 873 00:35:52,010 --> 00:35:54,730 before I make that clock Proclamation 874 00:35:54,730 --> 00:35:57,230 underscore I'm a sefer yeah almost 875 00:35:57,230 --> 00:36:00,560 underscore MS Sivir so basically I want 876 00:36:00,560 --> 00:36:02,300 to do that and say if that's true then 877 00:36:02,300 --> 00:36:06,200 compiler MSB c equals one right and then 878 00:36:06,200 --> 00:36:08,900 what we'll also do is we'll do an else 879 00:36:08,900 --> 00:36:12,050 here and in this case we'll just assume 880 00:36:12,050 --> 00:36:14,930 it's LLVM for now but we'll put it to do 881 00:36:14,930 --> 00:36:16,700 here which is basically like more 882 00:36:16,700 --> 00:36:21,230 compilers or something right maybe even 883 00:36:21,230 --> 00:36:24,590 like that and so eventually we'll do 884 00:36:24,590 --> 00:36:26,630 something a little smarter than that as 885 00:36:26,630 --> 00:36:28,130 we go but right now we're only compiling 886 00:36:28,130 --> 00:36:31,940 nm SVC so you know for now that should 887 00:36:31,940 --> 00:36:33,560 be good enough so when we actually do 888 00:36:33,560 --> 00:36:35,240 that let's take a look at what happens 889 00:36:35,240 --> 00:36:37,250 here oh right we have to undefined 890 00:36:37,250 --> 00:36:39,020 compiler it because we define it to zero 891 00:36:39,020 --> 00:36:40,160 and you can't just change it 892 00:36:40,160 --> 00:36:42,110 unfortunately you got a undef it first 893 00:36:42,110 --> 00:36:46,520 like so and then when I got one one 894 00:36:46,520 --> 00:36:48,110 missing Kendra so then there's a end if 895 00:36:48,110 --> 00:36:51,680 there alright so now it's coming that 896 00:36:51,680 --> 00:36:54,560 bits can forward is not defined and that 897 00:36:54,560 --> 00:36:58,390 may be true let's see what has to be 898 00:36:58,390 --> 00:37:01,190 defined in order for that to exist 899 00:37:01,190 --> 00:37:05,299 somewhere let's 900 00:37:05,299 --> 00:37:06,950 well it looks like we just need to do 901 00:37:06,950 --> 00:37:08,480 that or do we actually have to pound 902 00:37:08,480 --> 00:37:10,609 include in trindade I'm not actually 903 00:37:10,609 --> 00:37:13,279 sure if we need to do that or not we 904 00:37:13,279 --> 00:37:16,519 could take a look I guess the first 905 00:37:16,519 --> 00:37:19,489 thing we could do is try this first and 906 00:37:19,489 --> 00:37:22,660 see what it does so if we're defining 907 00:37:22,660 --> 00:37:26,779 MSB see we can basically now have our 908 00:37:26,779 --> 00:37:29,299 little section where we do the things 909 00:37:29,299 --> 00:37:32,720 that we want to do if ms DC is here such 910 00:37:32,720 --> 00:37:35,509 as that pragma in terms of function not 911 00:37:35,509 --> 00:37:37,279 declared so okay so I guess we have to 912 00:37:37,279 --> 00:37:40,249 do include this file as well which is 913 00:37:40,249 --> 00:37:43,609 the intrinsics and then we'll see okay 914 00:37:43,609 --> 00:37:46,430 bits can forward cannot convert argument 915 00:37:46,430 --> 00:37:48,499 one from you at 32 start to unsigned 916 00:37:48,499 --> 00:37:55,269 long star why not types pointing to or 917 00:37:55,269 --> 00:37:58,880 unrelated is that really true why would 918 00:37:58,880 --> 00:38:01,720 those be unrelated 919 00:38:01,720 --> 00:38:04,579 I guess unsigned in and unsigned long or 920 00:38:04,579 --> 00:38:09,589 technically different types oh the 921 00:38:09,589 --> 00:38:11,630 mystery is of C++ I can program it for 922 00:38:11,630 --> 00:38:14,269 so long and yet things like that always 923 00:38:14,269 --> 00:38:15,829 still confused very much what actually 924 00:38:15,829 --> 00:38:17,150 do you believe the technical difference 925 00:38:17,150 --> 00:38:19,940 to be between those types and I have 926 00:38:19,940 --> 00:38:20,749 absolutely no idea 927 00:38:20,749 --> 00:38:22,910 oops put that in the wrong place there 928 00:38:22,910 --> 00:38:25,279 we go so I believe that should probably 929 00:38:25,279 --> 00:38:27,410 work let's find out and see if it does 930 00:38:27,410 --> 00:38:30,019 and hey guess what it does and now let's 931 00:38:30,019 --> 00:38:31,849 take a look in there and see what it 932 00:38:31,849 --> 00:38:33,499 actually did differently now when we 933 00:38:33,499 --> 00:38:35,690 step into it so if we step in here you 934 00:38:35,690 --> 00:38:37,369 can see that this is actually using this 935 00:38:37,369 --> 00:38:40,190 this line that we talked about and if we 936 00:38:40,190 --> 00:38:41,930 go to the disassembly we can take a look 937 00:38:41,930 --> 00:38:44,839 at what it does so essentially what 938 00:38:44,839 --> 00:38:47,450 happens here is do you see this BSF 939 00:38:47,450 --> 00:38:49,730 that's bit scan forward it's literally 940 00:38:49,730 --> 00:38:52,430 one assembly language instruction that 941 00:38:52,430 --> 00:38:54,589 does all the work of that for loop now 942 00:38:54,589 --> 00:38:55,640 don't let that fool you because the 943 00:38:55,640 --> 00:38:56,809 assembly language terms can still take a 944 00:38:56,809 --> 00:38:59,089 while to execute sometimes but the point 945 00:38:59,089 --> 00:39:01,190 here is basically that like that is so 946 00:39:01,190 --> 00:39:03,319 much more concise certainly to the 947 00:39:03,319 --> 00:39:05,390 processor and it's probably going to be 948 00:39:05,390 --> 00:39:06,890 much faster than if we were to actually 949 00:39:06,890 --> 00:39:08,749 have to micro to code the loop ourselves 950 00:39:08,749 --> 00:39:10,430 because if this is executing something 951 00:39:10,430 --> 00:39:11,539 in micro code that's still gonna be a 952 00:39:11,539 --> 00:39:13,400 lot faster right so basically what 953 00:39:13,400 --> 00:39:15,319 happens here in fact you can even watch 954 00:39:15,319 --> 00:39:16,400 it work 955 00:39:16,400 --> 00:39:17,870 what its gonna do here is going to move 956 00:39:17,870 --> 00:39:19,550 the value this this thing right here 957 00:39:19,550 --> 00:39:21,620 it's going to load that value into the 958 00:39:21,620 --> 00:39:23,720 EAX register right and that's this 959 00:39:23,720 --> 00:39:25,040 register right here it's a little 960 00:39:25,040 --> 00:39:27,200 confusing because we're in x64 mode 961 00:39:27,200 --> 00:39:28,910 which means that it uses our ax to 962 00:39:28,910 --> 00:39:30,650 denote the ax register because it's 64 963 00:39:30,650 --> 00:39:32,180 bits long but really what we're talking 964 00:39:32,180 --> 00:39:33,650 about is we're talking about the bottom 965 00:39:33,650 --> 00:39:34,850 portion of it here right we're talking 966 00:39:34,850 --> 00:39:38,150 about the bottom 32 bit value so when we 967 00:39:38,150 --> 00:39:39,440 do that you see how it loaded it in 968 00:39:39,440 --> 00:39:41,000 there there it is it just loaded it 969 00:39:41,000 --> 00:39:42,830 right there and now it's going to call 970 00:39:42,830 --> 00:39:46,040 that BS F function on the value in the 971 00:39:46,040 --> 00:39:47,960 register to load it out right it goes 972 00:39:47,960 --> 00:39:49,430 ahead and does that and the destination 973 00:39:49,430 --> 00:39:51,290 is also e ax so it's going to write the 974 00:39:51,290 --> 00:39:53,360 result back in there right and you can 975 00:39:53,360 --> 00:39:54,800 see that it written wrote the result 976 00:39:54,800 --> 00:39:56,780 back in there and that's the result that 977 00:39:56,780 --> 00:39:58,280 we were expecting right that's what we 978 00:39:58,280 --> 00:39:59,660 wanted to actually have again it's in 979 00:39:59,660 --> 00:40:01,670 hexadecimal which is why it looks like 980 00:40:01,670 --> 00:40:04,970 an 18 instead of a 24 but you know 981 00:40:04,970 --> 00:40:07,340 that's that's just well you know I can I 982 00:40:07,340 --> 00:40:08,330 can here you go 983 00:40:08,330 --> 00:40:11,060 so Oh X 18 right you can see that that's 984 00:40:11,060 --> 00:40:13,370 just the hexadecimal encoding for 24 so 985 00:40:13,370 --> 00:40:16,040 there it is and then that is the 986 00:40:16,040 --> 00:40:18,080 entirety that right there did like the 987 00:40:18,080 --> 00:40:20,720 entirety of that this loop right so 988 00:40:20,720 --> 00:40:22,160 that's intrinsics in a nutshell they're 989 00:40:22,160 --> 00:40:23,570 really pretty simple and basically what 990 00:40:23,570 --> 00:40:25,460 we want to do is we want to do those for 991 00:40:25,460 --> 00:40:26,870 anything where there is a convenience 992 00:40:26,870 --> 00:40:28,220 CPU instructions so that we can access 993 00:40:28,220 --> 00:40:29,480 it because we don't want to go around 994 00:40:29,480 --> 00:40:30,620 especially when we start getting more 995 00:40:30,620 --> 00:40:32,510 time critical code we don't want to go 996 00:40:32,510 --> 00:40:34,520 around wasting a lot of that stuff that 997 00:40:34,520 --> 00:40:37,670 the processor could do for us by Optus 998 00:40:37,670 --> 00:40:38,840 getting it now it's possible that the 999 00:40:38,840 --> 00:40:40,580 compiler might have actually been smart 1000 00:40:40,580 --> 00:40:41,690 enough sometimes depending on the 1001 00:40:41,690 --> 00:40:43,700 compiler to actually realize that this 1002 00:40:43,700 --> 00:40:46,430 is a bit scam forward but why make it do 1003 00:40:46,430 --> 00:40:48,200 that when we could just go ahead and say 1004 00:40:48,200 --> 00:40:50,360 this is f what we want right and so now 1005 00:40:50,360 --> 00:40:52,010 we've done that and we're in good shape 1006 00:40:52,010 --> 00:40:54,110 so now we're loading our stuff and we're 1007 00:40:54,110 --> 00:40:56,090 pretty happy but if you actually take a 1008 00:40:56,090 --> 00:40:57,890 look at what happens here you'll notice 1009 00:40:57,890 --> 00:40:59,330 that we would like to be able to 1010 00:40:59,330 --> 00:41:01,610 composite this guy on top of things and 1011 00:41:01,610 --> 00:41:02,840 right now we're not actually doing that 1012 00:41:02,840 --> 00:41:05,420 and so that brings up use of the Alpha 1013 00:41:05,420 --> 00:41:07,010 channel which we should talk about now 1014 00:41:07,010 --> 00:41:08,570 it's actually very very easy for us to 1015 00:41:08,570 --> 00:41:14,480 make this work but you know well you 1016 00:41:14,480 --> 00:41:16,130 know what I'll do first I'll basically 1017 00:41:16,130 --> 00:41:18,620 show you the really simple version first 1018 00:41:18,620 --> 00:41:19,730 and then we'll talk about it a little 1019 00:41:19,730 --> 00:41:22,190 bit so as you know the Alpha Channel 1020 00:41:22,190 --> 00:41:24,530 right if you remember how this is how 1021 00:41:24,530 --> 00:41:27,740 this works in the actual art tool let me 1022 00:41:27,740 --> 00:41:28,829 see if I can actually 1023 00:41:28,829 --> 00:41:29,880 how would I do this I'll go to a 1024 00:41:29,880 --> 00:41:33,390 hand-made data test and I will load up 1025 00:41:33,390 --> 00:41:37,229 that hero front head there we go edit 1026 00:41:37,229 --> 00:41:44,099 with GIMP so if we look at this here you 1027 00:41:44,099 --> 00:41:47,819 can see that basically you've got your 1028 00:41:47,819 --> 00:41:49,289 red green and blue color channels but 1029 00:41:49,289 --> 00:41:50,880 you also have a fourth channel and that 1030 00:41:50,880 --> 00:41:52,410 channel is called the Alpha Channel now 1031 00:41:52,410 --> 00:41:54,599 most people probably sort of you know 1032 00:41:54,599 --> 00:41:56,099 even if you don't know exactly what that 1033 00:41:56,099 --> 00:41:56,400 is 1034 00:41:56,400 --> 00:41:58,259 you know intuitively now what it is 1035 00:41:58,259 --> 00:41:59,940 because you've probably seen it in paint 1036 00:41:59,940 --> 00:42:01,170 programs like you've probably worked 1037 00:42:01,170 --> 00:42:03,900 with it before right and so if we take a 1038 00:42:03,900 --> 00:42:06,569 look at the channels dialog let's take a 1039 00:42:06,569 --> 00:42:09,930 look here inside GIMP there's a channels 1040 00:42:09,930 --> 00:42:12,180 dialog right which is this you can 1041 00:42:12,180 --> 00:42:14,640 actually see I can turn off the channels 1042 00:42:14,640 --> 00:42:16,589 and we can actually see the Alpha 1043 00:42:16,589 --> 00:42:18,450 Channel by itself right instead of the 1044 00:42:18,450 --> 00:42:20,880 other channels which is basically all 1045 00:42:20,880 --> 00:42:23,069 the Alpha channel is is it's basically 1046 00:42:23,069 --> 00:42:25,019 just something that says where the image 1047 00:42:25,019 --> 00:42:26,819 exists and where it doesn't 1048 00:42:26,819 --> 00:42:29,309 and it's got partial values around the 1049 00:42:29,309 --> 00:42:31,650 edges that basically say well the it was 1050 00:42:31,650 --> 00:42:33,509 transitioning at this point right it was 1051 00:42:33,509 --> 00:42:35,339 transitioning its anti-aliasing that 1052 00:42:35,339 --> 00:42:37,019 edge basically right it's giving a 1053 00:42:37,019 --> 00:42:39,239 partial value because the shape 1054 00:42:39,239 --> 00:42:42,209 obviously can't be rep is not perfectly 1055 00:42:42,209 --> 00:42:44,130 pixelated the shape was actually 1056 00:42:44,130 --> 00:42:45,539 supposed to be a smooth line that went 1057 00:42:45,539 --> 00:42:47,249 through there and so these alpha values 1058 00:42:47,249 --> 00:42:48,660 are basically there to kind of smooth 1059 00:42:48,660 --> 00:42:51,059 that out and to sort of give you that 1060 00:42:51,059 --> 00:42:52,680 gradual fall off so it's not a hard 1061 00:42:52,680 --> 00:42:54,359 cookie cutter edge right it just kind of 1062 00:42:54,359 --> 00:42:55,650 feathers the things into the background 1063 00:42:55,650 --> 00:42:57,390 for you that's the way the art was set 1064 00:42:57,390 --> 00:42:59,549 up to work so right now we're drawing 1065 00:42:59,549 --> 00:43:00,839 those red green and blue channels but 1066 00:43:00,839 --> 00:43:02,339 we're not doing anything with the Alpha 1067 00:43:02,339 --> 00:43:03,869 Channel and obviously since the Alpha 1068 00:43:03,869 --> 00:43:05,190 Channel is the only thing that tells us 1069 00:43:05,190 --> 00:43:07,349 where the image exists we need to start 1070 00:43:07,349 --> 00:43:08,579 doing something with the Alpha Channel 1071 00:43:08,579 --> 00:43:11,999 to display the person such that display 1072 00:43:11,999 --> 00:43:13,650 things on top of other things so that 1073 00:43:13,650 --> 00:43:16,619 like bottom layers show through upper 1074 00:43:16,619 --> 00:43:19,739 layers right and so inside our renderer 1075 00:43:19,739 --> 00:43:22,259 this is going to work well yeah I won't 1076 00:43:22,259 --> 00:43:23,430 say how it's going to work in the 1077 00:43:23,430 --> 00:43:24,630 renderer necessarily that's that's a 1078 00:43:24,630 --> 00:43:30,150 little premature so let's not say that 1079 00:43:30,150 --> 00:43:33,749 word let's say a different word what I'm 1080 00:43:33,749 --> 00:43:35,160 actually going to say it's not that what 1081 00:43:35,160 --> 00:43:38,489 I'm going to say is let's talk about one 1082 00:43:38,489 --> 00:43:42,390 way we could easily implement this 1083 00:43:42,390 --> 00:43:46,410 for our testing purposes for our testing 1084 00:43:46,410 --> 00:43:48,360 purposes what we can do is basically do 1085 00:43:48,360 --> 00:43:50,760 exactly what Photoshop or anything else 1086 00:43:50,760 --> 00:43:52,650 does where we basically just think about 1087 00:43:52,650 --> 00:43:54,450 things in terms of layers we could draw 1088 00:43:54,450 --> 00:43:57,270 something first we could draw down you 1089 00:43:57,270 --> 00:43:58,890 know our trees or whatever in the 1090 00:43:58,890 --> 00:44:00,810 background right and then we want to 1091 00:44:00,810 --> 00:44:03,510 stick a guy on top of that what we would 1092 00:44:03,510 --> 00:44:05,550 do is we'd essentially think of creating 1093 00:44:05,550 --> 00:44:07,260 a separate layer right which has our guy 1094 00:44:07,260 --> 00:44:09,930 on it and basically what we'll do is 1095 00:44:09,930 --> 00:44:13,170 when we draw that layer will only draw 1096 00:44:13,170 --> 00:44:15,000 in the places where the Alpha Channel 1097 00:44:15,000 --> 00:44:16,590 says there was actually a shape and we 1098 00:44:16,590 --> 00:44:18,600 won't touch what's underneath in the 1099 00:44:18,600 --> 00:44:20,430 places where it's not so well basically 1100 00:44:20,430 --> 00:44:22,260 do compositing very much the way you 1101 00:44:22,260 --> 00:44:23,490 would think about it in Photoshop where 1102 00:44:23,490 --> 00:44:24,900 you have one layer and you're basically 1103 00:44:24,900 --> 00:44:27,630 drawing layers on top of each other and 1104 00:44:27,630 --> 00:44:30,180 you just don't draw where the Alpha 1105 00:44:30,180 --> 00:44:31,590 Channel says there isn't anything and 1106 00:44:31,590 --> 00:44:32,700 that gives you this ER through so 1107 00:44:32,700 --> 00:44:34,500 basically like it's like taking pieces 1108 00:44:34,500 --> 00:44:36,690 of paper cutouts and stacking them on 1109 00:44:36,690 --> 00:44:38,970 top of each other wherever it was cut 1110 00:44:38,970 --> 00:44:40,350 out you could still see through to the 1111 00:44:40,350 --> 00:44:43,560 thing that was underneath right so that 1112 00:44:43,560 --> 00:44:45,150 alpha layer at the Alpha channel is 1113 00:44:45,150 --> 00:44:46,350 basically telling us where to do the 1114 00:44:46,350 --> 00:44:48,150 cutout it's basically what tells us how 1115 00:44:48,150 --> 00:44:50,280 to do the cutout so how do we actually 1116 00:44:50,280 --> 00:44:52,830 implement that right well while we are 1117 00:44:52,830 --> 00:44:54,360 drawing right we basically have 1118 00:44:54,360 --> 00:44:56,280 something you know we've got our trees 1119 00:44:56,280 --> 00:44:58,290 you know they're there and then we've 1120 00:44:58,290 --> 00:45:00,690 got our guy and he's got the Alpha 1121 00:45:00,690 --> 00:45:02,550 channel on and says where things exist 1122 00:45:02,550 --> 00:45:05,100 and basically it's zero everywhere where 1123 00:45:05,100 --> 00:45:07,560 he does not exist it's 255 everywhere 1124 00:45:07,560 --> 00:45:09,810 that he does and at the edges it's 1125 00:45:09,810 --> 00:45:12,050 somewhere between those two values right 1126 00:45:12,050 --> 00:45:14,430 so it's basically a brightness value you 1127 00:45:14,430 --> 00:45:16,380 might think of it between 0 and 25 that 1128 00:45:16,380 --> 00:45:19,020 says what you know how much he exists at 1129 00:45:19,020 --> 00:45:21,180 that particular point so what we would 1130 00:45:21,180 --> 00:45:23,130 like to do right is we'd like to think 1131 00:45:23,130 --> 00:45:25,590 about that essentially for now as an 1132 00:45:25,590 --> 00:45:28,200 opacity value basically to say how much 1133 00:45:28,200 --> 00:45:30,030 of a guy blends through and by the way 1134 00:45:30,030 --> 00:45:31,500 we could use this alpha channel as well 1135 00:45:31,500 --> 00:45:33,810 for partial transparency like if we have 1136 00:45:33,810 --> 00:45:35,010 something that's supposed to be sort of 1137 00:45:35,010 --> 00:45:36,990 ghost-like that we want to sort of only 1138 00:45:36,990 --> 00:45:38,400 partially blend on just like in 1139 00:45:38,400 --> 00:45:39,960 Photoshop how you could paint the Alpha 1140 00:45:39,960 --> 00:45:42,780 Channel to be some middle value like 128 1141 00:45:42,780 --> 00:45:44,130 or something that's partially 1142 00:45:44,130 --> 00:45:46,500 translucent we might want to do that too 1143 00:45:46,500 --> 00:45:48,090 so what we'd like to do is use this 1144 00:45:48,090 --> 00:45:50,910 value essentially as a way of blending 1145 00:45:50,910 --> 00:45:55,170 in between the two right so I don't want 1146 00:45:55,170 --> 00:45:56,220 to talk about that 1147 00:45:56,220 --> 00:45:57,540 yet because let's just do the simplest 1148 00:45:57,540 --> 00:45:59,280 possible thing let's do something that 1149 00:45:59,280 --> 00:46:00,630 just for starters 1150 00:46:00,630 --> 00:46:05,220 uses zero or 255 or sort of rather on or 1151 00:46:05,220 --> 00:46:07,349 off so we'll basically say if it's zero 1152 00:46:07,349 --> 00:46:09,930 we won't draw anything and if it's 255 1153 00:46:09,930 --> 00:46:12,660 or sorry if it's anything from 1 to 255 1154 00:46:12,660 --> 00:46:15,090 anything in between we will I guess 1155 00:46:15,090 --> 00:46:16,650 another thing we could do is say 128 is 1156 00:46:16,650 --> 00:46:18,180 the cutoff so basically anything less 1157 00:46:18,180 --> 00:46:19,770 than 128 we won't draw anything greater 1158 00:46:19,770 --> 00:46:22,290 than 128 we will draw right you can 1159 00:46:22,290 --> 00:46:23,340 pretty much see how we could do that 1160 00:46:23,340 --> 00:46:24,690 very simply right because we're 1161 00:46:24,690 --> 00:46:26,550 iterating over all the pixels of the guy 1162 00:46:26,550 --> 00:46:29,490 in our drawbitmap regime right we we 1163 00:46:29,490 --> 00:46:31,740 iterate over all the values here to do 1164 00:46:31,740 --> 00:46:33,750 this dest plus plus equal source plus of 1165 00:46:33,750 --> 00:46:36,300 us right so what we could do instead is 1166 00:46:36,300 --> 00:46:38,849 we could go ahead and change the way 1167 00:46:38,849 --> 00:46:40,680 this works we could do both we could 1168 00:46:40,680 --> 00:46:43,560 always do both advances right and we can 1169 00:46:43,560 --> 00:46:45,900 isolate just the copy like that and what 1170 00:46:45,900 --> 00:46:48,540 we could say is if that source value the 1171 00:46:48,540 --> 00:46:50,550 source part that's coming in extract the 1172 00:46:50,550 --> 00:46:52,320 alpha right we shift it down by 24 to 1173 00:46:52,320 --> 00:46:54,630 get just the alpha by itself if that 1174 00:46:54,630 --> 00:46:57,359 value is greater than 128 then we do the 1175 00:46:57,359 --> 00:47:01,760 copy otherwise we don't make sense right 1176 00:47:01,760 --> 00:47:06,359 so if we did that and we ran it we now 1177 00:47:06,359 --> 00:47:08,190 get much more of what we would expect to 1178 00:47:08,190 --> 00:47:11,070 get right we now get something which 1179 00:47:11,070 --> 00:47:14,640 doesn't draw the guy everywhere where he 1180 00:47:14,640 --> 00:47:17,490 had an alpha value less than 128 and it 1181 00:47:17,490 --> 00:47:18,869 does draw the guy everywhere there's a 1182 00:47:18,869 --> 00:47:20,820 value over 128 and all we did was just 1183 00:47:20,820 --> 00:47:22,380 add that one simple test right that's 1184 00:47:22,380 --> 00:47:24,480 all we were doing now what you'll notice 1185 00:47:24,480 --> 00:47:27,869 is it has a very hard edge around him 1186 00:47:27,869 --> 00:47:31,410 right if I was to do the the zoom in on 1187 00:47:31,410 --> 00:47:34,050 this right let's say we go in tikrit a-- 1188 00:47:34,050 --> 00:47:35,880 there i don't actually know how creative 1189 00:47:35,880 --> 00:47:37,920 work sir can i do a paste as new image 1190 00:47:37,920 --> 00:47:47,790 paste into new image i don't know i 1191 00:47:47,790 --> 00:47:48,660 don't really know how to use this 1192 00:47:48,660 --> 00:47:52,170 program Oh does this what I want I don't 1193 00:47:52,170 --> 00:47:54,210 even know all right yeah I guess it is 1194 00:47:54,210 --> 00:47:55,680 it's doing what I wanted okay good 1195 00:47:55,680 --> 00:47:58,080 enough so if you're looking here you can 1196 00:47:58,080 --> 00:47:59,580 see you know there's a lot of 1197 00:47:59,580 --> 00:48:00,869 anti-aliasing this is very smooth 1198 00:48:00,869 --> 00:48:02,400 graphics there's a lot of anti aliasing 1199 00:48:02,400 --> 00:48:03,750 everywhere in here there's a lot of kind 1200 00:48:03,750 --> 00:48:05,490 of you know blurring of those edges to 1201 00:48:05,490 --> 00:48:06,720 make them a little smoother that's kind 1202 00:48:06,720 --> 00:48:08,580 of the way the art works but when we get 1203 00:48:08,580 --> 00:48:09,809 to this guy you'll notice there's 1204 00:48:09,809 --> 00:48:11,819 no smooth there's no blending there at 1205 00:48:11,819 --> 00:48:14,609 all so it's a very hard pixel edge along 1206 00:48:14,609 --> 00:48:16,709 the guy and the reason for that again is 1207 00:48:16,709 --> 00:48:18,150 because we're not using any partial 1208 00:48:18,150 --> 00:48:19,769 alpha values at all right we're not 1209 00:48:19,769 --> 00:48:21,660 doing anything to try and use those 1210 00:48:21,660 --> 00:48:24,469 values that are in between 0 and 255 1211 00:48:24,469 --> 00:48:27,269 we're just making a hard cutoff now what 1212 00:48:27,269 --> 00:48:29,130 this is often called in fact you'd see 1213 00:48:29,130 --> 00:48:30,719 this called this in 3d graphics lot it's 1214 00:48:30,719 --> 00:48:32,880 called alpha test is what this is called 1215 00:48:32,880 --> 00:48:35,400 which is basically a hard clamp limit 1216 00:48:35,400 --> 00:48:37,079 which basically just looks at the Alpha 1217 00:48:37,079 --> 00:48:38,789 value and says I'm either gonna do an 1218 00:48:38,789 --> 00:48:40,920 operation or not based on whether the 1219 00:48:40,920 --> 00:48:43,199 Alpha exceeds a threshold or not and 1220 00:48:43,199 --> 00:48:44,969 that is exactly what we implemented this 1221 00:48:44,969 --> 00:48:47,309 is basically alpha test right here but 1222 00:48:47,309 --> 00:48:48,930 what we'd like to do is something a 1223 00:48:48,930 --> 00:48:50,489 little bit better than alpha test we'd 1224 00:48:50,489 --> 00:48:52,439 rather do something that's actually some 1225 00:48:52,439 --> 00:48:55,140 kind of an alpha blend a blend that uses 1226 00:48:55,140 --> 00:48:57,589 the alpha value to compute the the 1227 00:48:57,589 --> 00:49:00,299 resulting color that we'll use what's 1228 00:49:00,299 --> 00:49:01,589 underneath 1229 00:49:01,589 --> 00:49:04,049 to actually and show through 1230 00:49:04,049 --> 00:49:07,170 what's underneath in case the alpha 1231 00:49:07,170 --> 00:49:15,209 value is not 255 that makes sense now 1232 00:49:15,209 --> 00:49:17,429 we are going to do this in the slowest 1233 00:49:17,429 --> 00:49:19,469 and dumbest possible way because I'd 1234 00:49:19,469 --> 00:49:21,749 like to make show the math being 1235 00:49:21,749 --> 00:49:25,289 explicit and so this will not be fast by 1236 00:49:25,289 --> 00:49:26,640 any stretch of the imagination it will 1237 00:49:26,640 --> 00:49:28,739 be very slow but again we are not 1238 00:49:28,739 --> 00:49:30,029 writing the render at the moment what 1239 00:49:30,029 --> 00:49:31,499 we're trying to do is write stuff that 1240 00:49:31,499 --> 00:49:34,229 we can use and so what I'd rather do is 1241 00:49:34,229 --> 00:49:39,569 just well you know what no I'm not going 1242 00:49:39,569 --> 00:49:40,949 to talk about how to do any of the fast 1243 00:49:40,949 --> 00:49:42,509 stuff we're just going to do it in the 1244 00:49:42,509 --> 00:49:44,519 slowest possible way so what we'd like 1245 00:49:44,519 --> 00:49:47,670 to do now is we'd like to go ahead and 1246 00:49:47,670 --> 00:49:49,499 and see about how to actually do that 1247 00:49:49,499 --> 00:49:52,170 alpha blend now I probably shouldn't 1248 00:49:52,170 --> 00:49:53,640 spend too much time belabor this because 1249 00:49:53,640 --> 00:49:57,209 there's actually an entire video in fact 1250 00:49:57,209 --> 00:50:00,449 of me explaining interpolation and I 1251 00:50:00,449 --> 00:50:02,099 don't know whether we want to rehash 1252 00:50:02,099 --> 00:50:04,589 that entirely on the stream or just did 1253 00:50:04,589 --> 00:50:06,809 that just crash I think frita just 1254 00:50:06,809 --> 00:50:09,569 totally crashed on me it did didn't it 1255 00:50:09,569 --> 00:50:12,059 uh yes it did 1256 00:50:12,059 --> 00:50:13,949 creative just totally just crashed it 1257 00:50:13,949 --> 00:50:17,339 just full-on it full-on went away 1258 00:50:17,339 --> 00:50:23,460 completely well what are you gonna do 1259 00:50:23,460 --> 00:50:30,230 watch it back up come on you can do it 1260 00:50:30,230 --> 00:50:32,730 it was working so well there for a while 1261 00:50:32,730 --> 00:50:35,010 see I tried to make a new image I guess 1262 00:50:35,010 --> 00:50:37,080 the thing to remember has never tried to 1263 00:50:37,080 --> 00:50:39,420 make a new image people that's the rules 1264 00:50:39,420 --> 00:50:41,690 you don't ever want to make a new image 1265 00:50:41,690 --> 00:50:45,150 all right that's fine make the image 1266 00:50:45,150 --> 00:50:50,990 please there we go hello all right okay 1267 00:50:50,990 --> 00:50:54,090 so here we go so what we need to 1268 00:50:54,090 --> 00:50:57,420 essentially do here right is I want to 1269 00:50:57,420 --> 00:50:58,530 make something that allows us to 1270 00:50:58,530 --> 00:51:01,800 smoothly blend between the two values so 1271 00:51:01,800 --> 00:51:04,290 we have a background value right I don't 1272 00:51:04,290 --> 00:51:06,260 know why that's always the hand shape 1273 00:51:06,260 --> 00:51:08,670 just is I guess the hand was what they 1274 00:51:08,670 --> 00:51:10,470 thought was good there so I have a 1275 00:51:10,470 --> 00:51:12,330 background color that's coming in right 1276 00:51:12,330 --> 00:51:14,580 I've got a hand apparently that's 1277 00:51:14,580 --> 00:51:16,170 drawing this now I've got a background 1278 00:51:16,170 --> 00:51:17,700 color it's funny to have it be a hand 1279 00:51:17,700 --> 00:51:20,250 like that that helped it all nope that 1280 00:51:20,250 --> 00:51:22,170 doesn't help at all welcome to the 1281 00:51:22,170 --> 00:51:23,490 mysteries of the universe ladies and 1282 00:51:23,490 --> 00:51:25,350 gentlemen I've got a background pixel so 1283 00:51:25,350 --> 00:51:27,960 this is one pixel right I've got a 1284 00:51:27,960 --> 00:51:29,850 background pixel and I've got a 1285 00:51:29,850 --> 00:51:32,130 foreground pixel right that this is the 1286 00:51:32,130 --> 00:51:33,660 sprogis I'll call this the sprite pixel 1287 00:51:33,660 --> 00:51:35,010 the bitmap pixel that we're drawing 1288 00:51:35,010 --> 00:51:39,330 right so this is whatever is in the 1289 00:51:39,330 --> 00:51:41,310 buffer and this is whatever is in the 1290 00:51:41,310 --> 00:51:43,860 thing we're putting on top right and so 1291 00:51:43,860 --> 00:51:46,380 in this code here we've got a source and 1292 00:51:46,380 --> 00:51:49,170 a desk right so basically this is the 1293 00:51:49,170 --> 00:51:50,870 desk this is the thing we're writing to 1294 00:51:50,870 --> 00:51:55,170 and we've got the source here this is 1295 00:51:55,170 --> 00:51:56,310 the source this is the thing that we're 1296 00:51:56,310 --> 00:51:57,510 trying to draw down this is the guy's 1297 00:51:57,510 --> 00:52:00,270 head right so this is the trees pixels 1298 00:52:00,270 --> 00:52:04,560 this is the the head pixels right so now 1299 00:52:04,560 --> 00:52:07,470 if we do this what we need to do is this 1300 00:52:07,470 --> 00:52:08,430 is some color 1301 00:52:08,430 --> 00:52:10,560 you know let's call that color a and 1302 00:52:10,560 --> 00:52:12,480 this is another color we'll call that 1303 00:52:12,480 --> 00:52:14,190 color B Wow 1304 00:52:14,190 --> 00:52:16,350 this is awful like I can't even click 1305 00:52:16,350 --> 00:52:20,850 down anymore ah I tell you computers 1306 00:52:20,850 --> 00:52:22,590 these days nothing ever works anymore 1307 00:52:22,590 --> 00:52:25,890 okay so I've got these two colors a and 1308 00:52:25,890 --> 00:52:28,680 B and what I want to do is I want to 1309 00:52:28,680 --> 00:52:31,050 produce a third color out of these right 1310 00:52:31,050 --> 00:52:33,210 I want to produce a C that's some blend 1311 00:52:33,210 --> 00:52:36,300 between a and B and what I wanted to do 1312 00:52:36,300 --> 00:52:37,500 is I want it to 1313 00:52:37,500 --> 00:52:40,110 blend based on that alpha channel right 1314 00:52:40,110 --> 00:52:42,780 I want the alpha channel to blend it 1315 00:52:42,780 --> 00:52:46,710 such that when it's zero I get a and 1316 00:52:46,710 --> 00:52:52,200 when it's 255 right I get B does that 1317 00:52:52,200 --> 00:52:59,910 make sense so when I actually go to do 1318 00:52:59,910 --> 00:53:03,630 this what I need to do is figure out 1319 00:53:03,630 --> 00:53:09,030 some some mathematical way of getting 1320 00:53:09,030 --> 00:53:12,930 from A to B smoothly based on another 1321 00:53:12,930 --> 00:53:15,420 value right I need to figure out some 1322 00:53:15,420 --> 00:53:16,680 way to pick because if you think about 1323 00:53:16,680 --> 00:53:19,140 the number line right you know I've got 1324 00:53:19,140 --> 00:53:21,930 255 at the high end for each Channel and 1325 00:53:21,930 --> 00:53:23,720 I've got 0 at the low end right 1326 00:53:23,720 --> 00:53:25,770 essentially what I'm doing here is I'm 1327 00:53:25,770 --> 00:53:29,220 saying I've got two points on this and I 1328 00:53:29,220 --> 00:53:30,390 don't really know where they are in fact 1329 00:53:30,390 --> 00:53:31,530 they don't even have to be in a Pickler 1330 00:53:31,530 --> 00:53:33,690 order a could be higher than B or vice 1331 00:53:33,690 --> 00:53:36,450 versa or whatever right so this is let's 1332 00:53:36,450 --> 00:53:38,160 say and this is when I say colors 1333 00:53:38,160 --> 00:53:40,050 obviously I mean one channel so we could 1334 00:53:40,050 --> 00:53:41,430 think of this as just the red Channel 1335 00:53:41,430 --> 00:53:42,990 right or the green channel or the blue 1336 00:53:42,990 --> 00:53:45,420 channel just one of them so when I'm 1337 00:53:45,420 --> 00:53:46,800 going to do this I basically have 1338 00:53:46,800 --> 00:53:48,780 whatever was in the background whatever 1339 00:53:48,780 --> 00:53:50,970 that channels color was right that's 1340 00:53:50,970 --> 00:53:54,870 here and then I have whatever the the 1341 00:53:54,870 --> 00:53:56,370 new color is that I'm blinging on top 1342 00:53:56,370 --> 00:53:58,080 whatever that the sprite is whatever is 1343 00:53:58,080 --> 00:54:01,950 in the guy and that's here and what I 1344 00:54:01,950 --> 00:54:03,510 need to do is figure out a way to 1345 00:54:03,510 --> 00:54:05,280 produce all of these values in between 1346 00:54:05,280 --> 00:54:08,040 here right I need to be able to produce 1347 00:54:08,040 --> 00:54:10,170 all of those values based on what the 1348 00:54:10,170 --> 00:54:12,210 Alpha channel is based on what the Alpha 1349 00:54:12,210 --> 00:54:13,830 Channel says and if the Alpha Channel 1350 00:54:13,830 --> 00:54:15,450 Zero that I'm going to leave it where it 1351 00:54:15,450 --> 00:54:17,460 was so I'm not gonna touch the 1352 00:54:17,460 --> 00:54:18,990 background at all at the Alpha Channel 1353 00:54:18,990 --> 00:54:20,340 typically five I want to drive it all 1354 00:54:20,340 --> 00:54:23,910 the way to be right so essentially the 1355 00:54:23,910 --> 00:54:25,710 way you could think about this and the 1356 00:54:25,710 --> 00:54:27,870 way that I usually like to sort of 1357 00:54:27,870 --> 00:54:31,830 explain it to begin with is that you can 1358 00:54:31,830 --> 00:54:33,630 think of it as being based around one of 1359 00:54:33,630 --> 00:54:34,950 the numbers we can think of it as being 1360 00:54:34,950 --> 00:54:37,290 based around the number that's that's 1361 00:54:37,290 --> 00:54:39,300 zero primal so the number where we have 1362 00:54:39,300 --> 00:54:41,310 zero yields that value which in this 1363 00:54:41,310 --> 00:54:44,040 case is the background color right we 1364 00:54:44,040 --> 00:54:46,620 can think of starting there and what we 1365 00:54:46,620 --> 00:54:47,970 want to do is you want to start there 1366 00:54:47,970 --> 00:54:51,300 and we want to sort of go some distance 1367 00:54:51,300 --> 00:54:53,820 towards be where that distance is going 1368 00:54:53,820 --> 00:54:56,970 to be 255 if we went all the way right 1369 00:54:56,970 --> 00:54:59,880 and zero if we didn't so how do we 1370 00:54:59,880 --> 00:55:01,860 produce what that with that actual 1371 00:55:01,860 --> 00:55:04,500 distance is right what's that value well 1372 00:55:04,500 --> 00:55:06,720 if you know rudimentary math you already 1373 00:55:06,720 --> 00:55:07,710 know what that is 1374 00:55:07,710 --> 00:55:11,880 it's just B minus a right B minus a is 1375 00:55:11,880 --> 00:55:14,100 if you will almost and we haven't talked 1376 00:55:14,100 --> 00:55:15,660 about vectors yet but it is essentially 1377 00:55:15,660 --> 00:55:16,920 a one-dimensional vector but it's 1378 00:55:16,920 --> 00:55:18,540 basically the Delta right it's the it's 1379 00:55:18,540 --> 00:55:22,110 the difference between a and B such that 1380 00:55:22,110 --> 00:55:26,310 if I were to take a star today and add 1381 00:55:26,310 --> 00:55:30,480 back in some you know this this full 1382 00:55:30,480 --> 00:55:33,930 portion I would get B and it's pretty 1383 00:55:33,930 --> 00:55:35,970 trivial to see why algebra wise right a 1384 00:55:35,970 --> 00:55:39,210 plus B minus a well the to the a 1385 00:55:39,210 --> 00:55:41,550 positive and a negative cancel and you 1386 00:55:41,550 --> 00:55:42,990 just are left with B which is the value 1387 00:55:42,990 --> 00:55:46,110 that I said we would get right so this 1388 00:55:46,110 --> 00:55:49,500 is basically the core the core of the 1389 00:55:49,500 --> 00:55:50,700 thing that we're going to use to 1390 00:55:50,700 --> 00:55:52,020 determine how to plan something right 1391 00:55:52,020 --> 00:55:54,180 because basically all I really need to 1392 00:55:54,180 --> 00:55:57,540 do is take this expression the a plus 1393 00:55:57,540 --> 00:56:00,300 the B minus a right and say as if I can 1394 00:56:00,300 --> 00:56:03,390 figure out some way to only add part of 1395 00:56:03,390 --> 00:56:06,570 this in there right all I really need to 1396 00:56:06,570 --> 00:56:08,880 do is stick some kind of a percentage in 1397 00:56:08,880 --> 00:56:10,920 here right some kind of a value that's 1398 00:56:10,920 --> 00:56:13,350 like a percentage from zero to a hundred 1399 00:56:13,350 --> 00:56:16,140 percent right if I could just multiply 1400 00:56:16,140 --> 00:56:18,540 this by some percentage then I could go 1401 00:56:18,540 --> 00:56:20,910 any percentage of the way from A to B 1402 00:56:20,910 --> 00:56:24,570 just by changing what P is right a plus 1403 00:56:24,570 --> 00:56:27,720 some percent of the distance from A to B 1404 00:56:27,720 --> 00:56:30,300 is going to give me exactly what I want 1405 00:56:30,300 --> 00:56:34,890 right so if we go ahead and build on 1406 00:56:34,890 --> 00:56:37,230 that assumption right if I want to say 1407 00:56:37,230 --> 00:56:40,770 I've got a plus some percentage here 1408 00:56:40,770 --> 00:56:43,140 right and also by convention this is 1409 00:56:43,140 --> 00:56:45,720 often called T I'll just point that out 1410 00:56:45,720 --> 00:56:47,280 to you we can use that cuz you'll see it 1411 00:56:47,280 --> 00:56:50,160 use us this way for a often but some 1412 00:56:50,160 --> 00:56:53,570 percentage of the distance from A to B 1413 00:56:53,570 --> 00:56:56,730 this would basically give me that value 1414 00:56:56,730 --> 00:56:59,190 that I wanted this would be that result 1415 00:56:59,190 --> 00:57:00,600 in color this would be the color that I 1416 00:57:00,600 --> 00:57:03,990 wanted out right so really all I have to 1417 00:57:03,990 --> 00:57:05,039 do is figure out how to do that 1418 00:57:05,039 --> 00:57:07,529 now what you'll also notice is I can 1419 00:57:07,529 --> 00:57:10,019 rearrange this expression in a couple of 1420 00:57:10,019 --> 00:57:12,179 different ways if you know algebra which 1421 00:57:12,179 --> 00:57:13,529 I'm hoping everyone on the stream does 1422 00:57:13,529 --> 00:57:16,319 because well honestly I've never thought 1423 00:57:16,319 --> 00:57:18,119 about how to teach algebra before so I 1424 00:57:18,119 --> 00:57:19,289 don't suspect that would give a very 1425 00:57:19,289 --> 00:57:21,719 good explanation but assuming you know 1426 00:57:21,719 --> 00:57:23,369 algebra then you also know that I can 1427 00:57:23,369 --> 00:57:24,749 pretty trivially use the distributive 1428 00:57:24,749 --> 00:57:27,209 property here to distribute T into this 1429 00:57:27,209 --> 00:57:28,829 expression and I would end up with these 1430 00:57:28,829 --> 00:57:31,859 terms right a plus TB minus T a right 1431 00:57:31,859 --> 00:57:36,029 and I can rearrange those terms any way 1432 00:57:36,029 --> 00:57:38,939 I want to so I could group them this way 1433 00:57:38,939 --> 00:57:42,689 right I could group them here by just 1434 00:57:42,689 --> 00:57:44,939 removing this term this term here moves 1435 00:57:44,939 --> 00:57:47,729 here right and this term stays where it 1436 00:57:47,729 --> 00:57:50,459 is this term slides there if I do that 1437 00:57:50,459 --> 00:57:52,259 rearrangement what you can see here is 1438 00:57:52,259 --> 00:57:54,269 these two front terms both have an A in 1439 00:57:54,269 --> 00:57:57,599 it so I can pull out the 1 minus T there 1440 00:57:57,599 --> 00:58:02,849 times a plus TB okay and now you have 1441 00:58:02,849 --> 00:58:04,739 what's usually the more canonical 1442 00:58:04,739 --> 00:58:07,219 version of what's called a linear blend 1443 00:58:07,219 --> 00:58:12,119 right this is usually called a linear 1444 00:58:12,119 --> 00:58:15,419 blend and what it is in either form 1445 00:58:15,419 --> 00:58:17,099 doesn't matter which one you find more 1446 00:58:17,099 --> 00:58:18,329 attractive they're just different ways 1447 00:58:18,329 --> 00:58:19,679 of computing the exact same thing right 1448 00:58:19,679 --> 00:58:23,369 algebra it's the same thing all they are 1449 00:58:23,369 --> 00:58:26,099 are a way of taking one thing in that's 1450 00:58:26,099 --> 00:58:27,869 just you know your starting value one 1451 00:58:27,869 --> 00:58:29,279 thing in that your ending value and 1452 00:58:29,279 --> 00:58:31,589 basically being able to produce anything 1453 00:58:31,589 --> 00:58:32,969 in between them by plugging in this 1454 00:58:32,969 --> 00:58:34,709 percentage value here but we haven't 1455 00:58:34,709 --> 00:58:35,819 actually talked about how to actually 1456 00:58:35,819 --> 00:58:38,209 make this percentage value work in 1457 00:58:38,209 --> 00:58:40,259 practice I just kind of magically waved 1458 00:58:40,259 --> 00:58:41,489 my hand and said we had a percentage 1459 00:58:41,489 --> 00:58:42,779 value here so we now need to talk a 1460 00:58:42,779 --> 00:58:44,549 little bit about just how that guy works 1461 00:58:44,549 --> 00:58:48,449 right well literally in the math sense 1462 00:58:48,449 --> 00:58:50,549 and if you're doing this entirely in 1463 00:58:50,549 --> 00:58:52,439 floating point math it could literally 1464 00:58:52,439 --> 00:58:54,419 just be a percentage right you know how 1465 00:58:54,419 --> 00:58:56,039 to translate percentages again if you've 1466 00:58:56,039 --> 00:58:57,269 had high school math or whatever you 1467 00:58:57,269 --> 00:58:59,249 know how to track translate percentages 1468 00:58:59,249 --> 00:59:01,979 into floating point math 100 percent 1469 00:59:01,979 --> 00:59:09,479 right is 1.0 50 percent is 0.5 right 1470 00:59:09,479 --> 00:59:13,589 zero percent is zero right so the number 1471 00:59:13,589 --> 00:59:16,499 is between zero and one all inclusive in 1472 00:59:16,499 --> 00:59:18,809 there are just those four 1473 00:59:18,809 --> 00:59:22,079 so really in this expression if T were 1474 00:59:22,079 --> 00:59:24,749 to range between zero and one including 1475 00:59:24,749 --> 00:59:26,159 all the fractional values in between it 1476 00:59:26,159 --> 00:59:28,890 then no matter what a and B are I don't 1477 00:59:28,890 --> 00:59:30,329 care what they are they could be colors 1478 00:59:30,329 --> 00:59:31,739 that could be anything positions in 1479 00:59:31,739 --> 00:59:34,829 space whatever doesn't matter this will 1480 00:59:34,829 --> 00:59:37,199 give us a blend between them right this 1481 00:59:37,199 --> 00:59:38,789 will allow us to move smoothly between 1482 00:59:38,789 --> 00:59:42,329 the two of them okay and so if you're 1483 00:59:42,329 --> 00:59:44,249 interested about in more about this sort 1484 00:59:44,249 --> 00:59:45,809 of stuff as well I would also recommend 1485 00:59:45,809 --> 00:59:49,380 if you do want to go to YouTube on the 1486 00:59:49,380 --> 00:59:52,799 hand mate in fact YouTube Casey Mira 1487 00:59:52,799 --> 00:59:54,479 Torre I think is what you would type in 1488 00:59:54,479 --> 00:59:57,359 here let's see here 1489 00:59:57,359 --> 00:59:59,269 Casey Mira Tory on YouTube there we go 1490 00:59:59,269 --> 01:00:02,119 you can actually see in my videos page 1491 01:00:02,119 --> 01:00:05,309 there is a witness Wednesday part 10 1492 01:00:05,309 --> 01:00:09,419 interpolation video and that is a full 1493 01:00:09,419 --> 01:00:10,949 on 50 minute explanation of 1494 01:00:10,949 --> 01:00:12,299 interpolation and how it works in a lot 1495 01:00:12,299 --> 01:00:14,400 of different ways so basically if you 1496 01:00:14,400 --> 01:00:15,749 want to watch that for more information 1497 01:00:15,749 --> 01:00:19,739 you can do that as well so where are we 1498 01:00:19,739 --> 01:00:21,299 at here we've only got seven minutes 1499 01:00:21,299 --> 01:00:23,400 left so let's go ahead and slam in the 1500 01:00:23,400 --> 01:00:25,650 floating-point version of this so that 1501 01:00:25,650 --> 01:00:27,150 we can actually see it in action and 1502 01:00:27,150 --> 01:00:29,069 then maybe we'll go ahead and fix it to 1503 01:00:29,069 --> 01:00:31,380 the fixed point version later but 1504 01:00:31,380 --> 01:00:32,999 basically you can see exactly what I'm 1505 01:00:32,999 --> 01:00:36,630 talking about here right so if I was to 1506 01:00:36,630 --> 01:00:38,429 go in here and write the floating-point 1507 01:00:38,429 --> 01:00:40,619 version of this let's go ahead and see 1508 01:00:40,619 --> 01:00:41,669 what we get 1509 01:00:41,669 --> 01:00:44,909 right what I would get first of all is I 1510 01:00:44,909 --> 01:00:47,309 gotta extract my read write and so my 1511 01:00:47,309 --> 01:00:50,329 read channel is going to basically be 1512 01:00:50,329 --> 01:00:53,640 shifted down by by 16 whatever's in that 1513 01:00:53,640 --> 01:00:56,459 source rank and then masked off so there 1514 01:00:56,459 --> 01:00:56,880 we go 1515 01:00:56,880 --> 01:00:59,039 and convert it to a float so that's a 1516 01:00:59,039 --> 01:01:02,579 number between 0 and 255 there we go 1517 01:01:02,579 --> 01:01:06,239 doop doop so then we have green I guess 1518 01:01:06,239 --> 01:01:08,309 I could just do our G and B for short 1519 01:01:08,309 --> 01:01:11,249 all right the green is the 8 and that's 1520 01:01:11,249 --> 01:01:15,419 0 then the alpha channel right I need I 1521 01:01:15,419 --> 01:01:17,039 just said I need it to be a number 1522 01:01:17,039 --> 01:01:18,839 between 0 and 1 well this will be a 1523 01:01:18,839 --> 01:01:21,989 number between 0 and 255 right so if I 1524 01:01:21,989 --> 01:01:24,229 want to turn a number between 0 to 255 1525 01:01:24,229 --> 01:01:28,289 into a number between 0 and 1 I need to 1526 01:01:28,289 --> 01:01:29,969 divide by that range but I need to 1527 01:01:29,969 --> 01:01:32,310 divide by 255 so that way 0 will map 1528 01:01:32,310 --> 01:01:34,290 0-255 will map-21 and everything in 1529 01:01:34,290 --> 01:01:35,340 between will map somewhere in between 1530 01:01:35,340 --> 01:01:38,430 right so now I've got an Arg and a bead 1531 01:01:38,430 --> 01:01:40,740 that are actually in floating-point now 1532 01:01:40,740 --> 01:01:42,570 I need to do the exact equation I just 1533 01:01:42,570 --> 01:01:45,300 said I need to create my new read so 1534 01:01:45,300 --> 01:01:47,310 I'll say that my read is now going to be 1535 01:01:47,310 --> 01:01:49,980 equal to oh I forgot something 1536 01:01:49,980 --> 01:01:53,490 I need the desk as well so I have my ice 1537 01:01:53,490 --> 01:01:55,920 or SARS and my Death Star's right I've 1538 01:01:55,920 --> 01:01:58,290 got I've got to pull them out of here 1539 01:01:58,290 --> 01:02:00,960 so that I can blend with them right so I 1540 01:02:00,960 --> 01:02:02,640 pull out the Death Star of the desk G 1541 01:02:02,640 --> 01:02:05,520 the desk be and I've got my sorcerer and 1542 01:02:05,520 --> 01:02:07,500 source' G and and to be fair I guess I 1543 01:02:07,500 --> 01:02:08,820 don't actually even care what these are 1544 01:02:08,820 --> 01:02:10,440 we don't even care if these are our G 1545 01:02:10,440 --> 01:02:12,720 and B we just care that their channels 0 1546 01:02:12,720 --> 01:02:15,540 1 & 2 right we don't even care so we 1547 01:02:15,540 --> 01:02:17,070 could be wrong about these shifts and it 1548 01:02:17,070 --> 01:02:18,180 wouldn't matter as long as we do them 1549 01:02:18,180 --> 01:02:21,030 all so anyway now I'm going to actually 1550 01:02:21,030 --> 01:02:23,760 produce my result red and my result red 1551 01:02:23,760 --> 01:02:25,680 is just going to be the exact equation 1552 01:02:25,680 --> 01:02:27,600 but I just specified it's going to be a 1553 01:02:27,600 --> 01:02:31,050 plus T a minus B if I wanted to do it 1554 01:02:31,050 --> 01:02:32,790 that way or I can do it this way over 1555 01:02:32,790 --> 01:02:34,710 here which is 1 minus T plus TB 1556 01:02:34,710 --> 01:02:38,180 right so I can do it this way right 1557 01:02:38,180 --> 01:02:41,970 times a plus T times B so we'll leave it 1558 01:02:41,970 --> 01:02:43,680 that way for now and we'll basically 1559 01:02:43,680 --> 01:02:46,860 just say okay if I do one 1560 01:02:46,860 --> 01:02:48,510 what's my T well my T is the Alpha value 1561 01:02:48,510 --> 01:02:50,810 that's the thing that's that's actually 1562 01:02:50,810 --> 01:02:52,770 causing it to work there and then what's 1563 01:02:52,770 --> 01:02:55,200 my a might be my a is going to be my 1564 01:02:55,200 --> 01:02:57,570 destination red times my source red 1565 01:02:57,570 --> 01:02:59,010 because I'm trying to get to the source 1566 01:02:59,010 --> 01:03:01,110 red right so that source red is the B 1567 01:03:01,110 --> 01:03:04,530 color and the the back and color is the 1568 01:03:04,530 --> 01:03:08,040 a color right all right I believe that's 1569 01:03:08,040 --> 01:03:10,470 what we said it was and so off we go now 1570 01:03:10,470 --> 01:03:12,360 we'll go ahead in and just do that for 1571 01:03:12,360 --> 01:03:14,220 all of them I've got to move that up a 1572 01:03:14,220 --> 01:03:15,720 bit so it's not obscured by the 1573 01:03:15,720 --> 01:03:17,160 five-minute warning the dreaded 1574 01:03:17,160 --> 01:03:25,830 five-minute warning be a B be like that 1575 01:03:25,830 --> 01:03:28,470 and then once we're done we have to then 1576 01:03:28,470 --> 01:03:31,290 reassemble the resulting value back into 1577 01:03:31,290 --> 01:03:33,810 something that we can actually use so 1578 01:03:33,810 --> 01:03:35,400 what I have to do now is actually do 1579 01:03:35,400 --> 01:03:39,150 sort of that that build back again for 1580 01:03:39,150 --> 01:03:40,200 the thing that we're going to actually 1581 01:03:40,200 --> 01:03:41,790 write to death so we have to actually 1582 01:03:41,790 --> 01:03:43,350 write something to death and what we're 1583 01:03:43,350 --> 01:03:45,840 going to write to death is going to be 1584 01:03:45,840 --> 01:03:48,540 our board with our G or with our B but 1585 01:03:48,540 --> 01:03:50,720 we have to now turn them back into 1586 01:03:50,720 --> 01:03:54,360 actual actual rounded values right so we 1587 01:03:54,360 --> 01:03:56,670 have to actually round the values each 1588 01:03:56,670 --> 01:04:01,980 time now so like that I suppose we could 1589 01:04:01,980 --> 01:04:03,420 just go ahead since we know these are 1590 01:04:03,420 --> 01:04:06,720 always positive we could also do this as 1591 01:04:06,720 --> 01:04:09,270 a truncation which would be a little 1592 01:04:09,270 --> 01:04:10,860 cleaner right I could do it this way 1593 01:04:10,860 --> 01:04:13,290 where we just actually truncate the 1594 01:04:13,290 --> 01:04:16,520 values plus the rounding amount like so 1595 01:04:16,520 --> 01:04:19,020 which I think you know probably is a 1596 01:04:19,020 --> 01:04:20,100 little stainer here since we are 1597 01:04:20,100 --> 01:04:23,220 actually doing this per pixel per pixel 1598 01:04:23,220 --> 01:04:25,800 things are very expensive so we do have 1599 01:04:25,800 --> 01:04:27,570 to watch out even in our test code so 1600 01:04:27,570 --> 01:04:29,040 that we won't get too slow and not be 1601 01:04:29,040 --> 01:04:31,170 able for not for us to use it but we may 1602 01:04:31,170 --> 01:04:32,940 replace this we probably don't want to 1603 01:04:32,940 --> 01:04:34,020 be doing this necessarily in floating 1604 01:04:34,020 --> 01:04:35,310 point math the way that we're doing it 1605 01:04:35,310 --> 01:04:36,960 here right now anyway but anyway point 1606 01:04:36,960 --> 01:04:39,030 being so here we go we're gonna actually 1607 01:04:39,030 --> 01:04:40,500 take these values and pack them back 1608 01:04:40,500 --> 01:04:42,030 into the places that they normally go 1609 01:04:42,030 --> 01:04:44,910 right like so we basically unpack them 1610 01:04:44,910 --> 01:04:48,920 and pack them oops 1611 01:04:48,920 --> 01:04:51,570 8:16 like that the argot shifted back up 1612 01:04:51,570 --> 01:04:53,640 thank God to put everything in there I 1613 01:04:53,640 --> 01:04:55,320 don't know I wrote that in pretty 1614 01:04:55,320 --> 01:04:56,640 quickly there we'll have to step through 1615 01:04:56,640 --> 01:04:57,840 this and see if it works 1616 01:04:57,840 --> 01:04:59,960 but I believe if we typed it correctly 1617 01:04:59,960 --> 01:05:03,540 we should have I'm not gonna open I'm 1618 01:05:03,540 --> 01:05:05,310 not gonna paste things into crea anymore 1619 01:05:05,310 --> 01:05:07,290 lesson learned we're gonna paste things 1620 01:05:07,290 --> 01:05:09,780 into GIMP from now on that way at the 1621 01:05:09,780 --> 01:05:11,100 crashes we can still draw in the 1622 01:05:11,100 --> 01:05:12,690 background so now let's take a look at 1623 01:05:12,690 --> 01:05:14,460 what happened can you see and hear how 1624 01:05:14,460 --> 01:05:16,260 that how that looks now we're you've 1625 01:05:16,260 --> 01:05:18,420 basically got you know that kind of 1626 01:05:18,420 --> 01:05:20,130 smooth that nice smooth edge now that 1627 01:05:20,130 --> 01:05:22,200 we're being the alpha Channel so that's 1628 01:05:22,200 --> 01:05:24,060 a much nicer comp right that's just a 1629 01:05:24,060 --> 01:05:27,710 much nicer thing to look at right and 1630 01:05:27,710 --> 01:05:30,420 yeah I mean that's that's alpha blending 1631 01:05:30,420 --> 01:05:32,760 in a nutshell right and so what kind of 1632 01:05:32,760 --> 01:05:34,710 alpha blending actually is this this is 1633 01:05:34,710 --> 01:05:37,290 a straight linear blend between the two 1634 01:05:37,290 --> 01:05:39,600 there's other like I said before on the 1635 01:05:39,600 --> 01:05:40,500 previous stream there's lots of 1636 01:05:40,500 --> 01:05:41,790 different things you could mean we say 1637 01:05:41,790 --> 01:05:42,960 alpha Bunny it depends on what that 1638 01:05:42,960 --> 01:05:45,870 blend equation is right so basically 1639 01:05:45,870 --> 01:05:48,900 this guy here this is our blend equation 1640 01:05:48,900 --> 01:05:51,060 that we're using there are other blend 1641 01:05:51,060 --> 01:05:55,730 equations so what I'll also say here is 1642 01:05:55,730 --> 01:05:58,900 to do KC 1643 01:05:58,900 --> 01:06:03,070 someday we need to talk about 1644 01:06:03,070 --> 01:06:06,710 premultiplied alpha because we are not 1645 01:06:06,710 --> 01:06:09,590 talking about that at the moment but now 1646 01:06:09,590 --> 01:06:11,590 is not the time to start that discussion 1647 01:06:11,590 --> 01:06:16,970 suffice to say this is not be multiplied 1648 01:06:16,970 --> 01:06:18,860 alpha but I'll just leave that for a 1649 01:06:18,860 --> 01:06:19,850 little thing that we can talk about 1650 01:06:19,850 --> 01:06:22,430 later on because at the moment it's 1651 01:06:22,430 --> 01:06:23,480 really not something that you need to 1652 01:06:23,480 --> 01:06:24,680 think about whether it's premultiplied 1653 01:06:24,680 --> 01:06:27,680 or or not but it is something that we 1654 01:06:27,680 --> 01:06:28,790 will have to think about a little later 1655 01:06:28,790 --> 01:06:30,380 on because it affects the math in very 1656 01:06:30,380 --> 01:06:32,150 important ways and we will need to 1657 01:06:32,150 --> 01:06:34,610 switch to using p mult multiplied alpha 1658 01:06:34,610 --> 01:06:37,760 for our final assets and so on so since 1659 01:06:37,760 --> 01:06:40,520 we are basically out of time here I 1660 01:06:40,520 --> 01:06:42,740 believe yes we have one minute left I'm 1661 01:06:42,740 --> 01:06:44,360 gonna call that done for the day we have 1662 01:06:44,360 --> 01:06:45,740 our alpha pudding working oh you know 1663 01:06:45,740 --> 01:06:46,700 what I'm not gonna quite call it done 1664 01:06:46,700 --> 01:06:48,070 for the day I might do one more thing 1665 01:06:48,070 --> 01:06:50,420 although I think this this actually will 1666 01:06:50,420 --> 01:06:53,180 cause us to have a couple bugs but I'm 1667 01:06:53,180 --> 01:06:54,890 gonna go ahead and make our our hero 1668 01:06:54,890 --> 01:07:00,710 head actually draw at the location of 1669 01:07:00,710 --> 01:07:03,320 the player now yeah so there we go so 1670 01:07:03,320 --> 01:07:05,450 there's our hero head very exciting he's 1671 01:07:05,450 --> 01:07:07,280 not actually in the right position but 1672 01:07:07,280 --> 01:07:08,990 at least he moves around there with the 1673 01:07:08,990 --> 01:07:12,470 guy very much fun yay yay for alpha 1674 01:07:12,470 --> 01:07:14,180 blending we're pretty close now so I 1675 01:07:14,180 --> 01:07:15,650 think basically tomorrow we'll have a 1676 01:07:15,650 --> 01:07:17,030 little guy walking around instead of our 1677 01:07:17,030 --> 01:07:18,380 rectangle because we're pretty close 1678 01:07:18,380 --> 01:07:21,470 all right everyone that is it for now 1679 01:07:21,470 --> 01:07:25,700 the Q & A has begun remember I only 1680 01:07:25,700 --> 01:07:28,460 start looking for Q colons when we start 1681 01:07:28,460 --> 01:07:31,580 the Q&A so please if you have a question 1682 01:07:31,580 --> 01:07:33,140 that you like answered now is the time 1683 01:07:33,140 --> 01:07:35,660 to post a chip to the twitch chat put a 1684 01:07:35,660 --> 01:07:37,490 Q : in front of it and please keep the 1685 01:07:37,490 --> 01:07:39,500 questions here in the post stream to 1686 01:07:39,500 --> 01:07:40,730 stuff that's actually out the code that 1687 01:07:40,730 --> 01:07:42,320 we wrote today or in previous days if 1688 01:07:42,320 --> 01:07:44,060 it's something that's off topic and 1689 01:07:44,060 --> 01:07:46,970 about something else please come before 1690 01:07:46,970 --> 01:07:49,040 our stream sometime oftentimes I try to 1691 01:07:49,040 --> 01:07:50,570 be on the stream about 15 minutes early 1692 01:07:50,570 --> 01:07:52,010 to answer just any off-topic questions 1693 01:07:52,010 --> 01:07:53,870 that you want answered and so I do 1694 01:07:53,870 --> 01:07:55,100 answer those that it's not on the po 1695 01:07:55,100 --> 01:07:56,150 stream because this is the one that kind 1696 01:07:56,150 --> 01:07:59,960 of goes into the recorded handmade hero 1697 01:07:59,960 --> 01:08:01,400 stream for people to learn on later and 1698 01:08:01,400 --> 01:08:02,690 I don't want to have lots of off-topic 1699 01:08:02,690 --> 01:08:06,430 stuff that they have to skip through 1700 01:08:06,430 --> 01:08:10,160 okay tiny typo in function name finally 1701 01:08:10,160 --> 01:08:12,290 significant set bit is missing an eye 1702 01:08:12,290 --> 01:08:15,440 okay thank you gasps blizzard let's take 1703 01:08:15,440 --> 01:08:21,460 a look at that intrinsic find least 1704 01:08:21,460 --> 01:08:23,120 significant there we go 1705 01:08:23,120 --> 01:08:25,190 that's better let's go ahead and click 1706 01:08:25,190 --> 01:08:31,609 that finally sick okay thank you very 1707 01:08:31,609 --> 01:08:39,470 much that is a definitely a typo yes 1708 01:08:39,470 --> 01:08:40,549 that's true 1709 01:08:40,549 --> 01:08:43,339 so mosaic Oh was talking about asserting 1710 01:08:43,339 --> 01:08:44,990 the compression mode is true we only 1711 01:08:44,990 --> 01:08:47,750 load one type of compression now which 1712 01:08:47,750 --> 01:08:50,029 is compression mode three so while we 1713 01:08:50,029 --> 01:08:51,529 are asserting the masks we should 1714 01:08:51,529 --> 01:08:53,540 probably also go ahead and assert that 1715 01:08:53,540 --> 01:08:56,359 the header compression mode is still in 1716 01:08:56,359 --> 01:08:57,830 that three mode because we don't load 1717 01:08:57,830 --> 01:08:59,029 any of the other compression modes at 1718 01:08:59,029 --> 01:09:01,190 present so we'd want to know if we got a 1719 01:09:01,190 --> 01:09:03,380 file that didn't conform to that 1720 01:09:03,380 --> 01:09:05,330 compression mode so that we could be 1721 01:09:05,330 --> 01:09:13,700 warned about it it's a good point so 1722 01:09:13,700 --> 01:09:15,529 also someone was saying we don't need 1723 01:09:15,529 --> 01:09:18,319 that intrinsic definition anymore well 1724 01:09:18,319 --> 01:09:19,880 we do actually need so I that's not 1725 01:09:19,880 --> 01:09:24,620 actually true so um I'll tell you what 1726 01:09:24,620 --> 01:09:25,970 the person saying and then I want to 1727 01:09:25,970 --> 01:09:27,799 make sure that is actually the case that 1728 01:09:27,799 --> 01:09:29,000 I'm not sure it is 1729 01:09:29,000 --> 01:09:33,170 so we'll yeah we'll talk about that so 1730 01:09:33,170 --> 01:09:34,569 basically what the person was saying 1731 01:09:34,569 --> 01:09:38,960 they were saying that the you don't need 1732 01:09:38,960 --> 01:09:41,029 this pragma intrinsic if you include 1733 01:09:41,029 --> 01:09:44,210 intrinsic but I'm not 100% certain if 1734 01:09:44,210 --> 01:09:52,279 that's the case let's find out so let's 1735 01:09:52,279 --> 01:09:53,480 say we do that right 1736 01:09:53,480 --> 01:09:56,450 now let's go take a look at the code 1737 01:09:56,450 --> 01:09:59,510 that gets generated just so I can see if 1738 01:09:59,510 --> 01:10:02,000 it actually still does that is intrinsic 1739 01:10:02,000 --> 01:10:03,860 it might but I just want to make sure 1740 01:10:03,860 --> 01:10:07,550 because I don't actually know sometimes 1741 01:10:07,550 --> 01:10:08,870 it doesn't for other functions I'm 1742 01:10:08,870 --> 01:10:10,400 pretty sure it doesn't but for this 1743 01:10:10,400 --> 01:10:12,200 function because they may not have done 1744 01:10:12,200 --> 01:10:14,360 a separate implementation of it then it 1745 01:10:14,360 --> 01:10:16,370 might not so that's that's definitely 1746 01:10:16,370 --> 01:10:18,620 possible all right what am I looking for 1747 01:10:18,620 --> 01:10:20,990 here I'm looking for a load bitmap right 1748 01:10:20,990 --> 01:10:25,730 load BMP so basically in here what we 1749 01:10:25,730 --> 01:10:27,910 want to do is take a look at this and 1750 01:10:27,910 --> 01:10:31,340 see what it generated go to disassembly 1751 01:10:31,340 --> 01:10:34,070 nope so does it okay so that's totally 1752 01:10:34,070 --> 01:10:36,140 fine so then it is fine without it 1753 01:10:36,140 --> 01:10:38,650 sometimes the reason that I don't that I 1754 01:10:38,650 --> 01:10:41,150 sometimes if you if you have if you 1755 01:10:41,150 --> 01:10:42,560 don't put the private intrinsic it'll 1756 01:10:42,560 --> 01:10:44,330 only use it in optimized builds or 1757 01:10:44,330 --> 01:10:45,710 whatever and so I wanted to make sure it 1758 01:10:45,710 --> 01:10:47,660 was I we there's no reason for us not to 1759 01:10:47,660 --> 01:10:49,040 always use it but as long as it always 1760 01:10:49,040 --> 01:10:54,040 does do that then that's totally fine 1761 01:10:54,040 --> 01:10:55,970 would it be worthwhile to avoid 1762 01:10:55,970 --> 01:10:57,410 converting to float when doing the alpha 1763 01:10:57,410 --> 01:11:04,460 blend yeah well so this is one of those 1764 01:11:04,460 --> 01:11:05,780 things that basically what we have to 1765 01:11:05,780 --> 01:11:10,850 say is who knows so technically I think 1766 01:11:10,850 --> 01:11:12,680 it probably would be in this particular 1767 01:11:12,680 --> 01:11:17,180 case right but we're so far away from 1768 01:11:17,180 --> 01:11:19,580 actually doing performance oriented 1769 01:11:19,580 --> 01:11:22,340 stuff that who knows it may be that it 1770 01:11:22,340 --> 01:11:23,420 really just doesn't matter for our 1771 01:11:23,420 --> 01:11:25,360 purposes at all in this particular case 1772 01:11:25,360 --> 01:11:28,520 but for something this trivial you can 1773 01:11:28,520 --> 01:11:31,690 do it entirely without moving to float 1774 01:11:31,690 --> 01:11:36,650 but you know first of all you'd never do 1775 01:11:36,650 --> 01:11:38,890 this you'd load the whole thing as a 1776 01:11:38,890 --> 01:11:41,180 Sindhi vector instead of doing the 1777 01:11:41,180 --> 01:11:43,100 channels individually like this is just 1778 01:11:43,100 --> 01:11:46,160 not we aren't thinking about performance 1779 01:11:46,160 --> 01:11:49,040 right now so thinking about whether you 1780 01:11:49,040 --> 01:11:50,450 could convert to float or not is just 1781 01:11:50,450 --> 01:11:52,160 not that relevant because there's so 1782 01:11:52,160 --> 01:11:53,810 many things that are wrong with this and 1783 01:11:53,810 --> 01:11:56,300 from a performance standpoint but it's 1784 01:11:56,300 --> 01:11:58,940 it's just not really that useful to 1785 01:11:58,940 --> 01:12:01,610 think about it I mean it's an I I 1786 01:12:01,610 --> 01:12:04,340 actually would suspect probably that at 1787 01:12:04,340 --> 01:12:05,750 the end of the day we won't even be 1788 01:12:05,750 --> 01:12:07,550 storing things in this format we won't 1789 01:12:07,550 --> 01:12:09,230 even have a RGB ease we might have like 1790 01:12:09,230 --> 01:12:10,880 a buffer of A's a buffer of ours and a 1791 01:12:10,880 --> 01:12:13,940 buffer of G's and so on right so things 1792 01:12:13,940 --> 01:12:18,170 might it's it's it's worth being aware 1793 01:12:18,170 --> 01:12:20,750 of how your code is performing but it's 1794 01:12:20,750 --> 01:12:22,490 also worth knowing when you don't really 1795 01:12:22,490 --> 01:12:24,140 care about some differences and in that 1796 01:12:24,140 --> 01:12:25,100 case I think that's a difference we 1797 01:12:25,100 --> 01:12:26,180 probably wouldn't care about that much 1798 01:12:26,180 --> 01:12:28,160 it might be interesting to do it just to 1799 01:12:28,160 --> 01:12:29,570 show how you would do it without 1800 01:12:29,570 --> 01:12:31,880 converting it to float but yeah do I 1801 01:12:31,880 --> 01:12:33,620 expect this to be a major performance 1802 01:12:33,620 --> 01:12:35,690 thing no not really because 1803 01:12:35,690 --> 01:12:37,610 already performing so poorly probably 1804 01:12:37,610 --> 01:12:40,070 that I'm not sure how much worse this 1805 01:12:40,070 --> 01:12:42,110 would really make it you know it's hard 1806 01:12:42,110 --> 01:12:49,340 to say why is the windows logo still 1807 01:12:49,340 --> 01:12:51,500 visit I have no idea because I don't 1808 01:12:51,500 --> 01:12:52,640 know if you caught at the beginning of 1809 01:12:52,640 --> 01:12:55,340 the stream I was doing that that tweak 1810 01:12:55,340 --> 01:12:56,840 thing that seven-plus task for our 1811 01:12:56,840 --> 01:12:59,330 Tweaker thing and it's the thing that 1812 01:12:59,330 --> 01:13:01,280 that's causing the windows to not be on 1813 01:13:01,280 --> 01:13:04,010 top it might be it might be possible 1814 01:13:04,010 --> 01:13:05,900 that that's a thing that was intentional 1815 01:13:05,900 --> 01:13:08,030 so let me see if it's in the Advanced 1816 01:13:08,030 --> 01:13:15,860 Options I'm not sure let's see let's see 1817 01:13:15,860 --> 01:13:21,440 why that's doing that you know that's in 1818 01:13:21,440 --> 01:13:22,969 the the help over here 1819 01:13:22,969 --> 01:13:30,800 so see option Z X and fix is about when 1820 01:13:30,800 --> 01:13:32,930 the classic theme is used clicking on 1821 01:13:32,930 --> 01:13:34,550 the string crooner no customize 1822 01:13:34,550 --> 01:13:36,080 horizontal paging it's a showing trick 1823 01:13:36,080 --> 01:13:38,239 lock allows to customize your desktop 1824 01:13:38,239 --> 01:13:40,989 button its rest reverse the direction 1825 01:13:40,989 --> 01:13:44,020 yeah I don't I don't actually know if 1826 01:13:44,020 --> 01:13:46,400 there's a thing I'll look for it later 1827 01:13:46,400 --> 01:13:50,630 but I don't see unfortunate I don't see 1828 01:13:50,630 --> 01:13:52,280 a way to get it to stop doing that 1829 01:13:52,280 --> 01:13:54,380 so I think that's might just happen for 1830 01:13:54,380 --> 01:13:56,000 a while until we figure out how to get 1831 01:13:56,000 --> 01:14:07,220 rid of it 1832 01:14:07,220 --> 01:14:13,830 let's see are there other ways to use 1833 01:14:13,830 --> 01:14:16,050 out or are there other ways to alpha 1834 01:14:16,050 --> 01:14:18,480 blend and should you be taking into 1835 01:14:18,480 --> 01:14:20,790 account which colors are easier to see 1836 01:14:20,790 --> 01:14:23,310 like green appears to be brighter than 1837 01:14:23,310 --> 01:14:28,440 red so assuming that I understand your 1838 01:14:28,440 --> 01:14:31,920 question correctly I think what you're 1839 01:14:31,920 --> 01:14:34,110 asking is are there other ways to blend 1840 01:14:34,110 --> 01:14:37,739 between two colors such that you're not 1841 01:14:37,739 --> 01:14:46,380 just using per channel so the first 1842 01:14:46,380 --> 01:14:49,830 thing I will say is that yes there are 1843 01:14:49,830 --> 01:14:51,900 many ways you could consider blending 1844 01:14:51,900 --> 01:14:54,630 between two things this is a linear 1845 01:14:54,630 --> 01:15:03,210 blend for starters and it's linear in 1846 01:15:03,210 --> 01:15:06,690 whatever space the colors are in which 1847 01:15:06,690 --> 01:15:10,920 themselves may not be linear so we 1848 01:15:10,920 --> 01:15:12,450 haven't we'll talk about this a lot we 1849 01:15:12,450 --> 01:15:13,800 get to the renderer but basically what 1850 01:15:13,800 --> 01:15:15,540 you have to understand is that the 1851 01:15:15,540 --> 01:15:16,770 colors that are displayed out of the 1852 01:15:16,770 --> 01:15:19,320 monitor are actually not linear so 1853 01:15:19,320 --> 01:15:21,000 basically you know we think about these 1854 01:15:21,000 --> 01:15:22,530 colors and we're doing this math the 1855 01:15:22,530 --> 01:15:26,160 math actually is assuming that that 1856 01:15:26,160 --> 01:15:29,250 colors are are linear a lot of times but 1857 01:15:29,250 --> 01:15:31,530 actually the way things work is there's 1858 01:15:31,530 --> 01:15:33,780 actually a curve so basically you know 1859 01:15:33,780 --> 01:15:36,270 there's a color value that you set so 1860 01:15:36,270 --> 01:15:38,430 there's basically a value from 0 to 255 1861 01:15:38,430 --> 01:15:39,960 that we are setting and we're calling 1862 01:15:39,960 --> 01:15:44,910 that the color right so what happens 1863 01:15:44,910 --> 01:15:48,870 though is that when that value is given 1864 01:15:48,870 --> 01:15:52,050 over to the display it actually goes 1865 01:15:52,050 --> 01:15:53,670 through a number of mappings potentially 1866 01:15:53,670 --> 01:15:55,230 once potentially on the graphics card 1867 01:15:55,230 --> 01:15:57,750 and once potentially by the monitor that 1868 01:15:57,750 --> 01:15:59,460 actually changes the perceived 1869 01:15:59,460 --> 01:16:02,520 brightness of that to not be linear so 1870 01:16:02,520 --> 01:16:06,900 then there's brightness here right and 1871 01:16:06,900 --> 01:16:08,910 so what actually happens is there some 1872 01:16:08,910 --> 01:16:12,660 curve that happens here right that you 1873 01:16:12,660 --> 01:16:14,790 know there's there's some curve you can 1874 01:16:14,790 --> 01:16:18,540 imagine where as you change 1875 01:16:18,540 --> 01:16:21,060 the actual numerical value of the color 1876 01:16:21,060 --> 01:16:24,390 instead of it getting you know if you 1877 01:16:24,390 --> 01:16:26,910 change it from between zero and ten the 1878 01:16:26,910 --> 01:16:29,070 difference in brightness may be much 1879 01:16:29,070 --> 01:16:32,610 more than the same distance right 240 to 1880 01:16:32,610 --> 01:16:35,760 250 or something might be a lot less of 1881 01:16:35,760 --> 01:16:38,760 a difference in brightness right let's 1882 01:16:38,760 --> 01:16:40,590 say or vice versa depending on how those 1883 01:16:40,590 --> 01:16:42,960 curves are set I think they're usually 1884 01:16:42,960 --> 01:16:44,490 set in this way but I can't quite 1885 01:16:44,490 --> 01:16:46,820 remember their exponentiated right yeah 1886 01:16:46,820 --> 01:16:50,040 so well exponentially they went through 1887 01:16:50,040 --> 01:16:51,780 this I don't know let's take a look 1888 01:16:51,780 --> 01:16:54,900 so just to just to give you the it's 1889 01:16:54,900 --> 01:16:57,300 been a lot this is the first graphics 1890 01:16:57,300 --> 01:16:58,470 programming I've done in a long time 1891 01:16:58,470 --> 01:17:01,050 actually so you know a lot of this stuff 1892 01:17:01,050 --> 01:17:04,530 is rusty for me to be honest with you so 1893 01:17:04,530 --> 01:17:07,410 let's see srgb gama curve can you look 1894 01:17:07,410 --> 01:17:09,090 at that can we get that up here 1895 01:17:09,090 --> 01:17:13,770 somewhere gamma curve there we go so 1896 01:17:13,770 --> 01:17:18,450 linear space and there's well that's not 1897 01:17:18,450 --> 01:17:20,850 what I actually wanted I wanted one on 1898 01:17:20,850 --> 01:17:24,210 one side and one with the other this is 1899 01:17:24,210 --> 01:17:26,070 not giving me the values I want I just 1900 01:17:26,070 --> 01:17:30,870 want brightness on one side and value on 1901 01:17:30,870 --> 01:17:34,170 the other I'm not looking for gamma 1902 01:17:34,170 --> 01:17:36,780 correction I'm actually looking for just 1903 01:17:36,780 --> 01:17:38,940 that doesn't anyone bake it down I just 1904 01:17:38,940 --> 01:17:40,590 want someone who's baked it down for me 1905 01:17:40,590 --> 01:17:45,660 that's really all I want well let's take 1906 01:17:45,660 --> 01:17:49,200 a look and see if this has it so srgb 1907 01:17:49,200 --> 01:17:51,210 that's actually got the full Clark you 1908 01:17:51,210 --> 01:17:54,540 here we go that's RGB intensities versus 1909 01:17:54,540 --> 01:17:59,340 HIV numerical values right so basically 1910 01:17:59,340 --> 01:18:02,100 let's see which was red so srgb 1911 01:18:02,100 --> 01:18:04,530 numerical values are red curve these are 1912 01:18:04,530 --> 01:18:09,990 the numerical values and I assume that's 1913 01:18:09,990 --> 01:18:15,120 the intensity showing exact low a 1914 01:18:15,120 --> 01:18:16,650 compressed value observe as linear 1915 01:18:16,650 --> 01:18:20,520 intensity or at a linear intensity as 1916 01:18:20,520 --> 01:18:22,530 this curve is linear so the gamma is 1 1917 01:18:22,530 --> 01:18:24,600 which curve are we talking about all 1918 01:18:24,600 --> 01:18:26,790 right this is not what I wanted I just 1919 01:18:26,790 --> 01:18:28,890 want why can't I get what I want maybe 1920 01:18:28,890 --> 01:18:30,540 I'm misinterpreting these diagrams but I 1921 01:18:30,540 --> 01:18:32,400 literally just want what I just drew 1922 01:18:32,400 --> 01:18:34,020 I wanted something that's the value that 1923 01:18:34,020 --> 01:18:35,520 you put into the buffer that's coming 1924 01:18:35,520 --> 01:18:38,550 out and how bright it appears on the 1925 01:18:38,550 --> 01:18:40,560 monitor that's all I wanted I don't know 1926 01:18:40,560 --> 01:18:42,239 why I can't get I just want one graph 1927 01:18:42,239 --> 01:18:43,920 that's just got that curve on it so that 1928 01:18:43,920 --> 01:18:45,989 I could show you but I don't know okay 1929 01:18:45,989 --> 01:18:47,250 so we can't get that curve maybe we'll 1930 01:18:47,250 --> 01:18:48,659 look up that curve I'll look up that 1931 01:18:48,659 --> 01:18:50,280 curve outside the stream so I won't have 1932 01:18:50,280 --> 01:18:52,199 to waste your time watching me try to 1933 01:18:52,199 --> 01:18:53,880 read through documentation but basically 1934 01:18:53,880 --> 01:18:58,020 point being it's nonlinear so it's 1935 01:18:58,020 --> 01:19:00,900 entirely possible that that is a bad 1936 01:19:00,900 --> 01:19:04,140 thing for your blend right you may be 1937 01:19:04,140 --> 01:19:06,750 doing alpha blending and you want this 1938 01:19:06,750 --> 01:19:09,750 this alpha was expecting it to be you 1939 01:19:09,750 --> 01:19:12,390 know let's say a smooth linear 1940 01:19:12,390 --> 01:19:14,250 transition so as you change alpha you 1941 01:19:14,250 --> 01:19:16,920 get a smooth step all along the way but 1942 01:19:16,920 --> 01:19:18,840 instead you're actually if you're doing 1943 01:19:18,840 --> 01:19:20,040 it in this exponentiated space 1944 01:19:20,040 --> 01:19:22,890 unbeknownst to you a little bit of the 1945 01:19:22,890 --> 01:19:24,750 blend actually goes a long way in terms 1946 01:19:24,750 --> 01:19:26,610 of what the perceived blend towards the 1947 01:19:26,610 --> 01:19:28,469 new color is things like that so there's 1948 01:19:28,469 --> 01:19:30,540 alpha corrected versions you can do some 1949 01:19:30,540 --> 01:19:33,480 of these things there's other blend 1950 01:19:33,480 --> 01:19:35,909 equations that do other operations that 1951 01:19:35,909 --> 01:19:38,100 aren't designed to basically map one 1952 01:19:38,100 --> 01:19:39,690 thing on to the other there's pre 1953 01:19:39,690 --> 01:19:41,760 multiplied versus not putting on 1954 01:19:41,760 --> 01:19:43,350 premultiplied alpha which is basically 1955 01:19:43,350 --> 01:19:46,380 getting rid of this 1.0 minus a term and 1956 01:19:46,380 --> 01:19:48,960 baking it into the to the I'm sorry gets 1957 01:19:48,960 --> 01:19:50,610 rid of this a term and bakes it into the 1958 01:19:50,610 --> 01:19:52,590 sr term which is another thing 1959 01:19:52,590 --> 01:19:54,420 altogether so there is a lot of stuff 1960 01:19:54,420 --> 01:19:56,190 that goes on here I don't know if that's 1961 01:19:56,190 --> 01:19:58,920 exactly what you were asking but that's 1962 01:19:58,920 --> 01:19:59,580 how that works 1963 01:19:59,580 --> 01:20:01,500 whether you take into account the fact 1964 01:20:01,500 --> 01:20:04,620 that channels work differently I don't 1965 01:20:04,620 --> 01:20:06,960 think so because the images themselves 1966 01:20:06,960 --> 01:20:09,000 have already had that taken into account 1967 01:20:09,000 --> 01:20:11,130 and you need to smoothly blend between 1968 01:20:11,130 --> 01:20:14,070 them so you could blend in a different 1969 01:20:14,070 --> 01:20:17,429 color space like you could blend a set 1970 01:20:17,429 --> 01:20:18,929 of blending in RGB you could blend in 1971 01:20:18,929 --> 01:20:21,090 HSV or you could blend in log or you 1972 01:20:21,090 --> 01:20:22,500 could do other things like this I don't 1973 01:20:22,500 --> 01:20:25,080 know whether that's really such a good 1974 01:20:25,080 --> 01:20:26,790 idea though because then what you'll get 1975 01:20:26,790 --> 01:20:29,010 is you're not going to get smooth 1976 01:20:29,010 --> 01:20:31,770 changes in the colors of the pixel 1977 01:20:31,770 --> 01:20:33,300 elements on the screen since they are RG 1978 01:20:33,300 --> 01:20:35,159 and B so I think that's probably where 1979 01:20:35,159 --> 01:20:36,540 you want to be for the operation that 1980 01:20:36,540 --> 01:20:38,219 we're doing but if you were trying to 1981 01:20:38,219 --> 01:20:39,900 alpha blend if you're trying to do an 1982 01:20:39,900 --> 01:20:40,710 alpha line that was trying to do 1983 01:20:40,710 --> 01:20:42,989 something else like smoothly blend hues 1984 01:20:42,989 --> 01:20:45,150 of things together then you might want 1985 01:20:45,150 --> 01:20:45,900 to blend in a different 1986 01:20:45,900 --> 01:20:47,820 space one that wasn't based on our gene 1987 01:20:47,820 --> 01:20:49,890 be one that had different properties I 1988 01:20:49,890 --> 01:20:51,480 don't know sorry I don't have a good 1989 01:20:51,480 --> 01:20:54,810 answer to that question really I don't 1990 01:20:54,810 --> 01:20:55,920 know yeah I don't think I answered that 1991 01:20:55,920 --> 01:20:59,520 very well but there are different ways 1992 01:20:59,520 --> 01:21:01,679 of blending things but I don't know if 1993 01:21:01,679 --> 01:21:02,969 they are exactly the way that maybe 1994 01:21:02,969 --> 01:21:08,040 you're thinking about it are we at all 1995 01:21:08,040 --> 01:21:09,870 concerned with the destinations alpha or 1996 01:21:09,870 --> 01:21:11,600 blending with a transparent destination 1997 01:21:11,600 --> 01:21:15,600 so well we are and we aren't basically 1998 01:21:15,600 --> 01:21:17,010 we're not concerned the reason we're not 1999 01:21:17,010 --> 01:21:18,659 concerned with the destinations alpha 2000 01:21:18,659 --> 01:21:20,219 channel at the moment is a because we 2001 01:21:20,219 --> 01:21:25,469 don't so two reasons first of all we 2002 01:21:25,469 --> 01:21:27,090 never really right the destinations 2003 01:21:27,090 --> 01:21:27,810 alpha Channel 2004 01:21:27,810 --> 01:21:29,400 because we don't care about it at all 2005 01:21:29,400 --> 01:21:31,920 right so you can see in this expression 2006 01:21:31,920 --> 01:21:33,330 we don't even write it it's always zero 2007 01:21:33,330 --> 01:21:35,250 right the destination just always gonna 2008 01:21:35,250 --> 01:21:38,010 have a zero alpha channel always now 2009 01:21:38,010 --> 01:21:39,300 that doesn't mean you have to do that 2010 01:21:39,300 --> 01:21:42,510 you can do rendering that uses the 2011 01:21:42,510 --> 01:21:43,739 destination alpha Channel to store 2012 01:21:43,739 --> 01:21:45,150 important information that it will use 2013 01:21:45,150 --> 01:21:48,780 and this is basically something that we 2014 01:21:48,780 --> 01:21:50,070 may explore later when we're actually 2015 01:21:50,070 --> 01:21:52,020 doing our actual renderer because 2016 01:21:52,020 --> 01:21:53,280 there's reasons why you might want to 2017 01:21:53,280 --> 01:21:54,710 use that summation alpha to do things 2018 01:21:54,710 --> 01:21:56,520 but right now we don't have a 2019 01:21:56,520 --> 01:21:58,980 destination alpha however what I do want 2020 01:21:58,980 --> 01:21:59,969 to point out is this doesn't have 2021 01:21:59,969 --> 01:22:02,190 anything to do with blending with other 2022 01:22:02,190 --> 01:22:04,080 transparent things because that actually 2023 01:22:04,080 --> 01:22:06,600 just always works because basically 2024 01:22:06,600 --> 01:22:10,199 since we are since we're basically since 2025 01:22:10,199 --> 01:22:12,060 we are always drawing things in 2026 01:22:12,060 --> 01:22:13,710 Photoshop style like I was saying before 2027 01:22:13,710 --> 01:22:16,820 where we're going to layer things down 2028 01:22:16,820 --> 01:22:19,739 such that we start with the bottom layer 2029 01:22:19,739 --> 01:22:22,650 right which has just whatever our base 2030 01:22:22,650 --> 01:22:24,360 code is right at some grass or something 2031 01:22:24,360 --> 01:22:26,159 right and then we're gonna like right on 2032 01:22:26,159 --> 01:22:28,949 to that a tree or whatever and then 2033 01:22:28,949 --> 01:22:30,150 we're going to write on top of that the 2034 01:22:30,150 --> 01:22:32,159 guy that's in front of the tree since we 2035 01:22:32,159 --> 01:22:33,480 know we're always going to be doing that 2036 01:22:33,480 --> 01:22:35,760 photoshop on top up on top up on top up 2037 01:22:35,760 --> 01:22:39,060 on top of compositing we will always 2038 01:22:39,060 --> 01:22:40,920 work because just like Photoshop layers 2039 01:22:40,920 --> 01:22:42,239 always stack on top of each other 2040 01:22:42,239 --> 01:22:43,770 properly we will always that on top of 2041 01:22:43,770 --> 01:22:45,600 each other properly if we were to draw 2042 01:22:45,600 --> 01:22:48,030 out of order right so in other words if 2043 01:22:48,030 --> 01:22:50,219 we're trying to draw stuff stacked up 2044 01:22:50,219 --> 01:22:54,120 right I'm gonna try and do a really bad 2045 01:22:54,120 --> 01:22:56,820 stacking diagram here so if this is our 2046 01:22:56,820 --> 01:22:59,280 background and this is sprite one 2047 01:22:59,280 --> 01:23:01,079 and this is sprite two if we're always 2048 01:23:01,079 --> 01:23:03,300 drawing in this order right from the 2049 01:23:03,300 --> 01:23:05,039 bottom most thing to the top then 2050 01:23:05,039 --> 01:23:07,380 stamping down we know that all we're 2051 01:23:07,380 --> 01:23:08,940 doing is writing in the colors of this 2052 01:23:08,940 --> 01:23:10,619 thing where they exist and blending them 2053 01:23:10,619 --> 01:23:12,869 with the background whatever it was so 2054 01:23:12,869 --> 01:23:14,579 another transparent thing that comes on 2055 01:23:14,579 --> 01:23:17,429 top doesn't have to care that the 2056 01:23:17,429 --> 01:23:19,770 destination buffer is actually already 2057 01:23:19,770 --> 01:23:21,389 the combination of two things 2058 01:23:21,389 --> 01:23:23,219 it doesn't care it'll just stack on top 2059 01:23:23,219 --> 01:23:25,739 of it properly so it doesn't matter to 2060 01:23:25,739 --> 01:23:27,270 this guy whether this guy had a 2061 01:23:27,270 --> 01:23:28,619 transparent portion or not because 2062 01:23:28,619 --> 01:23:30,599 that's already been resolved by this guy 2063 01:23:30,599 --> 01:23:33,809 by this operation right by the time this 2064 01:23:33,809 --> 01:23:35,400 guy writes to it it's as if they're only 2065 01:23:35,400 --> 01:23:38,789 ever was one buffer because all the 2066 01:23:38,789 --> 01:23:40,289 things that came before and have already 2067 01:23:40,289 --> 01:23:43,260 been slammed in there right if we were 2068 01:23:43,260 --> 01:23:46,230 going out of order if we were gonna try 2069 01:23:46,230 --> 01:23:48,449 and render the top thing like the this 2070 01:23:48,449 --> 01:23:50,579 bottom thing then this top thing then 2071 01:23:50,579 --> 01:23:53,520 the middle thing and this has to insert 2072 01:23:53,520 --> 01:23:55,980 between them then that's the point where 2073 01:23:55,980 --> 01:23:58,469 you start worrying about what the what 2074 01:23:58,469 --> 01:23:59,699 was actually written into the buffer 2075 01:23:59,699 --> 01:24:02,190 before right and that's all a huge mess 2076 01:24:02,190 --> 01:24:04,829 so basically what we want to do as much 2077 01:24:04,829 --> 01:24:07,289 as possible since we are a 2-d game we 2078 01:24:07,289 --> 01:24:09,030 have the luxury of probably being able 2079 01:24:09,030 --> 01:24:12,480 to do always to always know the order in 2080 01:24:12,480 --> 01:24:14,309 which we're drawing things and that will 2081 01:24:14,309 --> 01:24:15,690 let us do a bunch of things that are 2082 01:24:15,690 --> 01:24:18,030 actually extremely difficult in fact 2083 01:24:18,030 --> 01:24:20,369 sometimes impossible in 3d renderers 2084 01:24:20,369 --> 01:24:22,579 which is basically order independent 2085 01:24:22,579 --> 01:24:25,110 transparency is what they have to do and 2086 01:24:25,110 --> 01:24:27,030 they have to do all kinds of work to 2087 01:24:27,030 --> 01:24:28,349 make that stuff happen properly it's 2088 01:24:28,349 --> 01:24:31,829 really a nightmare for them it's why 2089 01:24:31,829 --> 01:24:33,420 games really hate stuff like looking 2090 01:24:33,420 --> 01:24:36,480 through several sets of windows at some 2091 01:24:36,480 --> 01:24:39,059 smokey particles right having lots of 2092 01:24:39,059 --> 01:24:40,739 translucence is actually really hard in 2093 01:24:40,739 --> 01:24:44,039 renderers for a number of reasons so 2094 01:24:44,039 --> 01:24:45,599 they try to avoid those sorts of things 2095 01:24:45,599 --> 01:24:47,969 or do them with sort of what they'll 2096 01:24:47,969 --> 01:24:50,510 usually do is they'll they'll actually 2097 01:24:50,510 --> 01:24:53,820 break apart the pieces of the scene that 2098 01:24:53,820 --> 01:24:57,539 are transparent partially and they'll 2099 01:24:57,539 --> 01:24:59,280 sort they actually will sort those 2100 01:24:59,280 --> 01:25:00,420 they'll draw everything that's not 2101 01:25:00,420 --> 01:25:02,159 transparent first and then will actually 2102 01:25:02,159 --> 01:25:03,780 sort the transparent pieces and draw 2103 01:25:03,780 --> 01:25:06,389 those in passes just like we're gonna do 2104 01:25:06,389 --> 01:25:08,309 for our renderer but we have the luxury 2105 01:25:08,309 --> 01:25:10,110 of being able to sort all of our stuff 2106 01:25:10,110 --> 01:25:11,730 so everything will just work for free in 2107 01:25:11,730 --> 01:25:12,360 that way 2108 01:25:12,360 --> 01:25:13,800 but they don't have the luxury of that 2109 01:25:13,800 --> 01:25:14,580 because they have a much higher 2110 01:25:14,580 --> 01:25:16,110 primitive account they have a much 2111 01:25:16,110 --> 01:25:17,969 higher primitive per pixel count than we 2112 01:25:17,969 --> 01:25:20,699 do and so they don't they can't get away 2113 01:25:20,699 --> 01:25:29,760 with that right so yeah well the final 2114 01:25:29,760 --> 01:25:31,650 blend favored the source over the 2115 01:25:31,650 --> 01:25:36,659 destination or is linear good enough I'm 2116 01:25:36,659 --> 01:25:38,130 not sure what that means we're really 2117 01:25:38,130 --> 01:25:40,020 not favoring anybody we're just using 2118 01:25:40,020 --> 01:25:44,010 the Alpha Channel to tell us how much of 2119 01:25:44,010 --> 01:25:46,170 the foreground should come in at that 2120 01:25:46,170 --> 01:25:48,810 point right how much of the source 2121 01:25:48,810 --> 01:25:51,540 should be used so I'm not sure can you 2122 01:25:51,540 --> 01:26:00,360 restate that question let's see how 2123 01:26:00,360 --> 01:26:01,590 would you deal with other picture 2124 01:26:01,590 --> 01:26:06,239 formats such as PNG JPEG GIF etc well we 2125 01:26:06,239 --> 01:26:07,590 just write a loader for whatever the 2126 01:26:07,590 --> 01:26:09,360 other format was or if you're lazy and 2127 01:26:09,360 --> 01:26:11,369 don't want to write another loader you 2128 01:26:11,369 --> 01:26:13,350 could just run a conversion tool and 2129 01:26:13,350 --> 01:26:16,409 then load them that way right you could 2130 01:26:16,409 --> 01:26:17,429 just run some freely available 2131 01:26:17,429 --> 01:26:18,869 conversion to a batch conversion tool 2132 01:26:18,869 --> 01:26:21,480 like image magic to batch convert your 2133 01:26:21,480 --> 01:26:22,920 stuff from whatever your source format 2134 01:26:22,920 --> 01:26:24,600 is into BMP so you could either load 2135 01:26:24,600 --> 01:26:27,330 them yourself review that or like I said 2136 01:26:27,330 --> 01:26:28,409 I'm hand made hero we write everything 2137 01:26:28,409 --> 01:26:29,790 from scratch but you don't have to write 2138 01:26:29,790 --> 01:26:31,050 everything from scratch you know there's 2139 01:26:31,050 --> 01:26:33,659 no reason that it's you can't use a 2140 01:26:33,659 --> 01:26:35,340 image loading library if you'd like to 2141 01:26:35,340 --> 01:26:36,770 and there are several that are available 2142 01:26:36,770 --> 01:26:39,300 there's thing called free image that 2143 01:26:39,300 --> 01:26:42,630 loads images you know your mileage may 2144 01:26:42,630 --> 01:26:44,340 vary but there's libraries you can use 2145 01:26:44,340 --> 01:26:53,059 so it's entirely up to you yeah 2146 01:26:53,059 --> 01:26:55,800 why is the math so complicated to use I 2147 01:26:55,800 --> 01:26:57,690 assume the BMP format does that because 2148 01:26:57,690 --> 01:26:58,679 it is somehow easier than doing 2149 01:26:58,679 --> 01:27:00,090 something else why isn't the math they 2150 01:27:00,090 --> 01:27:01,440 specified something that can just be 2151 01:27:01,440 --> 01:27:03,690 ANDed with the value or something so I 2152 01:27:03,690 --> 01:27:06,479 don't know why they chose that it seems 2153 01:27:06,479 --> 01:27:08,489 like a really bad idea to me what I 2154 01:27:08,489 --> 01:27:09,869 would have done is I would have 2155 01:27:09,869 --> 01:27:11,789 specified the order just hard-coded the 2156 01:27:11,789 --> 01:27:15,840 order and if I really wanted two 2157 01:27:15,840 --> 01:27:16,949 different orders like one for 2158 01:27:16,949 --> 01:27:18,119 little-endian one for big any and I 2159 01:27:18,119 --> 01:27:19,949 would have had a flag but you're right 2160 01:27:19,949 --> 01:27:23,010 the masks and BMP are complicated to use 2161 01:27:23,010 --> 01:27:24,749 for no real reason like why do we have 2162 01:27:24,749 --> 01:27:26,309 two bits can them because they're just 2163 01:27:26,309 --> 01:27:29,639 it was not a very smart format or store 2164 01:27:29,639 --> 01:27:31,440 the shift in there to write like store 2165 01:27:31,440 --> 01:27:33,239 the shift and they're like what spend an 2166 01:27:33,239 --> 01:27:39,570 extra 16 bits at the front of you're at 2167 01:27:39,570 --> 01:27:41,630 the front of your file format right to 2168 01:27:41,630 --> 01:27:52,070 tell what the ships were 2169 01:27:52,070 --> 01:27:53,880 something else that came up earlier the 2170 01:27:53,880 --> 01:27:55,140 stream did you mean to call the arc zone 2171 01:27:55,140 --> 01:27:57,570 of caprara LLVM or clang I always call 2172 01:27:57,570 --> 01:28:01,920 it LLVM because really it's it's not 2173 01:28:01,920 --> 01:28:03,900 clang that really is the thing that 2174 01:28:03,900 --> 01:28:05,580 determines what the intrinsics are it's 2175 01:28:05,580 --> 01:28:09,210 LLVM for the most part because LLVM 2176 01:28:09,210 --> 01:28:10,770 either has those intrinsic sin the bike 2177 01:28:10,770 --> 01:28:13,050 code or doesn't and if LLVM doesn't have 2178 01:28:13,050 --> 01:28:14,520 the intrinsic in the byte code then it's 2179 01:28:14,520 --> 01:28:16,350 like playing is just I mean playing just 2180 01:28:16,350 --> 01:28:18,090 a thing that like spits out LLVM byte 2181 01:28:18,090 --> 01:28:21,660 code right like and so if LLVM byte code 2182 01:28:21,660 --> 01:28:23,610 has intrinsic then it has it and if not 2183 01:28:23,610 --> 01:28:26,070 it doesn't so I typically always think 2184 01:28:26,070 --> 01:28:27,840 of it as LLVM but you could call it 2185 01:28:27,840 --> 01:28:37,280 playing if you wanted to it's up to you 2186 01:28:37,280 --> 01:28:39,960 in the bits can function what about 2187 01:28:39,960 --> 01:28:41,400 returning the index and have it sets a 2188 01:28:41,400 --> 01:28:42,840 negative one if not found 2189 01:28:42,840 --> 01:28:44,490 I see search functions doing that a lot 2190 01:28:44,490 --> 01:28:47,220 yes you could do that I find that to 2191 01:28:47,220 --> 01:28:49,440 just be a little more error-prone so I 2192 01:28:49,440 --> 01:28:51,210 would rather have there be a clear rule 2193 01:28:51,210 --> 01:28:52,440 that you can switch on because the 2194 01:28:52,440 --> 01:28:53,790 compiler is is probably going to 2195 01:28:53,790 --> 01:28:56,520 reorganize that stuff anyway and so it 2196 01:28:56,520 --> 01:29:04,280 just seems like an easier thing to do 2197 01:29:04,280 --> 01:29:07,860 can you go over the linear alpha blend 2198 01:29:07,860 --> 01:29:16,140 diagram again sure I certainly can so a 2199 01:29:16,140 --> 01:29:20,040 linear blend is actually something that 2200 01:29:20,040 --> 01:29:22,680 you can think about working between any 2201 01:29:22,680 --> 01:29:25,410 two things even if you don't really even 2202 01:29:25,410 --> 01:29:27,960 know what they were as long as they obey 2203 01:29:27,960 --> 01:29:30,930 a few simple properties right you could 2204 01:29:30,930 --> 01:29:32,370 almost think of it as just any two 2205 01:29:32,370 --> 01:29:35,310 points in any space right as long as 2206 01:29:35,310 --> 01:29:37,200 that space obey some linearity things 2207 01:29:37,200 --> 01:29:40,140 which let's not let's not get too crazy 2208 01:29:40,140 --> 01:29:42,840 for the moment but basically if I have a 2209 01:29:42,840 --> 01:29:45,120 point that I'm going to and a point that 2210 01:29:45,120 --> 01:29:47,070 I'm starting from right and I want a 2211 01:29:47,070 --> 01:29:49,500 linear blend between these all I need to 2212 01:29:49,500 --> 01:29:51,570 do to be able to do a linear blend is 2213 01:29:51,570 --> 01:29:55,260 have a way of producing the sort of the 2214 01:29:55,260 --> 01:29:58,260 the difference between those right I 2215 01:29:58,260 --> 01:30:00,390 need a way of being able to say a minus 2216 01:30:00,390 --> 01:30:02,640 B now I need to be able to produce that 2217 01:30:02,640 --> 01:30:05,190 and what that is like a minus B right 2218 01:30:05,190 --> 01:30:07,380 B minus a because we're going to be so B 2219 01:30:07,380 --> 01:30:09,630 minus a is basically telling me this 2220 01:30:09,630 --> 01:30:12,810 motion it's telling me how to go from A 2221 01:30:12,810 --> 01:30:16,350 to B right so on a simple number line 2222 01:30:16,350 --> 01:30:19,560 right if if I'm talking about just 5 the 2223 01:30:19,560 --> 01:30:22,380 number 5 is B and the number 2 is a I 2224 01:30:22,380 --> 01:30:24,630 subtract them right and I get 3 it's the 2225 01:30:24,630 --> 01:30:27,540 amount of steps it would take the 2226 01:30:27,540 --> 01:30:29,610 distance it would take to get from one 2227 01:30:29,610 --> 01:30:31,620 to the other right but this works in all 2228 01:30:31,620 --> 01:30:33,390 dimensions not just one so I'm just 2229 01:30:33,390 --> 01:30:35,040 gonna say like okay it's something it 2230 01:30:35,040 --> 01:30:36,150 doesn't matter two dimensions three 2231 01:30:36,150 --> 01:30:37,640 dimensions four dimensions I don't care 2232 01:30:37,640 --> 01:30:40,050 as long as we're talking about is you 2233 01:30:40,050 --> 01:30:42,690 know basically Euclidian stuff here as 2234 01:30:42,690 --> 01:30:44,520 long as I can produce this I can do a 2235 01:30:44,520 --> 01:30:45,930 linear blend and the way I do that 2236 01:30:45,930 --> 01:30:47,580 linear blend is you can think about it 2237 01:30:47,580 --> 01:30:50,580 exactly like you think about starting 2238 01:30:50,580 --> 01:30:52,020 someplace and walking somewhere else 2239 01:30:52,020 --> 01:30:56,820 right if I start a day and I add in this 2240 01:30:56,820 --> 01:30:58,890 difference this move movement right here 2241 01:30:58,890 --> 01:31:02,190 that B minus a right and I add in B 2242 01:31:02,190 --> 01:31:06,270 minus a I will get to B that's just how 2243 01:31:06,270 --> 01:31:07,980 it worked like you can think of it very 2244 01:31:07,980 --> 01:31:10,320 simply if I take the distance between 2245 01:31:10,320 --> 01:31:13,380 these two things and I and I walk it I'm 2246 01:31:13,380 --> 01:31:15,480 gonna end up at the other one right now 2247 01:31:15,480 --> 01:31:17,190 technically it's not quite a distance 2248 01:31:17,190 --> 01:31:19,140 it's actually a directional distance 2249 01:31:19,140 --> 01:31:21,210 right I know what direction I'm walking 2250 01:31:21,210 --> 01:31:23,100 to and that's why it's important that 2251 01:31:23,100 --> 01:31:24,630 we're talking about sign the numbers 2252 01:31:24,630 --> 01:31:24,960 here 2253 01:31:24,960 --> 01:31:27,449 right B you know if I say like I said 2254 01:31:27,449 --> 01:31:29,130 before let's say B was was actually 2255 01:31:29,130 --> 01:31:31,140 three and a was the five are sorry just 2256 01:31:31,140 --> 01:31:32,489 to was what I said before let's say B 2257 01:31:32,489 --> 01:31:34,290 was two when a was the five it's 2258 01:31:34,290 --> 01:31:36,449 important that I don't end up with three 2259 01:31:36,449 --> 01:31:38,520 here when I do this operation I need to 2260 01:31:38,520 --> 01:31:40,469 end up with negative three because it's 2261 01:31:40,469 --> 01:31:42,449 a direction I need to know which way I'm 2262 01:31:42,449 --> 01:31:42,840 going 2263 01:31:42,840 --> 01:31:45,540 right but basically as long as you can 2264 01:31:45,540 --> 01:31:47,310 produce that you could end up with this 2265 01:31:47,310 --> 01:31:49,590 which is basically just I mean it's it's 2266 01:31:49,590 --> 01:31:52,530 as simple as as this it's B equals a 2267 01:31:52,530 --> 01:31:55,739 plus B minus a right this this equation 2268 01:31:55,739 --> 01:31:57,630 right here if you can produce that 2269 01:31:57,630 --> 01:31:58,949 equation for the things that you're 2270 01:31:58,949 --> 01:32:01,080 talking about linear blending is as 2271 01:32:01,080 --> 01:32:03,960 simple as introducing this right you 2272 01:32:03,960 --> 01:32:05,750 could produce that new point by saying 2273 01:32:05,750 --> 01:32:08,190 instead of walking the whole distance 2274 01:32:08,190 --> 01:32:10,710 between a and B I'm going to walk some 2275 01:32:10,710 --> 01:32:12,690 portion of the distance between a and B 2276 01:32:12,690 --> 01:32:14,760 some fractional value that can be 2277 01:32:14,760 --> 01:32:16,590 whatever it is it could be 50% 2278 01:32:16,590 --> 01:32:18,580 it could be 25% what 2279 01:32:18,580 --> 01:32:21,100 ever it is and I will get however far 2280 01:32:21,100 --> 01:32:23,950 along there I need to go and that is a 2281 01:32:23,950 --> 01:32:25,900 linear blend like I said you can use 2282 01:32:25,900 --> 01:32:27,850 algebra to rearrange it if you want to 2283 01:32:27,850 --> 01:32:30,640 you can multiply this out if I have a 2284 01:32:30,640 --> 01:32:35,650 plus T B minus a equals some new value I 2285 01:32:35,650 --> 01:32:37,870 know that if I rearrange that I can use 2286 01:32:37,870 --> 01:32:40,810 the distributive property t be minus T 2287 01:32:40,810 --> 01:32:43,540 hey like that and I can go ahead and 2288 01:32:43,540 --> 01:32:45,700 regroup the terms these two a terms I 2289 01:32:45,700 --> 01:32:51,700 have a I have a 1 here in front of my a 2290 01:32:51,700 --> 01:32:53,650 coefficient right and I have a minus T 2291 01:32:53,650 --> 01:32:56,680 here so that's just 1 minus T times a 2292 01:32:56,680 --> 01:32:59,620 plus TB I just regroup the terms I 2293 01:32:59,620 --> 01:33:01,750 grouped this term in this term into one 2294 01:33:01,750 --> 01:33:03,610 term and then the TB still there and 2295 01:33:03,610 --> 01:33:05,710 that's the other form of the linear 2296 01:33:05,710 --> 01:33:07,210 blend that you often see so you've got 2297 01:33:07,210 --> 01:33:10,750 those two different formats there right 2298 01:33:10,750 --> 01:33:12,820 and so that's linear blending in a 2299 01:33:12,820 --> 01:33:14,100 nutshell it's very very simple 2300 01:33:14,100 --> 01:33:18,490 extremely powerful this one equation is 2301 01:33:18,490 --> 01:33:22,660 so powerful actually that you will see 2302 01:33:22,660 --> 01:33:26,500 it underlie almost everything we do in 2303 01:33:26,500 --> 01:33:29,800 this game there will be almost no part 2304 01:33:29,800 --> 01:33:33,300 of the code that does not at some point 2305 01:33:33,300 --> 01:33:39,280 compute some variation of this then so 2306 01:33:39,280 --> 01:33:41,470 trust me on this one you will have if 2307 01:33:41,470 --> 01:33:43,180 you don't quite understand it now you 2308 01:33:43,180 --> 01:33:44,650 will have a lot of opportunity to 2309 01:33:44,650 --> 01:33:46,870 practice because this is literally this 2310 01:33:46,870 --> 01:33:48,880 is probably if I had to say and I don't 2311 01:33:48,880 --> 01:33:50,200 know I haven't thought this through I'm 2312 01:33:50,200 --> 01:33:51,670 just saying this off the cuff but if I 2313 01:33:51,670 --> 01:33:54,160 had to say this is probably the most 2314 01:33:54,160 --> 01:33:57,700 important equation in all of gaming like 2315 01:33:57,700 --> 01:34:00,850 games need this equation probably more 2316 01:34:00,850 --> 01:34:03,160 than any other equation and there's tons 2317 01:34:03,160 --> 01:34:04,120 of equations that are important to 2318 01:34:04,120 --> 01:34:07,050 gaming but if you could only have one 2319 01:34:07,050 --> 01:34:09,640 this is probably the one you would need 2320 01:34:09,640 --> 01:34:13,150 because games can't do anything without 2321 01:34:13,150 --> 01:34:15,610 a linear blend because everything else 2322 01:34:15,610 --> 01:34:17,290 is built on top of it nonlinear blending 2323 01:34:17,290 --> 01:34:18,880 is built on top of it 2324 01:34:18,880 --> 01:34:21,070 all rasterization is built on top of it 2325 01:34:21,070 --> 01:34:23,740 all of animation is built on top of it 2326 01:34:23,740 --> 01:34:25,270 it's just incredibly incredibly 2327 01:34:25,270 --> 01:34:36,300 important 2328 01:34:36,300 --> 01:34:38,710 I'm unexperienced with Windows I know 2329 01:34:38,710 --> 01:34:40,300 we'd do a large virtual Alec at the 2330 01:34:40,300 --> 01:34:41,680 beginning is this basically the same as 2331 01:34:41,680 --> 01:34:44,710 an EM map in Linux yes for the most part 2332 01:34:44,710 --> 01:34:47,710 I'm not super experienced with M map so 2333 01:34:47,710 --> 01:34:49,540 I'm not prepared to say exactly but what 2334 01:34:49,540 --> 01:34:51,580 I would say is I would encourage you if 2335 01:34:51,580 --> 01:34:54,250 you have questions like that the best 2336 01:34:54,250 --> 01:34:55,630 place to go at the moment since I 2337 01:34:55,630 --> 01:34:57,010 haven't really looked at the Linux stuff 2338 01:34:57,010 --> 01:34:59,080 and haven't done an implementation of it 2339 01:34:59,080 --> 01:35:01,390 yet if you go to hand-made here or click 2340 01:35:01,390 --> 01:35:03,970 on news and forums there's a coding 2341 01:35:03,970 --> 01:35:05,890 resources page if you go to that coding 2342 01:35:05,890 --> 01:35:08,380 resources page go to the Linux listing 2343 01:35:08,380 --> 01:35:11,200 and click on handmade penguin SDL port 2344 01:35:11,200 --> 01:35:14,620 because I believe and I'm sorry if I it 2345 01:35:14,620 --> 01:35:16,450 turns out to be wrong but I believe he 2346 01:35:16,450 --> 01:35:21,100 actually explains how to do all of the 2347 01:35:21,100 --> 01:35:25,600 stuff that I did in in in Linux so you 2348 01:35:25,600 --> 01:35:27,610 can kind of go through here and look so 2349 01:35:27,610 --> 01:35:29,290 there's that M map and it appears to be 2350 01:35:29,290 --> 01:35:31,780 in the same place as our virtual Alex so 2351 01:35:31,780 --> 01:35:35,830 so take a look at that page handmade 2352 01:35:35,830 --> 01:35:38,830 penguin because that that would probably 2353 01:35:38,830 --> 01:35:40,060 be the best place to go for an 2354 01:35:40,060 --> 01:35:41,290 exploration since I know he's actually 2355 01:35:41,290 --> 01:35:49,170 worked it all out already 2356 01:35:49,170 --> 01:35:53,700 let's take a look here what bit value if 2357 01:35:53,700 --> 01:35:56,520 is 50% brightness well I'd be you have 2358 01:35:56,520 --> 01:36:00,030 zero and you have 255 so you can either 2359 01:36:00,030 --> 01:36:02,940 think of it as 127 well okay so here's 2360 01:36:02,940 --> 01:36:04,320 how to think about it in our actual 2361 01:36:04,320 --> 01:36:05,400 thing right here's how to answer that 2362 01:36:05,400 --> 01:36:07,410 question basically so you know that the 2363 01:36:07,410 --> 01:36:08,730 Alpha value that we're pulling out is 2364 01:36:08,730 --> 01:36:11,160 going to be whatever the alpha value in 2365 01:36:11,160 --> 01:36:13,200 in the bitmap is divided by 2 times 5 2366 01:36:13,200 --> 01:36:17,460 right so if you think about it what we 2367 01:36:17,460 --> 01:36:20,850 would want to do is say all right if we 2368 01:36:20,850 --> 01:36:24,660 have 128 divided by 255 what is that 2369 01:36:24,660 --> 01:36:26,850 well it's point 500 something something 2370 01:36:26,850 --> 01:36:29,910 something right not quite exactly 50 127 2371 01:36:29,910 --> 01:36:33,030 divided by 255 is 0.49 8 something 2372 01:36:33,030 --> 01:36:35,100 something something something right so 2373 01:36:35,100 --> 01:36:37,260 the actual answer is that there is no 2374 01:36:37,260 --> 01:36:41,490 actual value for exactly 50 127 is a 2375 01:36:41,490 --> 01:36:44,840 little bit low 128 is a little bit high 2376 01:36:44,840 --> 01:36:47,340 what are you gonna do you could adjust 2377 01:36:47,340 --> 01:36:50,720 this math to make it exact 2378 01:36:50,720 --> 01:36:55,620 you know if you wanted to write but but 2379 01:36:55,620 --> 01:36:57,090 the problem is you want to make sure 2380 01:36:57,090 --> 01:36:59,310 that one is exact so you need to make 2381 01:36:59,310 --> 01:37:01,830 sure that to be 5 by 2 to 5 is 0 like if 2382 01:37:01,830 --> 01:37:04,770 we were to do 128 divided by 56 you 2383 01:37:04,770 --> 01:37:06,150 could get an exact so if we divided by 2384 01:37:06,150 --> 01:37:07,530 triple 86 or you can get exact but you 2385 01:37:07,530 --> 01:37:09,240 could never get 1 because then your 2386 01:37:09,240 --> 01:37:11,550 highest value is typically 625 you would 2387 01:37:11,550 --> 01:37:13,110 end up never quite being able to get one 2388 01:37:13,110 --> 01:37:14,930 either and that has consequences as well 2389 01:37:14,930 --> 01:37:23,100 worst consequences in fact let's see 2390 01:37:23,100 --> 01:37:30,030 here let's see 2391 01:37:30,030 --> 01:37:35,640 what else we got does the display blit 2392 01:37:35,640 --> 01:37:37,410 operation actually do anything with the 2393 01:37:37,410 --> 01:37:41,580 Alpha Channel no it just writes zeros to 2394 01:37:41,580 --> 01:37:43,140 the Alpha Channel it's only using the 2395 01:37:43,140 --> 01:37:44,760 Alpha channels of control to basically 2396 01:37:44,760 --> 01:37:46,350 control how the blitt operates so it's 2397 01:37:46,350 --> 01:37:48,690 reading it but it never writes it if 2398 01:37:48,690 --> 01:37:52,050 that's what you're asking which i think 2399 01:37:52,050 --> 01:37:59,910 is what you're asking them now the solid 2400 01:37:59,910 --> 01:38:03,900 curve on Wikipedia's gamma correction is 2401 01:38:03,900 --> 01:38:06,420 the linear space intensity should be 2402 01:38:06,420 --> 01:38:08,040 what you are looking for okay so you're 2403 01:38:08,040 --> 01:38:11,630 saying go to Wikipedia and look up gamma 2404 01:38:11,630 --> 01:38:14,430 correction did you say or something else 2405 01:38:14,430 --> 01:38:16,700 what I'm sorry I just spaced out there 2406 01:38:16,700 --> 01:38:19,800 let's see oh we're out of time let's 2407 01:38:19,800 --> 01:38:21,750 just grab it then saw curve on gamma 2408 01:38:21,750 --> 01:38:23,220 correction I think so gamma correction 2409 01:38:23,220 --> 01:38:26,400 look at you so you're saying there's a 2410 01:38:26,400 --> 01:38:29,520 solid curve on here okay so you're 2411 01:38:29,520 --> 01:38:32,730 saying this curve right here hopefully 2412 01:38:32,730 --> 01:38:34,290 is what you're saying so I didn't do the 2413 01:38:34,290 --> 01:38:35,790 reading yet but assuming that that's the 2414 01:38:35,790 --> 01:38:38,520 solid curve basically is this what are 2415 01:38:38,520 --> 01:38:41,100 the two axes though the dotted line it's 2416 01:38:41,100 --> 01:38:42,420 a linear transfer function so I should 2417 01:38:42,420 --> 01:38:45,470 CRT there's difference what are the axes 2418 01:38:45,470 --> 01:38:51,330 by the way which axis is which hi there 2419 01:38:51,330 --> 01:38:53,060 guys can you tell me what the axes are 2420 01:38:53,060 --> 01:38:56,280 because which one is which one is the 2421 01:38:56,280 --> 01:38:59,070 brightness and which one is the input 2422 01:38:59,070 --> 01:39:02,460 value enable sheriff you have a 2423 01:39:02,460 --> 01:39:03,720 correction the dotted line indicates a 2424 01:39:03,720 --> 01:39:06,420 linear transfer function those solid 2425 01:39:06,420 --> 01:39:09,390 line shows how a typical CRT behaves the 2426 01:39:09,390 --> 01:39:11,010 dashed line represents the inverse 2427 01:39:11,010 --> 01:39:13,620 function so yeah so I guess I don't 2428 01:39:13,620 --> 01:39:15,180 actually know it doesn't say I assume 2429 01:39:15,180 --> 01:39:17,190 this is brightness and this is the input 2430 01:39:17,190 --> 01:39:18,840 value but I guess I don't actually know 2431 01:39:18,840 --> 01:39:20,520 assuming it was and you can see that's 2432 01:39:20,520 --> 01:39:22,770 what the curve looks like so it actually 2433 01:39:22,770 --> 01:39:25,410 has a lot more kind of resolution there 2434 01:39:25,410 --> 01:39:28,110 at the bottom then at the top there's 2435 01:39:28,110 --> 01:39:29,040 not a lot of resolution in the 2436 01:39:29,040 --> 01:39:30,510 brightness but I don't know I don't know 2437 01:39:30,510 --> 01:39:31,770 if that's reading this right because it 2438 01:39:31,770 --> 01:39:33,330 doesn't actually have the thing so we'll 2439 01:39:33,330 --> 01:39:34,200 have to look at that a little more 2440 01:39:34,200 --> 01:39:38,780 detail later all right 2441 01:39:38,780 --> 01:39:43,020 let's see I think that's about it for 2442 01:39:43,020 --> 01:39:45,150 stuff we can cover today 2443 01:39:45,150 --> 01:39:47,400 we have gotten this is pretty good we 2444 01:39:47,400 --> 01:39:48,510 have gotten to the point where we can 2445 01:39:48,510 --> 01:39:51,450 now do layered graphics on the screen so 2446 01:39:51,450 --> 01:39:54,090 I'm thinking it's a you know it's a it's 2447 01:39:54,090 --> 01:39:56,670 kind of a question to some degree about 2448 01:39:56,670 --> 01:40:00,330 where we go next like you know what what 2449 01:40:00,330 --> 01:40:01,740 is the next thing that we should be 2450 01:40:01,740 --> 01:40:04,040 doing if we're actually talking about 2451 01:40:04,040 --> 01:40:07,020 moving forwards on the game and so what 2452 01:40:07,020 --> 01:40:10,770 I was thinking of doing next is is 2453 01:40:10,770 --> 01:40:12,150 working on our player motion code 2454 01:40:12,150 --> 01:40:13,470 because I think that's important because 2455 01:40:13,470 --> 01:40:14,490 it's going to talk it's going to 2456 01:40:14,490 --> 01:40:15,870 basically speak to how we need to do our 2457 01:40:15,870 --> 01:40:17,760 collision detection which speaks to how 2458 01:40:17,760 --> 01:40:20,250 we need to interpret the tile map so I 2459 01:40:20,250 --> 01:40:21,300 was thinking of doing is basically 2460 01:40:21,300 --> 01:40:23,910 saying all right maybe we do a little 2461 01:40:23,910 --> 01:40:26,850 cleanup tomorrow and Friday of stuff 2462 01:40:26,850 --> 01:40:28,020 that still needs to kind of get cleaned 2463 01:40:28,020 --> 01:40:30,210 up a little bit just looking looking at 2464 01:40:30,210 --> 01:40:31,560 things like that see what we want to do 2465 01:40:31,560 --> 01:40:34,110 in terms of that sort of stuff but maybe 2466 01:40:34,110 --> 01:40:36,330 what I was thinking is so we'll start 2467 01:40:36,330 --> 01:40:39,060 next week on like actually talking about 2468 01:40:39,060 --> 01:40:41,490 linear algebra and vectors and we'll 2469 01:40:41,490 --> 01:40:42,900 actually start writing the movement code 2470 01:40:42,900 --> 01:40:44,700 for the guy for real so that it feels 2471 01:40:44,700 --> 01:40:45,840 good and we'll talk talking about 2472 01:40:45,840 --> 01:40:47,880 collision detection for real so that we 2473 01:40:47,880 --> 01:40:49,440 can kind of see what we need from our 2474 01:40:49,440 --> 01:40:50,850 engine for that because that's a really 2475 01:40:50,850 --> 01:40:53,310 important thing to spec that's one 2476 01:40:53,310 --> 01:40:55,800 direction to go the other direction to 2477 01:40:55,800 --> 01:40:57,540 go is we need to talk about how to 2478 01:40:57,540 --> 01:40:59,370 actually build these background bitmaps 2479 01:40:59,370 --> 01:41:01,650 right which is to say take the tile map 2480 01:41:01,650 --> 01:41:03,270 and kind of go ahead and build the 2481 01:41:03,270 --> 01:41:05,340 background bitmaps I don't know which 2482 01:41:05,340 --> 01:41:06,960 one we should do next it's kind of a 2483 01:41:06,960 --> 01:41:09,870 tough thing to say so it's a toss-up 2484 01:41:09,870 --> 01:41:12,360 maybe we'll flip a coin maybe we'll take 2485 01:41:12,360 --> 01:41:14,550 a poll I'm not sure both of them have to 2486 01:41:14,550 --> 01:41:15,960 get done before we know what our what 2487 01:41:15,960 --> 01:41:19,020 our engine spec really truly is so it's 2488 01:41:19,020 --> 01:41:21,900 something to think about but for now we 2489 01:41:21,900 --> 01:41:23,220 can always be happy that we now have a 2490 01:41:23,220 --> 01:41:25,230 nice living engine we can use so we can 2491 01:41:25,230 --> 01:41:26,610 put stuff up on the screen which is kind 2492 01:41:26,610 --> 01:41:28,380 of nice and from now on we'll always 2493 01:41:28,380 --> 01:41:29,970 have graphics to back us up which is 2494 01:41:29,970 --> 01:41:31,080 much nicer than looking at a bunch of 2495 01:41:31,080 --> 01:41:34,470 rectangles in my opinion so thank you 2496 01:41:34,470 --> 01:41:35,940 everyone for joining me for another 2497 01:41:35,940 --> 01:41:38,790 episode of handmade hero it has been a 2498 01:41:38,790 --> 01:41:41,190 pleasure coding with you as always and 2499 01:41:41,190 --> 01:41:43,080 it was a pleasure talking about the 2500 01:41:43,080 --> 01:41:45,210 linear blend which like I said is one of 2501 01:41:45,210 --> 01:41:46,740 the most important things you will see 2502 01:41:46,740 --> 01:41:49,050 it come up again and again and again on 2503 01:41:49,050 --> 01:41:52,050 the screen so it was nice to finally get 2504 01:41:52,050 --> 01:41:53,340 to that I think that's a pretty big 2505 01:41:53,340 --> 01:41:55,110 milestone starting to actually use the 2506 01:41:55,110 --> 01:41:56,790 linear blend and again like I said we'll 2507 01:41:56,790 --> 01:41:58,320 talk about it a lot more 2508 01:41:58,320 --> 01:42:00,180 in the future and we'll see a lot more 2509 01:42:00,180 --> 01:42:01,500 about it and we'll kind of learn more 2510 01:42:01,500 --> 01:42:03,450 and more about how interesting it is and 2511 01:42:03,450 --> 01:42:06,210 how intricate you can basically how 2512 01:42:06,210 --> 01:42:08,430 amazing it is that you can do so much 2513 01:42:08,430 --> 01:42:11,280 for such a simple function and basically 2514 01:42:11,280 --> 01:42:12,810 how it underlies everything if you will 2515 01:42:12,810 --> 01:42:15,540 so anyway thank you very much for 2516 01:42:15,540 --> 01:42:18,240 joining me if you would like to follow 2517 01:42:18,240 --> 01:42:19,680 along at home with the source code you 2518 01:42:19,680 --> 01:42:22,020 can pre-order the game and it comes with 2519 01:42:22,020 --> 01:42:24,150 full source code already every night I 2520 01:42:24,150 --> 01:42:25,500 update the source code you'll basically 2521 01:42:25,500 --> 01:42:26,670 a link in your email that you can use to 2522 01:42:26,670 --> 01:42:28,050 download the source code it also has the 2523 01:42:28,050 --> 01:42:29,280 art assets that we've been using on the 2524 01:42:29,280 --> 01:42:30,840 stream there's a separate zip file you 2525 01:42:30,840 --> 01:42:32,730 can download if you want to use like you 2526 01:42:32,730 --> 01:42:35,190 know the little guy and the backgrounds 2527 01:42:35,190 --> 01:42:36,840 and that sort of stuff for doing your 2528 01:42:36,840 --> 01:42:40,050 development and so you know anything you 2529 01:42:40,050 --> 01:42:41,430 basically completely follow along at 2530 01:42:41,430 --> 01:42:43,410 home and all the assets that you need to 2531 01:42:43,410 --> 01:42:44,970 follow along completely at home come 2532 01:42:44,970 --> 01:42:47,520 with the with with that pre-order so 2533 01:42:47,520 --> 01:42:48,900 check that out if you're interested we 2534 01:42:48,900 --> 01:42:50,130 also have a patreon if you want to 2535 01:42:50,130 --> 01:42:51,420 support the video series you can always 2536 01:42:51,420 --> 01:42:53,100 subscribe there we also have that news 2537 01:42:53,100 --> 01:42:54,390 and forums site which I showed just a 2538 01:42:54,390 --> 01:42:55,740 few minutes ago which has a ton of 2539 01:42:55,740 --> 01:42:57,030 resources for people who are trying to 2540 01:42:57,030 --> 01:42:58,800 learn on the stream too a lot of great 2541 01:42:58,800 --> 01:43:00,120 stuff the schedule for the week's always 2542 01:43:00,120 --> 01:43:02,850 posted here there's also the episode 2543 01:43:02,850 --> 01:43:04,110 guide which allows you to catch up with 2544 01:43:04,110 --> 01:43:06,270 old episodes got nice annotated video 2545 01:43:06,270 --> 01:43:08,610 series on there coding resources has the 2546 01:43:08,610 --> 01:43:09,960 ports like I showed before and other 2547 01:43:09,960 --> 01:43:11,670 resources you might need like good 2548 01:43:11,670 --> 01:43:13,110 documentation of stuff and there's a 2549 01:43:13,110 --> 01:43:15,120 forum you can post in when you need to 2550 01:43:15,120 --> 01:43:16,470 ask questions so please check that out 2551 01:43:16,470 --> 01:43:17,370 if you're trying to learn from the 2552 01:43:17,370 --> 01:43:18,600 series it's a great resource and there's 2553 01:43:18,600 --> 01:43:19,770 a lot of very helpful people on there 2554 01:43:19,770 --> 01:43:22,080 who are very nice on the forums who will 2555 01:43:22,080 --> 01:43:23,910 also try to answer your questions if I'm 2556 01:43:23,910 --> 01:43:24,900 not around to do so 2557 01:43:24,900 --> 01:43:27,000 so thank you very much for joining me I 2558 01:43:27,000 --> 01:43:29,130 will see you tomorrow same time saying 2559 01:43:29,130 --> 01:43:31,080 place 8:00 p.m. Pacific Standard Time on 2560 01:43:31,080 --> 01:43:33,690 Twitch so I hope to see you all there 2561 01:43:33,690 --> 01:43:36,720 and if I don't have an excellent 2562 01:43:36,720 --> 01:43:40,310 Thursday see you later everybody 188498

Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.