FileStream stream = File.OpenRead(@"path\folder\model.xaml");
Model3D xamlData = (Model3D)XamlReader.Load(stream);
code from: Mike Hodnick www.inetium.com
Tuesday, November 21, 2006
Friday, June 16, 2006
Tuesday, June 13, 2006
School work demo
A 3D Java Demo
http://psalmhundred.net/DM6101/assignment01/
A Flash Inverse Kinematics Demo
http://psalmhundred.net/DM6104/DM6104_IK_Assignment_2link.html
http://psalmhundred.net/DM6101/assignment01/
A Flash Inverse Kinematics Demo
http://psalmhundred.net/DM6104/DM6104_IK_Assignment_2link.html
Tuesday, February 21, 2006
C++: sample class
//CSprite.h
#ifndef CSPRITE_H
#define CSPRITE_H
class CSprite{
protected:
//attributes, fields, etc.
int x, y;
public:
//constructor
CSprite(){x = y = 0;};
CSprite(int x, int y);
//methods
void Move(int dx, int dy);
} ;
#endif
//CSprite.cpp
#include "CSprite.h"
CSprite::CSprite(int x, int y){
this->x = x;
this->y = y;
}
CSprite::Move(int dx, int dy){
x+=dx;
y+=dy;
}
#ifndef CSPRITE_H
#define CSPRITE_H
class CSprite{
protected:
//attributes, fields, etc.
int x, y;
public:
//constructor
CSprite(){x = y = 0;};
CSprite(int x, int y);
//methods
void Move(int dx, int dy);
} ;
#endif
//CSprite.cpp
#include "CSprite.h"
CSprite::CSprite(int x, int y){
this->x = x;
this->y = y;
}
CSprite::Move(int dx, int dy){
x+=dx;
y+=dy;
}
C++: Abstract class & methods & inheritance
// A.h
#ifndef A_H
#define A_H
class A{
protected:
//attributes, fields, etc.
public:
//pure virtual function -- abstract
void Paint()=0;
} ;
#endif
//ChildA.h
#include "A.h"
//extends from A
class ChildA: public A{
protected:
public:
//implement Paint in this class
void Paint();
};
#ifndef A_H
#define A_H
class A{
protected:
//attributes, fields, etc.
public:
//pure virtual function -- abstract
void Paint()=0;
} ;
#endif
//ChildA.h
#include "A.h"
//extends from A
class ChildA: public A{
protected:
public:
//implement Paint in this class
void Paint();
};
Visual C++: Input Linker
kernel32.lib
user32.lib
gdi32.lib
winspool.lib
comdlg32.lib
advapi32.lib
shell32.lib
ole32.lib
oleaut32.lib
uuid.lib
odbc32.lib
odbccp32.lib
dxerr.lib
dxguid.lib
d3dx9.lib
d3d9.lib
winmm.lib
comctl32.lib
dinput.lib
dsound.lib
user32.lib
gdi32.lib
winspool.lib
comdlg32.lib
advapi32.lib
shell32.lib
ole32.lib
oleaut32.lib
uuid.lib
odbc32.lib
odbccp32.lib
dxerr.lib
dxguid.lib
d3dx9.lib
d3d9.lib
winmm.lib
comctl32.lib
dinput.lib
dsound.lib
DirectX: LoadTexture
LPDIRECT3DTEXTURE9 LoadTexture(LPCWSTR filename, LPDIRECT3DDEVICE9 pd3dDevice){
LPDIRECT3DTEXTURE9 texture = NULL;
D3DXIMAGE_INFO info;
HRESULT hr;
//get width and height
V(D3DXGetImageInfoFromFile(filename, &info));
//create a new texture
V(D3DXCreateTextureFromFileEx(
pd3dDevice, // LPDIRECT3DDEVICE9 pDevice,
filename, //LPCTSTR pSrcFile,
info.Width, //Width,
info.Height, //Height,
1, //mipmap
D3DPOOL_DEFAULT, //DWORD Usage,
D3DFMT_UNKNOWN, //surface Format,
D3DPOOL_DEFAULT, //memory Pool,
D3DX_DEFAULT, //IMAGE Filter,
D3DX_DEFAULT, //MipFilter,
0, //ColorKey for transparency,
&info, //bitmap file info,
NULL, //color Palette,
&texture //destination Texture
));
return texture;
}
LPDIRECT3DTEXTURE9 texture = NULL;
D3DXIMAGE_INFO info;
HRESULT hr;
//get width and height
V(D3DXGetImageInfoFromFile(filename, &info));
//create a new texture
V(D3DXCreateTextureFromFileEx(
pd3dDevice, // LPDIRECT3DDEVICE9 pDevice,
filename, //LPCTSTR pSrcFile,
info.Width, //Width,
info.Height, //Height,
1, //mipmap
D3DPOOL_DEFAULT, //DWORD Usage,
D3DFMT_UNKNOWN, //surface Format,
D3DPOOL_DEFAULT, //memory Pool,
D3DX_DEFAULT, //IMAGE Filter,
D3DX_DEFAULT, //MipFilter,
0, //ColorKey for transparency,
&info, //bitmap file info,
NULL, //color Palette,
&texture //destination Texture
));
return texture;
}
C++: Multidimensional array
int **cells;
//allocate memory
cells = new int*[rows];
for(int i=0; i<rows; i++){
cells[i] = new int[columns];
}
//clean up
if(cells){
for(int i=0; i<rows; i++){
if(cells[i]){
delete[] cells[i];
}
}
delete[] cells;
}
Thursday, February 16, 2006
Flash MX 2004: unLoadMovie()
unLoadMovie() does not remove variables and handlers from the movie clip.
have to watch out for Key class. eg.: must Key.removeListener when unloading.
have to watch out for Key class. eg.: must Key.removeListener when unloading.
Subscribe to:
Posts (Atom)