{
C_PRIMARY = 0x4D4D,
C_OBJECTINFO = 0x3D3D,
C_VERSION = 0x0002,
C_EDITKEYFRAME = 0xB000,
C_MATERIAL = 0xAFFF,
C_MATNAME = 0xA000,
C_MATAMBIENT = 0xA010,
C_MATDIFFUSE = 0xA020,
C_MATSPECULAR = 0xA030,
C_MATSHININESS = 0xA040,
C_MATMAP = 0xA200,
C_MATMAPFILE = 0xA300,
C_OBJECT = 0x4000,
C_OBJECT_MESH = 0x4100,
C_OBJECT_VERTICES = 0x4110,
C_OBJECT_FACES = 0x4120,
C_OBJECT_MATERIAL = 0x4130,
C_OBJECT_UV = 0x4140
}
#endregion
#region Vars
Dictionary < string, Material > materials = new Dictionary < string, Material > ();
string base_dir;
BinaryReader reader;
double maxX, maxY, maxZ, minX, minY, minZ;
int version = -1;
#endregion
#region public properties
Model model = new Model ();
public Model Model {
get {
return model;
}
}
public int Version {
get {
return version;
}
}
public double MaxX {
get {
return maxX;
}
}
public double MaxY {
get {
return maxY;
}
}
public double MaxZ {
get {
return maxZ;
}
}
public double MinX {
get {
return minX;
}
}
public double MinY {
get {
return minY;
}
}
public double MinZ {
get {
return minZ;
}
}
#endregion
#region Constructors
public ThreeDSFile ( string file_name )
{
if (string. IsNullOrEmpty(file_name))
{
throw new ArgumentNullException("file_name");
}
if (!File. Exists(file_name))
{
throw new ArgumentException("3ds file could not be found", "file_name");
}
base_dir = new FileInfo ( file_name ).DirectoryName + "/";
maxX = maxY = maxZ = double. MinValue;
minX = minY = minZ = double. MaxValue;
FileStream file = null;
try
{
file = new FileStream(file_name, FileMode. Open, FileAccess. Read);
reader = new BinaryReader ( file );
reader. BaseStream. Seek (0, SeekOrigin. Begin);
ThreeDSChunk chunk = new ThreeDSChunk ( reader );
|
Из за большого объема этот материал размещен на нескольких страницах:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |


