Sign in to follow this  

Loading mesh using DXUT and my own class

This topic is 3110 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi! I've started to learn Directx 10 and i've decided to write my own class that would create object, load mesh, set cords, rotation, scale and so on. And i have problem when i try to load mesh. A read tutorial here -> http://msdn.microsoft.com/en-us/library/bb172493(VS.85).aspx After that i created my class
#include "DXUT.h"
#include "DXUTmisc.h"
#include "SDKmisc.h"
#include "SDKmesh.h"

class Object
{
public:
    CDXUTMesh10 g_Mesh;

    // Define the input layout
    const D3D10_INPUT_ELEMENT_DESC layout[] =
    {
        { L"POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D10_INPUT_PER_VERTEX_DATA, 0 },
        { L"NORMAL", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 12, D3D10_INPUT_PER_VERTEX_DATA, 0 },
        { L"TEXCOORD0", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 24, D3D10_INPUT_PER_VERTEX_DATA, 0 },
    };


	Object(WCHAR* path, ID3D10Device* pd3dDevice)
	{
		// Load the mesh
		V_RETURN( g_Mesh.Create( pd3dDevice, path, (D3D10_INPUT_ELEMENT_DESC*)layout, 3 ) );
	}

	~Object()
	{
		g_Mesh.Destroy();
	}

	void Render(ID3D10Device* pd3dDevice,)
	{
		pd3dDevice->IASetInputLayout( g_pVertexLayout );
		g_Mesh.Render( pd3dDevice, g_pEffect, g_pTechnique );
	}
};
And i get some errors: 1>c:\users\pedro\documents\visual studio projects\dx\propulsion\directxsamples\propulsion_using_dx10\object.h(9) : error C2146: syntax error : missing ';' before identifier 'g_Mesh' 1>c:\users\pedro\documents\visual studio projects\dx\propulsion\directxsamples\propulsion_using_dx10\object.h(9) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1>c:\users\pedro\documents\visual studio projects\dx\propulsion\directxsamples\propulsion_using_dx10\object.h(9) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1>c:\users\pedro\documents\visual studio projects\dx\propulsion\directxsamples\propulsion_using_dx10\object.h(13) : error C2059: syntax error : '{' 1>c:\users\pedro\documents\visual studio projects\dx\propulsion\directxsamples\propulsion_using_dx10\object.h(13) : error C2334: unexpected token(s) preceding '{'; skipping apparent function body 1>c:\users\pedro\documents\visual studio projects\dx\propulsion\directxsamples\propulsion_using_dx10\object.h(31) : error C2059: syntax error : ')' 1>c:\users\pedro\documents\visual studio projects\dx\propulsion\directxsamples\propulsion_using_dx10\object.h(32) : error C2143: syntax error : missing ')' before '{' 1>c:\users\pedro\documents\visual studio projects\dx\propulsion\directxsamples\propulsion_using_dx10\object.h(23) : error C2065: 'hr' : undeclared identifier 1>c:\users\pedro\documents\visual studio projects\dx\propulsion\directxsamples\propulsion_using_dx10\object.h(23) : error C2065: 'g_Mesh' : undeclared identifier 1>c:\users\pedro\documents\visual studio projects\dx\propulsion\directxsamples\propulsion_using_dx10\object.h(23) : error C2228: left of '.Create' must have class/struct/union 1> type is ''unknown-type'' 1>c:\users\pedro\documents\visual studio projects\dx\propulsion\directxsamples\propulsion_using_dx10\object.h(23) : error C2065: 'layout' : undeclared identifier 1>c:\users\pedro\documents\visual studio projects\dx\propulsion\directxsamples\propulsion_using_dx10\object.h(23) : error C2065: 'hr' : undeclared identifier 1>c:\users\pedro\documents\visual studio projects\dx\propulsion\directxsamples\propulsion_using_dx10\object.h(23) : error C2065: 'hr' : undeclared identifier 1>c:\users\pedro\documents\visual studio projects\dx\propulsion\directxsamples\propulsion_using_dx10\object.h(28) : error C2065: 'g_Mesh' : undeclared identifier 1>c:\users\pedro\documents\visual studio projects\dx\propulsion\directxsamples\propulsion_using_dx10\object.h(28) : error C2228: left of '.Destroy' must have class/struct/union 1> type is ''unknown-type'' 1>c:\users\pedro\documents\visual studio projects\dx\propulsion\directxsamples\propulsion_using_dx10\object.h(33) : error C2065: 'g_pVertexLayout' : undeclared identifier 1>c:\users\pedro\documents\visual studio projects\dx\propulsion\directxsamples\propulsion_using_dx10\object.h(34) : error C2065: 'g_Mesh' : undeclared identifier 1>c:\users\pedro\documents\visual studio projects\dx\propulsion\directxsamples\propulsion_using_dx10\object.h(34) : error C2228: left of '.Render' must have class/struct/union 1> type is ''unknown-type'' 1>c:\users\pedro\documents\visual studio projects\dx\propulsion\directxsamples\propulsion_using_dx10\object.h(34) : error C2065: 'g_pEffect' : undeclared identifier 1>c:\users\pedro\documents\visual studio projects\dx\propulsion\directxsamples\propulsion_using_dx10\object.h(34) : error C2065: 'g_pTechnique' : undeclared identifier I still don't know what hiding in g_pEffect and g_pTechnique, but i try to find out. Something that is more intresting is that:
    CDXUTMesh10 g_Mesh;
gives error. What i'm doing wrong? Thanks for any help! ;-)

Share this post


Link to post
Share on other sites

This topic is 3110 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this