mirror of
https://github.com/id-Software/GtkRadiant.git
synced 2026-03-19 16:39:26 +01:00
The GtkRadiant sources as originally released under the GPL license.
This commit is contained in:
221
plugins/spritemodel/plugin.cpp
Normal file
221
plugins/spritemodel/plugin.cpp
Normal file
@@ -0,0 +1,221 @@
|
||||
/*
|
||||
Copyright (C) 2002 Dominic Clifton.
|
||||
|
||||
This file is part of GtkRadiant.
|
||||
|
||||
GtkRadiant 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.
|
||||
|
||||
GtkRadiant 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 GtkRadiant; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
//
|
||||
// Sprite Model Plugin
|
||||
//
|
||||
// Code by Hydra aka Dominic Clifton
|
||||
//
|
||||
// Based on MD3Model source code by SPoG
|
||||
//
|
||||
|
||||
/*
|
||||
Overview
|
||||
========
|
||||
|
||||
|
||||
Why ?
|
||||
-----
|
||||
|
||||
It allows the user to see a graphical representation of the entity in the 3D view (maybe 2D views later) where the entity would just otherwise be a non-descriptive coloured box.
|
||||
|
||||
It is designed to be used with the entity view set to WireFrame (as the sprite images are rendered in the middle of the entity's bbox.
|
||||
|
||||
How ?
|
||||
-----
|
||||
|
||||
Implemented as a model module, without any ISelect stuff.
|
||||
|
||||
For an entity to use an image (instead of a model) you just update the entity defintion file so that the eclass_t's modelpath is filled in with a relative path and filename of an image file.
|
||||
|
||||
e.g:
|
||||
|
||||
baseq3/scripts/entities.def
|
||||
===========================
|
||||
|
||||
\/\*QUAKED ammo_bfg (.3 .3 1) (-16 -16 -16) (16 16 16) SUSPENDED
|
||||
...
|
||||
-------- MODEL FOR RADIANT ONLY - DO NOT SET THIS AS A KEY --------
|
||||
model="sprites/powerups/ammo/bfgam.bmp"\*\/
|
||||
|
||||
|
||||
valve/scripts/halflife.fgd
|
||||
==========================
|
||||
|
||||
@PointClass iconsprite("sprites/lightbulb.spr") base(Target, Targetname, Light) = light : "Invisible lightsource"
|
||||
[
|
||||
...
|
||||
]
|
||||
|
||||
What image formats are supported ?
|
||||
----------------------------------
|
||||
|
||||
This module can load any image format that there is an active image module for. For q3 this would be bmp, tga and jpg. For Half-Life this would be hlw and spr.
|
||||
|
||||
Version History
|
||||
===============
|
||||
|
||||
v0.1 - 27/May/2002
|
||||
- Created an inital implementation of a sprite model plugin.
|
||||
According to the powers that be, it seems creating a model
|
||||
plugin is hackish.
|
||||
It works ok, but there is no way to attach models (sprites if you will)
|
||||
to non-fixedsize entities (like func_bombtarget)
|
||||
Also, I can't get the alpha map stuff right so I had to invert the alpha
|
||||
mask in the spr loader so that 0xff = not drawn pixel.
|
||||
|
||||
ToDo
|
||||
====
|
||||
|
||||
* make sprites always face the camera (is this done in camwindow.cpp ?)
|
||||
|
||||
* maybe add an option to scale the sprites in the prefs ?
|
||||
|
||||
* un-hack the default fall-though to "sprite" model version (see m_version)
|
||||
|
||||
* maybe convert to a new kind of class not based on model.
|
||||
|
||||
* allow sprites on non-fixedsize ents
|
||||
|
||||
* fix reversed alpha map in spr loader
|
||||
|
||||
* allow an entity to have both an .md? and a sprite model.
|
||||
*/
|
||||
|
||||
#include "plugin.h"
|
||||
#include "spritemodel.h"
|
||||
|
||||
// =============================================================================
|
||||
// Globals
|
||||
|
||||
// function tables
|
||||
_QERFuncTable_1 __QERTABLENAME;
|
||||
OpenGLBinding g_QglTable;
|
||||
_QERShadersTable g_ShadersTable;
|
||||
|
||||
// =============================================================================
|
||||
// SYNAPSE
|
||||
|
||||
#include "synapse.h"
|
||||
|
||||
|
||||
char *supportedmodelformats[] = {"spr","bmp","tga","jpg","hlw",NULL}; // NULL is list delimiter
|
||||
|
||||
static void add_model_apis(CSynapseClient& client)
|
||||
{
|
||||
char **ext;
|
||||
for (ext = supportedmodelformats; *ext != NULL; ext++)
|
||||
{
|
||||
client.AddAPI(MODEL_MAJOR, *ext, sizeof(_QERPlugModelTable));
|
||||
}
|
||||
}
|
||||
|
||||
static bool model_is_supported(const char* extension)
|
||||
{
|
||||
char **ext;
|
||||
for (ext = supportedmodelformats; *ext != NULL; ext++)
|
||||
{
|
||||
if (stricmp(extension,*ext)==0)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void init_filetypes()
|
||||
{
|
||||
char **ext;
|
||||
for (ext = supportedmodelformats; *ext != NULL; ext++)
|
||||
{
|
||||
GetFileTypeRegistry()->addType(MODEL_MAJOR, filetype_t("sprite", *ext));
|
||||
}
|
||||
}
|
||||
|
||||
extern CSynapseServer* g_pSynapseServer;
|
||||
|
||||
class CSynapseClientModel : public CSynapseClient
|
||||
{
|
||||
public:
|
||||
// CSynapseClient API
|
||||
bool RequestAPI(APIDescriptor_t *pAPI);
|
||||
const char* GetInfo();
|
||||
const char* GetName();
|
||||
|
||||
CSynapseClientModel() { }
|
||||
virtual ~CSynapseClientModel() { }
|
||||
|
||||
bool OnActivate()
|
||||
{
|
||||
init_filetypes(); // see todo list above.
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
CSynapseServer* g_pSynapseServer = NULL;
|
||||
CSynapseClientModel g_SynapseClient;
|
||||
|
||||
extern "C" CSynapseClient* SYNAPSE_DLL_EXPORT Synapse_EnumerateInterfaces (const char *version, CSynapseServer *pServer)
|
||||
{
|
||||
if (strcmp(version, SYNAPSE_VERSION))
|
||||
{
|
||||
Syn_Printf("ERROR: synapse API version mismatch: should be '" SYNAPSE_VERSION "', got '%s'\n", version);
|
||||
return NULL;
|
||||
}
|
||||
g_pSynapseServer = pServer;
|
||||
g_pSynapseServer->IncRef();
|
||||
Set_Syn_Printf(g_pSynapseServer->Get_Syn_Printf());
|
||||
|
||||
add_model_apis(g_SynapseClient); // see todo list above.
|
||||
|
||||
g_SynapseClient.AddAPI( PLUGIN_MAJOR, "sprite", sizeof( _QERPluginTable ) );
|
||||
g_SynapseClient.AddAPI( RADIANT_MAJOR, NULL, sizeof( g_FuncTable ), SYN_REQUIRE, &g_FuncTable );
|
||||
g_SynapseClient.AddAPI( QGL_MAJOR, NULL, sizeof( g_QglTable ), SYN_REQUIRE, &g_QglTable );
|
||||
g_SynapseClient.AddAPI( SHADERS_MAJOR, "*", sizeof( g_ShadersTable ), SYN_REQUIRE, &g_ShadersTable );
|
||||
|
||||
return &g_SynapseClient;
|
||||
}
|
||||
|
||||
bool CSynapseClientModel::RequestAPI(APIDescriptor_t *pAPI)
|
||||
{
|
||||
if (!strcmp(pAPI->major_name, MODEL_MAJOR))
|
||||
{
|
||||
_QERPlugModelTable* pTable= static_cast<_QERPlugModelTable*>(pAPI->mpTable);
|
||||
|
||||
if (!strcmp(pAPI->minor_name, "sprite"))
|
||||
{
|
||||
pTable->m_pfnLoadModel = &LoadSpriteModel;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Syn_Printf("ERROR: RequestAPI( '%s' ) not found in '%s'\n", pAPI->major_name, GetInfo());
|
||||
return false;
|
||||
}
|
||||
|
||||
#include "version.h"
|
||||
|
||||
const char* CSynapseClientModel::GetInfo()
|
||||
{
|
||||
return "Sprite Model module built " __DATE__ " " RADIANT_VERSION;
|
||||
}
|
||||
|
||||
const char* CSynapseClientModel::GetName()
|
||||
{
|
||||
return "sprite";
|
||||
}
|
||||
47
plugins/spritemodel/plugin.h
Normal file
47
plugins/spritemodel/plugin.h
Normal file
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
Copyright (C) 2002 Dominic Clifton.
|
||||
|
||||
This file is part of GtkRadiant.
|
||||
|
||||
GtkRadiant 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.
|
||||
|
||||
GtkRadiant 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 GtkRadiant; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
//
|
||||
// Sprite Model Plugin
|
||||
//
|
||||
// Code by Hydra aka Dominic Clifton
|
||||
//
|
||||
// Based on MD3Model source code by SPoG
|
||||
//
|
||||
|
||||
#ifndef _PLUGIN_H_
|
||||
#define _PLUGIN_H_
|
||||
|
||||
#include "mathlib.h"
|
||||
#include <string.h>
|
||||
#include "qertypes.h"
|
||||
#include <stdio.h>
|
||||
|
||||
#define USE_QERTABLE_DEFINE
|
||||
#include "qerplugin.h"
|
||||
extern _QERFuncTable_1 __QERTABLENAME;
|
||||
|
||||
#define USE_QGLTABLE_DEFINE
|
||||
#include "igl.h"
|
||||
extern OpenGLBinding __QGLTABLENAME;
|
||||
|
||||
#include "imodel.h"
|
||||
|
||||
#endif // _PLUGIN_H_
|
||||
177
plugins/spritemodel/spritemodel.cpp
Normal file
177
plugins/spritemodel/spritemodel.cpp
Normal file
@@ -0,0 +1,177 @@
|
||||
/*
|
||||
Copyright (C) 2002 Dominic Clifton.
|
||||
|
||||
This file is part of GtkRadiant.
|
||||
|
||||
GtkRadiant 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.
|
||||
|
||||
GtkRadiant 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 GtkRadiant; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
//
|
||||
// Sprite Model Plugin
|
||||
//
|
||||
// Code by Hydra aka Dominic Clifton
|
||||
//
|
||||
// Based on MD3Model source code by SPoG
|
||||
//
|
||||
|
||||
#include "spritemodel.h"
|
||||
|
||||
void LoadSpriteModel(entity_interfaces_t *interfaces, const char *name)
|
||||
{
|
||||
IShader *pShader;
|
||||
|
||||
pShader = QERApp_Shader_ForName(name);
|
||||
|
||||
if (!pShader)
|
||||
{
|
||||
Sys_Printf("ERROR: can't find shader (or image) for: %s\n", name );
|
||||
return;// NULL;
|
||||
}
|
||||
|
||||
CSpriteModel *model = new CSpriteModel();
|
||||
model->Construct(pShader);
|
||||
interfaces->pRender = (IRender*)model;
|
||||
interfaces->pRender->IncRef();
|
||||
//interfaces->pSelect = (ISelect*)model;
|
||||
//interfaces->pSelect->IncRef();
|
||||
interfaces->pSelect = NULL;
|
||||
interfaces->pEdit = NULL;
|
||||
model->DecRef();
|
||||
|
||||
}
|
||||
|
||||
void CSpriteModel::Construct(IShader *pShader)
|
||||
{
|
||||
m_pShader = pShader;
|
||||
aabb_clear(&m_BBox);
|
||||
/*
|
||||
md3Surface_t *pSurface = (md3Surface_t *)(((unsigned char *)pHeader) + pHeader->ofsSurfaces);
|
||||
m_nSurfaces = pHeader->numSurfaces;
|
||||
CMD3Surface* surfaces = new CMD3Surface[m_nSurfaces];
|
||||
for (int i = 0; i < m_nSurfaces; i++ )
|
||||
{
|
||||
surfaces[i].Construct(pSurface);
|
||||
pSurface = (md3Surface_t *) ((( char * ) pSurface) + pSurface->ofsEnd);
|
||||
}
|
||||
m_children = surfaces;
|
||||
AccumulateBBox();
|
||||
*/
|
||||
}
|
||||
|
||||
CSpriteModel::CSpriteModel()
|
||||
{
|
||||
refCount = 1;
|
||||
//m_nSurfaces = 0;
|
||||
//m_children = NULL;
|
||||
m_pShader = NULL;
|
||||
}
|
||||
|
||||
CSpriteModel::~CSpriteModel()
|
||||
{
|
||||
// if(m_children) delete[] m_children;
|
||||
if (m_pShader)
|
||||
m_pShader->DecRef();
|
||||
}
|
||||
|
||||
void CSpriteModel::Draw(int state, int rflags) const
|
||||
{
|
||||
|
||||
/*
|
||||
// Draw a point in the middle of the bbox
|
||||
vec3_t middle = {0,0,0};
|
||||
g_QglTable.m_pfn_qglPointSize (4);
|
||||
g_QglTable.m_pfn_qglColor3f (0,1,0);
|
||||
g_QglTable.m_pfn_qglBegin (GL_POINTS);
|
||||
g_QglTable.m_pfn_qglVertex3fv (middle);
|
||||
g_QglTable.m_pfn_qglEnd ();
|
||||
*/
|
||||
|
||||
qtexture_t *q = m_pShader->getTexture();
|
||||
|
||||
// convert pixels to units and divide in half again so we draw in the middle
|
||||
// of the bbox.
|
||||
int h = q->height / 8;
|
||||
int w = q->width / 8;
|
||||
|
||||
// setup opengl stuff
|
||||
|
||||
g_QglTable.m_pfn_qglPushAttrib (GL_ALL_ATTRIB_BITS); // GL_ENABLE_BIT
|
||||
//g_QglTable.m_pfn_qglColor3f (1,1,1); //testing
|
||||
//g_QglTable.m_pfn_qglColor4f (1,1,1,1); //testing
|
||||
g_QglTable.m_pfn_qglBindTexture (GL_TEXTURE_2D, q->texture_number);
|
||||
|
||||
//g_QglTable.m_pfn_qglEnable (GL_TEXTURE_2D); // FIXME: ? this forces textures, even in wireframe mode, bad... ?
|
||||
|
||||
g_QglTable.m_pfn_qglAlphaFunc (GL_LESS, 1);
|
||||
g_QglTable.m_pfn_qglEnable (GL_ALPHA_TEST);
|
||||
|
||||
// get rid of this when sprite always faces camera
|
||||
g_QglTable.m_pfn_qglDisable(GL_CULL_FACE);
|
||||
g_QglTable.m_pfn_qglPolygonMode (GL_FRONT_AND_BACK, GL_FILL);
|
||||
|
||||
// draw the sprite
|
||||
|
||||
#if 0
|
||||
// using x/y axis, it appears FLAT without the proper transform and rotation.
|
||||
|
||||
g_QglTable.m_pfn_qglBegin(GL_QUADS);
|
||||
g_QglTable.m_pfn_qglTexCoord2f (0,0);
|
||||
g_QglTable.m_pfn_qglVertex3f (0-w,0-h, 0);
|
||||
g_QglTable.m_pfn_qglTexCoord2f (1,0);
|
||||
g_QglTable.m_pfn_qglVertex3f ( w,0-h, 0);
|
||||
g_QglTable.m_pfn_qglTexCoord2f (1,1);
|
||||
g_QglTable.m_pfn_qglVertex3f ( w, h, 0);
|
||||
g_QglTable.m_pfn_qglTexCoord2f (0,1);
|
||||
g_QglTable.m_pfn_qglVertex3f (0-w, h, 0);
|
||||
g_QglTable.m_pfn_qglEnd ();
|
||||
#else
|
||||
|
||||
// so draw it using y/z instead.
|
||||
g_QglTable.m_pfn_qglBegin(GL_QUADS);
|
||||
g_QglTable.m_pfn_qglTexCoord2f(0.0f, 0.0f);
|
||||
g_QglTable.m_pfn_qglVertex3f(0.0f, static_cast<float>(w), static_cast<float>(h));
|
||||
g_QglTable.m_pfn_qglTexCoord2f(1.0f, 0.0f);
|
||||
g_QglTable.m_pfn_qglVertex3f(0.0f, 0.0f - static_cast<float>(w), static_cast<float>(h));
|
||||
g_QglTable.m_pfn_qglTexCoord2f(1.0f, 1.0f);
|
||||
g_QglTable.m_pfn_qglVertex3f(0.0f, 0.0f - static_cast<float>(w), 0.0f - static_cast<float>(h));
|
||||
g_QglTable.m_pfn_qglTexCoord2f(0.0f, 0.0f);
|
||||
g_QglTable.m_pfn_qglVertex3f(0.0f, static_cast<float>(w), 0.0f - static_cast<float>(h));
|
||||
g_QglTable.m_pfn_qglEnd ();
|
||||
#endif
|
||||
|
||||
g_QglTable.m_pfn_qglBindTexture (GL_TEXTURE_2D, 0);
|
||||
g_QglTable.m_pfn_qglPopAttrib();
|
||||
}
|
||||
|
||||
/*
|
||||
bool CSpriteModel::TestRay(const ray_t *ray, vec_t *dist) const
|
||||
{
|
||||
vec_t depth_start = *dist;
|
||||
vec_t depth_local = *dist;
|
||||
|
||||
if (aabb_test_ray(&m_BBox, ray) == 0)
|
||||
return false;
|
||||
|
||||
for(int i=0; i<m_nSurfaces; i++)
|
||||
{
|
||||
if(m_children[i].TestRay(ray, &depth_local))
|
||||
{
|
||||
if (depth_local < *dist) *dist = depth_local;
|
||||
}
|
||||
}
|
||||
|
||||
return *dist < depth_start;
|
||||
}
|
||||
*/
|
||||
8
plugins/spritemodel/spritemodel.def
Normal file
8
plugins/spritemodel/spritemodel.def
Normal file
@@ -0,0 +1,8 @@
|
||||
; md3model.def : Declares the module parameters for the DLL.
|
||||
|
||||
LIBRARY "SPRITEMODEL"
|
||||
DESCRIPTION 'SPRITEMODEL Windows Dynamic Link Library'
|
||||
|
||||
EXPORTS
|
||||
; Explicit exports can go here
|
||||
Synapse_EnumerateInterfaces @1
|
||||
160
plugins/spritemodel/spritemodel.dsp
Normal file
160
plugins/spritemodel/spritemodel.dsp
Normal file
@@ -0,0 +1,160 @@
|
||||
# Microsoft Developer Studio Project File - Name="spritemodel" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
|
||||
|
||||
CFG=spritemodel - Win32 Debug
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "spritemodel.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "spritemodel.mak" CFG="spritemodel - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "spritemodel - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
|
||||
!MESSAGE "spritemodel - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName "spritemodel"
|
||||
# PROP Scc_LocalPath "..\.."
|
||||
CPP=cl.exe
|
||||
MTL=midl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "spritemodel - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "Release"
|
||||
# PROP BASE Intermediate_Dir "Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "Release"
|
||||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
F90=df.exe
|
||||
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MAP_EXPORTS" /YX /FD /c
|
||||
# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\..\libxml2\include\\" /I "..\..\..\gtk2-win32\lib\glib-2.0\include" /I "..\..\..\gtk2-win32\include\glib-2.0" /I "..\..\include" /I "..\common" /I "..\..\libs" /I "..\..\libs\nvtristrip" /I "..\..\..\STLPort\stlport" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MAP_EXPORTS" /YX /FD /c
|
||||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x40c /d "NDEBUG"
|
||||
# ADD RSC /l 0x40c /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
|
||||
# ADD LINK32 mathlib.lib glib-2.0.lib synapse.lib /nologo /dll /machine:I386 /def:".\spritemodel.def" /libpath:"..\..\libs\mathlib\release" /libpath:"..\..\libs\synapse\release" /libpath:"..\..\..\gtk2-win32\lib\\"
|
||||
# SUBTRACT LINK32 /pdb:none
|
||||
|
||||
!ELSEIF "$(CFG)" == "spritemodel - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "Debug"
|
||||
# PROP BASE Intermediate_Dir "Debug"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "Debug"
|
||||
# PROP Intermediate_Dir "Debug"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
F90=df.exe
|
||||
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MAP_EXPORTS" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\..\shared" /I "..\..\..\libxml2\include" /I "..\..\..\gtk2-win32\lib\glib-2.0\include" /I "..\..\..\gtk2-win32\include\glib-2.0" /I "..\..\include" /I "..\common" /I "..\..\libs" /I "..\..\libs\nvtristrip" /I "..\..\..\STLPort\stlport" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MAP_EXPORTS" /FR /YX /FD /GZ /c
|
||||
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x40c /d "_DEBUG"
|
||||
# ADD RSC /l 0x40c /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 mathlib.lib glib-2.0.lib synapse.lib /nologo /dll /debug /machine:I386 /def:".\spritemodel.def" /pdbtype:sept /libpath:"..\..\libs\mathlib\debug" /libpath:"..\..\libs\synapse\debug" /libpath:"..\..\..\gtk2-win32\lib\\"
|
||||
# SUBTRACT LINK32 /pdb:none
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "spritemodel - Win32 Release"
|
||||
# Name "spritemodel - Win32 Debug"
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\plugin.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\spritemodel.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\spritemodel.def
|
||||
# PROP Exclude_From_Build 1
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
||||
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||
# Begin Group "API"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\ifilesystem.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\igl.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\imodel.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\ishaders.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\qerplugin.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\qertypes.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\plugin.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\spritemodel.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Resource Files"
|
||||
|
||||
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
|
||||
# End Group
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Conscript
|
||||
# End Source File
|
||||
# End Target
|
||||
# End Project
|
||||
59
plugins/spritemodel/spritemodel.h
Normal file
59
plugins/spritemodel/spritemodel.h
Normal file
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
Copyright (C) 2002 Dominic Clifton.
|
||||
|
||||
This file is part of GtkRadiant.
|
||||
|
||||
GtkRadiant 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.
|
||||
|
||||
GtkRadiant 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 GtkRadiant; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
//
|
||||
// Sprite Model Plugin
|
||||
//
|
||||
// Code by Hydra aka Dominic Clifton
|
||||
//
|
||||
// Based on MD3Model source code by SPoG
|
||||
//
|
||||
|
||||
#include "plugin.h"
|
||||
|
||||
/*! i guess a description should go here... */
|
||||
class CSpriteModel: public IRender//, public ISelect
|
||||
{
|
||||
public:
|
||||
CSpriteModel();
|
||||
~CSpriteModel();
|
||||
|
||||
void IncRef() { refCount++; }
|
||||
void DecRef() { if(--refCount == 0) delete this; }
|
||||
|
||||
//IRender
|
||||
void Draw(int state, int rflags) const;
|
||||
const aabb_t *GetAABB() const { return &m_BBox; }
|
||||
|
||||
//ISelect
|
||||
//bool TestRay (const ray_t *ray, vec_t *dist) const;
|
||||
|
||||
void Construct(IShader *pShader);
|
||||
|
||||
protected:
|
||||
IShader *m_pShader;
|
||||
|
||||
private:
|
||||
int refCount;
|
||||
aabb_t m_BBox;
|
||||
};
|
||||
|
||||
void LoadSpriteModel(entity_interfaces_t *interfaces, const char *name);
|
||||
|
||||
186
plugins/spritemodel/spritemodel.vcproj
Normal file
186
plugins/spritemodel/spritemodel.vcproj
Normal file
@@ -0,0 +1,186 @@
|
||||
<?xml version="1.0" encoding = "Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="7.00"
|
||||
Name="spritemodel">
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"/>
|
||||
</Platforms>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory=".\Debug"
|
||||
IntermediateDirectory=".\Debug"
|
||||
ConfigurationType="2"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="FALSE"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\shared,..\..\..\libxml2\include,..\..\..\gtk2-win32\lib\glib-2.0\include,..\..\..\gtk2-win32\include\glib-2.0,..\..\include,..\common,..\..\libs,..\..\libs\nvtristrip,..\..\..\STLPort\stlport"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;MAP_EXPORTS"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="2"
|
||||
PrecompiledHeaderFile=".\Debug/spritemodel.pch"
|
||||
AssemblerListingLocation=".\Debug/"
|
||||
ObjectFile=".\Debug/"
|
||||
ProgramDataBaseFileName=".\Debug/"
|
||||
BrowseInformation="1"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="TRUE"
|
||||
DebugInformationFormat="4"
|
||||
CompileAs="0"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalOptions="/MACHINE:I386"
|
||||
OutputFile=".\Debug/spritemodel.dll"
|
||||
LinkIncremental="2"
|
||||
SuppressStartupBanner="TRUE"
|
||||
AdditionalLibraryDirectories="..\..\libs\mathlib\debug;..\..\libs\synapse\debug;"..\..\..\gtk2-win32\lib\""
|
||||
ModuleDefinitionFile=".\spritemodel.def"
|
||||
GenerateDebugInformation="TRUE"
|
||||
ProgramDatabaseFile=".\Debug/spritemodel.pdb"
|
||||
ImportLibrary=".\Debug/spritemodel.lib"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
MkTypLibCompatible="TRUE"
|
||||
SuppressStartupBanner="TRUE"
|
||||
TargetEnvironment="1"
|
||||
TypeLibraryName=".\Debug/spritemodel.tlb"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
Culture="1036"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory=".\Release"
|
||||
IntermediateDirectory=".\Release"
|
||||
ConfigurationType="2"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="FALSE"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
InlineFunctionExpansion="1"
|
||||
AdditionalIncludeDirectories="..\..\..\libxml2\include\,..\..\..\gtk2-win32\lib\glib-2.0\include,..\..\..\gtk2-win32\include\glib-2.0,..\..\include,..\common,..\..\libs,..\..\libs\nvtristrip,..\..\..\STLPort\stlport"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;MAP_EXPORTS"
|
||||
StringPooling="TRUE"
|
||||
RuntimeLibrary="2"
|
||||
EnableFunctionLevelLinking="TRUE"
|
||||
UsePrecompiledHeader="2"
|
||||
PrecompiledHeaderFile=".\Release/spritemodel.pch"
|
||||
AssemblerListingLocation=".\Release/"
|
||||
ObjectFile=".\Release/"
|
||||
ProgramDataBaseFileName=".\Release/"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="TRUE"
|
||||
CompileAs="0"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalOptions="/MACHINE:I386"
|
||||
OutputFile=".\Release/spritemodel.dll"
|
||||
LinkIncremental="1"
|
||||
SuppressStartupBanner="TRUE"
|
||||
AdditionalLibraryDirectories="..\..\libs\mathlib\release;..\..\libs\synapse\release;"..\..\..\gtk2-win32\lib\""
|
||||
ModuleDefinitionFile=".\spritemodel.def"
|
||||
ProgramDatabaseFile=".\Release/spritemodel.pdb"
|
||||
ImportLibrary=".\Release/spritemodel.lib"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
MkTypLibCompatible="TRUE"
|
||||
SuppressStartupBanner="TRUE"
|
||||
TargetEnvironment="1"
|
||||
TypeLibraryName=".\Release/spritemodel.tlb"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
Culture="1036"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
|
||||
<File
|
||||
RelativePath=".\plugin.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\spritemodel.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\spritemodel.def">
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl">
|
||||
<File
|
||||
RelativePath=".\plugin.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\spritemodel.h">
|
||||
</File>
|
||||
<Filter
|
||||
Name="API"
|
||||
Filter="">
|
||||
<File
|
||||
RelativePath="..\..\include\ifilesystem.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\igl.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\imodel.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\ishaders.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\qerplugin.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\qertypes.h">
|
||||
</File>
|
||||
</Filter>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Resource Files"
|
||||
Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
|
||||
</Filter>
|
||||
<File
|
||||
RelativePath=".\Conscript">
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
Reference in New Issue
Block a user