發表文章

目前顯示的是 11月, 2009的文章

如何由被讀取的swf (loadee)呼叫讀取者(loader)的function

想呼叫到loader的function,關鍵就是要能夠從被讀取者access到讀取者。範例如下: loader.swf中: trace("loader started."); var loader:Loader = new Loader(); addChild(loader); loader.load(new URLRequest("loadee.swf")); function loaderMethod():void { trace('hello!'); } // pose loader loader.x = stage.stageWidth/2; loader.y = stage.stageHeight/2; loadee.swf中: trace("loadee started."); // 呼叫最parent物件的方法 MovieClip(stage.getChildAt(0)).poppaMethod(); // 呼叫loader所在的物件的方法 (loaderInfo.loader.parent as MovieClip).poppaMethod(); 如果被讀取者想確認是否被讀取,確認讀取以後才去呼叫loader的方法,可以在loadee.swf加上: this.addEventListener(Event.ADDED_TO_STAGE, callLoaderMethod); function callLoaderMethod(event:Event):void { (loaderInfo.loader.parent as MovieClip). loaderMethod(); }

使用avi影片作為ARToolkit的視訊輸入源

在ARToolkit中,讀取video configuration的語法為: arVideoOpen( vconf ); 在範例中都可以看到 vconf 所指向的xml內容,預設是以camera作為影像輸入源,如果要改用avi格式的影像來做辨識,只要把xml內容的<camera>標籤改為如下的<avi_file>標籤即可。     <avi_file file_name="Data/hiro_pattern640x480.avi" loopAVI="true">         <pixel_format>             <RGB32 flip_h="false" flip_v="true"/>         </pixel_format>     </avi_file> avi的路徑是以exe檔為相對位置,不是以xml為相對位置。

如何把3dmax的physique轉成skin

圖片
使用3dmax的physique開發的骨架動畫不被大部分的動態3d格式輸出工具(*.b3d, *.3ds, ... exporter)所支援,大部分輸出工具都只支援3dmax內建的skin骨架動畫,還好可以找到轉檔的工具幫我們把physique轉成skin。 沒想到官網上還可以找到for 3dmax7的版本,分享連結在此:   3ds Max SDK Samples/Utilities Physique to Skin Utility – Recompiled for 3ds Max 6 and 3ds Max 7 An update to the physique to skin converter for 3ds Max 6 and 3ds Max 7. No new functionality has been added. phy2skin.zip (zip - 11Kb) 使用方法很簡單,基本上就是選了mesh以後,再按下Tool裡面的"Convert to Max Skin"按紐,再按下確認以後就成功了。 一張圖說明一切: 這邊也有視訊教學可看: [max] physique蒙皮转skin蒙皮的plugins 使用教学

Visual C++ 2008 快速鍵

關於快速鍵,官方有提供一份快速鍵的海報pdf: 由此下載 。列出來的東西好像很多,但真的要找的時候又覺得每個細項的資料都不多,其實還是不好用。(跟Adobe的海報比起來差好多 T_T) 在這邊把覺得比較好用的紀錄一下好了(陸續補充,但也可能永遠只有這幾條 -_-"): 格式化選取的code [ Ctrl+K, Ctrl+F ] View.Navigate-Backward [CTRL+-] View.NavigateForward [CTRL+SHIFT+-] Edit.CompleteWord [CTRL+SPACE or ALT+RIGHT ARROW] Auto-(Re)Format [Ctrl+K, Ctrl+D] find references [Shift+F12] duplicate the current line [Ctrl+C, Ctrl+V] delete the current line [Ctrl+L] search for the current selection [Ctrl+F3] create a bookmark [Ctrl+K, Ctrl+K] go to the next bookmark [Ctrl+K, Ctrl+N ]

認識一下 Inline function

圖片
忘記 inline function為什麼比較快,手上的入門書也沒說明,就google一下找到這篇說明 Inline Function 的文章,說得很清楚詳細。 筆記 To eliminate the cost of calls to small functions, C++ proposes a new feature called inline function. An inline function is a function that is expanded in line when it is invoked. That is, the compiler replaces the function call with the corresponding function codes . We should take utmost care while making a function inline. The speed benefit of an inline function diminishes as it grows in size . At some point the overheads of the function call becomes small as compared to the execution of the function, and the benefits of inline function may be lost. There are few situations where an inline function may not work...

ARToolkit官方文件閱讀筆記[3]: 開發第一個應用

圖片
原文 Developing your First Application, Part 1 筆記 這篇文件主要的重點是在說明所謂的"ARToolKit Step Functions" ,也就是運行ARToolkit的過程中會經歷的6大步驟,這些步驟在原文件中已經被整理成一個清楚的表格。 ARToolKit Step Functions 1. Initialize the application init 2. Grab a video input frame arVideoGetImage  (called in  mainLoop ) 3. Detect the markers arDetectMarker  (called in  mainLoop ) 4. Calculate camera transformation arGetTransMat  (called in  mainLoop ) 5. Draw the virtual objects draw  (called in  mainLoop ) 6. Close the video capture down cleanup 不過這六大步驟中沒有包含全部被實際使用到的ARToolkit函式,所以為了更進一步地了解建構一個AR應用究竟需要用到哪些ARToolkit函式,所以我再把每個步驟內所使用到的function抓出來加到表格中。 ARToolKit Step Functions 1. Initialize the application 由init() 作初使化工作,init內包括的function : arVideoOpen(vconf)[說明: 開啟video設置檔] vconfarVideoInqSize(&amp;xsize, &amp;ysize)[說明: 不懂用途] arParamLoad(cparaname, 1, &amp;wparam)[說明: dat檔和ARParam] arParamChangeSize( &amp;wparam, xsize, ysize, &amp;cparam )[說明: 需要因應攝影機,計算一下參數的變化] arInitCparam( &amp;cparam ) [說明: 設定為讀進來的參