It reminds me of a similar history on PS3 side that Linux was allowed to be installed and later it was renounced.

I may need to hurry to experience of the exciting device under my control.
Jay is a game developer.
Imagine you’re on the first slide of your powerpoint presentation and want to move to the next slide. Your remote control has two buttons. They are unmarked, but one button points up and one button points down.The result is half and half.
Which button do you press?
CHOICE /M "Do you agree?"This will print out a message "Do you agree? [Y,N]" and you can type in "y" key or "n" key to answer. Other keys are ignored and enter key after "y/n" is not needed.
CHOICE /C XPD /M "Do you like [X]box360 games or [P]layStation3 games? ([D]on't care)"Now you will have "X", "P", and "D" choices instead of simply "Y/N".
CHOICE /C XPD /M "Do you like [X]box360 games or [P]layStation3 games? ([D]on't care)"There is one more thing to note.
IF ERRORLEVEL 3 GOTO :DONT_CARE
IF ERRORLEVEL 2 GOTO :LIKE_PS3
IF ERRORLEVEL 1 GOTO :LIKE_XBOX
vote.bat ps3Then in the batch file, the argument is parsed in this way:
@ECHO OFFNow, we need to remember that the batch file takes either "xbox" or "ps3". It shouldn't be "xbox360" or "pS3". So we now need to add HELP message like this:
IF "%1" == "ps3" GOTO :VOTE_FOR_PS3
IF "%1" == "xbox" GOTO :VOTE_FOR_XBOX
@ECHO OFFWith "CHOICE" command, we can make this batch file much simple:
IF "%1" == "ps3" GOTO :VOTE_FOR_PS3
IF "%1" == "xbox" GOTO :VOTE_FOR_XBOX
GOTO :HELP
:HELP
ECHO USAGE: vote.bat [xbox|ps3]
@ECHO OFFThere is no need to have dedicated Help sub-routine. And don't need to bother with Case-sensitiveness.
CHOICE /C XP /M "Vote for [X]box or [P]s3?"
ECHO x | vote.batThis will have a same effect to a command, "vote.bat xbox", without any interactive pause.
Run("notepad.exe")We can also send keyboard short-cut messages:
WinWaitActive("Untitled - Notepad")
Send("This is some text.")
; from http://www.autoitscript.com/autoit3/docs/tutorials/notepad/notepad.htm
Send("!f") ; Alt+fI haven't seen mouse input functions yet. But there must be someway to do it; I will figure it later.
Send("^s") ; Ctrl+s
Send("{ENTER}") ; Enter
float depthOffset = 0.001;This approach is trying to estimate how much the pixel is open to the light; I tried to apply SSAO trick on the shadow map, but in a simpler way.
float depth00 = GetDepth( uv + float2( -1.5, -1.5 ) );
float brightness00 = saturate( ( depth00 - ( actualDepth - depthOffset ) ) / ( 2* depthOffset ) );
// do the same thing on different offsets.
float bOuterPenumbra = ( depthOnShadowMap >= actualDepth );This will make "A" part brighter than "C" part, which is opposite to the correct shadow model. This will make stronger shadow on "C" part and softer shadow on "A".
float brightness = variance / ( variance + pow( actualDepth - depthOnShadowMap, 2 ) );
float finalBrightness = max( bOuterPenumbra, brightness );
const float e = 2.71828183;There are some problems on this approach.
const expConst = -5.0;
const bool bUnderShadow = ( actualDepth > depthOnShadowMap );
const float brightness = ( bUnderShadow ? 0.0 : ( 1 - saturate( pow( e, expConst * actualDepth ) / pow( e, expConst * expFromExpMap ) ) ) );
( "may do good" + "definitely mean" ) / 2 = "mean"We may need them sometimes but I don't think their job is productive. It is like soldiers, which are powerful but don't produce any.
if( a == 1 ) doSomething1();For each line, CPU, more precisely ALU, will evaluate each statement: "a == 1", "a == 2" and so on. In other words, CPU need to calculate 40000 times for the same value "a".
else if( a == 2 ) doSomething2();
else if( a == 3 ) doSomething3();
....
else if( a == 40000 ) doSomething40000();
switch( a )This "switch statement" gives us an illusion that CPU will evaluate the value of "a" only one time.
{
case 1: doSomething1(); break;
case 2: doSomething2(); break;
case 3: doSomething3(); break;
...
case 40000: doSomething4000(); break;
}
typedef void (*CB)();This idea is called "jump table". In this implementation, CPU does not evaluate the "a" value 40000 times but does only once. In other words, this way is faster.
CB doSomethings[] = { doSomething0(), doSomething1(), ... doSomething40000() };
(*(doSomethings[ a ]))();
std::map< int, CB > hashTable;One better property of hash table over "jump table" is that the memory space that the hash table requires does not depend on the values but depends on the number of values, which is preferred. Although hash table need little bit more space than the number of values, it is much less than the size of jump table in this case.
hashTable[ 1 ] = doSomething1;
hashTable[ 40000 ] = doSomething40000;
(*(hashTable[ a ]))();