├── .editorconfig ├── .gitignore ├── CMakeLists.txt ├── README.md ├── bin ├── MacOSX │ └── oscer └── Windows64 │ └── oscer.exe ├── derivative ├── CHOP_CPlusPlusBase.h ├── CPlusPlus_Common.h ├── DAT_CPlusPlusBase.h ├── FrameQueue.cpp ├── FrameQueue.h ├── GL │ ├── LICENSE.txt │ ├── glew.c │ ├── glew.h │ ├── glewinfo.c │ └── wglew.h ├── GL_Extensions.h ├── SOP_CPlusPlusBase.h └── TOP_CPlusPlusBase.h ├── out ├── HotReloadClient.tox └── test.toe └── src ├── CHOP_main.cpp ├── DAT_main.cpp ├── SOP_main.cpp └── TOP_main.cpp /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [CMakeLists.txt] 4 | indent_size = 4 5 | indent_style = space 6 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .vs 2 | .vscode 3 | out 4 | CMakeSettings.json 5 | build 6 | 7 | libs 8 | src/aruco 9 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8) 2 | 3 | set(TOUCHDESIGNER_EXE "C:/Program Files/Derivative/TouchDesigner/bin/TouchDesigner.exe" CACHE FILEPATH "TouchDesigner.exe Path") 4 | 5 | ### 6 | 7 | project(CustomOps) 8 | 9 | include_directories( 10 | ${CMAKE_CURRENT_SOURCE_DIR}/src 11 | ${CMAKE_CURRENT_SOURCE_DIR}/derivative 12 | ${CMAKE_CURRENT_SOURCE_DIR}/derivative/GL 13 | ${CMAKE_CURRENT_SOURCE_DIR}/libs/include 14 | ) 15 | 16 | link_directories( 17 | ${CMAKE_CURRENT_SOURCE_DIR}/libs/lib 18 | ) 19 | 20 | file(GLOB DEP_SRC 21 | ${CMAKE_CURRENT_SOURCE_DIR}/derivative/GL/*.c 22 | ${CMAKE_CURRENT_SOURCE_DIR}/derivative/*.cpp 23 | ) 24 | 25 | ### 26 | 27 | if (APPLE) 28 | set(CMAKE_CXX_STANDARD 11) 29 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -stdlib=libc++") 30 | endif() 31 | 32 | set(OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/out) 33 | 34 | set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${OUTPUT_DIRECTORY}) 35 | set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG ${OUTPUT_DIRECTORY}) 36 | set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_MINSIZEREL ${OUTPUT_DIRECTORY}) 37 | set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELWITHDEBINFO ${OUTPUT_DIRECTORY}) 38 | set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE ${OUTPUT_DIRECTORY}) 39 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${OUTPUT_DIRECTORY}) 40 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${OUTPUT_DIRECTORY}) 41 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL ${OUTPUT_DIRECTORY}) 42 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO ${OUTPUT_DIRECTORY}) 43 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${OUTPUT_DIRECTORY}) 44 | 45 | ### 46 | 47 | function(BuiltCustomOp OPNAME SRC LINK_LIBRARIES) 48 | 49 | add_library(${OPNAME} MODULE ${SRC} ${DEP_SRC}) 50 | 51 | set_target_properties(${OPNAME} PROPERTIES LINKER_LANGUAGE CXX) 52 | set_target_properties(${OPNAME} PROPERTIES PREFIX "") 53 | set_target_properties(${OPNAME} PROPERTIES BUNDLE TRUE) 54 | 55 | find_package(OpenGL REQUIRED) 56 | target_link_libraries(${OPNAME} ${OPENGL_LIBRARY} ${LINK_LIBRARIES}) 57 | 58 | set(OPTEST ${OPNAME}_TEST) 59 | add_custom_target(${OPTEST}) 60 | 61 | set_target_properties(${OPTEST} PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/out) 62 | set_target_properties(${OPTEST} PROPERTIES VS_DEBUGGER_COMMAND ${TOUCHDESIGNER_EXE}) 63 | set_target_properties(${OPTEST} PROPERTIES VS_DEBUGGER_ENVIRONMENT "TOUCH_TEXT_CONSOLE=1") 64 | set_target_properties(${OPTEST} PROPERTIES VS_DEBUGGER_COMMAND_ARGUMENTS "test.toe") 65 | 66 | ### hot-reloading using OSC message (`oscer` https://github.com/aike/oscer) 67 | 68 | if (APPLE) 69 | set(OSCER "${CMAKE_CURRENT_SOURCE_DIR}/bin/MacOSX/oscer") 70 | elseif(WIN32) 71 | set(OSCER "${CMAKE_CURRENT_SOURCE_DIR}/bin/Windows64/oscer.exe") 72 | endif() 73 | 74 | add_custom_command(TARGET ${OPTEST} PRE_BUILD COMMAND ${OSCER} ARGS localhost 23423 /unload) 75 | add_custom_command(TARGET ${OPTEST} POST_BUILD COMMAND ${OSCER} ARGS localhost 23423 /load) 76 | 77 | endfunction(BuiltCustomOp) 78 | 79 | ### 80 | 81 | BuiltCustomOp(CustomCHOP "src/CHOP_main.cpp" "") 82 | BuiltCustomOp(CustomSOP "src/SOP_main.cpp" "") 83 | BuiltCustomOp(CustomTOP "src/TOP_main.cpp" "") 84 | BuiltCustomOp(CustomDAT "src/DAT_main.cpp" "") -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ### Youtube Link 2 | 3 | - [How to use TouchDesigner-Plugin-Template on Windows](https://www.youtube.com/watch?v=t_KHXpAErsA) 4 | - [How to use TouchDesigner-Plugin-Template on OSX](https://www.youtube.com/watch?v=_iOq9BpKSE8) 5 | 6 | ### 1. Change CMakeLists.txt as you need 7 | 8 | ```cmake 9 | BuiltCustomOp(CustomCHOP "src/CHOP_main.cpp" "") 10 | BuiltCustomOp(CustomSOP "src/SOP_main.cpp" "") 11 | BuiltCustomOp(CustomTOP "src/TOP_main.cpp" "") 12 | ``` 13 | 14 | ### 2. Open Project in Visual Studio 2017 or later 15 | 16 | 1. Launch Visual Studio 2019 17 | 2. `File` > `Open` > `CMake` and select `CMakeFiles.txt` 18 | 19 | ### 3. Write your own CPlusPlus Module :) 20 | 21 | Update `src/XOP_main.cpp` 22 | -------------------------------------------------------------------------------- /bin/MacOSX/oscer: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/satoruhiga/TouchDesigner-Plugin-Template/8b64eeb87c25ae27f9185b93f9f327fc9fa761db/bin/MacOSX/oscer -------------------------------------------------------------------------------- /bin/Windows64/oscer.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/satoruhiga/TouchDesigner-Plugin-Template/8b64eeb87c25ae27f9185b93f9f327fc9fa761db/bin/Windows64/oscer.exe -------------------------------------------------------------------------------- /derivative/CHOP_CPlusPlusBase.h: -------------------------------------------------------------------------------- 1 | /* Shared Use License: This file is owned by Derivative Inc. (Derivative) 2 | * and can only be used, and/or modified for use, in conjunction with 3 | * Derivative's TouchDesigner software, and only if you are a licensee who has 4 | * accepted Derivative's TouchDesigner license or assignment agreement 5 | * (which also govern the use of this file). You may share or redistribute 6 | * a modified version of this file provided the following conditions are met: 7 | * 8 | * 1. The shared file or redistribution must retain the information set out 9 | * above and this list of conditions. 10 | * 2. Derivative's name (Derivative Inc.) or its trademarks may not be used 11 | * to endorse or promote products derived from this file without specific 12 | * prior written permission from Derivative. 13 | */ 14 | 15 | /* 16 | * Produced by: 17 | * 18 | * Derivative Inc 19 | * 401 Richmond Street West, Unit 386 20 | * Toronto, Ontario 21 | * Canada M5V 3A8 22 | * 416-591-3555 23 | * 24 | * NAME: CHOP_CPlusPlusBase.h 25 | * 26 | * 27 | * Do not edit this file directly! 28 | * Make a subclass of CHOP_CPlusPlusBase instead, and add your own 29 | * data/functions. 30 | 31 | * Derivative Developers:: Make sure the virtual function order 32 | * stays the same, otherwise changes won't be backwards compatible 33 | */ 34 | 35 | #ifndef __CHOP_CPlusPlusBase__ 36 | #define __CHOP_CPlusPlusBase__ 37 | 38 | #include "CPlusPlus_Common.h" 39 | 40 | namespace TD 41 | { 42 | #pragma pack(push, 8) 43 | 44 | class CHOP_CPlusPlusBase; 45 | 46 | // Define for the current API version that this sample code is made for. 47 | // To upgrade to a newer version, replace the files 48 | // CHOP_CPlusPlusBase.h 49 | // CPlusPlus_Common.h 50 | // from the samples folder in a newer TouchDesigner installation. 51 | // You may need to upgrade your plugin code in that case, to match 52 | // the new API requirements 53 | const int CHOPCPlusPlusAPIVersion = 9; 54 | 55 | class CHOP_PluginInfo 56 | { 57 | public: 58 | // Must be set to CHOPCPlusPlusAPIVersion in FillCHOPPluginInfo 59 | int32_t apiVersion = 0; 60 | 61 | int32_t reserved[100]; 62 | 63 | // Information used to describe this plugin as a custom OP. 64 | OP_CustomOPInfo customOPInfo; 65 | 66 | int32_t reserved2[20]; 67 | }; 68 | 69 | class CHOP_GeneralInfo 70 | { 71 | public: 72 | // Set this to true if you want the CHOP to cook every frame, even 73 | // if none of it's inputs/parameters are changing. 74 | // This is generally useful for cases where the node is outputting to 75 | // something external to TouchDesigner, such as a network socket or device. 76 | // It ensures the node cooks every if nothing inside the network is using/viewing 77 | // the output of this node. 78 | // Important: 79 | // If the node may not be viewed/used by other nodes in the file, 80 | // such as a TCP network output node that isn't viewed in perform mode, 81 | // you should set cookOnStart = true in OP_CustomOPInfo. 82 | // That will ensure cooking is kick-started for this node. 83 | // Note that this fix only works for Custom Operators, not 84 | // cases where the .dll is loaded into CPlusPlus CHOP. 85 | // DEFAULT: false 86 | bool cookEveryFrame; 87 | 88 | // Set this to true if you want the CHOP to cook every frame, but only 89 | // if someone asks for it to cook. So if nobody is using the output from 90 | // the CHOP, it won't cook. This is different from 'cookEveryFrame' 91 | // since that will cause it to cook every frame no matter what. 92 | // DEFAULT: false 93 | bool cookEveryFrameIfAsked; 94 | 95 | // Set this to true if you will be outputting a timeslice 96 | // Outputting a timeslice means the number of samples in the CHOP will 97 | // be determined by the number of frames that have elapsed since the last 98 | // time TouchDesigner cooked (it will be more than one in cases where it's 99 | // running slower than the target cook rate), the playbar framerate and 100 | // the sample rate of the CHOP. 101 | // For example if you are outputting the CHOP 120hz sample rate, 102 | // TouchDesigner is running at 60 hz cookrate, and you missed a frame last cook 103 | // then on this cook the number of sampels of the output of this CHOP will 104 | // be 4 samples. I.e (120 / 60) * number of playbar frames to output. 105 | // If this isn't set then you specify the number of sample in the CHOP using 106 | // the getOutputInfo() function 107 | // DEFAULT: false 108 | bool timeslice; 109 | 110 | // If you are returning 'false' from getOutputInfo, this index will 111 | // specify the CHOP input whos attribues you will match 112 | // (channel names, length, sample rate etc.) 113 | // DEFAULT : 0 114 | int32_t inputMatchIndex; 115 | 116 | int32_t reserved[20]; 117 | }; 118 | 119 | class CHOP_OutputInfo 120 | { 121 | public: 122 | // The number of channels you want to output 123 | int32_t numChannels; 124 | 125 | // If you arn't outputting a timeslice, specify the number of samples here 126 | int32_t numSamples; 127 | 128 | // if you arn't outputting a timeslice, specify the start index 129 | // of the channels here. This is the 'Start' you see when you 130 | // middle click on a CHOP 131 | uint32_t startIndex; 132 | 133 | // Specify the sample rate of the channel data 134 | // DEFAULT : whatever the timeline FPS is ($FPS) 135 | float sampleRate; 136 | 137 | void* reserved1; 138 | int32_t reserved[20]; 139 | }; 140 | 141 | class CHOP_Output 142 | { 143 | public: 144 | CHOP_Output(int32_t nc, int32_t l, float s, uint32_t st, 145 | float **cs, const char** ns): 146 | numChannels(nc), 147 | numSamples(l), 148 | sampleRate(s), 149 | startIndex(st), 150 | channels(cs), 151 | names(ns) 152 | { 153 | } 154 | 155 | // Info about what you are expected to output 156 | const int32_t numChannels; 157 | const int32_t numSamples; 158 | const float sampleRate; 159 | const uint32_t startIndex; 160 | 161 | // This is an array of const char* that tells you the channel names 162 | // of the channels you are providing values for. It's 'numChannels' long. 163 | // E.g names[3] is the name of the 4th channel 164 | const char** const names; 165 | 166 | // This is an array of float arrays that is already allocated for you. 167 | // Fill it with the data you want outputted for this CHOP. 168 | // The length of the array is 'numChannels', 169 | // While the length of each of the array entries is 'numSamples'. 170 | // For example channels[1][10] will point to the 11th sample in the 2nd 171 | // channel 172 | float** const channels; 173 | 174 | int32_t reserved[20]; 175 | }; 176 | 177 | /***** FUNCTION CALL ORDER DURING INITIALIZATION ******/ 178 | /* 179 | When the TOP loads the dll the functions will be called in this order 180 | 181 | setupParameters(OP_ParameterManager* m); 182 | 183 | */ 184 | 185 | /***** FUNCTION CALL ORDER DURING A COOK ******/ 186 | /* 187 | 188 | When the CHOP cooks the functions will be called in this order 189 | 190 | getGeneralInfo() 191 | getOutputInfo() 192 | if getOutputInfo() returns true 193 | { 194 | getChannelName() once for each channel needed 195 | } 196 | execute() 197 | getNumInfoCHOPChans() 198 | for the number of chans returned getNumInfoCHOPChans() 199 | { 200 | getInfoCHOPChan() 201 | } 202 | getInfoDATSize() 203 | for the number of rows/cols returned by getInfoDATSize() 204 | { 205 | getInfoDATEntries() 206 | } 207 | getInfoPopupString() 208 | getWarningString() 209 | getErrorString() 210 | */ 211 | 212 | /*** DO NOT EDIT THIS CLASS, MAKE A SUBCLASS OF IT INSTEAD ***/ 213 | class CHOP_CPlusPlusBase 214 | { 215 | protected: 216 | CHOP_CPlusPlusBase() 217 | { 218 | } 219 | 220 | virtual ~CHOP_CPlusPlusBase() 221 | { 222 | } 223 | 224 | public: 225 | 226 | // BEGIN PUBLIC INTERFACE 227 | 228 | // Some general settings can be assigned here (if you override it) 229 | virtual void 230 | getGeneralInfo(CHOP_GeneralInfo*, const OP_Inputs *inputs, void* reserved1) 231 | { 232 | } 233 | 234 | // This function is called so the class can tell the CHOP how many 235 | // channels it wants to output, how many samples etc. 236 | // Return true if you specify the output here. 237 | // Return false if you want the output to be set by matching 238 | // the channel names, numSamples, sample rate etc. of one of your inputs 239 | // The input that is used is chosen by setting the 'inputMatchIndex' 240 | // memeber in CHOP_OutputInfo 241 | // The CHOP_OutputInfo class is pre-filled with what the CHOP would 242 | // output if you return false, so you can just tweak a few settings 243 | // and return true if you want 244 | virtual bool 245 | getOutputInfo(CHOP_OutputInfo*, const OP_Inputs *inputs, void *reserved1) 246 | { 247 | return false; 248 | } 249 | 250 | // This function will be called after getOutputInfo() asking for 251 | // the channel names. It will get called once for each channel name 252 | // you need to specify. If you returned 'false' from getOutputInfo() 253 | // it won't be called. 254 | virtual void 255 | getChannelName(int32_t index, OP_String *name, 256 | const OP_Inputs *inputs, void* reserved1) 257 | { 258 | name->setString("chan1"); 259 | } 260 | 261 | 262 | // In this function you do whatever you want to fill the output channels 263 | // which are already allocated for you in 'outputs' 264 | virtual void execute(CHOP_Output* outputs, 265 | const OP_Inputs* inputs, 266 | void* reserved1) = 0; 267 | 268 | 269 | // Override these methods if you want to output values to the Info CHOP/DAT 270 | // returning 0 means you dont plan to output any Info CHOP channels 271 | virtual int32_t 272 | getNumInfoCHOPChans(void *reserved1) 273 | { 274 | return 0; 275 | } 276 | 277 | // Specify the name and value for Info CHOP channel 'index', 278 | // by assigning something to 'name' and 'value' members of the 279 | // OP_InfoCHOPChan class pointer that is passed in. 280 | virtual void 281 | getInfoCHOPChan(int32_t index, OP_InfoCHOPChan* chan, void* reserved1) 282 | { 283 | } 284 | 285 | 286 | // Return false if you arn't returning data for an Info DAT 287 | // Return true if you are. 288 | // Set the members of the CHOP_InfoDATSize class to specify 289 | // the dimensions of the Info DAT 290 | virtual bool 291 | getInfoDATSize(OP_InfoDATSize* infoSize, void *reserved1) 292 | { 293 | return false; 294 | } 295 | 296 | // You are asked to assign values to the Info DAT 1 row or column at a time 297 | // The 'byColumn' variable in 'getInfoDATSize' is how you specify 298 | // if it is by column or by row. 299 | // 'index' is the row/column index 300 | // 'nEntries' is the number of entries in the row/column 301 | // Strings should be UTF-8 encoded. 302 | virtual void 303 | getInfoDATEntries(int32_t index, int32_t nEntries, 304 | OP_InfoDATEntries* entries, 305 | void *reserved1) 306 | { 307 | } 308 | 309 | // You can use this function to put the node into a warning state 310 | // by calling setSting() on 'warning' with a non empty string. 311 | // Leave 'warning' unchanged to not go into warning state. 312 | virtual void 313 | getWarningString(OP_String *warning, void *reserved1) 314 | { 315 | } 316 | 317 | // You can use this function to put the node into a error state 318 | // by calling setSting() on 'error' with a non empty string. 319 | // Leave 'error' unchanged to not go into error state. 320 | virtual void 321 | getErrorString(OP_String *error, void *reserved1) 322 | { 323 | } 324 | 325 | // Use this function to return some text that will show up in the 326 | // info popup (when you middle click on a node) 327 | // call setString() on info and give it some info if desired. 328 | virtual void 329 | getInfoPopupString(OP_String *info, void *reserved1) 330 | { 331 | } 332 | 333 | 334 | // Override these methods if you want to define specfic parameters 335 | virtual void 336 | setupParameters(OP_ParameterManager* manager, void* reserved1) 337 | { 338 | } 339 | 340 | 341 | // This is called whenever a pulse parameter is pressed 342 | virtual void 343 | pulsePressed(const char* name, void* reserved1) 344 | { 345 | } 346 | 347 | // This is called whenever a dynamic menu type custom parameter needs to have it's content's 348 | // updated. It may happen often, so this could should be efficient. 349 | virtual void 350 | buildDynamicMenu(const OP_Inputs* inputs, OP_BuildDynamicMenuInfo* info, void* reserved1) 351 | { 352 | } 353 | 354 | // END PUBLIC INTERFACE 355 | 356 | 357 | private: 358 | 359 | // Reserved for future features 360 | virtual int32_t reservedFunc6() { return 0; } 361 | virtual int32_t reservedFunc7() { return 0; } 362 | virtual int32_t reservedFunc8() { return 0; } 363 | virtual int32_t reservedFunc9() { return 0; } 364 | virtual int32_t reservedFunc10() { return 0; } 365 | virtual int32_t reservedFunc11() { return 0; } 366 | virtual int32_t reservedFunc12() { return 0; } 367 | virtual int32_t reservedFunc13() { return 0; } 368 | virtual int32_t reservedFunc14() { return 0; } 369 | virtual int32_t reservedFunc15() { return 0; } 370 | virtual int32_t reservedFunc16() { return 0; } 371 | virtual int32_t reservedFunc17() { return 0; } 372 | virtual int32_t reservedFunc18() { return 0; } 373 | virtual int32_t reservedFunc19() { return 0; } 374 | virtual int32_t reservedFunc20() { return 0; } 375 | 376 | int32_t reserved[400]; 377 | 378 | }; 379 | 380 | #pragma pack(pop) 381 | 382 | static_assert(offsetof(CHOP_PluginInfo, apiVersion) == 0, "Incorrect Alignment"); 383 | static_assert(offsetof(CHOP_PluginInfo, customOPInfo) == 408, "Incorrect Alignment"); 384 | static_assert(sizeof(CHOP_PluginInfo) == 944, "Incorrect Size"); 385 | 386 | static_assert(offsetof(CHOP_GeneralInfo, cookEveryFrame) == 0, "Incorrect Alignment"); 387 | static_assert(offsetof(CHOP_GeneralInfo, cookEveryFrameIfAsked) == 1, "Incorrect Alignment"); 388 | static_assert(offsetof(CHOP_GeneralInfo, timeslice) == 2, "Incorrect Alignment"); 389 | static_assert(offsetof(CHOP_GeneralInfo, inputMatchIndex) == 4, "Incorrect Alignment"); 390 | static_assert(sizeof(CHOP_GeneralInfo) == 88, "Incorrect Size"); 391 | 392 | static_assert(offsetof(CHOP_OutputInfo, numChannels) == 0, "Incorrect Alignment"); 393 | static_assert(offsetof(CHOP_OutputInfo, numSamples) == 4, "Incorrect Alignment"); 394 | static_assert(offsetof(CHOP_OutputInfo, startIndex) == 8, "Incorrect Alignment"); 395 | static_assert(offsetof(CHOP_OutputInfo, sampleRate) == 12, "Incorrect Alignment"); 396 | static_assert(offsetof(CHOP_OutputInfo, reserved1) == 16, "Incorrect Alignment"); 397 | static_assert(sizeof(CHOP_OutputInfo) == 104, "Incorrect Size"); 398 | 399 | static_assert(offsetof(CHOP_Output, numChannels) == 0, "Incorrect Alignment"); 400 | static_assert(offsetof(CHOP_Output, numSamples) == 4, "Incorrect Alignment"); 401 | static_assert(offsetof(CHOP_Output, sampleRate) == 8, "Incorrect Alignment"); 402 | static_assert(offsetof(CHOP_Output, startIndex) == 12, "Incorrect Alignment"); 403 | static_assert(offsetof(CHOP_Output, names) == 16, "Incorrect Alignment"); 404 | static_assert(offsetof(CHOP_Output, channels) == 24, "Incorrect Alignment"); 405 | static_assert(sizeof(CHOP_Output) == 112, "Incorrect Size"); 406 | #endif 407 | }; // namespace TD 408 | -------------------------------------------------------------------------------- /derivative/CPlusPlus_Common.h: -------------------------------------------------------------------------------- 1 | /* Shared Use License: This file is owned by Derivative Inc. (Derivative) 2 | * and can only be used, and/or modified for use, in conjunction with 3 | * Derivative's TouchDesigner software, and only if you are a licensee who has 4 | * accepted Derivative's TouchDesigner license or assignment agreement 5 | * (which also govern the use of this file). You may share or redistribute 6 | * a modified version of this file provided the following conditions are met: 7 | * 8 | * 1. The shared file or redistribution must retain the information set out 9 | * above and this list of conditions. 10 | * 2. Derivative's name (Derivative Inc.) or its trademarks may not be used 11 | * to endorse or promote products derived from this file without specific 12 | * prior written permission from Derivative. 13 | */ 14 | 15 | /******* 16 | Derivative Developers: Make sure the virtual function order 17 | stays the same, otherwise changes won't be backwards compatible 18 | ********/ 19 | 20 | 21 | #ifndef __CPlusPlus_Common__ 22 | #define __CPlusPlus_Common__ 23 | 24 | #include 25 | 26 | #ifdef _WIN32 27 | #define NOMINMAX 28 | #include 29 | #include 30 | #define DLLEXPORT __declspec (dllexport) 31 | #else 32 | #define DLLEXPORT 33 | #endif 34 | 35 | #include 36 | #include 37 | #include 38 | #include 39 | 40 | #ifndef PyObject_HEAD 41 | struct _object; 42 | typedef _object PyObject; 43 | typedef struct _typeobject PyTypeObject; 44 | typedef struct PyGetSetDef PyGetSefDef; 45 | typedef struct PyMethodDef PyMethodDef; 46 | #endif 47 | 48 | struct cudaArray; 49 | struct CUstream_st; 50 | typedef struct CUstream_st* cudaStream_t; 51 | 52 | class TOP_CPlusPlus; 53 | 54 | namespace TD 55 | { 56 | 57 | class CHOP_PluginInfo; 58 | class CHOP_CPlusPlusBase; 59 | class DAT_PluginInfo; 60 | class DAT_CPlusPlusBase; 61 | class TOP_PluginInfo; 62 | class TOP_CPlusPlusBase; 63 | class TOP_Context; 64 | class SOP_PluginInfo; 65 | class SOP_CPlusPlusBase; 66 | 67 | #pragma pack(push, 8) 68 | 69 | enum class OP_PixelFormat : int32_t 70 | { 71 | Invalid = -1, 72 | 73 | // 8-bit per color, BGRA pixels. This is preferred for 4 channel 8-bit data 74 | BGRA8Fixed = 0, 75 | // 8-bit per color, RGBA pixels. Only use this one if absolutely nessessary. 76 | RGBA8Fixed = 1, 77 | RGBA16Fixed = 102, 78 | RGBA16Float = 202, 79 | RGBA32Float = 2, 80 | 81 | Mono8Fixed = 3, 82 | Mono16Fixed = 100, 83 | Mono16Float = 200, 84 | Mono32Float = 5, 85 | 86 | // RG two channel 87 | RG8Fixed = 4, 88 | RG16Fixed = 101, 89 | RG16Float = 201, 90 | RG32Float = 6, 91 | 92 | // Alpha only 93 | A8Fixed = 300, 94 | A16Fixed, 95 | A16Float, 96 | A32Float, 97 | 98 | // Mono with Alpha 99 | MonoA8Fixed = 400, 100 | MonoA16Fixed, 101 | MonoA16Float, 102 | MonoA32Float, 103 | 104 | // sRGB. use SBGRA if possible since that's what most GPUs use 105 | SBGRA8Fixed = 600, 106 | SRGBA8Fixed, 107 | 108 | RGB10A2Fixed = 700, 109 | // 11-bit float, positive values only. B is actually 10 bits 110 | RGB11Float, 111 | 112 | 113 | }; 114 | 115 | typedef OP_PixelFormat OP_CPUMemPixelType; 116 | 117 | enum class OP_TexDim : int32_t 118 | { 119 | eInvalid = -1, 120 | e2D, 121 | e2DArray, 122 | e3D, 123 | eCube, 124 | }; 125 | 126 | class OP_String; 127 | class OP_TOPInputOpenGL; 128 | class OP_TOPInputDownloadOptionsOpenGL; 129 | 130 | class PY_GetInfo 131 | { 132 | public: 133 | PY_GetInfo() 134 | { 135 | memset(this, 0, sizeof(PY_GetInfo)); 136 | } 137 | // If this is set to true then the node will cook if it needs to before your class 138 | // instance is returned. This should be set to true if the python code requires 139 | // the node's state to be up-to-date before doing it's work. 140 | bool autoCook; 141 | 142 | int32_t reserved[50]; 143 | }; 144 | 145 | class PY_Context 146 | { 147 | public: 148 | virtual ~PY_Context() 149 | { 150 | } 151 | 152 | // Returns a pointer to the instance of your CHOP_CPlusPlusBase, TOP_CPlusPlusBase etc. subclass 153 | // for this node that you've defined in your project. 154 | virtual void* getNodeInstance(const PY_GetInfo& info, void* reserved = nullptr) = 0; 155 | 156 | // If your python code is changing something in your node that should cause it to re-cook 157 | // you should call this at the end of your python code. 158 | virtual void makeNodeDirty(void* reserved = nullptr) = 0; 159 | 160 | int32_t reserved[50]; 161 | }; 162 | 163 | #define OP_STRUCT_HEADER_ENTRIES 256 164 | #define OP_PYTHON_STRUCT_HEADER int32_t OP_PY_STRUCT_HEADER[OP_STRUCT_HEADER_ENTRIES]; 165 | 166 | struct PY_Struct 167 | { 168 | public: 169 | OP_PYTHON_STRUCT_HEADER 170 | 171 | PY_Context* context; 172 | 173 | int32_t reserved2[1024]; 174 | }; 175 | 176 | class TOP_Buffer; 177 | 178 | template class OP_SmartRef; 179 | 180 | // For classes that we want to be able to reference count, this will be their base class. 181 | // However management of the reference counting is done via the OP_SmartRef automatic 182 | // reference counting. 183 | class OP_RefCount 184 | { 185 | public: 186 | virtual ~OP_RefCount() { } 187 | 188 | protected: 189 | // Increase the reference count to this instance. 190 | virtual void acquire() = 0; 191 | // Decrease the reference count to this instance. When the reference count reaches 0 the class will be deleted. 192 | virtual void release() = 0; 193 | 194 | virtual void reserved0() = 0; 195 | virtual void reserved1() = 0; 196 | virtual void reserved2() = 0; 197 | virtual void reserved3() = 0; 198 | virtual void reserved4() = 0; 199 | 200 | template 201 | friend class OP_SmartRef; 202 | }; 203 | 204 | template 205 | class OP_SmartRef 206 | { 207 | public: 208 | 209 | OP_SmartRef() : 210 | myTarget(nullptr) 211 | { 212 | } 213 | 214 | OP_SmartRef(T* t) 215 | { 216 | if (t) 217 | t->acquire(); 218 | myTarget = t; 219 | } 220 | 221 | OP_SmartRef(const OP_SmartRef& t) : 222 | myTarget(nullptr) 223 | { 224 | operator=(t); 225 | } 226 | 227 | OP_SmartRef(OP_SmartRef&& t) : 228 | myTarget(nullptr) 229 | { 230 | operator=(std::move(t)); 231 | } 232 | 233 | ~OP_SmartRef() 234 | { 235 | release(); 236 | } 237 | 238 | void 239 | operator=(const OP_SmartRef& t) 240 | { 241 | if (this == &t || myTarget == t.myTarget) 242 | return; 243 | 244 | if (myTarget) 245 | myTarget->release(); 246 | if (t.myTarget) 247 | t.myTarget->acquire(); 248 | myTarget = t.myTarget; 249 | } 250 | 251 | void 252 | operator=(OP_SmartRef&& t) 253 | { 254 | if (this == &t || myTarget == t.myTarget) 255 | return; 256 | 257 | if (myTarget) 258 | myTarget->release(); 259 | myTarget = t.myTarget; 260 | t.myTarget = nullptr; 261 | } 262 | 263 | void 264 | release() 265 | { 266 | if (myTarget) 267 | { 268 | myTarget->release(); 269 | myTarget = nullptr; 270 | } 271 | } 272 | 273 | T* 274 | operator->() const 275 | { 276 | return myTarget; 277 | } 278 | 279 | operator bool() const 280 | { 281 | return myTarget != nullptr; 282 | } 283 | 284 | private: 285 | T* myTarget; 286 | 287 | friend class ::TOP_CPlusPlus; 288 | }; 289 | 290 | // Used to describe this Plugin so it can be used as a custom OP. 291 | // Can be filled in as part of the Fill*PluginInfo() callback 292 | class OP_CustomOPInfo 293 | { 294 | public: 295 | // For this plugin to be treated as a Custom OP, all of the below fields 296 | // must be filled in correctly. Otherwise the .dll can only be used 297 | // when manually loaded into the C++ TOP 298 | 299 | // The type name of the node, this needs to be unique from all the other 300 | // TOP plugins loaded on the system. The name must start with an upper case 301 | // character (A-Z), and the rest should be lower case 302 | // Only the characters a-z and 0-9 are allowed in the opType. 303 | // Spaces are not allowed 304 | OP_String* opType; 305 | 306 | // The english readable label for the node. This is what is shown in the 307 | // OP Create Menu dialog. 308 | // Spaces and other special characters are allowed. 309 | // This can be a UTF-8 encoded string for non-english langauge label 310 | OP_String* opLabel; 311 | 312 | // This should be three letters (upper or lower case), or numbers, which 313 | // are used to create an icon for this Custom OP. 314 | OP_String* opIcon; 315 | 316 | // The minimum number of wired inputs required for this OP to function. 317 | int32_t minInputs = 0; 318 | 319 | // The maximum number of connected inputs allowed for this OP. If this plugin 320 | // always requires 1 input, then set both min and max to 1. 321 | int32_t maxInputs = 0; 322 | 323 | // The name of the author 324 | OP_String* authorName; 325 | 326 | // The email of the author 327 | OP_String* authorEmail; 328 | 329 | // Major version should be used to differentiate between drastically different 330 | // versions of this Custom OP. In particular changes that arn't backwards 331 | // compatible. 332 | // A project file will compare the major version of OPs saved in it with the 333 | // major version of the plugin installed on the system, and expect them to be 334 | // the same. 335 | int32_t majorVersion = 0; 336 | 337 | // Minor version is used to denote upgrades to a plugin. It should be increased 338 | // when new features are added to a plugin that would cause loading up a project 339 | // with an older version of the plguin to behavior incorrectly. For example 340 | // if new parameters are added to the plugin. 341 | // A project file will expect the plugin installed on the system to be greater than 342 | // or equal to the plugin version the project was created with. Assuming 343 | // the majorVersion is the same. 344 | int32_t minorVersion = 1; 345 | 346 | // If this Custom OP is using CPython objects (PyObject* etc.) obtained via 347 | // getParPython() calls, this needs to be set to the Python 348 | // version this plugin is compiled against. 349 | // 350 | // This ensures when TD's Python version is upgraded the plugins will 351 | // error cleanly. This should be set to PY_VERSION as defined in 352 | // patchlevel.h from the Python include folder. (E.g, "3.5.1") 353 | // It should be left unchanged if CPython isn't being used in this plugin. 354 | OP_String* pythonVersion; 355 | 356 | // False by default. If this is on the node will cook at least once 357 | // when the project it is contained within starts up, or when the node 358 | // is created. 359 | // For pure output nodes that are using 'cookEveryFrame=true' in their 360 | // GeneralInfo, setting this to 'true' is required to kick-start the 361 | // every-frame cooking. 362 | bool cookOnStart = false; 363 | 364 | // If you provide either (or both) of these a custom Python class will be created for your Custom OP 365 | // that contains these getters/setters and/or methods. 366 | // These should be arrays of the given types, terminated by a {0} entry (as it CPython standard for working 367 | // with these types 368 | PyGetSetDef* pythonGetSets = nullptr; 369 | PyMethodDef* pythonMethods = nullptr; 370 | // The python documentation string for the class 371 | const char* pythonDoc = nullptr; 372 | 373 | // If you want this node to have a Callback DAT parameter and 374 | // your custom OP to be able call python callbacks the end-users fill in, 375 | // then fill in the stub code for the DAT here. 376 | // This will cause a Callbacks DAT parameter to be added to the first page of 377 | // your node's parameters. 378 | // This should be setup with empty/stub functions along with comments, 379 | // similar to the way other Callback DATs are pre-filled in other nodes in TouchDesigner. 380 | // Note: This only works when the .dll is installed as a Custom OP, not as a C++ OP. 381 | const char* pythonCallbacksDAT = nullptr; 382 | 383 | int32_t reserved[88]; 384 | }; 385 | 386 | // This class is used to provide direct access to the instance of a Custom OP 387 | // by another Custom OP who has a reference to it, via it's input or a parameter. 388 | // The type of 'T' will be TOP_CPlusPlusBase, CHOP_CPlusPlusBase etc. depending 389 | // on the OP family. Use the 'opType' field to verify that this node is the 390 | // type you expect it to be, before casting 'instance' to your real class that 391 | // implements the custom OP. 392 | // Since the header of the Custom OP is needed to do the cast, this is only 393 | // useful in cases where you are implementing multiple Custom OPs, and need a 394 | // higher level of communication between them than parameters/inputs etc. 395 | // The customOP field will be nullptr in the OP_TOPInput, OP_CHOPInput etc 396 | // if the node is not a Custom OP. 397 | // 398 | // Does not work with plugins loaded directly into the CPlusPlus nodes. 399 | template 400 | class OP_CustomOPInstance 401 | { 402 | public: 403 | OP_CustomOPInstance() 404 | { 405 | instance = nullptr; 406 | opType = nullptr; 407 | memset(reserved, 0, sizeof(reserved)); 408 | } 409 | 410 | T* instance; 411 | const char* opType; 412 | int32_t minorVersion; 413 | int32_t majorVersion; 414 | 415 | int32_t reserved[50]; 416 | }; 417 | 418 | class OP_Context 419 | { 420 | public: 421 | OP_Context() 422 | { 423 | memset(reserved, 0, sizeof(reserved)); 424 | } 425 | virtual ~OP_Context() 426 | { 427 | } 428 | 429 | // By convention all callbacks in TouchDesigner have the first argument as 'op' which is the OP that 430 | // the callback originated from (your Custom Operator in this case). 431 | // Use this function to create your 'arguments' tuple, the first entry will already be filled with the 432 | // PyObject for 'op'. You should fill in the other entries you want, starting at index 1. 433 | virtual PyObject* createArgumentsTuple(int numOtherArgs, void* reserved1) = 0; 434 | 435 | // Call the function defined in the Callbacks DAT named 'functionName'. 436 | // 'arguments' must be a PyTuple of arguments created with createArgumentsTuple() 437 | // 'keywords' must be nullptr or a PyDict of keyword arguments that you create yourself. 438 | // References to 'arguments' and 'keywords' are not stolen, so Py_DECREF if you are done with them after calling 439 | // this function. 440 | // This function will return the PyObject* returned by the callback. 441 | // This function will return nullptr on error, 442 | // If non-nullptr is returned, you are now the owner of it and must Py_DECREF it (or hold onto it for other usages). 443 | // If the node does not have a callback DAT created, or no function matches the given functionName, then Py_None is returned. 444 | // Py_None must also have Py_DECREF called on it. 445 | virtual PyObject* callPythonCallback(const char* functionName, PyObject* arguments, PyObject* keywords, 446 | void* reserved1) = 0; 447 | 448 | // All CUDA operations must occur on the main thread, and between calls to these 449 | // functions. This is needed to ensure the order of operations between Vulkan 450 | // and CUDA is properly managed. 451 | virtual bool beginCUDAOperations(void* reserved1) = 0; 452 | virtual void endCUDAOperations(void* reserved1) = 0; 453 | 454 | int32_t reserved[50]; 455 | 456 | protected: 457 | // Reserved for later use 458 | virtual void* reservedFunc0() = 0; 459 | virtual void* reservedFunc1() = 0; 460 | virtual void* reservedFunc2() = 0; 461 | virtual void* reservedFunc3() = 0; 462 | virtual void* reservedFunc4() = 0; 463 | virtual void* reservedFunc5() = 0; 464 | virtual void* reservedFunc6() = 0; 465 | virtual void* reservedFunc7() = 0; 466 | virtual void* reservedFunc8() = 0; 467 | virtual void* reservedFunc9() = 0; 468 | virtual void* reservedFunc10() = 0; 469 | virtual void* reservedFunc11() = 0; 470 | virtual void* reservedFunc12() = 0; 471 | virtual void* reservedFunc13() = 0; 472 | virtual void* reservedFunc14() = 0; 473 | }; 474 | 475 | class OP_NodeInfo 476 | { 477 | public: 478 | // The full path to the operator 479 | const char* opPath; 480 | 481 | // A unique ID representing the operator, no two operators will ever 482 | // have the same ID in a single TouchDesigner instance. 483 | uint32_t opId; 484 | 485 | // This is the handle to the main TouchDesigner window. 486 | // It's possible this will be 0 the first few times the operator cooks, 487 | // incase it cooks while TouchDesigner is still loading up 488 | #ifdef _WIN32 489 | HWND mainWindowHandle; 490 | #endif 491 | 492 | // The path to where the plugin's binary is located on this machine. 493 | // UTF8-8 encoded. 494 | const char* pluginPath; 495 | 496 | // Used to do other operations to the node such as call python callbacks 497 | OP_Context* context; 498 | 499 | // The number of times this node has cooked. Incremented at the start of the cook. 500 | uint32_t cookCount; 501 | 502 | #ifdef _WIN32 503 | // The HINSTANCE of the process executable 504 | HINSTANCE processHInstance; 505 | #endif 506 | 507 | #ifdef _WIN32 508 | int32_t reserved[12]; 509 | #else 510 | int32_t reserved[14]; 511 | #endif 512 | }; 513 | 514 | class OP_DATInput 515 | { 516 | public: 517 | const char* opPath; 518 | uint32_t opId; 519 | 520 | int32_t numRows; 521 | int32_t numCols; 522 | bool isTable; 523 | 524 | // data, referenced by (row,col), which will be a const char* for the 525 | // contents of the cell 526 | // E.g getCell(1,2) will be the contents of the cell located at (1,2) 527 | // The string will be in UTF-8 encoding. 528 | const char* 529 | getCell(int32_t row, int32_t col) const 530 | { 531 | return cellData[row * numCols + col]; 532 | } 533 | 534 | const char** cellData; 535 | 536 | // The number of times this node has cooked 537 | int64_t totalCooks; 538 | 539 | // See documentation for OPCustomOPInstance 540 | const OP_CustomOPInstance* customOP; 541 | 542 | int32_t reserved[16]; 543 | }; 544 | 545 | class OP_TOPInputDownloadOptions 546 | { 547 | public: 548 | OP_TOPInputDownloadOptions() 549 | { 550 | verticalFlip = false; 551 | pixelFormat = OP_PixelFormat::Invalid; 552 | } 553 | 554 | // Set this to true if you want the image vertically flipped in the 555 | // downloaded data 556 | bool verticalFlip; 557 | 558 | // Set this to how you want the pixel data to be give to you in CPU memory. 559 | // Leave this as Invalid if you want to download the texture in it's GPU native format. 560 | // Only 2D textures can be converted to other formats. 3D/Cube/2DArray all must have this set as Invalid. 561 | OP_PixelFormat pixelFormat; 562 | }; 563 | 564 | class OP_TextureDesc 565 | { 566 | public: 567 | OP_TextureDesc() 568 | { 569 | memset(reserved, 0, sizeof(reserved)); 570 | } 571 | 572 | uint32_t width = 0; 573 | uint32_t height = 0; 574 | // Depth for 3D and 2D_ARRAY textures, 1 for other texture types 575 | uint32_t depth = 1; 576 | 577 | OP_TexDim texDim = OP_TexDim::eInvalid; 578 | OP_PixelFormat pixelFormat = OP_PixelFormat::Invalid; 579 | 580 | // If these are 0, then the aspect is simple the width and height ratio (square pixels). 581 | float aspectX = 0.0f; 582 | float aspectY = 0.0f; 583 | 584 | int32_t reserved[32]; 585 | }; 586 | 587 | // When you are given one of these you become the owner. You need to call release() on it when you 588 | // are done with it. 589 | class OP_TOPDownloadResult : public OP_RefCount 590 | { 591 | protected: 592 | virtual ~OP_TOPDownloadResult() 593 | { 594 | } 595 | public: 596 | OP_TOPDownloadResult() 597 | { 598 | memset(reserved, 0, sizeof(reserved)); 599 | } 600 | 601 | // Stalls until the downloaded data is ready. If calling from the main thread, try to avoid calling this for at least 602 | // 1 frame to avoid a CPU stall (See CPUMemoryTOP example). 603 | // However, this call is thread safe so you can pass this class off to another thread and have it stall right away 604 | // and start working on the data as soon as it's ready (such as outputting to an external device). 605 | virtual void* getData() = 0; 606 | 607 | // The size in bytes of the data. 608 | uint64_t size = 0; 609 | 610 | OP_TextureDesc textureDesc; 611 | 612 | int32_t reserved[32]; 613 | }; 614 | 615 | 616 | class OP_CUDAArrayInfo 617 | { 618 | public: 619 | OP_CUDAArrayInfo() 620 | { 621 | memset(reserved, 0, sizeof(reserved)); 622 | } 623 | 624 | // Description of the texture that cudaArray points to. 625 | OP_TextureDesc textureDesc; 626 | 627 | // When you first obtain a pointer to the TOP_CUDAArrayInfo, this will be nullptr. 628 | // It will get filled in with the correct memory address when you call 629 | // OP_Context::beginCUDAOperations() 630 | cudaArray* cudaArray = nullptr; 631 | 632 | uint32_t reserved[25]; 633 | }; 634 | 635 | class OP_CUDAAcquireInfo 636 | { 637 | public: 638 | OP_CUDAAcquireInfo() 639 | { 640 | memset(reserved, 0, sizeof(reserved)); 641 | } 642 | 643 | cudaStream_t stream = 0; 644 | 645 | uint32_t reserved[25]; 646 | }; 647 | 648 | class OP_TOPInput 649 | { 650 | protected: 651 | virtual ~OP_TOPInput() 652 | { 653 | } 654 | public: 655 | // You become the owner of the returned OP_TOPDownloadResult. 656 | // Call release() on it when you are done with it (or let the variable fall out of scope and destruct itself). 657 | virtual OP_SmartRef downloadTexture(const OP_TOPInputDownloadOptions& opts, void* reserved1) const = 0; 658 | 659 | // Can only be called from a C++ TOP/Custom TOP that is working in TOP_ExecuteMode::CUDA. Will error/return nullptr in other 660 | // cases. Should only be called from within execute(), and the returned pointer will remain valids until execute() returns. 661 | // Returns a OP_CUDArrayInfo* that can be used to get the cudaArray* pointer for the texture memory for this TOP. 662 | virtual const OP_CUDAArrayInfo* getCUDAArray(const OP_CUDAAcquireInfo& info, void* reserved2) const = 0; 663 | 664 | const char* opPath; 665 | uint32_t opId; 666 | 667 | OP_TextureDesc textureDesc; 668 | 669 | // The number of times this node has cooked 670 | int64_t totalCooks; 671 | 672 | // See documentation for OPCustomOPInstance 673 | const OP_CustomOPInstance* customOP; 674 | 675 | int32_t reserved[12]; 676 | 677 | protected: 678 | virtual void* reserved0() = 0; 679 | virtual void* reserved1() = 0; 680 | virtual void* reserved2() = 0; 681 | virtual void* reserved3() = 0; 682 | virtual void* reserved4() = 0; 683 | }; 684 | 685 | class OP_String 686 | { 687 | protected: 688 | OP_String() 689 | { 690 | memset(reserved, 0, sizeof(reserved)); 691 | } 692 | 693 | virtual ~OP_String() 694 | { 695 | } 696 | 697 | public: 698 | // val is expected to be UTF-8 encoded 699 | virtual void setString(const char* val) = 0; 700 | 701 | int32_t reserved[20]; 702 | }; 703 | 704 | class OP_CHOPInput 705 | { 706 | public: 707 | const char* opPath; 708 | uint32_t opId; 709 | 710 | int32_t numChannels; 711 | int32_t numSamples; 712 | double sampleRate; 713 | double startIndex; 714 | 715 | // Retrieve a float array for a specific channel. 716 | // 'i' ranges from 0 to numChannels-1 717 | // The returned arrray contains 'numSamples' samples. 718 | // e.g: getChannelData(1)[10] will refer to the 11th sample in the 2nd channel 719 | 720 | const float* 721 | getChannelData(int32_t i) const 722 | { 723 | return channelData[i]; 724 | } 725 | 726 | // Retrieve the name of a specific channel. 727 | // 'i' ranges from 0 to numChannels-1 728 | // For example getChannelName(1) is the name of the 2nd channel 729 | 730 | const char* 731 | getChannelName(int32_t i) const 732 | { 733 | return nameData[i]; 734 | } 735 | 736 | const float** channelData; 737 | const char** nameData; 738 | 739 | // The number of times this node has cooked 740 | int64_t totalCooks; 741 | 742 | // See documentation for OPCustomOPInstance 743 | const OP_CustomOPInstance* customOP; 744 | 745 | int32_t reserved[16]; 746 | }; 747 | 748 | class OP_ObjectInput 749 | { 750 | public: 751 | const char* opPath; 752 | uint32_t opId; 753 | 754 | // Use these methods to calculate object transforms 755 | double worldTransform[4][4]; 756 | double localTransform[4][4]; 757 | 758 | // The number of times this node has cooked 759 | int64_t totalCooks; 760 | 761 | int32_t reserved[18]; 762 | }; 763 | 764 | // The type of data the attribute holds 765 | enum class AttribType : int32_t 766 | { 767 | // One or more floats 768 | Float = 0, 769 | 770 | // One or more integers 771 | Int, 772 | }; 773 | 774 | // Right now we only support point attributes. 775 | enum class AttribSet : int32_t 776 | { 777 | Invalid, 778 | Point = 0, 779 | }; 780 | 781 | // The type of the primitives, currently only Polygon type 782 | // is supported 783 | enum class PrimitiveType : int32_t 784 | { 785 | Invalid, 786 | Polygon = 0, 787 | }; 788 | 789 | class Vector 790 | { 791 | public: 792 | Vector() 793 | { 794 | x = 0.0f; 795 | y = 0.0f; 796 | z = 0.0f; 797 | } 798 | 799 | Vector(float xx, float yy, float zz) 800 | { 801 | x = xx; 802 | y = yy; 803 | z = zz; 804 | } 805 | 806 | // inplace operators 807 | inline Vector& 808 | operator*=(const float scalar) 809 | { 810 | x *= scalar; 811 | y *= scalar; 812 | z *= scalar; 813 | return *this; 814 | } 815 | 816 | inline Vector& 817 | operator/=(const float scalar) 818 | { 819 | x /= scalar; 820 | y /= scalar; 821 | z /= scalar; 822 | return *this; 823 | } 824 | 825 | inline Vector& 826 | operator-=(const Vector& trans) 827 | { 828 | x -= trans.x; 829 | y -= trans.y; 830 | z -= trans.z; 831 | return *this; 832 | } 833 | 834 | inline Vector& 835 | operator+=(const Vector& trans) 836 | { 837 | x += trans.x; 838 | y += trans.y; 839 | z += trans.z; 840 | return *this; 841 | } 842 | 843 | // non-inplace operations: 844 | inline Vector 845 | operator*(const float scalar) 846 | { 847 | Vector temp(*this); 848 | temp.x *= scalar; 849 | temp.y *= scalar; 850 | temp.z *= scalar; 851 | return temp; 852 | } 853 | 854 | inline Vector 855 | operator/(const float scalar) 856 | { 857 | Vector temp(*this); 858 | temp.x /= scalar; 859 | temp.y /= scalar; 860 | temp.z /= scalar; 861 | return temp; 862 | } 863 | 864 | inline Vector 865 | operator-(const Vector& trans) 866 | { 867 | Vector temp(*this); 868 | temp.x -= trans.x; 869 | temp.y -= trans.y; 870 | temp.z -= trans.z; 871 | return temp; 872 | } 873 | 874 | inline Vector 875 | operator+(const Vector& trans) 876 | { 877 | Vector temp(*this); 878 | temp.x += trans.x; 879 | temp.y += trans.y; 880 | temp.z += trans.z; 881 | return temp; 882 | } 883 | 884 | //------ 885 | float 886 | dot(const Vector &v) const 887 | { 888 | return x * v.x + y * v.y + z * v.z; 889 | } 890 | 891 | inline float 892 | length() 893 | { 894 | return sqrtf(dot(*this)); 895 | } 896 | 897 | inline float 898 | normalize() 899 | { 900 | float dn = x * x + y * y + z * z; 901 | if (dn > FLT_MIN && dn != 1.0F) 902 | { 903 | dn = sqrtf(dn); 904 | (*this) /= dn; 905 | } 906 | return dn; 907 | } 908 | 909 | float x; 910 | float y; 911 | float z; 912 | }; 913 | 914 | class Position 915 | { 916 | public: 917 | Position() 918 | { 919 | x = 0.0f; 920 | y = 0.0f; 921 | z = 0.0f; 922 | } 923 | 924 | Position(float xx, float yy, float zz) 925 | { 926 | x = xx; 927 | y = yy; 928 | z = zz; 929 | } 930 | 931 | // in-place operators 932 | inline Position& operator*=(const float scalar) 933 | { 934 | x *= scalar; 935 | y *= scalar; 936 | z *= scalar; 937 | return *this; 938 | } 939 | 940 | inline Position& operator/=(const float scalar) 941 | { 942 | x /= scalar; 943 | y /= scalar; 944 | z /= scalar; 945 | return *this; 946 | } 947 | 948 | inline Position& operator-=(const Vector& trans) 949 | { 950 | x -= trans.x; 951 | y -= trans.y; 952 | z -= trans.z; 953 | return *this; 954 | } 955 | 956 | inline Position& operator+=(const Vector& trans) 957 | { 958 | x += trans.x; 959 | y += trans.y; 960 | z += trans.z; 961 | return *this; 962 | } 963 | 964 | // non-inplace operators 965 | inline Position operator*(const float scalar) 966 | { 967 | Position temp(*this); 968 | temp.x *= scalar; 969 | temp.y *= scalar; 970 | temp.z *= scalar; 971 | return temp; 972 | } 973 | 974 | inline Position operator/(const float scalar) 975 | { 976 | Position temp(*this); 977 | temp.x /= scalar; 978 | temp.y /= scalar; 979 | temp.z /= scalar; 980 | return temp; 981 | } 982 | 983 | inline Position operator+(const Vector& trans) 984 | { 985 | Position temp(*this); 986 | temp.x += trans.x; 987 | temp.y += trans.y; 988 | temp.z += trans.z; 989 | return temp; 990 | } 991 | 992 | inline Position operator-(const Vector& trans) 993 | { 994 | Position temp(*this); 995 | temp.x -= trans.x; 996 | temp.y -= trans.y; 997 | temp.z -= trans.z; 998 | return temp; 999 | } 1000 | 1001 | float x; 1002 | float y; 1003 | float z; 1004 | }; 1005 | 1006 | class Color 1007 | { 1008 | public: 1009 | Color () 1010 | { 1011 | r = 1.0f; 1012 | g = 1.0f; 1013 | b = 1.0f; 1014 | a = 1.0f; 1015 | } 1016 | 1017 | Color (float rr, float gg, float bb, float aa) 1018 | { 1019 | r = rr; 1020 | g = gg; 1021 | b = bb; 1022 | a = aa; 1023 | } 1024 | 1025 | float r; 1026 | float g; 1027 | float b; 1028 | float a; 1029 | }; 1030 | 1031 | class TexCoord 1032 | { 1033 | public: 1034 | TexCoord() 1035 | { 1036 | u = 0.0f; 1037 | v = 0.0f; 1038 | w = 0.0f; 1039 | } 1040 | 1041 | TexCoord(float uu, float vv, float ww) 1042 | { 1043 | u = uu; 1044 | v = vv; 1045 | w = ww; 1046 | } 1047 | 1048 | float u; 1049 | float v; 1050 | float w; 1051 | }; 1052 | 1053 | class BoundingBox 1054 | { 1055 | public: 1056 | BoundingBox(float minx, float miny, float minz, 1057 | float maxx, float maxy, float maxz) : 1058 | minX(minx), minY(miny), minZ(minz), maxX(maxx), maxY(maxy), maxZ(maxz) 1059 | { 1060 | } 1061 | 1062 | BoundingBox(const Position& min, const Position& max) 1063 | { 1064 | minX = min.x; 1065 | maxX = max.x; 1066 | minY = min.y; 1067 | maxY = max.y; 1068 | minZ = min.z; 1069 | maxZ = max.z; 1070 | } 1071 | 1072 | BoundingBox(const Position& center, float x, float y, float z) 1073 | { 1074 | minX = center.x - x; 1075 | maxX = center.x + x; 1076 | minY = center.y - y; 1077 | maxY = center.y + y; 1078 | minZ = center.z - z; 1079 | maxZ = center.z + z; 1080 | } 1081 | 1082 | // enlarge the bounding box by the input point Position 1083 | void 1084 | enlargeBounds(const Position& pos) 1085 | { 1086 | if (pos.x < minX) 1087 | minX = pos.x; 1088 | if (pos.x > maxX) 1089 | maxX = pos.x; 1090 | if (pos.y < minY) 1091 | minY = pos.y; 1092 | if (pos.y > maxY) 1093 | maxY = pos.y; 1094 | if (pos.z < minZ) 1095 | minZ = pos.z; 1096 | if (pos.z > maxZ) 1097 | maxZ = pos.z; 1098 | } 1099 | 1100 | // enlarge the bounding box by the input bounding box: 1101 | void 1102 | enlargeBounds(const BoundingBox &box) 1103 | { 1104 | if (box.minX < minX) 1105 | minX = box.minX; 1106 | if (box.maxX > maxX) 1107 | maxX = box.maxX; 1108 | if (box.minY < minY) 1109 | minY = box.minY; 1110 | if (box.maxY > maxY) 1111 | maxY = box.maxY; 1112 | if (box.minZ < minZ) 1113 | minZ = box.minZ; 1114 | if (box.maxZ > maxZ) 1115 | maxZ = box.maxZ; 1116 | } 1117 | 1118 | // returns the bounding box length in x axis: 1119 | float 1120 | sizeX() 1121 | { 1122 | return maxX - minX; 1123 | } 1124 | 1125 | // returns the bounding box length in y axis: 1126 | float 1127 | sizeY() 1128 | { 1129 | return maxY - minY; 1130 | } 1131 | 1132 | // returns the bounding box length in z axis: 1133 | float 1134 | sizeZ() 1135 | { 1136 | return maxZ - minZ; 1137 | } 1138 | 1139 | bool 1140 | getCenter(Position* pos) 1141 | { 1142 | if (!pos) 1143 | return false; 1144 | pos->x = (minX + maxX) / 2.0f; 1145 | pos->y = (minY + maxY) / 2.0f; 1146 | pos->z = (minZ + maxZ) / 2.0f; 1147 | return true; 1148 | } 1149 | 1150 | // verifies if the input position (pos) is inside the current bounding box or not: 1151 | bool 1152 | isInside(const Position& pos) 1153 | { 1154 | if (pos.x >= minX && pos.x <= maxX && 1155 | pos.y >= minY && pos.y <= maxY && 1156 | pos.z >= minZ && pos.z <= maxZ) 1157 | return true; 1158 | else 1159 | return false; 1160 | } 1161 | 1162 | 1163 | float minX; 1164 | float minY; 1165 | float minZ; 1166 | 1167 | float maxX; 1168 | float maxY; 1169 | float maxZ; 1170 | 1171 | }; 1172 | 1173 | class SOP_NormalInfo 1174 | { 1175 | public: 1176 | 1177 | SOP_NormalInfo() 1178 | { 1179 | numNormals = 0; 1180 | attribSet = AttribSet::Point; 1181 | normals = nullptr; 1182 | } 1183 | 1184 | int32_t numNormals; 1185 | AttribSet attribSet; 1186 | const Vector* normals; 1187 | }; 1188 | 1189 | class SOP_ColorInfo 1190 | { 1191 | public: 1192 | 1193 | SOP_ColorInfo() 1194 | { 1195 | numColors = 0; 1196 | attribSet = AttribSet::Point; 1197 | colors = nullptr; 1198 | } 1199 | 1200 | int32_t numColors; 1201 | AttribSet attribSet; 1202 | const Color* colors; 1203 | }; 1204 | 1205 | class SOP_TextureInfo 1206 | { 1207 | public: 1208 | 1209 | SOP_TextureInfo() 1210 | { 1211 | numTextures = 0; 1212 | attribSet = AttribSet::Point; 1213 | textures = nullptr; 1214 | numTextureLayers = 0; 1215 | } 1216 | 1217 | int32_t numTextures; 1218 | AttribSet attribSet; 1219 | const TexCoord* textures; 1220 | int32_t numTextureLayers; 1221 | }; 1222 | 1223 | // CustomAttribInfo, all the required data for each custom attribute 1224 | // this info can be queried by calling getCustomAttribute() which accepts 1225 | // two types of argument: 1226 | // 1) a valid index of a custom attribute 1227 | // 2) a valid name of a custom attribute 1228 | class SOP_CustomAttribInfo 1229 | { 1230 | public: 1231 | 1232 | SOP_CustomAttribInfo() 1233 | { 1234 | name = nullptr; 1235 | numComponents = 0; 1236 | attribType = AttribType::Float; 1237 | } 1238 | 1239 | SOP_CustomAttribInfo(const char* n, int32_t numComp, AttribType type) 1240 | { 1241 | name = n; 1242 | numComponents = numComp; 1243 | attribType = type; 1244 | } 1245 | 1246 | const char* name; 1247 | int32_t numComponents; 1248 | AttribType attribType; 1249 | }; 1250 | 1251 | // SOP_CustomAttribData, all the required data for each custom attribute 1252 | // this info can be queried by calling getCustomAttribute() which accepts 1253 | // a valid name of a custom attribute 1254 | class SOP_CustomAttribData : public SOP_CustomAttribInfo 1255 | { 1256 | public: 1257 | 1258 | SOP_CustomAttribData() 1259 | { 1260 | floatData = nullptr; 1261 | intData = nullptr; 1262 | } 1263 | 1264 | SOP_CustomAttribData(const char* n, int32_t numComp, AttribType type) : 1265 | SOP_CustomAttribInfo(n, numComp, type) 1266 | { 1267 | floatData = nullptr; 1268 | intData = nullptr; 1269 | } 1270 | 1271 | float* floatData; 1272 | int32_t* intData; 1273 | }; 1274 | 1275 | // SOP_PrimitiveInfo, all the required data for each primitive 1276 | // this info can be queried by calling getPrimitive() which accepts 1277 | // a valid index of a primitive as an input argument 1278 | class SOP_PrimitiveInfo 1279 | { 1280 | public: 1281 | 1282 | SOP_PrimitiveInfo() 1283 | { 1284 | pointIndices = nullptr; 1285 | numVertices = 0; 1286 | type = PrimitiveType::Invalid; 1287 | pointIndicesOffset = 0; 1288 | } 1289 | 1290 | // number of vertices of this prim 1291 | int32_t numVertices; 1292 | 1293 | // all the indices of the vertices of the primitive. This array has 1294 | // numVertices entries in it 1295 | const int32_t* pointIndices; 1296 | 1297 | // The type of this primitive 1298 | PrimitiveType type; 1299 | 1300 | // the offset of the this primitive's point indices in the index array 1301 | // returned from getAllPrimPointIndices() 1302 | int32_t pointIndicesOffset; 1303 | 1304 | }; 1305 | 1306 | class OP_SOPInput 1307 | { 1308 | public: 1309 | virtual ~OP_SOPInput() 1310 | { 1311 | } 1312 | 1313 | const char* opPath; 1314 | uint32_t opId; 1315 | 1316 | // Returns the total number of points 1317 | virtual int32_t getNumPoints() const = 0; 1318 | 1319 | // The total number of vertices, across all primitives. 1320 | virtual int32_t getNumVertices() const = 0; 1321 | 1322 | // The total number of primitives 1323 | virtual int32_t getNumPrimitives() const = 0; 1324 | 1325 | // The total number of custom attributes 1326 | virtual int32_t getNumCustomAttributes() const = 0; 1327 | 1328 | // Returns an array of point positions. This array is getNumPoints() long. 1329 | virtual const Position* getPointPositions() const = 0; 1330 | 1331 | // Returns an array of normals. 1332 | // 1333 | // Returns nullptr if no normals are present 1334 | virtual const SOP_NormalInfo* getNormals() const = 0; 1335 | 1336 | // Returns an array of colors. 1337 | // Returns nullptr if no colors are present 1338 | virtual const SOP_ColorInfo* getColors() const = 0; 1339 | 1340 | // Returns an array of texture coordinates. 1341 | // If multiple texture coordinate layers are present, they will be placed 1342 | // interleaved back-to-back. 1343 | // E.g layer0 followed by layer1 followed by layer0 etc. 1344 | // 1345 | // Returns nullptr if no texture layers are present 1346 | virtual const SOP_TextureInfo* getTextures() const = 0; 1347 | 1348 | // Returns the custom attribute data with an input index 1349 | virtual const SOP_CustomAttribData* getCustomAttribute(int32_t customAttribIndex) const = 0; 1350 | 1351 | // Returns the custom attribute data with its name 1352 | virtual const SOP_CustomAttribData* getCustomAttribute(const char* customAttribName) const = 0; 1353 | 1354 | // Returns true if the SOP has a normal attribute of the given source 1355 | // attribute 'N' 1356 | virtual bool hasNormals() const = 0; 1357 | 1358 | // Returns true if the SOP has a color the given source 1359 | // attribute 'Cd' 1360 | virtual bool hasColors() const = 0; 1361 | 1362 | // Returns true if the position lies inside the geometry. 1363 | virtual bool isInside(const Position &pos) = 0; 1364 | 1365 | // Returns true if the ray intersected with the geometry 1366 | virtual bool sendRay(const Position &pos, const Vector &dir, 1367 | Position &hitPostion, float &hitLength, Vector &hitNormal, 1368 | float &hitU, float &hitV, int &hitPrimitiveIndex) = 0; 1369 | 1370 | // Returns the SOP_PrimitiveInfo with primIndex 1371 | const SOP_PrimitiveInfo 1372 | getPrimitive(int32_t primIndex) const 1373 | { 1374 | return myPrimsInfo[primIndex]; 1375 | } 1376 | 1377 | // Returns the full list of all the point indices for all primitives. 1378 | // The primitives are stored back to back in this array. 1379 | const int32_t* 1380 | getAllPrimPointIndices() 1381 | { 1382 | return myPrimPointIndices; 1383 | } 1384 | 1385 | SOP_PrimitiveInfo* myPrimsInfo; 1386 | const int32_t* myPrimPointIndices; 1387 | 1388 | // The number of times this node has cooked 1389 | int64_t totalCooks; 1390 | 1391 | // See documentation for OPCustomOPInstance 1392 | const OP_CustomOPInstance* customOP; 1393 | 1394 | int32_t reserved[95]; 1395 | }; 1396 | 1397 | class OP_TimeInfo 1398 | { 1399 | public: 1400 | 1401 | // same as global Python value absTime.frame. Counts up forever 1402 | // since the application started. In rootFPS units. 1403 | int64_t absFrame; 1404 | 1405 | // The timeline frame number for this cook 1406 | double frame; 1407 | 1408 | // The timeline FPS/rate this node is cooking at. 1409 | // If the component this node is located in has Component Time, it's FPS 1410 | // may be different than the Root FPS 1411 | double rate; 1412 | 1413 | // The frame number for the root timeline. Different than frame 1414 | // if the node is in a component that has component time. 1415 | double rootFrame; 1416 | 1417 | // The Root FPS/Rate the file is running at. 1418 | double rootRate; 1419 | 1420 | // The number of frames that have elapsed since the last cook occured. 1421 | // This can be more than one if frames were dropped. 1422 | // If this is the first time this node is cooking, this will be 0.0 1423 | // This is in 'rate' units, not 'rootRate' units. 1424 | double deltaFrames; 1425 | 1426 | // The number of milliseconds that have elapsed since the last cook. 1427 | // Note that this isn't done via CPU timers, but is instead 1428 | // simply deltaFrames * milliSecondsPerFrame 1429 | double deltaMS; 1430 | 1431 | int32_t reserved[40]; 1432 | }; 1433 | 1434 | class OP_Inputs 1435 | { 1436 | public: 1437 | // NOTE: When writting a TOP, none of these functions should 1438 | // be called inside a beginGLCommands()/endGLCommands() section 1439 | // as they may require GL themselves to complete execution. 1440 | 1441 | // Inputs that are wired into the node. Note that since some inputs 1442 | // may not be connected this number doesn't mean that that the first N 1443 | // inputs are connected. For example on a 3 input node if the 3rd input 1444 | // is only one connected, this will return 1, and getInput*(0) and (1) 1445 | // will return nullptr. 1446 | virtual int32_t getNumInputs() const = 0; 1447 | 1448 | private: 1449 | // Deprecated, only declared here so legacy code can work. 1450 | virtual const OP_TOPInputOpenGL* getInputTOPOpenGL(int32_t index) const = 0; 1451 | public: 1452 | // Only valid for C++ CHOP operators 1453 | virtual const OP_CHOPInput* getInputCHOP(int32_t index) const = 0; 1454 | // getInputSOP() declared later on in the class 1455 | // getInputDAT() declared later on in the class 1456 | 1457 | // these are defined by parameters. 1458 | // may return nullptr when invalid input 1459 | // this value is valid until the parameters are rebuilt or it is called with the same parameter name. 1460 | virtual const OP_DATInput* getParDAT(const char *name) const = 0; 1461 | private: 1462 | // Deprecated, only declared here so legacy code can work. 1463 | virtual const OP_TOPInputOpenGL* getParTOPOpenGL(const char *name) const = 0; 1464 | public: 1465 | virtual const OP_CHOPInput* getParCHOP(const char *name) const = 0; 1466 | virtual const OP_ObjectInput* getParObject(const char *name) const = 0; 1467 | // getParSOP() declared later on in the class 1468 | 1469 | // these work on any type of parameter and can be interchanged 1470 | // for menu types, int returns the menu selection index, string returns the item 1471 | 1472 | // returns the requested value, index may be 0 to 4. 1473 | virtual double getParDouble(const char* name, int32_t index = 0) const = 0; 1474 | 1475 | // for multiple values: returns True on success/false otherwise 1476 | virtual bool getParDouble2(const char* name, double &v0, double &v1) const = 0; 1477 | virtual bool getParDouble3(const char* name, double &v0, double &v1, double &v2) const = 0; 1478 | virtual bool getParDouble4(const char* name, double &v0, double &v1, double &v2, double &v3) const = 0; 1479 | 1480 | 1481 | // returns the requested value 1482 | virtual int32_t getParInt(const char* name, int32_t index = 0) const = 0; 1483 | 1484 | // for multiple values: returns True on success/false otherwise 1485 | virtual bool getParInt2(const char* name, int32_t &v0, int32_t &v1) const = 0; 1486 | virtual bool getParInt3(const char* name, int32_t &v0, int32_t &v1, int32_t &v2) const = 0; 1487 | virtual bool getParInt4(const char* name, int32_t &v0, int32_t &v1, int32_t &v2, int32_t &v3) const = 0; 1488 | 1489 | // returns the requested value 1490 | // this value is valid until the parameters are rebuilt or it is called with the same parameter name. 1491 | // return value usable for life of parameter 1492 | // The returned string will be in UTF-8 encoding. 1493 | virtual const char* getParString(const char* name) const = 0; 1494 | 1495 | 1496 | // this is similar to getParString, but will return an absolute path if it exists, with 1497 | // slash direction consistent with O/S requirements. 1498 | // to get the original parameter value, use getParString 1499 | // return value usable for life of parameter 1500 | // The returned string will be in UTF-8 encoding. 1501 | virtual const char* getParFilePath(const char* name) const = 0; 1502 | 1503 | // returns true on success 1504 | // from_name and to_name must be Object parameters 1505 | virtual bool getRelativeTransform(const char* from_name, const char* to_name, double matrix[4][4]) const = 0; 1506 | 1507 | // disable or enable updating of the parameter 1508 | virtual void enablePar(const char* name, bool onoff) const = 0; 1509 | 1510 | // these are defined by paths. 1511 | // may return nullptr when invalid input 1512 | // this value is valid until the parameters are rebuilt or it is called with the same parameter name. 1513 | virtual const OP_DATInput* getDAT(const char *path) const = 0; 1514 | private: 1515 | // Deprecated, only declared here so legacy code can work. 1516 | virtual const OP_TOPInputOpenGL* getTOPOpenGL(const char *path) const = 0; 1517 | public: 1518 | virtual const OP_CHOPInput* getCHOP(const char *path) const = 0; 1519 | virtual const OP_ObjectInput* getObject(const char *path) const = 0; 1520 | 1521 | private: 1522 | // Deprecated, only declared here so legacy code can work. Use the functions in OP_TOPInput instead. 1523 | virtual void* getTOPDataInCPUMemory(const OP_TOPInputOpenGL *top, 1524 | const OP_TOPInputDownloadOptionsOpenGL *options) const = 0; 1525 | public: 1526 | 1527 | virtual const OP_SOPInput* getParSOP(const char *name) const = 0; 1528 | // only valid for C++ SOP operators 1529 | virtual const OP_SOPInput* getInputSOP(int32_t index) const = 0; 1530 | virtual const OP_SOPInput* getSOP(const char *path) const = 0; 1531 | 1532 | // only valid for C++ DAT operators 1533 | virtual const OP_DATInput* getInputDAT(int32_t index) const = 0; 1534 | 1535 | // To use Python in your Plugin you need to fill the 1536 | // customOPInfo.pythonVersion member in Fill*PluginInfo. 1537 | // 1538 | // The returned object, if not null should have its reference count decremented 1539 | // or else a memorky leak will occur. 1540 | virtual PyObject* getParPython(const char* name) const = 0; 1541 | 1542 | // Returns a class whose members gives you information about timing 1543 | // such as FPS and delta-time since the last cook. 1544 | // See OP_TimeInfo for more information 1545 | virtual const OP_TimeInfo* getTimeInfo() const = 0; 1546 | 1547 | virtual const OP_TOPInput* getTOP(const char* path) const = 0; 1548 | virtual const OP_TOPInput* getInputTOP(int32_t index) const = 0; 1549 | virtual const OP_TOPInput* getParTOP(const char *name) const = 0; 1550 | }; 1551 | 1552 | class OP_InfoCHOPChan 1553 | { 1554 | public: 1555 | OP_String* name; 1556 | float value; 1557 | 1558 | int32_t reserved[10]; 1559 | }; 1560 | 1561 | class OP_InfoDATSize 1562 | { 1563 | public: 1564 | // Set this to the size you want the table to be 1565 | int32_t rows; 1566 | int32_t cols; 1567 | 1568 | // Set this to true if you want to return DAT entries on a column 1569 | // by column basis. 1570 | // Otherwise set to false, and you'll be expected to set them on 1571 | // a row by row basis. 1572 | // DEFAULT : false 1573 | bool byColumn; 1574 | 1575 | int32_t reserved[10]; 1576 | }; 1577 | 1578 | class OP_InfoDATEntries 1579 | { 1580 | public: 1581 | // This is an array of OP_String* pointers which you are expected to assign 1582 | // values to. 1583 | // e.g values[1]->setString("myColumnName"); 1584 | // The string should be in UTF-8 encoding. 1585 | OP_String** values; 1586 | 1587 | int32_t reserved[10]; 1588 | }; 1589 | 1590 | class OP_NumericParameter 1591 | { 1592 | public: 1593 | OP_NumericParameter(const char* iname = nullptr) 1594 | { 1595 | name = iname; 1596 | label = page = nullptr; 1597 | 1598 | for (int i = 0; i<4; i++) 1599 | { 1600 | defaultValues[i] = 0.0; 1601 | 1602 | minSliders[i] = 0.0; 1603 | maxSliders[i] = 1.0; 1604 | 1605 | minValues[i] = 0.0; 1606 | maxValues[i] = 1.0; 1607 | 1608 | clampMins[i] = false; 1609 | clampMaxes[i] = false; 1610 | } 1611 | } 1612 | 1613 | // Any char* values passed are copied immediately by the append parameter functions, 1614 | // and do not need to be retained by the calling function. 1615 | // Must begin with capital letter, and contain no spaces 1616 | const char* name; 1617 | const char* label; 1618 | const char* page; 1619 | 1620 | double defaultValues[4]; 1621 | double minValues[4]; 1622 | double maxValues[4]; 1623 | 1624 | bool clampMins[4]; 1625 | bool clampMaxes[4]; 1626 | 1627 | double minSliders[4]; 1628 | double maxSliders[4]; 1629 | 1630 | int32_t reserved[20]; 1631 | 1632 | }; 1633 | 1634 | class OP_StringParameter 1635 | { 1636 | public: 1637 | OP_StringParameter(const char* iname = nullptr) 1638 | { 1639 | name = iname; 1640 | label = page = nullptr; 1641 | defaultValue = nullptr; 1642 | } 1643 | 1644 | // Any char* values passed are copied immediately by the append parameter functions, 1645 | // and do not need to be retained by the calling function. 1646 | 1647 | // Must begin with capital letter, and contain no spaces 1648 | const char* name; 1649 | const char* label; 1650 | const char* page; 1651 | 1652 | // This should be in UTF-8 encoding. 1653 | const char* defaultValue; 1654 | 1655 | int32_t reserved[20]; 1656 | }; 1657 | 1658 | enum class OP_ParAppendResult : int32_t 1659 | { 1660 | Success = 0, 1661 | InvalidName, // invalid or duplicate name 1662 | InvalidSize, // size out of range 1663 | }; 1664 | 1665 | class OP_BuildDynamicMenuInfo 1666 | { 1667 | public: 1668 | // A pointer to your plugin instance, cast this to your class type 1669 | void* instance; 1670 | 1671 | // The name of the parameter being dynamically filled 1672 | const char* name; 1673 | 1674 | int reserved[20]; 1675 | 1676 | // Call this to add menu entries for your dynamic menu. 1677 | // The contents of the strings are copied during the call, you don't need to keep copies around 1678 | // after the call returns. 1679 | virtual bool addMenuEntry(const char* name, const char* label) = 0; 1680 | }; 1681 | 1682 | class OP_ParameterManager 1683 | { 1684 | 1685 | public: 1686 | // Returns OP_ParAppendResult::Success on success 1687 | virtual OP_ParAppendResult appendFloat(const OP_NumericParameter &np, int32_t size = 1) = 0; 1688 | virtual OP_ParAppendResult appendInt(const OP_NumericParameter &np, int32_t size = 1) = 0; 1689 | 1690 | virtual OP_ParAppendResult appendXY(const OP_NumericParameter &np) = 0; 1691 | virtual OP_ParAppendResult appendXYZ(const OP_NumericParameter &np) = 0; 1692 | 1693 | virtual OP_ParAppendResult appendUV(const OP_NumericParameter &np) = 0; 1694 | virtual OP_ParAppendResult appendUVW(const OP_NumericParameter &np) = 0; 1695 | 1696 | virtual OP_ParAppendResult appendRGB(const OP_NumericParameter &np) = 0; 1697 | virtual OP_ParAppendResult appendRGBA(const OP_NumericParameter &np) = 0; 1698 | 1699 | virtual OP_ParAppendResult appendToggle(const OP_NumericParameter &np) = 0; 1700 | virtual OP_ParAppendResult appendPulse(const OP_NumericParameter &np) = 0; 1701 | 1702 | virtual OP_ParAppendResult appendString(const OP_StringParameter &sp) = 0; 1703 | virtual OP_ParAppendResult appendFile(const OP_StringParameter &sp) = 0; 1704 | virtual OP_ParAppendResult appendFolder(const OP_StringParameter &sp) = 0; 1705 | 1706 | virtual OP_ParAppendResult appendDAT(const OP_StringParameter &sp) = 0; 1707 | virtual OP_ParAppendResult appendCHOP(const OP_StringParameter &sp) = 0; 1708 | virtual OP_ParAppendResult appendTOP(const OP_StringParameter &sp) = 0; 1709 | virtual OP_ParAppendResult appendObject(const OP_StringParameter &sp) = 0; 1710 | // appendSOP() located further down in the class 1711 | 1712 | 1713 | // Any char* values passed are copied immediately by the append parameter functions, 1714 | // and do not need to be retained by the calling function. 1715 | virtual OP_ParAppendResult appendMenu(const OP_StringParameter &sp, 1716 | int32_t nitems, const char **names, 1717 | const char **labels) = 0; 1718 | 1719 | // Any char* values passed are copied immediately by the append parameter functions, 1720 | // and do not need to be retained by the calling function. 1721 | virtual OP_ParAppendResult appendStringMenu(const OP_StringParameter &sp, 1722 | int32_t nitems, const char **names, 1723 | const char **labels) = 0; 1724 | 1725 | virtual OP_ParAppendResult appendSOP(const OP_StringParameter &sp) = 0; 1726 | 1727 | // To use Python in your Plugin you need to fill the 1728 | // customOPInfo.pythonVersion member in Fill*PluginInfo. 1729 | virtual OP_ParAppendResult appendPython(const OP_StringParameter &sp) = 0; 1730 | 1731 | virtual OP_ParAppendResult appendOP(const OP_StringParameter &sp) = 0; 1732 | virtual OP_ParAppendResult appendCOMP(const OP_StringParameter &sp) = 0; 1733 | virtual OP_ParAppendResult appendMAT(const OP_StringParameter &sp) = 0; 1734 | virtual OP_ParAppendResult appendPanelCOMP(const OP_StringParameter &sp) = 0; 1735 | 1736 | virtual OP_ParAppendResult appendHeader(const OP_StringParameter &np) = 0; 1737 | virtual OP_ParAppendResult appendMomentary(const OP_NumericParameter &np) = 0; 1738 | virtual OP_ParAppendResult appendWH(const OP_NumericParameter &np) = 0; 1739 | 1740 | // The buildDynamicMenu() function will be called in your class instance when required, allowing you to 1741 | // fill the menu with custom entries based on other parameters or external state (such as available devices). 1742 | virtual OP_ParAppendResult appendDynamicStringMenu(const OP_StringParameter &sp) = 0; 1743 | virtual OP_ParAppendResult appendDynamicMenu(const OP_StringParameter &sp) = 0; 1744 | 1745 | }; 1746 | 1747 | #pragma pack(pop) 1748 | 1749 | static_assert(offsetof(OP_CustomOPInfo, opType) == 0, "Incorrect Alignment"); 1750 | static_assert(offsetof(OP_CustomOPInfo, opLabel) == 8, "Incorrect Alignment"); 1751 | static_assert(offsetof(OP_CustomOPInfo, opIcon) == 16, "Incorrect Alignment"); 1752 | static_assert(offsetof(OP_CustomOPInfo, minInputs) == 24, "Incorrect Alignment"); 1753 | static_assert(offsetof(OP_CustomOPInfo, maxInputs) == 28, "Incorrect Alignment"); 1754 | static_assert(offsetof(OP_CustomOPInfo, authorName) == 32, "Incorrect Alignment"); 1755 | static_assert(offsetof(OP_CustomOPInfo, authorEmail) == 40, "Incorrect Alignment"); 1756 | static_assert(offsetof(OP_CustomOPInfo, majorVersion) == 48, "Incorrect Alignment"); 1757 | static_assert(offsetof(OP_CustomOPInfo, minorVersion) == 52, "Incorrect Alignment"); 1758 | static_assert(sizeof(OP_CustomOPInfo) == 456, "Incorrect Size"); 1759 | 1760 | static_assert(offsetof(OP_NodeInfo, opPath) == 0, "Incorrect Alignment"); 1761 | static_assert(offsetof(OP_NodeInfo, opId) == 8, "Incorrect Alignment"); 1762 | #ifdef _WIN32 1763 | static_assert(offsetof(OP_NodeInfo, mainWindowHandle) == 16, "Incorrect Alignment"); 1764 | static_assert(sizeof(OP_NodeInfo) == 104, "Incorrect Size"); 1765 | #else 1766 | static_assert(sizeof(OP_NodeInfo) == 96, "Incorrect Size"); 1767 | #endif 1768 | 1769 | static_assert(offsetof(OP_DATInput, opPath) == 0, "Incorrect Alignment"); 1770 | static_assert(offsetof(OP_DATInput, opId) == 8, "Incorrect Alignment"); 1771 | static_assert(offsetof(OP_DATInput, numRows) == 12, "Incorrect Alignment"); 1772 | static_assert(offsetof(OP_DATInput, numCols) == 16, "Incorrect Alignment"); 1773 | static_assert(offsetof(OP_DATInput, isTable) == 20, "Incorrect Alignment"); 1774 | static_assert(offsetof(OP_DATInput, cellData) == 24, "Incorrect Alignment"); 1775 | static_assert(offsetof(OP_DATInput, totalCooks) == 32, "Incorrect Alignment"); 1776 | static_assert(sizeof(OP_DATInput) == 112, "Incorrect Size"); 1777 | 1778 | static_assert(offsetof(OP_TOPInput, opPath) == 8, "Incorrect Alignment"); 1779 | static_assert(offsetof(OP_TOPInput, opId) == 16, "Incorrect Alignment"); 1780 | static_assert(offsetof(OP_TOPInput, textureDesc) == 20, "Incorrect Alignment"); 1781 | static_assert(offsetof(OP_TOPInput, totalCooks) == 156 + 20, "Incorrect Alignment"); 1782 | static_assert(sizeof(OP_TOPInput) == 156 + 28 + 56, "Incorrect Size"); 1783 | 1784 | static_assert(offsetof(OP_CHOPInput, opPath) == 0, "Incorrect Alignment"); 1785 | static_assert(offsetof(OP_CHOPInput, opId) == 8, "Incorrect Alignment"); 1786 | static_assert(offsetof(OP_CHOPInput, numChannels) == 12, "Incorrect Alignment"); 1787 | static_assert(offsetof(OP_CHOPInput, numSamples) == 16, "Incorrect Alignment"); 1788 | static_assert(offsetof(OP_CHOPInput, sampleRate) == 24, "Incorrect Alignment"); 1789 | static_assert(offsetof(OP_CHOPInput, startIndex) == 32, "Incorrect Alignment"); 1790 | static_assert(offsetof(OP_CHOPInput, channelData) == 40, "Incorrect Alignment"); 1791 | static_assert(offsetof(OP_CHOPInput, nameData) == 48, "Incorrect Alignment"); 1792 | static_assert(offsetof(OP_CHOPInput, totalCooks) == 56, "Incorrect Alignment"); 1793 | static_assert(sizeof(OP_CHOPInput) == 136, "Incorrect Size"); 1794 | 1795 | static_assert(offsetof(OP_ObjectInput, opPath) == 0, "Incorrect Alignment"); 1796 | static_assert(offsetof(OP_ObjectInput, opId) == 8, "Incorrect Alignment"); 1797 | static_assert(offsetof(OP_ObjectInput, worldTransform) == 16, "Incorrect Alignment"); 1798 | static_assert(offsetof(OP_ObjectInput, localTransform) == 144, "Incorrect Alignment"); 1799 | static_assert(offsetof(OP_ObjectInput, totalCooks) == 272, "Incorrect Alignment"); 1800 | static_assert(sizeof(OP_ObjectInput) == 352, "Incorrect Size"); 1801 | 1802 | static_assert(offsetof(Position, x) == 0, "Incorrect Alignment"); 1803 | static_assert(offsetof(Position, y) == 4, "Incorrect Alignment"); 1804 | static_assert(offsetof(Position, z) == 8, "Incorrect Alignment"); 1805 | static_assert(sizeof(Position) == 12, "Incorrect Size"); 1806 | 1807 | static_assert(offsetof(Vector, x) == 0, "Incorrect Alignment"); 1808 | static_assert(offsetof(Vector, y) == 4, "Incorrect Alignment"); 1809 | static_assert(offsetof(Vector, z) == 8, "Incorrect Alignment"); 1810 | static_assert(sizeof(Vector) == 12, "Incorrect Size"); 1811 | 1812 | static_assert(offsetof(Color, r) == 0, "Incorrect Alignment"); 1813 | static_assert(offsetof(Color, g) == 4, "Incorrect Alignment"); 1814 | static_assert(offsetof(Color, b) == 8, "Incorrect Alignment"); 1815 | static_assert(offsetof(Color, a) == 12, "Incorrect Alignment"); 1816 | static_assert(sizeof(Color) == 16, "Incorrect Size"); 1817 | 1818 | static_assert(offsetof(TexCoord, u) == 0, "Incorrect Alignment"); 1819 | static_assert(offsetof(TexCoord, v) == 4, "Incorrect Alignment"); 1820 | static_assert(offsetof(TexCoord, w) == 8, "Incorrect Alignment"); 1821 | static_assert(sizeof(TexCoord) == 12, "Incorrect Size"); 1822 | 1823 | static_assert(offsetof(SOP_NormalInfo, numNormals) == 0, "Incorrect Alignment"); 1824 | static_assert(offsetof(SOP_NormalInfo, attribSet) == 4, "Incorrect Alignment"); 1825 | static_assert(offsetof(SOP_NormalInfo, normals) == 8, "Incorrect Alignment"); 1826 | static_assert(sizeof(SOP_NormalInfo) == 16, "Incorrect Size"); 1827 | 1828 | static_assert(offsetof(SOP_ColorInfo, numColors) == 0, "Incorrect Alignment"); 1829 | static_assert(offsetof(SOP_ColorInfo, attribSet) == 4, "Incorrect Alignment"); 1830 | static_assert(offsetof(SOP_ColorInfo, colors) == 8, "Incorrect Alignment"); 1831 | static_assert(sizeof(SOP_ColorInfo) == 16, "Incorrect Size"); 1832 | 1833 | static_assert(offsetof(SOP_TextureInfo, numTextures) == 0, "Incorrect Alignment"); 1834 | static_assert(offsetof(SOP_TextureInfo, attribSet) == 4, "Incorrect Alignment"); 1835 | static_assert(offsetof(SOP_TextureInfo, textures) == 8, "Incorrect Alignment"); 1836 | static_assert(offsetof(SOP_TextureInfo, numTextureLayers) == 16, "Incorrect Alignment"); 1837 | static_assert(sizeof(SOP_TextureInfo) == 24, "Incorrect Size"); 1838 | 1839 | static_assert(offsetof(SOP_CustomAttribData, name) == 0, "Incorrect Alignment"); 1840 | static_assert(offsetof(SOP_CustomAttribData, numComponents) == 8, "Incorrect Alignment"); 1841 | static_assert(offsetof(SOP_CustomAttribData, attribType) == 12, "Incorrect Alignment"); 1842 | static_assert(offsetof(SOP_CustomAttribData, floatData) == 16, "Incorrect Alignment"); 1843 | static_assert(offsetof(SOP_CustomAttribData, intData) == 24, "Incorrect Alignment"); 1844 | static_assert(sizeof(SOP_CustomAttribData) == 32, "Incorrect Size"); 1845 | 1846 | static_assert(offsetof(SOP_PrimitiveInfo, numVertices) == 0, "Incorrect Alignment"); 1847 | static_assert(offsetof(SOP_PrimitiveInfo, pointIndices) == 8, "Incorrect Alignment"); 1848 | static_assert(offsetof(SOP_PrimitiveInfo, type) == 16, "Incorrect Alignment"); 1849 | static_assert(offsetof(SOP_PrimitiveInfo, pointIndicesOffset) == 20, "Incorrect Alignment"); 1850 | static_assert(sizeof(SOP_PrimitiveInfo) == 24, "Incorrect Size"); 1851 | 1852 | static_assert(sizeof(OP_SOPInput) == 440, "Incorrect Size"); 1853 | 1854 | 1855 | static_assert(offsetof(OP_InfoCHOPChan, name) == 0, "Incorrect Alignment"); 1856 | static_assert(offsetof(OP_InfoCHOPChan, value) == 8, "Incorrect Alignment"); 1857 | static_assert(sizeof(OP_InfoCHOPChan) == 56, "Incorrect Size"); 1858 | 1859 | static_assert(offsetof(OP_InfoDATSize, rows) == 0, "Incorrect Alignment"); 1860 | static_assert(offsetof(OP_InfoDATSize, cols) == 4, "Incorrect Alignment"); 1861 | static_assert(offsetof(OP_InfoDATSize, byColumn) == 8, "Incorrect Alignment"); 1862 | static_assert(sizeof(OP_InfoDATSize) == 52, "Incorrect Size"); 1863 | 1864 | static_assert(offsetof(OP_InfoDATEntries, values) == 0, "Incorrect Alignment"); 1865 | static_assert(sizeof(OP_InfoDATEntries) == 48, "Incorrect Size"); 1866 | 1867 | static_assert(offsetof(OP_NumericParameter, name) == 0, "Incorrect Alignment"); 1868 | static_assert(offsetof(OP_NumericParameter, label) == 8, "Incorrect Alignment"); 1869 | static_assert(offsetof(OP_NumericParameter, page) == 16, "Incorrect Alignment"); 1870 | static_assert(offsetof(OP_NumericParameter, defaultValues) == 24, "Incorrect Alignment"); 1871 | static_assert(offsetof(OP_NumericParameter, minValues) == 56, "Incorrect Alignment"); 1872 | static_assert(offsetof(OP_NumericParameter, maxValues) == 88, "Incorrect Alignment"); 1873 | static_assert(offsetof(OP_NumericParameter, clampMins) == 120, "Incorrect Alignment"); 1874 | static_assert(offsetof(OP_NumericParameter, clampMaxes) == 124, "Incorrect Alignment"); 1875 | static_assert(offsetof(OP_NumericParameter, minSliders) == 128, "Incorrect Alignment"); 1876 | static_assert(offsetof(OP_NumericParameter, maxSliders) == 160, "Incorrect Alignment"); 1877 | static_assert(sizeof(OP_NumericParameter) == 272, "Incorrect Size"); 1878 | 1879 | static_assert(offsetof(OP_TextureDesc, width) == 0, "Incorrect Alignment"); 1880 | static_assert(offsetof(OP_TextureDesc, height) == 4, "Incorrect Alignment"); 1881 | static_assert(offsetof(OP_TextureDesc, depth) == 8, "Incorrect Alignment"); 1882 | static_assert(offsetof(OP_TextureDesc, texDim) == 12, "Incorrect Alignment"); 1883 | static_assert(offsetof(OP_TextureDesc, pixelFormat) == 16, "Incorrect Alignment"); 1884 | static_assert(offsetof(OP_TextureDesc, aspectX) == 20, "Incorrect Alignment"); 1885 | static_assert(offsetof(OP_TextureDesc, aspectY) == 24, "Incorrect Alignment"); 1886 | static_assert(sizeof(OP_TextureDesc) == 156, "Incorrect Size"); 1887 | 1888 | static_assert(offsetof(OP_StringParameter, name) == 0, "Incorrect Alignment"); 1889 | static_assert(offsetof(OP_StringParameter, label) == 8, "Incorrect Alignment"); 1890 | static_assert(offsetof(OP_StringParameter, page) == 16, "Incorrect Alignment"); 1891 | static_assert(offsetof(OP_StringParameter, defaultValue) == 24, "Incorrect Alignment"); 1892 | static_assert(sizeof(OP_StringParameter) == 112, "Incorrect Size"); 1893 | static_assert(sizeof(OP_TimeInfo) == 216, "Incorrect Size"); 1894 | static_assert(offsetof(PY_GetInfo, autoCook) == 0, "Incorrect Alignment"); 1895 | static_assert(sizeof(PY_GetInfo) == 204, "Incorrect Size"); 1896 | static_assert(sizeof(PY_Context) == 208, "Incorrect Size"); 1897 | static_assert(offsetof(PY_Struct, context) == OP_STRUCT_HEADER_ENTRIES * sizeof(int32_t), "Incorrect Alignment"); 1898 | }; 1899 | 1900 | // These are the definitions for the C-functions that are used to 1901 | // load the library and create instances of the object you define 1902 | typedef void (__cdecl *FILLCHOPPLUGININFO)(TD::CHOP_PluginInfo *info); 1903 | typedef TD::CHOP_CPlusPlusBase* (__cdecl *CREATECHOPINSTANCE)(const TD::OP_NodeInfo*); 1904 | typedef void (__cdecl *DESTROYCHOPINSTANCE)(TD::CHOP_CPlusPlusBase*); 1905 | typedef void(__cdecl *FILLDATPLUGININFO)(TD::DAT_PluginInfo *info); 1906 | typedef TD::DAT_CPlusPlusBase* (__cdecl *CREATEDATINSTANCE)(const TD::OP_NodeInfo*); 1907 | typedef void(__cdecl *DESTROYDATINSTANCE)(TD::DAT_CPlusPlusBase*); 1908 | typedef void (__cdecl *FILLTOPPLUGININFO)(TD::TOP_PluginInfo* info); 1909 | typedef TD::TOP_CPlusPlusBase* (__cdecl *CREATETOPINSTANCE)(const TD::OP_NodeInfo*, TD::TOP_Context*); 1910 | typedef void (__cdecl *DESTROYTOPINSTANCE)(TD::TOP_CPlusPlusBase*, TD::TOP_Context*); 1911 | typedef void(__cdecl *FILLSOPPLUGININFO)(TD::SOP_PluginInfo *info); 1912 | typedef TD::SOP_CPlusPlusBase* (__cdecl *CREATESOPINSTANCE)(const TD::OP_NodeInfo*); 1913 | typedef void(__cdecl *DESTROYSOPINSTANCE)(TD::SOP_CPlusPlusBase*); 1914 | 1915 | #endif 1916 | -------------------------------------------------------------------------------- /derivative/DAT_CPlusPlusBase.h: -------------------------------------------------------------------------------- 1 | /* Shared Use License: This file is owned by Derivative Inc. (Derivative) 2 | * and can only be used, and/or modified for use, in conjunction with 3 | * Derivative's TouchDesigner software, and only if you are a licensee who has 4 | * accepted Derivative's TouchDesigner license or assignment agreement 5 | * (which also govern the use of this file). You may share or redistribute 6 | * a modified version of this file provided the following conditions are met: 7 | * 8 | * 1. The shared file or redistribution must retain the information set out 9 | * above and this list of conditions. 10 | * 2. Derivative's name (Derivative Inc.) or its trademarks may not be used 11 | * to endorse or promote products derived from this file without specific 12 | * prior written permission from Derivative. 13 | */ 14 | 15 | /* 16 | * Produced by: 17 | * 18 | * Derivative Inc 19 | * 401 Richmond Street West, Unit 386 20 | * Toronto, Ontario 21 | * Canada M5V 3A8 22 | * 416-591-3555 23 | * 24 | * NAME: DAT_CPlusPlusBase.h 25 | * 26 | * 27 | * Do not edit this file directly! 28 | * Make a subclass of DAT_CPlusPlusBase instead, and add your own 29 | * data/functions. 30 | 31 | * Derivative Developers:: Make sure the virtual function order 32 | * stays the same, otherwise changes won't be backwards compatible 33 | */ 34 | //#pragma once 35 | 36 | #ifndef __DAT_CPlusPlusBase__ 37 | #define __DAT_CPlusPlusBase__ 38 | 39 | #include 40 | #include "CPlusPlus_Common.h" 41 | 42 | namespace TD 43 | { 44 | 45 | #pragma pack(push, 8) 46 | 47 | // Define for the current API version that this sample code is made for. 48 | // To upgrade to a newer version, replace the files 49 | // DAT_CPlusPlusBase.h 50 | // CPlusPlus_Common.h 51 | // from the samples folder in a newer TouchDesigner installation. 52 | // You may need to upgrade your plugin code in that case, to match 53 | // the new API requirements 54 | const int DATCPlusPlusAPIVersion = 3; 55 | 56 | class DAT_PluginInfo 57 | { 58 | public: 59 | int32_t apiVersion = 0; 60 | 61 | int32_t reserved[100]; 62 | 63 | // Information used to describe this plugin as a custom OP. 64 | OP_CustomOPInfo customOPInfo; 65 | 66 | int32_t reserved2[20]; 67 | }; 68 | 69 | class DAT_GeneralInfo 70 | { 71 | public: 72 | // Set this to true if you want the DAT to cook every frame, even 73 | // if none of it's inputs/parameters are changing. 74 | // This is generally useful for cases where the node is outputting to 75 | // something external to TouchDesigner, such as a network socket or device. 76 | // It ensures the node cooks every if nothing inside the network is using/viewing 77 | // the output of this node. 78 | // Important: 79 | // If the node may not be viewed/used by other nodes in the file, 80 | // such as a TCP network output node that isn't viewed in perform mode, 81 | // you should set cookOnStart = true in OP_CustomOPInfo. 82 | // That will ensure cooking is kick-started for this node. 83 | // Note that this fix only works for Custom Operators, not 84 | // cases where the .dll is loaded into CPlusPlus DAT. 85 | // DEFAULT: false 86 | bool cookEveryFrame; 87 | 88 | // Set this to true if you want the DAT to cook every frame, but only 89 | // if someone asks for it to cook. So if nobody is using the output from 90 | // the DAT, it won't cook. This is difereent from 'cookEveryFrame' 91 | // since that will cause it to cook every frame no matter what. 92 | // DEFAULT: false 93 | bool cookEveryFrameIfAsked; 94 | 95 | private: 96 | int32_t reserved[20]; 97 | }; 98 | 99 | enum class DAT_OutDataType 100 | { 101 | Table = 0, 102 | Text, 103 | }; 104 | 105 | class DAT_Output 106 | { 107 | public: 108 | DAT_Output() 109 | { 110 | } 111 | 112 | ~DAT_Output() 113 | { 114 | } 115 | 116 | // Set the type of output data, call this function at the very start to 117 | // specify whether a Table or Text data will be output. 118 | virtual void setOutputDataType(DAT_OutDataType type) = 0; 119 | 120 | virtual DAT_OutDataType getOutputDataType() = 0; 121 | 122 | // If the type of out data is Table, set the number of rows and columns. 123 | virtual void setTableSize(const int32_t rows, const int32_t cols) = 0; 124 | 125 | virtual void getTableSize(int32_t *rows, int32_t *cols) = 0; 126 | 127 | // If the type of out data is set to Text, 128 | // Set the whole text by calling this function. str must be UTF-8 encoded. 129 | // returns false if null argument, 130 | // or if str is contains invalid UTF-8 bytes. 131 | virtual bool setText(const char* str) = 0; 132 | 133 | // Find the row/col index with a given name. name must be UTF-8 encoded. 134 | // The hintRowIndex/hintColIndex, if given and in range, will be 135 | // checked first to see if that row/col is a match. 136 | // This can make the searching faster if the row/col headers don't change often. 137 | // Returns -1 if it cannot find the row or if rowName isn't valid UTF-8. 138 | virtual int32_t findRow(const char* rowName, int32_t hint32_tRowIndex = -1) = 0; 139 | virtual int32_t findCol(const char* colName, int32_t hintColIndex = -1) = 0; 140 | 141 | // Set the string data for each cell of the table specified by a row and column index, 142 | // Returns false if such cell doesn't exists, or if str isn't valid UTF-8. 143 | virtual bool setCellString(int32_t row, int32_t col, const char* str) = 0; 144 | 145 | // Set the int data for each cell, similar to the setCellString() but sets Int values. 146 | virtual bool setCellInt(int32_t row, int32_t col, int32_t value) = 0; 147 | 148 | // Set the data for each cell, similar to the setCellString() but sets Double values. 149 | virtual bool setCellDouble(int32_t row, int32_t col, double value) = 0; 150 | 151 | 152 | // Get the string cell data at a row and column index. 153 | // Returns null if the cell/table doesn't exist. 154 | // The memory the pointer points to is valid until the next call to 155 | // a function that changes the tabel (setCell*, setTableSize etc.) 156 | // or the end of the ::execute function. 157 | virtual const char* getCellString(int32_t row, int32_t col) = 0; 158 | 159 | // Get the int32_t cell data with a row and column index, 160 | // returns false if it cannot find the cell, or invalid argument 161 | virtual bool getCellInt(int32_t row, int32_t col, int32_t* res) = 0; 162 | 163 | // Get the double cell data with a row and column index, 164 | // returns false if it cannot find the cell, or invalid argument 165 | virtual bool getCellDouble(int32_t row, int32_t col, double* res) = 0; 166 | 167 | private: 168 | 169 | int32_t reserved[20]; 170 | }; 171 | 172 | /*** DO NOT EDIT THIS CLASS, MAKE A SUBCLASS OF IT INSTEAD ***/ 173 | class DAT_CPlusPlusBase 174 | { 175 | protected: 176 | DAT_CPlusPlusBase() 177 | { 178 | } 179 | 180 | public: 181 | virtual 182 | ~DAT_CPlusPlusBase() 183 | { 184 | } 185 | 186 | // BEGIN PUBLIC INTERFACE 187 | 188 | // Some general settings can be assigned here (if you ovierride it) 189 | 190 | virtual void 191 | getGeneralInfo(DAT_GeneralInfo*, const OP_Inputs*, void* reserved1) 192 | { 193 | } 194 | 195 | // Add geometry data such as points, normals, colors, and triangles 196 | // or particles and etc. obtained from your desired algorithm or external files. 197 | // If the "directToGPU" flag is set to false, this function is being called 198 | // instead of executeVBO(). 199 | // See the OP_Inputs class definition for more details on it's contents 200 | virtual void execute(DAT_Output*, const OP_Inputs*, void* reserved1) = 0; 201 | 202 | // Override these methods if you want to output values to the Info CHOP/DAT 203 | // returning 0 means you dont plan to output any Info CHOP channels 204 | virtual int32_t 205 | getNumInfoCHOPChans(void *reserved1) 206 | { 207 | return 0; 208 | } 209 | 210 | // Specify the name and value for CHOP 'index', 211 | // by assigning something to 'name' and 'value' members of the 212 | // OP_InfoCHOPChan class pointer that is passed (it points 213 | // to a valid instance of the class already. 214 | // the 'name' pointer will initially point to nullptr 215 | // you must allocate memory or assign a constant string 216 | // to it. 217 | virtual void 218 | getInfoCHOPChan(int32_t index, OP_InfoCHOPChan* chan, void* reserved1) 219 | { 220 | } 221 | 222 | // Return false if you arn't returning data for an Info DAT 223 | // Return true if you are. 224 | // Set the members of the CHOP_InfoDATSize class to specify 225 | // the dimensions of the Info DAT 226 | virtual bool 227 | getInfoDATSize(OP_InfoDATSize* infoSize, void* reserved1) 228 | { 229 | return false; 230 | } 231 | 232 | // You are asked to assign values to the Info DAT 1 row or column at a time 233 | // The 'byColumn' variable in 'getInfoDATSize' is how you specify 234 | // if it is by column or by row. 235 | // 'index' is the row/column index 236 | // 'nEntries' is the number of entries in the row/column 237 | virtual void 238 | getInfoDATEntries(int32_t index, int32_t nEntries, 239 | OP_InfoDATEntries* entries, void* reserved1) 240 | { 241 | } 242 | 243 | // You can use this function to put the node into a warning state 244 | // with the returned string as the message. 245 | virtual void 246 | getWarningString(OP_String *warning, void *reserved1) 247 | { 248 | } 249 | 250 | // You can use this function to put the node into a error state 251 | // with the returned string as the message. 252 | virtual void 253 | getErrorString(OP_String *error, void *reserved1) 254 | { 255 | } 256 | 257 | // Use this function to return some text that will show up in the 258 | // info popup (when you middle click on a node) 259 | virtual void 260 | getInfoPopupString(OP_String *info, void *reserved1) 261 | { 262 | } 263 | 264 | // Override these methods if you want to define specfic parameters 265 | virtual void 266 | setupParameters(OP_ParameterManager* manager, void* reserved1) 267 | { 268 | } 269 | 270 | // This is called whenever a pulse parameter is pressed 271 | virtual void 272 | pulsePressed(const char* name, void* reserved1) 273 | { 274 | } 275 | 276 | // This is called whenever a dynamic menu type custom parameter needs to have it's content's 277 | // updated. It may happen often, so this could should be efficient. 278 | virtual void 279 | buildDynamicMenu(const OP_Inputs* inputs, OP_BuildDynamicMenuInfo* info, void* reserved1) 280 | { 281 | } 282 | 283 | // END PUBLIC INTERFACE 284 | 285 | private: 286 | 287 | // Reserved for future features 288 | virtual int32_t reservedFunc6() { return 0; } 289 | virtual int32_t reservedFunc7() { return 0; } 290 | virtual int32_t reservedFunc8() { return 0; } 291 | virtual int32_t reservedFunc9() { return 0; } 292 | virtual int32_t reservedFunc10() { return 0; } 293 | virtual int32_t reservedFunc11() { return 0; } 294 | virtual int32_t reservedFunc12() { return 0; } 295 | virtual int32_t reservedFunc13() { return 0; } 296 | virtual int32_t reservedFunc14() { return 0; } 297 | virtual int32_t reservedFunc15() { return 0; } 298 | virtual int32_t reservedFunc16() { return 0; } 299 | virtual int32_t reservedFunc17() { return 0; } 300 | virtual int32_t reservedFunc18() { return 0; } 301 | virtual int32_t reservedFunc19() { return 0; } 302 | virtual int32_t reservedFunc20() { return 0; } 303 | 304 | int32_t reserved[400]; 305 | }; 306 | 307 | #pragma pack(pop) 308 | 309 | static_assert(offsetof(DAT_PluginInfo, apiVersion) == 0, "Incorrect Alignment"); 310 | static_assert(offsetof(DAT_PluginInfo, customOPInfo) == 408, "Incorrect Alignment"); 311 | static_assert(sizeof(DAT_PluginInfo) == 944, "Incorrect Size"); 312 | 313 | static_assert(offsetof(DAT_GeneralInfo, cookEveryFrame) == 0, "Incorrect Alignment"); 314 | static_assert(offsetof(DAT_GeneralInfo, cookEveryFrameIfAsked) == 1, "Incorrect Alignment"); 315 | static_assert(sizeof(DAT_GeneralInfo) == 84, "Incorrect Size"); 316 | 317 | }; // namespace TD 318 | 319 | #endif 320 | -------------------------------------------------------------------------------- /derivative/FrameQueue.cpp: -------------------------------------------------------------------------------- 1 | /* Shared Use License: This file is owned by Derivative Inc. (Derivative) 2 | * and can only be used, and/or modified for use, in conjunction with 3 | * Derivative's TouchDesigner software, and only if you are a licensee who has 4 | * accepted Derivative's TouchDesigner license or assignment agreement 5 | * (which also govern the use of this file). You may share or redistribute 6 | * a modified version of this file provided the following conditions are met: 7 | * 8 | * 1. The shared file or redistribution must retain the information set out 9 | * above and this list of conditions. 10 | * 2. Derivative's name (Derivative Inc.) or its trademarks may not be used 11 | * to endorse or promote products derived from this file without specific 12 | * prior written permission from Derivative. 13 | */ 14 | 15 | #include "FrameQueue.h" 16 | #include 17 | 18 | using namespace TD; 19 | 20 | FrameQueue::FrameQueue(TOP_Context* context) : 21 | myContext(context) 22 | { 23 | 24 | } 25 | 26 | FrameQueue::~FrameQueue() 27 | { 28 | while (!myUpdatedBuffers.empty()) 29 | { 30 | myUpdatedBuffers.pop_front(); 31 | } 32 | } 33 | 34 | const int MaxQueueSize = 2; 35 | 36 | OP_SmartRef 37 | FrameQueue::getBufferToUpdate(uint64_t byteSize, TOP_BufferFlags flags) 38 | { 39 | myLock.lock(); 40 | 41 | OP_SmartRef buf; 42 | 43 | // If we've already reached the max queue size, replace the oldest buffer 44 | // instead of requesting a new one and growing the queue even more. 45 | if (myUpdatedBuffers.size() >= MaxQueueSize) 46 | { 47 | buf = myUpdatedBuffers.front().buf; 48 | myUpdatedBuffers.pop_front(); 49 | 50 | // If the size of this buffer is way off or if the flags are wrong, 51 | // don't use it. 52 | if (buf->size < byteSize || buf->size > byteSize * 2 || buf->flags != flags) 53 | { 54 | buf.release(); 55 | } 56 | } 57 | 58 | // If we don't have a buffer yet, allocate one 59 | if (!buf) 60 | buf = myContext->createOutputBuffer(byteSize, flags, nullptr); 61 | 62 | myLock.unlock(); 63 | return buf; 64 | } 65 | 66 | void 67 | FrameQueue::updateComplete(const BufferInfo& bufInfo) 68 | { 69 | assert(bufInfo.buf); 70 | myLock.lock(); 71 | myUpdatedBuffers.push_back(bufInfo); 72 | myLock.unlock(); 73 | } 74 | 75 | void 76 | FrameQueue::updateCancelled(OP_SmartRef* buf) 77 | { 78 | myContext->returnBuffer(buf); 79 | } 80 | 81 | BufferInfo 82 | FrameQueue::getBufferToUpload() 83 | { 84 | myLock.lock(); 85 | 86 | BufferInfo buf; 87 | if (!myUpdatedBuffers.empty()) 88 | { 89 | buf = myUpdatedBuffers.front(); 90 | myUpdatedBuffers.pop_front(); 91 | } 92 | myLock.unlock(); 93 | return buf; 94 | } 95 | -------------------------------------------------------------------------------- /derivative/FrameQueue.h: -------------------------------------------------------------------------------- 1 | /* Shared Use License: This file is owned by Derivative Inc. (Derivative) 2 | * and can only be used, and/or modified for use, in conjunction with 3 | * Derivative's TouchDesigner software, and only if you are a licensee who has 4 | * accepted Derivative's TouchDesigner license or assignment agreement 5 | * (which also govern the use of this file). You may share or redistribute 6 | * a modified version of this file provided the following conditions are met: 7 | * 8 | * 1. The shared file or redistribution must retain the information set out 9 | * above and this list of conditions. 10 | * 2. Derivative's name (Derivative Inc.) or its trademarks may not be used 11 | * to endorse or promote products derived from this file without specific 12 | * prior written permission from Derivative. 13 | */ 14 | 15 | #pragma once 16 | 17 | #include 18 | #include 19 | #include 20 | 21 | #include "TOP_CPlusPlusBase.h" 22 | 23 | class BufferInfo 24 | { 25 | public: 26 | TD::OP_SmartRef buf; 27 | TD::TOP_UploadInfo uploadInfo; 28 | 29 | }; 30 | class FrameQueue 31 | { 32 | public: 33 | FrameQueue(TD::TOP_Context* context); 34 | ~FrameQueue(); 35 | 36 | // Call this to get a buffer to fill with new buffer data. 37 | // You should call either updateComplete() or updateCancelled() when done with the buffer. 38 | // You can also call release() on the buffer to say you are done with it, but that won't 39 | // allow it to be re-used for another operation later on (possibly avoiding an allocation). 40 | // This may return nullptr if there is no buffer available for update. 41 | TD::OP_SmartRef getBufferToUpdate(uint64_t byteSize, TD::TOP_BufferFlags flags); 42 | 43 | // Takes ownership of the TOP_Buffer contained in BufferInfo, don't release it externally. 44 | void updateComplete(const BufferInfo &bufInfo); 45 | 46 | // Call this to tell the class that the data from the last getBufferForUpdate() 47 | // did not get filled so it should not be queued for upload to the TOP 48 | void updateCancelled(TD::OP_SmartRef *buf); 49 | 50 | // If there is a new buffer to upload, BufferInfo.buf will not be nullptr. 51 | // You are the owner of BufferInfo.buf if this returns a non-nullptr 52 | BufferInfo getBufferToUpload(); 53 | 54 | private: 55 | std::mutex myLock; 56 | std::deque myUpdatedBuffers; 57 | 58 | TD::TOP_Context* myContext; 59 | }; 60 | -------------------------------------------------------------------------------- /derivative/GL/LICENSE.txt: -------------------------------------------------------------------------------- 1 | The OpenGL Extension Wrangler Library 2 | Copyright (C) 2002-2007, Milan Ikits 3 | Copyright (C) 2002-2007, Marcelo E. Magallon 4 | Copyright (C) 2002, Lev Povalahev 5 | All rights reserved. 6 | 7 | Redistribution and use in source and binary forms, with or without 8 | modification, are permitted provided that the following conditions are met: 9 | 10 | * Redistributions of source code must retain the above copyright notice, 11 | this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above copyright notice, 13 | this list of conditions and the following disclaimer in the documentation 14 | and/or other materials provided with the distribution. 15 | * The name of the author may be used to endorse or promote products 16 | derived from this software without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 22 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 28 | THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | 31 | Mesa 3-D graphics library 32 | Version: 7.0 33 | 34 | Copyright (C) 1999-2007 Brian Paul All Rights Reserved. 35 | 36 | Permission is hereby granted, free of charge, to any person obtaining a 37 | copy of this software and associated documentation files (the "Software"), 38 | to deal in the Software without restriction, including without limitation 39 | the rights to use, copy, modify, merge, publish, distribute, sublicense, 40 | and/or sell copies of the Software, and to permit persons to whom the 41 | Software is furnished to do so, subject to the following conditions: 42 | 43 | The above copyright notice and this permission notice shall be included 44 | in all copies or substantial portions of the Software. 45 | 46 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 47 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 48 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 49 | BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 50 | AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 51 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 52 | 53 | 54 | Copyright (c) 2007 The Khronos Group Inc. 55 | 56 | Permission is hereby granted, free of charge, to any person obtaining a 57 | copy of this software and/or associated documentation files (the 58 | "Materials"), to deal in the Materials without restriction, including 59 | without limitation the rights to use, copy, modify, merge, publish, 60 | distribute, sublicense, and/or sell copies of the Materials, and to 61 | permit persons to whom the Materials are furnished to do so, subject to 62 | the following conditions: 63 | 64 | The above copyright notice and this permission notice shall be included 65 | in all copies or substantial portions of the Materials. 66 | 67 | THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 68 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 69 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 70 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 71 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 72 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 73 | MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. 74 | -------------------------------------------------------------------------------- /derivative/GL/wglew.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** The OpenGL Extension Wrangler Library 3 | ** Copyright (C) 2008-2015, Nigel Stewart 4 | ** Copyright (C) 2002-2008, Milan Ikits 5 | ** Copyright (C) 2002-2008, Marcelo E. Magallon 6 | ** Copyright (C) 2002, Lev Povalahev 7 | ** All rights reserved. 8 | ** 9 | ** Redistribution and use in source and binary forms, with or without 10 | ** modification, are permitted provided that the following conditions are met: 11 | ** 12 | ** * Redistributions of source code must retain the above copyright notice, 13 | ** this list of conditions and the following disclaimer. 14 | ** * Redistributions in binary form must reproduce the above copyright notice, 15 | ** this list of conditions and the following disclaimer in the documentation 16 | ** and/or other materials provided with the distribution. 17 | ** * The name of the author may be used to endorse or promote products 18 | ** derived from this software without specific prior written permission. 19 | ** 20 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 | ** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 | ** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23 | ** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 24 | ** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 25 | ** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 26 | ** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 | ** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 | ** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29 | ** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 30 | ** THE POSSIBILITY OF SUCH DAMAGE. 31 | */ 32 | 33 | /* 34 | ** Copyright (c) 2007 The Khronos Group Inc. 35 | ** 36 | ** Permission is hereby granted, free of charge, to any person obtaining a 37 | ** copy of this software and/or associated documentation files (the 38 | ** "Materials"), to deal in the Materials without restriction, including 39 | ** without limitation the rights to use, copy, modify, merge, publish, 40 | ** distribute, sublicense, and/or sell copies of the Materials, and to 41 | ** permit persons to whom the Materials are furnished to do so, subject to 42 | ** the following conditions: 43 | ** 44 | ** The above copyright notice and this permission notice shall be included 45 | ** in all copies or substantial portions of the Materials. 46 | ** 47 | ** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 48 | ** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 49 | ** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 50 | ** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 51 | ** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 52 | ** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 53 | ** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. 54 | */ 55 | 56 | #ifndef __wglew_h__ 57 | #define __wglew_h__ 58 | #define __WGLEW_H__ 59 | 60 | #ifdef __wglext_h_ 61 | #error wglext.h included before wglew.h 62 | #endif 63 | 64 | #define __wglext_h_ 65 | 66 | #if !defined(WINAPI) 67 | # ifndef WIN32_LEAN_AND_MEAN 68 | # define WIN32_LEAN_AND_MEAN 1 69 | # endif 70 | #include 71 | # undef WIN32_LEAN_AND_MEAN 72 | #endif 73 | 74 | /* 75 | * GLEW_STATIC needs to be set when using the static version. 76 | * GLEW_BUILD is set when building the DLL version. 77 | */ 78 | #ifdef GLEW_STATIC 79 | # define GLEWAPI extern 80 | #else 81 | # ifdef GLEW_BUILD 82 | # define GLEWAPI extern __declspec(dllexport) 83 | # else 84 | # define GLEWAPI extern __declspec(dllimport) 85 | # endif 86 | #endif 87 | 88 | #ifdef __cplusplus 89 | extern "C" { 90 | #endif 91 | 92 | /* -------------------------- WGL_3DFX_multisample ------------------------- */ 93 | 94 | #ifndef WGL_3DFX_multisample 95 | #define WGL_3DFX_multisample 1 96 | 97 | #define WGL_SAMPLE_BUFFERS_3DFX 0x2060 98 | #define WGL_SAMPLES_3DFX 0x2061 99 | 100 | #define WGLEW_3DFX_multisample WGLEW_GET_VAR(__WGLEW_3DFX_multisample) 101 | 102 | #endif /* WGL_3DFX_multisample */ 103 | 104 | /* ------------------------- WGL_3DL_stereo_control ------------------------ */ 105 | 106 | #ifndef WGL_3DL_stereo_control 107 | #define WGL_3DL_stereo_control 1 108 | 109 | #define WGL_STEREO_EMITTER_ENABLE_3DL 0x2055 110 | #define WGL_STEREO_EMITTER_DISABLE_3DL 0x2056 111 | #define WGL_STEREO_POLARITY_NORMAL_3DL 0x2057 112 | #define WGL_STEREO_POLARITY_INVERT_3DL 0x2058 113 | 114 | typedef BOOL (WINAPI * PFNWGLSETSTEREOEMITTERSTATE3DLPROC) (HDC hDC, UINT uState); 115 | 116 | #define wglSetStereoEmitterState3DL WGLEW_GET_FUN(__wglewSetStereoEmitterState3DL) 117 | 118 | #define WGLEW_3DL_stereo_control WGLEW_GET_VAR(__WGLEW_3DL_stereo_control) 119 | 120 | #endif /* WGL_3DL_stereo_control */ 121 | 122 | /* ------------------------ WGL_AMD_gpu_association ------------------------ */ 123 | 124 | #ifndef WGL_AMD_gpu_association 125 | #define WGL_AMD_gpu_association 1 126 | 127 | #define WGL_GPU_VENDOR_AMD 0x1F00 128 | #define WGL_GPU_RENDERER_STRING_AMD 0x1F01 129 | #define WGL_GPU_OPENGL_VERSION_STRING_AMD 0x1F02 130 | #define WGL_GPU_FASTEST_TARGET_GPUS_AMD 0x21A2 131 | #define WGL_GPU_RAM_AMD 0x21A3 132 | #define WGL_GPU_CLOCK_AMD 0x21A4 133 | #define WGL_GPU_NUM_PIPES_AMD 0x21A5 134 | #define WGL_GPU_NUM_SIMD_AMD 0x21A6 135 | #define WGL_GPU_NUM_RB_AMD 0x21A7 136 | #define WGL_GPU_NUM_SPI_AMD 0x21A8 137 | 138 | typedef VOID (WINAPI * PFNWGLBLITCONTEXTFRAMEBUFFERAMDPROC) (HGLRC dstCtx, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); 139 | typedef HGLRC (WINAPI * PFNWGLCREATEASSOCIATEDCONTEXTAMDPROC) (UINT id); 140 | typedef HGLRC (WINAPI * PFNWGLCREATEASSOCIATEDCONTEXTATTRIBSAMDPROC) (UINT id, HGLRC hShareContext, const int* attribList); 141 | typedef BOOL (WINAPI * PFNWGLDELETEASSOCIATEDCONTEXTAMDPROC) (HGLRC hglrc); 142 | typedef UINT (WINAPI * PFNWGLGETCONTEXTGPUIDAMDPROC) (HGLRC hglrc); 143 | typedef HGLRC (WINAPI * PFNWGLGETCURRENTASSOCIATEDCONTEXTAMDPROC) (void); 144 | typedef UINT (WINAPI * PFNWGLGETGPUIDSAMDPROC) (UINT maxCount, UINT* ids); 145 | typedef INT (WINAPI * PFNWGLGETGPUINFOAMDPROC) (UINT id, INT property, GLenum dataType, UINT size, void* data); 146 | typedef BOOL (WINAPI * PFNWGLMAKEASSOCIATEDCONTEXTCURRENTAMDPROC) (HGLRC hglrc); 147 | 148 | #define wglBlitContextFramebufferAMD WGLEW_GET_FUN(__wglewBlitContextFramebufferAMD) 149 | #define wglCreateAssociatedContextAMD WGLEW_GET_FUN(__wglewCreateAssociatedContextAMD) 150 | #define wglCreateAssociatedContextAttribsAMD WGLEW_GET_FUN(__wglewCreateAssociatedContextAttribsAMD) 151 | #define wglDeleteAssociatedContextAMD WGLEW_GET_FUN(__wglewDeleteAssociatedContextAMD) 152 | #define wglGetContextGPUIDAMD WGLEW_GET_FUN(__wglewGetContextGPUIDAMD) 153 | #define wglGetCurrentAssociatedContextAMD WGLEW_GET_FUN(__wglewGetCurrentAssociatedContextAMD) 154 | #define wglGetGPUIDsAMD WGLEW_GET_FUN(__wglewGetGPUIDsAMD) 155 | #define wglGetGPUInfoAMD WGLEW_GET_FUN(__wglewGetGPUInfoAMD) 156 | #define wglMakeAssociatedContextCurrentAMD WGLEW_GET_FUN(__wglewMakeAssociatedContextCurrentAMD) 157 | 158 | #define WGLEW_AMD_gpu_association WGLEW_GET_VAR(__WGLEW_AMD_gpu_association) 159 | 160 | #endif /* WGL_AMD_gpu_association */ 161 | 162 | /* ------------------------- WGL_ARB_buffer_region ------------------------- */ 163 | 164 | #ifndef WGL_ARB_buffer_region 165 | #define WGL_ARB_buffer_region 1 166 | 167 | #define WGL_FRONT_COLOR_BUFFER_BIT_ARB 0x00000001 168 | #define WGL_BACK_COLOR_BUFFER_BIT_ARB 0x00000002 169 | #define WGL_DEPTH_BUFFER_BIT_ARB 0x00000004 170 | #define WGL_STENCIL_BUFFER_BIT_ARB 0x00000008 171 | 172 | typedef HANDLE (WINAPI * PFNWGLCREATEBUFFERREGIONARBPROC) (HDC hDC, int iLayerPlane, UINT uType); 173 | typedef VOID (WINAPI * PFNWGLDELETEBUFFERREGIONARBPROC) (HANDLE hRegion); 174 | typedef BOOL (WINAPI * PFNWGLRESTOREBUFFERREGIONARBPROC) (HANDLE hRegion, int x, int y, int width, int height, int xSrc, int ySrc); 175 | typedef BOOL (WINAPI * PFNWGLSAVEBUFFERREGIONARBPROC) (HANDLE hRegion, int x, int y, int width, int height); 176 | 177 | #define wglCreateBufferRegionARB WGLEW_GET_FUN(__wglewCreateBufferRegionARB) 178 | #define wglDeleteBufferRegionARB WGLEW_GET_FUN(__wglewDeleteBufferRegionARB) 179 | #define wglRestoreBufferRegionARB WGLEW_GET_FUN(__wglewRestoreBufferRegionARB) 180 | #define wglSaveBufferRegionARB WGLEW_GET_FUN(__wglewSaveBufferRegionARB) 181 | 182 | #define WGLEW_ARB_buffer_region WGLEW_GET_VAR(__WGLEW_ARB_buffer_region) 183 | 184 | #endif /* WGL_ARB_buffer_region */ 185 | 186 | /* --------------------- WGL_ARB_context_flush_control --------------------- */ 187 | 188 | #ifndef WGL_ARB_context_flush_control 189 | #define WGL_ARB_context_flush_control 1 190 | 191 | #define WGL_CONTEXT_RELEASE_BEHAVIOR_NONE_ARB 0x0000 192 | #define WGL_CONTEXT_RELEASE_BEHAVIOR_ARB 0x2097 193 | #define WGL_CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB 0x2098 194 | 195 | #define WGLEW_ARB_context_flush_control WGLEW_GET_VAR(__WGLEW_ARB_context_flush_control) 196 | 197 | #endif /* WGL_ARB_context_flush_control */ 198 | 199 | /* ------------------------- WGL_ARB_create_context ------------------------ */ 200 | 201 | #ifndef WGL_ARB_create_context 202 | #define WGL_ARB_create_context 1 203 | 204 | #define WGL_CONTEXT_DEBUG_BIT_ARB 0x0001 205 | #define WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x0002 206 | #define WGL_CONTEXT_MAJOR_VERSION_ARB 0x2091 207 | #define WGL_CONTEXT_MINOR_VERSION_ARB 0x2092 208 | #define WGL_CONTEXT_LAYER_PLANE_ARB 0x2093 209 | #define WGL_CONTEXT_FLAGS_ARB 0x2094 210 | #define ERROR_INVALID_VERSION_ARB 0x2095 211 | #define ERROR_INVALID_PROFILE_ARB 0x2096 212 | 213 | typedef HGLRC (WINAPI * PFNWGLCREATECONTEXTATTRIBSARBPROC) (HDC hDC, HGLRC hShareContext, const int* attribList); 214 | 215 | #define wglCreateContextAttribsARB WGLEW_GET_FUN(__wglewCreateContextAttribsARB) 216 | 217 | #define WGLEW_ARB_create_context WGLEW_GET_VAR(__WGLEW_ARB_create_context) 218 | 219 | #endif /* WGL_ARB_create_context */ 220 | 221 | /* --------------------- WGL_ARB_create_context_profile -------------------- */ 222 | 223 | #ifndef WGL_ARB_create_context_profile 224 | #define WGL_ARB_create_context_profile 1 225 | 226 | #define WGL_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001 227 | #define WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB 0x00000002 228 | #define WGL_CONTEXT_PROFILE_MASK_ARB 0x9126 229 | 230 | #define WGLEW_ARB_create_context_profile WGLEW_GET_VAR(__WGLEW_ARB_create_context_profile) 231 | 232 | #endif /* WGL_ARB_create_context_profile */ 233 | 234 | /* ------------------- WGL_ARB_create_context_robustness ------------------- */ 235 | 236 | #ifndef WGL_ARB_create_context_robustness 237 | #define WGL_ARB_create_context_robustness 1 238 | 239 | #define WGL_CONTEXT_ROBUST_ACCESS_BIT_ARB 0x00000004 240 | #define WGL_LOSE_CONTEXT_ON_RESET_ARB 0x8252 241 | #define WGL_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB 0x8256 242 | #define WGL_NO_RESET_NOTIFICATION_ARB 0x8261 243 | 244 | #define WGLEW_ARB_create_context_robustness WGLEW_GET_VAR(__WGLEW_ARB_create_context_robustness) 245 | 246 | #endif /* WGL_ARB_create_context_robustness */ 247 | 248 | /* ----------------------- WGL_ARB_extensions_string ----------------------- */ 249 | 250 | #ifndef WGL_ARB_extensions_string 251 | #define WGL_ARB_extensions_string 1 252 | 253 | typedef const char* (WINAPI * PFNWGLGETEXTENSIONSSTRINGARBPROC) (HDC hdc); 254 | 255 | #define wglGetExtensionsStringARB WGLEW_GET_FUN(__wglewGetExtensionsStringARB) 256 | 257 | #define WGLEW_ARB_extensions_string WGLEW_GET_VAR(__WGLEW_ARB_extensions_string) 258 | 259 | #endif /* WGL_ARB_extensions_string */ 260 | 261 | /* ------------------------ WGL_ARB_framebuffer_sRGB ----------------------- */ 262 | 263 | #ifndef WGL_ARB_framebuffer_sRGB 264 | #define WGL_ARB_framebuffer_sRGB 1 265 | 266 | #define WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB 0x20A9 267 | 268 | #define WGLEW_ARB_framebuffer_sRGB WGLEW_GET_VAR(__WGLEW_ARB_framebuffer_sRGB) 269 | 270 | #endif /* WGL_ARB_framebuffer_sRGB */ 271 | 272 | /* ----------------------- WGL_ARB_make_current_read ----------------------- */ 273 | 274 | #ifndef WGL_ARB_make_current_read 275 | #define WGL_ARB_make_current_read 1 276 | 277 | #define ERROR_INVALID_PIXEL_TYPE_ARB 0x2043 278 | #define ERROR_INCOMPATIBLE_DEVICE_CONTEXTS_ARB 0x2054 279 | 280 | typedef HDC (WINAPI * PFNWGLGETCURRENTREADDCARBPROC) (VOID); 281 | typedef BOOL (WINAPI * PFNWGLMAKECONTEXTCURRENTARBPROC) (HDC hDrawDC, HDC hReadDC, HGLRC hglrc); 282 | 283 | #define wglGetCurrentReadDCARB WGLEW_GET_FUN(__wglewGetCurrentReadDCARB) 284 | #define wglMakeContextCurrentARB WGLEW_GET_FUN(__wglewMakeContextCurrentARB) 285 | 286 | #define WGLEW_ARB_make_current_read WGLEW_GET_VAR(__WGLEW_ARB_make_current_read) 287 | 288 | #endif /* WGL_ARB_make_current_read */ 289 | 290 | /* -------------------------- WGL_ARB_multisample -------------------------- */ 291 | 292 | #ifndef WGL_ARB_multisample 293 | #define WGL_ARB_multisample 1 294 | 295 | #define WGL_SAMPLE_BUFFERS_ARB 0x2041 296 | #define WGL_SAMPLES_ARB 0x2042 297 | 298 | #define WGLEW_ARB_multisample WGLEW_GET_VAR(__WGLEW_ARB_multisample) 299 | 300 | #endif /* WGL_ARB_multisample */ 301 | 302 | /* ---------------------------- WGL_ARB_pbuffer ---------------------------- */ 303 | 304 | #ifndef WGL_ARB_pbuffer 305 | #define WGL_ARB_pbuffer 1 306 | 307 | #define WGL_DRAW_TO_PBUFFER_ARB 0x202D 308 | #define WGL_MAX_PBUFFER_PIXELS_ARB 0x202E 309 | #define WGL_MAX_PBUFFER_WIDTH_ARB 0x202F 310 | #define WGL_MAX_PBUFFER_HEIGHT_ARB 0x2030 311 | #define WGL_PBUFFER_LARGEST_ARB 0x2033 312 | #define WGL_PBUFFER_WIDTH_ARB 0x2034 313 | #define WGL_PBUFFER_HEIGHT_ARB 0x2035 314 | #define WGL_PBUFFER_LOST_ARB 0x2036 315 | 316 | DECLARE_HANDLE(HPBUFFERARB); 317 | 318 | typedef HPBUFFERARB (WINAPI * PFNWGLCREATEPBUFFERARBPROC) (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int* piAttribList); 319 | typedef BOOL (WINAPI * PFNWGLDESTROYPBUFFERARBPROC) (HPBUFFERARB hPbuffer); 320 | typedef HDC (WINAPI * PFNWGLGETPBUFFERDCARBPROC) (HPBUFFERARB hPbuffer); 321 | typedef BOOL (WINAPI * PFNWGLQUERYPBUFFERARBPROC) (HPBUFFERARB hPbuffer, int iAttribute, int* piValue); 322 | typedef int (WINAPI * PFNWGLRELEASEPBUFFERDCARBPROC) (HPBUFFERARB hPbuffer, HDC hDC); 323 | 324 | #define wglCreatePbufferARB WGLEW_GET_FUN(__wglewCreatePbufferARB) 325 | #define wglDestroyPbufferARB WGLEW_GET_FUN(__wglewDestroyPbufferARB) 326 | #define wglGetPbufferDCARB WGLEW_GET_FUN(__wglewGetPbufferDCARB) 327 | #define wglQueryPbufferARB WGLEW_GET_FUN(__wglewQueryPbufferARB) 328 | #define wglReleasePbufferDCARB WGLEW_GET_FUN(__wglewReleasePbufferDCARB) 329 | 330 | #define WGLEW_ARB_pbuffer WGLEW_GET_VAR(__WGLEW_ARB_pbuffer) 331 | 332 | #endif /* WGL_ARB_pbuffer */ 333 | 334 | /* -------------------------- WGL_ARB_pixel_format ------------------------- */ 335 | 336 | #ifndef WGL_ARB_pixel_format 337 | #define WGL_ARB_pixel_format 1 338 | 339 | #define WGL_NUMBER_PIXEL_FORMATS_ARB 0x2000 340 | #define WGL_DRAW_TO_WINDOW_ARB 0x2001 341 | #define WGL_DRAW_TO_BITMAP_ARB 0x2002 342 | #define WGL_ACCELERATION_ARB 0x2003 343 | #define WGL_NEED_PALETTE_ARB 0x2004 344 | #define WGL_NEED_SYSTEM_PALETTE_ARB 0x2005 345 | #define WGL_SWAP_LAYER_BUFFERS_ARB 0x2006 346 | #define WGL_SWAP_METHOD_ARB 0x2007 347 | #define WGL_NUMBER_OVERLAYS_ARB 0x2008 348 | #define WGL_NUMBER_UNDERLAYS_ARB 0x2009 349 | #define WGL_TRANSPARENT_ARB 0x200A 350 | #define WGL_SHARE_DEPTH_ARB 0x200C 351 | #define WGL_SHARE_STENCIL_ARB 0x200D 352 | #define WGL_SHARE_ACCUM_ARB 0x200E 353 | #define WGL_SUPPORT_GDI_ARB 0x200F 354 | #define WGL_SUPPORT_OPENGL_ARB 0x2010 355 | #define WGL_DOUBLE_BUFFER_ARB 0x2011 356 | #define WGL_STEREO_ARB 0x2012 357 | #define WGL_PIXEL_TYPE_ARB 0x2013 358 | #define WGL_COLOR_BITS_ARB 0x2014 359 | #define WGL_RED_BITS_ARB 0x2015 360 | #define WGL_RED_SHIFT_ARB 0x2016 361 | #define WGL_GREEN_BITS_ARB 0x2017 362 | #define WGL_GREEN_SHIFT_ARB 0x2018 363 | #define WGL_BLUE_BITS_ARB 0x2019 364 | #define WGL_BLUE_SHIFT_ARB 0x201A 365 | #define WGL_ALPHA_BITS_ARB 0x201B 366 | #define WGL_ALPHA_SHIFT_ARB 0x201C 367 | #define WGL_ACCUM_BITS_ARB 0x201D 368 | #define WGL_ACCUM_RED_BITS_ARB 0x201E 369 | #define WGL_ACCUM_GREEN_BITS_ARB 0x201F 370 | #define WGL_ACCUM_BLUE_BITS_ARB 0x2020 371 | #define WGL_ACCUM_ALPHA_BITS_ARB 0x2021 372 | #define WGL_DEPTH_BITS_ARB 0x2022 373 | #define WGL_STENCIL_BITS_ARB 0x2023 374 | #define WGL_AUX_BUFFERS_ARB 0x2024 375 | #define WGL_NO_ACCELERATION_ARB 0x2025 376 | #define WGL_GENERIC_ACCELERATION_ARB 0x2026 377 | #define WGL_FULL_ACCELERATION_ARB 0x2027 378 | #define WGL_SWAP_EXCHANGE_ARB 0x2028 379 | #define WGL_SWAP_COPY_ARB 0x2029 380 | #define WGL_SWAP_UNDEFINED_ARB 0x202A 381 | #define WGL_TYPE_RGBA_ARB 0x202B 382 | #define WGL_TYPE_COLORINDEX_ARB 0x202C 383 | #define WGL_TRANSPARENT_RED_VALUE_ARB 0x2037 384 | #define WGL_TRANSPARENT_GREEN_VALUE_ARB 0x2038 385 | #define WGL_TRANSPARENT_BLUE_VALUE_ARB 0x2039 386 | #define WGL_TRANSPARENT_ALPHA_VALUE_ARB 0x203A 387 | #define WGL_TRANSPARENT_INDEX_VALUE_ARB 0x203B 388 | 389 | typedef BOOL (WINAPI * PFNWGLCHOOSEPIXELFORMATARBPROC) (HDC hdc, const int* piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats); 390 | typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBFVARBPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int* piAttributes, FLOAT *pfValues); 391 | typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBIVARBPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int* piAttributes, int *piValues); 392 | 393 | #define wglChoosePixelFormatARB WGLEW_GET_FUN(__wglewChoosePixelFormatARB) 394 | #define wglGetPixelFormatAttribfvARB WGLEW_GET_FUN(__wglewGetPixelFormatAttribfvARB) 395 | #define wglGetPixelFormatAttribivARB WGLEW_GET_FUN(__wglewGetPixelFormatAttribivARB) 396 | 397 | #define WGLEW_ARB_pixel_format WGLEW_GET_VAR(__WGLEW_ARB_pixel_format) 398 | 399 | #endif /* WGL_ARB_pixel_format */ 400 | 401 | /* ----------------------- WGL_ARB_pixel_format_float ---------------------- */ 402 | 403 | #ifndef WGL_ARB_pixel_format_float 404 | #define WGL_ARB_pixel_format_float 1 405 | 406 | #define WGL_TYPE_RGBA_FLOAT_ARB 0x21A0 407 | 408 | #define WGLEW_ARB_pixel_format_float WGLEW_GET_VAR(__WGLEW_ARB_pixel_format_float) 409 | 410 | #endif /* WGL_ARB_pixel_format_float */ 411 | 412 | /* ------------------------- WGL_ARB_render_texture ------------------------ */ 413 | 414 | #ifndef WGL_ARB_render_texture 415 | #define WGL_ARB_render_texture 1 416 | 417 | #define WGL_BIND_TO_TEXTURE_RGB_ARB 0x2070 418 | #define WGL_BIND_TO_TEXTURE_RGBA_ARB 0x2071 419 | #define WGL_TEXTURE_FORMAT_ARB 0x2072 420 | #define WGL_TEXTURE_TARGET_ARB 0x2073 421 | #define WGL_MIPMAP_TEXTURE_ARB 0x2074 422 | #define WGL_TEXTURE_RGB_ARB 0x2075 423 | #define WGL_TEXTURE_RGBA_ARB 0x2076 424 | #define WGL_NO_TEXTURE_ARB 0x2077 425 | #define WGL_TEXTURE_CUBE_MAP_ARB 0x2078 426 | #define WGL_TEXTURE_1D_ARB 0x2079 427 | #define WGL_TEXTURE_2D_ARB 0x207A 428 | #define WGL_MIPMAP_LEVEL_ARB 0x207B 429 | #define WGL_CUBE_MAP_FACE_ARB 0x207C 430 | #define WGL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB 0x207D 431 | #define WGL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB 0x207E 432 | #define WGL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB 0x207F 433 | #define WGL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB 0x2080 434 | #define WGL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB 0x2081 435 | #define WGL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB 0x2082 436 | #define WGL_FRONT_LEFT_ARB 0x2083 437 | #define WGL_FRONT_RIGHT_ARB 0x2084 438 | #define WGL_BACK_LEFT_ARB 0x2085 439 | #define WGL_BACK_RIGHT_ARB 0x2086 440 | #define WGL_AUX0_ARB 0x2087 441 | #define WGL_AUX1_ARB 0x2088 442 | #define WGL_AUX2_ARB 0x2089 443 | #define WGL_AUX3_ARB 0x208A 444 | #define WGL_AUX4_ARB 0x208B 445 | #define WGL_AUX5_ARB 0x208C 446 | #define WGL_AUX6_ARB 0x208D 447 | #define WGL_AUX7_ARB 0x208E 448 | #define WGL_AUX8_ARB 0x208F 449 | #define WGL_AUX9_ARB 0x2090 450 | 451 | typedef BOOL (WINAPI * PFNWGLBINDTEXIMAGEARBPROC) (HPBUFFERARB hPbuffer, int iBuffer); 452 | typedef BOOL (WINAPI * PFNWGLRELEASETEXIMAGEARBPROC) (HPBUFFERARB hPbuffer, int iBuffer); 453 | typedef BOOL (WINAPI * PFNWGLSETPBUFFERATTRIBARBPROC) (HPBUFFERARB hPbuffer, const int* piAttribList); 454 | 455 | #define wglBindTexImageARB WGLEW_GET_FUN(__wglewBindTexImageARB) 456 | #define wglReleaseTexImageARB WGLEW_GET_FUN(__wglewReleaseTexImageARB) 457 | #define wglSetPbufferAttribARB WGLEW_GET_FUN(__wglewSetPbufferAttribARB) 458 | 459 | #define WGLEW_ARB_render_texture WGLEW_GET_VAR(__WGLEW_ARB_render_texture) 460 | 461 | #endif /* WGL_ARB_render_texture */ 462 | 463 | /* ---------------- WGL_ARB_robustness_application_isolation --------------- */ 464 | 465 | #ifndef WGL_ARB_robustness_application_isolation 466 | #define WGL_ARB_robustness_application_isolation 1 467 | 468 | #define WGL_CONTEXT_RESET_ISOLATION_BIT_ARB 0x00000008 469 | 470 | #define WGLEW_ARB_robustness_application_isolation WGLEW_GET_VAR(__WGLEW_ARB_robustness_application_isolation) 471 | 472 | #endif /* WGL_ARB_robustness_application_isolation */ 473 | 474 | /* ---------------- WGL_ARB_robustness_share_group_isolation --------------- */ 475 | 476 | #ifndef WGL_ARB_robustness_share_group_isolation 477 | #define WGL_ARB_robustness_share_group_isolation 1 478 | 479 | #define WGL_CONTEXT_RESET_ISOLATION_BIT_ARB 0x00000008 480 | 481 | #define WGLEW_ARB_robustness_share_group_isolation WGLEW_GET_VAR(__WGLEW_ARB_robustness_share_group_isolation) 482 | 483 | #endif /* WGL_ARB_robustness_share_group_isolation */ 484 | 485 | /* ----------------------- WGL_ATI_pixel_format_float ---------------------- */ 486 | 487 | #ifndef WGL_ATI_pixel_format_float 488 | #define WGL_ATI_pixel_format_float 1 489 | 490 | #define WGL_TYPE_RGBA_FLOAT_ATI 0x21A0 491 | #define GL_RGBA_FLOAT_MODE_ATI 0x8820 492 | #define GL_COLOR_CLEAR_UNCLAMPED_VALUE_ATI 0x8835 493 | 494 | #define WGLEW_ATI_pixel_format_float WGLEW_GET_VAR(__WGLEW_ATI_pixel_format_float) 495 | 496 | #endif /* WGL_ATI_pixel_format_float */ 497 | 498 | /* -------------------- WGL_ATI_render_texture_rectangle ------------------- */ 499 | 500 | #ifndef WGL_ATI_render_texture_rectangle 501 | #define WGL_ATI_render_texture_rectangle 1 502 | 503 | #define WGL_TEXTURE_RECTANGLE_ATI 0x21A5 504 | 505 | #define WGLEW_ATI_render_texture_rectangle WGLEW_GET_VAR(__WGLEW_ATI_render_texture_rectangle) 506 | 507 | #endif /* WGL_ATI_render_texture_rectangle */ 508 | 509 | /* ------------------- WGL_EXT_create_context_es2_profile ------------------ */ 510 | 511 | #ifndef WGL_EXT_create_context_es2_profile 512 | #define WGL_EXT_create_context_es2_profile 1 513 | 514 | #define WGL_CONTEXT_ES2_PROFILE_BIT_EXT 0x00000004 515 | 516 | #define WGLEW_EXT_create_context_es2_profile WGLEW_GET_VAR(__WGLEW_EXT_create_context_es2_profile) 517 | 518 | #endif /* WGL_EXT_create_context_es2_profile */ 519 | 520 | /* ------------------- WGL_EXT_create_context_es_profile ------------------- */ 521 | 522 | #ifndef WGL_EXT_create_context_es_profile 523 | #define WGL_EXT_create_context_es_profile 1 524 | 525 | #define WGL_CONTEXT_ES_PROFILE_BIT_EXT 0x00000004 526 | 527 | #define WGLEW_EXT_create_context_es_profile WGLEW_GET_VAR(__WGLEW_EXT_create_context_es_profile) 528 | 529 | #endif /* WGL_EXT_create_context_es_profile */ 530 | 531 | /* -------------------------- WGL_EXT_depth_float -------------------------- */ 532 | 533 | #ifndef WGL_EXT_depth_float 534 | #define WGL_EXT_depth_float 1 535 | 536 | #define WGL_DEPTH_FLOAT_EXT 0x2040 537 | 538 | #define WGLEW_EXT_depth_float WGLEW_GET_VAR(__WGLEW_EXT_depth_float) 539 | 540 | #endif /* WGL_EXT_depth_float */ 541 | 542 | /* ---------------------- WGL_EXT_display_color_table ---------------------- */ 543 | 544 | #ifndef WGL_EXT_display_color_table 545 | #define WGL_EXT_display_color_table 1 546 | 547 | typedef GLboolean (WINAPI * PFNWGLBINDDISPLAYCOLORTABLEEXTPROC) (GLushort id); 548 | typedef GLboolean (WINAPI * PFNWGLCREATEDISPLAYCOLORTABLEEXTPROC) (GLushort id); 549 | typedef void (WINAPI * PFNWGLDESTROYDISPLAYCOLORTABLEEXTPROC) (GLushort id); 550 | typedef GLboolean (WINAPI * PFNWGLLOADDISPLAYCOLORTABLEEXTPROC) (GLushort* table, GLuint length); 551 | 552 | #define wglBindDisplayColorTableEXT WGLEW_GET_FUN(__wglewBindDisplayColorTableEXT) 553 | #define wglCreateDisplayColorTableEXT WGLEW_GET_FUN(__wglewCreateDisplayColorTableEXT) 554 | #define wglDestroyDisplayColorTableEXT WGLEW_GET_FUN(__wglewDestroyDisplayColorTableEXT) 555 | #define wglLoadDisplayColorTableEXT WGLEW_GET_FUN(__wglewLoadDisplayColorTableEXT) 556 | 557 | #define WGLEW_EXT_display_color_table WGLEW_GET_VAR(__WGLEW_EXT_display_color_table) 558 | 559 | #endif /* WGL_EXT_display_color_table */ 560 | 561 | /* ----------------------- WGL_EXT_extensions_string ----------------------- */ 562 | 563 | #ifndef WGL_EXT_extensions_string 564 | #define WGL_EXT_extensions_string 1 565 | 566 | typedef const char* (WINAPI * PFNWGLGETEXTENSIONSSTRINGEXTPROC) (void); 567 | 568 | #define wglGetExtensionsStringEXT WGLEW_GET_FUN(__wglewGetExtensionsStringEXT) 569 | 570 | #define WGLEW_EXT_extensions_string WGLEW_GET_VAR(__WGLEW_EXT_extensions_string) 571 | 572 | #endif /* WGL_EXT_extensions_string */ 573 | 574 | /* ------------------------ WGL_EXT_framebuffer_sRGB ----------------------- */ 575 | 576 | #ifndef WGL_EXT_framebuffer_sRGB 577 | #define WGL_EXT_framebuffer_sRGB 1 578 | 579 | #define WGL_FRAMEBUFFER_SRGB_CAPABLE_EXT 0x20A9 580 | 581 | #define WGLEW_EXT_framebuffer_sRGB WGLEW_GET_VAR(__WGLEW_EXT_framebuffer_sRGB) 582 | 583 | #endif /* WGL_EXT_framebuffer_sRGB */ 584 | 585 | /* ----------------------- WGL_EXT_make_current_read ----------------------- */ 586 | 587 | #ifndef WGL_EXT_make_current_read 588 | #define WGL_EXT_make_current_read 1 589 | 590 | #define ERROR_INVALID_PIXEL_TYPE_EXT 0x2043 591 | 592 | typedef HDC (WINAPI * PFNWGLGETCURRENTREADDCEXTPROC) (VOID); 593 | typedef BOOL (WINAPI * PFNWGLMAKECONTEXTCURRENTEXTPROC) (HDC hDrawDC, HDC hReadDC, HGLRC hglrc); 594 | 595 | #define wglGetCurrentReadDCEXT WGLEW_GET_FUN(__wglewGetCurrentReadDCEXT) 596 | #define wglMakeContextCurrentEXT WGLEW_GET_FUN(__wglewMakeContextCurrentEXT) 597 | 598 | #define WGLEW_EXT_make_current_read WGLEW_GET_VAR(__WGLEW_EXT_make_current_read) 599 | 600 | #endif /* WGL_EXT_make_current_read */ 601 | 602 | /* -------------------------- WGL_EXT_multisample -------------------------- */ 603 | 604 | #ifndef WGL_EXT_multisample 605 | #define WGL_EXT_multisample 1 606 | 607 | #define WGL_SAMPLE_BUFFERS_EXT 0x2041 608 | #define WGL_SAMPLES_EXT 0x2042 609 | 610 | #define WGLEW_EXT_multisample WGLEW_GET_VAR(__WGLEW_EXT_multisample) 611 | 612 | #endif /* WGL_EXT_multisample */ 613 | 614 | /* ---------------------------- WGL_EXT_pbuffer ---------------------------- */ 615 | 616 | #ifndef WGL_EXT_pbuffer 617 | #define WGL_EXT_pbuffer 1 618 | 619 | #define WGL_DRAW_TO_PBUFFER_EXT 0x202D 620 | #define WGL_MAX_PBUFFER_PIXELS_EXT 0x202E 621 | #define WGL_MAX_PBUFFER_WIDTH_EXT 0x202F 622 | #define WGL_MAX_PBUFFER_HEIGHT_EXT 0x2030 623 | #define WGL_OPTIMAL_PBUFFER_WIDTH_EXT 0x2031 624 | #define WGL_OPTIMAL_PBUFFER_HEIGHT_EXT 0x2032 625 | #define WGL_PBUFFER_LARGEST_EXT 0x2033 626 | #define WGL_PBUFFER_WIDTH_EXT 0x2034 627 | #define WGL_PBUFFER_HEIGHT_EXT 0x2035 628 | 629 | DECLARE_HANDLE(HPBUFFEREXT); 630 | 631 | typedef HPBUFFEREXT (WINAPI * PFNWGLCREATEPBUFFEREXTPROC) (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int* piAttribList); 632 | typedef BOOL (WINAPI * PFNWGLDESTROYPBUFFEREXTPROC) (HPBUFFEREXT hPbuffer); 633 | typedef HDC (WINAPI * PFNWGLGETPBUFFERDCEXTPROC) (HPBUFFEREXT hPbuffer); 634 | typedef BOOL (WINAPI * PFNWGLQUERYPBUFFEREXTPROC) (HPBUFFEREXT hPbuffer, int iAttribute, int* piValue); 635 | typedef int (WINAPI * PFNWGLRELEASEPBUFFERDCEXTPROC) (HPBUFFEREXT hPbuffer, HDC hDC); 636 | 637 | #define wglCreatePbufferEXT WGLEW_GET_FUN(__wglewCreatePbufferEXT) 638 | #define wglDestroyPbufferEXT WGLEW_GET_FUN(__wglewDestroyPbufferEXT) 639 | #define wglGetPbufferDCEXT WGLEW_GET_FUN(__wglewGetPbufferDCEXT) 640 | #define wglQueryPbufferEXT WGLEW_GET_FUN(__wglewQueryPbufferEXT) 641 | #define wglReleasePbufferDCEXT WGLEW_GET_FUN(__wglewReleasePbufferDCEXT) 642 | 643 | #define WGLEW_EXT_pbuffer WGLEW_GET_VAR(__WGLEW_EXT_pbuffer) 644 | 645 | #endif /* WGL_EXT_pbuffer */ 646 | 647 | /* -------------------------- WGL_EXT_pixel_format ------------------------- */ 648 | 649 | #ifndef WGL_EXT_pixel_format 650 | #define WGL_EXT_pixel_format 1 651 | 652 | #define WGL_NUMBER_PIXEL_FORMATS_EXT 0x2000 653 | #define WGL_DRAW_TO_WINDOW_EXT 0x2001 654 | #define WGL_DRAW_TO_BITMAP_EXT 0x2002 655 | #define WGL_ACCELERATION_EXT 0x2003 656 | #define WGL_NEED_PALETTE_EXT 0x2004 657 | #define WGL_NEED_SYSTEM_PALETTE_EXT 0x2005 658 | #define WGL_SWAP_LAYER_BUFFERS_EXT 0x2006 659 | #define WGL_SWAP_METHOD_EXT 0x2007 660 | #define WGL_NUMBER_OVERLAYS_EXT 0x2008 661 | #define WGL_NUMBER_UNDERLAYS_EXT 0x2009 662 | #define WGL_TRANSPARENT_EXT 0x200A 663 | #define WGL_TRANSPARENT_VALUE_EXT 0x200B 664 | #define WGL_SHARE_DEPTH_EXT 0x200C 665 | #define WGL_SHARE_STENCIL_EXT 0x200D 666 | #define WGL_SHARE_ACCUM_EXT 0x200E 667 | #define WGL_SUPPORT_GDI_EXT 0x200F 668 | #define WGL_SUPPORT_OPENGL_EXT 0x2010 669 | #define WGL_DOUBLE_BUFFER_EXT 0x2011 670 | #define WGL_STEREO_EXT 0x2012 671 | #define WGL_PIXEL_TYPE_EXT 0x2013 672 | #define WGL_COLOR_BITS_EXT 0x2014 673 | #define WGL_RED_BITS_EXT 0x2015 674 | #define WGL_RED_SHIFT_EXT 0x2016 675 | #define WGL_GREEN_BITS_EXT 0x2017 676 | #define WGL_GREEN_SHIFT_EXT 0x2018 677 | #define WGL_BLUE_BITS_EXT 0x2019 678 | #define WGL_BLUE_SHIFT_EXT 0x201A 679 | #define WGL_ALPHA_BITS_EXT 0x201B 680 | #define WGL_ALPHA_SHIFT_EXT 0x201C 681 | #define WGL_ACCUM_BITS_EXT 0x201D 682 | #define WGL_ACCUM_RED_BITS_EXT 0x201E 683 | #define WGL_ACCUM_GREEN_BITS_EXT 0x201F 684 | #define WGL_ACCUM_BLUE_BITS_EXT 0x2020 685 | #define WGL_ACCUM_ALPHA_BITS_EXT 0x2021 686 | #define WGL_DEPTH_BITS_EXT 0x2022 687 | #define WGL_STENCIL_BITS_EXT 0x2023 688 | #define WGL_AUX_BUFFERS_EXT 0x2024 689 | #define WGL_NO_ACCELERATION_EXT 0x2025 690 | #define WGL_GENERIC_ACCELERATION_EXT 0x2026 691 | #define WGL_FULL_ACCELERATION_EXT 0x2027 692 | #define WGL_SWAP_EXCHANGE_EXT 0x2028 693 | #define WGL_SWAP_COPY_EXT 0x2029 694 | #define WGL_SWAP_UNDEFINED_EXT 0x202A 695 | #define WGL_TYPE_RGBA_EXT 0x202B 696 | #define WGL_TYPE_COLORINDEX_EXT 0x202C 697 | 698 | typedef BOOL (WINAPI * PFNWGLCHOOSEPIXELFORMATEXTPROC) (HDC hdc, const int* piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats); 699 | typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBFVEXTPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int* piAttributes, FLOAT *pfValues); 700 | typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBIVEXTPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int* piAttributes, int *piValues); 701 | 702 | #define wglChoosePixelFormatEXT WGLEW_GET_FUN(__wglewChoosePixelFormatEXT) 703 | #define wglGetPixelFormatAttribfvEXT WGLEW_GET_FUN(__wglewGetPixelFormatAttribfvEXT) 704 | #define wglGetPixelFormatAttribivEXT WGLEW_GET_FUN(__wglewGetPixelFormatAttribivEXT) 705 | 706 | #define WGLEW_EXT_pixel_format WGLEW_GET_VAR(__WGLEW_EXT_pixel_format) 707 | 708 | #endif /* WGL_EXT_pixel_format */ 709 | 710 | /* ------------------- WGL_EXT_pixel_format_packed_float ------------------- */ 711 | 712 | #ifndef WGL_EXT_pixel_format_packed_float 713 | #define WGL_EXT_pixel_format_packed_float 1 714 | 715 | #define WGL_TYPE_RGBA_UNSIGNED_FLOAT_EXT 0x20A8 716 | 717 | #define WGLEW_EXT_pixel_format_packed_float WGLEW_GET_VAR(__WGLEW_EXT_pixel_format_packed_float) 718 | 719 | #endif /* WGL_EXT_pixel_format_packed_float */ 720 | 721 | /* -------------------------- WGL_EXT_swap_control ------------------------- */ 722 | 723 | #ifndef WGL_EXT_swap_control 724 | #define WGL_EXT_swap_control 1 725 | 726 | typedef int (WINAPI * PFNWGLGETSWAPINTERVALEXTPROC) (void); 727 | typedef BOOL (WINAPI * PFNWGLSWAPINTERVALEXTPROC) (int interval); 728 | 729 | #define wglGetSwapIntervalEXT WGLEW_GET_FUN(__wglewGetSwapIntervalEXT) 730 | #define wglSwapIntervalEXT WGLEW_GET_FUN(__wglewSwapIntervalEXT) 731 | 732 | #define WGLEW_EXT_swap_control WGLEW_GET_VAR(__WGLEW_EXT_swap_control) 733 | 734 | #endif /* WGL_EXT_swap_control */ 735 | 736 | /* ----------------------- WGL_EXT_swap_control_tear ----------------------- */ 737 | 738 | #ifndef WGL_EXT_swap_control_tear 739 | #define WGL_EXT_swap_control_tear 1 740 | 741 | #define WGLEW_EXT_swap_control_tear WGLEW_GET_VAR(__WGLEW_EXT_swap_control_tear) 742 | 743 | #endif /* WGL_EXT_swap_control_tear */ 744 | 745 | /* --------------------- WGL_I3D_digital_video_control --------------------- */ 746 | 747 | #ifndef WGL_I3D_digital_video_control 748 | #define WGL_I3D_digital_video_control 1 749 | 750 | #define WGL_DIGITAL_VIDEO_CURSOR_ALPHA_FRAMEBUFFER_I3D 0x2050 751 | #define WGL_DIGITAL_VIDEO_CURSOR_ALPHA_VALUE_I3D 0x2051 752 | #define WGL_DIGITAL_VIDEO_CURSOR_INCLUDED_I3D 0x2052 753 | #define WGL_DIGITAL_VIDEO_GAMMA_CORRECTED_I3D 0x2053 754 | 755 | typedef BOOL (WINAPI * PFNWGLGETDIGITALVIDEOPARAMETERSI3DPROC) (HDC hDC, int iAttribute, int* piValue); 756 | typedef BOOL (WINAPI * PFNWGLSETDIGITALVIDEOPARAMETERSI3DPROC) (HDC hDC, int iAttribute, const int* piValue); 757 | 758 | #define wglGetDigitalVideoParametersI3D WGLEW_GET_FUN(__wglewGetDigitalVideoParametersI3D) 759 | #define wglSetDigitalVideoParametersI3D WGLEW_GET_FUN(__wglewSetDigitalVideoParametersI3D) 760 | 761 | #define WGLEW_I3D_digital_video_control WGLEW_GET_VAR(__WGLEW_I3D_digital_video_control) 762 | 763 | #endif /* WGL_I3D_digital_video_control */ 764 | 765 | /* ----------------------------- WGL_I3D_gamma ----------------------------- */ 766 | 767 | #ifndef WGL_I3D_gamma 768 | #define WGL_I3D_gamma 1 769 | 770 | #define WGL_GAMMA_TABLE_SIZE_I3D 0x204E 771 | #define WGL_GAMMA_EXCLUDE_DESKTOP_I3D 0x204F 772 | 773 | typedef BOOL (WINAPI * PFNWGLGETGAMMATABLEI3DPROC) (HDC hDC, int iEntries, USHORT* puRed, USHORT *puGreen, USHORT *puBlue); 774 | typedef BOOL (WINAPI * PFNWGLGETGAMMATABLEPARAMETERSI3DPROC) (HDC hDC, int iAttribute, int* piValue); 775 | typedef BOOL (WINAPI * PFNWGLSETGAMMATABLEI3DPROC) (HDC hDC, int iEntries, const USHORT* puRed, const USHORT *puGreen, const USHORT *puBlue); 776 | typedef BOOL (WINAPI * PFNWGLSETGAMMATABLEPARAMETERSI3DPROC) (HDC hDC, int iAttribute, const int* piValue); 777 | 778 | #define wglGetGammaTableI3D WGLEW_GET_FUN(__wglewGetGammaTableI3D) 779 | #define wglGetGammaTableParametersI3D WGLEW_GET_FUN(__wglewGetGammaTableParametersI3D) 780 | #define wglSetGammaTableI3D WGLEW_GET_FUN(__wglewSetGammaTableI3D) 781 | #define wglSetGammaTableParametersI3D WGLEW_GET_FUN(__wglewSetGammaTableParametersI3D) 782 | 783 | #define WGLEW_I3D_gamma WGLEW_GET_VAR(__WGLEW_I3D_gamma) 784 | 785 | #endif /* WGL_I3D_gamma */ 786 | 787 | /* ---------------------------- WGL_I3D_genlock ---------------------------- */ 788 | 789 | #ifndef WGL_I3D_genlock 790 | #define WGL_I3D_genlock 1 791 | 792 | #define WGL_GENLOCK_SOURCE_MULTIVIEW_I3D 0x2044 793 | #define WGL_GENLOCK_SOURCE_EXTERNAL_SYNC_I3D 0x2045 794 | #define WGL_GENLOCK_SOURCE_EXTERNAL_FIELD_I3D 0x2046 795 | #define WGL_GENLOCK_SOURCE_EXTERNAL_TTL_I3D 0x2047 796 | #define WGL_GENLOCK_SOURCE_DIGITAL_SYNC_I3D 0x2048 797 | #define WGL_GENLOCK_SOURCE_DIGITAL_FIELD_I3D 0x2049 798 | #define WGL_GENLOCK_SOURCE_EDGE_FALLING_I3D 0x204A 799 | #define WGL_GENLOCK_SOURCE_EDGE_RISING_I3D 0x204B 800 | #define WGL_GENLOCK_SOURCE_EDGE_BOTH_I3D 0x204C 801 | 802 | typedef BOOL (WINAPI * PFNWGLDISABLEGENLOCKI3DPROC) (HDC hDC); 803 | typedef BOOL (WINAPI * PFNWGLENABLEGENLOCKI3DPROC) (HDC hDC); 804 | typedef BOOL (WINAPI * PFNWGLGENLOCKSAMPLERATEI3DPROC) (HDC hDC, UINT uRate); 805 | typedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEDELAYI3DPROC) (HDC hDC, UINT uDelay); 806 | typedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEEDGEI3DPROC) (HDC hDC, UINT uEdge); 807 | typedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEI3DPROC) (HDC hDC, UINT uSource); 808 | typedef BOOL (WINAPI * PFNWGLGETGENLOCKSAMPLERATEI3DPROC) (HDC hDC, UINT* uRate); 809 | typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEDELAYI3DPROC) (HDC hDC, UINT* uDelay); 810 | typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEEDGEI3DPROC) (HDC hDC, UINT* uEdge); 811 | typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEI3DPROC) (HDC hDC, UINT* uSource); 812 | typedef BOOL (WINAPI * PFNWGLISENABLEDGENLOCKI3DPROC) (HDC hDC, BOOL* pFlag); 813 | typedef BOOL (WINAPI * PFNWGLQUERYGENLOCKMAXSOURCEDELAYI3DPROC) (HDC hDC, UINT* uMaxLineDelay, UINT *uMaxPixelDelay); 814 | 815 | #define wglDisableGenlockI3D WGLEW_GET_FUN(__wglewDisableGenlockI3D) 816 | #define wglEnableGenlockI3D WGLEW_GET_FUN(__wglewEnableGenlockI3D) 817 | #define wglGenlockSampleRateI3D WGLEW_GET_FUN(__wglewGenlockSampleRateI3D) 818 | #define wglGenlockSourceDelayI3D WGLEW_GET_FUN(__wglewGenlockSourceDelayI3D) 819 | #define wglGenlockSourceEdgeI3D WGLEW_GET_FUN(__wglewGenlockSourceEdgeI3D) 820 | #define wglGenlockSourceI3D WGLEW_GET_FUN(__wglewGenlockSourceI3D) 821 | #define wglGetGenlockSampleRateI3D WGLEW_GET_FUN(__wglewGetGenlockSampleRateI3D) 822 | #define wglGetGenlockSourceDelayI3D WGLEW_GET_FUN(__wglewGetGenlockSourceDelayI3D) 823 | #define wglGetGenlockSourceEdgeI3D WGLEW_GET_FUN(__wglewGetGenlockSourceEdgeI3D) 824 | #define wglGetGenlockSourceI3D WGLEW_GET_FUN(__wglewGetGenlockSourceI3D) 825 | #define wglIsEnabledGenlockI3D WGLEW_GET_FUN(__wglewIsEnabledGenlockI3D) 826 | #define wglQueryGenlockMaxSourceDelayI3D WGLEW_GET_FUN(__wglewQueryGenlockMaxSourceDelayI3D) 827 | 828 | #define WGLEW_I3D_genlock WGLEW_GET_VAR(__WGLEW_I3D_genlock) 829 | 830 | #endif /* WGL_I3D_genlock */ 831 | 832 | /* -------------------------- WGL_I3D_image_buffer ------------------------- */ 833 | 834 | #ifndef WGL_I3D_image_buffer 835 | #define WGL_I3D_image_buffer 1 836 | 837 | #define WGL_IMAGE_BUFFER_MIN_ACCESS_I3D 0x00000001 838 | #define WGL_IMAGE_BUFFER_LOCK_I3D 0x00000002 839 | 840 | typedef BOOL (WINAPI * PFNWGLASSOCIATEIMAGEBUFFEREVENTSI3DPROC) (HDC hdc, HANDLE* pEvent, LPVOID *pAddress, DWORD *pSize, UINT count); 841 | typedef LPVOID (WINAPI * PFNWGLCREATEIMAGEBUFFERI3DPROC) (HDC hDC, DWORD dwSize, UINT uFlags); 842 | typedef BOOL (WINAPI * PFNWGLDESTROYIMAGEBUFFERI3DPROC) (HDC hDC, LPVOID pAddress); 843 | typedef BOOL (WINAPI * PFNWGLRELEASEIMAGEBUFFEREVENTSI3DPROC) (HDC hdc, LPVOID* pAddress, UINT count); 844 | 845 | #define wglAssociateImageBufferEventsI3D WGLEW_GET_FUN(__wglewAssociateImageBufferEventsI3D) 846 | #define wglCreateImageBufferI3D WGLEW_GET_FUN(__wglewCreateImageBufferI3D) 847 | #define wglDestroyImageBufferI3D WGLEW_GET_FUN(__wglewDestroyImageBufferI3D) 848 | #define wglReleaseImageBufferEventsI3D WGLEW_GET_FUN(__wglewReleaseImageBufferEventsI3D) 849 | 850 | #define WGLEW_I3D_image_buffer WGLEW_GET_VAR(__WGLEW_I3D_image_buffer) 851 | 852 | #endif /* WGL_I3D_image_buffer */ 853 | 854 | /* ------------------------ WGL_I3D_swap_frame_lock ------------------------ */ 855 | 856 | #ifndef WGL_I3D_swap_frame_lock 857 | #define WGL_I3D_swap_frame_lock 1 858 | 859 | typedef BOOL (WINAPI * PFNWGLDISABLEFRAMELOCKI3DPROC) (VOID); 860 | typedef BOOL (WINAPI * PFNWGLENABLEFRAMELOCKI3DPROC) (VOID); 861 | typedef BOOL (WINAPI * PFNWGLISENABLEDFRAMELOCKI3DPROC) (BOOL* pFlag); 862 | typedef BOOL (WINAPI * PFNWGLQUERYFRAMELOCKMASTERI3DPROC) (BOOL* pFlag); 863 | 864 | #define wglDisableFrameLockI3D WGLEW_GET_FUN(__wglewDisableFrameLockI3D) 865 | #define wglEnableFrameLockI3D WGLEW_GET_FUN(__wglewEnableFrameLockI3D) 866 | #define wglIsEnabledFrameLockI3D WGLEW_GET_FUN(__wglewIsEnabledFrameLockI3D) 867 | #define wglQueryFrameLockMasterI3D WGLEW_GET_FUN(__wglewQueryFrameLockMasterI3D) 868 | 869 | #define WGLEW_I3D_swap_frame_lock WGLEW_GET_VAR(__WGLEW_I3D_swap_frame_lock) 870 | 871 | #endif /* WGL_I3D_swap_frame_lock */ 872 | 873 | /* ------------------------ WGL_I3D_swap_frame_usage ----------------------- */ 874 | 875 | #ifndef WGL_I3D_swap_frame_usage 876 | #define WGL_I3D_swap_frame_usage 1 877 | 878 | typedef BOOL (WINAPI * PFNWGLBEGINFRAMETRACKINGI3DPROC) (void); 879 | typedef BOOL (WINAPI * PFNWGLENDFRAMETRACKINGI3DPROC) (void); 880 | typedef BOOL (WINAPI * PFNWGLGETFRAMEUSAGEI3DPROC) (float* pUsage); 881 | typedef BOOL (WINAPI * PFNWGLQUERYFRAMETRACKINGI3DPROC) (DWORD* pFrameCount, DWORD *pMissedFrames, float *pLastMissedUsage); 882 | 883 | #define wglBeginFrameTrackingI3D WGLEW_GET_FUN(__wglewBeginFrameTrackingI3D) 884 | #define wglEndFrameTrackingI3D WGLEW_GET_FUN(__wglewEndFrameTrackingI3D) 885 | #define wglGetFrameUsageI3D WGLEW_GET_FUN(__wglewGetFrameUsageI3D) 886 | #define wglQueryFrameTrackingI3D WGLEW_GET_FUN(__wglewQueryFrameTrackingI3D) 887 | 888 | #define WGLEW_I3D_swap_frame_usage WGLEW_GET_VAR(__WGLEW_I3D_swap_frame_usage) 889 | 890 | #endif /* WGL_I3D_swap_frame_usage */ 891 | 892 | /* --------------------------- WGL_NV_DX_interop --------------------------- */ 893 | 894 | #ifndef WGL_NV_DX_interop 895 | #define WGL_NV_DX_interop 1 896 | 897 | #define WGL_ACCESS_READ_ONLY_NV 0x0000 898 | #define WGL_ACCESS_READ_WRITE_NV 0x0001 899 | #define WGL_ACCESS_WRITE_DISCARD_NV 0x0002 900 | 901 | typedef BOOL (WINAPI * PFNWGLDXCLOSEDEVICENVPROC) (HANDLE hDevice); 902 | typedef BOOL (WINAPI * PFNWGLDXLOCKOBJECTSNVPROC) (HANDLE hDevice, GLint count, HANDLE* hObjects); 903 | typedef BOOL (WINAPI * PFNWGLDXOBJECTACCESSNVPROC) (HANDLE hObject, GLenum access); 904 | typedef HANDLE (WINAPI * PFNWGLDXOPENDEVICENVPROC) (void* dxDevice); 905 | typedef HANDLE (WINAPI * PFNWGLDXREGISTEROBJECTNVPROC) (HANDLE hDevice, void* dxObject, GLuint name, GLenum type, GLenum access); 906 | typedef BOOL (WINAPI * PFNWGLDXSETRESOURCESHAREHANDLENVPROC) (void* dxObject, HANDLE shareHandle); 907 | typedef BOOL (WINAPI * PFNWGLDXUNLOCKOBJECTSNVPROC) (HANDLE hDevice, GLint count, HANDLE* hObjects); 908 | typedef BOOL (WINAPI * PFNWGLDXUNREGISTEROBJECTNVPROC) (HANDLE hDevice, HANDLE hObject); 909 | 910 | #define wglDXCloseDeviceNV WGLEW_GET_FUN(__wglewDXCloseDeviceNV) 911 | #define wglDXLockObjectsNV WGLEW_GET_FUN(__wglewDXLockObjectsNV) 912 | #define wglDXObjectAccessNV WGLEW_GET_FUN(__wglewDXObjectAccessNV) 913 | #define wglDXOpenDeviceNV WGLEW_GET_FUN(__wglewDXOpenDeviceNV) 914 | #define wglDXRegisterObjectNV WGLEW_GET_FUN(__wglewDXRegisterObjectNV) 915 | #define wglDXSetResourceShareHandleNV WGLEW_GET_FUN(__wglewDXSetResourceShareHandleNV) 916 | #define wglDXUnlockObjectsNV WGLEW_GET_FUN(__wglewDXUnlockObjectsNV) 917 | #define wglDXUnregisterObjectNV WGLEW_GET_FUN(__wglewDXUnregisterObjectNV) 918 | 919 | #define WGLEW_NV_DX_interop WGLEW_GET_VAR(__WGLEW_NV_DX_interop) 920 | 921 | #endif /* WGL_NV_DX_interop */ 922 | 923 | /* --------------------------- WGL_NV_DX_interop2 -------------------------- */ 924 | 925 | #ifndef WGL_NV_DX_interop2 926 | #define WGL_NV_DX_interop2 1 927 | 928 | #define WGLEW_NV_DX_interop2 WGLEW_GET_VAR(__WGLEW_NV_DX_interop2) 929 | 930 | #endif /* WGL_NV_DX_interop2 */ 931 | 932 | /* --------------------------- WGL_NV_copy_image --------------------------- */ 933 | 934 | #ifndef WGL_NV_copy_image 935 | #define WGL_NV_copy_image 1 936 | 937 | typedef BOOL (WINAPI * PFNWGLCOPYIMAGESUBDATANVPROC) (HGLRC hSrcRC, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, HGLRC hDstRC, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth); 938 | 939 | #define wglCopyImageSubDataNV WGLEW_GET_FUN(__wglewCopyImageSubDataNV) 940 | 941 | #define WGLEW_NV_copy_image WGLEW_GET_VAR(__WGLEW_NV_copy_image) 942 | 943 | #endif /* WGL_NV_copy_image */ 944 | 945 | /* ------------------------ WGL_NV_delay_before_swap ----------------------- */ 946 | 947 | #ifndef WGL_NV_delay_before_swap 948 | #define WGL_NV_delay_before_swap 1 949 | 950 | typedef BOOL (WINAPI * PFNWGLDELAYBEFORESWAPNVPROC) (HDC hDC, GLfloat seconds); 951 | 952 | #define wglDelayBeforeSwapNV WGLEW_GET_FUN(__wglewDelayBeforeSwapNV) 953 | 954 | #define WGLEW_NV_delay_before_swap WGLEW_GET_VAR(__WGLEW_NV_delay_before_swap) 955 | 956 | #endif /* WGL_NV_delay_before_swap */ 957 | 958 | /* -------------------------- WGL_NV_float_buffer -------------------------- */ 959 | 960 | #ifndef WGL_NV_float_buffer 961 | #define WGL_NV_float_buffer 1 962 | 963 | #define WGL_FLOAT_COMPONENTS_NV 0x20B0 964 | #define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_R_NV 0x20B1 965 | #define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RG_NV 0x20B2 966 | #define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGB_NV 0x20B3 967 | #define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGBA_NV 0x20B4 968 | #define WGL_TEXTURE_FLOAT_R_NV 0x20B5 969 | #define WGL_TEXTURE_FLOAT_RG_NV 0x20B6 970 | #define WGL_TEXTURE_FLOAT_RGB_NV 0x20B7 971 | #define WGL_TEXTURE_FLOAT_RGBA_NV 0x20B8 972 | 973 | #define WGLEW_NV_float_buffer WGLEW_GET_VAR(__WGLEW_NV_float_buffer) 974 | 975 | #endif /* WGL_NV_float_buffer */ 976 | 977 | /* -------------------------- WGL_NV_gpu_affinity -------------------------- */ 978 | 979 | #ifndef WGL_NV_gpu_affinity 980 | #define WGL_NV_gpu_affinity 1 981 | 982 | #define WGL_ERROR_INCOMPATIBLE_AFFINITY_MASKS_NV 0x20D0 983 | #define WGL_ERROR_MISSING_AFFINITY_MASK_NV 0x20D1 984 | 985 | DECLARE_HANDLE(HGPUNV); 986 | typedef struct _GPU_DEVICE { 987 | DWORD cb; 988 | CHAR DeviceName[32]; 989 | CHAR DeviceString[128]; 990 | DWORD Flags; 991 | RECT rcVirtualScreen; 992 | } GPU_DEVICE, *PGPU_DEVICE; 993 | 994 | typedef HDC (WINAPI * PFNWGLCREATEAFFINITYDCNVPROC) (const HGPUNV *phGpuList); 995 | typedef BOOL (WINAPI * PFNWGLDELETEDCNVPROC) (HDC hdc); 996 | typedef BOOL (WINAPI * PFNWGLENUMGPUDEVICESNVPROC) (HGPUNV hGpu, UINT iDeviceIndex, PGPU_DEVICE lpGpuDevice); 997 | typedef BOOL (WINAPI * PFNWGLENUMGPUSFROMAFFINITYDCNVPROC) (HDC hAffinityDC, UINT iGpuIndex, HGPUNV *hGpu); 998 | typedef BOOL (WINAPI * PFNWGLENUMGPUSNVPROC) (UINT iGpuIndex, HGPUNV *phGpu); 999 | 1000 | #define wglCreateAffinityDCNV WGLEW_GET_FUN(__wglewCreateAffinityDCNV) 1001 | #define wglDeleteDCNV WGLEW_GET_FUN(__wglewDeleteDCNV) 1002 | #define wglEnumGpuDevicesNV WGLEW_GET_FUN(__wglewEnumGpuDevicesNV) 1003 | #define wglEnumGpusFromAffinityDCNV WGLEW_GET_FUN(__wglewEnumGpusFromAffinityDCNV) 1004 | #define wglEnumGpusNV WGLEW_GET_FUN(__wglewEnumGpusNV) 1005 | 1006 | #define WGLEW_NV_gpu_affinity WGLEW_GET_VAR(__WGLEW_NV_gpu_affinity) 1007 | 1008 | #endif /* WGL_NV_gpu_affinity */ 1009 | 1010 | /* ---------------------- WGL_NV_multisample_coverage ---------------------- */ 1011 | 1012 | #ifndef WGL_NV_multisample_coverage 1013 | #define WGL_NV_multisample_coverage 1 1014 | 1015 | #define WGL_COVERAGE_SAMPLES_NV 0x2042 1016 | #define WGL_COLOR_SAMPLES_NV 0x20B9 1017 | 1018 | #define WGLEW_NV_multisample_coverage WGLEW_GET_VAR(__WGLEW_NV_multisample_coverage) 1019 | 1020 | #endif /* WGL_NV_multisample_coverage */ 1021 | 1022 | /* -------------------------- WGL_NV_present_video ------------------------- */ 1023 | 1024 | #ifndef WGL_NV_present_video 1025 | #define WGL_NV_present_video 1 1026 | 1027 | #define WGL_NUM_VIDEO_SLOTS_NV 0x20F0 1028 | 1029 | DECLARE_HANDLE(HVIDEOOUTPUTDEVICENV); 1030 | 1031 | typedef BOOL (WINAPI * PFNWGLBINDVIDEODEVICENVPROC) (HDC hDc, unsigned int uVideoSlot, HVIDEOOUTPUTDEVICENV hVideoDevice, const int* piAttribList); 1032 | typedef int (WINAPI * PFNWGLENUMERATEVIDEODEVICESNVPROC) (HDC hDc, HVIDEOOUTPUTDEVICENV* phDeviceList); 1033 | typedef BOOL (WINAPI * PFNWGLQUERYCURRENTCONTEXTNVPROC) (int iAttribute, int* piValue); 1034 | 1035 | #define wglBindVideoDeviceNV WGLEW_GET_FUN(__wglewBindVideoDeviceNV) 1036 | #define wglEnumerateVideoDevicesNV WGLEW_GET_FUN(__wglewEnumerateVideoDevicesNV) 1037 | #define wglQueryCurrentContextNV WGLEW_GET_FUN(__wglewQueryCurrentContextNV) 1038 | 1039 | #define WGLEW_NV_present_video WGLEW_GET_VAR(__WGLEW_NV_present_video) 1040 | 1041 | #endif /* WGL_NV_present_video */ 1042 | 1043 | /* ---------------------- WGL_NV_render_depth_texture ---------------------- */ 1044 | 1045 | #ifndef WGL_NV_render_depth_texture 1046 | #define WGL_NV_render_depth_texture 1 1047 | 1048 | #define WGL_NO_TEXTURE_ARB 0x2077 1049 | #define WGL_BIND_TO_TEXTURE_DEPTH_NV 0x20A3 1050 | #define WGL_BIND_TO_TEXTURE_RECTANGLE_DEPTH_NV 0x20A4 1051 | #define WGL_DEPTH_TEXTURE_FORMAT_NV 0x20A5 1052 | #define WGL_TEXTURE_DEPTH_COMPONENT_NV 0x20A6 1053 | #define WGL_DEPTH_COMPONENT_NV 0x20A7 1054 | 1055 | #define WGLEW_NV_render_depth_texture WGLEW_GET_VAR(__WGLEW_NV_render_depth_texture) 1056 | 1057 | #endif /* WGL_NV_render_depth_texture */ 1058 | 1059 | /* -------------------- WGL_NV_render_texture_rectangle -------------------- */ 1060 | 1061 | #ifndef WGL_NV_render_texture_rectangle 1062 | #define WGL_NV_render_texture_rectangle 1 1063 | 1064 | #define WGL_BIND_TO_TEXTURE_RECTANGLE_RGB_NV 0x20A0 1065 | #define WGL_BIND_TO_TEXTURE_RECTANGLE_RGBA_NV 0x20A1 1066 | #define WGL_TEXTURE_RECTANGLE_NV 0x20A2 1067 | 1068 | #define WGLEW_NV_render_texture_rectangle WGLEW_GET_VAR(__WGLEW_NV_render_texture_rectangle) 1069 | 1070 | #endif /* WGL_NV_render_texture_rectangle */ 1071 | 1072 | /* --------------------------- WGL_NV_swap_group --------------------------- */ 1073 | 1074 | #ifndef WGL_NV_swap_group 1075 | #define WGL_NV_swap_group 1 1076 | 1077 | typedef BOOL (WINAPI * PFNWGLBINDSWAPBARRIERNVPROC) (GLuint group, GLuint barrier); 1078 | typedef BOOL (WINAPI * PFNWGLJOINSWAPGROUPNVPROC) (HDC hDC, GLuint group); 1079 | typedef BOOL (WINAPI * PFNWGLQUERYFRAMECOUNTNVPROC) (HDC hDC, GLuint* count); 1080 | typedef BOOL (WINAPI * PFNWGLQUERYMAXSWAPGROUPSNVPROC) (HDC hDC, GLuint* maxGroups, GLuint *maxBarriers); 1081 | typedef BOOL (WINAPI * PFNWGLQUERYSWAPGROUPNVPROC) (HDC hDC, GLuint* group, GLuint *barrier); 1082 | typedef BOOL (WINAPI * PFNWGLRESETFRAMECOUNTNVPROC) (HDC hDC); 1083 | 1084 | #define wglBindSwapBarrierNV WGLEW_GET_FUN(__wglewBindSwapBarrierNV) 1085 | #define wglJoinSwapGroupNV WGLEW_GET_FUN(__wglewJoinSwapGroupNV) 1086 | #define wglQueryFrameCountNV WGLEW_GET_FUN(__wglewQueryFrameCountNV) 1087 | #define wglQueryMaxSwapGroupsNV WGLEW_GET_FUN(__wglewQueryMaxSwapGroupsNV) 1088 | #define wglQuerySwapGroupNV WGLEW_GET_FUN(__wglewQuerySwapGroupNV) 1089 | #define wglResetFrameCountNV WGLEW_GET_FUN(__wglewResetFrameCountNV) 1090 | 1091 | #define WGLEW_NV_swap_group WGLEW_GET_VAR(__WGLEW_NV_swap_group) 1092 | 1093 | #endif /* WGL_NV_swap_group */ 1094 | 1095 | /* ----------------------- WGL_NV_vertex_array_range ----------------------- */ 1096 | 1097 | #ifndef WGL_NV_vertex_array_range 1098 | #define WGL_NV_vertex_array_range 1 1099 | 1100 | typedef void * (WINAPI * PFNWGLALLOCATEMEMORYNVPROC) (GLsizei size, GLfloat readFrequency, GLfloat writeFrequency, GLfloat priority); 1101 | typedef void (WINAPI * PFNWGLFREEMEMORYNVPROC) (void *pointer); 1102 | 1103 | #define wglAllocateMemoryNV WGLEW_GET_FUN(__wglewAllocateMemoryNV) 1104 | #define wglFreeMemoryNV WGLEW_GET_FUN(__wglewFreeMemoryNV) 1105 | 1106 | #define WGLEW_NV_vertex_array_range WGLEW_GET_VAR(__WGLEW_NV_vertex_array_range) 1107 | 1108 | #endif /* WGL_NV_vertex_array_range */ 1109 | 1110 | /* -------------------------- WGL_NV_video_capture ------------------------- */ 1111 | 1112 | #ifndef WGL_NV_video_capture 1113 | #define WGL_NV_video_capture 1 1114 | 1115 | #define WGL_UNIQUE_ID_NV 0x20CE 1116 | #define WGL_NUM_VIDEO_CAPTURE_SLOTS_NV 0x20CF 1117 | 1118 | DECLARE_HANDLE(HVIDEOINPUTDEVICENV); 1119 | 1120 | typedef BOOL (WINAPI * PFNWGLBINDVIDEOCAPTUREDEVICENVPROC) (UINT uVideoSlot, HVIDEOINPUTDEVICENV hDevice); 1121 | typedef UINT (WINAPI * PFNWGLENUMERATEVIDEOCAPTUREDEVICESNVPROC) (HDC hDc, HVIDEOINPUTDEVICENV* phDeviceList); 1122 | typedef BOOL (WINAPI * PFNWGLLOCKVIDEOCAPTUREDEVICENVPROC) (HDC hDc, HVIDEOINPUTDEVICENV hDevice); 1123 | typedef BOOL (WINAPI * PFNWGLQUERYVIDEOCAPTUREDEVICENVPROC) (HDC hDc, HVIDEOINPUTDEVICENV hDevice, int iAttribute, int* piValue); 1124 | typedef BOOL (WINAPI * PFNWGLRELEASEVIDEOCAPTUREDEVICENVPROC) (HDC hDc, HVIDEOINPUTDEVICENV hDevice); 1125 | 1126 | #define wglBindVideoCaptureDeviceNV WGLEW_GET_FUN(__wglewBindVideoCaptureDeviceNV) 1127 | #define wglEnumerateVideoCaptureDevicesNV WGLEW_GET_FUN(__wglewEnumerateVideoCaptureDevicesNV) 1128 | #define wglLockVideoCaptureDeviceNV WGLEW_GET_FUN(__wglewLockVideoCaptureDeviceNV) 1129 | #define wglQueryVideoCaptureDeviceNV WGLEW_GET_FUN(__wglewQueryVideoCaptureDeviceNV) 1130 | #define wglReleaseVideoCaptureDeviceNV WGLEW_GET_FUN(__wglewReleaseVideoCaptureDeviceNV) 1131 | 1132 | #define WGLEW_NV_video_capture WGLEW_GET_VAR(__WGLEW_NV_video_capture) 1133 | 1134 | #endif /* WGL_NV_video_capture */ 1135 | 1136 | /* -------------------------- WGL_NV_video_output -------------------------- */ 1137 | 1138 | #ifndef WGL_NV_video_output 1139 | #define WGL_NV_video_output 1 1140 | 1141 | #define WGL_BIND_TO_VIDEO_RGB_NV 0x20C0 1142 | #define WGL_BIND_TO_VIDEO_RGBA_NV 0x20C1 1143 | #define WGL_BIND_TO_VIDEO_RGB_AND_DEPTH_NV 0x20C2 1144 | #define WGL_VIDEO_OUT_COLOR_NV 0x20C3 1145 | #define WGL_VIDEO_OUT_ALPHA_NV 0x20C4 1146 | #define WGL_VIDEO_OUT_DEPTH_NV 0x20C5 1147 | #define WGL_VIDEO_OUT_COLOR_AND_ALPHA_NV 0x20C6 1148 | #define WGL_VIDEO_OUT_COLOR_AND_DEPTH_NV 0x20C7 1149 | #define WGL_VIDEO_OUT_FRAME 0x20C8 1150 | #define WGL_VIDEO_OUT_FIELD_1 0x20C9 1151 | #define WGL_VIDEO_OUT_FIELD_2 0x20CA 1152 | #define WGL_VIDEO_OUT_STACKED_FIELDS_1_2 0x20CB 1153 | #define WGL_VIDEO_OUT_STACKED_FIELDS_2_1 0x20CC 1154 | 1155 | DECLARE_HANDLE(HPVIDEODEV); 1156 | 1157 | typedef BOOL (WINAPI * PFNWGLBINDVIDEOIMAGENVPROC) (HPVIDEODEV hVideoDevice, HPBUFFERARB hPbuffer, int iVideoBuffer); 1158 | typedef BOOL (WINAPI * PFNWGLGETVIDEODEVICENVPROC) (HDC hDC, int numDevices, HPVIDEODEV* hVideoDevice); 1159 | typedef BOOL (WINAPI * PFNWGLGETVIDEOINFONVPROC) (HPVIDEODEV hpVideoDevice, unsigned long* pulCounterOutputPbuffer, unsigned long *pulCounterOutputVideo); 1160 | typedef BOOL (WINAPI * PFNWGLRELEASEVIDEODEVICENVPROC) (HPVIDEODEV hVideoDevice); 1161 | typedef BOOL (WINAPI * PFNWGLRELEASEVIDEOIMAGENVPROC) (HPBUFFERARB hPbuffer, int iVideoBuffer); 1162 | typedef BOOL (WINAPI * PFNWGLSENDPBUFFERTOVIDEONVPROC) (HPBUFFERARB hPbuffer, int iBufferType, unsigned long* pulCounterPbuffer, BOOL bBlock); 1163 | 1164 | #define wglBindVideoImageNV WGLEW_GET_FUN(__wglewBindVideoImageNV) 1165 | #define wglGetVideoDeviceNV WGLEW_GET_FUN(__wglewGetVideoDeviceNV) 1166 | #define wglGetVideoInfoNV WGLEW_GET_FUN(__wglewGetVideoInfoNV) 1167 | #define wglReleaseVideoDeviceNV WGLEW_GET_FUN(__wglewReleaseVideoDeviceNV) 1168 | #define wglReleaseVideoImageNV WGLEW_GET_FUN(__wglewReleaseVideoImageNV) 1169 | #define wglSendPbufferToVideoNV WGLEW_GET_FUN(__wglewSendPbufferToVideoNV) 1170 | 1171 | #define WGLEW_NV_video_output WGLEW_GET_VAR(__WGLEW_NV_video_output) 1172 | 1173 | #endif /* WGL_NV_video_output */ 1174 | 1175 | /* -------------------------- WGL_OML_sync_control ------------------------- */ 1176 | 1177 | #ifndef WGL_OML_sync_control 1178 | #define WGL_OML_sync_control 1 1179 | 1180 | typedef BOOL (WINAPI * PFNWGLGETMSCRATEOMLPROC) (HDC hdc, INT32* numerator, INT32 *denominator); 1181 | typedef BOOL (WINAPI * PFNWGLGETSYNCVALUESOMLPROC) (HDC hdc, INT64* ust, INT64 *msc, INT64 *sbc); 1182 | typedef INT64 (WINAPI * PFNWGLSWAPBUFFERSMSCOMLPROC) (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder); 1183 | typedef INT64 (WINAPI * PFNWGLSWAPLAYERBUFFERSMSCOMLPROC) (HDC hdc, INT fuPlanes, INT64 target_msc, INT64 divisor, INT64 remainder); 1184 | typedef BOOL (WINAPI * PFNWGLWAITFORMSCOMLPROC) (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder, INT64* ust, INT64 *msc, INT64 *sbc); 1185 | typedef BOOL (WINAPI * PFNWGLWAITFORSBCOMLPROC) (HDC hdc, INT64 target_sbc, INT64* ust, INT64 *msc, INT64 *sbc); 1186 | 1187 | #define wglGetMscRateOML WGLEW_GET_FUN(__wglewGetMscRateOML) 1188 | #define wglGetSyncValuesOML WGLEW_GET_FUN(__wglewGetSyncValuesOML) 1189 | #define wglSwapBuffersMscOML WGLEW_GET_FUN(__wglewSwapBuffersMscOML) 1190 | #define wglSwapLayerBuffersMscOML WGLEW_GET_FUN(__wglewSwapLayerBuffersMscOML) 1191 | #define wglWaitForMscOML WGLEW_GET_FUN(__wglewWaitForMscOML) 1192 | #define wglWaitForSbcOML WGLEW_GET_FUN(__wglewWaitForSbcOML) 1193 | 1194 | #define WGLEW_OML_sync_control WGLEW_GET_VAR(__WGLEW_OML_sync_control) 1195 | 1196 | #endif /* WGL_OML_sync_control */ 1197 | 1198 | /* ------------------------------------------------------------------------- */ 1199 | 1200 | #define WGLEW_FUN_EXPORT GLEW_FUN_EXPORT 1201 | #define WGLEW_VAR_EXPORT GLEW_VAR_EXPORT 1202 | 1203 | WGLEW_FUN_EXPORT PFNWGLSETSTEREOEMITTERSTATE3DLPROC __wglewSetStereoEmitterState3DL; 1204 | 1205 | WGLEW_FUN_EXPORT PFNWGLBLITCONTEXTFRAMEBUFFERAMDPROC __wglewBlitContextFramebufferAMD; 1206 | WGLEW_FUN_EXPORT PFNWGLCREATEASSOCIATEDCONTEXTAMDPROC __wglewCreateAssociatedContextAMD; 1207 | WGLEW_FUN_EXPORT PFNWGLCREATEASSOCIATEDCONTEXTATTRIBSAMDPROC __wglewCreateAssociatedContextAttribsAMD; 1208 | WGLEW_FUN_EXPORT PFNWGLDELETEASSOCIATEDCONTEXTAMDPROC __wglewDeleteAssociatedContextAMD; 1209 | WGLEW_FUN_EXPORT PFNWGLGETCONTEXTGPUIDAMDPROC __wglewGetContextGPUIDAMD; 1210 | WGLEW_FUN_EXPORT PFNWGLGETCURRENTASSOCIATEDCONTEXTAMDPROC __wglewGetCurrentAssociatedContextAMD; 1211 | WGLEW_FUN_EXPORT PFNWGLGETGPUIDSAMDPROC __wglewGetGPUIDsAMD; 1212 | WGLEW_FUN_EXPORT PFNWGLGETGPUINFOAMDPROC __wglewGetGPUInfoAMD; 1213 | WGLEW_FUN_EXPORT PFNWGLMAKEASSOCIATEDCONTEXTCURRENTAMDPROC __wglewMakeAssociatedContextCurrentAMD; 1214 | 1215 | WGLEW_FUN_EXPORT PFNWGLCREATEBUFFERREGIONARBPROC __wglewCreateBufferRegionARB; 1216 | WGLEW_FUN_EXPORT PFNWGLDELETEBUFFERREGIONARBPROC __wglewDeleteBufferRegionARB; 1217 | WGLEW_FUN_EXPORT PFNWGLRESTOREBUFFERREGIONARBPROC __wglewRestoreBufferRegionARB; 1218 | WGLEW_FUN_EXPORT PFNWGLSAVEBUFFERREGIONARBPROC __wglewSaveBufferRegionARB; 1219 | 1220 | WGLEW_FUN_EXPORT PFNWGLCREATECONTEXTATTRIBSARBPROC __wglewCreateContextAttribsARB; 1221 | 1222 | WGLEW_FUN_EXPORT PFNWGLGETEXTENSIONSSTRINGARBPROC __wglewGetExtensionsStringARB; 1223 | 1224 | WGLEW_FUN_EXPORT PFNWGLGETCURRENTREADDCARBPROC __wglewGetCurrentReadDCARB; 1225 | WGLEW_FUN_EXPORT PFNWGLMAKECONTEXTCURRENTARBPROC __wglewMakeContextCurrentARB; 1226 | 1227 | WGLEW_FUN_EXPORT PFNWGLCREATEPBUFFERARBPROC __wglewCreatePbufferARB; 1228 | WGLEW_FUN_EXPORT PFNWGLDESTROYPBUFFERARBPROC __wglewDestroyPbufferARB; 1229 | WGLEW_FUN_EXPORT PFNWGLGETPBUFFERDCARBPROC __wglewGetPbufferDCARB; 1230 | WGLEW_FUN_EXPORT PFNWGLQUERYPBUFFERARBPROC __wglewQueryPbufferARB; 1231 | WGLEW_FUN_EXPORT PFNWGLRELEASEPBUFFERDCARBPROC __wglewReleasePbufferDCARB; 1232 | 1233 | WGLEW_FUN_EXPORT PFNWGLCHOOSEPIXELFORMATARBPROC __wglewChoosePixelFormatARB; 1234 | WGLEW_FUN_EXPORT PFNWGLGETPIXELFORMATATTRIBFVARBPROC __wglewGetPixelFormatAttribfvARB; 1235 | WGLEW_FUN_EXPORT PFNWGLGETPIXELFORMATATTRIBIVARBPROC __wglewGetPixelFormatAttribivARB; 1236 | 1237 | WGLEW_FUN_EXPORT PFNWGLBINDTEXIMAGEARBPROC __wglewBindTexImageARB; 1238 | WGLEW_FUN_EXPORT PFNWGLRELEASETEXIMAGEARBPROC __wglewReleaseTexImageARB; 1239 | WGLEW_FUN_EXPORT PFNWGLSETPBUFFERATTRIBARBPROC __wglewSetPbufferAttribARB; 1240 | 1241 | WGLEW_FUN_EXPORT PFNWGLBINDDISPLAYCOLORTABLEEXTPROC __wglewBindDisplayColorTableEXT; 1242 | WGLEW_FUN_EXPORT PFNWGLCREATEDISPLAYCOLORTABLEEXTPROC __wglewCreateDisplayColorTableEXT; 1243 | WGLEW_FUN_EXPORT PFNWGLDESTROYDISPLAYCOLORTABLEEXTPROC __wglewDestroyDisplayColorTableEXT; 1244 | WGLEW_FUN_EXPORT PFNWGLLOADDISPLAYCOLORTABLEEXTPROC __wglewLoadDisplayColorTableEXT; 1245 | 1246 | WGLEW_FUN_EXPORT PFNWGLGETEXTENSIONSSTRINGEXTPROC __wglewGetExtensionsStringEXT; 1247 | 1248 | WGLEW_FUN_EXPORT PFNWGLGETCURRENTREADDCEXTPROC __wglewGetCurrentReadDCEXT; 1249 | WGLEW_FUN_EXPORT PFNWGLMAKECONTEXTCURRENTEXTPROC __wglewMakeContextCurrentEXT; 1250 | 1251 | WGLEW_FUN_EXPORT PFNWGLCREATEPBUFFEREXTPROC __wglewCreatePbufferEXT; 1252 | WGLEW_FUN_EXPORT PFNWGLDESTROYPBUFFEREXTPROC __wglewDestroyPbufferEXT; 1253 | WGLEW_FUN_EXPORT PFNWGLGETPBUFFERDCEXTPROC __wglewGetPbufferDCEXT; 1254 | WGLEW_FUN_EXPORT PFNWGLQUERYPBUFFEREXTPROC __wglewQueryPbufferEXT; 1255 | WGLEW_FUN_EXPORT PFNWGLRELEASEPBUFFERDCEXTPROC __wglewReleasePbufferDCEXT; 1256 | 1257 | WGLEW_FUN_EXPORT PFNWGLCHOOSEPIXELFORMATEXTPROC __wglewChoosePixelFormatEXT; 1258 | WGLEW_FUN_EXPORT PFNWGLGETPIXELFORMATATTRIBFVEXTPROC __wglewGetPixelFormatAttribfvEXT; 1259 | WGLEW_FUN_EXPORT PFNWGLGETPIXELFORMATATTRIBIVEXTPROC __wglewGetPixelFormatAttribivEXT; 1260 | 1261 | WGLEW_FUN_EXPORT PFNWGLGETSWAPINTERVALEXTPROC __wglewGetSwapIntervalEXT; 1262 | WGLEW_FUN_EXPORT PFNWGLSWAPINTERVALEXTPROC __wglewSwapIntervalEXT; 1263 | 1264 | WGLEW_FUN_EXPORT PFNWGLGETDIGITALVIDEOPARAMETERSI3DPROC __wglewGetDigitalVideoParametersI3D; 1265 | WGLEW_FUN_EXPORT PFNWGLSETDIGITALVIDEOPARAMETERSI3DPROC __wglewSetDigitalVideoParametersI3D; 1266 | 1267 | WGLEW_FUN_EXPORT PFNWGLGETGAMMATABLEI3DPROC __wglewGetGammaTableI3D; 1268 | WGLEW_FUN_EXPORT PFNWGLGETGAMMATABLEPARAMETERSI3DPROC __wglewGetGammaTableParametersI3D; 1269 | WGLEW_FUN_EXPORT PFNWGLSETGAMMATABLEI3DPROC __wglewSetGammaTableI3D; 1270 | WGLEW_FUN_EXPORT PFNWGLSETGAMMATABLEPARAMETERSI3DPROC __wglewSetGammaTableParametersI3D; 1271 | 1272 | WGLEW_FUN_EXPORT PFNWGLDISABLEGENLOCKI3DPROC __wglewDisableGenlockI3D; 1273 | WGLEW_FUN_EXPORT PFNWGLENABLEGENLOCKI3DPROC __wglewEnableGenlockI3D; 1274 | WGLEW_FUN_EXPORT PFNWGLGENLOCKSAMPLERATEI3DPROC __wglewGenlockSampleRateI3D; 1275 | WGLEW_FUN_EXPORT PFNWGLGENLOCKSOURCEDELAYI3DPROC __wglewGenlockSourceDelayI3D; 1276 | WGLEW_FUN_EXPORT PFNWGLGENLOCKSOURCEEDGEI3DPROC __wglewGenlockSourceEdgeI3D; 1277 | WGLEW_FUN_EXPORT PFNWGLGENLOCKSOURCEI3DPROC __wglewGenlockSourceI3D; 1278 | WGLEW_FUN_EXPORT PFNWGLGETGENLOCKSAMPLERATEI3DPROC __wglewGetGenlockSampleRateI3D; 1279 | WGLEW_FUN_EXPORT PFNWGLGETGENLOCKSOURCEDELAYI3DPROC __wglewGetGenlockSourceDelayI3D; 1280 | WGLEW_FUN_EXPORT PFNWGLGETGENLOCKSOURCEEDGEI3DPROC __wglewGetGenlockSourceEdgeI3D; 1281 | WGLEW_FUN_EXPORT PFNWGLGETGENLOCKSOURCEI3DPROC __wglewGetGenlockSourceI3D; 1282 | WGLEW_FUN_EXPORT PFNWGLISENABLEDGENLOCKI3DPROC __wglewIsEnabledGenlockI3D; 1283 | WGLEW_FUN_EXPORT PFNWGLQUERYGENLOCKMAXSOURCEDELAYI3DPROC __wglewQueryGenlockMaxSourceDelayI3D; 1284 | 1285 | WGLEW_FUN_EXPORT PFNWGLASSOCIATEIMAGEBUFFEREVENTSI3DPROC __wglewAssociateImageBufferEventsI3D; 1286 | WGLEW_FUN_EXPORT PFNWGLCREATEIMAGEBUFFERI3DPROC __wglewCreateImageBufferI3D; 1287 | WGLEW_FUN_EXPORT PFNWGLDESTROYIMAGEBUFFERI3DPROC __wglewDestroyImageBufferI3D; 1288 | WGLEW_FUN_EXPORT PFNWGLRELEASEIMAGEBUFFEREVENTSI3DPROC __wglewReleaseImageBufferEventsI3D; 1289 | 1290 | WGLEW_FUN_EXPORT PFNWGLDISABLEFRAMELOCKI3DPROC __wglewDisableFrameLockI3D; 1291 | WGLEW_FUN_EXPORT PFNWGLENABLEFRAMELOCKI3DPROC __wglewEnableFrameLockI3D; 1292 | WGLEW_FUN_EXPORT PFNWGLISENABLEDFRAMELOCKI3DPROC __wglewIsEnabledFrameLockI3D; 1293 | WGLEW_FUN_EXPORT PFNWGLQUERYFRAMELOCKMASTERI3DPROC __wglewQueryFrameLockMasterI3D; 1294 | 1295 | WGLEW_FUN_EXPORT PFNWGLBEGINFRAMETRACKINGI3DPROC __wglewBeginFrameTrackingI3D; 1296 | WGLEW_FUN_EXPORT PFNWGLENDFRAMETRACKINGI3DPROC __wglewEndFrameTrackingI3D; 1297 | WGLEW_FUN_EXPORT PFNWGLGETFRAMEUSAGEI3DPROC __wglewGetFrameUsageI3D; 1298 | WGLEW_FUN_EXPORT PFNWGLQUERYFRAMETRACKINGI3DPROC __wglewQueryFrameTrackingI3D; 1299 | 1300 | WGLEW_FUN_EXPORT PFNWGLDXCLOSEDEVICENVPROC __wglewDXCloseDeviceNV; 1301 | WGLEW_FUN_EXPORT PFNWGLDXLOCKOBJECTSNVPROC __wglewDXLockObjectsNV; 1302 | WGLEW_FUN_EXPORT PFNWGLDXOBJECTACCESSNVPROC __wglewDXObjectAccessNV; 1303 | WGLEW_FUN_EXPORT PFNWGLDXOPENDEVICENVPROC __wglewDXOpenDeviceNV; 1304 | WGLEW_FUN_EXPORT PFNWGLDXREGISTEROBJECTNVPROC __wglewDXRegisterObjectNV; 1305 | WGLEW_FUN_EXPORT PFNWGLDXSETRESOURCESHAREHANDLENVPROC __wglewDXSetResourceShareHandleNV; 1306 | WGLEW_FUN_EXPORT PFNWGLDXUNLOCKOBJECTSNVPROC __wglewDXUnlockObjectsNV; 1307 | WGLEW_FUN_EXPORT PFNWGLDXUNREGISTEROBJECTNVPROC __wglewDXUnregisterObjectNV; 1308 | 1309 | WGLEW_FUN_EXPORT PFNWGLCOPYIMAGESUBDATANVPROC __wglewCopyImageSubDataNV; 1310 | 1311 | WGLEW_FUN_EXPORT PFNWGLDELAYBEFORESWAPNVPROC __wglewDelayBeforeSwapNV; 1312 | 1313 | WGLEW_FUN_EXPORT PFNWGLCREATEAFFINITYDCNVPROC __wglewCreateAffinityDCNV; 1314 | WGLEW_FUN_EXPORT PFNWGLDELETEDCNVPROC __wglewDeleteDCNV; 1315 | WGLEW_FUN_EXPORT PFNWGLENUMGPUDEVICESNVPROC __wglewEnumGpuDevicesNV; 1316 | WGLEW_FUN_EXPORT PFNWGLENUMGPUSFROMAFFINITYDCNVPROC __wglewEnumGpusFromAffinityDCNV; 1317 | WGLEW_FUN_EXPORT PFNWGLENUMGPUSNVPROC __wglewEnumGpusNV; 1318 | 1319 | WGLEW_FUN_EXPORT PFNWGLBINDVIDEODEVICENVPROC __wglewBindVideoDeviceNV; 1320 | WGLEW_FUN_EXPORT PFNWGLENUMERATEVIDEODEVICESNVPROC __wglewEnumerateVideoDevicesNV; 1321 | WGLEW_FUN_EXPORT PFNWGLQUERYCURRENTCONTEXTNVPROC __wglewQueryCurrentContextNV; 1322 | 1323 | WGLEW_FUN_EXPORT PFNWGLBINDSWAPBARRIERNVPROC __wglewBindSwapBarrierNV; 1324 | WGLEW_FUN_EXPORT PFNWGLJOINSWAPGROUPNVPROC __wglewJoinSwapGroupNV; 1325 | WGLEW_FUN_EXPORT PFNWGLQUERYFRAMECOUNTNVPROC __wglewQueryFrameCountNV; 1326 | WGLEW_FUN_EXPORT PFNWGLQUERYMAXSWAPGROUPSNVPROC __wglewQueryMaxSwapGroupsNV; 1327 | WGLEW_FUN_EXPORT PFNWGLQUERYSWAPGROUPNVPROC __wglewQuerySwapGroupNV; 1328 | WGLEW_FUN_EXPORT PFNWGLRESETFRAMECOUNTNVPROC __wglewResetFrameCountNV; 1329 | 1330 | WGLEW_FUN_EXPORT PFNWGLALLOCATEMEMORYNVPROC __wglewAllocateMemoryNV; 1331 | WGLEW_FUN_EXPORT PFNWGLFREEMEMORYNVPROC __wglewFreeMemoryNV; 1332 | 1333 | WGLEW_FUN_EXPORT PFNWGLBINDVIDEOCAPTUREDEVICENVPROC __wglewBindVideoCaptureDeviceNV; 1334 | WGLEW_FUN_EXPORT PFNWGLENUMERATEVIDEOCAPTUREDEVICESNVPROC __wglewEnumerateVideoCaptureDevicesNV; 1335 | WGLEW_FUN_EXPORT PFNWGLLOCKVIDEOCAPTUREDEVICENVPROC __wglewLockVideoCaptureDeviceNV; 1336 | WGLEW_FUN_EXPORT PFNWGLQUERYVIDEOCAPTUREDEVICENVPROC __wglewQueryVideoCaptureDeviceNV; 1337 | WGLEW_FUN_EXPORT PFNWGLRELEASEVIDEOCAPTUREDEVICENVPROC __wglewReleaseVideoCaptureDeviceNV; 1338 | 1339 | WGLEW_FUN_EXPORT PFNWGLBINDVIDEOIMAGENVPROC __wglewBindVideoImageNV; 1340 | WGLEW_FUN_EXPORT PFNWGLGETVIDEODEVICENVPROC __wglewGetVideoDeviceNV; 1341 | WGLEW_FUN_EXPORT PFNWGLGETVIDEOINFONVPROC __wglewGetVideoInfoNV; 1342 | WGLEW_FUN_EXPORT PFNWGLRELEASEVIDEODEVICENVPROC __wglewReleaseVideoDeviceNV; 1343 | WGLEW_FUN_EXPORT PFNWGLRELEASEVIDEOIMAGENVPROC __wglewReleaseVideoImageNV; 1344 | WGLEW_FUN_EXPORT PFNWGLSENDPBUFFERTOVIDEONVPROC __wglewSendPbufferToVideoNV; 1345 | 1346 | WGLEW_FUN_EXPORT PFNWGLGETMSCRATEOMLPROC __wglewGetMscRateOML; 1347 | WGLEW_FUN_EXPORT PFNWGLGETSYNCVALUESOMLPROC __wglewGetSyncValuesOML; 1348 | WGLEW_FUN_EXPORT PFNWGLSWAPBUFFERSMSCOMLPROC __wglewSwapBuffersMscOML; 1349 | WGLEW_FUN_EXPORT PFNWGLSWAPLAYERBUFFERSMSCOMLPROC __wglewSwapLayerBuffersMscOML; 1350 | WGLEW_FUN_EXPORT PFNWGLWAITFORMSCOMLPROC __wglewWaitForMscOML; 1351 | WGLEW_FUN_EXPORT PFNWGLWAITFORSBCOMLPROC __wglewWaitForSbcOML; 1352 | WGLEW_VAR_EXPORT GLboolean __WGLEW_3DFX_multisample; 1353 | WGLEW_VAR_EXPORT GLboolean __WGLEW_3DL_stereo_control; 1354 | WGLEW_VAR_EXPORT GLboolean __WGLEW_AMD_gpu_association; 1355 | WGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_buffer_region; 1356 | WGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_context_flush_control; 1357 | WGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_create_context; 1358 | WGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_create_context_profile; 1359 | WGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_create_context_robustness; 1360 | WGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_extensions_string; 1361 | WGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_framebuffer_sRGB; 1362 | WGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_make_current_read; 1363 | WGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_multisample; 1364 | WGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_pbuffer; 1365 | WGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_pixel_format; 1366 | WGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_pixel_format_float; 1367 | WGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_render_texture; 1368 | WGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_robustness_application_isolation; 1369 | WGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_robustness_share_group_isolation; 1370 | WGLEW_VAR_EXPORT GLboolean __WGLEW_ATI_pixel_format_float; 1371 | WGLEW_VAR_EXPORT GLboolean __WGLEW_ATI_render_texture_rectangle; 1372 | WGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_create_context_es2_profile; 1373 | WGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_create_context_es_profile; 1374 | WGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_depth_float; 1375 | WGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_display_color_table; 1376 | WGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_extensions_string; 1377 | WGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_framebuffer_sRGB; 1378 | WGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_make_current_read; 1379 | WGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_multisample; 1380 | WGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_pbuffer; 1381 | WGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_pixel_format; 1382 | WGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_pixel_format_packed_float; 1383 | WGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_swap_control; 1384 | WGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_swap_control_tear; 1385 | WGLEW_VAR_EXPORT GLboolean __WGLEW_I3D_digital_video_control; 1386 | WGLEW_VAR_EXPORT GLboolean __WGLEW_I3D_gamma; 1387 | WGLEW_VAR_EXPORT GLboolean __WGLEW_I3D_genlock; 1388 | WGLEW_VAR_EXPORT GLboolean __WGLEW_I3D_image_buffer; 1389 | WGLEW_VAR_EXPORT GLboolean __WGLEW_I3D_swap_frame_lock; 1390 | WGLEW_VAR_EXPORT GLboolean __WGLEW_I3D_swap_frame_usage; 1391 | WGLEW_VAR_EXPORT GLboolean __WGLEW_NV_DX_interop; 1392 | WGLEW_VAR_EXPORT GLboolean __WGLEW_NV_DX_interop2; 1393 | WGLEW_VAR_EXPORT GLboolean __WGLEW_NV_copy_image; 1394 | WGLEW_VAR_EXPORT GLboolean __WGLEW_NV_delay_before_swap; 1395 | WGLEW_VAR_EXPORT GLboolean __WGLEW_NV_float_buffer; 1396 | WGLEW_VAR_EXPORT GLboolean __WGLEW_NV_gpu_affinity; 1397 | WGLEW_VAR_EXPORT GLboolean __WGLEW_NV_multisample_coverage; 1398 | WGLEW_VAR_EXPORT GLboolean __WGLEW_NV_present_video; 1399 | WGLEW_VAR_EXPORT GLboolean __WGLEW_NV_render_depth_texture; 1400 | WGLEW_VAR_EXPORT GLboolean __WGLEW_NV_render_texture_rectangle; 1401 | WGLEW_VAR_EXPORT GLboolean __WGLEW_NV_swap_group; 1402 | WGLEW_VAR_EXPORT GLboolean __WGLEW_NV_vertex_array_range; 1403 | WGLEW_VAR_EXPORT GLboolean __WGLEW_NV_video_capture; 1404 | WGLEW_VAR_EXPORT GLboolean __WGLEW_NV_video_output; 1405 | WGLEW_VAR_EXPORT GLboolean __WGLEW_OML_sync_control; 1406 | /* ------------------------------------------------------------------------- */ 1407 | 1408 | GLEWAPI GLenum GLEWAPIENTRY wglewInit (); 1409 | GLEWAPI GLboolean GLEWAPIENTRY wglewIsSupported (const char *name); 1410 | 1411 | #ifndef WGLEW_GET_VAR 1412 | #define WGLEW_GET_VAR(x) (*(const GLboolean*)&x) 1413 | #endif 1414 | 1415 | #ifndef WGLEW_GET_FUN 1416 | #define WGLEW_GET_FUN(x) x 1417 | #endif 1418 | 1419 | GLEWAPI GLboolean GLEWAPIENTRY wglewGetExtension (const char *name); 1420 | 1421 | #ifdef __cplusplus 1422 | } 1423 | #endif 1424 | 1425 | #undef GLEWAPI 1426 | 1427 | #endif /* __wglew_h__ */ 1428 | -------------------------------------------------------------------------------- /derivative/GL_Extensions.h: -------------------------------------------------------------------------------- 1 | // Stub file for simpler CHOP usage than an OpenGLTOP 2 | 3 | #include 4 | -------------------------------------------------------------------------------- /derivative/SOP_CPlusPlusBase.h: -------------------------------------------------------------------------------- 1 | /* Shared Use License: This file is owned by Derivative Inc. (Derivative) 2 | * and can only be used, and/or modified for use, in conjunction with 3 | * Derivative's TouchDesigner software, and only if you are a licensee who has 4 | * accepted Derivative's TouchDesigner license or assignment agreement 5 | * (which also govern the use of this file). You may share or redistribute 6 | * a modified version of this file provided the following conditions are met: 7 | * 8 | * 1. The shared file or redistribution must retain the information set out 9 | * above and this list of conditions. 10 | * 2. Derivative's name (Derivative Inc.) or its trademarks may not be used 11 | * to endorse or promote products derived from this file without specific 12 | * prior written permission from Derivative. 13 | */ 14 | 15 | /* 16 | * Produced by: 17 | * 18 | * Derivative Inc 19 | * 401 Richmond Street West, Unit 386 20 | * Toronto, Ontario 21 | * Canada M5V 3A8 22 | * 416-591-3555 23 | * 24 | * NAME: SOP_CPlusPlusBase.h 25 | * 26 | * 27 | * Do not edit this file directly! 28 | * Make a subclass of SOP_CPlusPlusBase instead, and add your own 29 | * data/functions. 30 | 31 | * Derivative Developers:: Make sure the virtual function order 32 | * stays the same, otherwise changes won't be backwards compatible 33 | */ 34 | //#pragma once 35 | 36 | #ifndef __SOP_CPlusPlusBase__ 37 | #define __SOP_CPlusPlusBase__ 38 | 39 | #include 40 | #include "CPlusPlus_Common.h" 41 | 42 | namespace TD 43 | { 44 | 45 | class SOP_CPlusPlusBase; 46 | 47 | #pragma pack(push, 8) 48 | 49 | // Define for the current API version that this sample code is made for. 50 | // To upgrade to a newer version, replace the files 51 | // SOP_CPlusPlusBase.h 52 | // CPlusPlus_Common.h 53 | // from the samples folder in a newer TouchDesigner installation. 54 | // You may need to upgrade your plugin code in that case, to match 55 | // the new API requirements 56 | const int SOPCPlusPlusAPIVersion = 3; 57 | 58 | class SOP_PluginInfo 59 | { 60 | public: 61 | int32_t apiVersion = 0; 62 | 63 | int32_t reserved[100]; 64 | 65 | // Information used to describe this plugin as a custom OP. 66 | OP_CustomOPInfo customOPInfo; 67 | 68 | int32_t reserved2[20]; 69 | }; 70 | 71 | enum class SOP_Winding : int32_t 72 | { 73 | // Clockwise vertex winding. Don't use, for legacy plugins. 74 | LegacyCW = 0, 75 | 76 | // Counter-clockwise vertex winding. All new plugins should work this way. 77 | CCW, 78 | }; 79 | 80 | class SOP_GeneralInfo 81 | { 82 | public: 83 | // Set this to true if you want the SOP to cook every frame, even 84 | // if none of it's inputs/parameters are changing. 85 | // This is generally useful for cases where the node is outputting to 86 | // something external to TouchDesigner, such as a network socket or device. 87 | // It ensures the node cooks every if nothing inside the network is using/viewing 88 | // the output of this node. 89 | // Important: 90 | // If the node may not be viewed/used by other nodes in the file, 91 | // such as a TCP network output node that isn't viewed in perform mode, 92 | // you should set cookOnStart = true in OP_CustomOPInfo. 93 | // That will ensure cooking is kick-started for this node. 94 | // Note that this fix only works for Custom Operators, not 95 | // cases where the .dll is loaded into CPlusPlus SOP. 96 | // DEFAULT: false 97 | bool cookEveryFrame; 98 | 99 | // Set this to true if you want the SOP to cook every frame, but only 100 | // if someone asks for it to cook. So if nobody is using the output from 101 | // the SOP, it won't cook. This is difereent from 'cookEveryFrame' 102 | // since that will cause it to cook every frame no matter what. 103 | // Defaults to false. 104 | // DEFAULT: false 105 | bool cookEveryFrameIfAsked; 106 | 107 | 108 | // Set this flag to true to load the geometry to the GPU for faster updating 109 | // Note that if you set this flag to 'true', then the function executeVBO() is being called 110 | // instead of execute() function. 111 | // If this flag is set to false, then execute() function is called. 112 | // When directToGPU is true, the data is not available to be used in SOPs, 113 | // except to be rendered with a Render TOP. 114 | // DEFAULT: false. 115 | bool directToGPU; 116 | 117 | 118 | // Legacy code used clockwise vertex winding, but counter-clockwise is more consistent 119 | // with TouchDesigner. Older plugins will have this set to LegacyCW, 120 | // but newer ones should set it to CCW, as the sample code does. 121 | SOP_Winding winding; 122 | 123 | private: 124 | int32_t reserved[19]; 125 | }; 126 | 127 | 128 | 129 | // The buffer object mode. 130 | // This helps the graphics driver determine where to keep the data 131 | // for beter performance. 132 | enum class VBOBufferMode : int32_t 133 | { 134 | // The data will be modified once or rarely and used many times. 135 | Static = 0, 136 | 137 | // The data will be modified repeatedly and used many times. 138 | Dynamic, 139 | }; 140 | 141 | // an enumerator to specify the group type 142 | enum class SOP_GroupType 143 | { 144 | Point = 0, 145 | Primitive, 146 | }; 147 | 148 | 149 | // This class is used to create geometry on the CPU, to be used in SOP networks. 150 | // NOTE: set 'directToGPU' flag from SOP_GeneralInfo class to false. 151 | class SOP_Output 152 | { 153 | public: 154 | 155 | SOP_Output() 156 | { 157 | } 158 | 159 | ~SOP_Output() 160 | { 161 | } 162 | 163 | // Add a single point at the given position. 164 | // Returns the point's index. 165 | virtual int32_t addPoint(const Position& pos) = 0; 166 | 167 | // Add multiple points at specified positions. 168 | // 'numPoints' is the number of points to be added. 169 | virtual bool addPoints(const Position* pos, int32_t numPoints) = 0; 170 | 171 | // Returns the number of added points at the time of query 172 | virtual int32_t getNumPoints() = 0; 173 | 174 | // Set the normal vector for the point with the 'pointIdx'. 175 | // The point must already exist by via calling addPoints() or addPoint(). 176 | virtual bool setNormal(const Vector& n, int32_t pointIdx) = 0; 177 | 178 | // Set the normal vectors for existing points. 179 | // Note that has been the points must be already added by calling addPoints() or addPoint(). 180 | // The startPointIdx indicates the start index of the points to set normals for. 181 | virtual bool setNormals(const Vector* n, int32_t numPoints, int32_t startPointIdx) = 0; 182 | 183 | // Returns true if the normal has been set for this geometry. 184 | virtual bool hasNormal() = 0; 185 | 186 | // Set the color value with Color (i.e. r,g,b,a) for the point with 'pointIdx' index. 187 | // The point must already exist by via calling addPoints() or addPoint(). 188 | virtual bool setColor(const Color& c, int32_t pointIdx) = 0; 189 | 190 | // Set the colors for points that are already added. 191 | // The startPointIdx indicates the start index of the points to set colors for. 192 | virtual bool setColors(const Color* colors, int32_t numPoints, int32_t startPointIdx) = 0; 193 | 194 | // Returns true if the color has been set for this geometry. 195 | virtual bool hasColor() = 0; 196 | 197 | // Set texture coordinate data for existing points. 198 | // The numLayers is the texcoord size and can be from 1 up to 8 for texture layers 199 | // The first numLayers used will be used as the max number of layers for all future calls for this cook. 200 | // The pointIdx specifies the point index with the texture coords 201 | virtual bool setTexCoord(const TexCoord* tex, int32_t numLayers, int32_t pointIdx) = 0; 202 | 203 | // Set texture coordinate data for existing points. 204 | // The numLayers is the texCoord size and can be from 1 up to 8 for texCoord layers. 205 | // The first numLayers used will be used as the max number of layers for all future calls for this cook. 206 | // The startPointIdx indicates the start index of the points to set texCoord for. 207 | virtual bool setTexCoords(const TexCoord* t, int32_t numPoints, int32_t numLayers, int32_t startPointIdx) = 0; 208 | 209 | // Returns true if the texCoord/textures has been set for this geometry. 210 | virtual bool hasTexCoord() = 0; 211 | 212 | // Returns the number of texcoord layers 213 | virtual int32_t getNumTexCoordLayers() = 0; 214 | 215 | // Set the custom attribute with SOP_CustomAttribData (must have set its name, number of components, and its type) 216 | // The data param must hold the data for the custom attribute. 217 | // E.g a custom atrrib with 4 components for each point should holds 4*numPoints values for its data. 218 | virtual bool setCustomAttribute(const SOP_CustomAttribData* cu, int32_t numPoints) = 0; 219 | 220 | // Returns true if the custom attributes has been set for this geometry. 221 | virtual bool hasCustomAttibutes() = 0; 222 | 223 | // Add a triangle using the points at the given 3 indices. 224 | virtual bool addTriangle(int32_t ptIdx1, int32_t ptIdx2, int32_t ptIdx3) = 0; 225 | 226 | // Add multiple triangles using an array of point's indices. 227 | // The size param represents the number of triangles to be added. 228 | // 'indices' must contain at least 3 * size elements. 229 | virtual bool addTriangles(const int32_t *indices, int32_t size) = 0; 230 | 231 | // add particle systems from the points that has been already added. The points can have colors, normals and custom attribs. 232 | // the startIndex param is the staring index of the points from particle system. 233 | virtual bool addParticleSystem(int32_t numParticles, int32_t startIndex) = 0; 234 | 235 | // Add line strip from the points that has been already added. The points can have colors, normals and custom attribs. 236 | // the 'indices' contains the indices of vertices, and 'size' is the number of indices for the line strip 237 | virtual bool addLine(const int32_t *indices, int32_t size) = 0; 238 | 239 | // Add line strips from the points that has been already added.The points can have colors, normals and custom attribs. 240 | // the 'indices' contains the indices of vertices, 'sizeOfEachLine' contains the number of vertices for each line, 241 | // 'numOfLines' specifies the number of lines to be drawn. 242 | // Note that the number of elements in sizeOfEachLine must be equal to numOfLines. 243 | virtual bool addLines(const int32_t *indices, int32_t* sizeOfEachLine, int32_t numOfLines) = 0; 244 | 245 | // Returns the number of added primitives at the time of query. Currently it is either the number of triangles or particles. 246 | virtual int32_t getNumPrimitives() = 0; 247 | 248 | // Set the bounding box for the whole geometry. 249 | // Setting the bounding box helps to have exact homing on the viewer. 250 | // You may set this value at each frame for non static geometries that are translating constantly. 251 | virtual bool setBoundingBox(const BoundingBox& bbox) = 0; 252 | 253 | // Add a group with input type and name. 254 | // Returns false if a group with this name already exists. 255 | virtual bool addGroup(const SOP_GroupType& type, const char* name) = 0; 256 | 257 | // Destroy a group with input type and name. 258 | // Returns false if a group with this name for the specified type does not exists. 259 | virtual bool destroyGroup(const SOP_GroupType& type, const char* name) = 0; 260 | 261 | // Add a point with its index to an already existing group with SOP_GroupType::Point type. 262 | // Returns false if a point group with this name does not exists Or 263 | // if a point with that index does not exists. 264 | virtual bool addPointToGroup(int index, const char* name) = 0; 265 | 266 | // Add a primitive with its index to an already existing group with SOP_GroupType::Primitive type. 267 | // Returns false if a primitive group with this name does not exists Or 268 | // if a pritimive with that index does not exists. 269 | virtual bool addPrimToGroup(int index, const char* name) = 0; 270 | 271 | // Add a point/prim index to an already defined group. 272 | // Returns false if a primitive group with this name does not exists Or 273 | // if a pritimive/point with that index does not exists. 274 | virtual bool addToGroup(int index, const SOP_GroupType& type, const char* name) = 0; 275 | 276 | // Add a point with its index to an already existing group with SOP_GroupType::Point type. 277 | // Returns false if a point group with this name does not exists Or 278 | // if a point with that index does not exists. 279 | virtual bool discardFromPointGroup(int index, const char* name) = 0; 280 | 281 | // Add a primitive with its index to an already existing group with SOP_GroupType::Primitive type. 282 | // Returns false if a primitive group with this name does not exists Or 283 | // if a pritimive with that index does not exists. 284 | virtual bool discardFromPrimGroup(int index, const char* name) = 0; 285 | 286 | // Remove a point/prim index from an already defined group. 287 | // Returns false if a primitive group with this name does not exists Or 288 | // if a pritimive/point with that index does not exists. 289 | virtual bool discardFromGroup(int index, const SOP_GroupType& type, const char* name) = 0; 290 | 291 | private: 292 | 293 | int32_t reserved[20]; 294 | }; 295 | 296 | 297 | // This class is used to load geometry directly onto the GPU. The geometry can be used for rendering, but not SOP networks. 298 | // NOTE: set 'directToGPU' flag from SOP_GeneralInfo class to true. 299 | class SOP_VBOOutput 300 | { 301 | 302 | public: 303 | 304 | SOP_VBOOutput() 305 | { 306 | } 307 | 308 | ~SOP_VBOOutput() 309 | { 310 | } 311 | 312 | // enable/set the normal, color, texcoord, if the geometry contains this information 313 | virtual void enableNormal() = 0; 314 | 315 | virtual void enableColor() = 0; 316 | 317 | virtual void enableTexCoord(int32_t numLayers = 0) = 0; 318 | 319 | // Returns true if the normal, color, texcoord, or custom attributes has been set for this geometry. 320 | virtual bool hasNormal() = 0; 321 | 322 | virtual bool hasColor() = 0; 323 | 324 | virtual bool hasTexCoord() = 0; 325 | 326 | virtual bool hasCustomAttibutes() = 0; 327 | 328 | // Add the custom attribute with SOP_CustomAttribInfo (must have set its name, number of components, and its type) 329 | virtual bool addCustomAttribute(const SOP_CustomAttribInfo& cu) = 0; 330 | 331 | // Allocates and setup VBO buffers. 332 | // Call this fucntion before adding any points, colors or normals, 333 | // but after enableNormal(), enableColor(), addCustomAttribute(). 334 | // 'numVertices' is how much memory to allocate for positions/normals etc. 335 | // 'numIndices' is how much memory to allocate for indices that are used 336 | // to build primitives. 337 | virtual void allocVBO(int32_t numVertices, int32_t numIndices, VBOBufferMode mode) = 0; 338 | 339 | // Returns the start of an array of Positions that should be filled. 340 | // The length of this array is numVertices. 341 | virtual Position* getPos() = 0; 342 | 343 | // Returns the start of an array of Vectors that should be filled. 344 | // The length of this array is numVertices. 345 | virtual Vector* getNormals() = 0; 346 | 347 | // Returns the start of an array of Colors that should be filled. 348 | // The length of this array is numVertices. 349 | virtual Color* getColors() = 0; 350 | 351 | // Returns the start of an array of TexCoords that should be filled. 352 | // The length of this array is numVertices. 353 | virtual TexCoord* getTexCoords() = 0; 354 | 355 | // Returns the number of texcoord layers which has been already set 356 | // by enableTexCoord() call. 357 | virtual int32_t getNumTexCoordLayers() = 0; 358 | 359 | // Returns an array of indices (of vertices) that should be filled. The indices 360 | // for all the triangles must be set as their initial values is undefined. 361 | // It is used to create 'numTriangles' triangles. 362 | // Length of the returned array is numTriangles * 3. 363 | virtual int32_t* addTriangles(int32_t numTriangles) = 0; 364 | 365 | // Returns an array of indices (of vertices) that should be filled. The indices 366 | // for particles must be set as their initial values is undefined. 367 | // It is used to create 'numParticles' particles. 368 | // Length of the returned array is numParticles. 369 | virtual int32_t* addParticleSystem(int32_t numParticles) = 0; 370 | 371 | // Returns an array of indices (of vertices) that should be filled. 372 | // It is used to create line strip with numIndices. 373 | // Length of the returned array is numIndices. 374 | virtual int32_t* addLines(int32_t numIndices) = 0; 375 | 376 | // Fills SOP_CustomAttribData with data for the given attribute 'name'. 377 | // The intData or floatData member contains a pointer to the member that should 378 | // be filled. 379 | // Returns false is case of null arguments, or invalid name. 380 | virtual bool getCustomAttribute(SOP_CustomAttribData* cu, const char* name) = 0; 381 | 382 | // Finish updating the VBO buffers. 383 | // After you are done with the VBO buffers, make sure to call this function 384 | // Note: this function must be the last function to be called 385 | virtual void updateComplete() = 0; 386 | 387 | // Set the bounding box for the whole geometry. 388 | // We recommned to set the bounding box in GPU direct mode for exact homing. 389 | // You may set this value at each frame for non static geometries that are translating constantly. 390 | virtual bool setBoundingBox(const BoundingBox& bbox) = 0; 391 | 392 | private: 393 | 394 | }; 395 | 396 | 397 | 398 | /*** DO NOT EDIT THIS CLASS, MAKE A SUBCLASS OF IT INSTEAD ***/ 399 | class SOP_CPlusPlusBase 400 | { 401 | 402 | protected: 403 | 404 | SOP_CPlusPlusBase() 405 | { 406 | } 407 | 408 | public: 409 | 410 | virtual 411 | ~SOP_CPlusPlusBase() 412 | { 413 | } 414 | 415 | // BEGIN PUBLIC INTERFACE 416 | 417 | // Some general settings can be assigned here (if you ovierride it) 418 | // The OP_Inputs* provides the access to the custom parameters 419 | // before the call to the execute/VBO() functions. 420 | virtual void 421 | getGeneralInfo(SOP_GeneralInfo*, const OP_Inputs*, void* reserved1) 422 | { 423 | } 424 | 425 | 426 | // Add geometry data such as points, normals, colors, and triangles 427 | // or particles and etc. obtained from your desired algorithm or external files. 428 | // If the "directToGPU" flag is set to false, this function is being called 429 | // instead of executeVBO(). 430 | // See the OP_Inputs class definition for more details on it's contents 431 | virtual void execute(SOP_Output*, const OP_Inputs*, void* reserved1) = 0; 432 | 433 | // For direct GPU loading (i.e. "directToGPU" is set to true) this function is being called 434 | // instead of execute(). 435 | // Fill the VBO buffers with the geometry data, obtained from your desired algorithm or files, 436 | // such as points, normals, colors, texcoord, triangles, and etc. 437 | virtual void executeVBO(SOP_VBOOutput*, const OP_Inputs*, void* reserved1) = 0; 438 | 439 | 440 | // Override these methods if you want to output values to the Info CHOP/DAT 441 | // returning 0 means you dont plan to output any Info CHOP channels 442 | virtual int32_t 443 | getNumInfoCHOPChans(void *reserved1) 444 | { 445 | return 0; 446 | } 447 | 448 | // Specify the name and value for CHOP 'index', 449 | // by assigning something to 'name' and 'value' members of the 450 | // OP_InfoCHOPChan class pointer that is passed (it points 451 | // to a valid instance of the class already. 452 | // the 'name' pointer will initially point to nullptr 453 | // you must allocate memory or assign a constant string 454 | // to it. 455 | virtual void 456 | getInfoCHOPChan(int32_t index, OP_InfoCHOPChan* chan, void *reserved1) 457 | { 458 | } 459 | 460 | 461 | // Return false if you arn't returning data for an Info DAT 462 | // Return true if you are. 463 | // Set the members of the CHOP_InfoDATSize class to specify 464 | // the dimensions of the Info DAT 465 | virtual bool 466 | getInfoDATSize(OP_InfoDATSize* infoSize, void* reserved1) 467 | { 468 | return false; 469 | } 470 | 471 | 472 | // You are asked to assign values to the Info DAT 1 row or column at a time 473 | // The 'byColumn' variable in 'getInfoDATSize' is how you specify 474 | // if it is by column or by row. 475 | // 'index' is the row/column index 476 | // 'nEntries' is the number of entries in the row/column 477 | // Strings should be UTF-8 encoded. 478 | virtual void 479 | getInfoDATEntries(int32_t index, int32_t nEntries, 480 | OP_InfoDATEntries* entries, void* reserved1) 481 | { 482 | } 483 | 484 | 485 | // You can use this function to put the node into a warning state 486 | // with the returned string as the message. 487 | virtual void 488 | getWarningString(OP_String *warning, void *reserved1) 489 | { 490 | } 491 | 492 | // You can use this function to put the node into a error state 493 | // with the returned string as the message. 494 | virtual void 495 | getErrorString(OP_String *error, void *reserved1) 496 | { 497 | } 498 | 499 | // Use this function to return some text that will show up in the 500 | // info popup (when you middle click on a node) 501 | virtual void 502 | getInfoPopupString(OP_String *info, void *reserved1) 503 | { 504 | } 505 | 506 | 507 | // Override these methods if you want to define specfic parameters 508 | virtual void 509 | setupParameters(OP_ParameterManager* manager, void* reserved1) 510 | { 511 | } 512 | 513 | 514 | // This is called whenever a pulse parameter is pressed 515 | virtual void 516 | pulsePressed(const char* name, void* reserved1) 517 | { 518 | } 519 | 520 | // This is called whenever a dynamic menu type custom parameter needs to have it's content's 521 | // updated. It may happen often, so this could should be efficient. 522 | virtual void 523 | buildDynamicMenu(const OP_Inputs* inputs, OP_BuildDynamicMenuInfo* info, void* reserved1) 524 | { 525 | } 526 | 527 | // END PUBLIC INTERFACE 528 | 529 | 530 | private: 531 | 532 | // Reserved for future features 533 | virtual int32_t reservedFunc6() { return 0; } 534 | virtual int32_t reservedFunc7() { return 0; } 535 | virtual int32_t reservedFunc8() { return 0; } 536 | virtual int32_t reservedFunc9() { return 0; } 537 | virtual int32_t reservedFunc10() { return 0; } 538 | virtual int32_t reservedFunc11() { return 0; } 539 | virtual int32_t reservedFunc12() { return 0; } 540 | virtual int32_t reservedFunc13() { return 0; } 541 | virtual int32_t reservedFunc14() { return 0; } 542 | virtual int32_t reservedFunc15() { return 0; } 543 | virtual int32_t reservedFunc16() { return 0; } 544 | virtual int32_t reservedFunc17() { return 0; } 545 | virtual int32_t reservedFunc18() { return 0; } 546 | virtual int32_t reservedFunc19() { return 0; } 547 | virtual int32_t reservedFunc20() { return 0; } 548 | 549 | int32_t reserved[400]; 550 | 551 | }; 552 | 553 | #pragma pack(pop) 554 | 555 | static_assert(offsetof(SOP_PluginInfo, apiVersion) == 0, "Incorrect Alignment"); 556 | static_assert(offsetof(SOP_PluginInfo, customOPInfo) == 408, "Incorrect Alignment"); 557 | static_assert(sizeof(SOP_PluginInfo) == 944, "Incorrect Size"); 558 | 559 | static_assert(offsetof(SOP_GeneralInfo, cookEveryFrame) == 0, "Incorrect Alignment"); 560 | static_assert(offsetof(SOP_GeneralInfo, cookEveryFrameIfAsked) == 1, "Incorrect Alignment"); 561 | static_assert(offsetof(SOP_GeneralInfo, directToGPU) == 2, "Incorrect Alignment"); 562 | static_assert(offsetof(SOP_GeneralInfo, winding) == 4, "Incorrect Alignment"); 563 | static_assert(sizeof(SOP_GeneralInfo) == 84, "Incorrect Size"); 564 | 565 | }; // namespace TD 566 | 567 | #endif 568 | -------------------------------------------------------------------------------- /derivative/TOP_CPlusPlusBase.h: -------------------------------------------------------------------------------- 1 | /* Shared Use License: This file is owned by Derivative Inc. (Derivative) 2 | * and can only be used, and/or modified for use, in conjunction with 3 | * Derivative's TouchDesigner software, and only if you are a licensee who has 4 | * accepted Derivative's TouchDesigner license or assignment agreement 5 | * (which also govern the use of this file). You may share or redistribute 6 | * a modified version of this file provided the following conditions are met: 7 | * 8 | * 1. The shared file or redistribution must retain the information set out 9 | * above and this list of conditions. 10 | * 2. Derivative's name (Derivative Inc.) or its trademarks may not be used 11 | * to endorse or promote products derived from this file without specific 12 | * prior written permission from Derivative. 13 | */ 14 | 15 | /* 16 | * Produced by: 17 | * 18 | * Derivative Inc 19 | * 401 Richmond Street West, Unit 386 20 | * Toronto, Ontario 21 | * Canada M5V 3A8 22 | * 416-591-3555 23 | * 24 | * NAME: TOP_CPlusPlusBase.h 25 | * 26 | */ 27 | 28 | /******* 29 | Do not edit this file directly! 30 | Make a subclass of TOP_CPlusPlusBase instead, and add your own data/function 31 | 32 | Derivative Developers:: Make sure the virtual function order 33 | stays the same, otherwise changes won't be backwards compatible 34 | ********/ 35 | 36 | #ifndef __TOP_CPlusPlusBase__ 37 | #define __TOP_CPlusPlusBase__ 38 | 39 | #include "assert.h" 40 | #include "CPlusPlus_Common.h" 41 | 42 | #ifndef VK_HEADER_VERSION 43 | typedef struct objectVkDevice_T* VkDevice; 44 | #endif 45 | 46 | #ifndef _WIN32 47 | #ifdef __OBJC__ 48 | @class NSOpenGLContext; 49 | #else 50 | class NSOpenGLContext; 51 | #endif 52 | #endif 53 | 54 | namespace TD 55 | { 56 | class TOP_CPlusPlusBase; 57 | class TOP_Context; 58 | 59 | #pragma pack(push, 8) 60 | 61 | enum class TOP_ExecuteMode : int32_t 62 | { 63 | // Old Unsupported Value 64 | Unsupported = 0, 65 | 66 | // CPU memory is filled with data directly, which is then given to the node to upload into a texture 67 | // for you. This avoids the need to do any GPU work directly, letting TouchDesigner handle all of that 68 | // for you. 69 | CPUMem, 70 | 71 | // Unused value 72 | Reserved, 73 | 74 | // Using CUDA. Textures will be given using cudaArray*, registered with 75 | // cudaGraphicsRegisterFlagsSurfaceLoadStore flag set. The output 76 | // texture will be written using a provided cudaArray* as well 77 | CUDA, 78 | }; 79 | 80 | // Used to specify if the given CPU data in CPU-mode is 81 | enum class TOP_FirstPixel : int32_t 82 | { 83 | // The first row of pixel data provided will be the bottom row, 84 | // starting from the left 85 | BottomLeft = 0, 86 | 87 | // The first row of pixel data provided will be the top row, 88 | // starting from the left 89 | TopLeft, 90 | 91 | }; 92 | 93 | // Define for the current API version that this sample code is made for. 94 | // To upgrade to a newer version, replace the files 95 | // TOP_CPlusPlusBase.h 96 | // CPlusPlus_Common.h 97 | // from the samples folder in a newer TouchDesigner installation. 98 | // You may need to upgrade your plugin code in that case, to match 99 | // the new API requirements 100 | const int TOPCPlusPlusAPIVersion = 11; 101 | 102 | class TOP_PluginInfo 103 | { 104 | public: 105 | // Must be set to TOPCPlusPlusAPIVersion in FillTOPPluginInfo 106 | int32_t apiVersion = 0; 107 | 108 | // Set this to control the execution mode for this plugin 109 | // See the documention for TOP_ExecuteMode for more information 110 | TOP_ExecuteMode executeMode = TOP_ExecuteMode::CPUMem; 111 | 112 | int32_t reserved[100]; 113 | 114 | // Information used to describe this plugin as a custom OP. 115 | OP_CustomOPInfo customOPInfo; 116 | 117 | int32_t reserved2[20]; 118 | }; 119 | 120 | enum class DepthFormat : int32_t 121 | { 122 | None, 123 | Fixed, // Will be 16-bit or 24-bit fix, depending on the GPU. 124 | Float, // Will be 32-bit float generally. 125 | }; 126 | 127 | // TouchDesigner will select the best pixel format based on the options you give 128 | // Not all possible combinations of channels/bit depth are possible, 129 | // so you get the best choice supported by your card 130 | 131 | class TOP_OutputFormat 132 | { 133 | public: 134 | int32_t width = 0; 135 | int32_t height = 0; 136 | 137 | // The aspect ratio of the TOP's output. If left as 0s, then it'll use the width/height 138 | // as the aspect ratio. 139 | float aspectX = 0.0f; 140 | float aspectY = 0.0f; 141 | 142 | // The pixel format of the data and texture 143 | OP_PixelFormat pixelFormat; 144 | 145 | // The anti-alias level. 146 | // 1 means no anti-alaising 147 | // 2 means '2x', etc., up to 32 right now 148 | // Only used when executeMode == TOP_ExecuteMode::OpenGL_FBO 149 | int32_t antiAlias = 1; 150 | 151 | // If you want to use multiple render targets, you can set this 152 | // greater than one 153 | // Only used when executeMode == TOP_ExecuteMode:: 154 | int32_t numColorBuffers = 1; 155 | 156 | DepthFormat depthFormat = DepthFormat::None; 157 | 158 | // Set to true if the depth buffer should include stencil bits. 159 | // Only used when executeMode == TOP_ExecuteMode::Vulkan 160 | bool stencilBuffer = false; 161 | 162 | int32_t reserved[20]; 163 | }; 164 | 165 | class TOP_GeneralInfo 166 | { 167 | public: 168 | // Set this to true if you want the TOP to cook every frame, even 169 | // if none of it's inputs/parameters are changing. 170 | // This is generally useful for cases where the node is outputting to 171 | // something external to TouchDesigner, such as a network socket or device. 172 | // It ensures the node cooks every if nothing inside the network is using/viewing 173 | // the output of this node. 174 | // Important: 175 | // If the node may not be viewed/used by other nodes in the file, 176 | // such as a TCP network output node that isn't viewed in perform mode, 177 | // you should set cookOnStart = true in OP_CustomOPInfo. 178 | // That will ensure cooking is kick-started for this node. 179 | // Note that this fix only works for Custom Operators, not 180 | // cases where the .dll is loaded into CPlusPlus TOP. 181 | // DEFAULT: false 182 | bool cookEveryFrame; 183 | 184 | // Set this to true if you want the CHOP to cook every frame, if asked 185 | // (someone uses it's output) 186 | // This is different from 'cookEveryFrame', which causes the node to cook 187 | // every frame no matter what 188 | // DEFAULT: false 189 | bool cookEveryFrameIfAsked; 190 | 191 | // When setting the output texture size using the node's common page 192 | // if using 'Input' or 'Half' options for example, it uses the first input 193 | // by default. You can use a different input by assigning a value 194 | // to inputSizeIndex. 195 | // This member is ignored if getOutputFormat() returns true. 196 | // DEFAULT: 0 197 | int32_t inputSizeIndex; 198 | 199 | int32_t reserved[20]; 200 | }; 201 | 202 | enum class TOP_BufferFlags : int32_t 203 | { 204 | None = 0x0000, 205 | Readable = 0x0001, 206 | }; 207 | 208 | class TOP_Buffer : public OP_RefCount 209 | { 210 | protected: 211 | TOP_Buffer() {} 212 | virtual ~TOP_Buffer() {} 213 | 214 | public: 215 | void* data = nullptr; 216 | uint64_t size = 0; 217 | TOP_BufferFlags flags = TOP_BufferFlags::None; 218 | 219 | int32_t reserved[50]; 220 | 221 | protected: 222 | 223 | virtual void reserved0() = 0; 224 | virtual void reserved1() = 0; 225 | virtual void reserved2() = 0; 226 | virtual void reserved3() = 0; 227 | virtual void reserved4() = 0; 228 | }; 229 | 230 | 231 | // This class is passed as the OP_Context in the OP_NodeInfo. It remains valid for the life 232 | // of the node. 233 | class TOP_Context : public OP_Context 234 | { 235 | protected: 236 | virtual ~TOP_Context() {} 237 | 238 | public: 239 | // Creates a TOP_Buffer you can fill with data from the CPU. Held in a OP_SmartRef. 240 | // This function is thread-safe and can be called 241 | // at any time in any thread, including from multiple threads at the same time. 242 | // You become owner of the TOP_Buffer, and must give it back to the node via a call in TOP_Output during execute() 243 | // or call release() on it yourself if you don't need it anymore. 244 | virtual OP_SmartRef createOutputBuffer(uint64_t size, TOP_BufferFlags flags, void* reserved) = 0; 245 | 246 | // If you don't need a buffer anymore, but want it to be available for a future create* call (avoiding an allocation) 247 | // You can return it using this function instead of calling release() on it. This allows it to be re-used for 248 | // another option potentially, avoiding a re-allocation. 249 | virtual void returnBuffer(OP_SmartRef* buf) = 0; 250 | 251 | protected: 252 | virtual void reserved0() = 0; 253 | virtual void reserved1() = 0; 254 | virtual void reserved2() = 0; 255 | virtual void reserved3() = 0; 256 | virtual void reserved4() = 0; 257 | virtual void reserved5() = 0; 258 | virtual void reserved6() = 0; 259 | virtual void reserved7() = 0; 260 | virtual void reserved8() = 0; 261 | virtual void reserved9() = 0; 262 | }; 263 | 264 | /***** FUNCTION CALL ORDER DURING INITIALIZATION ******/ 265 | /* 266 | When the Custom TOP is created, or the C++ TOP creates an instead of this class. Functions will be called in this order 267 | setupParameters(OP_ParameterManager* m); 268 | */ 269 | 270 | /***** FUNCTION CALL ORDER DURING A COOK ******/ 271 | /* 272 | When the TOP cooks the functions will be called in this order 273 | 274 | getGeneralInfo() 275 | getOutputFormat() 276 | 277 | execute() 278 | getNumInfoCHOPChans() 279 | for the number of chans returned getNumInfoCHOPChans() 280 | { 281 | getInfoCHOPChan() 282 | } 283 | getInfoDATSize() 284 | for the number of rows/cols returned by getInfoDATSize() 285 | { 286 | getInfoDATEntries() 287 | } 288 | getWarningString() 289 | getErrorString() 290 | getInfoPopupString() 291 | */ 292 | 293 | class TOP_UploadInfo 294 | { 295 | public: 296 | TOP_UploadInfo() 297 | { 298 | memset(reserved, 0, sizeof(reserved)); 299 | } 300 | 301 | // Byte offset into the TOP_Buffer's data to start reading the data from. 302 | uint64_t bufferOffset = 0; 303 | 304 | // Describe the texture that should be created from the buffer 305 | OP_TextureDesc textureDesc; 306 | 307 | // For e2D texDim textures, you can flip the texture vertically by setting this to TopLeft. 308 | TOP_FirstPixel firstPixel = TOP_FirstPixel::BottomLeft; 309 | 310 | // You can output to any number of color buffers when uploading. Get the > 0 buffers using 311 | // a Render Select TOP. 312 | // The color buffers can different resolutions, pixel formats and texDims from each other. 313 | uint32_t colorBufferIndex = 0; 314 | 315 | uint32_t reserved[25]; 316 | }; 317 | 318 | class TOP_CUDAOutputInfo 319 | { 320 | public: 321 | TOP_CUDAOutputInfo() 322 | { 323 | memset(reserved, 0, sizeof(reserved)); 324 | } 325 | 326 | cudaStream_t stream = 0; 327 | 328 | // Describe the texture that should be created from the buffer 329 | OP_TextureDesc textureDesc; 330 | 331 | // You can output to any number of color buffers when uploading. Get the > 0 buffers using 332 | // a Render Select TOP. 333 | // The color buffers can different resolutions, pixel formats and texDims from each other. 334 | uint32_t colorBufferIndex = 0; 335 | 336 | uint32_t reserved[25]; 337 | }; 338 | 339 | class TOP_Output 340 | { 341 | protected: 342 | virtual ~TOP_Output() 343 | { 344 | } 345 | 346 | public: 347 | 348 | // Upload a TOP_Buffer you have filled in. The texture will be allocated at the resolution/format/dimension 349 | // as defined in 'info'. This function takes ownership of 'buf'. The OP_SmartRef will be empty after calling this. 350 | // Only usable in TOP_ExecuteMode::CPUMem 351 | virtual void uploadBuffer(OP_SmartRef* buf, const TOP_UploadInfo& info, void* reserved) = 0; 352 | 353 | // Only usable in TOP_ExecuteMode::CUDA 354 | virtual const OP_CUDAArrayInfo* createCUDAArray(const TOP_CUDAOutputInfo& info, void* reserved) = 0; 355 | 356 | private: 357 | virtual void reserved0() = 0; 358 | virtual void reserved1() = 0; 359 | virtual void reserved2() = 0; 360 | virtual void reserved3() = 0; 361 | virtual void reserved4() = 0; 362 | virtual void reserved5() = 0; 363 | virtual void reserved6() = 0; 364 | virtual void reserved7() = 0; 365 | virtual void reserved8() = 0; 366 | virtual void reserved9() = 0; 367 | }; 368 | 369 | 370 | /*** DO NOT EDIT THIS CLASS, MAKE A SUBCLASS OF IT INSTEAD ***/ 371 | class TOP_CPlusPlusBase 372 | { 373 | protected: 374 | TOP_CPlusPlusBase() 375 | { 376 | memset(reserved, 0, sizeof(reserved)); 377 | } 378 | 379 | public: 380 | virtual ~TOP_CPlusPlusBase() 381 | { 382 | } 383 | 384 | // BEGIN PUBLIC INTERFACE 385 | 386 | // Some general settings can be assigned here by setting memebers of 387 | // the TOP_GeneralInfo class that is passed in 388 | virtual void 389 | getGeneralInfo(TOP_GeneralInfo*, const OP_Inputs*, void *reserved1) 390 | { 391 | } 392 | 393 | virtual void execute(TOP_Output*, const OP_Inputs* , 394 | void* reserved1) = 0; 395 | 396 | // Override these methods if you want to output values to the Info CHOP/DAT 397 | // returning 0 means you dont plan to output any Info CHOP channels 398 | 399 | virtual int32_t 400 | getNumInfoCHOPChans(void* reserved1) 401 | { 402 | return 0; 403 | } 404 | 405 | // Specify the name and value for Info CHOP channel 'index', 406 | // by assigning something to 'name' and 'value' members of the 407 | // OP_InfoCHOPChan class pointer that is passed in. 408 | virtual void 409 | getInfoCHOPChan(int32_t index, OP_InfoCHOPChan* chan, 410 | void* reserved1) 411 | { 412 | } 413 | 414 | 415 | // Return false if you arn't returning data for an Info DAT 416 | // Return true if you are. 417 | // Fill in members of the OP_InfoDATSize class to specify the size 418 | virtual bool 419 | getInfoDATSize(OP_InfoDATSize* infoSize, void* reserved1) 420 | { 421 | return false; 422 | } 423 | 424 | // You are asked to assign values to the Info DAT 1 row or column at a time 425 | // The 'byColumn' variable in 'getInfoDATSize' is how you specify 426 | // if it is by column or by row. 427 | // 'index' is the row/column index 428 | // 'nEntries' is the number of entries in the row/column 429 | // Strings should be UTF-8 encoded. 430 | virtual void 431 | getInfoDATEntries(int32_t index, int32_t nEntries, OP_InfoDATEntries* entries, 432 | void *reserved1) 433 | { 434 | } 435 | 436 | // You can use this function to put the node into a warning state 437 | // with the returned string as the message. 438 | virtual void 439 | getWarningString(OP_String *warning, void *reserved1) 440 | { 441 | } 442 | 443 | // You can use this function to put the node into a error state 444 | // with the returned string as the message. 445 | virtual void 446 | getErrorString(OP_String *error, void *reserved1) 447 | { 448 | } 449 | 450 | // Use this function to return some text that will show up in the 451 | // info popup (when you middle click on a node) 452 | virtual void 453 | getInfoPopupString(OP_String *info, void *reserved1) 454 | { 455 | } 456 | 457 | // Override these methods if you want to define specfic parameters 458 | virtual void 459 | setupParameters(OP_ParameterManager* manager, void* reserved1) 460 | { 461 | } 462 | 463 | // This is called whenever a pulse parameter is pressed 464 | virtual void 465 | pulsePressed(const char* name, void* reserved1) 466 | { 467 | } 468 | 469 | // This is called whenever a dynamic menu type custom parameter needs to have it's content's 470 | // updated. It may happen often, so this could should be efficient. 471 | virtual void 472 | buildDynamicMenu(const OP_Inputs* inputs, OP_BuildDynamicMenuInfo* info, void* reserved1) 473 | { 474 | } 475 | 476 | 477 | // END PUBLIC INTERFACE 478 | 479 | // Reserved for future features 480 | virtual int32_t reservedFunc6() { return 0; } 481 | virtual int32_t reservedFunc7() { return 0; } 482 | virtual int32_t reservedFunc8() { return 0; } 483 | virtual int32_t reservedFunc9() { return 0; } 484 | virtual int32_t reservedFunc10() { return 0; } 485 | virtual int32_t reservedFunc11() { return 0; } 486 | virtual int32_t reservedFunc12() { return 0; } 487 | virtual int32_t reservedFunc13() { return 0; } 488 | virtual int32_t reservedFunc14() { return 0; } 489 | virtual int32_t reservedFunc15() { return 0; } 490 | virtual int32_t reservedFunc16() { return 0; } 491 | virtual int32_t reservedFunc17() { return 0; } 492 | virtual int32_t reservedFunc18() { return 0; } 493 | virtual int32_t reservedFunc19() { return 0; } 494 | virtual int32_t reservedFunc20() { return 0; } 495 | 496 | int32_t reserved[400]; 497 | }; 498 | 499 | #pragma pack(pop) 500 | 501 | static_assert(offsetof(TOP_PluginInfo, apiVersion) == 0, "Incorrect Alignment"); 502 | static_assert(offsetof(TOP_PluginInfo, executeMode) == 4, "Incorrect Alignment"); 503 | static_assert(offsetof(TOP_PluginInfo, customOPInfo) == 408, "Incorrect Alignment"); 504 | static_assert(sizeof(TOP_PluginInfo) == 944, "Incorrect Size"); 505 | 506 | static_assert(offsetof(TOP_GeneralInfo, cookEveryFrame) == 0, "Incorrect Aligment"); 507 | static_assert(offsetof(TOP_GeneralInfo, cookEveryFrameIfAsked) == 1, "Incorrect Aligment"); 508 | static_assert(offsetof(TOP_GeneralInfo, inputSizeIndex) == 4, "Incorrect Aligment"); 509 | static_assert(sizeof(TOP_GeneralInfo) == 88, "Incorrect Size"); 510 | 511 | static_assert(offsetof(TOP_OutputFormat, width) == 0, "Incorrect Aligment"); 512 | static_assert(offsetof(TOP_OutputFormat, height) == 4, "Incorrect Aligment"); 513 | static_assert(offsetof(TOP_OutputFormat, aspectX) == 8, "Incorrect Aligment"); 514 | static_assert(offsetof(TOP_OutputFormat, aspectY) == 12, "Incorrect Aligment"); 515 | static_assert(offsetof(TOP_OutputFormat, pixelFormat) == 16, "Incorrect Aligment"); 516 | static_assert(offsetof(TOP_OutputFormat, antiAlias) == 20, "Incorrect Aligment"); 517 | static_assert(offsetof(TOP_OutputFormat, numColorBuffers) == 24, "Incorrect Aligment"); 518 | static_assert(offsetof(TOP_OutputFormat, depthFormat) == 28, "Incorrect Aligment"); 519 | static_assert(offsetof(TOP_OutputFormat, stencilBuffer) == 32, "Incorrect Aligment"); 520 | static_assert(sizeof(TOP_OutputFormat) == 116, "Incorrect Size"); 521 | 522 | static_assert(offsetof(TOP_UploadInfo, bufferOffset) == 0, "Incorrect Alignment"); 523 | static_assert(offsetof(TOP_UploadInfo, textureDesc) == 8, "Incorrect Alignment"); 524 | static_assert(offsetof(TOP_UploadInfo, firstPixel) == 156+8, "Incorrect Alignment"); 525 | static_assert(offsetof(TOP_UploadInfo, colorBufferIndex) == 156+12, "Incorrect Alignment"); 526 | static_assert(sizeof(TOP_UploadInfo) == 156 + 116, "Incorrect Size"); 527 | 528 | }; // namespace TD 529 | 530 | #endif 531 | -------------------------------------------------------------------------------- /out/HotReloadClient.tox: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/satoruhiga/TouchDesigner-Plugin-Template/8b64eeb87c25ae27f9185b93f9f327fc9fa761db/out/HotReloadClient.tox -------------------------------------------------------------------------------- /out/test.toe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/satoruhiga/TouchDesigner-Plugin-Template/8b64eeb87c25ae27f9185b93f9f327fc9fa761db/out/test.toe -------------------------------------------------------------------------------- /src/CHOP_main.cpp: -------------------------------------------------------------------------------- 1 | #include "CPlusPlus_Common.h" 2 | #include "CHOP_CPlusPlusBase.h" 3 | 4 | using namespace TD; 5 | 6 | //// 7 | 8 | class CustomCHOP : public CHOP_CPlusPlusBase 9 | { 10 | public: 11 | 12 | CustomCHOP(const OP_NodeInfo* info) 13 | {} 14 | 15 | virtual ~CustomCHOP() override 16 | {} 17 | 18 | void setupParameters(OP_ParameterManager* manager, void* reserved1) override 19 | {} 20 | 21 | void getGeneralInfo(CHOP_GeneralInfo* info, const OP_Inputs *inputs, void* reserved1) override 22 | {} 23 | 24 | bool getOutputInfo(CHOP_OutputInfo* info, const OP_Inputs *inputs, void *reserved1) override 25 | { 26 | info->numSamples = 600; 27 | info->numChannels = 1; 28 | 29 | return true; 30 | } 31 | 32 | void getChannelName(int32_t index, OP_String *name, 33 | const OP_Inputs *inputs, void* reserved1) override 34 | { 35 | name->setString("chan1"); 36 | } 37 | 38 | void execute(CHOP_Output* output, const OP_Inputs* inputs, void* reserved1) override 39 | { 40 | for (int i = 0; i < output->numSamples; i++) 41 | { 42 | float d = (float)i / float(output->numSamples - 1); 43 | output->channels[0][i] = sinf(d * 3.1415f * 2.0f); 44 | } 45 | } 46 | }; 47 | 48 | //// 49 | 50 | extern "C" 51 | { 52 | DLLEXPORT void FillCHOPPluginInfo(CHOP_PluginInfo *info) 53 | { 54 | // Always set this to CHOPCPlusPlusAPIVersion. 55 | info->apiVersion = CHOPCPlusPlusAPIVersion; 56 | 57 | // The opType is the unique name for this CHOP. It must start with a 58 | // capital A-Z character, and all the following characters must lower case 59 | // or numbers (a-z, 0-9) 60 | info->customOPInfo.opType->setString("Testop"); 61 | 62 | // The opLabel is the text that will show up in the OP Create Dialog 63 | info->customOPInfo.opLabel->setString("Test OP"); 64 | 65 | // Will be turned into a 3 letter icon on the nodes 66 | info->customOPInfo.opIcon->setString("TST"); 67 | 68 | // Information about the author of this OP 69 | info->customOPInfo.authorName->setString("Author Name"); 70 | info->customOPInfo.authorEmail->setString("email@email.com"); 71 | 72 | // This CHOP can work with 0 inputs 73 | info->customOPInfo.minInputs = 0; 74 | 75 | // It can accept up to 1 input though, which changes it's behavior 76 | info->customOPInfo.maxInputs = 1; 77 | } 78 | 79 | DLLEXPORT CHOP_CPlusPlusBase* CreateCHOPInstance(const OP_NodeInfo* info) 80 | { 81 | return new CustomCHOP(info); 82 | } 83 | 84 | DLLEXPORT void DestroyCHOPInstance(CHOP_CPlusPlusBase* instance) 85 | { 86 | delete (CustomCHOP*)instance; 87 | } 88 | }; 89 | -------------------------------------------------------------------------------- /src/DAT_main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "CPlusPlus_Common.h" 4 | #include "DAT_CPlusPlusBase.h" 5 | 6 | using namespace TD; 7 | 8 | //// 9 | 10 | class CustomDAT : public DAT_CPlusPlusBase 11 | { 12 | public: 13 | CustomDAT(const OP_NodeInfo *info) {} 14 | 15 | virtual ~CustomDAT() {} 16 | 17 | void setupParameters(OP_ParameterManager *manager, void *reserved1) override 18 | { 19 | } 20 | 21 | void getGeneralInfo(DAT_GeneralInfo *ginfo, 22 | const OP_Inputs *inputs, 23 | void *reserved1) override 24 | { 25 | } 26 | 27 | void execute(DAT_Output *output, 28 | const OP_Inputs *inputs, 29 | void *reserved) override 30 | { 31 | if (!output) 32 | return; 33 | 34 | bool isTable = false; 35 | 36 | if (!isTable) // is Text 37 | { 38 | output->setOutputDataType(DAT_OutDataType::Text); 39 | output->setText("TEST from C++"); 40 | } 41 | else 42 | { 43 | output->setOutputDataType(DAT_OutDataType::Table); 44 | output->setTableSize(2, 2); 45 | 46 | for (int i = 0; i < 2; i++) 47 | { 48 | for (int j = 0; j < 2; j++) 49 | { 50 | const std::string s = std::to_string(i) + ":" + std::to_string(j); 51 | 52 | output->setCellString(i, j, s.c_str()); 53 | } 54 | } 55 | } 56 | } 57 | }; 58 | 59 | //// 60 | 61 | extern "C" 62 | { 63 | DLLEXPORT void FillDATPluginInfo(DAT_PluginInfo *info) 64 | { 65 | // Always return DAT_CPLUSPLUS_API_VERSION in this function. 66 | info->apiVersion = DATCPlusPlusAPIVersion; 67 | 68 | // The opType is the unique name for this CHOP. It must start with a 69 | // capital A-Z character, and all the following characters must lower case 70 | // or numbers (a-z, 0-9) 71 | info->customOPInfo.opType->setString("Testop"); 72 | 73 | // The opLabel is the text that will show up in the OP Create Dialog 74 | info->customOPInfo.opLabel->setString("Test OP"); 75 | 76 | // Will be turned into a 3 letter icon on the nodes 77 | info->customOPInfo.opIcon->setString("TST"); 78 | 79 | // Information about the author of this OP 80 | info->customOPInfo.authorName->setString("Author Name"); 81 | info->customOPInfo.authorEmail->setString("email@email.com"); 82 | 83 | info->customOPInfo.minInputs = 0; 84 | info->customOPInfo.maxInputs = 1; 85 | } 86 | 87 | DLLEXPORT DAT_CPlusPlusBase *CreateDATInstance(const OP_NodeInfo *info) 88 | { 89 | return new CustomDAT(info); 90 | } 91 | 92 | DLLEXPORT void DestroyDATInstance(DAT_CPlusPlusBase *instance) 93 | { 94 | delete (CustomDAT *)instance; 95 | } 96 | }; 97 | -------------------------------------------------------------------------------- /src/SOP_main.cpp: -------------------------------------------------------------------------------- 1 | #include "CPlusPlus_Common.h" 2 | #include "SOP_CPlusPlusBase.h" 3 | 4 | using namespace TD; 5 | 6 | //// 7 | 8 | class CustomSOP : public SOP_CPlusPlusBase 9 | { 10 | public: 11 | 12 | CustomSOP(const OP_NodeInfo* info) 13 | {} 14 | 15 | virtual ~CustomSOP() 16 | {} 17 | 18 | void setupParameters(OP_ParameterManager* manager, void* reserved1) override 19 | {} 20 | 21 | void execute(SOP_Output* output, const OP_Inputs* inputs, void* reserved) override 22 | { 23 | int N = 32; 24 | 25 | for (int i = 0; i < N; i++) 26 | { 27 | float d = (float)i / (N - 1); 28 | 29 | float x = sin(d * 3.1415 * 2); 30 | float y = cos(d * 3.1415 * 2); 31 | 32 | output->addPoint(Position(x, y, 0)); 33 | } 34 | } 35 | 36 | void executeVBO(SOP_VBOOutput* output, const OP_Inputs*, void* reserved) override 37 | {} 38 | 39 | }; 40 | 41 | //// 42 | 43 | extern "C" 44 | { 45 | 46 | DLLEXPORT void FillSOPPluginInfo(SOP_PluginInfo *info) 47 | { 48 | // Always return SOP_CPLUSPLUS_API_VERSION in this function. 49 | info->apiVersion = SOPCPlusPlusAPIVersion; 50 | 51 | // The opType is the unique name for this TOP. It must start with a 52 | // capital A-Z character, and all the following characters must lower case 53 | // or numbers (a-z, 0-9) 54 | info->customOPInfo.opType->setString("Testop"); 55 | 56 | // The opLabel is the text that will show up in the OP Create Dialog 57 | info->customOPInfo.opLabel->setString("Test OP"); 58 | 59 | // Will be turned into a 3 letter icon on the nodes 60 | info->customOPInfo.opIcon->setString("TST"); 61 | 62 | // Information about the author of this OP 63 | info->customOPInfo.authorName->setString("Author Name"); 64 | info->customOPInfo.authorEmail->setString("email@email.com"); 65 | 66 | // This SOP works with 0 or 1 inputs 67 | info->customOPInfo.minInputs = 0; 68 | info->customOPInfo.maxInputs = 1; 69 | 70 | } 71 | DLLEXPORT SOP_CPlusPlusBase* CreateSOPInstance(const OP_NodeInfo* info) 72 | { 73 | return new CustomSOP(info); 74 | } 75 | 76 | DLLEXPORT void DestroySOPInstance(SOP_CPlusPlusBase* instance) 77 | { 78 | delete (CustomSOP*)instance; 79 | } 80 | }; 81 | -------------------------------------------------------------------------------- /src/TOP_main.cpp: -------------------------------------------------------------------------------- 1 | #include "CPlusPlus_Common.h" 2 | #include "TOP_CPlusPlusBase.h" 3 | 4 | using namespace TD; 5 | 6 | //// 7 | 8 | 9 | class CustomTOP : public TOP_CPlusPlusBase 10 | { 11 | public: 12 | TOP_Context* myContext; 13 | 14 | CustomTOP(const OP_NodeInfo *info, TOP_Context* context) 15 | : myContext(context) 16 | {} 17 | 18 | virtual ~CustomTOP() 19 | {} 20 | 21 | void setupParameters(OP_ParameterManager* manager, void* reserved1) override 22 | {} 23 | 24 | void getGeneralInfo(TOP_GeneralInfo* ginfo, const OP_Inputs*, void *reserved1) override 25 | { 26 | ginfo->cookEveryFrameIfAsked = true; 27 | } 28 | 29 | void execute(TOP_Output* output, const OP_Inputs* inputs, void* reserved1) override 30 | { 31 | TOP_UploadInfo info; 32 | info.textureDesc.texDim = OP_TexDim::e2D; 33 | info.textureDesc.width = 256; 34 | info.textureDesc.height = 256; 35 | info.textureDesc.pixelFormat = OP_PixelFormat::BGRA8Fixed; 36 | info.colorBufferIndex = 0; 37 | 38 | size_t byteSize = info.textureDesc.width * info.textureDesc.height * 4 * sizeof(uint8_t); 39 | OP_SmartRef buf = myContext->createOutputBuffer(byteSize, TOP_BufferFlags::None, nullptr); 40 | 41 | uint8_t* mem = (uint8_t*)buf->data; 42 | 43 | for (int y = 0; y < info.textureDesc.height; y++) 44 | { 45 | uint8_t* pixel = mem + info.textureDesc.width * y * 4; 46 | float v = (float)y / (info.textureDesc.height - 1); 47 | 48 | for (int x = 0; x < info.textureDesc.width; x++) 49 | { 50 | float u = (float)x / (info.textureDesc.width - 1); 51 | 52 | pixel[0] = u * 255; 53 | pixel[1] = v * 255; 54 | pixel[2] = 0; 55 | pixel[3] = 255; 56 | 57 | pixel += 4; 58 | } 59 | } 60 | 61 | output->uploadBuffer(&buf, info, nullptr); 62 | } 63 | 64 | }; 65 | 66 | //// 67 | 68 | extern "C" 69 | { 70 | DLLEXPORT void FillTOPPluginInfo(TOP_PluginInfo *info) 71 | { 72 | // This must always be set to this constant 73 | info->apiVersion = TOPCPlusPlusAPIVersion; 74 | 75 | // Change this to change the executeMode behavior of this plugin. 76 | info->executeMode = TOP_ExecuteMode::CPUMem; 77 | 78 | // The opType is the unique name for this TOP. It must start with a 79 | // capital A-Z character, and all the following characters must lower case 80 | // or numbers (a-z, 0-9) 81 | info->customOPInfo.opType->setString("Testop"); 82 | 83 | // The opLabel is the text that will show up in the OP Create Dialog 84 | info->customOPInfo.opLabel->setString("Test OP"); 85 | 86 | // Will be turned into a 3 letter icon on the nodes 87 | info->customOPInfo.opIcon->setString("TST"); 88 | 89 | // Information about the author of this OP 90 | info->customOPInfo.authorName->setString("Author Name"); 91 | info->customOPInfo.authorEmail->setString("email@email.com"); 92 | 93 | // This TOP works with 0 or 1 inputs connected 94 | info->customOPInfo.minInputs = 0; 95 | info->customOPInfo.maxInputs = 1; 96 | } 97 | 98 | DLLEXPORT TOP_CPlusPlusBase* CreateTOPInstance(const OP_NodeInfo* info, TOP_Context* context) 99 | { 100 | return new CustomTOP(info, context); 101 | } 102 | 103 | DLLEXPORT void DestroyTOPInstance(TOP_CPlusPlusBase* instance, TOP_Context *context) 104 | { 105 | delete (CustomTOP*)instance; 106 | } 107 | }; 108 | --------------------------------------------------------------------------------