本文整理汇总了C++中CDebug类的典型用法代码示例。如果您正苦于以下问题:C++ CDebug类的具体用法?C++ CDebug怎么用?C++ CDebug使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CDebug类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: WinMain
//.........这里部分代码省略.........
// バックバッファフォーマットはディスプレイモードに合わせて使う
presentParameter.BackBufferFormat = displayMode.Format;
// 映像信号に同期してフリップする
presentParameter.SwapEffect = D3DSWAPEFFECT_DISCARD;
// ウィンドウモード
presentParameter.Windowed = TRUE;
// デプスバッファ(Zバッファ)とステンシルバッファを作成
presentParameter.EnableAutoDepthStencil = TRUE;
// デプスバッファの利用方法
// D3DFMT_D16 デプスバッファのみを16bitとして扱う
// D3DFMT_D24S8 デプスバッファを24bit ステンシルバッファを8bitとして扱う
presentParameter.AutoDepthStencilFormat = D3DFMT_D24S8;
// ウィンドウモード
presentParameter.FullScreen_RefreshRateInHz = 0;
presentParameter.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;
//--------------------------------------------------------------------
direct3D->CreateDevice(D3DADAPTER_DEFAULT,
D3DDEVTYPE_HAL,
windowHandle,
D3DCREATE_HARDWARE_VERTEXPROCESSING,
&presentParameter,
&device);
CDebug* debug = new CDebug();
debug->Init(device);
CKeyboard* keyboard = new CKeyboard();
keyboard->Init(_instanceHandle, windowHandle);
CMouse* mouse = new CMouse();
mouse->Init(_instanceHandle, windowHandle);
CWiiController* wiiController = new CWiiController();
// メッセージループ
for (;;)
{
if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
{
if (msg.message == WM_QUIT)
{
// PostQuitMessage()が呼ばれたらループ終了
break;
}
else
{
// メッセージの翻訳とディスパッチ
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
else
{
currentTime = timeGetTime();
if ((currentTime - LastTimeFPS) >= 500)
示例2: Start
void CError::Start ( char* fname )
{
if ( fname != 0x0 && strlen(fname) > 0 ) {
// Read error message file. NOT YET IMPLEMENTED
} else {
debug.Print ( "error", "No error file loaded." );
}
debug.Print ( "error", "Error handler started." );
m_bStarted = true;
}
示例3: OutputMessage
void CError::OutputMessage ()
{
// Create sysbox message
std::string box_msg;
box_msg = "Subsystem: " + m_ErrorSubsys + "\n\n";
box_msg += "Error: " + m_ErrorMsg + "\n";
if ( m_ErrorExtra.length() > 0) box_msg += "Info: " + m_ErrorExtra + "\n";
if ( m_ErrorFix.length() > 0) box_msg += "\nFix: " + m_ErrorFix + "\n";
if ( m_ErrorID.length() > 0 ) box_msg += "Error ID: " + m_ErrorID + "\n";
if ( m_ErrorFunc.length() > 0 ) box_msg += "Function: " + m_ErrorFunc + "\n";
// Error output to debug file
debug.PrintErr ( m_ErrorID, m_ErrorSubsys, m_ErrorMsg, box_msg );
}
示例4: RecreateOctree
void RecreateOctree()
{
// You will not need this function for the octree. It is just for the tutorial
// every time we change our subdivision information.
g_EndNodeCount = 0; // Reset the end node count
g_Debug.Clear(); // Clear the list of debug lines
g_Octree.DestroyOctree(); // Destroy the octree and start again
// Get the new scene dimensions since we destroyed the previous octree
g_Octree.GetSceneDimensions(g_pVertices, g_NumberOfVerts);
// Create our new octree with the new subdivision information
g_Octree.CreateNode(g_pVertices, g_NumberOfVerts, g_Octree.GetCenter(), g_Octree.GetWidth());
}
示例5: RenderScene
void RenderScene()
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity(); // Reset The matrix
// Position the camera
g_Camera.Look();
// Each frame we calculate the new frustum. In reality you only need to
// calculate the frustum when we move the camera.
g_Frustum.CalculateFrustum();
// Initialize the total node count that is being draw per frame
g_TotalNodesDrawn = 0;
/////// * /////////// * /////////// * NEW * /////// * /////////// * /////////// *
// Here we draw the octree, starting with the root node and recursing down each node.
// This time, we pass in the root node and just the original world model. You could
// just store the world in the root node and not have to keep the original data around.
// This is up to you. I like this way better because it's easy, though it could be
// more error prone.
g_Octree.DrawOctree(&g_Octree, &g_World);
// Render the cubed nodes to visualize the octree (in wire frame mode)
if( g_bDisplayNodes )
g_Debug.RenderDebugLines();
// Create a buffer to store the octree information for the title bar
static char strBuffer[255] = {0};
// Display in window mode the current subdivision information. We now display the
// max triangles per node, the max level of subdivision, total end nodes, current nodes drawn
// and frames per second we are receiving.
sprintf(strBuffer, "Triangles: %d Subdivisions: %d EndNodes: %d NodesDraw: %d FPS: %s",
g_MaxTriangles, g_MaxSubdivisions, g_EndNodeCount, g_TotalNodesDrawn, g_strFrameRate);
/////// * /////////// * /////////// * NEW * /////// * /////////// * /////////// *
// Set our window title bar to the subdivision information
SetWindowText(g_hWnd, strBuffer);
// Swap the backbuffers to the foreground
SwapBuffers(g_hDC);
}
示例6: RenderScene
void RenderScene()
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear The Screen And The Depth Buffer
glLoadIdentity(); // Reset The matrix
// Give OpenGL our camera position
g_Camera.Look();
/////// * /////////// * /////////// * NEW * /////// * /////////// * /////////// *
// Each frame we calculate the new frustum. In reality you only need to
// calculate the frustum when we move the camera.
g_Frustum.CalculateFrustum();
// Initialize the total node count that is being draw per frame
g_TotalNodesDrawn = 0;
/////// * /////////// * /////////// * NEW * /////// * /////////// * /////////// *
// Here we draw the octree, starting with the root node and recursing down each node.
// When we get to each of the end nodes we will draw the vertices assigned to them.
g_Octree.DrawOctree(&g_Octree);
// Render the cube'd nodes to visualize the octree (in wire frame mode)
g_Debug.RenderDebugLines();
SwapBuffers(g_hDC); // Swap the backbuffers to the foreground
char strBuffer[255] = {0}; // Create a character buffer
// To view our octree information I set the window's title bar to the some basic
// information such as the max triangles per node, the max subdivisions,
// total end nodes and the total drawn end nodes that are currently in the frustum.
// Display in window mode the current subdivision information
sprintf(strBuffer, "MaxTriangles: %d MaxSubdivisions: %d TotalEndNodes: %d TotalNodesDraw: %d",
g_MaxTriangles, g_MaxSubdivisions, g_EndNodeCount, g_TotalNodesDrawn);
// Set our window title bar to the subdivision data
SetWindowText(g_hWnd, strBuffer);
}
示例7: CreateNode
void COctree::CreateNode(CVector3 *pVertices, int numberOfVerts, CVector3 vCenter, float width)
{
// This is our main function that creates the octree. We will recurse through
// this function until we finish subdividing. Either this will be because we
// subdivided too many levels or we divided all of the triangles up.
// Create a variable to hold the number of triangles
int numberOfTriangles = numberOfVerts / 3;
// Initialize this node's center point. Now we know the center of this node.
m_vCenter = vCenter;
// Initialize this nodes cube width. Now we know the width of this current node.
m_Width = width;
// Add the current node to our debug rectangle list so we can visualize it.
// We can now see this node visually as a cube when we render the rectangles.
// Since it's a cube we pass in the width for width, height and depth.
g_Debug.AddDebugRectangle(vCenter, width, width, width);
// Check if we have too many triangles in this node and we haven't subdivided
// above our max subdivisions. If so, then we need to break this node into
// 8 more nodes (hence the word OCTree). Both must be true to divide this node.
if( (numberOfTriangles > g_MaxTriangles) && (g_CurrentSubdivision < g_MaxSubdivisions) )
{
// Since we need to subdivide more we set the divided flag to true.
// This let's us know that this node does NOT have any vertices assigned to it,
// but nodes that perhaps have vertices stored in them (Or their nodes, etc....)
// We will querey this variable when we are drawing the octree.
m_bSubDivided = true;
// Create a list for each new node to store if a triangle should be stored in it's
// triangle list. For each index it will be a true or false to tell us if that triangle
// is in the cube of that node. Below we check every point to see where it's
// position is from the center (I.E. if it's above the center, to the left and
// back it's the TOP_LEFT_BACK node). Depending on the node we set the pList
// index to true. This will tell us later which triangles go to which node.
// You might catch that this way will produce doubles in some nodes. Some
// triangles will intersect more than 1 node right? We won't split the triangles
// in this tutorial just to keep it simple, but the next tutorial we will.
// Create the list of booleans for each triangle index
vector<bool> pList1(numberOfTriangles); // TOP_LEFT_FRONT node list
vector<bool> pList2(numberOfTriangles); // TOP_LEFT_BACK node list
vector<bool> pList3(numberOfTriangles); // TOP_RIGHT_BACK node list
vector<bool> pList4(numberOfTriangles); // TOP_RIGHT_FRONT node list
vector<bool> pList5(numberOfTriangles); // BOTTOM_LEFT_FRONT node list
vector<bool> pList6(numberOfTriangles); // BOTTOM_LEFT_BACK node list
vector<bool> pList7(numberOfTriangles); // BOTTOM_RIGHT_BACK node list
vector<bool> pList8(numberOfTriangles); // BOTTOM_RIGHT_FRONT node list
// Create this variable to cut down the thickness of the code below (easier to read)
CVector3 vCtr = vCenter;
// Go through all of the vertices and check which node they belong too. The way
// we do this is use the center of our current node and check where the point
// lies in relationship to the center. For instance, if the point is
// above, left and back from the center point it's the TOP_LEFT_BACK node.
// You'll see we divide by 3 because there are 3 points in a triangle.
// If the vertex index 0 and 1 are in a node, 0 / 3 and 1 / 3 is 0 so it will
// just set the 0'th index to TRUE twice, which doesn't hurt anything. When
// we get to the 3rd vertex index of pVertices[] it will then be checking the
// 1st index of the pList*[] array. We do this because we want a list of the
// triangles in the node, not the vertices.
for(int i = 0; i < numberOfVerts; i++)
{
// Create some variables to cut down the thickness of the code (easier to read)
CVector3 vPoint = pVertices[i];
// Check if the point lines within the TOP LEFT FRONT node
if( (vPoint.x <= vCtr.x) && (vPoint.y >= vCtr.y) && (vPoint.z >= vCtr.z) )
pList1[i / 3] = true;
// Check if the point lines within the TOP LEFT BACK node
if( (vPoint.x <= vCtr.x) && (vPoint.y >= vCtr.y) && (vPoint.z <= vCtr.z) )
pList2[i / 3] = true;
// Check if the point lines within the TOP RIGHT BACK node
if( (vPoint.x >= vCtr.x) && (vPoint.y >= vCtr.y) && (vPoint.z <= vCtr.z) )
pList3[i / 3] = true;
// Check if the point lines within the TOP RIGHT FRONT node
if( (vPoint.x >= vCtr.x) && (vPoint.y >= vCtr.y) && (vPoint.z >= vCtr.z) )
pList4[i / 3] = true;
// Check if the point lines within the BOTTOM LEFT FRONT node
if( (vPoint.x <= vCtr.x) && (vPoint.y <= vCtr.y) && (vPoint.z >= vCtr.z) )
pList5[i / 3] = true;
// Check if the point lines within the BOTTOM LEFT BACK node
if( (vPoint.x <= vCtr.x) && (vPoint.y <= vCtr.y) && (vPoint.z <= vCtr.z) )
pList6[i / 3] = true;
// Check if the point lines within the BOTTOM RIGHT BACK node
if( (vPoint.x >= vCtr.x) && (vPoint.y <= vCtr.y) && (vPoint.z <= vCtr.z) )
pList7[i / 3] = true;
// Check if the point lines within the BOTTOM RIGHT FRONT node
if( (vPoint.x >= vCtr.x) && (vPoint.y <= vCtr.y) && (vPoint.z >= vCtr.z) )
pList8[i / 3] = true;
//.........这里部分代码省略.........
示例8: delete
// User-defined operator delete.
void operator delete( void *pvMem )
{
debug.Printf ( "DELETE %p\n", pvMem );
free ( pvMem );
}
示例9: new
// User-defined operator new.
void *operator new( size_t stSize )
{
void* pvMem = malloc( stSize );
debug.Printf ( "NEW %p (%d bytes)\n", pvMem, stSize );
return pvMem;
}
示例10: Exit
void CError::Exit ( int code )
{
debug.Exit ( code );
}