r473: no message
[ctsim.git] / src / docs.cpp
index c9f2b3ff0af45bfbb01e3998274fc267a4bf7c42..59371ab10fd589eb751a63fedf19e43c2f91494e 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (c) 1983-2001 Kevin Rosenberg
 **
-**  $Id: docs.cpp,v 1.19 2001/01/30 07:32:13 kevin Exp $
+**  $Id: docs.cpp,v 1.20 2001/01/30 10:58:13 kevin Exp $
 **
 **  This program is free software; you can redistribute it and/or modify
 **  it under the terms of the GNU General Public License (version 2) as
@@ -373,6 +373,17 @@ TextFileDocument::getTextCtrl()
 
 IMPLEMENT_DYNAMIC_CLASS(Graph3dFileDocument, wxDocument)
 
+Graph3dFileDocument::Graph3dFileDocument(void) 
+: m_bBadFileOpen(false), m_nVertices(0), m_pVertices(0), m_pNormals(0)
+{
+}
+
+Graph3dFileDocument::~Graph3dFileDocument() 
+{
+    delete [] m_pVertices;
+    delete [] m_pNormals;
+}
+
 bool 
 Graph3dFileDocument::OnSaveDocument(const wxString& filename)
 {
@@ -403,3 +414,32 @@ Graph3dFileDocument::getView() const
   return dynamic_cast<Graph3dFileView*>(GetFirstView()); 
 }
 
+bool
+Graph3dFileDocument::createFromImageFile (const ImageFile& rImageFile)
+{
+  delete [] m_pVertices;
+  delete [] m_pNormals;
+
+  m_nx = rImageFile.nx();
+  m_ny = rImageFile.ny();
+  m_array = rImageFile.getArray();
+#if 0
+  const int nTriangles = nx * ny;
+  m_nVertices = nTriangles;
+  m_pVertices = new glTripleFloat [nTriangles];
+  m_pNormals = new glTripleFloat [nTriangles];
+
+  for (unsigned int ix = 0; ix < nx; ix++) {
+    for (unsigned int iy = 0; iy < ny; iy++) {
+      const int iTriangle = ix * iy;
+      m_pVertices[iTriangle][0] = ix;
+      m_pVertices[iTriangle][1] = iy;
+      m_pVertices[iTriangle][2] = v[ix][iy];
+      m_pNormals[iTriangle][0] = 0;
+      m_pNormals[iTriangle][1] = 0;
+      m_pNormals[iTriangle][2] = 0;
+    }
+  }
+#endif
+  return true;
+}