Recovered from microbel
This commit is contained in:
111
common/include/material.H
Normal file
111
common/include/material.H
Normal file
@@ -0,0 +1,111 @@
|
||||
/*
|
||||
* PVVMUD a 3D MUD
|
||||
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#ifndef _MATERIAL_H
|
||||
#define _MATERIAL_H
|
||||
|
||||
#include "texture.H"
|
||||
|
||||
#define MAT_NOTEXTURE -1
|
||||
|
||||
typedef float RGBA_t[4];
|
||||
typedef float Shininess_t[1];
|
||||
|
||||
|
||||
class CMaterial : public CObject {
|
||||
int m_id;
|
||||
int m_textureId;
|
||||
|
||||
protected:
|
||||
RGBA_t m_ambient;
|
||||
RGBA_t m_diffuse;
|
||||
RGBA_t m_specular;
|
||||
RGBA_t m_emission;
|
||||
Shininess_t m_shininess;
|
||||
public:
|
||||
CMaterial();
|
||||
CMaterial(int materialId);
|
||||
CMaterial(int materialId, char * name);
|
||||
|
||||
virtual ~CMaterial() {}
|
||||
|
||||
int getId(){return m_id;}
|
||||
void setId(int materialId);
|
||||
|
||||
int load(char * fileName);
|
||||
int save(char * fileName);
|
||||
private:
|
||||
int loadBMAT(char * fileName);
|
||||
|
||||
public:
|
||||
void RGBA_SetColor(RGBA_t rgba, float red, float green, float blue, float alpha);
|
||||
void RGBA_Print(RGBA_t rgba);
|
||||
|
||||
//void loadMAT(int id,char * name);
|
||||
// void readMAT(int id,FILE * matFile);
|
||||
void setTextureId(int textureId);
|
||||
int getTextureId();
|
||||
|
||||
void setAmbient(float red, float green, float blue, float alpha);
|
||||
void setDiffuse(float red, float green, float blue, float alpha);
|
||||
void setSpecular(float red, float green, float blue, float alpha);
|
||||
void setShininess(float shininess);
|
||||
void setEmission(float red, float green, float blue, float alpha);
|
||||
|
||||
BYTE getAmbientByte(int num);
|
||||
BYTE getDiffuseByte(int num);
|
||||
BYTE getSpecularByte(int num);
|
||||
BYTE getEmissionByte(int num);
|
||||
BYTE getShininessByte();
|
||||
|
||||
float getAmbientFloat(int num);
|
||||
float getDiffuseFloat(int num);
|
||||
float getSpecularFloat(int num);
|
||||
float getEmissionFloat(int num);
|
||||
float getShininessFloat();
|
||||
|
||||
void setAmbient(int num,BYTE value);
|
||||
void setDiffuse(int num,BYTE value);
|
||||
void setSpecular(int num,BYTE value);
|
||||
void setEmission(int num,BYTE value);
|
||||
void setShininess(BYTE value);
|
||||
|
||||
virtual int exec(CTextureCache * texCache);
|
||||
};
|
||||
|
||||
class CMaterialCache : public CCache {
|
||||
public:
|
||||
CMaterialCache();
|
||||
virtual ~CMaterialCache() {}
|
||||
|
||||
CMaterial * add(CMaterial * material);
|
||||
CMaterial * get(int id);
|
||||
};
|
||||
|
||||
#endif /* _MATERIAL_H */
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user