rate up
0
rate down
Model Error
I keep getting these errors Severity Code Description Project File Line Suppression State Error C3203 'allocator': unspecialized class template can't be used as a template argument for template parameter '_Alloc', expected a real type OpenServe c:usersgarredocumentsvisual studio 2017projectsopenserveopenservestaticmodel.h 20 Error C2923 'std::vector': 'SurfaceMaterial' is not a valid template type argument for parameter '_Ty' OpenServe c:usersgarredocumentsvisual studio 2017projectsopenserveopenservestaticmodel.h 20 Error C2065 'SurfaceMaterial': undeclared identifier OpenServe c:usersgarredocumentsvisual studio 2017projectsopenserveopenservestaticmodel.h 20 Error C2061 syntax error: identifier 'Model3D' OpenServe c:usersgarredocumentsvisual studio 2017projectsopenserveopenserveskinnedmodel.h 12 Error C2061 syntax error: identifier 'Model3D' OpenServe c:usersgarredocumentsvisual studio 2017projectsopenserveopenserveskinnedmodel.h 15 Error C2061 syntax error: identifier 'Model3D' OpenServe c:usersgarredocumentsvisual studio 2017projectsopenserveopenserveskinnedmodel.h 17 On these scripts #pragma once #include "pch.h" private class SkinnedModel { public: SkinnedModel(); ~SkinnedModel(); //LoadMD5Model() function prototype bool LoadMD5Model(std::wstring filename, Model3D& MD5Model, std::vector<ID3D11ShaderResourceView*>& shaderResourceViewArray, std::vector<std::wstring> texFileNameArray); bool LoadMD5Anim(std::wstring filename, Model3D& MD5Model); void UpdateMD5Model(Model3D& MD5Model, float deltaTime, int animation); void Update(); void Render(); void CleanUp(); private: }; #pragma once #include "pch.h" private class StaticModel { public: StaticModel(); ~StaticModel(); //Define LoadObjModel function after we create surfaceMaterial structure bool LoadObjModel(std::wstring filename, //.obj filename ID3D11Buffer** vertBuff, //mesh vertex buffer ID3D11Buffer** indexBuff, //mesh index buffer std::vector<int>& subsetIndexStart, //start index of each subset std::vector<int>& subsetMaterialArray, //index value of material for each subset std::vector<SurfaceMaterial>& material, //vector of material structures int& subsetCount, //Number of subsets in mesh bool isRHCoordSys, //true if model was created in right hand coord system bool computeNormals); //true to compute the normals, false to use the files normals void Update(); void Render(); void CleanUp(); private: };
Comments
As I asume you declaration of Model3D is in pch.h. specialization of vecctor cannot be made on non existing object and your error assume that this is it
on Nov 01 `17
maxiorek82
#pragma once #include <wrl.h> #include <wrl/client.h> #include <dxgi1_4.h> #include <d3d11_3.h> #include <d2d1_3.h> #include <d2d1effects_2.h> #include <dwrite_3.h> #include <wincodec.h> #include <DirectXColors.h> #include <DirectXMath.h> #include <memory> #include <agile.h> #include <concrt.h> //Include and link appropriate libraries and headers// #pragma comment(lib, "d3d11.lib") #pragma comment(lib, "d3dx11.lib") #pragma comment(lib, "d3dx10.lib") #pragma comment (lib, "D3D10_1.lib") #pragma comment (lib, "DXGI.lib") #pragma comment (lib, "D2D1.lib") #pragma comment (lib, "dwrite.lib") #pragma comment (lib, "dinput8.lib") #pragma comment (lib, "dxguid.lib") #pragma comment (lib, "DXErr.lib") #include <windows.h> #include <d3d11.h> #include <D3D10_1.h> #include <DXGI.h> #include <D2D1.h> #include <sstream> #include <dwrite.h> ///////////////**************new**************//////////////////// #include <vector> #include <fstream> #include <istream> ///////////////**************new**************//////////////////// using namespace DirectX; using namespace Moga::Windows::Phone; struct Vertex //Overloaded Vertex Structure { Vertex() {} Vertex(float x, float y, float z, float u, float v, float nx, float ny, float nz, float tx, float ty, float tz) : pos(x, y, z), texCoord(u, v), normal(nx, ny, nz), tangent(tx, ty, tz) {} XMFLOAT3 pos; XMFLOAT2 texCoord; XMFLOAT3 normal; XMFLOAT3 tangent; XMFLOAT3 biTangent; ///////////////**************new**************//////////////////// // Will not be sent to shader int StartWeight; int WeightCount; ///////////////**************new**************//////////////////// }; //Global Declarations - Interfaces// IDXGISwapChain* SwapChain; ID3D11Device* d3d11Device; ID3D11DeviceContext* d3d11DevCon; ID3D11RenderTargetView* renderTargetView; ID3D11DepthStencilView* depthStencilView; ID3D11Texture2D* depthStencilBuffer; ID3D11VertexShader* VS; ID3D11PixelShader* PS; ID3D11PixelShader* D2D_PS; ID3D10Blob* D2D_PS_Buffer; ID3D10Blob* VS_Buffer; ID3D10Blob* PS_Buffer; ID3D11InputLayout* vertLayout; ID3D11Buffer* cbPerObjectBuffer; ID3D11BlendState* d2dTransparency; ID3D11RasterizerState* CCWcullMode; ID3D11RasterizerState* CWcullMode; ID3D11SamplerState* CubesTexSamplerState; ID3D11Buffer* cbPerFrameBuffer; ID3D10Device1 *d3d101Device; IDXGIKeyedMutex *keyedMutex11; IDXGIKeyedMutex *keyedMutex10; ID2D1RenderTarget *D2DRenderTarget; ID2D1SolidColorBrush *Brush; ID3D11Texture2D *BackBuffer11; ID3D11Texture2D *sharedTex11; ID3D11Buffer *d2dVertBuffer; ID3D11Buffer *d2dIndexBuffer; ID3D11ShaderResourceView *d2dTexture; IDWriteFactory *DWriteFactory; IDWriteTextFormat *TextFormat; ID3D11BlendState* Transparency; ID3D11Buffer* sphereIndexBuffer; ID3D11Buffer* sphereVertBuffer; ID3D11VertexShader* SKYMAP_VS; ID3D11PixelShader* SKYMAP_PS; ID3D10Blob* SKYMAP_VS_Buffer; ID3D10Blob* SKYMAP_PS_Buffer; ID3D11ShaderResourceView* smrv; ID3D11DepthStencilState* DSLessEqual; ID3D11RasterizerState* RSCullNone; int NumSphereVertices; int NumSphereFaces; XMMATRIX sphereArena; ID3D11Buffer* meshVertBuff; ID3D11Buffer* meshIndexBuff; XMMATRIX meshWorld; int meshSubsets = 0; std::vector<int> meshSubsetIndexStart; std::vector<int> meshSubsetTexture; std::vector<ID3D11ShaderResourceView*> meshSRV; std::vector<std::wstring> textureNameArray; UINT stride = sizeof(Vertex); UINT offset = 0; //Create effects constant buffer's structure// struct cbPerObject { XMMATRIX WVP; XMMATRIX World; //These will be used for the pixel shader XMFLOAT4 difColor; BOOL hasTexture; //Because of HLSL structure packing, we will use windows BOOL //instead of bool because HLSL packs things into 4 bytes, and //bool is only one byte, where BOOL is 4 bytes BOOL hasNormMap; }; cbPerObject cbPerObj; XMMATRIX Rotation; XMMATRIX Scale; XMMATRIX Translation; struct SurfaceMaterial { std::wstring matName; XMFLOAT4 difColor; int texArrayIndex; bool hasTexture; bool transparent; }; std::vector<SurfaceMaterial> material; XMVECTOR currPlayerDirection = XMVectorSet(0.0f, 0.0f, 0.0f, 0.0f); XMVECTOR oldPlayerDirection = XMVectorSet(0.0f, 0.0f, 0.0f, 0.0f); XMVECTOR playerPosition = XMVectorSet(0.0f, 0.0f, 0.0f, 0.0f); XMMATRIX Rotationx; XMMATRIX Rotationz; XMMATRIX Rotationy; // Vectors XMVECTOR camPosition; XMVECTOR camTarget; XMVECTOR camUp; XMMATRIX WVP; XMMATRIX camView; XMMATRIX camProjection; XMVECTOR DefaultForward = XMVectorSet(0.0f, 0.0f, 1.0f, 0.0f); XMVECTOR DefaultRight = XMVectorSet(1.0f, 0.0f, 0.0f, 0.0f); XMVECTOR camForward = XMVectorSet(0.0f, 0.0f, 1.0f, 0.0f); XMVECTOR camRight = XMVectorSet(1.0f, 0.0f, 0.0f, 0.0f); XMMATRIX camRotationMatrix; XMMATRIX groundArena; float moveLeftRight = 0.0f; float moveBackForward = 0.0f; float camYaw = 0.0f; float camPitch = 0.0f; XMVECTOR racquetBoundingBoxMinVertex[820]; XMVECTOR racquetBoundingBoxMaxVertex[820]; XMVECTOR ballBoundingBoxMinVertex; XMVECTOR ballBoundingBoundingBoxMaxVertex; XMMATRIX ballBoundingArena; XMVECTOR ballBoundingDir; float playerCamDist = 15.0f; struct Joint { std::wstring name; int parentID; XMFLOAT3 pos; XMFLOAT4 orientation; }; D3D11_INPUT_ELEMENT_DESC layout[] = { { "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 }, { "TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 12, D3D11_INPUT_PER_VERTEX_DATA, 0 }, { "NORMAL", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 20, D3D11_INPUT_PER_VERTEX_DATA, 0 }, { "TANGENT", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 32, D3D11_INPUT_PER_VERTEX_DATA, 0 } }; UINT numElements = ARRAYSIZE(layout); struct Weight { int jointID; float bias; XMFLOAT3 pos; XMFLOAT3 normal; }; struct ModelSubset { int texArrayIndex; int numTriangles; std::vector<Vertex> vertices; std::vector<DWORD> indices; std::vector<Weight> weights; std::vector<XMFLOAT3> positions; ID3D11Buffer* vertBuff; ID3D11Buffer* indexBuff; }; struct Model3D { int numSubsets; int numJoints; std::vector<Joint> joints; std::vector<ModelSubset> subsets; std::vector<ModelAnimation> animations; }; struct BoundingBox { XMFLOAT3 min; XMFLOAT3 max; }; struct FrameData { int frameID; std::vector<float> frameData; }; float red = 0.0f; float green = 0.0f; float blue = 0.0f; int colormodr = 1; int colormodg = 1; int colormodb = 1; DXGI_SWAP_CHAIN_DESC swapChainDesc; //Global Declarations - Others// LPCTSTR WndClassName = L"firstwindow"; HWND hwnd = NULL; HRESULT hr; int Width = 1920; int Height = 1200; struct AnimJointInfo { std::wstring name; int parentID; int flags; int startIndex; }; struct ModelAnimation { int numFrames; int numJoints; int frameRate; int numAnimatedComponents; float frameTime; float totalAnimTime; float currAnimTime; std::vector<AnimJointInfo> jointInfo; std::vector<BoundingBox> frameBounds; std::vector<Joint> baseFrameJoints; std::vector<FrameData> frameData; std::vector<std::vector<Joint>> frameSkeleton; };
on Nov 01 `17
dudedude1234
you shouldn't add the code in a comment, can you update your question with the code instead? comments have no formatting
on Nov 03 `17
iedoc
You have a circular reference somewhere. not sure where its at, but basically it goes like this: A depends on B, B depends on C, C depends on A
on Nov 03 `17
iedoc
This might not answer your question, but it should prevent you from compiling. your structure Model3D references ModelAnimation. ModelAnimation is declared below Model3D, so at the point Model3D is being compiled, there is no ModelAnimation yet.
on Nov 03 `17
iedoc
rate up
1
rate down
#pragma once #include <wrl.h> #include <wrl/client.h> #include <dxgi1_4.h> #include <d3d11_3.h> #include <d2d1_3.h> #include <d2d1effects_2.h> #include <dwrite_3.h> #include <wincodec.h> #include <DirectXColors.h> #include <DirectXMath.h> #include <memory> #include <agile.h> #include <concrt.h> //Include and link appropriate libraries and headers// #pragma comment(lib, "d3d11.lib") #pragma comment(lib, "d3dx11.lib") #pragma comment(lib, "d3dx10.lib") #pragma comment (lib, "D3D10_1.lib") #pragma comment (lib, "DXGI.lib") #pragma comment (lib, "D2D1.lib") #pragma comment (lib, "dwrite.lib") #pragma comment (lib, "dinput8.lib") #pragma comment (lib, "dxguid.lib") #pragma comment (lib, "DXErr.lib") #include <windows.h> #include <d3d11.h> #include <D3D10_1.h> #include <DXGI.h> #include <D2D1.h> #include <sstream> #include <dwrite.h> ///////////////**************new**************//////////////////// #include <vector> #include <fstream> #include <istream> ///////////////**************new**************//////////////////// using namespace DirectX; using namespace Moga::Windows::Phone; struct Vertex //Overloaded Vertex Structure { Vertex() {} Vertex(float x, float y, float z, float u, float v, float nx, float ny, float nz, float tx, float ty, float tz) : pos(x, y, z), texCoord(u, v), normal(nx, ny, nz), tangent(tx, ty, tz) {} XMFLOAT3 pos; XMFLOAT2 texCoord; XMFLOAT3 normal; XMFLOAT3 tangent; XMFLOAT3 biTangent; ///////////////**************new**************//////////////////// // Will not be sent to shader int StartWeight; int WeightCount; ///////////////**************new**************//////////////////// }; //Global Declarations - Interfaces// IDXGISwapChain* SwapChain; ID3D11Device* d3d11Device; ID3D11DeviceContext* d3d11DevCon; ID3D11RenderTargetView* renderTargetView; ID3D11DepthStencilView* depthStencilView; ID3D11Texture2D* depthStencilBuffer; ID3D11VertexShader* VS; ID3D11PixelShader* PS; ID3D11PixelShader* D2D_PS; ID3D10Blob* D2D_PS_Buffer; ID3D10Blob* VS_Buffer; ID3D10Blob* PS_Buffer; ID3D11InputLayout* vertLayout; ID3D11Buffer* cbPerObjectBuffer; ID3D11BlendState* d2dTransparency; ID3D11RasterizerState* CCWcullMode; ID3D11RasterizerState* CWcullMode; ID3D11SamplerState* CubesTexSamplerState; ID3D11Buffer* cbPerFrameBuffer; ID3D10Device1 *d3d101Device; IDXGIKeyedMutex *keyedMutex11; IDXGIKeyedMutex *keyedMutex10; ID2D1RenderTarget *D2DRenderTarget; ID2D1SolidColorBrush *Brush; ID3D11Texture2D *BackBuffer11; ID3D11Texture2D *sharedTex11; ID3D11Buffer *d2dVertBuffer; ID3D11Buffer *d2dIndexBuffer; ID3D11ShaderResourceView *d2dTexture; IDWriteFactory *DWriteFactory; IDWriteTextFormat *TextFormat; ID3D11BlendState* Transparency; ID3D11Buffer* sphereIndexBuffer; ID3D11Buffer* sphereVertBuffer; ID3D11VertexShader* SKYMAP_VS; ID3D11PixelShader* SKYMAP_PS; ID3D10Blob* SKYMAP_VS_Buffer; ID3D10Blob* SKYMAP_PS_Buffer; ID3D11ShaderResourceView* smrv; ID3D11DepthStencilState* DSLessEqual; ID3D11RasterizerState* RSCullNone; int NumSphereVertices; int NumSphereFaces; XMMATRIX sphereArena; ID3D11Buffer* meshVertBuff; ID3D11Buffer* meshIndexBuff; XMMATRIX meshWorld; int meshSubsets = 0; std::vector<int> meshSubsetIndexStart; std::vector<int> meshSubsetTexture; std::vector<ID3D11ShaderResourceView*> meshSRV; std::vector<std::wstring> textureNameArray; UINT stride = sizeof(Vertex); UINT offset = 0; //Create effects constant buffer's structure// struct cbPerObject { XMMATRIX WVP; XMMATRIX World; //These will be used for the pixel shader XMFLOAT4 difColor; BOOL hasTexture; //Because of HLSL structure packing, we will use windows BOOL //instead of bool because HLSL packs things into 4 bytes, and //bool is only one byte, where BOOL is 4 bytes BOOL hasNormMap; }; cbPerObject cbPerObj; XMMATRIX Rotation; XMMATRIX Scale; XMMATRIX Translation; struct SurfaceMaterial { std::wstring matName; XMFLOAT4 difColor; int texArrayIndex; bool hasTexture; bool transparent; }; std::vector<SurfaceMaterial> material; XMVECTOR currPlayerDirection = XMVectorSet(0.0f, 0.0f, 0.0f, 0.0f); XMVECTOR oldPlayerDirection = XMVectorSet(0.0f, 0.0f, 0.0f, 0.0f); XMVECTOR playerPosition = XMVectorSet(0.0f, 0.0f, 0.0f, 0.0f); XMMATRIX Rotationx; XMMATRIX Rotationz; XMMATRIX Rotationy; // Vectors XMVECTOR camPosition; XMVECTOR camTarget; XMVECTOR camUp; XMMATRIX WVP; XMMATRIX camView; XMMATRIX camProjection; XMVECTOR DefaultForward = XMVectorSet(0.0f, 0.0f, 1.0f, 0.0f); XMVECTOR DefaultRight = XMVectorSet(1.0f, 0.0f, 0.0f, 0.0f); XMVECTOR camForward = XMVectorSet(0.0f, 0.0f, 1.0f, 0.0f); XMVECTOR camRight = XMVectorSet(1.0f, 0.0f, 0.0f, 0.0f); XMMATRIX camRotationMatrix; XMMATRIX groundArena; float moveLeftRight = 0.0f; float moveBackForward = 0.0f; float camYaw = 0.0f; float camPitch = 0.0f; XMVECTOR racquetBoundingBoxMinVertex[820]; XMVECTOR racquetBoundingBoxMaxVertex[820]; XMVECTOR ballBoundingBoxMinVertex; XMVECTOR ballBoundingBoundingBoxMaxVertex; XMMATRIX ballBoundingArena; XMVECTOR ballBoundingDir; float playerCamDist = 15.0f; struct Joint { std::wstring name; int parentID; XMFLOAT3 pos; XMFLOAT4 orientation; }; D3D11_INPUT_ELEMENT_DESC layout[] = { { "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 }, { "TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 12, D3D11_INPUT_PER_VERTEX_DATA, 0 }, { "NORMAL", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 20, D3D11_INPUT_PER_VERTEX_DATA, 0 }, { "TANGENT", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 32, D3D11_INPUT_PER_VERTEX_DATA, 0 } }; UINT numElements = ARRAYSIZE(layout); struct Weight { int jointID; float bias; XMFLOAT3 pos; XMFLOAT3 normal; }; struct ModelSubset { int texArrayIndex; int numTriangles; std::vector<Vertex> vertices; std::vector<DWORD> indices; std::vector<Weight> weights; std::vector<XMFLOAT3> positions; ID3D11Buffer* vertBuff; ID3D11Buffer* indexBuff; }; struct Model3D { int numSubsets; int numJoints; std::vector<Joint> joints; std::vector<ModelSubset> subsets; std::vector<ModelAnimation> animations; }; struct BoundingBox { XMFLOAT3 min; XMFLOAT3 max; }; struct FrameData { int frameID; std::vector<float> frameData; }; float red = 0.0f; float green = 0.0f; float blue = 0.0f; int colormodr = 1; int colormodg = 1; int colormodb = 1; DXGI_SWAP_CHAIN_DESC swapChainDesc; //Global Declarations - Others// LPCTSTR WndClassName = L"firstwindow"; HWND hwnd = NULL; HRESULT hr; int Width = 1920; int Height = 1200; struct AnimJointInfo { std::wstring name; int parentID; int flags; int startIndex; }; struct ModelAnimation { int numFrames; int numJoints; int frameRate; int numAnimatedComponents; float frameTime; float totalAnimTime; float currAnimTime; std::vector<AnimJointInfo> jointInfo; std::vector<BoundingBox> frameBounds; std::vector<Joint> baseFrameJoints; std::vector<FrameData> frameData; std::vector<std::vector<Joint>> frameSkeleton; };
Comments
I see the same error as before with ModelAnimation which is a part of Model3D struct. watch were you declare obcjects and half of your problems should be gone
on Nov 02 `17
maxiorek82
I keep getting XMFLOAT3: undeclared unidentifier on ModelSubset Missing type specifier -int assumed. C++ does not support default -int on vertex
on Nov 05 `17
dudedude1234
Sign in to answer!