Jump to content
  • Advertisement
Sign in to follow this  
AnujKalia

Animadead help required

This topic is 2610 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

I'm working on a 3D game and I want my characters to show some skeletal animation. I found Animadead to be a good library for skeletal animation (till now). I invested some time in getting the Maya exporter and demo programs to work.
However, now I'm getting some problems with textures. I added a simple texture to my model in Maya. However, with Animadead I'm getting my model only "partially textured". Some areas are appearing totally black.


Here's the standard Animadead code that uses u-v coordinates.

#include "supermodel.h"
#include "SDLtexture.h"
#include <windows.h>
#include <GL/gl.h>
#define DEMOSRCDIR

using namespace std;

void TextureLoader::operator()(string file, void *&userdata)
{
string path = DEMOSRCDIR "images/";
string::size_type pos = file.find_last_of("/");
string therest = string(file, pos+1);
path += therest;
userdata = (void *)LoadTexture(path.c_str());
}

SuperModel::SuperModel(ad::Model::Type type, ad::UserFunction *fp) : Model(type, fp)
{
}

SuperModel::~SuperModel()
{
}

void SuperModel::Draw()
{
glColor4f(1,1,1,1);
glEnable(GL_TEXTURE_2D);
glEnable(GL_LIGHTING);

unsigned int mesh, i, j, k, l;

GenerateRenderPoseMatrices();

for (mesh = 0; mesh < meshes.size(); mesh++)
{
for (i=0; i < meshes[mesh]->numSurfaces; i++)
{
glBindTexture(GL_TEXTURE_2D, (unsigned int)(meshes[mesh]->surfaces.userData));
for (j = 0; j < meshes[mesh]->surfaces.numFaces; j++)
{
for (k=0; k < meshes[mesh]->numBones; k++)
worldBonesTEMP[meshes[mesh]->bones[k]]=worldBones[meshes[mesh]->bones[k]] * meshes[mesh]->inverseBindPose[meshes[mesh]->bones[k]];

glBegin(GL_POLYGON);
for (k = 0; k < meshes[mesh]->surfaces.faces[j].numIndices; k++)
{
ad::SuperVertex *svert = &meshes[mesh]->surfaces.superVerts[ meshes[mesh]->surfaces.faces[j].indices[k] ];

ad::Vector3 pos(svert->x, svert->y, svert->z);
ad::Vector3 norm(svert->a, svert->b, svert->c);
ad::Vector3 ret;
ad::Vector3 ret2;

for (l=0; l < svert->numInfluences; l++)
{
ret+=worldBonesTEMP[svert->weights[l].bone]*pos*svert->weights[l].weight;
ret2+=worldBonesTEMP[svert->weights[l].bone].Rotate(norm) * svert->weights[l].weight;
}

ret2.Normalize();
//printf("(%f,%f)\n",1-svert->u,1-svert->v);
glTexCoord2f(svert->u,1-svert->v);
glNormal3f(ret2.x, ret2.y, ret2.z);
glVertex3f(ret.x, ret.y, ret.z);
}
glEnd();
}
}
}
}



I've added an image which shows the black areas. Anyone with experience in Animadead please help!!

Share this post


Link to post
Share on other sites
Advertisement
Well I solved it myself..turned out the texture being used was wrong somehow. So I switched from SDL to GLFW...

Does someone know which models I should use with Animadead? Till now I've managed to use the "Krag" model from CreativeCrash. But I can't use most of the models there. In the Animadead window, they appear stretched or broken :angry::(.

Please help!!!!:(:(:(:(:(:(:(

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!