維尼的蜂巢

RealTime??!! It’s amazing!!!!

wired pointer 十月 1, 2010

Filed under: Uncategorized — kevinlin @ 4:50 下午

why after delete a pointer , it’s not be null?????//

* 0xABABABAB : Used by Microsoft’s HeapAlloc() to mark “no man’s land" guard bytes after allocated heap memory
* 0xABADCAFE : A startup to this value to initialize all free memory to catch errant pointers
* 0xBAADF00D : Used by Microsoft’s LocalAlloc(LMEM_FIXED) to mark uninitialised allocated heap memory
* 0xBADCAB1E : Error Code returned to the Microsoft eVC debugger when connection is severed to the debugger
* 0xBEEFCACE : Used by Microsoft .NET as a magic number in resource files
* 0xCCCCCCCC : Used by Microsoft’s C++ debugging runtime library to mark uninitialised stack memory
* 0xCDCDCDCD : Used by Microsoft’s C++ debugging runtime library to mark uninitialised heap memory
* 0xDEADDEAD : A Microsoft Windows STOP Error code used when the user manually initiates the crash.
* 0xFDFDFDFD : Used by Microsoft’s C++ debugging heap to mark “no man’s land" guard bytes before and after allocated heap memory
* 0xFEEEFEEE : Used by Microsoft’s HeapFree() to mark freed heap memory

reference: http://www.codeguru.com/forum/archive/index.php/t-325259.html

 

VS 2010: 修改VC++的繼承的inclde目錄跟Lib目錄 九月 6, 2010

Filed under: VC++/C++/C — kevinlin @ 11:46 上午
Tags:

vs2010拿掉了Tools->裡面的設定VC++Directories

全部移到Porject自己個別設定,那如果我有4-50個project不就要設定到死

所以他有一個GLOBAL的設定,直接選擇VC++ directories Inherit 就能使用

檔名是這樣的 Microsoft.cpp.[Platform].users.props (會在安裝時產生)

位置在$(USERPROFILE)\appdata\local\microsoft\msbuild\v4.0

我是用notepad++直接開起來改,存檔

用property manager編輯也是可以

參考: http://blogs.msdn.com/b/vcblog/archive/2010/03/02/visual-studio-2010-c-project-upgrade-guide.aspx

 

OGRE的換裝系統Memo 十二月 12, 2009

Filed under: Uncategorized — kevinlin @ 6:50 下午
Tags: ,

Q:
I am currently working on the equipping technique for the characters in our game. Regarding the paint-on-armor(cloth leather chain) it is rather easy by assigning different materials to the desired SubEntities. For the modelled armor pieces like plate armor I am a little bit stuck now, I have searched around on the boards and in the wiki but cannot find the real clue. Attaching to bone doesnt seem to be a good option.

Is it possible to load a different mesh into a submesh and how does it work? Should I load all the gear in one go from the start and set the SubEntities to invisible untill i need them or what would be the best method to change the equipment on a game-character?

Thanks in advance

A:You’re on the right track.

Attaching to bones is not the way to go for clothing. It works well for equipment (guns, swords, etc) and maybe some accesories (hat, holster, etc) but woul dnot work well for armour.

Building your model with all conceivable geometries (leather vs plate vs robe) in seperate subentities and then enabling/disabling as needed is a good way to go. A lot of games go this way.

You could also building your character out of components (leather torso vs plate torso vs robe torso) and attach/assembled limbs and heads as needed. A lot of game go this way (probably more than above).

Each has pros and cons. The first has some more overhead in terms of animation and vert/poly counts — not sure how “smart" OGRE is in ignoring/optimising invisible subentities (but I would guess pretty smart).

The second way can be harder in terms of managing animation (crashing polys, seams, etc), but has some added benefits in terms of being able to easily detach components (i.e. decapitation and dismemberment), plus customizability options may be easier to do.

If you want something fast/eas(ish), go with 1. If you want something a little more robust/extensible, go with two.

A:
You can’t “swap" them but you can set them visible/invisible using

entity->getSubEntity(0)->setVisible(false);

You could do it this way if you have a low number of combinations, but it’s a bad idea if you have hundreds of pieces of clothing. With a few pieces, it’s a decent idea though.

If you have lots of combinations, I think your best bet is to have a base character mesh, with bones and skeleton, animations, etc. Then have additional pieces that you share the skeleton with.

So for example, if a naked character is ok for your base mesh, use it. Let’s say you want your character wearing armor. You’d model your armor in your 3d program and bind it to the same skeleton structure as your base mesh. All bones have to exist with the same names, positions and orientations.

Then in Ogre you can use:

entity->shareSkeletonInstanceWith(otherEntity);

That means as one animates, it animates both at the same time. I got this working through a bit of trial and error. I can’t remember the problems I had but they were minor.

In the end, for a full system, you probably need a combination of the following:

1. Attaching certain pieces to bones
2. Sharing the skeleton between some pieces
3. Attaching equipment to the same scene node as the base mesh and playing the same animation name. For example, let’s say you have a robe that has special animation for the robe cloth, you can’t use #2 because it’ll have different bones and special skeletal animation.

Anyhow, good luck. Also you should look into the Ogre files yourself – you could have found the answer to the SubEntity->setVisible problem in like 2 seconds.

 

macos profile 備忘 八月 5, 2009

Filed under: Mac,Uncategorized — kevinlin @ 10:13 上午
Tags:

MacOSX 10.5.7的環境變數設定檔是 ~/.profile

好像舊的版本是~/.base_profile 跟我不太一樣

 

SVN-Server on Macbook 八月 3, 2009

Filed under: Mac,Subversion — kevinlin @ 10:17 下午

很久以前用微軟的vss做版本控制,後來改用公司的SVN。 自己寫程式要做版本控制只有自己架svn server來用。因為Leopard已經內建了svn 1.4.4跟apache所以使用mac不失為一個好方法。

步驟很簡單

1. 隨意一個地方建立
# mkdir /users/kevin/repos

2. 建立第一個專案
# svnadmin create /users/kevin/repos/myfirstproject

3.如果要給多人用就要去做ㄧ些這個project的config
# mate /users/kevin/repos/myfirstproject/conf/svnserve.conf
# svnserve -d –listen-port=3690  (開啓SVN伺服器服務)
# killall svnserve(刪掉svn server)

4.不過沒有要給多人使用就跳過第三個步驟。
# cd /users/kevin/repos
# mkdir myNowWork (目前的工作目錄)
# cd myNowWork
# sudo svn co file:///users/kevin/repos/myfirstproject (從指定的路徑checkout出最新版本)
# cd myfirstproject (剛剛抓下來的專案)
# sudo svn mkdir  trunk (隨便建一個目錄)
# sudo svn ci -m “first commit" 把剛剛建好的目錄commit回去

經過上面的步驟就能自己在local使用svn了

改天再來做 svn server讓多人使用的

網路上參考到這篇 http://asuralyc.blogspot.com/2009/05/svn-websvn-ssl-trac-on-leopard.html

 

Ruby, Rails and MySQL with Leopard 10.5.2 and XCode 3.0 七月 13, 2009

Filed under: Mac,Rails — kevinlin @ 8:20 下午
Tags:

其實本來用MAMP(apache+mysql)跟Locomotive(ruby,rails)
這樣是可以run的

但是我想要解決為什麼我的mysql跟rails就是連接有問題

上一篇似乎解決了安裝gem mysql但是…
還是有錯誤

上網找了一下 發現原來是XCode裝的Ruby搞的鬼

解決方法是給多點參數,然後rebuild一下gem的mysql

1. 先打mysql_config可以看到一些參數
lin-kevinde-macbook:music_library Kevin$ mysql_config
Usage: /usr/local/mysql/bin/mysql_config [OPTIONS]
Options:
–cflags [-I/usr/local/mysql/include -g -Os -arch i386 -fno-common -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DIGNORE_SIGHUP_SIGQUIT -DDONT_DECLARE_CXA_PURE_VIRTUAL]
–include [-I/usr/local/mysql/include]
–libs [-L/usr/local/mysql/lib -lmysqlclient -lz -lm -lmygcc]
–libs_r [-L/usr/local/mysql/lib -lmysqlclient_r -lz -lm -lmygcc]
–plugindir [/usr/local/mysql/lib/plugin]
–socket [/tmp/mysql.sock]
–port [0]
–version [5.1.36]
–libmysqld-libs [-L/usr/local/mysql/lib -lmysqld -ldl -lz -lm -lmygcc]

2. 把cflags的都複製起來,放到ARCHFLAGS裡
sudo env ARCHFLAGS="-g -Os -arch i386 -fno-common -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DIGNORE_SIGHUP_SIGQUIT -DDONT_DECLARE_CXA_PURE_VIRTUAL" gem install mysql — –with-mysql-config=/usr/local/mysql/bin/mysql_config

3.然後去/Library/Ruby/Gems/1.8/gems/mysql-*/
再打下面這堆
sudo env ARCHFLAGS="-g -Os -arch i386 -fno-common -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DIGNORE_SIGHUP_SIGQUIT -DDONT_DECLARE_CXA_PURE_VIRTUAL" ruby extconf.rb –with-mysql-include=/usr/local/mysql/include –with-mysql-lib=/usr/local/mysql/lib –with-mysql-dir=/usr/local/mysql –with-mysql-config=/usr/local/mysql/bin/mysql_config

4. 接著就
make
make install 就成功了

參考 http://cho.hapgoods.com/wordpress/?p=158

ps.其實我本來是裝64bit的mysql照著這樣的步驟都不能成功,改裝32bit的mysql就成功了,真奇怪

 

finally work

Filed under: Uncategorized — kevinlin @ 4:35 下午
Tags:

Ror in mac connect to mysql

#gem install mysql — —with-mysql-config=/usr/local/mysql/bin/mysql_config