view dmq3d.h @ 245:eed8eed58f82

Changes in the 3d loader.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 09 Oct 2012 17:46:40 +0300
parents 3bff024a91be
children be2ca95af493
line wrap: on
line source

/*
 * DMLib
 * -- Whatever
 * Programmed and designed by Matti 'ccr' Hamalainen
 * (C) Copyright 2012 Tecnic Software productions (TNSP)
 */
#ifndef DMQ3D_H
#define DMQ3D_H

#include "dmlib.h"
#include "dmvecmat.h"
#include "dmres.h"

#ifdef __cplusplus
extern "C" {
#endif


typedef struct
{
    int v1, v2, type;
} DM3DLine;


typedef struct
{
    int v, bitmap;
} DM3DSprite;


typedef struct
{
    char name[64];
    SDL_Surface *img;
} DM3DBitmap;


typedef struct
{
    int nvertices, nvertexalloc;
    DMVector *vertices;

    int nlines, nlinesalloc;
    DM3DLine *lines;

    int nbitmaps, nbitmapsalloc;
    DM3DBitmap *bitmaps;
    
    int nsprites, nspritesalloc;
    DM3DSprite *sprites;
} DM3DLineSpriteModel;


int dmAdd3DLineSpriteModelVertex(DM3DLineSpriteModel *model, DMVector *v, int *index);
int dmAdd3DLineSpriteModelLine(DM3DLineSpriteModel *model, DM3DLine *v, int *index);
int dmAdd3DLineSpriteModelSprite(DM3DLineSpriteModel *model, DM3DSprite *v, int *index);
int dmAdd3DLineSpriteModelBitmap(DM3DLineSpriteModel *model, DM3DBitmap *v, int *index);

int dmRead3DLineSpriteModel(DMResource *f, DM3DLineSpriteModel **model);
void dmFree3DLineSpriteModel(DM3DLineSpriteModel *model);

void dmDraw3DLineSpriteModel(SDL_Surface *screen, DM3DLineSpriteModel *model, DMVector *pos, DMMatrix *mat, SDL_Surface *fbmap, Uint32 lcol);


#ifdef __cplusplus
}
#endif

#endif // DMQ3D_H