Monday, October 30, 2006

A Big Progress

A stupid mistake disturbed me for many days!!! Damn.
When I was trying to drawing a mesh, I've assigned a right transformation matrix, but I've forgot to restore that to the original one, that causes smaller mesh become smaller, further mesh become further #- -

Now the next step is make it support texture, and support cG interface.

What I've done for this:
  1. Flexible, extensible architecture (more percisely should be called as a framework)
  2. Full featured customed Mesh Model (.x Mesh loading, .lcbm Mesh Loading, and .lcbm persistent, .x text mesh persistent), 6000 faster than DirectX's built-in .x mesh loader
  3. Full featured camera controller
  4. DirectX UI RAD Designer (Design a DXUI is as easy as you can do in VS.NET's RAD mode)

And i've forgot to say what it is, I'm planning to use this demo, a Virtual Classroom to request another big project, Virtual School, haha, that will be pretty cool!!!

A simple pascal compiler

The subject Compiler's Principle, the professor asked me to build a simple pascal's compiler, from tokenlization to code generation, except the optimization part, to earn the full scores in experiment. and I did, that doesn't spend me too much time, all codes I wrote manually, no any connections with yacc,lex,flex,bision,antlr, and all this sorts of tools.

After all the experiments are done, I may open the source of the compiler, that's not complex, and that's a good tutorial for the beginners.

May be the professor will ask me to build a coressponding virtual machine to run the generated code. that'll be a big problem :(
The architecture's description (Without the instruction set):
Architecture of the Virtual Machine:

The VM is a stack-based structure, have no any general registers, all the operation are done via stack operations.
Inner registers(inaccessible in the the assembly):
Instruction Pointer Register
Return value Register
Call Stack Register
Stack Frame Register

The VM's architecture depends on two sorts of stack, one is Call Stack, element of the stack is StackFrame,
and the Stack Frame contains the second stack, the operation stack.
That's, whatevery what's in the current stack, it will not be able to affect the next invokation.

VM Context will contains:
Call Stack - Stores all stack frames, when the size is 0, the program will end.
Registers - Including the instruction pointer register, return value register
Code Segment- Points to the actual code in the memory.

Stack Frame will contains:
Procedure Configure Block - Configure the resources used by the current procedure
Instruction Pointer - Used to store temporarily IP when a new stack frame pushed into the call stack
Parameters - The caller will put the top data in the stack into this place, the number of parameters is specified by the PCB.
Data Stack - The data stack, size will be specified by the PCB
Local Variants - Same as Parameters, but it will not copy top datas in the caller's stack

The definition of return value: A running procedure, the top data in the stack will be sent to the RV register

Procedure Configure Block
Stack Configure:
maxstack n 16 bits, the maximum of stack (can be ignored in the VM, only needed while optimization and JIT generation used in high performance)
arguments n 16 bits, the count of parameters of current procedure
locals n 16bits, the count of local variants.

Friday, October 20, 2006

Good book met bad translator... ...

NVIDIA recommended four books, but only half of them are published in China.
I owned <GPU Gems> and <The Cg Tutorial>'s chinese translated version.
The <GPU Gems> have many authors, it's translators have many either. the different experiences of these different translators caused this book have many translation style, that's a big weakness of this nice book.

These days I'm hanging on the <The Cg Tutorial>, even if it's a quite old book( published in 2004), but the old cannot cover it's brilliance, the same as <GPU Gems> it's blemish is translation, many glossaries is wrong.

Wednesday, October 18, 2006

So boring... ...

Everyday facing my screen, facing my book.
Maybe I'm insane, I shouldn't spend so much time to achieve my dream, I'm wasting my youth, my life.

i'm escaping too much, but I know, it's not ready to repick my confidence.
wait to the next week, wait for my project's been accepted by school, and, take a rest?find a girlfriend? or still continue on my dream? too many issues disturbing me.

I wish one day I can think where to have dinner instead of functional programming, where to hang around with my friends instead of collision detection, where to share my emotion with my girlfriend instead of shadow volume.

no pain, no gain. hope i'm on my right way... ... fuck!
Left is my shelf in my dorm, and right picture is my bedroom (my home), haha, only thing can make me proud :(

Another Blog

This blog I've registered many months ago. but there the China Telecom had banned the blogspot's address. the monopolization always shame! Before this Blog, i got few, but maybe I don't have the interesting in blogging, they are wasted.

And these days I heard the China Telecom started to ban router, I'm angry! What the hell it's doing! Any one who wants to use internet must use single telephone line to access in, no share and no tolerate any more!