Anim8or Community

Please login or register.

Login with username, password and session length
Advanced search  

News:

Ian Ross has just released a book on Anim8or. It's perect for a beginner and a good reference for experienced users. It contains detailed chapters on every aspect, with many examples. Get your own copy here: "Anim8or Tutorial Book"

Pages: [1] 2

Author Topic: How to load in C++?  (Read 19448 times)

omutomata

  • Newbie
  • *
  • Posts: 7
    • View Profile
How to load in C++?
« on: January 09, 2009, 11:00:43 am »

Hello everyone, This is my first post here, one of the many to come hopefully. If someone asked this question before or if it can be found in manual or in one of the tutorials I apologise for spamming but i found nothing about this so i've decided to ask you people. How do i load my 3D object in C++? I've tried using An8Loader.h, i found it in a post on this forum but i have no idea how to use it, i've only managed to use the LoadFile(string) but what do i do after that? How do i display my object? Also i found out reading the manual that i can export the object in *.C format. I've included that file in my program and Anim8orExport.h which was included in the *.C and i get this one error " excess elements in aggregate initializer ". i am working with Dev-C++ under Windows XP SP2. Any help would be more than welcomed. Once again sorry if this is found in forum, manual or tutorial, I just couldn't find it.

Also i would like to say that Anim8or is great  3D animator program and i want to thank to R. Steven Glanville for sharing it with us and everyone who is helping improving it.
Logged

VBSmiles

  • Full Member
  • ***
  • Posts: 203
    • View Profile
Re: How to load in C++?
« Reply #1 on: January 09, 2009, 06:58:27 pm »

x file, or create your own loader.
Logged

Claude

  • Sr. Member
  • ****
  • Posts: 285
    • View Profile
Re: How to load in C++?
« Reply #2 on: January 09, 2009, 07:25:22 pm »

On Texel's site,you will find GLAn8Viewer,an example
showing how to use liban8 to render at least a static model
using Opengl.
http://texel3d.free.fr/projets/liban8/index.html

For the second part of your question,showing the relevant source code would help to get comments.

Logged

omutomata

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: How to load in C++?
« Reply #3 on: January 10, 2009, 10:14:26 am »

x file, or create your own loader.

can you be more specific about x file? I'm sorry but i'm a total noob when it comes to 3D animation, anim8or is the first program i am trying to use and i have no ideea how to make my own loader. Maybe you can point me in some tutorials if there are any.
Logged

omutomata

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: How to load in C++?
« Reply #4 on: January 10, 2009, 10:30:47 am »

On Texel's site,you will find GLAn8Viewer,an example
showing how to use liban8 to render at least a static model
using Opengl.
http://texel3d.free.fr/projets/liban8/index.html

For the second part of your question,showing the relevant source code would help to get comments.

well i downloaded GLAn8Viewer but there is no source code just the program itself. as for the error, this is a part of code i can't put it all cause it's too big.

In my program all i did was this:

#include "Objects/flower.c" //which is my bad representation of the flower from 1st tutorial.

and then i searched the net for Anim8orExport.h which is included by flower.c:

// File "D:\Game\Objects\flower.c"
// Export object "object01"
// Created with Anim8or 0.95

#include "Anim8orExport.h"


// Group group01
// mesh01
static float mesh01_coords[] = {
.....

i guess it's the normal .c file that you would export from anim8or i haven't changed anything in it.
Also i'd like to say that before i included the .C file my program worked just fine.

I got Anim8orExport.h from here, maybe there is something wrong with that, i don;t know for sure. http://www.koders.com/c/fid39DF877793A5BBC1F286A9D09DCEB36EBE4BFE75.aspx


PS: thanks for answering me.
« Last Edit: January 10, 2009, 10:32:55 am by omutomata »
Logged

texel

  • Jr. Member
  • **
  • Posts: 81
    • View Profile
Re: How to load in C++?
« Reply #5 on: January 10, 2009, 12:59:17 pm »

Hi,

the source code of GLAn8Viewer is included in the .zip file of LibAn8.
To use it you must have basic knowledges in C++ and OpenGL.

Logged

Claude

  • Sr. Member
  • ****
  • Posts: 285
    • View Profile
Re: How to load in C++?
« Reply #6 on: January 10, 2009, 06:25:55 pm »

Anim8orExport.h is available on the resource page of the
site.

Your compiler is giving you a syntax error.Could you
post the line of code giving the error msg.

Using LibAn8 seems to be a lot better option than
the C export.

Logged

charles

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: How to load in C++?
« Reply #7 on: March 29, 2013, 10:55:37 pm »

The main problem I had with the export file was invalid variable names. If the "name" field contained ' ', '~', '-', or other characters not allowed in C variable names, they get propagated to the .c output.
Logged

charles

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: How to load in C++?
« Reply #8 on: March 30, 2013, 05:28:07 am »

Okay, I just tried this and the compile failed with "excess elements in aggregate initializer" on the g++ compiler. The problem appears to be an extra field in the .c file not defined in Anim8orExport.h. There seem to be two errors here, one is a field in Anim8orMaterial called Environment Texture, of type char * and there's another at the aggregate level I haven't found yet. Clearly the .h file does not reflect the same version as the .c.
Logged

Raxx

  • Administrator
  • Hero Member
  • *****
  • Posts: 1482
    • View Profile
Re: How to load in C++?
« Reply #9 on: March 30, 2013, 07:18:20 am »

Hm, just to make sure Steve sees it, send him an email about it if you can.
Logged

charles

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: How to load in C++?
« Reply #10 on: March 31, 2013, 12:27:12 am »

Here's the thing, I'm new and don't know my way around. What I'd like to see is the file posted here. It's not huge, about 40 lines I think, and it's much harder to find than it ought to be, IMO.

When I discovered that it wasn't in the install package and after I looked in the docs, I created one by reverse-engineering the .c file and mine worked. As far as I can see, mine is pretty much the same as the official one except I put char[] in place of the char* and created #define NAMELEN and such to give the arrays a size. I don't see how char* get initialized properly since the char* needs an address and the text needs a place. To me

char name[NAMELEN] ;

was a more natural way to define strings.

Anyway, can we just get it posted here please?
« Last Edit: March 31, 2013, 12:30:32 am by charles »
Logged

cooldude234

  • Sr. Member
  • ****
  • Posts: 902
  • You know what I realized, I dont have an avatar :\
    • View Profile
Re: How to load in C++?
« Reply #11 on: March 31, 2013, 12:42:31 am »

I don't understand what your asking here? Are you trying to make a parser or are you trying to compile someone else's?
Logged
¼

Claude

  • Sr. Member
  • ****
  • Posts: 285
    • View Profile
Re: How to load in C++?
« Reply #12 on: March 31, 2013, 03:18:32 pm »

He's trying to use the export object as a C file feature and having trouble
with the header file supplied by Steve.

If I understand well,you want to know how to post a file on the forum.
If this is the case,click on additional options at the bottom of your next
post.

The header was written to be reused with different C file.This is the
reason why no array size are used.

It was written to be compiled by VCC++ which probably accepts things that
g++ doesn't.So you'll have to correct the header each time you use
a different object.

Or if you have the time, you could modify the C export script to export a header
file  in addition to the C file.One that would suit your compiler.

Ultimately using LibAn8 seems to be a lot better option than
the C export.
Logged

charles

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: How to load in C++?
« Reply #13 on: April 03, 2013, 04:17:50 am »

To anyone wondering why I want to be able to export and import to Anim8or: I am new to this application and I don't know all it's capabilities and features but I am pretty sure it doesn't do everything I want to do. Imagine a figure of some sort, a stick person, a robot or some other character that I want to move around in a natural looking way. I think this application will create the 3D character but I want to add the 4th dimension so I want to export the character to my own program that understands kinematics, spacial movements, joint flexure and such. For example to move an arm I must know where the shoulder joint is. That determines the position of the elbow which determines the position of the wrist, etc. I don't want to manually compute all the movements, I want a program to compute a complete sequence. Does this explain why I want to export objects to g++?
« Last Edit: April 03, 2013, 04:19:33 am by charles »
Logged

cooldude234

  • Sr. Member
  • ****
  • Posts: 902
  • You know what I realized, I dont have an avatar :\
    • View Profile
Re: How to load in C++?
« Reply #14 on: April 03, 2013, 05:40:24 am »

I still don't get why you want to export to G++
and if you want a library that will do those sort of things, you should look into bullet or havok physics or even Phyxs by Nvidia
Logged
¼
Pages: [1] 2