Files
wagic/JGE/include/JOBJModel.h
wagic.the.homebrew 8ff6839c8d Some preparation work for new platform support.
- Added a "PSP" compile-time define to clean up some compile time checks (replaced !WIN32 && !LINUX && !IOS with PSP) 
-- Wil, I am aware that this is redundant with the PSPENV variable you introduced recently, I think we can clean that up easily
-- This looks like lots of changes, but most of the time I just moved some blocks here and there
-- tested on VC 2010, PSP, and a bit of NDK
-- I might have broken maemo, iOS, or Linux compilation, can you guys check?
- Fixed some warnings reported by NDK
- NDK still does not compile because recent boost additions (mutex, etc...) are apparently not supported
2011-04-21 13:16:11 +00:00

77 lines
1.8 KiB
C++

//-------------------------------------------------------------------------------------
//
// JGE++ is a hardware accelerated 2D game SDK for PSP/Windows.
//
// Licensed under the BSD license, see LICENSE in JGE root for details.
//
// Copyright (c) 2007 James Hui (a.k.a. Dr.Watson) <jhkhui@gmail.com>
//
//-------------------------------------------------------------------------------------
#ifndef _OBJMODEL_H
#define _OBJMODEL_H
#include <vector>
using namespace std;
#if defined (PSP)
#include <pspgu.h>
#include <pspgum.h>
#endif
#include "JGE.h"
#include "Vector3D.h"
class JTexture;
//////////////////////////////////////////////////////////////////////////
/// Helper class to display Wavefront OBJ model.
///
//////////////////////////////////////////////////////////////////////////
class JOBJModel
{
struct Face
{
int mVertCount;
int mVertIdx[4];
int mTexIdx[4];
int mNormalIdx[4];
};
public:
//////////////////////////////////////////////////////////////////////////
/// Constructor.
//////////////////////////////////////////////////////////////////////////
JOBJModel();
~JOBJModel();
int ReadLine(char *output, const char *buffer, int start, int size);
//////////////////////////////////////////////////////////////////////////
/// Load OBJ model.
///
/// @param modelName - Name of OBJ file.
/// @param texturenName - Name of texture.
///
//////////////////////////////////////////////////////////////////////////
bool Load(const char *modelName, const char *textureName);
//////////////////////////////////////////////////////////////////////////
/// Render the model to screen.
///
//////////////////////////////////////////////////////////////////////////
void Render();
private:
int mPolycount;
Vertex3D* mPolygons;
JTexture* mTexture;
};
#endif