]> de.git.xonotic.org Git - xonotic/netradiant.git/blob - plugins/shaders/plugin.cpp
some updates to the Linux build system - obtained a core binary and all required...
[xonotic/netradiant.git] / plugins / shaders / plugin.cpp
1 /*\r
2 Copyright (c) 2001, Loki software, inc.\r
3 All rights reserved.\r
4 \r
5 Redistribution and use in source and binary forms, with or without modification, \r
6 are permitted provided that the following conditions are met:\r
7 \r
8 Redistributions of source code must retain the above copyright notice, this list \r
9 of conditions and the following disclaimer.\r
10 \r
11 Redistributions in binary form must reproduce the above copyright notice, this\r
12 list of conditions and the following disclaimer in the documentation and/or\r
13 other materials provided with the distribution.\r
14 \r
15 Neither the name of Loki software nor the names of its contributors may be used \r
16 to endorse or promote products derived from this software without specific prior \r
17 written permission. \r
18 \r
19 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' \r
20 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE \r
21 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE \r
22 DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY \r
23 DIRECT,INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES \r
24 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; \r
25 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON \r
26 ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT \r
27 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS \r
28 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \r
29 */\r
30 \r
31 //\r
32 // Shaders Plugin\r
33 //\r
34 \r
35 #include "plugin.h"\r
36 \r
37 // =============================================================================\r
38 // Globals\r
39 \r
40 // function tables\r
41 _QERFuncTable_1 g_FuncTable;\r
42 _QERAppDataTable g_DataTable;\r
43 _QERQglTable g_QglTable;\r
44 _QERAppShadersTable g_ShadersTable;\r
45 _QERFileSystemTable g_VFSTable;\r
46 _QERScripLibTable g_ScripLibTable;\r
47 _QERBrushTable g_BrushTable;\r
48 \r
49 static bool g_bInterfaceInitDone = false;\r
50 \r
51 // =============================================================================\r
52 // SYNAPSE\r
53 \r
54 CSynapseServer* g_pSynapseServer = NULL;\r
55 CSynapseClientShaders g_SynapseClient;\r
56 \r
57 static const XMLConfigEntry_t entries[] = \r
58   { \r
59     { SHADERS_MAJOR, SYN_PROVIDE, sizeof(_QERShadersTable), NULL },\r
60     { VFS_MAJOR, SYN_REQUIRE, sizeof(g_VFSTable), &g_VFSTable },\r
61     { NULL, SYN_UNKNOWN, 0, NULL } };\r
62 \r
63 #if __GNUC__ >= 4\r
64 #pragma GCC visibility push(default)\r
65 #endif\r
66 extern "C" CSynapseClient* SYNAPSE_DLL_EXPORT Synapse_EnumerateInterfaces( const char *version, CSynapseServer *pServer ) {\r
67 #if __GNUC__ >= 4\r
68 #pragma GCC visibility pop\r
69 #endif\r
70   if (strcmp(version, SYNAPSE_VERSION))\r
71   {\r
72     Syn_Printf("ERROR: synapse API version mismatch: should be '" SYNAPSE_VERSION "', got '%s'\n", version);\r
73     return NULL;\r
74   }\r
75   g_pSynapseServer = pServer;\r
76   g_pSynapseServer->IncRef();\r
77   Set_Syn_Printf(g_pSynapseServer->Get_Syn_Printf());\r
78   \r
79   if ( !g_SynapseClient.ConfigXML( pServer, NULL, entries ) ) {\r
80     return NULL;\r
81   }\r
82   \r
83   g_SynapseClient.AddAPI(RADIANT_MAJOR, NULL, sizeof(_QERFuncTable_1), SYN_REQUIRE, &g_FuncTable);\r
84   g_SynapseClient.AddAPI(DATA_MAJOR, NULL, sizeof(_QERAppDataTable), SYN_REQUIRE, &g_DataTable);\r
85   g_SynapseClient.AddAPI(QGL_MAJOR, NULL, sizeof(_QERQglTable), SYN_REQUIRE, &g_QglTable);\r
86   g_SynapseClient.AddAPI(APPSHADERS_MAJOR, NULL, sizeof(_QERAppShadersTable), SYN_REQUIRE, &g_ShadersTable);\r
87   g_SynapseClient.AddAPI(SCRIPLIB_MAJOR, NULL, sizeof(_QERScripLibTable), SYN_REQUIRE, &g_ScripLibTable);\r
88   g_SynapseClient.AddAPI(BRUSH_MAJOR, NULL, sizeof(_QERBrushTable), SYN_REQUIRE, &g_BrushTable);\r
89 \r
90   return &g_SynapseClient;\r
91 }\r
92 \r
93 #include "version.h"\r
94 \r
95 const char* CSynapseClientShaders::GetInfo()\r
96 {\r
97   return "Q3/Half-Life shaders module built " __DATE__ " " RADIANT_VERSION;\r
98 }\r
99 \r
100 const char* CSynapseClientShaders::GetName()\r
101 {\r
102   return "shaders";\r
103 }\r