2012年2月29日 星期三

Unity3d: Forward Rendering Path Details

http://unity3d.com/support/documentation/Components/RenderTech-ForwardRendering.html

2012年2月24日 星期五

Titanium iOS/Android cross platform memo

  1. As possible as you can choose non-dependent interface on specific platform. 
  2. Be careful the include *.js path. 
  3. Localization file at the string.xml file. When you find some item name displayed have problem, you need to check the file first.

2012年2月21日 星期二

JavaScript language advanced Tips & Tricks

http://code.google.com/p/jslibs/wiki/JavascriptTips#Singleton_pattern

Java script singleton: http://www.hardcode.nl/subcategory_1/article_526-singleton-examples-in-javascript.htm

var Setting =(function(){
    var instantiated;
    function init (){
        // all singleton code goes here
        return {
            publicWhatever:function(){
                alert('whatever')
            },
            userID:null,
          
            setUserID:function( id ) {
                userID = id;
            },
          
            getUserID:function() {
                return userID;
            }
        }
    }

    return {
        getInstance :function(){
            if (!instantiated){
                instantiated = init();
            }
            return instantiated;
        }
    }
})()

2012年2月19日 星期日

Write data to file in Titanium

var configDir = Titanium.Filesystem.getFile( Titanium.Filesystem.applicationDataDirectory, "dirPath" );
       
    if ( configDir.exists() ) {
         configDir.createDirectory();
     }

var config = Titanium.Filesystem.getFile( configDir.resolve(), "fileName" );
       
    if ( config.write( writeSettingToConfig( userID ) ) == false )
    {
        // handle write error
        var error;
    }
    config = null;
    configDir = null;

2012年2月15日 星期三

FETCHING DATA FROM GOOGLE PLACES API USING TITANIUM

FETCHING DATA FROM GOOGLE PLACES API USING TITANIUM
http://boydlee.com/appcelerator-titanium/fetching-data-from-google-places-api-using-titanium.html

2012年2月8日 星期三

Shadow map PCF vs. Variance filter

PCF(Percentage closer filer): Because texture precision is not enough to confirm lossless. Therefore, we can reference the neighbor pattern. I use four corner texel( left-top, right-top, left-bottom, right-bottom) and the current texel.
                           float2 texCoord;
                           float4 p;
                           texCoord.x = shadowPos.x + 1/shadowMapSize;
                           texCoord.y = shadowPos.y - 1/shadowMapSize;
                           p.x = tex( sm, texCoord );  // left-top

                           texCoord.xy = shadowPos.xy + 1/shadowMapSize;
                           p.y = tex( sm, texCoord );  // right-top

                           texCoord.xy = shadowPos.xy - 1/shadowMapSize;
                           p.z = tex( sm, texCoord );  // left-bottom

                           texCoord.x = shadowPos.x + 1/shadowMapSize;
                           texCoord.y = shadowPos.y - 1/shadowMapSize;
                           p.w = tex( sm, texCoord );  // right-bottom

                           float4 resultCorn = ( shadow.z > p ) ? 1 : 0;
                           float2 result;
                           result.x = dotProduct4( result, 0.25 );

                           texCoord.xy = shadowPos.xy;
                           p.x = tex( sm, texCoord );  // center

                           result.y = ( shadow.z > p.x ) ? 1 : 0;
                           float finalResult = dotProduct( result.xxyy, 0.25 );

Variance: We need two shadow map, individually they are record clip-depth and square of clip-depth.
                     

                          

2012年2月7日 星期二

iOS vs. Android GPU architecture

 iOS outperform Android for OpenGL apps on the exact same hardware. iOS offers a fast path for OpenGL apps. ( there are no intermediate buffers on iOS, but on Android whose surfaceflinger system will creates an additional copy of the entire screen which need to be copied over the main bus every time you swap buffers)

2012年2月4日 星期六

Get friends checkin from FQL

https://graph.facebook.com/

fql?q=SELECT coords, tagged_uids, page_id, author_uid FROM checkin WHERE author_uid IN (SELECT uid2 FROM friend WHERE uid1 = me())

http://developers.facebook.com/docs/reference/fql/checkin/

We can test the result from  Graph API Explorer
http://developers.facebook.com/tools/explorer

2012年2月2日 星期四

Create Facebook app id

https://developers.facebook.com/apps/?action=create