General Category > General Anim8or Forum
liban8 issues
omutomata:
Yes i've put the .h and .cpp from objtoan8 in the right folder but i get the same error.... Just to make sure i am not doing anyting stupid:
1. Succesfully compiled the program without #include "liban8\An8Loader.h".
2. Added #include "liban8\An8Loader.h" (just this header) to my program.
3. Copied liban8 folder with all containing .h and .cpp to where my project is located. (Up until this point i can still compile)
4. Added An8File an8File;
if( an8File.LoadFile(std::string((LPCTSTR)(inputFile))) == false)
{
return false;
}
and received error. Also where in An8Loader.h is LoadFile? All i see there is:
--- Code: ---// Load a .an8 file
bool LoadFile(std::string file_name);
--- End code ---
SubDrag:
Yeah that's the header. It's in An8File.cpp. Perhaps it can't find that file, try adding everything to your project. Although in visual studio, you'd be able to compile, but not link, if it could find the .h but didn't find the .cpp
omutomata:
You were right, after i've added all .cpp files to the project and included An8Loader.h i've managed to compile everything but i get an warning (i've made it short taking only relevant information):
--- Code: ---\liban8\AN8X_SkinnedMeshHelper.cpp In member function `void AN8XFigureHelper::ProcessNode(An8File*, std::vector<AN8XBone, std::allocator<AN8XBone> >*,
std::vector<AN8XObjectInstanceInFigure*, std::allocator<AN8XObjectInstanceInFigure*> >*, std::vector<An8Mesh*, std::allocator<An8Mesh*> >*,
std::vector<int, std::allocator<int> >*, std::vector<AN8XMATRIX, std::allocator<AN8XMATRIX> >*, std::vector<An8Material*, std::allocator<An8Material*> >*, int, An8Bone*, AN8XMATRIX*)':
[Warning] passing NULL used for non-pointer converting 1 of `void std::vector<_Tp, _Alloc>::push_back(const _Tp&) [with _Tp = int, _Alloc = std::allocator<int>]'
--- End code ---
The line that spawns this warning is present two times in AN8X_SkinnedMeshHelper.cpp and is this one:
--- Code: ---MeshesListMaterialsID.push_back(NULL);
--- End code ---
I've googled the warning and found some posts saying that it cannot convert from pointer to int and that i should use ptrnull instead but that also got me to an error:
--- Code: ---\liban8\AN8X_SkinnedMeshHelper.cpp [Error] no matching function for call to `std::vector<int, std::allocator<int> >::push_back(const ptrnull_t&)'
--- End code ---
Anyway, ignoring the warning i've tried rendering the model but i guess i'm doing something wrong there too... made a function by following the documentation that came with liban8 like this:
--- Code: ---void LoadModel()
{
An8File an8File;
glLoadIdentity(); // Reset The View
glTranslatef(0.0f, 0.0f,-2.0f);
if( an8File.LoadFile(std::string((LPCTSTR)("test.an8"))) == false)
{
MessageBox(NULL,"Failed To Load Model.","ERROR",MB_OK|MB_ICONEXCLAMATION);;
}
// Compute mesh position in object space (avoid the need of translation)
an8File.ComputeAllPositions();
// Ungroup meshes (easier to manipulate)
an8File.Ungroup();
// Triangulize faces
an8File.Triangulize();
// Compute matices of camera, objects, Lights, ... from quaternions
an8File.ComputeAllMatrices();
// Computer integer id to joint texture and material (.an8 files use strings)
an8File.ComputeTextureIDForMaterial();
}
--- End code ---
Then i've ran this function in Draw() but all i see on the screen is the quad i drew to make the program work before adding liban8.
Btw thank you for the help you provided so far.
SubDrag:
It's hard to say, but admittedly you use a lot of functions I don't use. If it helps, try examining my source. I parsed out the data it gave me and used it all myself. It's all recursive nodes, so maybe not at the right spot.
Claude:
omutomata
Liban8 is not a rendering lib.It provides a comprehensive data
structure containing everything from the an8 file + utility
functions.
Reading SubDrag's code will show you how to access the data,
but not how to render since it's a converter.It's probably not
rendering,but writing to a file in obj format.
Something else could also help.
On the site of Liban8,you will find GLAn8Viewer.It's a demo using Liban8 to render an an8 model.
Claude
Navigation
[0] Message Index
[*] Previous page
Go to full version