1 /*========================================================================= 2 3 Program: Visualization Toolkit 4 Module: vtkOSPRayMaterial.h 5 6 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 7 All rights reserved. 8 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 9 10 This software is distributed WITHOUT ANY WARRANTY; without even 11 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 12 PURPOSE. See the above copyright notice for more information. 13 14 =========================================================================*/ 15 /** 16 * @class vtkOSPRayMaterialHelpers 17 * @brief convert vtk appearance controls to ospray materials 18 * 19 * Routines that convert vtk's appearance controlling state into ospray 20 * specific calls to create materials. The key piece of information is the 21 * vtkProperty::MaterialName, the rest is looked up from the 22 * vtkOSPRayMaterialLibrary singleton. 23 * The routines here are used by vtkOSPRayPolyDataMapperNode at render time. 24 * 25 * The contents here are private implementation details, and not meant to 26 * be part of VTK's public API. 27 * 28 * @sa vtkOSPRayMaterialLibrary 29 */ 30 31 #ifndef vtkOSPRayMaterialHelpers_h 32 #define vtkOSPRayMaterialHelpers_h 33 34 #include <map> 35 #include <string> 36 37 #include "RTWrapper/RTWrapper.h" // for handle types 38 39 class vtkImageData; 40 class vtkOSPRayRendererNode; 41 42 namespace vtkOSPRayMaterialHelpers 43 { 44 45 /** 46 * Helper function to make a 2d OSPRay Texture. 47 * Was promoted from OSPRay because of deprecation there. 48 */ 49 OSPTexture NewTexture2D(RTW::Backend* backend, const osp::vec2i& size, const OSPTextureFormat type, 50 void* data, const uint32_t _flags); 51 52 /** 53 * Manufacture an ospray texture from a 2d vtkImageData. 54 * isSRGB can be set to true if the image is 8-bits and sRGB encoded. 55 */ 56 OSPTexture VTKToOSPTexture( 57 RTW::Backend* backend, vtkImageData* vColorTextureMap, bool isSRGB = false); 58 59 /** 60 * Construct a set of ospray materials for all of the material names. 61 */ 62 void MakeMaterials( 63 vtkOSPRayRendererNode* orn, OSPRenderer oRenderer, std::map<std::string, OSPMaterial>& mats); 64 65 /** 66 * Construct one ospray material within the given renderer that 67 * corresponds to the visual characteristics set out in the named 68 * material in the material library. 69 */ 70 OSPMaterial MakeMaterial(vtkOSPRayRendererNode* orn, OSPRenderer oRenderer, std::string nickname); 71 72 /** 73 * Wraps ospNewMaterial 74 */ 75 OSPMaterial NewMaterial(vtkOSPRayRendererNode* orn, OSPRenderer oRenderer, std::string ospMatName); 76 77 } 78 #endif 79 // VTK-HeaderTest-Exclude: vtkOSPRayMaterialHelpers.h 80