]> git.xonotic.org Git - xonotic/netradiant.git/blobdiff - contrib/bobtoolz/DPatch.h
Merge branch 'NateEag-master-patch-12920' into 'master'
[xonotic/netradiant.git] / contrib / bobtoolz / DPatch.h
index d04121ea9731062588732fc8fa4e84c5dcad5fd0..4d0c26c5718acdad9708811fe1ca654e4dce3a34 100644 (file)
@@ -1,62 +1,81 @@
-/*\r
-BobToolz plugin for GtkRadiant\r
-Copyright (C) 2001 Gordon Biggans\r
-\r
-This library is free software; you can redistribute it and/or\r
-modify it under the terms of the GNU Lesser General Public\r
-License as published by the Free Software Foundation; either\r
-version 2.1 of the License, or (at your option) any later version.\r
-\r
-This library is distributed in the hope that it will be useful,\r
-but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\r
-Lesser General Public License for more details.\r
-\r
-You should have received a copy of the GNU Lesser General Public\r
-License along with this library; if not, write to the Free Software\r
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
-*/\r
-\r
-// DPatch.h: interface for the DPatch class.\r
-//\r
-//////////////////////////////////////////////////////////////////////\r
-\r
-#if !defined(AFX_DPATCH_H__26C6B083_CE5B_420B_836B_1DDA733C04CE__INCLUDED_)\r
-#define AFX_DPATCH_H__26C6B083_CE5B_420B_836B_1DDA733C04CE__INCLUDED_\r
-\r
-#include "StdAfx.h"    // Added by ClassView\r
-#if _MSC_VER > 1000\r
-#pragma once\r
-#endif // _MSC_VER > 1000\r
-\r
-typedef struct\r
-{      \r
-       bool mergable;\r
-       int pos1;\r
-       int pos2;\r
-} patch_merge_t;\r
-\r
-class DPatch  \r
-{\r
-public:\r
-       list<DPatch> Split(bool rows, bool cols);\r
-       void Transpose();\r
-       void Invert();\r
-       DPatch* MergePatches(patch_merge_t merge_info, DPatch* p1, DPatch* p2);\r
-       patch_merge_t IsMergable(DPatch* other);\r
-  bool ResetTextures(const char *oldTextureName, const char *newTextureName);\r
-       void RemoveFromRadiant(void);\r
-       brush_t* QER_brush;\r
-       void LoadFromBrush_t(brush_t* brush);\r
-       patchMesh_t* QER_patch;\r
-       void BuildInRadiant(void* entity = NULL);\r
-       void SetTexture(const char* textureName);\r
-       char texture[256];\r
-       int width, height;\r
-       drawVert_t points[MAX_PATCH_WIDTH][MAX_PATCH_HEIGHT];\r
-       DPatch();\r
-       virtual ~DPatch();\r
-\r
-};\r
-\r
-#endif // !defined(AFX_DPATCH_H__26C6B083_CE5B_420B_836B_1DDA733C04CE__INCLUDED_)\r
+/*
+   BobToolz plugin for GtkRadiant
+   Copyright (C) 2001 Gordon Biggans
+
+   This library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   This library 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with this library; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+// DPatch.h: interface for the DPatch class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#if !defined( AFX_DPATCH_H__26C6B083_CE5B_420B_836B_1DDA733C04CE__INCLUDED_ )
+#define AFX_DPATCH_H__26C6B083_CE5B_420B_836B_1DDA733C04CE__INCLUDED_
+
+#include <list>
+#include <stdlib.h>
+
+typedef struct
+{
+       bool mergable;
+       int pos1;
+       int pos2;
+} patch_merge_t;
+
+typedef struct {
+       float xyz[3];
+       float st[2];
+       float normal[3];
+       float lightmap[2];
+} drawVert_t;
+
+namespace scene
+{
+class Node;
+class Instance;
+}
+
+const int MAX_PATCH_WIDTH = 32;
+const int MAX_PATCH_HEIGHT = 32;
+const int MIN_PATCH_WIDTH = 3;
+const int MIN_PATCH_HEIGHT = 3;
+
+class DPatch
+{
+public:
+std::list<DPatch> SplitRows();
+std::list<DPatch> SplitCols();
+std::list<DPatch> Split();
+void Transpose();
+//DPatch* TransposePatch(DPatch* p1);
+//void DebugPrint();
+void Invert();
+DPatch* MergePatches( patch_merge_t merge_info, DPatch* p1, DPatch* p2 );
+patch_merge_t IsMergable( DPatch* other );
+bool ResetTextures( const char *oldTextureName, const char *newTextureName );
+scene::Node* QER_entity;
+scene::Node* QER_brush;
+void LoadFromPatch( scene::Instance& patch );
+void BuildInRadiant( scene::Node* entity = NULL );
+void SetTexture( const char* textureName );
+char texture[256];
+int width, height;
+drawVert_t points[MAX_PATCH_WIDTH][MAX_PATCH_HEIGHT];
+DPatch();
+virtual ~DPatch();
+
+};
+
+#endif // !defined(AFX_DPATCH_H__26C6B083_CE5B_420B_836B_1DDA733C04CE__INCLUDED_)