About Store Forum Documentation Contact
Donations:
309$/mo



Post Reply 
My first crash report!
Author Message
Rubeus Offline
Member

Post: #1
My first crash report!
Got this while working in the code editor:

Code:
Problem signature:
  Problem Event Name:    APPCRASH
  Application Name:    Esenthel 64.exe
  Application Version:    1.0.0.0
  Application Timestamp:    51c70c72
  Fault Module Name:    ntdll.dll
  Fault Module Version:    6.1.7601.17725
  Fault Module Timestamp:    4ec4aa8e
  Exception Code:    c00000fd
  Exception Offset:    000000000005507f
  OS Version:    6.1.7601.2.1.0.256.48
  Locale ID:    1033
  Additional Information 1:    d0ed
  Additional Information 2:    d0ede5fcd386f4817f1cb1bbcdb481d8
  Additional Information 3:    ddc8
  Additional Information 4:    ddc82295ad2880523e42e4b55fd15c2d

That doesn't show much, but this is the code file I was working on:
Code:
/******************************************************************************/
// This is the shape creater for the Isohedrothingy
/******************************************************************************/
class Icosahedron
{
   #define COL_DEF GREEN
public:
   void                 AddLen         ( Mesh &mesh, flt  Size = 1  );        // Adds "Sizing" to the length of the object's verts.
   void                 Create         ( Mesh &mesh, byte Divs = 1  );        // Create the mesh
   void                 SubDiv         ( Mesh &mesh, byte Divs = 1  );        // Add subdivisions to the mesh to smooth it out
private:                                                    
   float                PHI = ( 1 + Sqrt( 5 ) ) / 2                   ;       // Define PHI
  
   void                 SetTexCrd      ( Mesh &mesh                  );       // Set the texture coordinates; doesn't work quite right currently
   void                 SetColors      ( Mesh &mesh                  );       // Set the Vertex colors
   void                 SetColors      ( Mesh &mesh, Color &color    );       // Set the Vertex colors to ~color
   void                 SetPoints      ( Mesh &mesh                  );       // Fill the InitialPoints array
   void                 SetTris        ( Mesh &mesh                  );       // Set the vertices each face uses
}
/******************************************************************************/
void Icosahedron.SetPoints( Mesh &mesh )
{
   /*
   Set up as:
      (+-1, +-PHI, 0)
      (0, +-1, +-PHI)
      (+-PHI, 0, +-1)
   */
   if( !mesh.is(  ) ||  !mesh.parts.elms(  ) ||  !mesh.parts[0].base.vtxs(  ) )
      return;
   mesh.parts[0].base.vtx.pos( 0  ).set(   -1,  PHI,    0 );                  // Set the initial places
   mesh.parts[0].base.vtx.pos( 1  ).set(    1,  PHI,    0 );
   mesh.parts[0].base.vtx.pos( 2  ).set(   -1, -PHI,    0 );
   mesh.parts[0].base.vtx.pos( 3  ).set(    1, -PHI,    0 );
  
   mesh.parts[0].base.vtx.pos( 4  ).set(    0,   -1,  PHI );
   mesh.parts[0].base.vtx.pos( 5  ).set(    0,    1,  PHI );
   mesh.parts[0].base.vtx.pos( 6  ).set(    0,   -1, -PHI );
   mesh.parts[0].base.vtx.pos( 7  ).set(    0,    1, -PHI );
  
   mesh.parts[0].base.vtx.pos( 8  ).set(  PHI,    0,   -1 );
   mesh.parts[0].base.vtx.pos( 9  ).set(  PHI,    0,    1 );
   mesh.parts[0].base.vtx.pos( 10 ).set( -PHI,    0,   -1 );
   mesh.parts[0].base.vtx.pos( 11 ).set( -PHI,    0,    1 );
  
   FREP( mesh.parts[0].base.vtxs(  ) )
      mesh.parts[0].base.vtx.pos( i ).normalize(  );
}
/******************************************************************************/
void Icosahedron.SetTris( Mesh &mesh )
{
   if( !mesh.is(  ) ||  !mesh.parts.elms(  ) ||  !mesh.parts[0].base.vtxs(  ) )
      return;
   MeshBase &base = mesh.parts[0].base;
   base.tri.ind( 0  ).set(  0, 11,  5 );                                      // Set the faces. 5 edges per vert
   base.tri.ind( 1  ).set(  0,  5,  1 );
   base.tri.ind( 2  ).set(  0,  1,  7 );
   base.tri.ind( 3  ).set(  0,  7, 10 );
   base.tri.ind( 4  ).set(  0, 10, 11 );
  
   base.tri.ind( 5  ).set(  1,  5,  9 );
   base.tri.ind( 6  ).set(  5, 11,  4 );
   base.tri.ind( 7  ).set( 11, 10,  2 );
   base.tri.ind( 8  ).set( 10,  7,  6 );
   base.tri.ind( 9  ).set(  7,  1,  8 );
  
   base.tri.ind( 10 ).set(  3,  9,  4 );
   base.tri.ind( 11 ).set(  3,  4,  2 );
   base.tri.ind( 12 ).set(  3,  2,  6 );
   base.tri.ind( 13 ).set(  3,  6,  8 );
   base.tri.ind( 14 ).set(  3,  8,  9 );
  
   base.tri.ind( 15 ).set(  4,  9,  5 );
   base.tri.ind( 16 ).set(  2,  4, 11 );
   base.tri.ind( 17 ).set(  6,  2, 10 );
   base.tri.ind( 18 ).set(  8,  6,  7 );
   base.tri.ind( 19 ).set(  9,  8,  1 );  
  
   base.setNormals(  );                                                       // Set automatic vertex normals
}
/******************************************************************************/
void Icosahedron.Create( Mesh &mesh, byte Divs )
{
   mesh.parts.New(  ).base.create( 12, 0, 20, 0,                              // Create a new part and base with 12 vertexes, 20 triangles
      NRM_ALL|VTX_TEX0|VTX_POS|VTX_COLOR );  
   SetPoints      ( mesh );                                                   // Create the points in 3D space        
   SetTris        ( mesh );                                                   // Connect the points to make triangles
   SubDiv  ( mesh, Divs );                                                    // Set the starting number of verts
}
/******************************************************************************/
void Icosahedron.SetTexCrd( Mesh &mesh )
{
   if( !mesh.is(  ) ||  !mesh.parts.elms(  ) ||  !mesh.parts[0].base.vtxs(  ) )
      return;
   float scale = 1.0;
   FREP( mesh.parts[0].base.vtxs(  ) )                                        // Iterate verts
   {
      Vec ref = !mesh.parts[0].base.vtx.pos( i );                             // Make a normalized copy
      mesh.parts[0].base.vtx.tex0(i).set(                                     // Set the vertex coords
         ( 0.5 - Angle( ref.xz(  ) ) * ( 1 / PI2 ) ) * scale,                 // U
           0.5 - ( 2 * Atan(                                                  // V
              ref.y / ( 1 + Sqrt( 1 - ( ref.y * ref.y ) ) ) )                 // Use Atan to calculate Asin
           ) * ( 1 / PI ) ) * scale;  
      //(float)(0.5 - Math.Atan2(vertex.Position.X, vertex.Position.Z) * Abs.TwoPI_RECIPROCAL);
      //(float)(0.5 - Math.Asin(vertex.Position.Y) * Abs.PI_RECIPROCAL);      
                      
   }
}
/******************************************************************************/
void Icosahedron.SubDiv( Mesh &mesh, byte divs )
{
   if( !mesh.is(  ) ||  !mesh.parts.elms(  ) ||  !mesh.parts[0].base.vtxs(  ) )
      return;                                                                 // return if there is no mesh
   FREP( divs )
   mesh.subdivide    (      );                                                // Make it rounder
   mesh.setNormals   (      );                                                // Set the normals
   mesh.setAutoTanBin(      );                                                // Calculate tangents and binormals if needed
   mesh.setBox       (      );                                                // Recalculate bounding box from vertexes
   mesh.setRender    (      );                                                // Set to rendering version
      //SetTexCrd    ( mesh );                                                // Set the texture coordinates of the sphere
}
/******************************************************************************/
void Icosahedron.AddLen( Mesh &mesh, flt Size )
{
   if( !mesh.is(  ) ||  !mesh.parts.elms(  ) ||  !mesh.parts[0].base.vtxs(  ) )
      return;
      
   FREP( mesh.parts[0].base.vtxs(  ) )                                     // Iterate the verts
   {
      Vec &x = mesh.parts[0].base.vtx.pos( i );
      x += !x * Size;                                                      // Add the length to the verts
   }
   mesh.setBox   (  );
   mesh.setRender(  );
}
/******************************************************************************/
void Icosahedron.SetColors( Mesh &mesh, Color &color )
{
   if( !mesh.is(  ) ||  !mesh.parts.elms(  ) ||  !mesh.parts[0].base.vtxs(  ) )
      return;
   FREP( mesh.parts[0].base.vtxs(  ) )                                        // Iterate verts
      mesh.parts[0].base.vtx.color(i).set(
        
         color.a );
}
/******************************************************************************/
void Icosahedron.SetColors( Mesh &mesh               )
{
   if( !mesh.is(  ) ||  !mesh.parts.elms(  ) ||  !mesh.parts[0].base.vtxs(  ) )
      return;
   FREP( mesh.parts[0].base.vtxs(  ) )                                        // Iterate verts
      mesh.parts[0].base.vtx.color(i).set(
         COL_DEF.r, COL_DEF.g, COL_DEF.b, COL_DEF.a );

}

For whatever reason, it crashes whenever I try to make a curly brace after the FREP line(line 140) in the "void Icosahedron.SetColors( Mesh &mesh, Color &color )" function(the other SetColors function it works fine).
-If I copy and paste the function to a new project, it's fine-If I copy this whole file, it crashes.
-Creating the braces behind the comment works, but before the comment or on the line after causes it to crash.
-I can create the braces after the vtx color set call without an issue. If I copy and paste a pair of curly braces, it doesn't crash, but then it does if I delete the closing brace.

I need to get paid for all this QA I'm doing. smile
(If this isn't one of those 1-in-a-million "How did you even find this??"-type crashes, I'll eat my hat.)
06-29-2013 11:06 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #2
RE: My first crash report!
Many thanks, it wasn't easy but I managed to find and fix the problem smile it will work ok in next release.

Quote:I need to get paid for all this QA I'm doing. smile
I once was able to find and report a bug in Microsoft VS C++ compiler.
My imagination on the reply from MS: "Thank you so much, we'll be happy to reward you with 1,000$"
Reality: "Thanks, we've investigated the issue and fixed the problem"

yeah wink
06-30-2013 03:38 PM
Find all posts by this user Quote this message in a reply
Rubeus Offline
Member

Post: #3
RE: My first crash report!
Haha, fair enough. I'm happy to contribute. grin
06-30-2013 05:22 PM
Find all posts by this user Quote this message in a reply
Post Reply