public void Init() { m_lstpolys = new List<Polygon>(); m_lstpoints = new List<Point3d>(); m_center = new Point3d(); m_name = "Model"; m_fullname = "Model"; m_min = new Point3d(); m_max = new Point3d(); m_visible = true; m_radius = 0.0f; material = new Material(); tag = Object3d.OBJ_NORMAL; m_listid = -1; }
public void Init() { m_lstpolys = new ArrayList(); m_lstpoints = new ArrayList(); m_center = new Point3d(); m_name = "Model"; m_fullname = "Model"; m_min = new Point3d(); m_max = new Point3d(); m_visible = true; m_radius = 0.0; m_support = false; material = new Material(); m_showalpha = false; }
void ProcessTexMapChunk(ThreeDSChunk chunk, Material m) { while (chunk.BytesRead < chunk.Length) { ThreeDSChunk child = new ThreeDSChunk(reader); switch ((Groups)child.ID) { case Groups.C_MATMAPFILE: string name = ProcessString(child); Console.WriteLine(" Texture File: {0}", name); /* Bitmap bmp; try { bmp = new Bitmap(base_dir + name); } catch (Exception e) { // couldn't find the file Console.WriteLine(" ERROR: could not load file '{0}'", base_dir + name); break; } // Flip image (needed so texture are the correct way around!) bmp.RotateFlip(RotateFlipType.RotateNoneFlipY); System.Drawing.Imaging.BitmapData imgData = bmp.LockBits(new Rectangle(new Point(0, 0), bmp.Size), System.Drawing.Imaging.ImageLockMode.ReadOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb); // System.Drawing.Imaging.PixelFormat.Format24bppRgb ); m.BindTexture(imgData.Width, imgData.Height, imgData.Scan0); bmp.UnlockBits(imgData); bmp.Dispose(); */ break; default: SkipChunk(child); break; } chunk.BytesRead += child.BytesRead; } }
void ProcessMaterialChunk(ThreeDSChunk chunk) { string name = string.Empty; Material m = new Material(); while (chunk.BytesRead < chunk.Length) { ThreeDSChunk child = new ThreeDSChunk(reader); switch ((Groups)child.ID) { case Groups.C_MATNAME: name = ProcessString(child); Console.WriteLine("Material: {0}", name); break; case Groups.C_MATAMBIENT: m.Ambient = ProcessColorChunk(child); break; case Groups.C_MATDIFFUSE: m.Diffuse = ProcessColorChunk(child); break; case Groups.C_MATSPECULAR: m.Specular = ProcessColorChunk(child); break; case Groups.C_MATSHININESS: m.Shininess = ProcessPercentageChunk(child); //Console.WriteLine ( "SHININESS: {0}", m.Shininess ); break; case Groups.C_MATMAP: ProcessPercentageChunk(child); //SkipChunk ( child ); ProcessTexMapChunk(child, m); break; default: SkipChunk(child); break; } chunk.BytesRead += child.BytesRead; } materials.Add(name, m); }