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:
8
include/.cvsignore
Normal file
8
include/.cvsignore
Normal file
@@ -0,0 +1,8 @@
|
||||
version
|
||||
version.h
|
||||
version.new
|
||||
aboutmsg
|
||||
aboutmsg.h
|
||||
aboutmsg.new
|
||||
RADIANT_MAJOR
|
||||
RADIANT_MINOR
|
||||
23
include/cullable.cpp
Normal file
23
include/cullable.cpp
Normal file
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
Copyright (C) 2001-2006, William Joseph.
|
||||
All Rights Reserved.
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
#include "cullable.h"
|
||||
|
||||
71
include/cullable.h
Normal file
71
include/cullable.h
Normal file
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
Copyright (C) 2001-2006, William Joseph.
|
||||
All Rights Reserved.
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
#if !defined(INCLUDED_CULLABLE_H)
|
||||
#define INCLUDED_CULLABLE_H
|
||||
|
||||
#include "generic/constant.h"
|
||||
|
||||
template<typename Element> class BasicVector3;
|
||||
typedef BasicVector3<float> Vector3;
|
||||
class Plane3;
|
||||
class Matrix4;
|
||||
class AABB;
|
||||
class Segment;
|
||||
|
||||
template<typename Enumeration> class EnumeratedValue;
|
||||
struct VolumeIntersection;
|
||||
typedef EnumeratedValue<VolumeIntersection> VolumeIntersectionValue;
|
||||
|
||||
class VolumeTest
|
||||
{
|
||||
public:
|
||||
|
||||
/// \brief Returns true if \p point intersects volume.
|
||||
virtual bool TestPoint(const Vector3& point) const = 0;
|
||||
/// \brief Returns true if \p segment intersects volume.
|
||||
virtual bool TestLine(const Segment& segment) const = 0;
|
||||
/// \brief Returns true if \p plane faces towards volume.
|
||||
virtual bool TestPlane(const Plane3& plane) const = 0;
|
||||
/// \brief Returns true if \p plane transformed by \p localToWorld faces the viewer.
|
||||
virtual bool TestPlane(const Plane3& plane, const Matrix4& localToWorld) const = 0;
|
||||
/// \brief Returns the intersection of \p aabb and volume.
|
||||
virtual VolumeIntersectionValue TestAABB(const AABB& aabb) const = 0;
|
||||
/// \brief Returns the intersection of \p aabb transformed by \p localToWorld and volume.
|
||||
virtual VolumeIntersectionValue TestAABB(const AABB& aabb, const Matrix4& localToWorld) const = 0;
|
||||
|
||||
virtual bool fill() const = 0;
|
||||
|
||||
virtual const Matrix4& GetViewport() const = 0;
|
||||
virtual const Matrix4& GetProjection() const = 0;
|
||||
virtual const Matrix4& GetModelview() const = 0;
|
||||
};
|
||||
|
||||
class Cullable
|
||||
{
|
||||
public:
|
||||
STRING_CONSTANT(Name, "Cullable");
|
||||
|
||||
virtual VolumeIntersectionValue intersectVolume(const VolumeTest& test, const Matrix4& localToWorld) const = 0;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
23
include/editable.cpp
Normal file
23
include/editable.cpp
Normal file
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
Copyright (C) 2001-2006, William Joseph.
|
||||
All Rights Reserved.
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
#include "editable.h"
|
||||
|
||||
60
include/editable.h
Normal file
60
include/editable.h
Normal file
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
Copyright (C) 2001-2006, William Joseph.
|
||||
All Rights Reserved.
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
#if !defined(INCLUDED_EDITABLE_H)
|
||||
#define INCLUDED_EDITABLE_H
|
||||
|
||||
template<typename Element> class BasicVector3;
|
||||
typedef BasicVector3<float> Vector3;
|
||||
template<typename Element> class BasicVector4;
|
||||
typedef BasicVector4<float> Vector4;
|
||||
class Matrix4;
|
||||
typedef Vector4 Quaternion;
|
||||
|
||||
#include "scenelib.h"
|
||||
|
||||
class Editable
|
||||
{
|
||||
public:
|
||||
STRING_CONSTANT(Name, "Editable");
|
||||
|
||||
virtual const Matrix4& getLocalPivot() const = 0;
|
||||
};
|
||||
|
||||
inline Editable* Node_getEditable(scene::Node& node)
|
||||
{
|
||||
return NodeTypeCast<Editable>::cast(node);
|
||||
}
|
||||
|
||||
class Snappable
|
||||
{
|
||||
public:
|
||||
STRING_CONSTANT(Name, "Snappable");
|
||||
|
||||
virtual void snapto(float snap) = 0;
|
||||
};
|
||||
|
||||
inline Snappable* Node_getSnappable(scene::Node& node)
|
||||
{
|
||||
return NodeTypeCast<Snappable>::cast(node);
|
||||
}
|
||||
|
||||
#endif
|
||||
23
include/iarchive.cpp
Normal file
23
include/iarchive.cpp
Normal file
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
Copyright (C) 2001-2006, William Joseph.
|
||||
All Rights Reserved.
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
#include "iarchive.h"
|
||||
|
||||
162
include/iarchive.h
Normal file
162
include/iarchive.h
Normal file
@@ -0,0 +1,162 @@
|
||||
/*
|
||||
Copyright (C) 2001-2006, William Joseph.
|
||||
All Rights Reserved.
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
#if !defined(INCLUDED_IARCHIVE_H)
|
||||
#define INCLUDED_IARCHIVE_H
|
||||
|
||||
#include <cstddef>
|
||||
#include "generic/constant.h"
|
||||
|
||||
class InputStream;
|
||||
|
||||
/// \brief A file opened in binary mode.
|
||||
class ArchiveFile
|
||||
{
|
||||
public:
|
||||
/// \brief Destroys the file object.
|
||||
virtual void release() = 0;
|
||||
/// \brief Returns the size of the file data in bytes.
|
||||
virtual std::size_t size() const = 0;
|
||||
/// \brief Returns the path to this file (relative to the filesystem root)
|
||||
virtual const char* getName() const = 0;
|
||||
/// \brief Returns the stream associated with this file.
|
||||
/// Subsequent calls return the same stream.
|
||||
/// The stream may be read forwards until it is exhausted.
|
||||
/// The stream remains valid for the lifetime of the file.
|
||||
virtual InputStream& getInputStream() = 0;
|
||||
};
|
||||
|
||||
class TextInputStream;
|
||||
|
||||
/// \brief A file opened in text mode.
|
||||
class ArchiveTextFile
|
||||
{
|
||||
public:
|
||||
/// \brief Destroys the file object.
|
||||
virtual void release() = 0;
|
||||
/// \brief Returns the stream associated with this file.
|
||||
/// Subsequent calls return the same stream.
|
||||
/// The stream may be read forwards until it is exhausted.
|
||||
/// The stream remains valid for the lifetime of the file.
|
||||
virtual TextInputStream& getInputStream() = 0;
|
||||
};
|
||||
|
||||
class ScopedArchiveFile
|
||||
{
|
||||
ArchiveFile& m_file;
|
||||
public:
|
||||
ScopedArchiveFile(ArchiveFile& file) : m_file(file)
|
||||
{
|
||||
}
|
||||
~ScopedArchiveFile()
|
||||
{
|
||||
m_file.release();
|
||||
}
|
||||
};
|
||||
|
||||
class CustomArchiveVisitor;
|
||||
|
||||
class Archive
|
||||
{
|
||||
public:
|
||||
|
||||
class Visitor
|
||||
{
|
||||
public:
|
||||
virtual void visit(const char* name) = 0;
|
||||
};
|
||||
|
||||
typedef CustomArchiveVisitor VisitorFunc;
|
||||
|
||||
enum EMode
|
||||
{
|
||||
eFiles = 0x01,
|
||||
eDirectories = 0x02,
|
||||
eFilesAndDirectories = 0x03,
|
||||
};
|
||||
|
||||
/// \brief Destroys the archive object.
|
||||
/// Any unreleased file object associated with the archive remains valid. */
|
||||
virtual void release() = 0;
|
||||
/// \brief Returns a new object associated with the file identified by \p name, or 0 if the file cannot be opened.
|
||||
/// Name comparisons are case-insensitive.
|
||||
virtual ArchiveFile* openFile(const char* name) = 0;
|
||||
/// \brief Returns a new object associated with the file identified by \p name, or 0 if the file cannot be opened.
|
||||
/// Name comparisons are case-insensitive.
|
||||
virtual ArchiveTextFile* openTextFile(const char* name) = 0;
|
||||
/// Returns true if the file identified by \p name can be opened.
|
||||
/// Name comparisons are case-insensitive.
|
||||
virtual bool containsFile(const char* name) = 0;
|
||||
/// \brief Performs a depth-first traversal of the archive tree starting at \p root.
|
||||
/// Traverses the entire tree if \p root is "".
|
||||
/// When a file is encountered, calls \c visitor.file passing the file name.
|
||||
/// When a directory is encountered, calls \c visitor.directory passing the directory name.
|
||||
/// Skips the directory if \c visitor.directory returned true.
|
||||
/// Root comparisons are case-insensitive.
|
||||
/// Names are mixed-case.
|
||||
virtual void forEachFile(VisitorFunc visitor, const char* root) = 0;
|
||||
};
|
||||
|
||||
class CustomArchiveVisitor
|
||||
{
|
||||
Archive::Visitor* m_visitor;
|
||||
Archive::EMode m_mode;
|
||||
std::size_t m_depth;
|
||||
public:
|
||||
CustomArchiveVisitor(Archive::Visitor& visitor, Archive::EMode mode, std::size_t depth)
|
||||
: m_visitor(&visitor), m_mode(mode), m_depth(depth)
|
||||
{
|
||||
}
|
||||
void file(const char* name)
|
||||
{
|
||||
if((m_mode & Archive::eFiles) != 0)
|
||||
m_visitor->visit(name);
|
||||
}
|
||||
bool directory(const char* name, std::size_t depth)
|
||||
{
|
||||
if((m_mode & Archive::eDirectories) != 0)
|
||||
m_visitor->visit(name);
|
||||
if(depth == m_depth)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
typedef Archive* (*PFN_OPENARCHIVE) (const char* name);
|
||||
|
||||
class _QERArchiveTable
|
||||
{
|
||||
public:
|
||||
INTEGER_CONSTANT(Version, 1);
|
||||
STRING_CONSTANT(Name, "archive");
|
||||
|
||||
PFN_OPENARCHIVE m_pfnOpenArchive;
|
||||
};
|
||||
|
||||
template<typename Type>
|
||||
class Modules;
|
||||
typedef Modules<_QERArchiveTable> ArchiveModules;
|
||||
|
||||
template<typename Type>
|
||||
class ModulesRef;
|
||||
typedef ModulesRef<_QERArchiveTable> ArchiveModulesRef;
|
||||
|
||||
#endif
|
||||
23
include/ibrush.cpp
Normal file
23
include/ibrush.cpp
Normal file
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
Copyright (C) 2001-2006, William Joseph.
|
||||
All Rights Reserved.
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
#include "ibrush.h"
|
||||
|
||||
56
include/ibrush.h
Normal file
56
include/ibrush.h
Normal file
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
Copyright (C) 2001-2006, William Joseph.
|
||||
All Rights Reserved.
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
#if !defined(INCLUDED_IBRUSH_H)
|
||||
#define INCLUDED_IBRUSH_H
|
||||
|
||||
#include "generic/constant.h"
|
||||
|
||||
namespace scene
|
||||
{
|
||||
class Node;
|
||||
}
|
||||
|
||||
class BrushCreator
|
||||
{
|
||||
public:
|
||||
INTEGER_CONSTANT(Version, 1);
|
||||
STRING_CONSTANT(Name, "brush");
|
||||
virtual scene::Node& createBrush() = 0;
|
||||
virtual bool useAlternativeTextureProjection() const = 0;
|
||||
};
|
||||
|
||||
#include "modulesystem.h"
|
||||
|
||||
template<typename Type>
|
||||
class GlobalModule;
|
||||
typedef GlobalModule<BrushCreator> GlobalBrushModule;
|
||||
|
||||
template<typename Type>
|
||||
class GlobalModuleRef;
|
||||
typedef GlobalModuleRef<BrushCreator> GlobalBrushModuleRef;
|
||||
|
||||
inline BrushCreator& GlobalBrushCreator()
|
||||
{
|
||||
return GlobalBrushModule::getTable();
|
||||
}
|
||||
|
||||
#endif
|
||||
23
include/icamera.cpp
Normal file
23
include/icamera.cpp
Normal file
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
Copyright (C) 1999-2006 Id Software, Inc. and contributors.
|
||||
For a list of contributors, see the accompanying CONTRIBUTORS file.
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
#include "icamera.h"
|
||||
|
||||
68
include/icamera.h
Normal file
68
include/icamera.h
Normal file
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
Copyright (C) 1999-2006 Id Software, Inc. and contributors.
|
||||
For a list of contributors, see the accompanying CONTRIBUTORS file.
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// DESCRIPTION:
|
||||
// camera interface
|
||||
//
|
||||
|
||||
#if !defined(INCLUDED_ICAMERA_H)
|
||||
#define INCLUDED_ICAMERA_H
|
||||
|
||||
#include "generic/constant.h"
|
||||
|
||||
class Matrix4;
|
||||
|
||||
class CameraView
|
||||
{
|
||||
public:
|
||||
virtual void setModelview(const Matrix4& modelview) = 0;
|
||||
virtual void setFieldOfView(float fieldOfView) = 0;
|
||||
};
|
||||
|
||||
class Callback;
|
||||
|
||||
class CameraModel
|
||||
{
|
||||
public:
|
||||
STRING_CONSTANT(Name, "CameraModel");
|
||||
virtual void setCameraView(CameraView* view, const Callback& disconnect) = 0;
|
||||
};
|
||||
|
||||
template<typename Element> class BasicVector3;
|
||||
typedef BasicVector3<float> Vector3;
|
||||
|
||||
typedef void (* PFN_GETCAMERA) ( Vector3& origin, Vector3& angles );
|
||||
typedef void (* PFN_SETCAMERA) ( const Vector3& origin, const Vector3& angles );
|
||||
typedef void (* PFN_GETCAMWINDOWEXTENTS) ( int *x, int *y, int *width, int *height );
|
||||
|
||||
struct _QERCameraTable
|
||||
{
|
||||
INTEGER_CONSTANT(Version, 1);
|
||||
STRING_CONSTANT(Name, "camera");
|
||||
|
||||
PFN_GETCAMERA m_pfnGetCamera;
|
||||
PFN_SETCAMERA m_pfnSetCamera;
|
||||
PFN_GETCAMWINDOWEXTENTS m_pfnGetCamWindowExtents;
|
||||
};
|
||||
|
||||
#endif
|
||||
23
include/idatastream.cpp
Normal file
23
include/idatastream.cpp
Normal file
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
Copyright (C) 2001-2006, William Joseph.
|
||||
All Rights Reserved.
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
#include "idatastream.h"
|
||||
|
||||
83
include/idatastream.h
Normal file
83
include/idatastream.h
Normal file
@@ -0,0 +1,83 @@
|
||||
/*
|
||||
Copyright (C) 2001-2006, William Joseph.
|
||||
All Rights Reserved.
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
#if !defined(INCLUDED_IDATASTREAM_H)
|
||||
#define INCLUDED_IDATASTREAM_H
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
class StreamBase
|
||||
{
|
||||
public:
|
||||
typedef std::size_t size_type;
|
||||
typedef unsigned char byte_type;
|
||||
};
|
||||
|
||||
/// \brief A read-only byte-stream.
|
||||
class InputStream : public StreamBase
|
||||
{
|
||||
public:
|
||||
/// \brief Attempts to read the next \p length bytes from the stream to \p buffer.
|
||||
/// Returns the number of bytes actually stored in \p buffer.
|
||||
virtual size_type read(byte_type* buffer, size_type length) = 0;
|
||||
};
|
||||
|
||||
/// \brief A write-only byte-stream.
|
||||
class OutputStream : public StreamBase
|
||||
{
|
||||
public:
|
||||
/// \brief Attempts to write \p length bytes to the stream from \p buffer.
|
||||
/// Returns the number of bytes actually read from \p buffer.
|
||||
virtual size_type write(const byte_type* buffer, size_type length) = 0;
|
||||
};
|
||||
|
||||
class SeekableStream
|
||||
{
|
||||
public:
|
||||
typedef int offset_type;
|
||||
typedef std::size_t position_type;
|
||||
|
||||
enum seekdir
|
||||
{
|
||||
beg,
|
||||
cur,
|
||||
end,
|
||||
};
|
||||
|
||||
/// \brief Sets the current \p position of the stream relative to the start.
|
||||
virtual position_type seek(position_type position) = 0;
|
||||
/// \brief Sets the current \p position of the stream relative to either the start, end or current position.
|
||||
virtual position_type seek(offset_type offset, seekdir direction) = 0;
|
||||
/// \brief Returns the current position of the stream.
|
||||
virtual position_type tell() const = 0;
|
||||
};
|
||||
|
||||
/// \brief A seekable read-only byte-stream.
|
||||
class SeekableInputStream : public InputStream, public SeekableStream
|
||||
{
|
||||
};
|
||||
|
||||
/// \brief A seekable write-only byte-stream.
|
||||
class SeekableOutputStream : public OutputStream, public SeekableStream
|
||||
{
|
||||
};
|
||||
|
||||
#endif
|
||||
23
include/ieclass.cpp
Normal file
23
include/ieclass.cpp
Normal file
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
Copyright (C) 1999-2006 Id Software, Inc. and contributors.
|
||||
For a list of contributors, see the accompanying CONTRIBUTORS file.
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
#include "ieclass.h"
|
||||
|
||||
118
include/ieclass.h
Normal file
118
include/ieclass.h
Normal file
@@ -0,0 +1,118 @@
|
||||
/*
|
||||
Copyright (C) 1999-2006 Id Software, Inc. and contributors.
|
||||
For a list of contributors, see the accompanying CONTRIBUTORS file.
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
/// \file ieclass.h
|
||||
/// \brief Entity Class definition loader API.
|
||||
|
||||
|
||||
#if !defined(INCLUDED_IECLASS_H)
|
||||
#define INCLUDED_IECLASS_H
|
||||
|
||||
#include "generic/constant.h"
|
||||
|
||||
#define MAX_FLAGS 16
|
||||
|
||||
// eclass show flags
|
||||
|
||||
#define ECLASS_LIGHT 0x00000001
|
||||
#define ECLASS_ANGLE 0x00000002
|
||||
#define ECLASS_PATH 0x00000004
|
||||
#define ECLASS_MISCMODEL 0x00000008
|
||||
|
||||
class Shader;
|
||||
|
||||
class EntityClass;
|
||||
class ListAttributeType;
|
||||
|
||||
class EntityClassCollector
|
||||
{
|
||||
public:
|
||||
virtual void insert(EntityClass* eclass) = 0;
|
||||
virtual void insert(const char* name, const ListAttributeType& list)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
struct EntityClassScanner
|
||||
{
|
||||
INTEGER_CONSTANT(Version, 1);
|
||||
STRING_CONSTANT(Name, "eclass");
|
||||
|
||||
void (*scanFile)(EntityClassCollector& collector, const char* filename);
|
||||
const char* (*getExtension)();
|
||||
};
|
||||
|
||||
#include "modulesystem.h"
|
||||
|
||||
template<typename Type>
|
||||
class GlobalModule;
|
||||
typedef GlobalModule<EntityClassScanner> GlobalEClassModule;
|
||||
|
||||
template<typename Type>
|
||||
class GlobalModuleRef;
|
||||
typedef GlobalModuleRef<EntityClassScanner> GlobalEClassModuleRef;
|
||||
|
||||
inline EntityClassScanner& GlobalEClassLoader()
|
||||
{
|
||||
return GlobalEClassModule::getTable();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
class EntityClassVisitor
|
||||
{
|
||||
public:
|
||||
virtual void visit(EntityClass* eclass) = 0;
|
||||
};
|
||||
|
||||
class ModuleObserver;
|
||||
|
||||
|
||||
struct EntityClassManager
|
||||
{
|
||||
INTEGER_CONSTANT(Version, 1);
|
||||
STRING_CONSTANT(Name, "eclassmanager");
|
||||
|
||||
EntityClass* (*findOrInsert)(const char* name, bool has_brushes);
|
||||
const ListAttributeType* (*findListType)(const char* name);
|
||||
void (*forEach)(EntityClassVisitor& visitor);
|
||||
void (*attach)(ModuleObserver& observer);
|
||||
void (*detach)(ModuleObserver& observer);
|
||||
void (*realise)();
|
||||
void (*unrealise)();
|
||||
};
|
||||
|
||||
template<typename Type>
|
||||
class GlobalModule;
|
||||
typedef GlobalModule<EntityClassManager> GlobalEntityClassManagerModule;
|
||||
|
||||
template<typename Type>
|
||||
class GlobalModuleRef;
|
||||
typedef GlobalModuleRef<EntityClassManager> GlobalEntityClassManagerModuleRef;
|
||||
|
||||
inline EntityClassManager& GlobalEntityClassManager()
|
||||
{
|
||||
return GlobalEntityClassManagerModule::getTable();
|
||||
}
|
||||
|
||||
#endif
|
||||
23
include/ientity.cpp
Normal file
23
include/ientity.cpp
Normal file
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
Copyright (C) 2001-2006, William Joseph.
|
||||
All Rights Reserved.
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
#include "ientity.h"
|
||||
|
||||
131
include/ientity.h
Normal file
131
include/ientity.h
Normal file
@@ -0,0 +1,131 @@
|
||||
/*
|
||||
Copyright (C) 2001-2006, William Joseph.
|
||||
All Rights Reserved.
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
#if !defined(INCLUDED_IENTITY_H)
|
||||
#define INCLUDED_IENTITY_H
|
||||
|
||||
#include "generic/constant.h"
|
||||
|
||||
#include "string/string.h"
|
||||
#include "scenelib.h"
|
||||
|
||||
class EntityClass;
|
||||
|
||||
class Entity
|
||||
{
|
||||
public:
|
||||
STRING_CONSTANT(Name, "Entity");
|
||||
|
||||
class Visitor
|
||||
{
|
||||
public:
|
||||
virtual void visit(const char* key, const char* value) = 0;
|
||||
};
|
||||
|
||||
virtual const EntityClass& getEntityClass() const = 0;
|
||||
virtual void forEachKeyValue(Visitor& visitor) const = 0;
|
||||
virtual void setKeyValue(const char* key, const char* value) = 0;
|
||||
virtual const char* getKeyValue(const char* key) const = 0;
|
||||
virtual bool isContainer() const = 0;
|
||||
};
|
||||
|
||||
class EntityCopyingVisitor : public Entity::Visitor
|
||||
{
|
||||
Entity& m_entity;
|
||||
public:
|
||||
EntityCopyingVisitor(Entity& entity)
|
||||
: m_entity(entity)
|
||||
{
|
||||
}
|
||||
|
||||
void visit(const char* key, const char* value)
|
||||
{
|
||||
if(!string_equal(key, "classname"))
|
||||
{
|
||||
m_entity.setKeyValue(key, value);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
inline Entity* Node_getEntity(scene::Node& node)
|
||||
{
|
||||
return NodeTypeCast<Entity>::cast(node);
|
||||
}
|
||||
|
||||
|
||||
template<typename value_type>
|
||||
class Stack;
|
||||
template<typename Contained>
|
||||
class Reference;
|
||||
|
||||
namespace scene
|
||||
{
|
||||
class Node;
|
||||
}
|
||||
|
||||
typedef Reference<scene::Node> NodeReference;
|
||||
|
||||
namespace scene
|
||||
{
|
||||
typedef Stack<NodeReference> Path;
|
||||
}
|
||||
|
||||
class Counter;
|
||||
|
||||
class EntityCreator
|
||||
{
|
||||
public:
|
||||
INTEGER_CONSTANT(Version, 2);
|
||||
STRING_CONSTANT(Name, "entity");
|
||||
|
||||
virtual scene::Node& createEntity(EntityClass* eclass) = 0;
|
||||
|
||||
typedef void (*KeyValueChangedFunc)();
|
||||
virtual void setKeyValueChangedFunc(KeyValueChangedFunc func) = 0;
|
||||
|
||||
virtual void setCounter(Counter* counter) = 0;
|
||||
|
||||
virtual void connectEntities(const scene::Path& e1, const scene::Path& e2) = 0;
|
||||
|
||||
virtual void setLightRadii(bool lightRadii) = 0;
|
||||
virtual bool getLightRadii() = 0;
|
||||
virtual void setShowNames(bool showNames) = 0;
|
||||
virtual bool getShowNames() = 0;
|
||||
virtual void setShowAngles(bool showAngles) = 0;
|
||||
virtual bool getShowAngles() = 0;
|
||||
};
|
||||
|
||||
#include "modulesystem.h"
|
||||
|
||||
template<typename Type>
|
||||
class GlobalModule;
|
||||
typedef GlobalModule<EntityCreator> GlobalEntityModule;
|
||||
|
||||
template<typename Type>
|
||||
class GlobalModuleRef;
|
||||
typedef GlobalModuleRef<EntityCreator> GlobalEntityModuleRef;
|
||||
|
||||
inline EntityCreator& GlobalEntityCreator()
|
||||
{
|
||||
return GlobalEntityModule::getTable();
|
||||
}
|
||||
|
||||
#endif
|
||||
23
include/ifilesystem.cpp
Normal file
23
include/ifilesystem.cpp
Normal file
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
Copyright (C) 2001-2006, William Joseph.
|
||||
All Rights Reserved.
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
#include "ifilesystem.h"
|
||||
|
||||
134
include/ifilesystem.h
Normal file
134
include/ifilesystem.h
Normal file
@@ -0,0 +1,134 @@
|
||||
/*
|
||||
Copyright (C) 2001-2006, William Joseph.
|
||||
All Rights Reserved.
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
#if !defined(INCLUDED_IFILESYSTEM_H)
|
||||
#define INCLUDED_IFILESYSTEM_H
|
||||
|
||||
#include <cstddef>
|
||||
#include "generic/constant.h"
|
||||
|
||||
template<typename FirstArgument>
|
||||
class Callback1;
|
||||
typedef Callback1<const char*> ArchiveNameCallback;
|
||||
typedef Callback1<const char*> FileNameCallback;
|
||||
|
||||
class ArchiveFile;
|
||||
class ArchiveTextFile;
|
||||
class Archive;
|
||||
|
||||
class ModuleObserver;
|
||||
|
||||
typedef struct _GSList GSList;
|
||||
|
||||
/// The Virtual File System.
|
||||
class VirtualFileSystem
|
||||
{
|
||||
public:
|
||||
INTEGER_CONSTANT(Version, 1);
|
||||
STRING_CONSTANT(Name, "VFS");
|
||||
|
||||
/// \brief Adds a root search \p path.
|
||||
/// Called before \c initialise.
|
||||
virtual void initDirectory(const char *path) = 0;
|
||||
/// \brief Initialises the filesystem.
|
||||
/// Called after all root search paths have been added.
|
||||
virtual void initialise() = 0;
|
||||
/// \brief Shuts down the filesystem.
|
||||
virtual void shutdown() = 0;
|
||||
|
||||
/// \brief Returns the file identified by \p filename opened in binary mode, or 0 if not found.
|
||||
/// The caller must \c release() the file returned if it is not 0.
|
||||
virtual ArchiveFile* openFile(const char* filename) = 0;
|
||||
/// \brief Returns the file identified by \p filename opened in text mode, or 0 if not found.
|
||||
/// The caller must \c release() the file returned if it is not 0.
|
||||
virtual ArchiveTextFile* openTextFile(const char* filename) = 0;
|
||||
|
||||
/// \brief Opens the file identified by \p filename and reads it into \p buffer, or sets *\p buffer to 0 if not found.
|
||||
/// Returns the size of the buffer allocated, or undefined value if *\p buffer is 0;
|
||||
/// The caller must free the allocated buffer by calling \c freeFile
|
||||
/// \deprecated Deprecated - use \c openFile.
|
||||
virtual std::size_t loadFile(const char *filename, void **buffer) = 0;
|
||||
/// \brief Frees the buffer returned by \c loadFile.
|
||||
/// \deprecated Deprecated.
|
||||
virtual void freeFile(void *p) = 0;
|
||||
|
||||
/// \brief Calls \p callback for each directory under \p basedir.
|
||||
virtual void forEachDirectory(const char* basedir, const FileNameCallback& callback, std::size_t depth = 1) = 0;
|
||||
/// \brief Calls \p callback for each file under \p basedir matching \p extension.
|
||||
/// Use "*" as \p extension to match all file extensions.
|
||||
virtual void forEachFile(const char* basedir, const char* extension, const FileNameCallback& callback, std::size_t depth = 1) = 0;
|
||||
|
||||
/// \brief Returns a list containing the relative names of all the directories under \p basedir.
|
||||
/// The caller must free the returned list by calling \c clearFileDirList;
|
||||
/// \deprecated Deprecated - use \c forEachDirectory.
|
||||
virtual GSList* getDirList(const char *basedir) = 0;
|
||||
/// \brief Returns a list containing the relative names of the files under \p basedir (\p extension can be "*" for all files).
|
||||
/// The caller must free the returned list by calling \c clearFileDirList.
|
||||
/// \deprecated Deprecated - use \c forEachFile.
|
||||
virtual GSList* getFileList(const char *basedir, const char *extension) = 0;
|
||||
/// \brief Frees the \p list returned from \c getDirList or \c getFileList.
|
||||
/// \deprecated Deprecated.
|
||||
virtual void clearFileDirList(GSList **list) = 0;
|
||||
|
||||
/// \brief Returns the absolute filename for a relative \p name, or "" if not found.
|
||||
virtual const char* findFile(const char* name) = 0;
|
||||
/// \brief Returns the filesystem root for an absolute \p name, or "" if not found.
|
||||
/// This can be used to convert an absolute name to a relative name.
|
||||
virtual const char* findRoot(const char* name) = 0;
|
||||
|
||||
/// \brief Attach an \p observer whose realise() and unrealise() methods will be called when the filesystem is initialised or shut down.
|
||||
virtual void attach(ModuleObserver& observer) = 0;
|
||||
/// \brief Detach an \p observer previously-attached by calling \c attach.
|
||||
virtual void detach(ModuleObserver& observer) = 0;
|
||||
|
||||
virtual Archive* getArchive(const char* archiveName) = 0;
|
||||
virtual void forEachArchive(const ArchiveNameCallback& callback) = 0;
|
||||
};
|
||||
|
||||
#include "modulesystem.h"
|
||||
|
||||
template<typename Type>
|
||||
class GlobalModule;
|
||||
typedef GlobalModule<VirtualFileSystem> GlobalFileSystemModule;
|
||||
|
||||
template<typename Type>
|
||||
class GlobalModuleRef;
|
||||
typedef GlobalModuleRef<VirtualFileSystem> GlobalFileSystemModuleRef;
|
||||
|
||||
inline VirtualFileSystem& GlobalFileSystem()
|
||||
{
|
||||
return GlobalFileSystemModule::getTable();
|
||||
}
|
||||
|
||||
|
||||
/// \deprecated Use \c openFile.
|
||||
inline int vfsLoadFile(const char* filename, void** buffer, int index = 0)
|
||||
{
|
||||
return static_cast<int>(GlobalFileSystem().loadFile(filename, buffer));
|
||||
};
|
||||
|
||||
/// \deprecated Deprecated.
|
||||
inline void vfsFreeFile(void* p)
|
||||
{
|
||||
GlobalFileSystem().freeFile(p);
|
||||
}
|
||||
|
||||
#endif
|
||||
23
include/ifiletypes.cpp
Normal file
23
include/ifiletypes.cpp
Normal file
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
Copyright (C) 2001-2006, William Joseph.
|
||||
All Rights Reserved.
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
#include "ifiletypes.h"
|
||||
|
||||
76
include/ifiletypes.h
Normal file
76
include/ifiletypes.h
Normal file
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
Copyright (C) 2001-2006, William Joseph.
|
||||
All Rights Reserved.
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
#if !defined(INCLUDED_IFILETYPES_H)
|
||||
#define INCLUDED_IFILETYPES_H
|
||||
|
||||
#include "generic/constant.h"
|
||||
|
||||
class filetype_t
|
||||
{
|
||||
public:
|
||||
filetype_t()
|
||||
: name(""), pattern("")
|
||||
{
|
||||
}
|
||||
filetype_t(const char* _name, const char* _pattern)
|
||||
: name(_name), pattern(_pattern)
|
||||
{
|
||||
}
|
||||
const char* name;
|
||||
const char* pattern;
|
||||
};
|
||||
|
||||
|
||||
class IFileTypeList
|
||||
{
|
||||
public:
|
||||
virtual void addType(const char* moduleName, filetype_t type) = 0;
|
||||
};
|
||||
|
||||
class IFileTypeRegistry
|
||||
{
|
||||
public:
|
||||
INTEGER_CONSTANT(Version, 1);
|
||||
STRING_CONSTANT(Name, "filetypes");
|
||||
|
||||
virtual void addType(const char* moduleType, const char* moduleName, filetype_t type) = 0;
|
||||
virtual void getTypeList(const char* moduleType, IFileTypeList* typelist) = 0;
|
||||
};
|
||||
|
||||
#include "modulesystem.h"
|
||||
|
||||
template<typename Type>
|
||||
class GlobalModule;
|
||||
typedef GlobalModule<IFileTypeRegistry> GlobalFiletypesModule;
|
||||
|
||||
template<typename Type>
|
||||
class GlobalModuleRef;
|
||||
typedef GlobalModuleRef<IFileTypeRegistry> GlobalFiletypesModuleRef;
|
||||
|
||||
inline IFileTypeRegistry& GlobalFiletypes()
|
||||
{
|
||||
return GlobalFiletypesModule::getTable();
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
23
include/ifilter.cpp
Normal file
23
include/ifilter.cpp
Normal file
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
Copyright (C) 2001-2006, William Joseph.
|
||||
All Rights Reserved.
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
#include "ifilter.h"
|
||||
|
||||
88
include/ifilter.h
Normal file
88
include/ifilter.h
Normal file
@@ -0,0 +1,88 @@
|
||||
/*
|
||||
Copyright (C) 2001-2006, William Joseph.
|
||||
All Rights Reserved.
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
#if !defined(INCLUDED_IFILTER_H)
|
||||
#define INCLUDED_IFILTER_H
|
||||
|
||||
#include "generic/constant.h"
|
||||
|
||||
enum
|
||||
{
|
||||
EXCLUDE_WORLD = 0x00000001,
|
||||
EXCLUDE_ENT = 0x00000002,
|
||||
EXCLUDE_CURVES = 0x00000004,
|
||||
EXCLUDE_TRANSLUCENT = 0x00000008,
|
||||
EXCLUDE_LIQUIDS = 0x00000010,
|
||||
EXCLUDE_CAULK = 0x00000020,
|
||||
EXCLUDE_CLIP = 0x00000040,
|
||||
EXCLUDE_PATHS = 0x00000080,
|
||||
EXCLUDE_LIGHTS = 0x00000100,
|
||||
EXCLUDE_DETAILS = 0x00000200,
|
||||
EXCLUDE_HINTSSKIPS = 0x00000400,
|
||||
EXCLUDE_MODELS = 0x00000800,
|
||||
EXCLUDE_AREAPORTALS = 0x00001000,
|
||||
EXCLUDE_TRIGGERS = 0x00002000,
|
||||
EXCLUDE_CLUSTERPORTALS = 0x00004000,
|
||||
EXCLUDE_TERRAIN = 0x00008000,
|
||||
EXCLUDE_LIGHTGRID = 0x00010000,
|
||||
EXCLUDE_STRUCTURAL = 0x00020000,
|
||||
EXCLUDE_BOTCLIP = 0x00040000,
|
||||
EXCLUDE_VISPORTALS = 0x00080000,
|
||||
};
|
||||
|
||||
class Filter
|
||||
{
|
||||
public:
|
||||
virtual void setActive(bool active) = 0;
|
||||
};
|
||||
|
||||
class Filterable
|
||||
{
|
||||
public:
|
||||
virtual void updateFiltered() = 0;
|
||||
};
|
||||
|
||||
class FilterSystem
|
||||
{
|
||||
public:
|
||||
INTEGER_CONSTANT(Version, 1);
|
||||
STRING_CONSTANT(Name, "filters");
|
||||
virtual void addFilter(Filter& filter, int mask) = 0;
|
||||
virtual void registerFilterable(Filterable& filterable) = 0;
|
||||
virtual void unregisterFilterable(Filterable& filterable) = 0;
|
||||
};
|
||||
|
||||
#include "modulesystem.h"
|
||||
|
||||
template<typename Type>
|
||||
class GlobalModule;
|
||||
typedef GlobalModule<FilterSystem> GlobalFilterModule;
|
||||
|
||||
template<typename Type>
|
||||
class GlobalModuleRef;
|
||||
typedef GlobalModuleRef<FilterSystem> GlobalFilterModuleRef;
|
||||
|
||||
inline FilterSystem& GlobalFilterSystem()
|
||||
{
|
||||
return GlobalFilterModule::getTable();
|
||||
}
|
||||
|
||||
#endif
|
||||
23
include/igl.cpp
Normal file
23
include/igl.cpp
Normal file
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
Copyright (C) 2001-2006, William Joseph.
|
||||
All Rights Reserved.
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
#include "igl.h"
|
||||
|
||||
2830
include/igl.h
Normal file
2830
include/igl.h
Normal file
File diff suppressed because it is too large
Load Diff
23
include/igtkgl.cpp
Normal file
23
include/igtkgl.cpp
Normal file
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
Copyright (C) 2001-2006, William Joseph.
|
||||
All Rights Reserved.
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
#include "igtkgl.h"
|
||||
|
||||
43
include/igtkgl.h
Normal file
43
include/igtkgl.h
Normal file
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
Copyright (C) 2001-2006, William Joseph.
|
||||
All Rights Reserved.
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
#if !defined(INCLUDED_IGTKGL_H)
|
||||
#define INCLUDED_IGTKGL_H
|
||||
|
||||
#include "generic/constant.h"
|
||||
|
||||
typedef struct _GtkWidget GtkWidget;
|
||||
typedef int gint;
|
||||
typedef gint gboolean;
|
||||
|
||||
struct _QERGtkGLTable
|
||||
{
|
||||
INTEGER_CONSTANT(Version, 1);
|
||||
STRING_CONSTANT(Name, "gtkgl");
|
||||
|
||||
GtkWidget* (*glwidget_new)(gboolean zbufffer);
|
||||
void (*glwidget_swap_buffers)(GtkWidget* widget);
|
||||
gboolean(*glwidget_make_current)(GtkWidget* widget);
|
||||
void (*glwidget_destroy_context)(GtkWidget* widget);
|
||||
void (*glwidget_create_context)(GtkWidget* widget);
|
||||
};
|
||||
|
||||
#endif
|
||||
23
include/iimage.cpp
Normal file
23
include/iimage.cpp
Normal file
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
Copyright (C) 2001-2006, William Joseph.
|
||||
All Rights Reserved.
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
#include "iimage.h"
|
||||
|
||||
75
include/iimage.h
Normal file
75
include/iimage.h
Normal file
@@ -0,0 +1,75 @@
|
||||
/*
|
||||
Copyright (C) 2001-2006, William Joseph.
|
||||
All Rights Reserved.
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
#if !defined(INCLUDED_IIMAGE_H)
|
||||
#define INCLUDED_IIMAGE_H
|
||||
|
||||
#include "generic/constant.h"
|
||||
|
||||
typedef unsigned char byte;
|
||||
|
||||
class Image
|
||||
{
|
||||
public:
|
||||
virtual void release() = 0;
|
||||
virtual byte* getRGBAPixels() const = 0;
|
||||
virtual unsigned int getWidth() const = 0;
|
||||
virtual unsigned int getHeight() const = 0;
|
||||
|
||||
virtual int getSurfaceFlags() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
virtual int getContentFlags() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
virtual int getValue() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
||||
class ArchiveFile;
|
||||
|
||||
struct _QERPlugImageTable
|
||||
{
|
||||
INTEGER_CONSTANT(Version, 1);
|
||||
STRING_CONSTANT(Name, "image");
|
||||
|
||||
/// Read an image from the file.
|
||||
/// Returns 0 if the image could not be read.
|
||||
Image* (*loadImage)(ArchiveFile& file);
|
||||
};
|
||||
|
||||
template<typename Type>
|
||||
class ModuleRef;
|
||||
typedef ModuleRef<_QERPlugImageTable> ImageModuleRef;
|
||||
|
||||
template<typename Type>
|
||||
class Modules;
|
||||
typedef Modules<_QERPlugImageTable> ImageModules;
|
||||
|
||||
template<typename Type>
|
||||
class ModulesRef;
|
||||
typedef ModulesRef<_QERPlugImageTable> ImageModulesRef;
|
||||
|
||||
#endif // _IIMAGE_H
|
||||
23
include/imap.cpp
Normal file
23
include/imap.cpp
Normal file
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
Copyright (C) 2001-2006, William Joseph.
|
||||
All Rights Reserved.
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
#include "imap.h"
|
||||
|
||||
81
include/imap.h
Normal file
81
include/imap.h
Normal file
@@ -0,0 +1,81 @@
|
||||
/*
|
||||
Copyright (C) 2001-2006, William Joseph.
|
||||
All Rights Reserved.
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
#if !defined(INCLUDED_IMAP_H)
|
||||
#define INCLUDED_IMAP_H
|
||||
|
||||
#include "generic/constant.h"
|
||||
|
||||
class Tokeniser;
|
||||
class TokenWriter;
|
||||
|
||||
/// \brief A node whose state can be imported from a token stream.
|
||||
class MapImporter
|
||||
{
|
||||
public:
|
||||
STRING_CONSTANT(Name, "MapImporter");
|
||||
|
||||
virtual bool importTokens(Tokeniser& tokeniser) = 0;
|
||||
};
|
||||
|
||||
/// \brief A node whose state can be exported to a token stream.
|
||||
class MapExporter
|
||||
{
|
||||
public:
|
||||
STRING_CONSTANT(Name, "MapExporter");
|
||||
|
||||
virtual void exportTokens(TokenWriter& writer) const = 0;
|
||||
};
|
||||
|
||||
#include "iscenegraph.h"
|
||||
|
||||
class EntityCreator;
|
||||
|
||||
class TextInputStream;
|
||||
class TextOutputStream;
|
||||
|
||||
|
||||
typedef void(*GraphTraversalFunc)(scene::Node& root, const scene::Traversable::Walker& walker);
|
||||
|
||||
/// \brief A module that reads and writes a map in a specific format.
|
||||
class MapFormat
|
||||
{
|
||||
public:
|
||||
INTEGER_CONSTANT(Version, 2);
|
||||
STRING_CONSTANT(Name, "map");
|
||||
|
||||
/// \brief Read a map graph into \p root from \p outputStream, using \p entityTable to create entities.
|
||||
virtual void readGraph(scene::Node& root, TextInputStream& inputStream, EntityCreator& entityTable) const = 0;
|
||||
/// \brief Write the map graph obtained by applying \p traverse to \p root into \p outputStream.
|
||||
virtual void writeGraph(scene::Node& root, GraphTraversalFunc traverse, TextOutputStream& outputStream) const = 0;
|
||||
};
|
||||
|
||||
|
||||
template<typename Type>
|
||||
class Modules;
|
||||
typedef Modules<MapFormat> MapModules;
|
||||
|
||||
template<typename Type>
|
||||
class ModulesRef;
|
||||
typedef ModulesRef<MapFormat> MapModulesRef;
|
||||
|
||||
|
||||
#endif
|
||||
23
include/imodel.cpp
Normal file
23
include/imodel.cpp
Normal file
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
Copyright (C) 2001-2006, William Joseph.
|
||||
All Rights Reserved.
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
#include "imodel.h"
|
||||
|
||||
50
include/imodel.h
Normal file
50
include/imodel.h
Normal file
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
Copyright (C) 2001-2006, William Joseph.
|
||||
All Rights Reserved.
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
#if !defined(INCLUDED_IMODEL_H)
|
||||
#define INCLUDED_IMODEL_H
|
||||
|
||||
#include "generic/constant.h"
|
||||
|
||||
namespace scene
|
||||
{
|
||||
class Node;
|
||||
}
|
||||
|
||||
class ArchiveFile;
|
||||
|
||||
class ModelLoader
|
||||
{
|
||||
public:
|
||||
INTEGER_CONSTANT(Version, 1);
|
||||
STRING_CONSTANT(Name, "model");
|
||||
virtual scene::Node& loadModel(ArchiveFile& file) = 0;
|
||||
};
|
||||
|
||||
template<typename Type>
|
||||
class Modules;
|
||||
typedef Modules<ModelLoader> ModelModules;
|
||||
|
||||
template<typename Type>
|
||||
class ModulesRef;
|
||||
typedef ModulesRef<ModelLoader> ModelModulesRef;
|
||||
|
||||
#endif /* _IMODEL_H_ */
|
||||
362
include/include.vcproj
Normal file
362
include/include.vcproj
Normal file
@@ -0,0 +1,362 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="7.10"
|
||||
Name="include"
|
||||
ProjectGUID="{04A5D9EE-EC49-4CBC-BD05-D80BC287897C}"
|
||||
Keyword="Win32Proj">
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"/>
|
||||
</Platforms>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="Debug"
|
||||
IntermediateDirectory="Debug"
|
||||
ConfigurationType="4"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=""../include";"../libs";"../../STLport-4.6/stlport";"../../libxml2-2.6/include""
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
|
||||
StringPooling="TRUE"
|
||||
MinimalRebuild="TRUE"
|
||||
ExceptionHandling="FALSE"
|
||||
BasicRuntimeChecks="0"
|
||||
RuntimeLibrary="3"
|
||||
BufferSecurityCheck="FALSE"
|
||||
ForceConformanceInForLoopScope="TRUE"
|
||||
UsePrecompiledHeader="0"
|
||||
BrowseInformation="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="4"
|
||||
DisableSpecificWarnings="4610;4510;4512;4505;4100;4127"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
OutputFile="$(OutDir)/include.lib"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="Release"
|
||||
IntermediateDirectory="Release"
|
||||
ConfigurationType="4"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
GlobalOptimizations="TRUE"
|
||||
InlineFunctionExpansion="2"
|
||||
EnableIntrinsicFunctions="TRUE"
|
||||
OptimizeForWindowsApplication="TRUE"
|
||||
AdditionalIncludeDirectories=""../include";"../libs";"../../STLport-4.6/stlport";"../../libxml2-2.6/include""
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
|
||||
StringPooling="TRUE"
|
||||
ExceptionHandling="FALSE"
|
||||
RuntimeLibrary="2"
|
||||
BufferSecurityCheck="FALSE"
|
||||
ForceConformanceInForLoopScope="TRUE"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="4"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="3"
|
||||
DisableSpecificWarnings="4610;4510;4512;4505;4100;4127"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
OutputFile="$(OutDir)/include.lib"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<File
|
||||
RelativePath=".\cullable.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\cullable.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\editable.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\editable.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\iarchive.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\iarchive.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\ibrush.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\ibrush.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\icamera.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\icamera.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\idatastream.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\idatastream.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\ieclass.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\ieclass.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\ientity.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\ientity.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\ifilesystem.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\ifilesystem.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\ifiletypes.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\ifiletypes.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\ifilter.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\ifilter.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\igl.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\igl.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\igtkgl.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\igtkgl.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\iimage.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\iimage.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\imap.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\imap.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\imodel.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\imodel.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\ipatch.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\ipatch.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\iplugin.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\iplugin.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\ireference.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\ireference.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\irender.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\irender.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\iscenegraph.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\iscenegraph.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\iscriplib.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\iscriplib.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\iselection.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\iselection.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\ishaders.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\ishaders.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\itexdef.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\itexdef.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\itextstream.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\itextstream.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\itextures.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\itextures.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\itoolbar.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\itoolbar.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\iundo.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\iundo.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\mapfile.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\mapfile.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\modelskin.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\modelskin.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\moduleobserver.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\moduleobserver.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\modulesystem.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\modulesystem.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\nameable.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\nameable.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\namespace.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\namespace.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\preferencesystem.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\preferencesystem.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\qerplugin.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\qerplugin.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\renderable.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\renderable.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\selectable.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\selectable.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\stream_version.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\warnings.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\windowobserver.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\windowobserver.h">
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
23
include/ipatch.cpp
Normal file
23
include/ipatch.cpp
Normal file
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
Copyright (C) 2001-2006, William Joseph.
|
||||
All Rights Reserved.
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
#include "ipatch.h"
|
||||
|
||||
59
include/ipatch.h
Normal file
59
include/ipatch.h
Normal file
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
Copyright (C) 2001-2006, William Joseph.
|
||||
All Rights Reserved.
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
#if !defined(INCLUDED_IPATCH_H)
|
||||
#define INCLUDED_IPATCH_H
|
||||
|
||||
#include "generic/constant.h"
|
||||
|
||||
namespace scene
|
||||
{
|
||||
class Node;
|
||||
}
|
||||
|
||||
class PatchCreator
|
||||
{
|
||||
public:
|
||||
INTEGER_CONSTANT(Version, 1);
|
||||
STRING_CONSTANT(Name, "patch");
|
||||
virtual scene::Node& createPatch() = 0;
|
||||
};
|
||||
|
||||
#include "modulesystem.h"
|
||||
|
||||
template<typename Type>
|
||||
class ModuleRef;
|
||||
typedef ModuleRef<PatchCreator> PatchModuleRef;
|
||||
|
||||
template<typename Type>
|
||||
class GlobalModule;
|
||||
typedef GlobalModule<PatchCreator> GlobalPatchModule;
|
||||
|
||||
template<typename Type>
|
||||
class GlobalModuleRef;
|
||||
typedef GlobalModuleRef<PatchCreator> GlobalPatchModuleRef;
|
||||
|
||||
inline PatchCreator& GlobalPatchCreator()
|
||||
{
|
||||
return GlobalPatchModule::getTable();
|
||||
}
|
||||
|
||||
#endif
|
||||
23
include/iplugin.cpp
Normal file
23
include/iplugin.cpp
Normal file
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
Copyright (C) 1999-2006 Id Software, Inc. and contributors.
|
||||
For a list of contributors, see the accompanying CONTRIBUTORS file.
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
#include "iplugin.h"
|
||||
|
||||
53
include/iplugin.h
Normal file
53
include/iplugin.h
Normal file
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
Copyright (C) 1999-2006 Id Software, Inc. and contributors.
|
||||
For a list of contributors, see the accompanying CONTRIBUTORS file.
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
#if !defined(INCLUDED_IPLUGIN_H)
|
||||
#define INCLUDED_IPLUGIN_H
|
||||
|
||||
#include "generic/constant.h"
|
||||
|
||||
typedef const char* (* PFN_QERPLUG_INIT) (void* hApp, void* pMainWidget);
|
||||
typedef const char* (* PFN_QERPLUG_GETNAME)();
|
||||
typedef const char* (* PFN_QERPLUG_GETCOMMANDLIST)();
|
||||
typedef const char* (* PFN_QERPLUG_GETCOMMANDTITLELIST)();
|
||||
typedef void (* PFN_QERPLUG_DISPATCH) (const char* p, float* vMin, float* vMax, bool bSingleBrush);
|
||||
|
||||
struct _QERPluginTable
|
||||
{
|
||||
INTEGER_CONSTANT(Version, 1);
|
||||
STRING_CONSTANT(Name, "plugin");
|
||||
|
||||
PFN_QERPLUG_INIT m_pfnQERPlug_Init;
|
||||
PFN_QERPLUG_GETNAME m_pfnQERPlug_GetName;
|
||||
PFN_QERPLUG_GETCOMMANDLIST m_pfnQERPlug_GetCommandList;
|
||||
PFN_QERPLUG_GETCOMMANDTITLELIST m_pfnQERPlug_GetCommandTitleList;
|
||||
PFN_QERPLUG_DISPATCH m_pfnQERPlug_Dispatch;
|
||||
};
|
||||
|
||||
template<typename Type>
|
||||
class Modules;
|
||||
typedef Modules<_QERPluginTable> PluginModules;
|
||||
|
||||
template<typename Type>
|
||||
class ModulesRef;
|
||||
typedef ModulesRef<_QERPluginTable> PluginModulesRef;
|
||||
|
||||
#endif
|
||||
23
include/ireference.cpp
Normal file
23
include/ireference.cpp
Normal file
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
Copyright (C) 2001-2006, William Joseph.
|
||||
All Rights Reserved.
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
#include "ireference.h"
|
||||
|
||||
78
include/ireference.h
Normal file
78
include/ireference.h
Normal file
@@ -0,0 +1,78 @@
|
||||
/*
|
||||
Copyright (C) 2001-2006, William Joseph.
|
||||
All Rights Reserved.
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
#if !defined(INCLUDED_IREFERENCE_H)
|
||||
#define INCLUDED_IREFERENCE_H
|
||||
|
||||
#include "generic/constant.h"
|
||||
|
||||
namespace scene
|
||||
{
|
||||
class Node;
|
||||
}
|
||||
|
||||
class ModuleObserver;
|
||||
|
||||
class Resource
|
||||
{
|
||||
public:
|
||||
virtual bool load() = 0;
|
||||
virtual bool save() = 0;
|
||||
virtual void flush() = 0;
|
||||
virtual void refresh() = 0;
|
||||
virtual scene::Node* getNode() = 0;
|
||||
virtual void setNode(scene::Node* node) = 0;
|
||||
virtual void attach(ModuleObserver& observer) = 0;
|
||||
virtual void detach(ModuleObserver& observer) = 0;
|
||||
virtual void realise() = 0;
|
||||
virtual void unrealise() = 0;
|
||||
};
|
||||
|
||||
class EntityCreator;
|
||||
|
||||
class ReferenceCache
|
||||
{
|
||||
public:
|
||||
INTEGER_CONSTANT(Version, 1);
|
||||
STRING_CONSTANT(Name, "reference");
|
||||
|
||||
virtual Resource* capture(const char* path) = 0;
|
||||
virtual void release(const char* path) = 0;
|
||||
|
||||
virtual void setEntityCreator(EntityCreator& entityCreator) = 0;
|
||||
};
|
||||
|
||||
#include "modulesystem.h"
|
||||
|
||||
template<typename Type>
|
||||
class GlobalModule;
|
||||
typedef GlobalModule<ReferenceCache> GlobalReferenceModule;
|
||||
|
||||
template<typename Type>
|
||||
class GlobalModuleRef;
|
||||
typedef GlobalModuleRef<ReferenceCache> GlobalReferenceModuleRef;
|
||||
|
||||
inline ReferenceCache& GlobalReferenceCache()
|
||||
{
|
||||
return GlobalReferenceModule::getTable();
|
||||
}
|
||||
|
||||
#endif
|
||||
23
include/irender.cpp
Normal file
23
include/irender.cpp
Normal file
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
Copyright (C) 2001-2006, William Joseph.
|
||||
All Rights Reserved.
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
#include "irender.h"
|
||||
|
||||
175
include/irender.h
Normal file
175
include/irender.h
Normal file
@@ -0,0 +1,175 @@
|
||||
/*
|
||||
Copyright (C) 2001-2006, William Joseph.
|
||||
All Rights Reserved.
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
#if !defined(INCLUDED_IRENDER_H)
|
||||
#define INCLUDED_IRENDER_H
|
||||
|
||||
#include "generic/constant.h"
|
||||
|
||||
|
||||
// Rendering states to sort by.
|
||||
// Higher bits have the most effect - slowest state changes should be highest.
|
||||
|
||||
const unsigned int RENDER_DEFAULT = 0;
|
||||
const unsigned int RENDER_LINESTIPPLE = 1 << 0; // glEnable(GL_LINE_STIPPLE)
|
||||
const unsigned int RENDER_POLYGONSTIPPLE = 1 << 1; // glEnable(GL_POLYGON_STIPPLE)
|
||||
const unsigned int RENDER_ALPHATEST = 1 << 2; // glEnable(GL_ALPHA_TEST)
|
||||
const unsigned int RENDER_DEPTHTEST = 1 << 3; // glEnable(GL_DEPTH_TEST)
|
||||
const unsigned int RENDER_DEPTHWRITE = 1 << 4; // glDepthMask(GL_TRUE)
|
||||
const unsigned int RENDER_COLOURWRITE = 1 << 5; // glColorMask(GL_TRUE; GL_TRUE; GL_TRUE; GL_TRUE)
|
||||
const unsigned int RENDER_CULLFACE = 1 << 6; // glglEnable(GL_CULL_FACE)
|
||||
const unsigned int RENDER_SCALED = 1 << 7; // glEnable(GL_NORMALIZE)
|
||||
const unsigned int RENDER_SMOOTH = 1 << 8; // glShadeModel
|
||||
const unsigned int RENDER_LIGHTING = 1 << 9; // glEnable(GL_LIGHTING)
|
||||
const unsigned int RENDER_BLEND = 1 << 10; // glEnable(GL_BLEND)
|
||||
const unsigned int RENDER_OFFSETLINE = 1 << 11; // glEnable(GL_POLYGON_OFFSET_LINE)
|
||||
const unsigned int RENDER_FILL = 1 << 12; // glPolygonMode
|
||||
const unsigned int RENDER_COLOUR = 1 << 13; // glEnableClientState(GL_COLOR_ARRAY)
|
||||
const unsigned int RENDER_TEXTURE = 1 << 14; // glEnable(GL_TEXTURE_2D)
|
||||
const unsigned int RENDER_BUMP = 1 << 15;
|
||||
const unsigned int RENDER_PROGRAM = 1 << 16;
|
||||
const unsigned int RENDER_SCREEN = 1 << 17;
|
||||
const unsigned int RENDER_OVERRIDE = 1 << 18;
|
||||
typedef unsigned int RenderStateFlags;
|
||||
|
||||
|
||||
class AABB;
|
||||
class Matrix4;
|
||||
|
||||
template<typename Element> class BasicVector3;
|
||||
typedef BasicVector3<float> Vector3;
|
||||
|
||||
class Shader;
|
||||
|
||||
class RendererLight
|
||||
{
|
||||
public:
|
||||
virtual Shader* getShader() const = 0;
|
||||
virtual const AABB& aabb() const = 0;
|
||||
virtual bool testAABB(const AABB& other) const = 0;
|
||||
virtual const Matrix4& rotation() const = 0;
|
||||
virtual const Vector3& offset() const = 0;
|
||||
virtual const Vector3& colour() const = 0;
|
||||
virtual bool isProjected() const = 0;
|
||||
virtual const Matrix4& projection() const = 0;
|
||||
};
|
||||
|
||||
class LightCullable
|
||||
{
|
||||
public:
|
||||
virtual bool testLight(const RendererLight& light) const = 0;
|
||||
virtual void insertLight(const RendererLight& light)
|
||||
{
|
||||
}
|
||||
virtual void clearLights()
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
template<typename FirstArgument>
|
||||
class Callback1;
|
||||
|
||||
class Renderable;
|
||||
typedef Callback1<const Renderable&> RenderableCallback;
|
||||
|
||||
typedef Callback1<const RendererLight&> RendererLightCallback;
|
||||
|
||||
class LightList
|
||||
{
|
||||
public:
|
||||
virtual void evaluateLights() const = 0;
|
||||
virtual void lightsChanged() const = 0;
|
||||
virtual void forEachLight(const RendererLightCallback& callback) const = 0;
|
||||
};
|
||||
|
||||
const int c_attr_TexCoord0 = 1;
|
||||
const int c_attr_Tangent = 3;
|
||||
const int c_attr_Binormal = 4;
|
||||
|
||||
class OpenGLRenderable
|
||||
{
|
||||
public:
|
||||
virtual void render(RenderStateFlags state) const = 0;
|
||||
};
|
||||
|
||||
class Matrix4;
|
||||
struct qtexture_t;
|
||||
class ModuleObserver;
|
||||
|
||||
#include "math/vector.h"
|
||||
|
||||
class Shader
|
||||
{
|
||||
public:
|
||||
virtual void addRenderable(const OpenGLRenderable& renderable, const Matrix4& modelview, const LightList* lights = 0) = 0;
|
||||
virtual void incrementUsed() = 0;
|
||||
virtual void decrementUsed() = 0;
|
||||
virtual void attach(ModuleObserver& observer) = 0;
|
||||
virtual void detach(ModuleObserver& observer) = 0;
|
||||
virtual qtexture_t& getTexture() const = 0;
|
||||
virtual unsigned int getFlags() const = 0;
|
||||
};
|
||||
|
||||
class ShaderCache
|
||||
{
|
||||
public:
|
||||
INTEGER_CONSTANT(Version, 1);
|
||||
STRING_CONSTANT(Name, "renderstate");
|
||||
|
||||
virtual Shader* capture(const char* name) = 0;
|
||||
virtual void release(const char* name) = 0;
|
||||
/*! Render all Shader objects. */
|
||||
virtual void render(RenderStateFlags globalstate, const Matrix4& modelview, const Matrix4& projection, const Vector3& viewer = Vector3(0, 0, 0)) = 0;
|
||||
|
||||
virtual void realise() = 0;
|
||||
virtual void unrealise() = 0;
|
||||
|
||||
virtual bool lightingSupported() const = 0;
|
||||
virtual bool useShaderLanguage() const = 0;
|
||||
|
||||
virtual const LightList& attach(LightCullable& cullable) = 0;
|
||||
virtual void detach(LightCullable& cullable) = 0;
|
||||
virtual void changed(LightCullable& cullable) = 0;
|
||||
virtual void attach(RendererLight& light) = 0;
|
||||
virtual void detach(RendererLight& light) = 0;
|
||||
virtual void changed(RendererLight& light) = 0;
|
||||
|
||||
virtual void attachRenderable(const Renderable& renderable) = 0;
|
||||
virtual void detachRenderable(const Renderable& renderable) = 0;
|
||||
virtual void forEachRenderable(const RenderableCallback& callback) const = 0;
|
||||
};
|
||||
|
||||
#include "modulesystem.h"
|
||||
|
||||
template<typename Type>
|
||||
class GlobalModule;
|
||||
typedef GlobalModule<ShaderCache> GlobalShaderCacheModule;
|
||||
|
||||
template<typename Type>
|
||||
class GlobalModuleRef;
|
||||
typedef GlobalModuleRef<ShaderCache> GlobalShaderCacheModuleRef;
|
||||
|
||||
inline ShaderCache& GlobalShaderCache()
|
||||
{
|
||||
return GlobalShaderCacheModule::getTable();
|
||||
}
|
||||
|
||||
#endif
|
||||
23
include/iscenegraph.cpp
Normal file
23
include/iscenegraph.cpp
Normal file
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
Copyright (C) 2001-2006, William Joseph.
|
||||
All Rights Reserved.
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
#include "iscenegraph.h"
|
||||
|
||||
222
include/iscenegraph.h
Normal file
222
include/iscenegraph.h
Normal file
@@ -0,0 +1,222 @@
|
||||
/*
|
||||
Copyright (C) 2001-2006, William Joseph.
|
||||
All Rights Reserved.
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
#if !defined (INCLUDED_ISCENEGRAPH_H)
|
||||
#define INCLUDED_ISCENEGRAPH_H
|
||||
|
||||
#include <cstddef>
|
||||
#include "generic/constant.h"
|
||||
|
||||
template<typename value_type>
|
||||
class Stack;
|
||||
template<typename Contained>
|
||||
class Reference;
|
||||
|
||||
class Callback;
|
||||
|
||||
namespace scene
|
||||
{
|
||||
class Instance;
|
||||
const Instance* const nullInstancePointer = 0;
|
||||
inline const Instance& nullInstance()
|
||||
{
|
||||
return *nullInstancePointer;
|
||||
}
|
||||
|
||||
class Node;
|
||||
const Node* const nullNodePointer = 0;
|
||||
inline const Node& nullNode()
|
||||
{
|
||||
return *nullNodePointer;
|
||||
}
|
||||
}
|
||||
|
||||
typedef Reference<scene::Node> NodeReference;
|
||||
|
||||
typedef std::size_t TypeId;
|
||||
|
||||
const TypeId NODETYPEID_MAX = 64;
|
||||
const TypeId NODETYPEID_NONE = NODETYPEID_MAX;
|
||||
|
||||
const TypeId INSTANCETYPEID_MAX = 64;
|
||||
const TypeId INSTANCETYPEID_NONE = INSTANCETYPEID_MAX;
|
||||
|
||||
namespace scene
|
||||
{
|
||||
/// \brief A unique key to an instance of a node in the scene-graph.
|
||||
typedef Stack<NodeReference> Path;
|
||||
|
||||
/// \brief A scene-graph - a Directed Acyclic Graph (DAG).
|
||||
///
|
||||
/// - Each node may refer to zero or more 'child' nodes (directed).
|
||||
/// - A node may never have itself as one of its ancestors (acyclic).
|
||||
/// - Each node may have more than one 'parent', thus having more than one 'instance' in the graph.
|
||||
/// - Each instance is uniquely identified by the list of its ancestors plus itself, known as a 'path'.
|
||||
class Graph
|
||||
{
|
||||
public:
|
||||
INTEGER_CONSTANT(Version, 1);
|
||||
STRING_CONSTANT(Name, "scenegraph");
|
||||
|
||||
class Walker
|
||||
{
|
||||
public:
|
||||
/// \brief Called before traversing the first child-instance of 'instance'. If the return value is false, the children of the current instance are not traversed.
|
||||
virtual bool pre(const Path& path, Instance& instance) const = 0;
|
||||
/// \brief Called after traversing the last child-instance of 'instance'.
|
||||
virtual void post(const Path& path, Instance& instance) const
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
/// \brief Returns the root-node of the graph.
|
||||
virtual Node& root() = 0;
|
||||
/// \brief Sets the root-node of the graph to be 'node'.
|
||||
virtual void insert_root(Node& root) = 0;
|
||||
/// \brief Clears the root-node of the graph.
|
||||
virtual void erase_root() = 0;
|
||||
/// \brief Traverses all nodes in the graph depth-first, starting from the root node.
|
||||
virtual void traverse(const Walker& walker) = 0;
|
||||
/// \brief Traverses all nodes in the graph depth-first, starting from 'start'.
|
||||
virtual void traverse_subgraph(const Walker& walker, const Path& start) = 0;
|
||||
/// \brief Returns the instance at the location identified by 'path', or 0 if it does not exist.
|
||||
virtual scene::Instance* find(const Path& path) = 0;
|
||||
|
||||
/// \brief Invokes all scene-changed callbacks. Called when any part of the scene changes the way it will appear when the scene is rendered.
|
||||
/// \todo Move to a separate class.
|
||||
virtual void sceneChanged() = 0;
|
||||
/// \brief Add a \p callback to be invoked when the scene changes.
|
||||
/// \todo Move to a separate class.
|
||||
virtual void addSceneChangedCallback(const Callback& callback) = 0;
|
||||
|
||||
/// \brief Invokes all bounds-changed callbacks. Called when the bounds of any instance in the scene change.
|
||||
/// \todo Move to a separate class.
|
||||
virtual void boundsChanged() = 0;
|
||||
/// \brief Add a \p callback to be invoked when the bounds of any instance in the scene change.
|
||||
virtual void addBoundsChangedCallback(const Callback& callback) = 0;
|
||||
/// \brief Remove a \p callback to be invoked when the bounds of any instance in the scene change.
|
||||
virtual void removeBoundsChangedCallback(const Callback& callback) = 0;
|
||||
|
||||
virtual TypeId getNodeTypeId(const char* name) = 0;
|
||||
virtual TypeId getInstanceTypeId(const char* name) = 0;
|
||||
};
|
||||
|
||||
class Traversable
|
||||
{
|
||||
public:
|
||||
STRING_CONSTANT(Name, "scene::Traversable");
|
||||
|
||||
class Observer
|
||||
{
|
||||
public:
|
||||
/// \brief Called when a node is added to the container.
|
||||
virtual void insert(Node& node) = 0;
|
||||
/// \brief Called when a node is removed from the container.
|
||||
virtual void erase(Node& node) = 0;
|
||||
};
|
||||
|
||||
class Walker
|
||||
{
|
||||
public:
|
||||
/// \brief Called before traversing the first child-node of 'node'. If the return value is false, the children of the current node are not traversed.
|
||||
virtual bool pre(Node& node) const = 0;
|
||||
/// \brief Called after traversing the last child-node of 'node'.
|
||||
virtual void post(Node& node) const
|
||||
{
|
||||
}
|
||||
};
|
||||
/// \brief Adds a node to the container.
|
||||
virtual void insert(Node& node) = 0;
|
||||
/// \brief Removes a node from the container.
|
||||
virtual void erase(Node& node) = 0;
|
||||
/// \brief Traverses the subgraphs rooted at each node in the container, depth-first.
|
||||
virtual void traverse(const Walker& walker) = 0;
|
||||
/// \brief Returns true if the container contains no nodes.
|
||||
virtual bool empty() const = 0;
|
||||
};
|
||||
|
||||
class Instantiable
|
||||
{
|
||||
public:
|
||||
STRING_CONSTANT(Name, "scene::Instantiable");
|
||||
|
||||
class Observer
|
||||
{
|
||||
public:
|
||||
/// \brief Called when an instance is added to the container.
|
||||
virtual void insert(scene::Instance* instance) = 0;
|
||||
/// \brief Called when an instance is removed from the container.
|
||||
virtual void erase(scene::Instance* instance) = 0;
|
||||
};
|
||||
|
||||
class Visitor
|
||||
{
|
||||
public:
|
||||
virtual void visit(Instance& instance) const = 0;
|
||||
};
|
||||
|
||||
/// \brief Returns a new instance uniquely identified by 'path'.
|
||||
virtual scene::Instance* create(const scene::Path& path, scene::Instance* parent) = 0;
|
||||
/// \brief Calls Visitor::visit(instance) for each instance in the container.
|
||||
virtual void forEachInstance(const Visitor& visitor) = 0;
|
||||
/// \brief Adds an instance to the container.
|
||||
virtual void insert(Observer* observer, const Path& path, scene::Instance* instance) = 0;
|
||||
/// \brief Returns an instance removed from the container.
|
||||
virtual scene::Instance* erase(Observer* observer, const Path& path) = 0;
|
||||
};
|
||||
|
||||
class Cloneable
|
||||
{
|
||||
public:
|
||||
STRING_CONSTANT(Name, "scene::Cloneable");
|
||||
|
||||
/// \brief Returns a copy of itself.
|
||||
virtual scene::Node& clone() const = 0;
|
||||
};
|
||||
}
|
||||
|
||||
#include "modulesystem.h"
|
||||
|
||||
template<typename Type>
|
||||
class GlobalModule;
|
||||
typedef GlobalModule<scene::Graph> GlobalSceneGraphModule;
|
||||
|
||||
template<typename Type>
|
||||
class GlobalModuleRef;
|
||||
typedef GlobalModuleRef<scene::Graph> GlobalSceneGraphModuleRef;
|
||||
|
||||
inline scene::Graph& GlobalSceneGraph()
|
||||
{
|
||||
return GlobalSceneGraphModule::getTable();
|
||||
}
|
||||
|
||||
inline void AddSceneChangeCallback(const Callback& callback)
|
||||
{
|
||||
GlobalSceneGraph().addSceneChangedCallback(callback);
|
||||
}
|
||||
inline void SceneChangeNotify()
|
||||
{
|
||||
GlobalSceneGraph().sceneChanged();
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
23
include/iscriplib.cpp
Normal file
23
include/iscriplib.cpp
Normal file
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
Copyright (C) 2001-2006, William Joseph.
|
||||
All Rights Reserved.
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
#include "iscriplib.h"
|
||||
|
||||
85
include/iscriplib.h
Normal file
85
include/iscriplib.h
Normal file
@@ -0,0 +1,85 @@
|
||||
/*
|
||||
Copyright (C) 2001-2006, William Joseph.
|
||||
All Rights Reserved.
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
#if !defined(INCLUDED_ISCRIPLIB_H)
|
||||
#define INCLUDED_ISCRIPLIB_H
|
||||
|
||||
/// \file iscriplib.h
|
||||
/// \brief Token input/output stream module.
|
||||
|
||||
#include <cstddef>
|
||||
#include "generic/constant.h"
|
||||
|
||||
#define MAXTOKEN 1024
|
||||
|
||||
class Tokeniser
|
||||
{
|
||||
public:
|
||||
virtual void release() = 0;
|
||||
virtual void nextLine() = 0;
|
||||
virtual const char* getToken() = 0;
|
||||
virtual void ungetToken() = 0;
|
||||
virtual std::size_t getLine() const = 0;
|
||||
virtual std::size_t getColumn() const = 0;
|
||||
};
|
||||
|
||||
class TextInputStream;
|
||||
|
||||
class TokenWriter
|
||||
{
|
||||
public:
|
||||
virtual void release() = 0;
|
||||
virtual void nextLine() = 0;
|
||||
virtual void writeToken(const char* token) = 0;
|
||||
virtual void writeString(const char* string) = 0;
|
||||
virtual void writeInteger(int i) = 0;
|
||||
virtual void writeUnsigned(std::size_t i) = 0;
|
||||
virtual void writeFloat(double f) = 0;
|
||||
};
|
||||
|
||||
class TextOutputStream;
|
||||
|
||||
struct _QERScripLibTable
|
||||
{
|
||||
INTEGER_CONSTANT(Version, 1);
|
||||
STRING_CONSTANT(Name, "scriptlib");
|
||||
|
||||
Tokeniser& (* m_pfnNewScriptTokeniser)(TextInputStream& istream);
|
||||
Tokeniser& (* m_pfnNewSimpleTokeniser)(TextInputStream& istream);
|
||||
TokenWriter& (* m_pfnNewSimpleTokenWriter)(TextOutputStream& ostream);
|
||||
};
|
||||
|
||||
#include "modulesystem.h"
|
||||
|
||||
template<typename Type>
|
||||
class GlobalModule;
|
||||
typedef GlobalModule<_QERScripLibTable> GlobalScripLibModule;
|
||||
|
||||
template<typename Type>
|
||||
class GlobalModuleRef;
|
||||
typedef GlobalModuleRef<_QERScripLibTable> GlobalScripLibModuleRef;
|
||||
|
||||
inline _QERScripLibTable& GlobalScriptLibrary()
|
||||
{
|
||||
return GlobalScripLibModule::getTable();
|
||||
}
|
||||
|
||||
#endif
|
||||
23
include/iselection.cpp
Normal file
23
include/iselection.cpp
Normal file
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
Copyright (C) 2001-2006, William Joseph.
|
||||
All Rights Reserved.
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
#include "iselection.h"
|
||||
|
||||
147
include/iselection.h
Normal file
147
include/iselection.h
Normal file
@@ -0,0 +1,147 @@
|
||||
/*
|
||||
Copyright (C) 2001-2006, William Joseph.
|
||||
All Rights Reserved.
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
#if !defined(INCLUDED_ISELECTION_H)
|
||||
#define INCLUDED_ISELECTION_H
|
||||
|
||||
#include <cstddef>
|
||||
#include "generic/constant.h"
|
||||
|
||||
class Renderer;
|
||||
class View;
|
||||
|
||||
class Callback;
|
||||
|
||||
template<typename FirstArgument>
|
||||
class Callback1;
|
||||
|
||||
class Selectable
|
||||
{
|
||||
public:
|
||||
STRING_CONSTANT(Name, "Selectable");
|
||||
|
||||
virtual void setSelected(bool select) = 0;
|
||||
virtual bool isSelected() const = 0;
|
||||
};
|
||||
|
||||
namespace scene
|
||||
{
|
||||
class Instance;
|
||||
};
|
||||
|
||||
class InstanceSelectionObserver
|
||||
{
|
||||
public:
|
||||
virtual void onSelectedChanged(scene::Instance& instance) = 0;
|
||||
};
|
||||
|
||||
template<typename Element> class BasicVector3;
|
||||
typedef BasicVector3<float> Vector3;
|
||||
template<typename Element> class BasicVector4;
|
||||
typedef BasicVector4<float> Vector4;
|
||||
class Matrix4;
|
||||
typedef Vector4 Quaternion;
|
||||
|
||||
typedef Callback1<const Selectable&> SelectionChangeCallback;
|
||||
|
||||
class SelectionSystem
|
||||
{
|
||||
public:
|
||||
INTEGER_CONSTANT(Version, 1);
|
||||
STRING_CONSTANT(Name, "selection");
|
||||
|
||||
enum EMode
|
||||
{
|
||||
eEntity,
|
||||
ePrimitive,
|
||||
eComponent,
|
||||
};
|
||||
|
||||
enum EComponentMode
|
||||
{
|
||||
eDefault,
|
||||
eVertex,
|
||||
eEdge,
|
||||
eFace,
|
||||
};
|
||||
|
||||
enum EManipulatorMode
|
||||
{
|
||||
eTranslate,
|
||||
eRotate,
|
||||
eScale,
|
||||
eDrag,
|
||||
eClip,
|
||||
};
|
||||
|
||||
virtual void SetMode(EMode mode) = 0;
|
||||
virtual EMode Mode() const = 0;
|
||||
virtual void SetComponentMode(EComponentMode mode) = 0;
|
||||
virtual EComponentMode ComponentMode() const = 0;
|
||||
virtual void SetManipulatorMode(EManipulatorMode mode) = 0;
|
||||
virtual EManipulatorMode ManipulatorMode() const = 0;
|
||||
|
||||
virtual SelectionChangeCallback getObserver(EMode mode) = 0;
|
||||
virtual std::size_t countSelected() const = 0;
|
||||
virtual std::size_t countSelectedComponents() const = 0;
|
||||
virtual void onSelectedChanged(scene::Instance& instance, const Selectable& selectable) = 0;
|
||||
virtual void onComponentSelection(scene::Instance& instance, const Selectable& selectable) = 0;
|
||||
virtual scene::Instance& ultimateSelected() const = 0;
|
||||
virtual scene::Instance& penultimateSelected() const = 0;
|
||||
virtual void setSelectedAll(bool selected) = 0;
|
||||
virtual void setSelectedAllComponents(bool selected) = 0;
|
||||
|
||||
class Visitor
|
||||
{
|
||||
public:
|
||||
virtual void visit(scene::Instance& instance) const = 0;
|
||||
};
|
||||
virtual void foreachSelected(const Visitor& visitor) const = 0;
|
||||
virtual void foreachSelectedComponent(const Visitor& visitor) const = 0;
|
||||
|
||||
virtual void addSelectionChangeCallback(const SelectionChangeCallback& callback) = 0;
|
||||
|
||||
virtual void NudgeManipulator(const Vector3& nudge, const Vector3& view) = 0;
|
||||
|
||||
virtual void translateSelected(const Vector3& translation) = 0;
|
||||
virtual void rotateSelected(const Quaternion& rotation) = 0;
|
||||
virtual void scaleSelected(const Vector3& scaling) = 0;
|
||||
|
||||
virtual void pivotChanged() const = 0;
|
||||
};
|
||||
|
||||
#include "modulesystem.h"
|
||||
|
||||
template<typename Type>
|
||||
class GlobalModule;
|
||||
typedef GlobalModule<SelectionSystem> GlobalSelectionModule;
|
||||
|
||||
template<typename Type>
|
||||
class GlobalModuleRef;
|
||||
typedef GlobalModuleRef<SelectionSystem> GlobalSelectionModuleRef;
|
||||
|
||||
inline SelectionSystem& GlobalSelectionSystem()
|
||||
{
|
||||
return GlobalSelectionModule::getTable();
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
23
include/ishaders.cpp
Normal file
23
include/ishaders.cpp
Normal file
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
Copyright (C) 1999-2006 Id Software, Inc. and contributors.
|
||||
For a list of contributors, see the accompanying CONTRIBUTORS file.
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
#include "ishaders.h"
|
||||
|
||||
197
include/ishaders.h
Normal file
197
include/ishaders.h
Normal file
@@ -0,0 +1,197 @@
|
||||
/*
|
||||
Copyright (C) 1999-2006 Id Software, Inc. and contributors.
|
||||
For a list of contributors, see the accompanying CONTRIBUTORS file.
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
#if !defined(INCLUDED_ISHADERS_H)
|
||||
#define INCLUDED_ISHADERS_H
|
||||
|
||||
#include "generic/constant.h"
|
||||
|
||||
enum
|
||||
{
|
||||
QER_TRANS = 1 << 0,
|
||||
QER_NOCARVE = 1 << 1,
|
||||
QER_NODRAW = 1 << 2,
|
||||
QER_NONSOLID = 1 << 3,
|
||||
QER_WATER = 1 << 4,
|
||||
QER_LAVA = 1 << 5,
|
||||
QER_FOG = 1 << 6,
|
||||
QER_ALPHATEST = 1 << 7,
|
||||
QER_CULL = 1 << 8,
|
||||
QER_AREAPORTAL = 1 << 9,
|
||||
QER_CLIP = 1 << 10,
|
||||
QER_BOTCLIP = 1 << 11,
|
||||
};
|
||||
|
||||
struct qtexture_t;
|
||||
|
||||
template<typename Element> class BasicVector3;
|
||||
typedef BasicVector3<float> Vector3;
|
||||
typedef Vector3 Colour3;
|
||||
|
||||
typedef unsigned char BlendFactor;
|
||||
const BlendFactor BLEND_ZERO = 0;
|
||||
const BlendFactor BLEND_ONE = 1;
|
||||
const BlendFactor BLEND_SRC_COLOUR = 2;
|
||||
const BlendFactor BLEND_ONE_MINUS_SRC_COLOUR = 3;
|
||||
const BlendFactor BLEND_SRC_ALPHA = 4;
|
||||
const BlendFactor BLEND_ONE_MINUS_SRC_ALPHA = 5;
|
||||
const BlendFactor BLEND_DST_COLOUR = 6;
|
||||
const BlendFactor BLEND_ONE_MINUS_DST_COLOUR = 7;
|
||||
const BlendFactor BLEND_DST_ALPHA = 8;
|
||||
const BlendFactor BLEND_ONE_MINUS_DST_ALPHA = 9;
|
||||
const BlendFactor BLEND_SRC_ALPHA_SATURATE = 10;
|
||||
|
||||
class BlendFunc
|
||||
{
|
||||
public:
|
||||
BlendFunc(BlendFactor src, BlendFactor dst) : m_src(src), m_dst(dst)
|
||||
{
|
||||
}
|
||||
BlendFactor m_src;
|
||||
BlendFactor m_dst;
|
||||
};
|
||||
|
||||
class ShaderLayer
|
||||
{
|
||||
public:
|
||||
virtual qtexture_t* texture() const = 0;
|
||||
virtual BlendFunc blendFunc() const = 0;
|
||||
virtual bool clampToBorder() const = 0;
|
||||
virtual float alphaTest() const = 0;
|
||||
};
|
||||
|
||||
template<typename FirstArgument>
|
||||
class Callback1;
|
||||
typedef Callback1<const ShaderLayer&> ShaderLayerCallback;
|
||||
|
||||
|
||||
class IShader
|
||||
{
|
||||
public:
|
||||
enum EAlphaFunc
|
||||
{
|
||||
eAlways,
|
||||
eEqual,
|
||||
eLess,
|
||||
eGreater,
|
||||
eLEqual,
|
||||
eGEqual,
|
||||
};
|
||||
enum ECull
|
||||
{
|
||||
eCullNone,
|
||||
eCullBack,
|
||||
};
|
||||
// Increment the number of references to this object
|
||||
virtual void IncRef() = 0;
|
||||
// Decrement the reference count
|
||||
virtual void DecRef() = 0;
|
||||
// get/set the qtexture_t* Radiant uses to represent this shader object
|
||||
virtual qtexture_t* getTexture() const = 0;
|
||||
virtual qtexture_t* getDiffuse() const = 0;
|
||||
virtual qtexture_t* getBump() const = 0;
|
||||
virtual qtexture_t* getSpecular() const = 0;
|
||||
// get shader name
|
||||
virtual const char* getName() const = 0;
|
||||
virtual bool IsInUse() const = 0;
|
||||
virtual void SetInUse(bool bInUse) = 0;
|
||||
// get the editor flags (QER_NOCARVE QER_TRANS)
|
||||
virtual int getFlags() const = 0;
|
||||
// get the transparency value
|
||||
virtual float getTrans() const = 0;
|
||||
// test if it's a true shader, or a default shader created to wrap around a texture
|
||||
virtual bool IsDefault() const = 0;
|
||||
// get the alphaFunc
|
||||
virtual void getAlphaFunc(EAlphaFunc *func, float *ref) = 0;
|
||||
virtual BlendFunc getBlendFunc() const = 0;
|
||||
// get the cull type
|
||||
virtual ECull getCull() = 0;
|
||||
// get shader file name (ie the file where this one is defined)
|
||||
virtual const char* getShaderFileName() const = 0;
|
||||
|
||||
virtual const ShaderLayer* firstLayer() const = 0;
|
||||
virtual void forEachLayer(const ShaderLayerCallback& layer) const = 0;
|
||||
|
||||
virtual qtexture_t* lightFalloffImage() const = 0;
|
||||
};
|
||||
|
||||
class Callback;
|
||||
typedef struct _GSList GSList;
|
||||
typedef Callback1<const char*> ShaderNameCallback;
|
||||
|
||||
class ModuleObserver;
|
||||
|
||||
class ShaderSystem
|
||||
{
|
||||
public:
|
||||
INTEGER_CONSTANT(Version, 1);
|
||||
STRING_CONSTANT(Name, "shaders");
|
||||
// NOTE: shader and texture names used must be full path.
|
||||
// Shaders usable as textures have prefix equal to getTexturePrefix()
|
||||
|
||||
virtual void realise() = 0;
|
||||
virtual void unrealise() = 0;
|
||||
virtual void refresh() = 0;
|
||||
// activate the shader for a given name and return it
|
||||
// will return the default shader if name is not found
|
||||
virtual IShader* getShaderForName(const char* name) = 0;
|
||||
|
||||
virtual void foreachShaderName(const ShaderNameCallback& callback) = 0;
|
||||
|
||||
// iterate over the list of active shaders
|
||||
virtual void beginActiveShadersIterator() = 0;
|
||||
virtual bool endActiveShadersIterator() = 0;
|
||||
virtual IShader* dereferenceActiveShadersIterator() = 0;
|
||||
virtual void incrementActiveShadersIterator() = 0;
|
||||
|
||||
virtual void setActiveShadersChangedNotify(const Callback& notify) = 0;
|
||||
|
||||
virtual void attach(ModuleObserver& observer) = 0;
|
||||
virtual void detach(ModuleObserver& observer) = 0;
|
||||
|
||||
virtual void setLightingEnabled(bool enabled) = 0;
|
||||
|
||||
virtual const char* getTexturePrefix() const = 0;
|
||||
};
|
||||
|
||||
#include "modulesystem.h"
|
||||
|
||||
template<typename Type>
|
||||
class GlobalModule;
|
||||
typedef GlobalModule<ShaderSystem> GlobalShadersModule;
|
||||
|
||||
template<typename Type>
|
||||
class GlobalModuleRef;
|
||||
typedef GlobalModuleRef<ShaderSystem> GlobalShadersModuleRef;
|
||||
|
||||
inline ShaderSystem& GlobalShaderSystem()
|
||||
{
|
||||
return GlobalShadersModule::getTable();
|
||||
}
|
||||
|
||||
|
||||
#define QERApp_Shader_ForName GlobalShaderSystem().getShaderForName
|
||||
#define QERApp_ActiveShaders_IteratorBegin GlobalShaderSystem().beginActiveShadersIterator
|
||||
#define QERApp_ActiveShaders_IteratorAtEnd GlobalShaderSystem().endActiveShadersIterator
|
||||
#define QERApp_ActiveShaders_IteratorCurrent GlobalShaderSystem().dereferenceActiveShadersIterator
|
||||
#define QERApp_ActiveShaders_IteratorIncrement GlobalShaderSystem().incrementActiveShadersIterator
|
||||
|
||||
#endif
|
||||
23
include/itexdef.cpp
Normal file
23
include/itexdef.cpp
Normal file
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
Copyright (C) 2001-2006, William Joseph.
|
||||
All Rights Reserved.
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
#include "itexdef.h"
|
||||
|
||||
42
include/itexdef.h
Normal file
42
include/itexdef.h
Normal file
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
Copyright (C) 2001-2006, William Joseph.
|
||||
All Rights Reserved.
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
#if !defined (INCLUDED_ITEXDEF_H)
|
||||
#define INCLUDED_ITEXDEF_H
|
||||
|
||||
class texdef_t
|
||||
{
|
||||
public:
|
||||
float shift[2];
|
||||
float rotate;
|
||||
float scale[2];
|
||||
|
||||
texdef_t()
|
||||
{
|
||||
shift[0] = 0;
|
||||
shift[1] = 0;
|
||||
rotate = 0;
|
||||
scale[0] = 1;
|
||||
scale[1] = 1;
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
23
include/itextstream.cpp
Normal file
23
include/itextstream.cpp
Normal file
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
Copyright (C) 2001-2006, William Joseph.
|
||||
All Rights Reserved.
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
#include "itextstream.h"
|
||||
|
||||
114
include/itextstream.h
Normal file
114
include/itextstream.h
Normal file
@@ -0,0 +1,114 @@
|
||||
/*
|
||||
Copyright (C) 2001-2006, William Joseph.
|
||||
All Rights Reserved.
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
#if !defined(INCLUDED_ITEXTSTREAM_H)
|
||||
#define INCLUDED_ITEXTSTREAM_H
|
||||
|
||||
/// \file
|
||||
/// \brief Text-stream interfaces.
|
||||
|
||||
#include <cstddef>
|
||||
#include "generic/static.h"
|
||||
|
||||
/// \brief A read-only character-stream.
|
||||
class TextInputStream
|
||||
{
|
||||
public:
|
||||
/// \brief Attempts to read the next \p length characters from the stream to \p buffer.
|
||||
/// Returns the number of characters actually stored in \p buffer.
|
||||
virtual std::size_t read(char* buffer, std::size_t length) = 0;
|
||||
};
|
||||
|
||||
/// \brief A write-only character-stream.
|
||||
class TextOutputStream
|
||||
{
|
||||
public:
|
||||
/// \brief Attempts to write \p length characters to the stream from \p buffer.
|
||||
/// Returns the number of characters actually read from \p buffer.
|
||||
virtual std::size_t write(const char* buffer, std::size_t length) = 0;
|
||||
};
|
||||
|
||||
/// \brief Calls the overloaded function ostream_write() to perform text formatting specific to the type being written.
|
||||
/*! Note that ostream_write() is not globally defined - it must be defined once for each type supported.\n
|
||||
To support writing a custom type MyClass to any kind of text-output-stream with operator<<:
|
||||
\code
|
||||
template<typename TextOutputStreamType>
|
||||
TextOutputStreamType& ostream_write(TextOutputStreamType& ostream, const MyClass& myClass)
|
||||
{
|
||||
return ostream << myClass.getName() << ' ' << myClass.getText();
|
||||
}
|
||||
\endcode
|
||||
Expressing this as a template allows it to be used directly with any concrete text-output-stream type, not just the abstract TextOutputStream\n
|
||||
\n
|
||||
This overload writes a single character to any text-output-stream - ostream_write(TextOutputStreamType& ostream, char c).
|
||||
*/
|
||||
template<typename T>
|
||||
inline TextOutputStream& operator<<(TextOutputStream& ostream, const T& t)
|
||||
{
|
||||
return ostream_write(ostream, t);
|
||||
}
|
||||
|
||||
class NullOutputStream : public TextOutputStream
|
||||
{
|
||||
public:
|
||||
std::size_t write(const char*, std::size_t length)
|
||||
{
|
||||
return length;
|
||||
}
|
||||
};
|
||||
|
||||
class OutputStreamHolder
|
||||
{
|
||||
NullOutputStream m_nullOutputStream;
|
||||
TextOutputStream* m_outputStream;
|
||||
public:
|
||||
OutputStreamHolder()
|
||||
: m_outputStream(&m_nullOutputStream)
|
||||
{
|
||||
}
|
||||
void setOutputStream(TextOutputStream& outputStream)
|
||||
{
|
||||
m_outputStream = &outputStream;
|
||||
}
|
||||
TextOutputStream& getOutputStream()
|
||||
{
|
||||
return *m_outputStream;
|
||||
}
|
||||
};
|
||||
|
||||
typedef Static<OutputStreamHolder> GlobalOutputStream;
|
||||
|
||||
/// \brief Returns the global output stream. Used to display messages to the user.
|
||||
inline TextOutputStream& globalOutputStream()
|
||||
{
|
||||
return GlobalOutputStream::instance().getOutputStream();
|
||||
}
|
||||
|
||||
class ErrorStreamHolder : public OutputStreamHolder {};
|
||||
typedef Static<ErrorStreamHolder> GlobalErrorStream;
|
||||
|
||||
/// \brief Returns the global error stream. Used to display error messages to the user.
|
||||
inline TextOutputStream& globalErrorStream()
|
||||
{
|
||||
return GlobalErrorStream::instance().getOutputStream();
|
||||
}
|
||||
|
||||
#endif
|
||||
23
include/itextures.cpp
Normal file
23
include/itextures.cpp
Normal file
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
Copyright (C) 2001-2006, William Joseph.
|
||||
All Rights Reserved.
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
#include "itextures.h"
|
||||
|
||||
92
include/itextures.h
Normal file
92
include/itextures.h
Normal file
@@ -0,0 +1,92 @@
|
||||
/*
|
||||
Copyright (C) 2001-2006, William Joseph.
|
||||
All Rights Reserved.
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
#if !defined(INCLUDED_ITEXTURES_H)
|
||||
#define INCLUDED_ITEXTURES_H
|
||||
|
||||
#include "iimage.h"
|
||||
#include "generic/constant.h"
|
||||
|
||||
struct qtexture_t;
|
||||
|
||||
class LoadImageCallback
|
||||
{
|
||||
typedef Image* (*LoadFunc)(void* environment, const char* name);
|
||||
public:
|
||||
void* m_environment;
|
||||
LoadFunc m_func;
|
||||
|
||||
LoadImageCallback(void* environment, LoadFunc func) : m_environment(environment), m_func(func)
|
||||
{
|
||||
}
|
||||
Image* loadImage(const char* name) const
|
||||
{
|
||||
return m_func(m_environment, name);
|
||||
}
|
||||
};
|
||||
|
||||
inline bool operator==(const LoadImageCallback& self, const LoadImageCallback& other)
|
||||
{
|
||||
return self.m_environment == other.m_environment && self.m_func == other.m_func;
|
||||
}
|
||||
inline bool operator<(const LoadImageCallback& self, const LoadImageCallback& other)
|
||||
{
|
||||
return self.m_environment < other.m_environment ||
|
||||
(!(other.m_environment < self.m_environment) && self.m_func < other.m_func);
|
||||
}
|
||||
|
||||
class TexturesCacheObserver
|
||||
{
|
||||
public:
|
||||
virtual void unrealise() = 0;
|
||||
virtual void realise() = 0;
|
||||
};
|
||||
|
||||
class TexturesCache
|
||||
{
|
||||
public:
|
||||
INTEGER_CONSTANT(Version, 1);
|
||||
STRING_CONSTANT(Name, "textures");
|
||||
virtual LoadImageCallback defaultLoader() const = 0;
|
||||
virtual Image* loadImage(const char* name) = 0;
|
||||
virtual qtexture_t* capture(const char* name) = 0;
|
||||
virtual qtexture_t* capture(const LoadImageCallback& load, const char* name) = 0;
|
||||
virtual void release(qtexture_t* texture) = 0;
|
||||
virtual void attach(TexturesCacheObserver& observer) = 0;
|
||||
virtual void detach(TexturesCacheObserver& observer) = 0;
|
||||
};
|
||||
|
||||
#include "modulesystem.h"
|
||||
|
||||
template<typename Type>
|
||||
class GlobalModule;
|
||||
typedef GlobalModule<TexturesCache> GlobalTexturesModule;
|
||||
|
||||
template<typename Type>
|
||||
class GlobalModuleRef;
|
||||
typedef GlobalModuleRef<TexturesCache> GlobalTexturesModuleRef;
|
||||
|
||||
inline TexturesCache& GlobalTexturesCache()
|
||||
{
|
||||
return GlobalTexturesModule::getTable();
|
||||
}
|
||||
|
||||
#endif
|
||||
23
include/itoolbar.cpp
Normal file
23
include/itoolbar.cpp
Normal file
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
Copyright (C) 1999-2006 Id Software, Inc. and contributors.
|
||||
For a list of contributors, see the accompanying CONTRIBUTORS file.
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
#include "itoolbar.h"
|
||||
|
||||
66
include/itoolbar.h
Normal file
66
include/itoolbar.h
Normal file
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
Copyright (C) 1999-2006 Id Software, Inc. and contributors.
|
||||
For a list of contributors, see the accompanying CONTRIBUTORS file.
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
#if !defined(INCLUDED_IPLUGTOOLBAR_H)
|
||||
#define INCLUDED_IPLUGTOOLBAR_H
|
||||
|
||||
#include <cstddef>
|
||||
#include "generic/constant.h"
|
||||
|
||||
class IToolbarButton
|
||||
{
|
||||
public:
|
||||
enum EType
|
||||
{
|
||||
eSpace,
|
||||
eButton,
|
||||
eToggleButton,
|
||||
eRadioButton,
|
||||
};
|
||||
|
||||
virtual const char* getImage() const = 0;
|
||||
virtual const char* getText() const = 0;
|
||||
virtual const char* getTooltip() const = 0;
|
||||
virtual EType getType() const = 0;
|
||||
virtual void activate() const = 0;
|
||||
};
|
||||
|
||||
typedef std::size_t (* PFN_TOOLBARBUTTONCOUNT)();
|
||||
typedef const IToolbarButton* (* PFN_GETTOOLBARBUTTON)(std::size_t index);
|
||||
|
||||
struct _QERPlugToolbarTable
|
||||
{
|
||||
INTEGER_CONSTANT(Version, 1);
|
||||
STRING_CONSTANT(Name, "toolbar");
|
||||
|
||||
PFN_TOOLBARBUTTONCOUNT m_pfnToolbarButtonCount;
|
||||
PFN_GETTOOLBARBUTTON m_pfnGetToolbarButton;
|
||||
};
|
||||
|
||||
template<typename Type>
|
||||
class Modules;
|
||||
typedef Modules<_QERPlugToolbarTable> ToolbarModules;
|
||||
|
||||
template<typename Type>
|
||||
class ModulesRef;
|
||||
typedef ModulesRef<_QERPlugToolbarTable> ToolbarModulesRef;
|
||||
|
||||
#endif
|
||||
23
include/iundo.cpp
Normal file
23
include/iundo.cpp
Normal file
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
Copyright (C) 2001-2006, William Joseph.
|
||||
All Rights Reserved.
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
#include "iundo.h"
|
||||
|
||||
111
include/iundo.h
Normal file
111
include/iundo.h
Normal file
@@ -0,0 +1,111 @@
|
||||
/*
|
||||
Copyright (C) 2001-2006, William Joseph.
|
||||
All Rights Reserved.
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
#if !defined(INCLUDED_IUNDO_H)
|
||||
#define INCLUDED_IUNDO_H
|
||||
|
||||
/// \file
|
||||
/// \brief The undo-system interface. Uses the 'memento' pattern.
|
||||
|
||||
#include <cstddef>
|
||||
#include "generic/constant.h"
|
||||
|
||||
class UndoMemento
|
||||
{
|
||||
public:
|
||||
virtual void release() = 0;
|
||||
};
|
||||
|
||||
class Undoable
|
||||
{
|
||||
public:
|
||||
virtual UndoMemento* exportState() const = 0;
|
||||
virtual void importState(const UndoMemento* state) = 0;
|
||||
};
|
||||
|
||||
class UndoObserver
|
||||
{
|
||||
public:
|
||||
virtual void save(Undoable* undoable) = 0;
|
||||
};
|
||||
|
||||
class Callback;
|
||||
|
||||
class UndoTracker
|
||||
{
|
||||
public:
|
||||
virtual void clear() = 0;
|
||||
virtual void begin() = 0;
|
||||
virtual void undo() = 0;
|
||||
virtual void redo() = 0;
|
||||
};
|
||||
|
||||
class UndoSystem
|
||||
{
|
||||
public:
|
||||
INTEGER_CONSTANT(Version, 1);
|
||||
STRING_CONSTANT(Name, "undo");
|
||||
|
||||
virtual UndoObserver* observer(Undoable* undoable) = 0;
|
||||
virtual void release(Undoable* undoable) = 0;
|
||||
|
||||
virtual std::size_t size() const = 0;
|
||||
virtual void start() = 0;
|
||||
virtual void finish(const char* command) = 0;
|
||||
virtual void undo() = 0;
|
||||
virtual void redo() = 0;
|
||||
virtual void clear() = 0;
|
||||
|
||||
virtual void trackerAttach(UndoTracker& tracker) = 0;
|
||||
virtual void trackerDetach(UndoTracker& tracker) = 0;
|
||||
};
|
||||
|
||||
#include "modulesystem.h"
|
||||
|
||||
template<typename Type>
|
||||
class GlobalModule;
|
||||
typedef GlobalModule<UndoSystem> GlobalUndoModule;
|
||||
|
||||
template<typename Type>
|
||||
class GlobalModuleRef;
|
||||
typedef GlobalModuleRef<UndoSystem> GlobalUndoModuleRef;
|
||||
|
||||
inline UndoSystem& GlobalUndoSystem()
|
||||
{
|
||||
return GlobalUndoModule::getTable();
|
||||
}
|
||||
|
||||
class UndoableCommand
|
||||
{
|
||||
const char* m_command;
|
||||
public:
|
||||
UndoableCommand(const char* command) : m_command(command)
|
||||
{
|
||||
GlobalUndoSystem().start();
|
||||
}
|
||||
~UndoableCommand()
|
||||
{
|
||||
GlobalUndoSystem().finish(m_command);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
23
include/mapfile.cpp
Normal file
23
include/mapfile.cpp
Normal file
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
Copyright (C) 2001-2006, William Joseph.
|
||||
All Rights Reserved.
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
#include "mapfile.h"
|
||||
|
||||
77
include/mapfile.h
Normal file
77
include/mapfile.h
Normal file
@@ -0,0 +1,77 @@
|
||||
/*
|
||||
Copyright (C) 2001-2006, William Joseph.
|
||||
All Rights Reserved.
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
#if !defined(INCLUDED_MAPFILE_H)
|
||||
#define INCLUDED_MAPFILE_H
|
||||
|
||||
#include <limits>
|
||||
|
||||
#include "iscenegraph.h"
|
||||
|
||||
class Callback;
|
||||
|
||||
const std::size_t MAPFILE_MAX_CHANGES = std::numeric_limits<std::size_t>::max();
|
||||
|
||||
class MapFile
|
||||
{
|
||||
public:
|
||||
STRING_CONSTANT(Name, "MapFile");
|
||||
|
||||
virtual void save() = 0;
|
||||
virtual bool saved() const = 0;
|
||||
virtual void changed() = 0;
|
||||
virtual void setChangedCallback(const Callback& changed) = 0;
|
||||
virtual std::size_t changes() const = 0;
|
||||
};
|
||||
|
||||
#include "scenelib.h"
|
||||
|
||||
inline MapFile* Node_getMapFile(scene::Node& node)
|
||||
{
|
||||
return NodeTypeCast<MapFile>::cast(node);
|
||||
}
|
||||
|
||||
template<typename Iterator>
|
||||
inline MapFile* path_find_mapfile(Iterator first, Iterator last)
|
||||
{
|
||||
Iterator i = last;
|
||||
for(;;)
|
||||
{
|
||||
--i;
|
||||
|
||||
MapFile* map = Node_getMapFile(*i);
|
||||
if(map != 0)
|
||||
{
|
||||
return map;
|
||||
}
|
||||
|
||||
if(i == first)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
ERROR_MESSAGE("failed to find parent mapfile for path");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
23
include/modelskin.cpp
Normal file
23
include/modelskin.cpp
Normal file
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
Copyright (C) 2001-2006, William Joseph.
|
||||
All Rights Reserved.
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
#include "modelskin.h"
|
||||
|
||||
93
include/modelskin.h
Normal file
93
include/modelskin.h
Normal file
@@ -0,0 +1,93 @@
|
||||
/*
|
||||
Copyright (C) 2001-2006, William Joseph.
|
||||
All Rights Reserved.
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
#if !defined(INCLUDED_MODELSKIN_H)
|
||||
#define INCLUDED_MODELSKIN_H
|
||||
|
||||
#include "generic/constant.h"
|
||||
|
||||
class SkinRemap
|
||||
{
|
||||
public:
|
||||
const char* m_from;
|
||||
const char* m_to;
|
||||
SkinRemap(const char* from, const char* to) : m_from(from), m_to(to)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
template<typename FirstArgument>
|
||||
class Callback1;
|
||||
typedef Callback1<SkinRemap> SkinRemapCallback;
|
||||
class ModuleObserver;
|
||||
|
||||
class ModelSkin
|
||||
{
|
||||
public:
|
||||
STRING_CONSTANT(Name, "ModelSkin");
|
||||
/// \brief Attach an \p observer whose realise() and unrealise() methods will be called when the skin is loaded or unloaded.
|
||||
virtual void attach(ModuleObserver& observer) = 0;
|
||||
/// \brief Detach an \p observer previously-attached by calling \c attach.
|
||||
virtual void detach(ModuleObserver& observer) = 0;
|
||||
/// \brief Returns true if this skin is currently loaded.
|
||||
virtual bool realised() const = 0;
|
||||
/// \brief Returns the shader identifier that \p name remaps to, or "" if not found or not realised.
|
||||
virtual const char* getRemap(const char* name) const = 0;
|
||||
/// \brief Calls \p callback for each remap pair. Has no effect if not realised.
|
||||
virtual void forEachRemap(const SkinRemapCallback& callback) const = 0;
|
||||
};
|
||||
|
||||
class SkinnedModel
|
||||
{
|
||||
public:
|
||||
STRING_CONSTANT(Name, "SkinnedModel");
|
||||
/// \brief Instructs the skinned model to update its skin.
|
||||
virtual void skinChanged() = 0;
|
||||
};
|
||||
|
||||
class ModelSkinCache
|
||||
{
|
||||
public:
|
||||
INTEGER_CONSTANT(Version, 1);
|
||||
STRING_CONSTANT(Name, "modelskin");
|
||||
/// \brief Increments the reference count of and returns a reference to the skin uniquely identified by 'name'.
|
||||
virtual ModelSkin& capture(const char* name) = 0;
|
||||
/// \brief Decrements the reference-count of the skin uniquely identified by 'name'.
|
||||
virtual void release(const char* name) = 0;
|
||||
};
|
||||
|
||||
|
||||
#include "modulesystem.h"
|
||||
|
||||
template<typename Type>
|
||||
class GlobalModule;
|
||||
typedef GlobalModule<ModelSkinCache> GlobalModelSkinCacheModule;
|
||||
|
||||
template<typename Type>
|
||||
class GlobalModuleRef;
|
||||
typedef GlobalModuleRef<ModelSkinCache> GlobalModelSkinCacheModuleRef;
|
||||
|
||||
inline ModelSkinCache& GlobalModelSkinCache()
|
||||
{
|
||||
return GlobalModelSkinCacheModule::getTable();
|
||||
}
|
||||
|
||||
#endif
|
||||
23
include/moduleobserver.cpp
Normal file
23
include/moduleobserver.cpp
Normal file
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
Copyright (C) 2001-2006, William Joseph.
|
||||
All Rights Reserved.
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
#include "moduleobserver.h"
|
||||
|
||||
32
include/moduleobserver.h
Normal file
32
include/moduleobserver.h
Normal file
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
Copyright (C) 2001-2006, William Joseph.
|
||||
All Rights Reserved.
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
#if !defined(INCLUDED_MODULEOBSERVER_H)
|
||||
#define INCLUDED_MODULEOBSERVER_H
|
||||
|
||||
class ModuleObserver
|
||||
{
|
||||
public:
|
||||
virtual void unrealise() = 0;
|
||||
virtual void realise() = 0;
|
||||
};
|
||||
|
||||
#endif
|
||||
23
include/modulesystem.cpp
Normal file
23
include/modulesystem.cpp
Normal file
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
Copyright (C) 2001-2006, William Joseph.
|
||||
All Rights Reserved.
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
#include "modulesystem.h"
|
||||
|
||||
247
include/modulesystem.h
Normal file
247
include/modulesystem.h
Normal file
@@ -0,0 +1,247 @@
|
||||
/*
|
||||
Copyright (C) 2001-2006, William Joseph.
|
||||
All Rights Reserved.
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
#if !defined(INCLUDED_MODULESYSTEM_H)
|
||||
#define INCLUDED_MODULESYSTEM_H
|
||||
|
||||
#include "generic/static.h"
|
||||
|
||||
#if defined(WIN32)
|
||||
#define RADIANT_DLLEXPORT __stdcall
|
||||
#else
|
||||
#define RADIANT_DLLEXPORT
|
||||
#endif
|
||||
|
||||
|
||||
class Module
|
||||
{
|
||||
public:
|
||||
virtual void capture() = 0;
|
||||
virtual void release() = 0;
|
||||
virtual void* getTable() = 0;
|
||||
};
|
||||
|
||||
inline void* Module_getTable(Module& module)
|
||||
{
|
||||
return module.getTable();
|
||||
}
|
||||
|
||||
class TextOutputStream;
|
||||
class DebugMessageHandler;
|
||||
|
||||
class ModuleServer
|
||||
{
|
||||
public:
|
||||
class Visitor
|
||||
{
|
||||
public:
|
||||
virtual void visit(const char* name, Module& module) = 0;
|
||||
};
|
||||
|
||||
virtual void setError(bool error) = 0;
|
||||
virtual bool getError() const = 0;
|
||||
|
||||
virtual TextOutputStream& getOutputStream() = 0;
|
||||
virtual TextOutputStream& getErrorStream() = 0;
|
||||
virtual DebugMessageHandler& getDebugMessageHandler() = 0;
|
||||
|
||||
virtual void registerModule(const char* type, int version, const char* name, Module& module) = 0;
|
||||
virtual Module* findModule(const char* type, int version, const char* name) const = 0;
|
||||
virtual void foreachModule(const char* type, int version, Visitor& visitor) = 0;
|
||||
};
|
||||
|
||||
class ModuleServerHolder
|
||||
{
|
||||
ModuleServer* m_server;
|
||||
public:
|
||||
ModuleServerHolder()
|
||||
: m_server(0)
|
||||
{
|
||||
}
|
||||
void set(ModuleServer& server)
|
||||
{
|
||||
m_server = &server;
|
||||
}
|
||||
ModuleServer& get()
|
||||
{
|
||||
return *m_server;
|
||||
}
|
||||
};
|
||||
|
||||
typedef Static<ModuleServerHolder> GlobalModuleServer;
|
||||
|
||||
inline ModuleServer& globalModuleServer()
|
||||
{
|
||||
return GlobalModuleServer::instance().get();
|
||||
}
|
||||
|
||||
|
||||
template<typename Type>
|
||||
class Modules
|
||||
{
|
||||
public:
|
||||
class Visitor
|
||||
{
|
||||
public:
|
||||
virtual void visit(const char* name, const Type& table) = 0;
|
||||
};
|
||||
|
||||
virtual Type* findModule(const char* name) = 0;
|
||||
virtual void foreachModule(Visitor& visitor) = 0;
|
||||
};
|
||||
|
||||
#include "debugging/debugging.h"
|
||||
|
||||
template<typename Type>
|
||||
class ModuleRef
|
||||
{
|
||||
Module* m_module;
|
||||
Type* m_table;
|
||||
public:
|
||||
ModuleRef(const char* name) : m_table(0)
|
||||
{
|
||||
if(!globalModuleServer().getError())
|
||||
{
|
||||
m_module = globalModuleServer().findModule(typename Type::Name(), typename Type::Version(), name);
|
||||
if(m_module == 0)
|
||||
{
|
||||
globalModuleServer().setError(true);
|
||||
globalErrorStream() << "ModuleRef::initialise: type=" << makeQuoted(typename Type::Name()) << " version=" << makeQuoted(typename Type::Version()) << " name=" << makeQuoted(name) << " - not found\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
m_module->capture();
|
||||
if(!globalModuleServer().getError())
|
||||
{
|
||||
m_table = static_cast<Type*>(m_module->getTable());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
~ModuleRef()
|
||||
{
|
||||
if(m_module != 0)
|
||||
{
|
||||
m_module->release();
|
||||
}
|
||||
}
|
||||
Type* getTable()
|
||||
{
|
||||
#if defined(_DEBUG)
|
||||
ASSERT_MESSAGE(m_table != 0, "ModuleRef::getTable: type=" << makeQuoted(typename Type::Name()) << " version=" << makeQuoted(typename Type::Version()) << " - module-reference used without being initialised");
|
||||
#endif
|
||||
return m_table;
|
||||
}
|
||||
};
|
||||
|
||||
template<typename Type>
|
||||
class SingletonModuleRef
|
||||
{
|
||||
Module* m_module;
|
||||
Type* m_table;
|
||||
public:
|
||||
|
||||
SingletonModuleRef()
|
||||
: m_module(0), m_table(0)
|
||||
{
|
||||
}
|
||||
|
||||
bool initialised() const
|
||||
{
|
||||
return m_module != 0;
|
||||
}
|
||||
|
||||
void initialise(const char* name)
|
||||
{
|
||||
m_module = globalModuleServer().findModule(typename Type::Name(), typename Type::Version(), name);
|
||||
if(m_module == 0)
|
||||
{
|
||||
globalModuleServer().setError(true);
|
||||
globalErrorStream() << "SingletonModuleRef::initialise: type=" << makeQuoted(typename Type::Name()) << " version=" << makeQuoted(typename Type::Version()) << " name=" << makeQuoted(name) << " - not found\n";
|
||||
}
|
||||
}
|
||||
|
||||
Type* getTable()
|
||||
{
|
||||
#if defined(_DEBUG)
|
||||
ASSERT_MESSAGE(m_table != 0, "SingletonModuleRef::getTable: type=" << makeQuoted(typename Type::Name()) << " version=" << makeQuoted(typename Type::Version()) << " - module-reference used without being initialised");
|
||||
#endif
|
||||
return m_table;
|
||||
}
|
||||
void capture()
|
||||
{
|
||||
if(initialised())
|
||||
{
|
||||
m_module->capture();
|
||||
m_table = static_cast<Type*>(m_module->getTable());
|
||||
}
|
||||
}
|
||||
void release()
|
||||
{
|
||||
if(initialised())
|
||||
{
|
||||
m_module->release();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
template<typename Type>
|
||||
class GlobalModule
|
||||
{
|
||||
static SingletonModuleRef<Type> m_instance;
|
||||
public:
|
||||
static SingletonModuleRef<Type>& instance()
|
||||
{
|
||||
return m_instance;
|
||||
}
|
||||
static Type& getTable()
|
||||
{
|
||||
return *m_instance.getTable();
|
||||
}
|
||||
};
|
||||
|
||||
template<class Type>
|
||||
SingletonModuleRef<Type> GlobalModule<Type>::m_instance;
|
||||
|
||||
|
||||
template<typename Type>
|
||||
class GlobalModuleRef
|
||||
{
|
||||
public:
|
||||
GlobalModuleRef(const char* name = "*")
|
||||
{
|
||||
if(!globalModuleServer().getError())
|
||||
{
|
||||
GlobalModule<Type>::instance().initialise(name);
|
||||
}
|
||||
GlobalModule<Type>::instance().capture();
|
||||
}
|
||||
~GlobalModuleRef()
|
||||
{
|
||||
GlobalModule<Type>::instance().release();
|
||||
}
|
||||
Type& getTable()
|
||||
{
|
||||
return GlobalModule<Type>::getTable();
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
23
include/nameable.cpp
Normal file
23
include/nameable.cpp
Normal file
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
Copyright (C) 2001-2006, William Joseph.
|
||||
All Rights Reserved.
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
#include "nameable.h"
|
||||
|
||||
42
include/nameable.h
Normal file
42
include/nameable.h
Normal file
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
Copyright (C) 2001-2006, William Joseph.
|
||||
All Rights Reserved.
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
#if !defined(INCLUDED_NAMEABLE_H)
|
||||
#define INCLUDED_NAMEABLE_H
|
||||
|
||||
#include "generic/constant.h"
|
||||
|
||||
template<typename FirstArgument>
|
||||
class Callback1;
|
||||
typedef Callback1<const char*> NameCallback;
|
||||
|
||||
class Nameable
|
||||
{
|
||||
public:
|
||||
STRING_CONSTANT(Name, "Nameable");
|
||||
|
||||
virtual const char* name() const = 0;
|
||||
virtual void attach(const NameCallback& callback) = 0;
|
||||
virtual void detach(const NameCallback& callback) = 0;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
23
include/namespace.cpp
Normal file
23
include/namespace.cpp
Normal file
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
Copyright (C) 2001-2006, William Joseph.
|
||||
All Rights Reserved.
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
#include "namespace.h"
|
||||
|
||||
64
include/namespace.h
Normal file
64
include/namespace.h
Normal file
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
Copyright (C) 2001-2006, William Joseph.
|
||||
All Rights Reserved.
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
#if !defined(INCLUDED_NAMESPACE_H)
|
||||
#define INCLUDED_NAMESPACE_H
|
||||
|
||||
#include "generic/constant.h"
|
||||
|
||||
template<typename FirstArgument>
|
||||
class Callback1;
|
||||
typedef Callback1<const char*> NameCallback;
|
||||
typedef Callback1<const NameCallback&> NameCallbackCallback;
|
||||
|
||||
class Namespace
|
||||
{
|
||||
public:
|
||||
INTEGER_CONSTANT(Version, 1);
|
||||
STRING_CONSTANT(Name, "namespace");
|
||||
virtual void attach(const NameCallback& setName, const NameCallbackCallback& attachObserver) = 0;
|
||||
virtual void detach(const NameCallback& setName, const NameCallbackCallback& detachObserver) = 0;
|
||||
virtual void makeUnique(const char* name, const NameCallback& setName) const = 0;
|
||||
};
|
||||
|
||||
class Namespaced
|
||||
{
|
||||
public:
|
||||
STRING_CONSTANT(Name, "Namespaced");
|
||||
|
||||
virtual void setNamespace(Namespace& space) = 0;
|
||||
};
|
||||
|
||||
#include "modulesystem.h"
|
||||
|
||||
template<typename Type>
|
||||
class GlobalModule;
|
||||
typedef GlobalModule<Namespace> GlobalNamespaceModule;
|
||||
|
||||
template<typename Type>
|
||||
class GlobalModuleRef;
|
||||
typedef GlobalModuleRef<Namespace> GlobalNamespaceModuleRef;
|
||||
|
||||
inline Namespace& GlobalNamespace()
|
||||
{
|
||||
return GlobalNamespaceModule::getTable();
|
||||
}
|
||||
#endif
|
||||
206
include/preferencesystem.cpp
Normal file
206
include/preferencesystem.cpp
Normal file
@@ -0,0 +1,206 @@
|
||||
/*
|
||||
Copyright (C) 2001-2006, William Joseph.
|
||||
All Rights Reserved.
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
#if 0
|
||||
|
||||
#include "preferencesystem.h"
|
||||
#include "preferencedictionary.h"
|
||||
|
||||
#include "xml/xmlparser.h"
|
||||
#include "xml/xmlwriter.h"
|
||||
|
||||
|
||||
void LoadPrefs(PreferenceDictionary& preferences, const char* filename)
|
||||
{
|
||||
TextFileInputStream file(filename);
|
||||
if(!file.failed())
|
||||
{
|
||||
XMLStreamParser parser(file);
|
||||
XMLPreferenceDictionaryImporter importer(preferences);
|
||||
parser.exportXML(importer);
|
||||
}
|
||||
else
|
||||
{
|
||||
// error
|
||||
}
|
||||
}
|
||||
|
||||
void SavePrefs(PreferenceDictionary& preferences, const char* filename)
|
||||
{
|
||||
TextFileOutputStream file(filename);
|
||||
if(!file.failed())
|
||||
{
|
||||
XMLStreamWriter writer(file);
|
||||
XMLPreferenceDictionaryExporter exporter(preferences, "1");
|
||||
exporter.exportXML(writer);
|
||||
}
|
||||
else
|
||||
{
|
||||
// error
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class StringPreference
|
||||
{
|
||||
public:
|
||||
class Observer
|
||||
{
|
||||
public:
|
||||
virtual void onChanged() = 0;
|
||||
};
|
||||
|
||||
private:
|
||||
CopiedString m_string;
|
||||
Observer& m_observer;
|
||||
public:
|
||||
StringPreference(Observer& observer)
|
||||
: m_observer(observer)
|
||||
{
|
||||
}
|
||||
void importString(const char* value)
|
||||
{
|
||||
m_string = value;
|
||||
m_observer.onChanged();
|
||||
}
|
||||
typedef MemberCaller1<StringPreference, const char*, &StringPreference::importString> ImportStringCaller;
|
||||
void exportString(StringImportCallback& importer)
|
||||
{
|
||||
importer(m_string.c_str());
|
||||
}
|
||||
typedef MemberCaller1<StringPreference, StringImportCallback&, &StringPreference::exportString> ExportStringCaller;
|
||||
};
|
||||
|
||||
inline void int_export(int i, StringImportCallback& importer)
|
||||
{
|
||||
char buffer[16];
|
||||
sprintf(buffer, "%d", i);
|
||||
importer(buffer);
|
||||
}
|
||||
|
||||
inline int int_import(const char* value)
|
||||
{
|
||||
return atoi(value);
|
||||
}
|
||||
|
||||
class IntPreference
|
||||
{
|
||||
public:
|
||||
class Observer
|
||||
{
|
||||
public:
|
||||
virtual void onChanged() = 0;
|
||||
};
|
||||
|
||||
private:
|
||||
int m_int;
|
||||
Observer& m_observer;
|
||||
public:
|
||||
|
||||
IntPreference(Observer& observer)
|
||||
: m_observer(observer)
|
||||
{
|
||||
}
|
||||
void importString(const char* value)
|
||||
{
|
||||
m_int = int_import(value);
|
||||
m_observer.onChanged();
|
||||
}
|
||||
typedef MemberCaller1<IntPreference, const char*, &IntPreference::importString> ImportStringCaller;
|
||||
void exportString(StringImportCallback& importer)
|
||||
{
|
||||
int_export(m_int, importer);
|
||||
}
|
||||
typedef MemberCaller1<IntPreference, StringImportCallback&, &IntPreference::exportString> ExportStringCaller;
|
||||
};
|
||||
|
||||
class IntPreferenceImporter
|
||||
{
|
||||
int& m_i;
|
||||
public:
|
||||
|
||||
IntPreferenceImporter(int& i)
|
||||
: m_i(i)
|
||||
{
|
||||
}
|
||||
void importString(const char* value)
|
||||
{
|
||||
m_i = int_import(value);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class TestPrefs
|
||||
{
|
||||
public:
|
||||
TestPrefs()
|
||||
{
|
||||
PreferenceDictionary preferences;
|
||||
|
||||
class StringObserver : public StringPreference::Observer
|
||||
{
|
||||
public:
|
||||
void onChanged()
|
||||
{
|
||||
int bleh = 0;
|
||||
}
|
||||
} string_observer;
|
||||
StringPreference string1(string_observer);
|
||||
string1.importString("twenty-three");
|
||||
|
||||
class IntObserver : public IntPreference::Observer
|
||||
{
|
||||
public:
|
||||
void onChanged()
|
||||
{
|
||||
int bleh = 0;
|
||||
}
|
||||
|
||||
} int_observer;
|
||||
IntPreference int1(int_observer);
|
||||
int1.importString("23");
|
||||
|
||||
preferences.registerPreference("string1", StringPreference::ImportStringCaller(string1), StringPreference::ExportStringCaller(string1));
|
||||
preferences.registerPreference("int1", IntPreference::ImportStringCaller(int1), IntPreference::ExportStringCaller(int1));
|
||||
|
||||
LoadPrefs(preferences, "test.pref");
|
||||
SavePrefs(preferences, "test.pref");
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
#if 0
|
||||
TestPrefs g_TestPrefs;
|
||||
#endif
|
||||
|
||||
void readpref(PreferenceDictionary& preferences, int& int_variable)
|
||||
{
|
||||
PreferenceDictionary::iterator i = preferences.find("int_variable");
|
||||
IntPreferenceImporter importer(int_variable);
|
||||
(*i).second.exporter().exportString(importer);
|
||||
}
|
||||
|
||||
void writepref(PreferenceDictionary& preferences, int& int_variable)
|
||||
{
|
||||
PreferenceDictionary::iterator i = preferences.find("int_variable");
|
||||
int_export(int_variable, (*i).second.importer());
|
||||
}
|
||||
#endif
|
||||
57
include/preferencesystem.h
Normal file
57
include/preferencesystem.h
Normal file
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
Copyright (C) 2001-2006, William Joseph.
|
||||
All Rights Reserved.
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
#if !defined(INCLUDED_PREFERENCESYSTEM_H)
|
||||
#define INCLUDED_PREFERENCESYSTEM_H
|
||||
|
||||
#include "generic/constant.h"
|
||||
|
||||
template<typename FirstArgument>
|
||||
class Callback1;
|
||||
typedef Callback1<const char*> StringImportCallback;
|
||||
typedef Callback1<const StringImportCallback&> StringExportCallback;
|
||||
|
||||
class PreferenceSystem
|
||||
{
|
||||
public:
|
||||
INTEGER_CONSTANT(Version, 1);
|
||||
STRING_CONSTANT(Name, "preferences");
|
||||
|
||||
virtual void registerPreference(const char* name, const StringImportCallback& importer, const StringExportCallback& exporter) = 0;
|
||||
};
|
||||
|
||||
#include "modulesystem.h"
|
||||
|
||||
template<typename Type>
|
||||
class GlobalModule;
|
||||
typedef GlobalModule<PreferenceSystem> GlobalPreferenceSystemModule;
|
||||
|
||||
template<typename Type>
|
||||
class GlobalModuleRef;
|
||||
typedef GlobalModuleRef<PreferenceSystem> GlobalPreferenceSystemModuleRef;
|
||||
|
||||
inline PreferenceSystem& GlobalPreferenceSystem()
|
||||
{
|
||||
return GlobalPreferenceSystemModule::getTable();
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
23
include/qerplugin.cpp
Normal file
23
include/qerplugin.cpp
Normal file
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
Copyright (C) 1999-2006 Id Software, Inc. and contributors.
|
||||
For a list of contributors, see the accompanying CONTRIBUTORS file.
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
#include "qerplugin.h"
|
||||
|
||||
145
include/qerplugin.h
Normal file
145
include/qerplugin.h
Normal file
@@ -0,0 +1,145 @@
|
||||
/*
|
||||
Copyright (C) 1999-2006 Id Software, Inc. and contributors.
|
||||
For a list of contributors, see the accompanying CONTRIBUTORS file.
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
// QERadiant PlugIns
|
||||
//
|
||||
//
|
||||
|
||||
#ifndef __QERPLUGIN_H__
|
||||
#define __QERPLUGIN_H__
|
||||
|
||||
#include "generic/constant.h"
|
||||
|
||||
|
||||
// ========================================
|
||||
// GTK+ helper functions
|
||||
|
||||
// NOTE: parent can be 0 in all functions but it's best to set them
|
||||
|
||||
// this API does not depend on gtk+ or glib
|
||||
typedef struct _GtkWidget GtkWidget;
|
||||
|
||||
enum EMessageBoxType
|
||||
{
|
||||
eMB_OK,
|
||||
eMB_OKCANCEL,
|
||||
eMB_YESNO,
|
||||
eMB_YESNOCANCEL,
|
||||
eMB_NOYES,
|
||||
};
|
||||
|
||||
enum EMessageBoxIcon
|
||||
{
|
||||
eMB_ICONDEFAULT,
|
||||
eMB_ICONERROR,
|
||||
eMB_ICONWARNING,
|
||||
eMB_ICONQUESTION,
|
||||
eMB_ICONASTERISK,
|
||||
};
|
||||
|
||||
enum EMessageBoxReturn
|
||||
{
|
||||
eIDOK,
|
||||
eIDCANCEL,
|
||||
eIDYES,
|
||||
eIDNO,
|
||||
};
|
||||
|
||||
// simple Message Box, see above for the 'type' flags
|
||||
|
||||
typedef EMessageBoxReturn (* PFN_QERAPP_MESSAGEBOX) (GtkWidget *parent, const char* text, const char* caption/* = "GtkRadiant"*/, EMessageBoxType type/* = eMB_OK*/, EMessageBoxIcon icon/* = eMB_ICONDEFAULT*/);
|
||||
|
||||
// file and directory selection functions return null if the user hits cancel
|
||||
// - 'title' is the dialog title (can be null)
|
||||
// - 'path' is used to set the initial directory (can be null)
|
||||
// - 'pattern': the first pattern is for the win32 mode, then comes the Gtk pattern list, see Radiant source for samples
|
||||
typedef const char* (* PFN_QERAPP_FILEDIALOG) (GtkWidget *parent, bool open, const char* title, const char* path/* = 0*/, const char* pattern/* = 0*/);
|
||||
|
||||
// returns a gchar* string that must be g_free'd by the user
|
||||
typedef char* (* PFN_QERAPP_DIRDIALOG) (GtkWidget *parent, const char* title/* = "Choose Directory"*/, const char* path/* = 0*/);
|
||||
|
||||
// return true if the user closed the dialog with 'Ok'
|
||||
// 'color' is used to set the initial value and store the selected value
|
||||
template<typename Element> class BasicVector3;
|
||||
typedef BasicVector3<float> Vector3;
|
||||
typedef bool (* PFN_QERAPP_COLORDIALOG) (GtkWidget *parent, Vector3& color,
|
||||
const char* title/* = "Choose Color"*/);
|
||||
|
||||
// load a .bmp file and create a GtkImage widget from it
|
||||
// NOTE: 'filename' is relative to <radiant_path>/plugins/bitmaps/
|
||||
typedef struct _GtkImage GtkImage;
|
||||
typedef GtkImage* (* PFN_QERAPP_NEWIMAGE) (const char* filename);
|
||||
|
||||
// ========================================
|
||||
|
||||
class ModuleObserver;
|
||||
|
||||
// the radiant core API
|
||||
struct _QERFuncTable_1
|
||||
{
|
||||
INTEGER_CONSTANT(Version, 1);
|
||||
STRING_CONSTANT(Name, "radiant");
|
||||
|
||||
const char* (*getEnginePath)();
|
||||
const char* (*getGameToolsPath)();
|
||||
const char* (*getAppPath)();
|
||||
const char* (*getSettingsPath)();
|
||||
|
||||
const char* (*getGameName)();
|
||||
const char* (*getGameMode)();
|
||||
|
||||
const char* (*getGameDescriptionKeyValue)(const char* key);
|
||||
const char* (*getRequiredGameDescriptionKeyValue)(const char* key);
|
||||
|
||||
void (*attachGameToolsPathObserver)(ModuleObserver& observer);
|
||||
void (*detachGameToolsPathObserver)(ModuleObserver& observer);
|
||||
void (*attachEnginePathObserver)(ModuleObserver& observer);
|
||||
void (*detachEnginePathObserver)(ModuleObserver& observer);
|
||||
void (*attachGameNameObserver)(ModuleObserver& observer);
|
||||
void (*detachGameNameObserver)(ModuleObserver& observer);
|
||||
void (*attachGameModeObserver)(ModuleObserver& observer);
|
||||
void (*detachGameModeObserver)(ModuleObserver& observer);
|
||||
|
||||
// GTK+ functions
|
||||
PFN_QERAPP_MESSAGEBOX m_pfnMessageBox;
|
||||
PFN_QERAPP_FILEDIALOG m_pfnFileDialog;
|
||||
PFN_QERAPP_DIRDIALOG m_pfnDirDialog;
|
||||
PFN_QERAPP_COLORDIALOG m_pfnColorDialog;
|
||||
PFN_QERAPP_NEWIMAGE m_pfnNewImage;
|
||||
|
||||
};
|
||||
|
||||
#include "modulesystem.h"
|
||||
|
||||
template<typename Type>
|
||||
class GlobalModule;
|
||||
typedef GlobalModule<_QERFuncTable_1> GlobalRadiantModule;
|
||||
|
||||
template<typename Type>
|
||||
class GlobalModuleRef;
|
||||
typedef GlobalModuleRef<_QERFuncTable_1> GlobalRadiantModuleRef;
|
||||
|
||||
inline _QERFuncTable_1& GlobalRadiant()
|
||||
{
|
||||
return GlobalRadiantModule::getTable();
|
||||
}
|
||||
|
||||
#endif
|
||||
23
include/renderable.cpp
Normal file
23
include/renderable.cpp
Normal file
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
Copyright (C) 2001-2006, William Joseph.
|
||||
All Rights Reserved.
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
#include "renderable.h"
|
||||
|
||||
76
include/renderable.h
Normal file
76
include/renderable.h
Normal file
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
Copyright (C) 2001-2006, William Joseph.
|
||||
All Rights Reserved.
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
#if !defined(INCLUDED_RENDERABLE_H)
|
||||
#define INCLUDED_RENDERABLE_H
|
||||
|
||||
#include "generic/constant.h"
|
||||
|
||||
class Shader;
|
||||
class OpenGLRenderable;
|
||||
class LightList;
|
||||
class Matrix4;
|
||||
|
||||
class Renderer
|
||||
{
|
||||
public:
|
||||
enum EHighlightMode
|
||||
{
|
||||
eFace = 1 << 0,
|
||||
/*! Full highlighting. */
|
||||
ePrimitive = 1 << 1,
|
||||
};
|
||||
|
||||
enum EStyle
|
||||
{
|
||||
eWireframeOnly,
|
||||
eFullMaterials,
|
||||
};
|
||||
|
||||
virtual void PushState() = 0;
|
||||
virtual void PopState() = 0;
|
||||
virtual void SetState(Shader* state, EStyle mode) = 0;
|
||||
virtual const EStyle getStyle() const = 0;
|
||||
virtual void Highlight(EHighlightMode mode, bool bEnable = true) = 0;
|
||||
virtual void setLights(const LightList& lights)
|
||||
{
|
||||
}
|
||||
virtual void addRenderable(const OpenGLRenderable& renderable, const Matrix4& world) = 0;
|
||||
};
|
||||
|
||||
class VolumeTest;
|
||||
|
||||
class Renderable
|
||||
{
|
||||
public:
|
||||
STRING_CONSTANT(Name, "Renderable");
|
||||
|
||||
virtual void renderSolid(Renderer& renderer, const VolumeTest& volume) const = 0;
|
||||
virtual void renderWireframe(Renderer& renderer, const VolumeTest& volume) const = 0;
|
||||
virtual void renderComponents(Renderer&, const VolumeTest&) const
|
||||
{
|
||||
}
|
||||
virtual void viewChanged() const
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
23
include/selectable.cpp
Normal file
23
include/selectable.cpp
Normal file
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
Copyright (C) 2001-2006, William Joseph.
|
||||
All Rights Reserved.
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
#include "selectable.h"
|
||||
|
||||
306
include/selectable.h
Normal file
306
include/selectable.h
Normal file
@@ -0,0 +1,306 @@
|
||||
/*
|
||||
Copyright (C) 2001-2006, William Joseph.
|
||||
All Rights Reserved.
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
#if !defined(INCLUDED_SELECTABLE_H)
|
||||
#define INCLUDED_SELECTABLE_H
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
#include "math/vector.h"
|
||||
#include "scenelib.h"
|
||||
|
||||
class SelectionIntersection
|
||||
{
|
||||
float m_depth;
|
||||
float m_distance;
|
||||
public:
|
||||
SelectionIntersection() : m_depth(1), m_distance(2)
|
||||
{
|
||||
}
|
||||
SelectionIntersection(float depth, float distance) : m_depth(depth), m_distance(distance)
|
||||
{
|
||||
}
|
||||
bool operator<(const SelectionIntersection& other) const
|
||||
{
|
||||
if(m_distance != other.m_distance)
|
||||
{
|
||||
return m_distance < other.m_distance;
|
||||
}
|
||||
if(m_depth != other.m_depth)
|
||||
{
|
||||
return m_depth < other.m_depth;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
bool equalEpsilon(const SelectionIntersection& other, float distanceEpsilon, float depthEpsilon) const
|
||||
{
|
||||
return float_equal_epsilon(m_distance, other.m_distance, distanceEpsilon)
|
||||
&& float_equal_epsilon(m_depth, other.m_depth, depthEpsilon);
|
||||
}
|
||||
float depth() const
|
||||
{
|
||||
return m_depth;
|
||||
}
|
||||
bool valid() const
|
||||
{
|
||||
return depth() < 1;
|
||||
}
|
||||
};
|
||||
|
||||
// returns true if self is closer than other
|
||||
inline bool SelectionIntersection_closer(const SelectionIntersection& self, const SelectionIntersection& other)
|
||||
{
|
||||
return self < other;
|
||||
}
|
||||
|
||||
// assigns other to best if other is closer than best
|
||||
inline void assign_if_closer(SelectionIntersection& best, const SelectionIntersection& other)
|
||||
{
|
||||
if(SelectionIntersection_closer(other, best))
|
||||
{
|
||||
best = other;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
class VertexPointer
|
||||
{
|
||||
typedef const unsigned char* byte_pointer;
|
||||
public:
|
||||
typedef float elem_type;
|
||||
typedef const elem_type* pointer;
|
||||
typedef const elem_type& reference;
|
||||
|
||||
class iterator
|
||||
{
|
||||
public:
|
||||
iterator() {}
|
||||
iterator(byte_pointer vertices, std::size_t stride)
|
||||
: m_iter(vertices), m_stride(stride) {}
|
||||
|
||||
bool operator==(const iterator& other) const
|
||||
{
|
||||
return m_iter == other.m_iter;
|
||||
}
|
||||
bool operator!=(const iterator& other) const
|
||||
{
|
||||
return !operator==(other);
|
||||
}
|
||||
|
||||
iterator operator+(std::size_t i)
|
||||
{
|
||||
return iterator(m_iter + i * m_stride, m_stride);
|
||||
}
|
||||
iterator operator+=(std::size_t i)
|
||||
{
|
||||
m_iter += i * m_stride;
|
||||
return *this;
|
||||
}
|
||||
iterator& operator++()
|
||||
{
|
||||
m_iter += m_stride;
|
||||
return *this;
|
||||
}
|
||||
iterator operator++(int)
|
||||
{
|
||||
iterator tmp = *this;
|
||||
m_iter += m_stride;
|
||||
return tmp;
|
||||
}
|
||||
reference operator*() const
|
||||
{
|
||||
return *reinterpret_cast<pointer>(m_iter);
|
||||
}
|
||||
private:
|
||||
byte_pointer m_iter;
|
||||
std::size_t m_stride;
|
||||
};
|
||||
|
||||
VertexPointer(pointer vertices, std::size_t stride)
|
||||
: m_vertices(reinterpret_cast<byte_pointer>(vertices)), m_stride(stride) {}
|
||||
|
||||
iterator begin() const
|
||||
{
|
||||
return iterator(m_vertices, m_stride);
|
||||
}
|
||||
|
||||
reference operator[](std::size_t i) const
|
||||
{
|
||||
return *reinterpret_cast<pointer>(m_vertices + m_stride*i);
|
||||
}
|
||||
|
||||
private:
|
||||
byte_pointer m_vertices;
|
||||
std::size_t m_stride;
|
||||
};
|
||||
|
||||
class IndexPointer
|
||||
{
|
||||
public:
|
||||
typedef unsigned int index_type;
|
||||
typedef const index_type* pointer;
|
||||
|
||||
class iterator
|
||||
{
|
||||
public:
|
||||
iterator(pointer iter) : m_iter(iter) {}
|
||||
|
||||
bool operator==(const iterator& other) const
|
||||
{
|
||||
return m_iter == other.m_iter;
|
||||
}
|
||||
bool operator!=(const iterator& other) const
|
||||
{
|
||||
return !operator==(other);
|
||||
}
|
||||
|
||||
iterator operator+(std::size_t i)
|
||||
{
|
||||
return m_iter + i;
|
||||
}
|
||||
iterator operator+=(std::size_t i)
|
||||
{
|
||||
return m_iter += i;
|
||||
}
|
||||
iterator operator++()
|
||||
{
|
||||
return ++m_iter;
|
||||
}
|
||||
iterator operator++(int)
|
||||
{
|
||||
return m_iter++;
|
||||
}
|
||||
const index_type& operator*() const
|
||||
{
|
||||
return *m_iter;
|
||||
}
|
||||
private:
|
||||
void increment()
|
||||
{
|
||||
++m_iter;
|
||||
}
|
||||
pointer m_iter;
|
||||
};
|
||||
|
||||
IndexPointer(pointer indices, std::size_t count)
|
||||
: m_indices(indices), m_finish(indices + count) {}
|
||||
|
||||
iterator begin() const
|
||||
{
|
||||
return m_indices;
|
||||
}
|
||||
iterator end() const
|
||||
{
|
||||
return m_finish;
|
||||
}
|
||||
|
||||
private:
|
||||
pointer m_indices;
|
||||
pointer m_finish;
|
||||
};
|
||||
|
||||
template<typename Element> class BasicVector3;
|
||||
typedef BasicVector3<float> Vector3;
|
||||
class Matrix4;
|
||||
class VolumeTest;
|
||||
|
||||
class SelectionTest
|
||||
{
|
||||
public:
|
||||
virtual void BeginMesh(const Matrix4& localToWorld, bool twoSided = false) = 0;
|
||||
virtual const VolumeTest& getVolume() const = 0;
|
||||
virtual const Vector3& getNear() const = 0;
|
||||
virtual const Vector3& getFar() const = 0;
|
||||
virtual void TestPoint(const Vector3& point, SelectionIntersection& best) = 0;
|
||||
virtual void TestPolygon(const VertexPointer& vertices, std::size_t count, SelectionIntersection& best) = 0;
|
||||
virtual void TestLineLoop(const VertexPointer& vertices, std::size_t count, SelectionIntersection& best) = 0;
|
||||
virtual void TestLineStrip(const VertexPointer& vertices, std::size_t count, SelectionIntersection& best) = 0;
|
||||
virtual void TestLines(const VertexPointer& vertices, std::size_t count, SelectionIntersection& best) = 0;
|
||||
virtual void TestTriangles(const VertexPointer& vertices, const IndexPointer& indices, SelectionIntersection& best) = 0;
|
||||
virtual void TestQuads(const VertexPointer& vertices, const IndexPointer& indices, SelectionIntersection& best) = 0;
|
||||
virtual void TestQuadStrip(const VertexPointer& vertices, const IndexPointer& indices, SelectionIntersection& best) = 0;
|
||||
};
|
||||
|
||||
class Selectable;
|
||||
|
||||
class Selector
|
||||
{
|
||||
public:
|
||||
virtual void pushSelectable(Selectable& selectable) = 0;
|
||||
virtual void popSelectable() = 0;
|
||||
virtual void addIntersection(const SelectionIntersection& intersection) = 0;
|
||||
};
|
||||
|
||||
inline void Selector_add(Selector& selector, Selectable& selectable)
|
||||
{
|
||||
selector.pushSelectable(selectable);
|
||||
selector.addIntersection(SelectionIntersection(0, 0));
|
||||
selector.popSelectable();
|
||||
}
|
||||
|
||||
inline void Selector_add(Selector& selector, Selectable& selectable, const SelectionIntersection& intersection)
|
||||
{
|
||||
selector.pushSelectable(selectable);
|
||||
selector.addIntersection(intersection);
|
||||
selector.popSelectable();
|
||||
}
|
||||
|
||||
|
||||
class VolumeTest;
|
||||
class SelectionTestable
|
||||
{
|
||||
public:
|
||||
STRING_CONSTANT(Name, "SelectionTestable");
|
||||
|
||||
virtual void testSelect(Selector& selector, SelectionTest& test) = 0;
|
||||
};
|
||||
|
||||
inline SelectionTestable* Instance_getSelectionTestable(scene::Instance& instance)
|
||||
{
|
||||
return InstanceTypeCast<SelectionTestable>::cast(instance);
|
||||
}
|
||||
|
||||
|
||||
template<typename FirstArgument>
|
||||
class Callback1;
|
||||
class Plane3;
|
||||
typedef Callback1<const Plane3&> PlaneCallback;
|
||||
|
||||
class SelectedPlanes
|
||||
{
|
||||
public:
|
||||
virtual bool contains(const Plane3& plane) const = 0;
|
||||
};
|
||||
|
||||
class PlaneSelectable
|
||||
{
|
||||
public:
|
||||
STRING_CONSTANT(Name, "PlaneSelectable");
|
||||
|
||||
virtual void selectPlanes(Selector& selector, SelectionTest& test, const PlaneCallback& selectedPlaneCallback) = 0;
|
||||
virtual void selectReversedPlanes(Selector& selector, const SelectedPlanes& selectedPlanes) = 0;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
3
include/stream_version.h
Normal file
3
include/stream_version.h
Normal file
@@ -0,0 +1,3 @@
|
||||
// version defines for q3map stream
|
||||
#define Q3MAP_STREAM_VERSION "1"
|
||||
|
||||
1
include/version.default
Normal file
1
include/version.default
Normal file
@@ -0,0 +1 @@
|
||||
1.5.0
|
||||
31
include/warnings.h
Normal file
31
include/warnings.h
Normal file
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
Copyright (C) 2001-2006, William Joseph.
|
||||
All Rights Reserved.
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
#if !defined (INCLUDED_WARNINGS_H)
|
||||
#define INCLUDED_WARNINGS_H
|
||||
|
||||
#if _MSC_VER > 1000 && defined(WIN32)
|
||||
#pragma warning(disable:4355) // 'this' : used in base member initializer list
|
||||
#pragma warning(disable:4503) // '[symbol]' : decorated name length exceeded, name was truncated
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
23
include/windowobserver.cpp
Normal file
23
include/windowobserver.cpp
Normal file
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
Copyright (C) 2001-2006, William Joseph.
|
||||
All Rights Reserved.
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
#include "windowobserver.h"
|
||||
|
||||
91
include/windowobserver.h
Normal file
91
include/windowobserver.h
Normal file
@@ -0,0 +1,91 @@
|
||||
/*
|
||||
Copyright (C) 2001-2006, William Joseph.
|
||||
All Rights Reserved.
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
#if !defined(INCLUDED_WINDOWOBSERVER_H)
|
||||
#define INCLUDED_WINDOWOBSERVER_H
|
||||
|
||||
template<typename Enumeration> class BitFieldValue;
|
||||
struct ModifierEnumeration;
|
||||
typedef BitFieldValue<ModifierEnumeration> ModifierFlags;
|
||||
|
||||
template<typename Enumeration> class EnumeratedValue;
|
||||
struct ButtonEnumeration;
|
||||
typedef EnumeratedValue<ButtonEnumeration> ButtonIdentifier;
|
||||
|
||||
|
||||
#include "generic/bitfield.h"
|
||||
|
||||
struct ModifierEnumeration
|
||||
{
|
||||
enum Value
|
||||
{
|
||||
SHIFT = 0,
|
||||
CONTROL = 1,
|
||||
ALT = 2
|
||||
};
|
||||
};
|
||||
|
||||
typedef BitFieldValue<ModifierEnumeration> ModifierFlags;
|
||||
|
||||
const ModifierFlags c_modifierNone;
|
||||
const ModifierFlags c_modifierShift(ModifierEnumeration::SHIFT);
|
||||
const ModifierFlags c_modifierControl(ModifierEnumeration::CONTROL);
|
||||
const ModifierFlags c_modifierAlt(ModifierEnumeration::ALT);
|
||||
|
||||
#include "generic/enumeration.h"
|
||||
|
||||
struct ButtonEnumeration
|
||||
{
|
||||
enum Value
|
||||
{
|
||||
INVALID = 0,
|
||||
LEFT = 1,
|
||||
MIDDLE = 3,
|
||||
RIGHT = 2
|
||||
};
|
||||
};
|
||||
|
||||
typedef EnumeratedValue<ButtonEnumeration> ButtonIdentifier;
|
||||
|
||||
const ButtonIdentifier c_buttonInvalid(ButtonEnumeration::INVALID);
|
||||
const ButtonIdentifier c_buttonLeft(ButtonEnumeration::LEFT);
|
||||
const ButtonIdentifier c_buttonMiddle(ButtonEnumeration::MIDDLE);
|
||||
const ButtonIdentifier c_buttonRight(ButtonEnumeration::RIGHT);
|
||||
|
||||
|
||||
template<typename Element>
|
||||
class BasicVector2;
|
||||
typedef BasicVector2<float> Vector2;
|
||||
typedef Vector2 WindowVector;
|
||||
|
||||
class WindowObserver
|
||||
{
|
||||
public:
|
||||
virtual void release() = 0;
|
||||
virtual void onSizeChanged(int width, int height) = 0;
|
||||
virtual void onMouseDown(const WindowVector& position, ButtonIdentifier button, ModifierFlags modifiers) = 0;
|
||||
virtual void onMouseUp(const WindowVector& position, ButtonIdentifier button, ModifierFlags modifiers) = 0;
|
||||
virtual void onMouseMotion(const WindowVector& position, ModifierFlags modifiers) = 0;
|
||||
virtual void onModifierDown(ModifierFlags modifier) = 0;
|
||||
virtual void onModifierUp(ModifierFlags modifier) = 0;
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user