]> de.git.xonotic.org Git - xonotic/netradiant.git/commitdiff
Merge branch 'diffnoise' into 'master'
authorMario <zacjardine@y7mail.com>
Sun, 29 Apr 2018 12:31:33 +0000 (12:31 +0000)
committerMario <zacjardine@y7mail.com>
Sun, 29 Apr 2018 12:31:33 +0000 (12:31 +0000)
tools: reduce diff noise with GtkRadiant

See merge request xonotic/netradiant!82

plugins/iqmmodel/iqm.cpp
plugins/iqmmodel/iqm.h
plugins/iqmmodel/plugin.cpp
plugins/iqmmodel/plugin.h
tools/quake3/q3map2/game_etut.h
tools/quake3/q3map2/game_quakelive.h
tools/quake3/q3map2/game_wolf.h
tools/quake3/q3map2/game_wolfet.h
tools/quake3/q3map2/help.c
tools/quake3/q3map2/vis.c

index 96883c68842517fe263fa3b04db6dc1b6f15c988..466effcc3a7940e9765c0a2720bcd0bfe215927f 100644 (file)
@@ -1,24 +1,24 @@
 /*
-Copyright (C) 2001-2006, William Joseph.
-Copyright (C) 2010-2014 COR Entertainment, LLC.
-All Rights Reserved.
+   Copyright (C) 2001-2006, William Joseph.
+   Copyright (C) 2010-2014 COR Entertainment, LLC.
+   All Rights Reserved.
 
-This file is part of GtkRadiant.
+   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 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.
+   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
-*/
+   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
+ */
 
 #include "iqm.h"
 
@@ -33,43 +33,41 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 typedef unsigned char byte;
 
 /*
-========================================================================
+   ========================================================================
 
-.IQM triangle model file format
+   .IQM triangle model file format
+
+   ========================================================================
+ */
 
-========================================================================
-*/
 typedef struct {
-    float s;
-    float t;
+       float s;
+       float t;
 } iqmSt_t;
 
-void istream_read_iqmSt(PointerInputStream &inputStream, iqmSt_t &st)
-{
-    st.s = istream_read_float32_le(inputStream);
-    st.t = istream_read_float32_le(inputStream);
+void istream_read_iqmSt( PointerInputStream &inputStream, iqmSt_t &st ){
+       st.s = istream_read_float32_le( inputStream );
+       st.t = istream_read_float32_le( inputStream );
 }
 
 typedef struct {
-    unsigned int indices[3];
+       unsigned int indices[3];
 } iqmTriangle_t;
 
-void istream_read_iqmTriangle(PointerInputStream &inputStream, iqmTriangle_t &triangle)
-{
-    triangle.indices[0] = istream_read_int32_le(inputStream);
-    triangle.indices[1] = istream_read_int32_le(inputStream);
-    triangle.indices[2] = istream_read_int32_le(inputStream);
+void istream_read_iqmTriangle( PointerInputStream &inputStream, iqmTriangle_t &triangle ){
+       triangle.indices[0] = istream_read_int32_le( inputStream );
+       triangle.indices[1] = istream_read_int32_le( inputStream );
+       triangle.indices[2] = istream_read_int32_le( inputStream );
 }
 
 typedef struct {
-    float v[3];
+       float v[3];
 } iqmPos_t;
 
-void istream_read_iqmPos(PointerInputStream &inputStream, iqmPos_t &iqmPos)
-{
-    iqmPos.v[0] = istream_read_float32_le(inputStream);
-    iqmPos.v[1] = istream_read_float32_le(inputStream);
-    iqmPos.v[2] = istream_read_float32_le(inputStream);
+void istream_read_iqmPos( PointerInputStream &inputStream, iqmPos_t &iqmPos ){
+       iqmPos.v[0] = istream_read_float32_le( inputStream );
+       iqmPos.v[1] = istream_read_float32_le( inputStream );
+       iqmPos.v[2] = istream_read_float32_le( inputStream );
 }
 
 const int IQM_POSITION = 0;
@@ -95,190 +93,221 @@ const int IQM_DOUBLE = 8;
 const int IQM_LOOP = 1;
 
 typedef struct iqmHeader_s {
-    byte id[16];
-    unsigned int version;
-    unsigned int filesize;
-    unsigned int flags;
-    unsigned int num_text, ofs_text;
-    unsigned int num_meshes, ofs_meshes;
-    unsigned int num_vertexarrays, num_vertexes, ofs_vertexarrays;
-    unsigned int num_triangles, ofs_triangles, ofs_neighbors;
-    unsigned int num_joints, ofs_joints;
-    unsigned int num_poses, ofs_poses;
-    unsigned int num_anims, ofs_anims;
-    unsigned int num_frames, num_framechannels, ofs_frames, ofs_bounds;
-    unsigned int num_comment, ofs_comment;
-    unsigned int num_extensions, ofs_extensions;
+       byte id[16];
+       unsigned int version;
+       unsigned int filesize;
+       unsigned int flags;
+       unsigned int num_text, ofs_text;
+       unsigned int num_meshes, ofs_meshes;
+       unsigned int num_vertexarrays, num_vertexes, ofs_vertexarrays;
+       unsigned int num_triangles, ofs_triangles, ofs_neighbors;
+       unsigned int num_joints, ofs_joints;
+       unsigned int num_poses, ofs_poses;
+       unsigned int num_anims, ofs_anims;
+       unsigned int num_frames, num_framechannels, ofs_frames, ofs_bounds;
+       unsigned int num_comment, ofs_comment;
+       unsigned int num_extensions, ofs_extensions;
 } iqmHeader_t;
 
-void istream_read_iqmHeader(PointerInputStream &inputStream, iqmHeader_t &header)
-{
-    inputStream.read(header.id, 16);
-#define READINT(x) header.x = istream_read_int32_le(inputStream);
-    READINT (version)
-    READINT (filesize)
-    READINT (flags)
-    READINT (num_text)
-    READINT (ofs_text)
-    READINT (num_meshes)
-    READINT (ofs_meshes)
-    READINT (num_vertexarrays)
-    READINT (num_vertexes)
-    READINT (ofs_vertexarrays)
-    READINT (num_triangles)
-    READINT (ofs_triangles)
-    READINT (ofs_neighbors)
-    READINT (num_joints)
-    READINT (ofs_joints)
-    READINT (num_frames)
-    READINT (num_framechannels)
-    READINT (ofs_frames)
-    READINT (ofs_bounds)
-    READINT (num_comment)
-    READINT (ofs_comment)
-    READINT (num_extensions)
-    READINT (ofs_extensions)
+void istream_read_iqmHeader( PointerInputStream &inputStream, iqmHeader_t &header ){
+       inputStream.read( header.id, 16 );
+#define READINT( x ) header.x = istream_read_int32_le( inputStream );
+       READINT( version )
+       READINT( filesize )
+       READINT( flags )
+       READINT( num_text )
+       READINT( ofs_text )
+       READINT( num_meshes )
+       READINT( ofs_meshes )
+       READINT( num_vertexarrays )
+       READINT( num_vertexes )
+       READINT( ofs_vertexarrays )
+       READINT( num_triangles )
+       READINT( ofs_triangles )
+       READINT( ofs_neighbors )
+       READINT( num_joints )
+       READINT( ofs_joints )
+       READINT( num_frames )
+       READINT( num_framechannels )
+       READINT( ofs_frames )
+       READINT( ofs_bounds )
+       READINT( num_comment )
+       READINT( ofs_comment )
+       READINT( num_extensions )
+       READINT( ofs_extensions )
 #undef READINT
 }
 
-typedef struct iqmvertexarray_s {
-    unsigned int type;
-    unsigned int flags;
-    unsigned int format;
-    unsigned int size;
-    unsigned int offset;
+typedef struct iqmmesh_s {
+       unsigned int name;
+       unsigned int material;
+       unsigned int first_vertex;
+       unsigned int num_vertexes;
+       unsigned int first_triangle;
+       unsigned int num_triangles;
+} iqmmesh_t;
+
+void istream_read_iqmMesh( PointerInputStream &inputStream, iqmmesh_t &iqmmesh ){
+#define READUINT( x ) iqmmesh.x = istream_read_uint32_le( inputStream );
+       READUINT( name )
+       READUINT( material )
+       READUINT( first_vertex )
+       READUINT( num_vertexes )
+       READUINT( first_triangle )
+       READUINT( num_triangles )
+#undef READUINT
 }
-        iqmvertexarray_t;
-
-void istream_read_iqmVertexarray(PointerInputStream &inputStream, iqmvertexarray_t &out)
-{
-#define READINT(x) out.x = istream_read_int32_le(inputStream);
-    READINT (type)
-    READINT (flags)
-    READINT (format)
-    READINT (size)
-    READINT (offset)
+
+typedef struct iqmvertexarray_s {
+       unsigned int type;
+       unsigned int flags;
+       unsigned int format;
+       unsigned int size;
+       unsigned int offset;
+} iqmvertexarray_t;
+
+void istream_read_iqmVertexarray( PointerInputStream &inputStream, iqmvertexarray_t &vertexarray ){
+#define READINT( x ) vertexarray.x = istream_read_int32_le( inputStream );
+       READINT( type )
+       READINT( flags )
+       READINT( format )
+       READINT( size )
+       READINT( offset )
 #undef READINT
 }
 
-
-ArbitraryMeshVertex IQMVertex_construct(const iqmPos_t *pos, const iqmPos_t *norm, const iqmSt_t *st)
-{
-    return ArbitraryMeshVertex(
-            Vertex3f(pos->v[0], pos->v[1], pos->v[2]),
-            Normal3f(norm->v[0], norm->v[1], norm->v[2]),
-            TexCoord2f(st->s, st->t)
-    );
+ArbitraryMeshVertex IQMVertex_construct( const iqmPos_t *pos, const iqmPos_t *norm, const iqmSt_t *st ){
+       return ArbitraryMeshVertex(
+               Vertex3f( pos->v[0], pos->v[1], pos->v[2] ),
+               Normal3f( norm->v[0], norm->v[1], norm->v[2] ),
+               TexCoord2f( st->s, st->t )
+               );
 }
 
-void IQMSurface_read(Model &model, const byte *buffer, ArchiveFile &file)
-{
-    Surface &surface = model.newSurface();
-    iqmHeader_t header;
-    {
-        PointerInputStream inputStream(buffer);
-        istream_read_iqmHeader(inputStream, header);
-    }
-
-    {
-
-        UniqueVertexBuffer<ArbitraryMeshVertex> inserter(surface.vertices());
-        inserter.reserve(header.num_vertexes);
-
-        int ofs_position = -1, ofs_st = -1, ofs_normal = -1;
-        PointerInputStream vaStream(buffer + header.ofs_vertexarrays);
-        for (unsigned int i = 0; i < header.num_vertexarrays; i++) {
-            iqmvertexarray_t va;
-            istream_read_iqmVertexarray(vaStream, va);
-
-            switch (va.type) {
-                case IQM_POSITION:
-                    if (va.format == IQM_FLOAT && va.size == 3) {
-                        ofs_position = va.offset;
-                    }
-                    break;
-                case IQM_TEXCOORD:
-                    if (va.format == IQM_FLOAT && va.size == 2) {
-                        ofs_st = va.offset;
-                    }
-                    break;
-                case IQM_NORMAL:
-                    if (va.format == IQM_FLOAT && va.size == 3) {
-                        ofs_normal = va.offset;
-                    }
-                    break;
-            }
-        }
-
-        surface.indices().reserve(header.num_vertexes);
-
-        PointerInputStream posStream(buffer + ofs_position);
-        Array<iqmPos_t> iqmPos(header.num_vertexes);
-        for (Array<iqmPos_t>::iterator i = iqmPos.begin(); i != iqmPos.end(); ++i) {
-            istream_read_iqmPos(posStream, *i);
-        }
-
-        PointerInputStream normStream(buffer + ofs_normal);
-        Array<iqmPos_t> iqmNorm(header.num_vertexes);
-        for (Array<iqmPos_t>::iterator i = iqmNorm.begin(); i != iqmNorm.end(); ++i) {
-            istream_read_iqmPos(normStream, *i);
-        }
-
-        Array<iqmSt_t> iqmSt(header.num_vertexes);
-        PointerInputStream stStream(buffer + ofs_st);
-        for (Array<iqmSt_t>::iterator i = iqmSt.begin(); i != iqmSt.end(); ++i) {
-            istream_read_iqmSt(stStream, *i);
-        }
-
-        PointerInputStream triangleStream(buffer + header.ofs_triangles);
-        for (unsigned int i = 0; i < header.num_triangles; ++i) {
-            iqmTriangle_t triangle;
-            istream_read_iqmTriangle(triangleStream, triangle);
-            for (int j = 0; j < 3; j++) {
-                surface.indices().insert(inserter.insert(IQMVertex_construct(
-                        &iqmPos[triangle.indices[j]],
-                        &iqmNorm[triangle.indices[j]],
-                        &iqmSt[triangle.indices[j]])));
-            }
-        }
-    }
-
-    surface.setShader("");
-    surface.updateAABB();
+void IQMSurface_read( Model &model, const byte *buffer, ArchiveFile &file ){
+       iqmHeader_t header;
+       {
+               PointerInputStream inputStream( buffer );
+               istream_read_iqmHeader( inputStream, header );
+       }
+
+       int ofs_position = -1, ofs_st = -1, ofs_normal = -1;
+       PointerInputStream vaStream( buffer + header.ofs_vertexarrays );
+       for ( unsigned int i = 0; i < header.num_vertexarrays; i++ ) {
+               iqmvertexarray_t va;
+               istream_read_iqmVertexarray( vaStream, va );
+
+               switch ( va.type ) {
+               case IQM_POSITION:
+                       if ( va.format == IQM_FLOAT && va.size == 3 ) {
+                               ofs_position = va.offset;
+                       }
+                       break;
+               case IQM_TEXCOORD:
+                       if ( va.format == IQM_FLOAT && va.size == 2 ) {
+                               ofs_st = va.offset;
+                       }
+                       break;
+               case IQM_NORMAL:
+                       if ( va.format == IQM_FLOAT && va.size == 3 ) {
+                               ofs_normal = va.offset;
+                       }
+                       break;
+               }
+       }
+
+       PointerInputStream posStream( buffer + ofs_position );
+       Array<iqmPos_t> iqmPos( header.num_vertexes );
+       for ( Array<iqmPos_t>::iterator i = iqmPos.begin(); i != iqmPos.end(); ++i ) {
+               istream_read_iqmPos( posStream, *i );
+       }
+
+       PointerInputStream normStream( buffer + ofs_normal );
+       Array<iqmPos_t> iqmNorm( header.num_vertexes );
+       for ( Array<iqmPos_t>::iterator i = iqmNorm.begin(); i != iqmNorm.end(); ++i ) {
+               istream_read_iqmPos( normStream, *i );
+       }
+
+       Array<iqmSt_t> iqmSt( header.num_vertexes );
+       PointerInputStream stStream( buffer + ofs_st );
+       for ( Array<iqmSt_t>::iterator i = iqmSt.begin(); i != iqmSt.end(); ++i ) {
+               istream_read_iqmSt( stStream, *i );
+       }
+
+       PointerInputStream iqmMesh( buffer + header.ofs_meshes );
+       for ( unsigned int m = 0; m < header.num_meshes; m++ ) {
+               Surface &surface = model.newSurface();
+
+               iqmmesh_t iqmmesh;
+               istream_read_iqmMesh( iqmMesh, iqmmesh );
+
+               bool material_found = false;
+               // if not malformed data neither missing string
+               if ( iqmmesh.material <= header.num_text && iqmmesh.material > 0 ) {
+                       char *material;
+                       material = (char*) buffer + header.ofs_text + iqmmesh.material;
+
+                       if ( material[0] != '\0' ) {
+                               surface.setShader( material );
+                               material_found = true;
+                       }
+               }
+
+               if ( !material_found ) {
+                       // empty string will trigger "textures/shader/notex" on display
+                       surface.setShader( "" );
+               }
+
+               UniqueVertexBuffer<ArbitraryMeshVertex> inserter( surface.vertices() );
+               inserter.reserve( iqmmesh.num_vertexes );
+
+               surface.indices().reserve( iqmmesh.num_vertexes );
+
+               unsigned int triangle_offset = header.ofs_triangles + iqmmesh.first_triangle * sizeof( iqmTriangle_t );
+               PointerInputStream triangleStream( buffer + triangle_offset );
+               for ( unsigned int i = 0; i < iqmmesh.num_triangles; ++i ) {
+                       iqmTriangle_t triangle;
+                       istream_read_iqmTriangle( triangleStream, triangle );
+                       for ( int j = 0; j < 3; j++ ) {
+                               surface.indices().insert( inserter.insert( IQMVertex_construct(
+                                                                                                                          &iqmPos[triangle.indices[j]],
+                                                                                                                          &iqmNorm[triangle.indices[j]],
+                                                                                                                          &iqmSt[triangle.indices[j]] ) ) );
+                       }
+               }
+
+               surface.updateAABB();
+       }
 }
 
-void IQMModel_read(Model &model, const byte *buffer, ArchiveFile &file)
-{
-    IQMSurface_read(model, buffer, file);
-    model.updateAABB();
+void IQMModel_read( Model &model, const byte *buffer, ArchiveFile &file ){
+       IQMSurface_read( model, buffer, file );
+       model.updateAABB();
 }
 
-scene::Node &IQMModel_new(const byte *buffer, ArchiveFile &file)
-{
-    ModelNode *modelNode = new ModelNode();
-    IQMModel_read(modelNode->model(), buffer, file);
-    return modelNode->node();
+scene::Node &IQMModel_new( const byte *buffer, ArchiveFile &file ){
+       ModelNode *modelNode = new ModelNode();
+       IQMModel_read( modelNode->model(), buffer, file );
+       return modelNode->node();
 }
 
-scene::Node &IQMModel_default()
-{
-    ModelNode *modelNode = new ModelNode();
-    Model_constructNull(modelNode->model());
-    return modelNode->node();
+scene::Node &IQMModel_default(){
+       ModelNode *modelNode = new ModelNode();
+       Model_constructNull( modelNode->model() );
+       return modelNode->node();
 }
 
-scene::Node &IQMModel_fromBuffer(unsigned char *buffer, ArchiveFile &file)
-{
-    if (memcmp(buffer, "INTERQUAKEMODEL", 16)) {
-        globalErrorStream() << "IQM read error: incorrect ident\n";
-        return IQMModel_default();
-    } else {
-        return IQMModel_new(buffer, file);
-    }
+scene::Node &IQMModel_fromBuffer( unsigned char *buffer, ArchiveFile &file ){
+       if ( memcmp( buffer, "INTERQUAKEMODEL", 16 ) ) {
+               globalErrorStream() << "IQM read error: incorrect ident\n";
+               return IQMModel_default();
+       }
+       else {
+               return IQMModel_new( buffer, file );
+       }
 }
 
-scene::Node &loadIQMModel(ArchiveFile &file)
-{
-    ScopedArchiveBuffer buffer(file);
-    return IQMModel_fromBuffer(buffer.buffer, file);
+scene::Node &loadIQMModel( ArchiveFile &file ){
+       ScopedArchiveBuffer buffer( file );
+       return IQMModel_fromBuffer( buffer.buffer, file );
 }
index f706a998a290a653f45be03252227b29f22a95d5..8f48f3bb4b40694f64c908041adfe1bd084e1994 100644 (file)
@@ -1,31 +1,31 @@
 /*
-Copyright (C) 2001-2006, William Joseph.
-All Rights Reserved.
+   Copyright (C) 2001-2006, William Joseph.
+   All Rights Reserved.
 
-This file is part of GtkRadiant.
+   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 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.
+   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
-*/
+   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
+ */
 
-#if !defined(INCLUDED_IQM_H)
+#if !defined( INCLUDED_IQM_H )
 #define INCLUDED_IQM_H
 
 namespace scene { class Node; }
 class ArchiveFile;
 
-scene::Node &loadIQMModel(ArchiveFile &file);
+scene::Node &loadIQMModel( ArchiveFile &file );
 
 
 #endif
index 4c0264687752505d4d707029b95779a251f97966..b6d896e342da1c9dce37945becd1178fcceffed3 100644 (file)
@@ -1,23 +1,23 @@
 /*
-Copyright (C) 2001-2006, William Joseph.
-All Rights Reserved.
+   Copyright (C) 2001-2006, William Joseph.
+   All Rights Reserved.
 
-This file is part of GtkRadiant.
+   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 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.
+   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
-*/
+   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
+ */
 
 #include "plugin.h"
 
@@ -40,47 +40,43 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
 class IQMModelLoader : public ModelLoader {
 public:
-    scene::Node &loadModel(ArchiveFile &file)
-    {
-        return loadIQMModel(file);
-    }
+scene::Node &loadModel( ArchiveFile &file ){
+       return loadIQMModel( file );
+}
 };
 
 class ModelDependencies :
-        public GlobalFileSystemModuleRef,
-        public GlobalOpenGLModuleRef,
-        public GlobalUndoModuleRef,
-        public GlobalSceneGraphModuleRef,
-        public GlobalShaderCacheModuleRef,
-        public GlobalSelectionModuleRef,
-        public GlobalFiletypesModuleRef {
+       public GlobalFileSystemModuleRef,
+       public GlobalOpenGLModuleRef,
+       public GlobalUndoModuleRef,
+       public GlobalSceneGraphModuleRef,
+       public GlobalShaderCacheModuleRef,
+       public GlobalSelectionModuleRef,
+       public GlobalFiletypesModuleRef {
 };
 
 class ModelIQMAPI : public TypeSystemRef {
-    IQMModelLoader m_modeliqm;
+IQMModelLoader m_modeliqm;
 public:
-    typedef ModelLoader Type;
+typedef ModelLoader Type;
 
-    STRING_CONSTANT(Name, "iqm");
+STRING_CONSTANT( Name, "iqm" );
 
-    ModelIQMAPI()
-    {
-        GlobalFiletypesModule::getTable().addType(Type::Name(), Name(), filetype_t("iqm models", "*.iqm"));
-    }
+ModelIQMAPI(){
+       GlobalFiletypesModule::getTable().addType( Type::Name(), Name(), filetype_t( "InterQuake Models", "*.iqm" ) );
+}
 
-    ModelLoader *getTable()
-    {
-        return &m_modeliqm;
-    }
+ModelLoader *getTable(){
+       return &m_modeliqm;
+}
 };
 
 typedef SingletonModule<ModelIQMAPI, ModelDependencies> ModelIQMModule;
 
 ModelIQMModule g_ModelIQMModule;
 
-extern "C" void RADIANT_DLLEXPORT Radiant_RegisterModules(ModuleServer &server)
-{
-    initialiseModule(server);
+extern "C" void RADIANT_DLLEXPORT Radiant_RegisterModules( ModuleServer &server ){
+       initialiseModule( server );
 
-    g_ModelIQMModule.selfRegister();
+       g_ModelIQMModule.selfRegister();
 }
index 2f338b602701eb586d6382fd978b2be106700d48..c6bfe6cead95bb5357902a7f82c878a18ded8ec9 100644 (file)
@@ -1,25 +1,25 @@
 /*
-Copyright (C) 2001-2006, William Joseph.
-All Rights Reserved.
+   Copyright (C) 2001-2006, William Joseph.
+   All Rights Reserved.
 
-This file is part of GtkRadiant.
+   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 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.
+   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
-*/
+   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
+ */
 
-#if !defined(INCLUDED_SAMPLE_H)
+#if !defined( INCLUDED_SAMPLE_H )
 #define INCLUDED_SAMPLE_H
 
 #endif
index 0841283da3179b83a7d76bfdcd387435a29b58e1..f4303f2e63153470c2f3431d8d14567239c923f2 100644 (file)
        "flareshader",      /* default flare shader */
        qfalse,             /* wolf lighting model? */
        128,                /* lightmap width/height */
-       1.0f,               /* lightmap gamma */
+       2.2f,               /* lightmap gamma */
        qtrue,              /* lightmap sRGB */
        qfalse,             /* texture sRGB (yes, this is incorrect, but we better match ET:UT) */
        qfalse,             /* color sRGB */
index a130ead1312941f2efbe31ec5923983c34d99f1d..3f7a29daa659119121701e1b59164a702223e7b5 100644 (file)
    ------------------------------------------------------------------------------- */
 
 
+   /* -------------------------------------------------------------------------------
+
+   Additional surface flags for Quake Live
+
+   ------------------------------------------------------------------------------- */
+
+#define Q_SURF_SNOWSTEPS       0x80000         // snow footsteps
+#define Q_SURF_WOODSTEPS       0x100000        // wood footsteps
+#define Q_SURF_DMGTHROUGH      0x200000        // Missile dmg through surface(?)
+                                                                               // (This is not in use atm, will
+                                                                               //  probably be re-purposed some day.)
+
 
 /* -------------------------------------------------------------------------------
 
@@ -52,9 +64,9 @@
 
 {
        "quakelive",        /* -game x */
-       "baseq3",           /* default base game data dir (FIXME what does quake live really use?) */
-       ".q3a",             /* unix home sub-dir (FIXME what does quake live really use?) */
-       "quake",            /* magic path word (FIXME where does quake live install to?) */
+       "baseq3",           /* default base game data dir */
+       ".quakelive/quakelive/home",             /* unix home sub-dir */
+       "quake",            /* magic path word */
        "scripts",          /* shader directory */
        64,                 /* max lightmapped surface verts */
        999,                /* max surface verts */
                { "ladder",         0,                          0,                          Q_SURF_LADDER,              0,                          0,                          0 },
                { "nodamage",       0,                          0,                          Q_SURF_NODAMAGE,            0,                          0,                          0 },
                { "metalsteps",     0,                          0,                          Q_SURF_METALSTEPS,          0,                          0,                          0 },
+               { "snowsteps",      0,                          0,                          Q_SURF_SNOWSTEPS,           0,                          0,                          0 },
+               { "woodsteps",      0,                          0,                          Q_SURF_WOODSTEPS,           0,                          0,                          0 },
+               { "dmgthrough",     0,                          0,                          Q_SURF_DMGTHROUGH,          0,                          0,                          0 },
                { "flesh",          0,                          0,                          Q_SURF_FLESH,               0,                          0,                          0 },
                { "nosteps",        0,                          0,                          Q_SURF_NOSTEPS,             0,                          0,                          0 },
                { "nodlight",       0,                          0,                          Q_SURF_NODLIGHT,            0,                          0,                          0 },
index b4a3f7d6555e9e7fd494434132e587588f0c575d..fcfd17ec964f65a877d118b9b496d3fd3f995a62 100644 (file)
                { "clusterportal",  W_CONT_CLUSTERPORTAL,       W_CONT_SOLID,               0,                          0,                          C_TRANSLUCENT,              C_SOLID },
                { "donotenter",     W_CONT_DONOTENTER,          W_CONT_SOLID,               0,                          0,                          C_TRANSLUCENT,              C_SOLID },
                { "nonotenterlarge",W_CONT_DONOTENTER_LARGE,    W_CONT_SOLID,               0,                          0,                          C_TRANSLUCENT,              C_SOLID },
+               { "donotenterlarge",W_CONT_DONOTENTER_LARGE,    W_CONT_SOLID,               0,                          0,                          C_TRANSLUCENT,              C_SOLID },
 
                { "fog",            W_CONT_FOG,                 W_CONT_SOLID,               0,                          0,                          C_FOG,                      C_SOLID },
                { "sky",            0,                          0,                          W_SURF_SKY,                 0,                          C_SKY,                      0 },
index 1401323adb15595dc1295af1fadd787d44cf0034..c783b9a0805a89a4b3d7799171668c8ab2f57f1c 100644 (file)
                { "clusterportal",  W_CONT_CLUSTERPORTAL,       W_CONT_SOLID,               0,                          0,                          C_TRANSLUCENT,              C_SOLID },
                { "donotenter",     W_CONT_DONOTENTER,          W_CONT_SOLID,               0,                          0,                          C_TRANSLUCENT,              C_SOLID },
                { "nonotenterlarge",W_CONT_DONOTENTER_LARGE,    W_CONT_SOLID,               0,                          0,                          C_TRANSLUCENT,              C_SOLID },
+               { "donotenterlarge",W_CONT_DONOTENTER_LARGE,    W_CONT_SOLID,               0,                          0,                          C_TRANSLUCENT,              C_SOLID },
 
                { "fog",            W_CONT_FOG,                 W_CONT_SOLID,               0,                          0,                          C_FOG,                      C_SOLID },
                { "sky",            0,                          0,                          W_SURF_SKY,                 0,                          C_SKY,                      0 },
index 519a46e1e57739b5c5046b26b4e3c41aba5680d5..17b21173bb4e4f7fe5f7bf15a62eb972344c21f2 100644 (file)
@@ -101,7 +101,7 @@ void HelpBsp()
                {"-flat", "Enable flat shading (good for combining with -celshader)"},
                {"-fulldetail", "Treat detail brushes as structural ones"},
                {"-leaktest", "Abort if a leak was found"},
-               {"-linefile <filename.lin>", "Line file to write"},
+               {"-linfile <filename.lin>", "Line file to write"},
                {"-meta", "Combine adjacent triangles of the same texture to surfaces (ALWAYS USE THIS)"},
                {"-minsamplesize <N>", "Sets minimum lightmap resolution in luxels/qu"},
                {"-mi <N>", "Sets the maximum number of indexes per surface"},
@@ -137,6 +137,7 @@ void HelpVis()
        struct HelpOption vis[] = {
                {"-vis <filename.map>", "Switch that enters this stage"},
                {"-fast", "Very fast and crude vis calculation"},
+               {"-hint", "Merge all but hint portals"},
                {"-mergeportals", "The less crude half of `-merge`, makes vis sometimes much faster but doesn't hurt fps usually"},
                {"-merge", "Faster but still okay vis calculation"},
                {"-nopassage", "Just use PortalFlow vis (usually less fps)"},
@@ -206,6 +207,8 @@ void HelpLight()
                {"-gridscale <F>", "Scaling factor for the light grid only"},
                {"-keeplights", "Keep light entities in the BSP file after compile"},
                {"-lightmapdir <directory>", "Directory to store external lightmaps (default: same as map name without extension)"},
+               {"-lightmapsearchblocksize <N>", "Restrict lightmap search to block size <N>"},
+               {"-lightmapsearchpower <N>", "Optimize for lightmap merge power <N>"},
                {"-lightmapsize <N>", "Size of lightmaps to generate (must be a power of two)"},
                {"-lightsubdiv <N>", "Size of light emitting shader subdivision"},
                {"-lomem", "Low memory but slower lighting mode"},
index 97d8b1f94a9926a00cc982652cb1dbcc5e6a23f0..98f208ab2149e3b2e76d12091de175451152b2c2 100644 (file)
@@ -1170,7 +1170,7 @@ int VisMain( int argc, char **argv ){
        }
 
        if ( i != argc - 1 ) {
-               Error( "usage: vis [-threads #] [-level 0-4] [-fast] [-v] BSPFilePath" );
+               Error( "usage: vis [-threads #] [-fast] [-v] BSPFilePath" );
        }
 
 
@@ -1186,9 +1186,9 @@ int VisMain( int argc, char **argv ){
                sprintf( portalFilePath, "%s%s", inbase, ExpandArg( argv[ i ] ) );
                StripExtension( portalFilePath );
                strcat( portalFilePath, ".prt" );
-               Sys_Printf( "Loading %s\n", portalFilePath );
-               LoadPortals( portalFilePath );
        }
+       Sys_Printf( "Loading %s\n", portalFilePath );
+       LoadPortals( portalFilePath );
 
        /* ydnar: exit if no portals, hence no vis */
        if ( numportals == 0 ) {