[info-performer] Simple pseudo loader

New Message Reply Date view Thread view Subject view Author view

From: Sakis Gaitatzes (gaitat++at++yahoo.com)
Date: 11/18/2002 04:47:00


pfHello,

I wanted my models to be loaded in my application with SCRIBE mode so I wrote
a very simple, I thought, pseudo loader that doesnt work.
Can somebody help me?

#include <Performer/pf/pfTraverser.h>
#include <Performer/pfdu.h>

int
preDrawWire (pfTraverser *, void *)
{
    pfVec4 v (0.0f, 0.0f, 0.0f, 1.0f);
    pfuPreDrawStyle (PFUSTYLE_SCRIBED, v);

    return PFTRAV_CONT;
}

int
postDrawWire (pfTraverser *, void *)
{
    pfuPostDrawStyle (PFUSTYLE_SCRIBED);

    return PFTRAV_CONT;
}

extern "C" pfNode *
pfdLoadFile_wire (char *fileName)
{
    char *lastdot = strrchr (fileName, '.');

    if (lastdot == NULL)
    {
        pfNotify (PFNFY_WARN, PFNFY_USAGE,
                  "pfdLoadFile_wire: bad file name %s", fileName);
        return NULL;
    }
    char realName[PATH_MAX];

    strncpy (realName, fileName, lastdot - fileName);
    realName[lastdot - fileName] = '\0';

    pfNode *parent = pfdLoadFile (realName);
    if (parent == NULL)
        return NULL; /* error message printed already */

    parent->setTravFuncs (PFTRAV_DRAW, preDrawWire, postDrawWire);
    parent->setTravData (PFTRAV_DRAW, NULL);

    return parent;
}

=====
Athanasios Gaitatzes (Saki)
e-mail: gaitat++at++yahoo.com
   url: http://www.virtuality.gr/

__________________________________________________
Do you Yahoo!?
Yahoo! Web Hosting - Let the expert host your site
http://webhosting.yahoo.com


New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Mon Nov 18 2002 - 04:49:29 PST

This message has been cleansed for anti-spam protection. Replace '++at++' in any mail addresses with the '@' symbol.