// ----------------------------------------------------------------------------- // Note: Always order struct fields by CUDA alignment restrictions // Pad struct to 16 bytes if used in array // // https://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html#vector-types // float4, float2, float3/float/int, short, byte (buffer/program/sampler ids are integers) // ----------------------------------------------------------------------------- // Easy Architect 3D includes (keep aligned with "GLOptixCommon.pas") #pragma once #include #include "commonStructs.h" // Optix Ray Type #define RADIANCE_RAY_TYPE 0 // Usato per calcolare i metariali (any hit e close hit) #define SHADOW_RAY_TYPE 1 // Usato per calcolare le ombre (any hit) #define TRANSPARENCY_RAY_TYPE 2 // Usato per calcolare le rifrazioni e lo spessore degli oggetti (any hit) // Optix "RADIANCE sub_ray_type" Type #define SUB_RAY_TYPE_PRIMARY 1 #define SUB_RAY_TYPE_REFLECTION 2 #define SUB_RAY_TYPE_REFRACTION 3 #define SUB_RAY_TYPE_AMBIENT_OCCLUSION 4 #define SUB_RAY_TYPE_RADIOSITY 5 // Global Raytrace Options/Settings #define OPTIX_RAYOPT_NONE 0x00000000 #define OPTIX_RAYOPT_OPAQUE_WALLS 0x00000001 #define OPTIX_RAYOPT_ENABLE_AMBIENT_OCCLUSION 0x00000002 #define OPTIX_RAYOPT_ENABLE_REFLECTIONS 0x00000004 #define OPTIX_RAYOPT_ENABLE_REFL_BLURRING 0x00000008 #define OPTIX_RAYOPT_ENABLE_REFRACTIONS 0x00000010 #define OPTIX_RAYOPT_ENABLE_REFR_BLURRING 0x00000020 // Item Options #define OPTIX_ITEM_ENABLED 0x00000001 #define OPTIX_ITEM_VISIBLE 0x00000002 #define OPTIX_ITEM_CAST_SHADOWS 0x00000004 #define OPTIX_ITEM_NOT_IN_RAYTRACE 0x00000008 // Mesh Options #define MESH_OPT_ENABLED 0x00000001 #define MESH_OPT_VISIBLE 0x00000002 #define MESH_OPT_CAST_SHADOWS 0x00000004 #define MESH_FORCE_SINGLE_SIDED 0x00000008 // Light Options (general flags) #define LIGHT_OPT_ON 0x00000001 #define LIGHT_OPT_CAST_SHADOWS 0x00000002 #define LIGHT_OPT_AMBIENT_ON 0x00000004 #define LIGHT_OPT_DIFFUSE_ON 0x00000008 #define LIGHT_OPT_SPECULAR_ON 0x00000010 #define LIGHT_OPT_HDR_EMISSION_MAP 0x00010000 // Light Options (light type) #define LIGHT_OPT_LT_MASK 0x0F000000 #define LIGHT_OPT_LT_POINT_LIGHT 0x01000000 #define LIGHT_OPT_LT_SPOT_LIGHT 0x02000000 #define LIGHT_OPT_LT_DIRECTIONAL_LIGHT 0x03000000 #define LIGHT_OPT_LT_PHOTOMETRIC_LIGHT 0x04000000 #define LIGHT_OPT_LT_AREA_LIGHT 0x05000000 #define LIGHT_OPT_LT_PHOTOMETRIC_ASM_LIGHT 0x06000000 // Material Options #define OPTIX_MATERIAL_TWO_SIDED 0x00000001 #define OPTIX_MATERIAL_AMBIENT_ON 0x00000002 #define OPTIX_MATERIAL_DIFFUSE_ON 0x00000004 #define OPTIX_MATERIAL_SPECULAR_ON 0x00000008 #define OPTIX_MATERIAL_EMISSION_ON 0x00000010 #define OPTIX_MATERIAL_SHININESS_ON 0x00000020 #define OPTIX_MATERIAL_TRANSPARENCY_ON 0x00000040 #define OPTIX_MATERIAL_RAYTRACED_REFLECTIONS_ON 0x00000080 #define OPTIX_MATERIAL_REFLECTION_BLUR_ON 0x00000100 #define OPTIX_MATERIAL_BRILLIANCE_ON 0x00000200 #define OPTIX_MATERIAL_ROUGHNESS_ON 0x00000400 #define OPTIX_MATERIAL_ENVIRONMENTAL_REFLECTIONS_ON 0x00000800 #define OPTIX_MATERIAL_REFRACTIONS_ON 0x00001000 #define OPTIX_MATERIAL_METALLIC_REFLECTIONS 0x00002000 #define OPTIX_MATERIAL_FRESNEL_ON 0x00004000 #define OPTIX_MATERIAL_ABSORPTION_ON 0x00008000 #define OPTIX_MATERIAL_TRANSPARENCY_COLOR_FILER_ON 0x00010000 #define OPTIX_MATERIAL_ANISOTROPICITY_ON 0x00020000 #define OPTIX_MATERIAL_ABSORPTION_USE_IOR 0x00040000 #define OPTIX_MATERIAL_TRANSPARENCY_BLUR_ON 0x00080000 #define OPTIX_MATERIAL_TRANSP_BLUR_USE_ETCHING 0x00100000 // Optix Material Texture presence flag #define OPTIX_TEXTURE_NONE 0x00000000 #define OPTIX_TEXTURE_PRIMARY 0x00000001 #define OPTIX_TEXTURE_SECONDARY 0x00000002 #define OPTIX_TEXTURE_BUMP 0x00000004 #define OPTIX_TEXTURE_SPECULAR 0x00000008 #define OPTIX_TEXTURE_REFLECTIVE 0x00000010 #define OPTIX_TEXTURE_ATTENUATION 0x00000020 #define OPTIX_TEXTURE_ENVIRONMENT 0x00000040 #define OPTIX_TEXTURE_OPACITY 0x00000080 #define OPTIX_TEXTURE_DECAL 0x00000100 #define OPTIX_TEXTURE_EMISSION 0x00000200 #define OPTIX_TEXTURE_BLURRING 0x00000400 #define OPTIX_TEXTURE_SHADOW_MAP 0x00000800 #define OPTIX_TEXTURE_DISPLACEMENT 0x00001000 #define OPTIX_TEXTURE_SHININESS 0x00002000 #define OPTIX_TEXTURE_SPECULAR_COLOR 0x00004000 #define OPTIX_TEXTURE_PHOTOMETRIC_MAP 0x00008000 #define OPTIX_TEXTURE_NK_DATA_MAP 0x00010000 // Texture Image Option #define OPTIX_HDR_RGBE_ENCODED_IMAGE 0x00000001 #define OPTIX_VERT_ATTR_NONE 0x00000000 #define OPTIX_VERT_ATTR_HAVE_NORMAL 0x00000001 #define OPTIX_VERT_ATTR_HAVE_TANGENT 0x00000002 #define OPTIX_VERT_ATTR_HAVE_BINORMAL 0x00000004 #define OPTIX_VERT_ATTR_HAVE_TEXCOORD 0x00000008 #define OPTIX_VERT_ATTR_HAVE_COLOR 0x00000010 #define MAX_TEXTURES 16 typedef unsigned char UCHAR; typedef unsigned int UINT; typedef unsigned short WORD; // Material's Texture Index typedef enum { MapTypeTexture1 = 0, MapTypeTexture2, MapTypeOpacity, MapTypeBump, MapTypeSpecular, MapTypeReflective, MapTypeAttenuation, MapTypeEnvironmental, MapTypeDecal, MapTypeEmissionColor, MapTypeBlurring, MapTypeDisplacement, MapTypeShininess, MapTypeSpecularColor, MapTypeNKData = 15, MapTypeIesData = 16 } TOptixEA3DMapType; typedef enum { mtStandard = 0, mtGenericShaderLanguage, mtMatte, mtPlastic, mtMetal, mtBrushedMetal, mtVelvet, mtGlass, mtDiffuseTransmitter, mtIndigo, mtGlossy, mtLiquid, mtMirror, mtCeramic, mtVarnished, mtSemiGlossy, mtSilk, mtLightEmitter, mtDiffuse, mtMarmiPietre, mtTranslucid } TOptixEA3DMaterialType; typedef enum { cmNormalColor = 0, cmLightsShowAmbientIntensity, cmLightsShowDiffuseIntensity, cmLightsShowSpecularIntensity, cmLightsShowShadowsIntensity, cmPixelLuminanceIntensity } TOptixEA3DPixelOutputColorMode; typedef enum { stOpenGLStandard = 0, stLambertBlinn, stLambertPhong, stLambertWard, stOrenNayar, stMinneart, stCookTorrance, stVelvet, stTranslucid } TOptixEA3DMaterialIlluminationModel; typedef enum { MapUVMapping = 0, MapObjectLinear, MapEyeLinear, MapSphereMapping, MapCubeMapping } TOptixEA3DMappingModeType; typedef enum { MainMaterial = 0, SecondMaterial } TOptixEA3DMaterialIndex; // Pad struct to 16 bytes if used in array typedef struct struct_TOptixEA3DTextureData { unsigned int Options; unsigned char MappingMode; //unsigned char RepeatMode; float UOffset; float VOffset; float UScale; float VScale; //float Rotation; float MinAmount; float MaxAmount; } TOptixEA3DTextureData; // Pad struct to 16 bytes if used in array typedef struct struct_OptixEA3DMaterial { unsigned int MatOptions; // Material Options unsigned int TexOptions; // Material Texturing Options unsigned int MatType; // mtStandard,mtGenericShaderLanguage,mtMatte,mtPlastic,mtMetal,mtBrushedMetal,mtVelvet,mtGlass,mtDiffuseTransmitter,mtIndigo,mtGlossy,mtLiquid,mtMirror unsigned int MatSubType; // mstStandard,mstAcciaioInox,mstCromatura,mstAlluminio,mstOro,mstArgento,mstOttone,mstRame,mstLaminati,mstFormica,mstVernice,mstSmalto,mstLaccatura,mstTenda,mstParalume,mstCeramica,mstPorcellana unsigned int MatIllumModel; // stOpenGLStandard,stLambertBlinn,stLambertPhong,stLambertWard,stOrenNayar,stMinneart,stCookTorrance,stVelvet float3 Ambient; float AmbientLevel; float3 Diffuse; float DiffuseLevel; float3 Specular; float SpecularLevel; float ShininessLevel; float GLShininessLevel; float3 Emission; float EmissionLevel; float EmissionGain; float3 ReflectanceColor; float3 SolidColor; float BrillianceLevel; float RoughnessLevel; float AnisotropicityLevel; float EnvironmentalReflectionsValue; float RaytracedReflectionsValue; float MetallicReflectionValue; float ReflectionBlurringValue; float FresnelLevel; float TransparencyLevel; float TransparencyBlurValue; float RefractionsLevel; float AbsorptionLevel; float TransparencyColorFilterLevel; float SheenLevel; float BackscatterLevel; float SubSurfaceScatteringLevel; float AreaMinShininness; // Area Light min lamp shininness float AreaMaxShininness; // Area Light min lamp shininness float AreaMinReflections; // Area Light min lamp reflections float AreaMaxReflections; // Area Light min lamp reflections float TranslucencyLevel; // Padding float3 ColorPadding01; float3 ColorPadding02; float3 ColorPadding03; float ValuePadding01; float ValuePadding02; int IntValuePadding01; int IntValuePadding02; // Textures Data (Settings) TOptixEA3DTextureData TextureData[MAX_TEXTURES]; // Textures IDs (Images) WORD TextureIds[MAX_TEXTURES]; } TOptixEA3DMaterial; // Pad struct to 16 bytes if used in array typedef struct struct_OptixEA3DLight { int LightOptions; float3 Position; float3 Ambient; float3 Diffuse; float3 Specular; float ConstantAttenuation; // K0 float LinearAttenuation; // K1 float QuadraticAttenuation; // K2 float3 FrontVector; // equals "SpotDirection" float3 RightVector; // this is Right float3 UpVector; // UpVector is calculated FrontVector X RightVector // float3 SpotDirection; // equals "FrontVector" float SpotExponent; float SpotCosPenumbra; float SpotCosCutoff; float AreaSizeX; // Area Size in the direction of "RightVector" float AreaSizeY; // Area Size in the direction of "UpVector" int IesTextureId; int EmissionTextureId; float EmissionTextureUOffset; float EmissionTextureVOffset; float EmissionTextureUGain; float EmissionTextureVGain; } TOptixEA3DLight; // Pad struct to 16 bytes if used in array typedef struct struct_TOptixEA3DVertexData { int Attribute; float3 Position; float3 Normal; float3 Tangent; float3 Binormal; float3 RadColor; float2 TexCoord; float AOValue; int PAD; // Optix ha comunque arrotondato a 80 byte } TOptixEA3DVertexData; // Pad struct to 16 bytes if used in array typedef struct struct_TOptixEA3DGlobalSettings { int Options; float GammaValue; float SceneEpsilon; float3 GlobalAmbientLight; float3 BackgroundColor; float3 BadColor1; float3 BadColor2; UCHAR MaxRefractionDepth; // Limite su ricorsione nelle Rifrazioni UCHAR MaxReflectionDepth; // Limite su ricorsione nelle Riflessioni UCHAR AA_MaxSamples; UCHAR AO_MaxSamples; float AA_JitterFactor; float AA_MaxError; float AO_AmbientAmount; float AO_DiffuseAmount; float AO_MaxDistance; // Free Float values - RFU float ShadowsAmount; // Combacia con il valore dell'OpenGL float ValuePadding02; float ValuePadding03; float ValuePadding04; float ValuePadding05; float ValuePadding06; float ValuePadding07; float ValuePadding08; float ValuePadding09; float ValuePadding10; float ValuePadding11; float ValuePadding12; float ValuePadding13; float ValuePadding14; float ValuePadding15; float ValuePadding16; float ValuePadding17; float ValuePadding18; float ValuePadding19; float ValuePadding20; float ValuePadding21; float ValuePadding22; float ValuePadding23; float ValuePadding24; float ValuePadding25; float ValuePadding26; float ValuePadding27; float ValuePadding28; float ValuePadding29; // Free Int values - RFU int IntValuePadding01; int IntValuePadding02; int IntValuePadding03; int IntValuePadding04; int IntValuePadding05; int IntValuePadding06; int IntValuePadding07; int IntValuePadding08; int IntValuePadding09; // Free Byte values - RFU UCHAR PixelOutputColorMode; // Mi indica come deve essere calcolato il Pixel (OUTPUT COLOR). vedi "TOptixEA3DPixelOutputColorMode" UCHAR ByteValuePadding02; UCHAR ByteValuePadding03; UCHAR ByteValuePadding04; UCHAR ByteValuePadding05; UCHAR ByteValuePadding06; UCHAR ByteValuePadding07; UCHAR ByteValuePadding08; UCHAR ByteValuePadding09; UCHAR ByteValuePadding10; UCHAR ByteValuePadding11; UCHAR ByteValuePadding12; UCHAR ByteValuePadding13; UCHAR ByteValuePadding14; UCHAR ByteValuePadding15; UCHAR ByteValuePadding16; UCHAR ByteValuePadding17; UCHAR ByteValuePadding18; UCHAR ByteValuePadding19; } TOptixEA3DGlobalSettings; // Pad struct to 16 bytes if used in array typedef struct struct_TOptixEA3DPrimitiveData { int FgOptions; WORD FgUniqueId; WORD MaterialId; } TOptixEA3DPrimitiveData; // Color Ray data (RADIANCE_RAY_TYPE) struct TRadianceRayData { int object_id; int sub_ray_type; float importance; bool sub_sample; // Questo รจ il raggio sub sample di antialiasing int recursion_depth; // Livello di ricorsione raggiunto UINT seed; // Serve per tenere in progressivo nella funzione "rnd(x)" float3 color; // Colore RGB ottenuto dal tracciamento (punto intersecato) float z_depth; // Contiene la distanza del punto intersecato (quello a cui corrisponde il valore "result" sopra) }; // Shadow ray Data (SHADOW_RAY_TYPE) struct TShadowRayData { bool Shadowed; float3 ShadowColor; }; // Trasparency ray Data (TRANSPARENCY_RAY_TYPE) struct TTranspRayData { int object_id; int sub_ray_type; float max_distance; // Serve per calcolare lo spessore di "object_id" (per le trasparenze) float3 exit_point; // Punto di uscita Raggio rifratto };