• Main Page
  • Modules
  • Files
  • File List
  • Globals

NvFlow.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2014-2017, NVIDIA CORPORATION.  All rights reserved.
00003  *
00004  * NVIDIA CORPORATION and its licensors retain all intellectual property
00005  * and proprietary rights in and to this software, related documentation
00006  * and any modifications thereto.  Any use, reproduction, disclosure or
00007  * distribution of this software and related documentation without an express
00008  * license agreement from NVIDIA CORPORATION is strictly prohibited.
00009  */
00010 
00011 #pragma once
00012 
00013 #include "NvFlowContext.h"
00014 #include "NvFlowShader.h"
00015 
00016 // -------------------------- NvFlowGrid -------------------------------
00019 
00021 struct NvFlowGrid;
00022 
00024 struct NvFlowGridExport;
00025 
00027 enum NvFlowGridTextureChannel
00028 {
00029     eNvFlowGridTextureChannelVelocity = 0,
00030     eNvFlowGridTextureChannelDensity = 1,
00031     eNvFlowGridTextureChannelDensityCoarse = 2,
00032 
00033     eNvFlowGridTextureChannelCount
00034 };
00035 
00037 enum NvFlowMultiRes
00038 {
00039     eNvFlowMultiRes1x1x1 = 0,
00040     eNvFlowMultiRes2x2x2 = 1
00041 };
00042 
00044 struct NvFlowGridDesc
00045 {
00046     NvFlowFloat3 initialLocation;       
00047     NvFlowFloat3 halfSize;              
00048 
00049     NvFlowDim virtualDim;               
00050     NvFlowMultiRes densityMultiRes;     
00051 
00052     float residentScale;                
00053     float coarseResidentScaleFactor;    
00054 
00055     bool enableVTR;                     
00056     bool lowLatencyMapping;             
00057 };
00058 
00064 NV_FLOW_API void NvFlowGridDescDefaults(NvFlowGridDesc* desc);
00065 
00074 NV_FLOW_API NvFlowGrid* NvFlowCreateGrid(NvFlowContext* context, const NvFlowGridDesc* desc);
00075 
00081 NV_FLOW_API void NvFlowReleaseGrid(NvFlowGrid* grid);
00082 
00084 struct NvFlowGridResetDesc
00085 {
00086     NvFlowFloat3 initialLocation;       
00087     NvFlowFloat3 halfSize;              
00088 };
00089 
00095 NV_FLOW_API void NvFlowGridResetDescDefaults(NvFlowGridResetDesc* desc);
00096 
00103 NV_FLOW_API void NvFlowGridReset(NvFlowGrid* grid, const NvFlowGridResetDesc* desc);
00104 
00111 NV_FLOW_API void NvFlowGridSetTargetLocation(NvFlowGrid* grid, NvFlowFloat3 targetLocation);
00112 
00114 enum NvFlowGridDebugVisFlags
00115 {
00116     eNvFlowGridDebugVisDisabled = 0x00,     
00117     eNvFlowGridDebugVisBlocks = 0x01,       
00118     eNvFlowGridDebugVisEmitBounds = 0x02,   
00119     eNvFlowGridDebugVisShapesSimple = 0x04, 
00120 
00121     eNvFlowGridDebugVisCount
00122 };
00123 
00125 struct NvFlowGridParams
00126 {
00127     NvFlowFloat3 gravity;                   
00128 
00129     bool singlePassAdvection;               
00130 
00131     bool pressureLegacyMode;                
00132 
00133     bool bigEffectMode;                     
00134     float bigEffectPredictTime;             
00135 
00136     NvFlowGridDebugVisFlags debugVisFlags;  
00137 };
00138 
00144 NV_FLOW_API void NvFlowGridParamsDefaults(NvFlowGridParams* params);
00145 
00152 NV_FLOW_API void NvFlowGridSetParams(NvFlowGrid* grid, const NvFlowGridParams* params);
00153 
00155 struct NvFlowSupport
00156 {
00157     bool supportsVTR;       
00158 };
00159 
00169 NV_FLOW_API NvFlowResult NvFlowGridQuerySupport(NvFlowGrid* grid, NvFlowContext* context, NvFlowSupport* support);
00170 
00172 struct NvFlowQueryTime
00173 {
00174     float simulation;
00175 };
00176 
00186 NV_FLOW_API NvFlowResult NvFlowGridQueryTime(NvFlowGrid* grid, NvFlowQueryTime* gpuTime, NvFlowQueryTime* cpuTime);
00187 
00194 NV_FLOW_API void NvFlowGridGPUMemUsage(NvFlowGrid* grid, NvFlowUint64* numBytes);
00195 
00203 NV_FLOW_API void NvFlowGridUpdate(NvFlowGrid* grid, NvFlowContext* context, float dt);
00204 
00213 NV_FLOW_API NvFlowGridExport* NvFlowGridGetGridExport(NvFlowContext* context, NvFlowGrid* grid);
00214 
00216 // -------------------------- NvFlowGridMaterial -------------------------------
00219 
00221 struct NvFlowGridMaterialHandle
00222 {
00223     NvFlowGrid* grid;       
00224     NvFlowUint64 uid;       
00225 };
00226 
00228 enum NvFlowGridComponent
00229 {
00230     eNvFlowGridComponentVelocity = 0,
00231     eNvFlowGridComponentSmoke = 1,
00232     eNvFlowGridComponentTemperature = 2,
00233     eNvFlowGridComponentFuel = 3,
00234 
00235     eNvFlowGridNumComponents = 4
00236 };
00237 
00239 struct NvFlowGridMaterialPerComponent
00240 {
00241     float damping;                      
00242     float fade;                         
00243     float macCormackBlendFactor;        
00244     float macCormackBlendThreshold;     
00245     float allocWeight;                  
00246     float allocThreshold;               
00247 };
00248 
00250 struct NvFlowGridMaterialParams
00251 {
00252     NvFlowGridMaterialPerComponent velocity;    
00253     NvFlowGridMaterialPerComponent smoke;       
00254     NvFlowGridMaterialPerComponent temperature; 
00255     NvFlowGridMaterialPerComponent fuel;        
00256 
00257     float vorticityStrength;                    
00258     float vorticityVelocityMask;                
00259     float vorticityTemperatureMask;             
00260     float vorticitySmokeMask;                   
00261     float vorticityFuelMask;                    
00262     float vorticityConstantMask;                
00263 
00264     float ignitionTemp;                         
00265     float burnPerTemp;                          
00266     float fuelPerBurn;                          
00267     float tempPerBurn;                          
00268     float smokePerBurn;                         
00269     float divergencePerBurn;                    
00270     float buoyancyPerTemp;                      
00271     float coolingRate;                          
00272 };
00273 
00279 NV_FLOW_API void NvFlowGridMaterialParamsDefaults(NvFlowGridMaterialParams* params);
00280 
00288 NV_FLOW_API NvFlowGridMaterialHandle NvFlowGridGetDefaultMaterial(NvFlowGrid* grid);
00289 
00298 NV_FLOW_API NvFlowGridMaterialHandle NvFlowGridCreateMaterial(NvFlowGrid* grid, const NvFlowGridMaterialParams* params);
00299 
00306 NV_FLOW_API void NvFlowGridReleaseMaterial(NvFlowGrid* grid, NvFlowGridMaterialHandle material);
00307 
00315 NV_FLOW_API void NvFlowGridSetMaterialParams(NvFlowGrid* grid, NvFlowGridMaterialHandle material, const NvFlowGridMaterialParams* params);
00316 
00318 // -------------------------- NvFlowShape -------------------------------
00321 
00323 enum NvFlowShapeType
00324 {
00325     eNvFlowShapeTypeSDF = 0,
00326     eNvFlowShapeTypeSphere = 1,
00327     eNvFlowShapeTypeBox = 2,
00328     eNvFlowShapeTypeCapsule = 3,
00329     eNvFlowShapeTypePlane = 4
00330 };
00331 
00333 struct NvFlowShapeSDF;
00334 
00336 struct NvFlowShapeDescSDF
00337 {
00338     NvFlowUint sdfOffset;   
00339 };
00340 
00342 struct NvFlowShapeDescSphere
00343 {
00344     float radius;           
00345 };
00346 
00348 struct NvFlowShapeDescBox
00349 {
00350     NvFlowFloat3 halfSize;  
00351 };
00352 
00354 struct NvFlowShapeDescCapsule
00355 {
00356     float radius;           
00357     float length;           
00358 };
00359 
00361 struct NvFlowShapeDescPlane
00362 {
00363     NvFlowFloat3 normal;    
00364     float distance;         
00365 };
00366 
00368 union NvFlowShapeDesc
00369 {
00370     NvFlowShapeDescSDF sdf;
00371     NvFlowShapeDescSphere sphere;
00372     NvFlowShapeDescBox box;
00373     NvFlowShapeDescCapsule capsule;
00374     NvFlowShapeDescPlane plane;
00375 };
00376 
00378 struct NvFlowShapeSDFDesc
00379 {
00380     NvFlowDim resolution;       
00381 };
00382 
00388 NV_FLOW_API void NvFlowShapeSDFDescDefaults(NvFlowShapeSDFDesc* desc);
00389 
00391 struct NvFlowShapeSDFData
00392 {
00393     float* data;                
00394     NvFlowUint rowPitch;        
00395     NvFlowUint depthPitch;      
00396     NvFlowDim dim;              
00397 };
00398 
00407 NV_FLOW_API NvFlowShapeSDF* NvFlowCreateShapeSDF(NvFlowContext* context, const NvFlowShapeSDFDesc* desc);
00408 
00417 NV_FLOW_API NvFlowShapeSDF* NvFlowCreateShapeSDFFromTexture3D(NvFlowContext* context, NvFlowTexture3D* texture);
00418 
00424 NV_FLOW_API void NvFlowReleaseShapeSDF(NvFlowShapeSDF* shape);
00425 
00434 NV_FLOW_API NvFlowShapeSDFData NvFlowShapeSDFMap(NvFlowShapeSDF* shape, NvFlowContext* context);
00435 
00442 NV_FLOW_API void NvFlowShapeSDFUnmap(NvFlowShapeSDF* shape, NvFlowContext* context);
00443 
00445 // -------------------------- NvFlowGridEmit -------------------------------
00448 
00450 enum NvFlowGridEmitMode
00451 {
00452     eNvFlowGridEmitModeDefault = 0,                 
00453     eNvFlowGridEmitModeDisableVelocity = 0x01,      
00454     eNvFlowGridEmitModeDisableDensity = 0x02,       
00455     eNvFlowGridEmitModeDisableAlloc = 0x04,         
00456     eNvFlowGridEmitModeAllocShape = 0x08,           
00457 
00458     eNvFlowGridEmitModeAllocShapeOnly = 0x0F,       
00459 };
00460 
00462 struct NvFlowGridEmitParams
00463 {
00464     NvFlowUint shapeRangeOffset;                    
00465     NvFlowUint shapeRangeSize;                      
00466     NvFlowShapeType shapeType;                      
00467     float shapeDistScale;                           
00468 
00469     NvFlowFloat4x4 bounds;                          
00470     NvFlowFloat4x4 localToWorld;                    
00471     NvFlowFloat3 centerOfMass;                      
00472 
00473     float deltaTime;                                
00474 
00475     NvFlowUint emitMaterialIndex;                   
00476     NvFlowUint emitMode;                            
00477 
00478     NvFlowFloat3 allocationScale;                   
00479     float allocationPredict;                        
00480     NvFlowFloat3 predictVelocity;                   
00481     float predictVelocityWeight;                    
00482 
00483     float minActiveDist;                            
00484     float maxActiveDist;                            
00485     float minEdgeDist;                              
00486     float maxEdgeDist;                              
00487     float slipThickness;                            
00488     float slipFactor;                               
00489 
00490     NvFlowFloat3 velocityLinear;                    
00491     NvFlowFloat3 velocityAngular;                   
00492     NvFlowFloat3 velocityCoupleRate;                
00493 
00494     float smoke;                                    
00495     float smokeCoupleRate;                          
00496 
00497     float temperature;                              
00498     float temperatureCoupleRate;                    
00499 
00500     float fuel;                                     
00501     float fuelCoupleRate;                           
00502     float fuelReleaseTemp;                          
00503     float fuelRelease;                              
00504 };
00505 
00511 NV_FLOW_API void NvFlowGridEmitParamsDefaults(NvFlowGridEmitParams* params);
00512 
00522 NV_FLOW_API void NvFlowGridEmit(NvFlowGrid* grid, const NvFlowShapeDesc* shapes, NvFlowUint numShapes, const NvFlowGridEmitParams* params, NvFlowUint numParams);
00523 
00531 NV_FLOW_API void NvFlowGridUpdateEmitMaterials(NvFlowGrid* grid, NvFlowGridMaterialHandle* materials, NvFlowUint numMaterials);
00532 
00540 NV_FLOW_API void NvFlowGridUpdateEmitSDFs(NvFlowGrid* grid, NvFlowShapeSDF** sdfs, NvFlowUint numSdfs);
00541 
00543 // -------------------------- NvFlowGridEmitCustom -------------------------------
00546 
00548 struct NvFlowGridEmitCustomAllocParams
00549 {
00550     NvFlowResourceRW* maskResourceRW;   
00551 
00552     NvFlowDim maskDim;                  
00553 
00554     NvFlowFloat3 gridLocation;          
00555     NvFlowFloat3 gridHalfSize;          
00556 
00557     NvFlowGridMaterialHandle material;  
00558 };
00559 
00560 typedef void(*NvFlowGridEmitCustomAllocFunc)(void* userdata, const NvFlowGridEmitCustomAllocParams* params);
00561 
00569 NV_FLOW_API void NvFlowGridEmitCustomRegisterAllocFunc(NvFlowGrid* grid, NvFlowGridEmitCustomAllocFunc func, void* userdata);
00570 
00572 struct NvFlowGridEmitCustomEmitParams
00573 {
00574     NvFlowGrid* grid;           
00575     NvFlowUint numLayers;       
00576     void* flowInternal;         
00577 };
00578 
00580 struct NvFlowGridEmitCustomEmitLayerParams
00581 {
00582     NvFlowResourceRW* dataRW[2u];               
00583     NvFlowResource* blockTable;                 
00584     NvFlowResource* blockList;                  
00585 
00586     NvFlowShaderPointParams shaderParams;       
00587 
00588     NvFlowUint numBlocks;                       
00589     NvFlowUint maxBlocks;                       
00590 
00591     NvFlowFloat3 gridLocation;                  
00592     NvFlowFloat3 gridHalfSize;                  
00593 
00594     NvFlowGridMaterialHandle material;          
00595 };
00596 
00597 typedef void(*NvFlowGridEmitCustomEmitFunc)(void* userdata, NvFlowUint* dataFrontIdx, const NvFlowGridEmitCustomEmitParams* params);
00598 
00607 NV_FLOW_API void NvFlowGridEmitCustomRegisterEmitFunc(NvFlowGrid* grid, NvFlowGridTextureChannel channel, NvFlowGridEmitCustomEmitFunc func, void* userdata);
00608 
00616 NV_FLOW_API void NvFlowGridEmitCustomGetLayerParams(const NvFlowGridEmitCustomEmitParams* emitParams, NvFlowUint layerIdx, NvFlowGridEmitCustomEmitLayerParams* emitLayerParams);
00617 
00619 // -------------------------- NvFlowGridExportImport -------------------------------
00622 
00624 struct NvFlowGridExportImportLayerMapping
00625 {
00626     NvFlowGridMaterialHandle material;          
00627 
00628     NvFlowResource* blockTable;                 
00629     NvFlowResource* blockList;                  
00630 
00631     NvFlowUint numBlocks;                       
00632 };
00633 
00635 struct NvFlowGridExportImportLayeredMapping
00636 {
00637     NvFlowShaderLinearParams shaderParams;      
00638     NvFlowUint maxBlocks;                       
00639 
00640     NvFlowUint2* layeredBlockListCPU;           
00641     NvFlowUint layeredNumBlocks;                
00642 
00643     NvFlowFloat4x4 modelMatrix;                 
00644 };
00645 
00647 // -------------------------- NvFlowGridExport -------------------------------
00650 
00652 struct NvFlowGridExportHandle
00653 {
00654     NvFlowGridExport* gridExport;           
00655     NvFlowGridTextureChannel channel;       
00656     NvFlowUint numLayerViews;               
00657 };
00658 
00660 struct NvFlowGridExportLayerView
00661 {
00662     NvFlowResource* data;                           
00663     NvFlowGridExportImportLayerMapping mapping;     
00664 };
00665 
00667 struct NvFlowGridExportLayeredView
00668 {
00669     NvFlowGridExportImportLayeredMapping mapping;   
00670 };
00671 
00673 struct NvFlowGridExportSimpleShape
00674 {
00675     NvFlowFloat4x4 localToWorld;        
00676     NvFlowShapeDesc shapeDesc;          
00677 };
00678 
00680 struct NvFlowGridExportDebugVisView
00681 {
00682     NvFlowGridDebugVisFlags debugVisFlags;      
00683 
00684     NvFlowFloat4x4* bounds;                     
00685     NvFlowUint numBounds;                       
00686     NvFlowGridExportSimpleShape* spheres;       
00687     NvFlowUint numSpheres;                      
00688     NvFlowGridExportSimpleShape* capsules;      
00689     NvFlowUint numCapsules;                     
00690     NvFlowGridExportSimpleShape* boxes;         
00691     NvFlowUint numBoxes;                        
00692 };
00693 
00703 NV_FLOW_API NvFlowGridExportHandle NvFlowGridExportGetHandle(NvFlowGridExport* gridExport, NvFlowContext* context, NvFlowGridTextureChannel channel);
00704 
00712 NV_FLOW_API void NvFlowGridExportGetLayerView(NvFlowGridExportHandle handle, NvFlowUint layerIdx, NvFlowGridExportLayerView* layerView);
00713 
00720 NV_FLOW_API void NvFlowGridExportGetLayeredView(NvFlowGridExportHandle handle, NvFlowGridExportLayeredView* layeredView);
00721 
00728 NV_FLOW_API void NvFlowGridExportGetDebugVisView(NvFlowGridExport* gridExport, NvFlowGridExportDebugVisView* view);
00729 
00731 // -------------------------- NvFlowGridImport -------------------------------
00734 
00736 struct NvFlowGridImport;
00737 
00739 struct NvFlowGridImportDesc
00740 {
00741     NvFlowGridExport* gridExport;       
00742 };
00743 
00745 enum NvFlowGridImportMode
00746 {
00747     eNvFlowGridImportModePoint = 0,     
00748     eNvFlowGridImportModeLinear = 1     
00749 };
00750 
00752 struct NvFlowGridImportParams
00753 {
00754     NvFlowGridExport* gridExport;       
00755     NvFlowGridTextureChannel channel;   
00756     NvFlowGridImportMode importMode;    
00757 };
00758 
00760 struct NvFlowGridImportHandle
00761 {
00762     NvFlowGridImport* gridImport;       
00763     NvFlowGridTextureChannel channel;   
00764     NvFlowUint numLayerViews;           
00765 };
00766 
00768 struct NvFlowGridImportLayerView
00769 {
00770     NvFlowResourceRW* dataRW;                       
00771     NvFlowResourceRW* blockTableRW;                 
00772     NvFlowResourceRW* blockListRW;                  
00773     NvFlowGridExportImportLayerMapping mapping;     
00774 };
00775 
00777 struct NvFlowGridImportLayeredView
00778 {
00779     NvFlowGridExportImportLayeredMapping mapping;   
00780 };
00781 
00790 NV_FLOW_API NvFlowGridImport* NvFlowCreateGridImport(NvFlowContext* context, const NvFlowGridImportDesc* desc);
00791 
00797 NV_FLOW_API void NvFlowReleaseGridImport(NvFlowGridImport* gridImport);
00798 
00808 NV_FLOW_API NvFlowGridImportHandle NvFlowGridImportGetHandle(NvFlowGridImport* gridImport, NvFlowContext* context, const NvFlowGridImportParams* params);
00809 
00817 NV_FLOW_API void NvFlowGridImportGetLayerView(NvFlowGridImportHandle handle, NvFlowUint layerIdx, NvFlowGridImportLayerView* layerView);
00818 
00825 NV_FLOW_API void NvFlowGridImportGetLayeredView(NvFlowGridImportHandle handle, NvFlowGridImportLayeredView* layeredView);
00826 
00834 NV_FLOW_API void NvFlowGridImportReleaseChannel(NvFlowGridImport* gridImport, NvFlowContext* context, NvFlowGridTextureChannel channel);
00835 
00844 NV_FLOW_API NvFlowGridExport* NvFlowGridImportGetGridExport(NvFlowGridImport* gridImport, NvFlowContext* context);
00845 
00847 struct NvFlowGridImportStateCPU;
00848 
00850 struct NvFlowGridImportStateCPUParams
00851 {
00852     NvFlowGridImportStateCPU* stateCPU;     
00853     NvFlowGridTextureChannel channel;       
00854     NvFlowGridImportMode importMode;        
00855 };
00856 
00864 NV_FLOW_API NvFlowGridImportStateCPU* NvFlowCreateGridImportStateCPU(NvFlowGridImport* gridImport);
00865 
00871 NV_FLOW_API void NvFlowReleaseGridImportStateCPU(NvFlowGridImportStateCPU* stateCPU);
00872 
00880 NV_FLOW_API void NvFlowGridImportUpdateStateCPU(NvFlowGridImportStateCPU* stateCPU, NvFlowContext* context, NvFlowGridExport* gridExport);
00881 
00891 NV_FLOW_API NvFlowGridImportHandle NvFlowGridImportStateCPUGetHandle(NvFlowGridImport* gridImport, NvFlowContext* context, const NvFlowGridImportStateCPUParams* params);
00892 
00894 // -------------------------- NvFlowGridSummary -------------------------------
00897 
00899 struct NvFlowGridSummary;
00900 
00902 struct NvFlowGridSummaryDesc
00903 {
00904     NvFlowGridExport* gridExport;       
00905 };
00906 
00915 NV_FLOW_API NvFlowGridSummary* NvFlowCreateGridSummary(NvFlowContext* context, const NvFlowGridSummaryDesc* desc);
00916 
00922 NV_FLOW_API void NvFlowReleaseGridSummary(NvFlowGridSummary* gridSummary);
00923 
00925 struct NvFlowGridSummaryStateCPU;
00926 
00934 NV_FLOW_API NvFlowGridSummaryStateCPU* NvFlowCreateGridSummaryStateCPU(NvFlowGridSummary* gridSummary);
00935 
00941 NV_FLOW_API void NvFlowReleaseGridSummaryStateCPU(NvFlowGridSummaryStateCPU* stateCPU);
00942 
00944 struct NvFlowGridSummaryUpdateParams
00945 {
00946     NvFlowGridSummaryStateCPU* stateCPU;    
00947 
00948     NvFlowGridExport* gridExport;       
00949 };
00950 
00958 NV_FLOW_API void NvFlowGridSummaryUpdate(NvFlowGridSummary* gridSummary, NvFlowContext* context, const NvFlowGridSummaryUpdateParams* params);
00959 
00961 struct NvFlowGridSummaryDebugRenderParams
00962 {
00963     NvFlowGridSummaryStateCPU* stateCPU;
00964 
00965     NvFlowRenderTargetView* renderTargetView;   
00966 
00967     NvFlowFloat4x4 projectionMatrix;            
00968     NvFlowFloat4x4 viewMatrix;                  
00969 };
00970 
00978 NV_FLOW_API void NvFlowGridSummaryDebugRender(NvFlowGridSummary* gridSummary, NvFlowContext* context, const NvFlowGridSummaryDebugRenderParams* params);
00979 
00981 struct NvFlowGridSummaryResult
00982 {
00983     NvFlowFloat4 worldLocation;
00984     NvFlowFloat4 worldHalfSize;
00985     NvFlowFloat3 averageVelocity;
00986     float averageSpeed;
00987     float averageTemperature;
00988     float averageFuel;
00989     float averageBurn;
00990     float averageSmoke;
00991 };
00992 
01000 NV_FLOW_API NvFlowUint NvFlowGridSummaryGetNumLayers(NvFlowGridSummaryStateCPU* stateCPU);
01001 
01010 NV_FLOW_API NvFlowGridMaterialHandle NvFlowGridSummaryGetLayerMaterial(NvFlowGridSummaryStateCPU* stateCPU, NvFlowUint layerIdx);
01011 
01020 NV_FLOW_API void NvFlowGridSummaryGetSummaries(NvFlowGridSummaryStateCPU* stateCPU, NvFlowGridSummaryResult** results, NvFlowUint* numResults, NvFlowUint layerIdx);
01021 
01023 // -------------------------- NvFlowRenderMaterial -------------------------------
01026 
01028 struct NvFlowRenderMaterialPool;
01029 
01031 struct NvFlowRenderMaterialPoolDesc
01032 {
01033     NvFlowUint colorMapResolution;      
01034 };
01035 
01044 NV_FLOW_API NvFlowRenderMaterialPool* NvFlowCreateRenderMaterialPool(NvFlowContext* context, const NvFlowRenderMaterialPoolDesc* desc);
01045 
01051 NV_FLOW_API void NvFlowReleaseRenderMaterialPool(NvFlowRenderMaterialPool* pool);
01052 
01054 struct NvFlowRenderMaterialHandle
01055 {
01056     NvFlowRenderMaterialPool* pool;         
01057     NvFlowUint64 uid;                       
01058 };
01059 
01061 enum NvFlowVolumeRenderMode
01062 {
01063     eNvFlowVolumeRenderMode_colormap = 0,       
01064     eNvFlowVolumeRenderMode_raw = 1,            
01065     eNvFlowVolumeRenderMode_rainbow = 2,        
01066     eNvFlowVolumeRenderMode_debug = 3,          
01067 
01068     eNvFlowVolumeRenderModeCount
01069 };
01070 
01072 struct NvFlowRenderMaterialParams
01073 {
01074     NvFlowGridMaterialHandle material;          
01075 
01076     float alphaScale;                           
01077     float additiveFactor;                       
01078 
01079     NvFlowFloat4 colorMapCompMask;              
01080     NvFlowFloat4 alphaCompMask;                 
01081     NvFlowFloat4 intensityCompMask;             
01082 
01083     float colorMapMinX;                         
01084     float colorMapMaxX;                         
01085     float alphaBias;                            
01086     float intensityBias;                        
01087 };
01088 
01094 NV_FLOW_API void NvFlowRenderMaterialParamsDefaults(NvFlowRenderMaterialParams* params);
01095 
01103 NV_FLOW_API NvFlowRenderMaterialHandle NvFlowGetDefaultRenderMaterial(NvFlowRenderMaterialPool* pool);
01104 
01114 NV_FLOW_API NvFlowRenderMaterialHandle NvFlowCreateRenderMaterial(NvFlowContext* context, NvFlowRenderMaterialPool* pool, const NvFlowRenderMaterialParams* params);
01115 
01121 NV_FLOW_API void NvFlowReleaseRenderMaterial(NvFlowRenderMaterialHandle handle);
01122 
01129 NV_FLOW_API void NvFlowRenderMaterialUpdate(NvFlowRenderMaterialHandle handle, const NvFlowRenderMaterialParams* params);
01130 
01132 struct NvFlowColorMapData
01133 {
01134     NvFlowFloat4* data;         
01135     NvFlowUint dim;             
01136 };
01137 
01146 NV_FLOW_API NvFlowColorMapData NvFlowRenderMaterialColorMap(NvFlowContext* context, NvFlowRenderMaterialHandle handle);
01147 
01154 NV_FLOW_API void NvFlowRenderMaterialColorUnmap(NvFlowContext* context, NvFlowRenderMaterialHandle handle);
01155 
01157 // -------------------------- NvFlowVolumeRender -------------------------------
01160 
01162 struct NvFlowVolumeRender;
01163 
01165 struct NvFlowVolumeRenderDesc
01166 {
01167     NvFlowGridExport* gridExport;               
01168 };
01169 
01178 NV_FLOW_API NvFlowVolumeRender* NvFlowCreateVolumeRender(NvFlowContext* context, const NvFlowVolumeRenderDesc* desc);
01179 
01185 NV_FLOW_API void NvFlowReleaseVolumeRender(NvFlowVolumeRender* volumeRender);
01186 
01188 enum NvFlowVolumeRenderDownsample
01189 {
01190     eNvFlowVolumeRenderDownsampleNone = 0,
01191     eNvFlowVolumeRenderDownsample2x2 = 1
01192 };
01193 
01195 enum NvFlowMultiResRayMarch
01196 {
01197     eNvFlowMultiResRayMarchDisabled = 0,
01198     eNvFlowMultiResRayMarch2x2 = 1,
01199     eNvFlowMultiResRayMarch4x4 = 2,
01200     eNvFlowMultiResRayMarch8x8 = 3,
01201     eNvFlowMultiResRayMarch16x16 = 4,
01202 };
01203 
01205 struct NvFlowVolumeRenderViewport
01206 {
01207     float topLeftX;
01208     float topLeftY;
01209     float width;
01210     float height;
01211 };
01212 
01214 struct NvFlowVolumeRenderMultiResParams
01215 {
01216     bool enabled;                           
01217     float centerWidth;                      
01218     float centerHeight;                     
01219     float centerX;                          
01220     float centerY;                          
01221     float densityScaleX[3];                 
01222     float densityScaleY[3];                 
01223     NvFlowVolumeRenderViewport viewport;    
01224     float nonMultiResWidth;                 
01225     float nonMultiResHeight;                
01226 };
01227 
01229 struct NvFlowVolumeRenderLMSParams
01230 {
01231     bool enabled;                           
01232     float warpLeft;                         
01233     float warpRight;
01234     float warpUp;
01235     float warpDown;
01236     float sizeLeft;
01237     float sizeRight;
01238     float sizeUp;
01239     float sizeDown;
01240     NvFlowVolumeRenderViewport viewport;    
01241     float nonLMSWidth;                      
01242     float nonLMSHeight;                     
01243 };
01244 
01246 struct NvFlowVolumeRenderParams
01247 {
01248     NvFlowFloat4x4 projectionMatrix;            
01249     NvFlowFloat4x4 viewMatrix;                  
01250     NvFlowFloat4x4 modelMatrix;                 
01251 
01252     NvFlowDepthStencilView* depthStencilView;   
01253     NvFlowRenderTargetView* renderTargetView;   
01254 
01255     NvFlowRenderMaterialPool* materialPool;     
01256 
01257     NvFlowVolumeRenderMode renderMode;          
01258     NvFlowGridTextureChannel renderChannel;     
01259 
01260     bool debugMode;                             
01261 
01262     NvFlowVolumeRenderDownsample downsampleFactor;  
01263     float screenPercentage;                         
01264     NvFlowMultiResRayMarch multiResRayMarch;        
01265     float multiResSamplingScale;                    
01266 
01267     bool smoothColorUpsample;                       
01268 
01269     bool preColorCompositeOnly;                     
01270     bool colorCompositeOnly;                        
01271     bool generateDepth;                             
01272     bool generateDepthDebugMode;                    
01273     float depthAlphaThreshold;                      
01274     float depthIntensityThreshold;                  
01275 
01276     NvFlowVolumeRenderMultiResParams multiRes;          
01277 
01278     NvFlowVolumeRenderLMSParams lensMatchedShading;     
01279 };
01280 
01286 NV_FLOW_API void NvFlowVolumeRenderParamsDefaults(NvFlowVolumeRenderParams* params);
01287 
01289 struct NvFlowVolumeLightingParams
01290 {
01291     NvFlowRenderMaterialPool* materialPool;     
01292 
01293     NvFlowVolumeRenderMode renderMode;          
01294     NvFlowGridTextureChannel renderChannel;     
01295 };
01296 
01307 NV_FLOW_API NvFlowGridExport* NvFlowVolumeRenderLightGridExport(NvFlowVolumeRender* volumeRender, NvFlowContext* context, NvFlowGridExport* gridExport, const NvFlowVolumeLightingParams* params);
01308 
01317 NV_FLOW_API void NvFlowVolumeRenderGridExport(NvFlowVolumeRender* volumeRender, NvFlowContext* context, NvFlowGridExport* gridExport, const NvFlowVolumeRenderParams* params);
01318 
01327 NV_FLOW_API void NvFlowVolumeRenderTexture3D(NvFlowVolumeRender* volumeRender, NvFlowContext* context, NvFlowTexture3D* density, const NvFlowVolumeRenderParams* params);
01328 
01330 // -------------------------- NvFlowVolumeShadow -------------------------------
01333 
01335 struct NvFlowVolumeShadow;
01336 
01338 struct NvFlowVolumeShadowDesc
01339 {
01340     NvFlowGridExport* gridExport;       
01341 
01342     NvFlowUint mapWidth;                
01343     NvFlowUint mapHeight;               
01344     NvFlowUint mapDepth;                
01345 
01346     float minResidentScale;             
01347     float maxResidentScale;             
01348 };
01349 
01351 struct NvFlowVolumeShadowParams
01352 {
01353     NvFlowFloat4x4 projectionMatrix;            
01354     NvFlowFloat4x4 viewMatrix;                  
01355 
01356     NvFlowRenderMaterialPool* materialPool;     
01357 
01358     NvFlowVolumeRenderMode renderMode;          
01359     NvFlowGridTextureChannel renderChannel;     
01360 
01361     float intensityScale;                       
01362     float minIntensity;                         
01363 
01364     NvFlowFloat4 shadowBlendCompMask;           
01365     float shadowBlendBias;                      
01366 };
01367 
01369 struct NvFlowVolumeShadowDebugRenderParams
01370 {
01371     NvFlowRenderTargetView* renderTargetView;   
01372 
01373     NvFlowFloat4x4 projectionMatrix;            
01374     NvFlowFloat4x4 viewMatrix;                  
01375 };
01376 
01378 struct NvFlowVolumeShadowStats
01379 {
01380     NvFlowUint shadowColumnsActive;
01381     NvFlowUint shadowBlocksActive;
01382     NvFlowUint shadowCellsActive;
01383 };
01384 
01393 NV_FLOW_API NvFlowVolumeShadow* NvFlowCreateVolumeShadow(NvFlowContext* context, const NvFlowVolumeShadowDesc* desc);
01394 
01400 NV_FLOW_API void NvFlowReleaseVolumeShadow(NvFlowVolumeShadow* volumeShadow);
01401 
01410 NV_FLOW_API void NvFlowVolumeShadowUpdate(NvFlowVolumeShadow* volumeShadow, NvFlowContext* context, NvFlowGridExport* gridExport, const NvFlowVolumeShadowParams* params);
01411 
01420 NV_FLOW_API NvFlowGridExport* NvFlowVolumeShadowGetGridExport(NvFlowVolumeShadow* volumeShadow, NvFlowContext* context);
01421 
01429 NV_FLOW_API void NvFlowVolumeShadowDebugRender(NvFlowVolumeShadow* volumeShadow, NvFlowContext* context, const NvFlowVolumeShadowDebugRenderParams* params);
01430 
01437 NV_FLOW_API void NvFlowVolumeShadowGetStats(NvFlowVolumeShadow* volumeShadow, NvFlowVolumeShadowStats* stats);
01438 
01440 // -------------------------- NvFlowCrossSection -------------------------------
01443 
01445 struct NvFlowCrossSection;
01446 
01448 struct NvFlowCrossSectionDesc
01449 {
01450     NvFlowGridExport* gridExport;       
01451 };
01452 
01454 struct NvFlowCrossSectionParams
01455 {
01456     NvFlowGridExport* gridExport;               
01457     NvFlowGridExport* gridExportDebugVis;       
01458 
01459     NvFlowFloat4x4 projectionMatrix;            
01460     NvFlowFloat4x4 viewMatrix;                  
01461 
01462     NvFlowDepthStencilView* depthStencilView;   
01463     NvFlowRenderTargetView* renderTargetView;   
01464 
01465     NvFlowRenderMaterialPool* materialPool;     
01466 
01467     NvFlowVolumeRenderMode renderMode;          
01468     NvFlowGridTextureChannel renderChannel;     
01469 
01470     NvFlowUint crossSectionAxis;                
01471     NvFlowFloat3 crossSectionPosition;          
01472     float crossSectionScale;                    
01473 
01474     float intensityScale;                       
01475 
01476     bool pointFilter;                           
01477 
01478     bool velocityVectors;                       
01479     float velocityScale;                        
01480     float vectorLengthScale;                    
01481 
01482     bool outlineCells;                          
01483 
01484     bool fullscreen;                            
01485 
01486     NvFlowFloat4 lineColor;                     
01487     NvFlowFloat4 backgroundColor;               
01488     NvFlowFloat4 cellColor;                     
01489 };
01490 
01496 NV_FLOW_API void NvFlowCrossSectionParamsDefaults(NvFlowCrossSectionParams* params);
01497 
01506 NV_FLOW_API NvFlowCrossSection* NvFlowCreateCrossSection(NvFlowContext* context, const NvFlowCrossSectionDesc* desc);
01507 
01513 NV_FLOW_API void NvFlowReleaseCrossSection(NvFlowCrossSection* crossSection);
01514 
01522 NV_FLOW_API void NvFlowCrossSectionRender(NvFlowCrossSection* crossSection, NvFlowContext* context, const NvFlowCrossSectionParams* params);
01523 
01525 // -------------------------- NvFlowGridProxy -------------------------------
01528 
01530 struct NvFlowGridProxy;
01531 
01533 enum NvFlowGridProxyType
01534 {
01535     eNvFlowGridProxyTypePassThrough = 0,    
01536     eNvFlowGridProxyTypeMultiGPU = 1,       
01537     eNvFlowGridProxyTypeInterQueue = 2,     
01538 };
01539 
01541 struct NvFlowGridProxyDesc
01542 {
01543     NvFlowContext* gridContext;         
01544     NvFlowContext* renderContext;       
01545     NvFlowContext* gridCopyContext;     
01546     NvFlowContext* renderCopyContext;   
01547 
01548     NvFlowGridExport* gridExport;       
01549 
01550     NvFlowGridProxyType proxyType;      
01551 };
01552 
01554 struct NvFlowGridProxyFlushParams
01555 {
01556     NvFlowContext* gridContext;         
01557     NvFlowContext* gridCopyContext;     
01558     NvFlowContext* renderCopyContext;   
01559 };
01560 
01568 NV_FLOW_API NvFlowGridProxy* NvFlowCreateGridProxy(const NvFlowGridProxyDesc* desc);
01569 
01575 NV_FLOW_API void NvFlowReleaseGridProxy(NvFlowGridProxy* proxy);
01576 
01584 NV_FLOW_API void NvFlowGridProxyPush(NvFlowGridProxy* proxy, NvFlowGridExport* gridExport, const NvFlowGridProxyFlushParams* params);
01585 
01592 NV_FLOW_API void NvFlowGridProxyFlush(NvFlowGridProxy* proxy, const NvFlowGridProxyFlushParams* params);
01593 
01602 NV_FLOW_API NvFlowGridExport* NvFlowGridProxyGetGridExport(NvFlowGridProxy* proxy, NvFlowContext* renderContext);
01603 
01605 // -------------------------- NvFlowDevice -------------------------------
01608 
01610 struct NvFlowDevice;
01611 
01613 enum NvFlowDeviceMode
01614 {
01615     eNvFlowDeviceModeProxy = 0,     
01616     eNvFlowDeviceModeUnique = 1,    
01617 };
01618 
01620 struct NvFlowDeviceDesc
01621 {
01622     NvFlowDeviceMode mode;          
01623     bool autoSelectDevice;          
01624     NvFlowUint adapterIdx;          
01625 };
01626 
01632 NV_FLOW_API void NvFlowDeviceDescDefaults(NvFlowDeviceDesc* desc);
01633 
01641 NV_FLOW_API bool NvFlowDedicatedDeviceAvailable(NvFlowContext* renderContext);
01642 
01650 NV_FLOW_API bool NvFlowDedicatedDeviceQueueAvailable(NvFlowContext* renderContext);
01651 
01660 NV_FLOW_API NvFlowDevice* NvFlowCreateDevice(NvFlowContext* renderContext, const NvFlowDeviceDesc* desc);
01661 
01667 NV_FLOW_API void NvFlowReleaseDevice(NvFlowDevice* device);
01668 
01670 struct NvFlowDeviceQueue;
01671 
01673 enum NvFlowDeviceQueueType
01674 {
01675     eNvFlowDeviceQueueTypeGraphics = 0,
01676     eNvFlowDeviceQueueTypeCompute = 1,
01677     eNvFlowDeviceQueueTypeCopy = 2
01678 };
01679 
01681 struct NvFlowDeviceQueueDesc
01682 {
01683     NvFlowDeviceQueueType queueType;
01684     bool lowLatency;
01685 };
01686 
01688 struct NvFlowDeviceQueueStatus
01689 {
01690     NvFlowUint framesInFlight;          
01691     NvFlowUint64 lastFenceCompleted;    
01692     NvFlowUint64 nextFenceValue;        
01693 };
01694 
01703 NV_FLOW_API NvFlowDeviceQueue* NvFlowCreateDeviceQueue(NvFlowDevice* device, const NvFlowDeviceQueueDesc* desc);
01704 
01710 NV_FLOW_API void NvFlowReleaseDeviceQueue(NvFlowDeviceQueue* deviceQueue);
01711 
01719 NV_FLOW_API NvFlowContext* NvFlowDeviceQueueCreateContext(NvFlowDeviceQueue* deviceQueue);
01720 
01728 NV_FLOW_API void NvFlowDeviceQueueUpdateContext(NvFlowDeviceQueue* deviceQueue, NvFlowContext* context, NvFlowDeviceQueueStatus* status);
01729 
01736 NV_FLOW_API void NvFlowDeviceQueueFlush(NvFlowDeviceQueue* deviceQueue, NvFlowContext* context);
01737 
01744 NV_FLOW_API void NvFlowDeviceQueueConditionalFlush(NvFlowDeviceQueue* deviceQueue, NvFlowContext* context);
01745 
01753 NV_FLOW_API void NvFlowDeviceQueueWaitOnFence(NvFlowDeviceQueue* deviceQueue, NvFlowContext* context, NvFlowUint64 fenceValue);
01754 
01756 // -------------------------- NvFlowSDFGenerator -------------------------------
01759 
01761 struct NvFlowSDFGen;
01762 
01764 struct NvFlowSDFGenDesc
01765 {
01766     NvFlowDim resolution;       
01767 };
01768 
01770 struct NvFlowSDFGenMeshParams
01771 {
01772     NvFlowUint numVertices;         
01773     float* positions;               
01774     NvFlowUint positionStride;      
01775     float* normals;                 
01776     NvFlowUint normalStride;        
01777 
01778     NvFlowUint numIndices;          
01779     NvFlowUint* indices;            
01780 
01781     NvFlowFloat4x4 modelMatrix;     
01782 
01783     NvFlowDepthStencilView* depthStencilView;   
01784     NvFlowRenderTargetView* renderTargetView;   
01785 };
01786 
01795 NV_FLOW_API NvFlowSDFGen* NvFlowCreateSDFGen(NvFlowContext* context, const NvFlowSDFGenDesc* desc);
01796 
01802 NV_FLOW_API void NvFlowReleaseSDFGen(NvFlowSDFGen* sdfGen);
01803 
01810 NV_FLOW_API void NvFlowSDFGenReset(NvFlowSDFGen* sdfGen, NvFlowContext* context);
01811 
01819 NV_FLOW_API void NvFlowSDFGenVoxelize(NvFlowSDFGen* sdfGen, NvFlowContext* context, const NvFlowSDFGenMeshParams* params);
01820 
01827 NV_FLOW_API void NvFlowSDFGenUpdate(NvFlowSDFGen* sdfGen, NvFlowContext* context);
01828 
01837 NV_FLOW_API NvFlowTexture3D* NvFlowSDFGenShape(NvFlowSDFGen* sdfGen, NvFlowContext* context);
01838 
01840 // -------------------------- NvFlowParticleSurface -------------------------------
01843 
01845 struct NvFlowParticleSurface;
01846 
01848 struct NvFlowParticleSurfaceDesc
01849 {
01850     NvFlowFloat3 initialLocation;       
01851     NvFlowFloat3 halfSize;              
01852 
01853     NvFlowDim virtualDim;               
01854     float residentScale;                
01855 
01856     NvFlowUint maxParticles;            
01857 };
01858 
01860 struct NvFlowParticleSurfaceData
01861 {
01862     const float* positions;         
01863     NvFlowUint positionStride;      
01864     NvFlowUint numParticles;        
01865 };
01866 
01868 struct NvFlowParticleSurfaceParams
01869 {
01870     float surfaceThreshold;         
01871     float smoothRadius;             
01872     bool separableSmoothing;        
01873 };
01874 
01876 struct NvFlowParticleSurfaceEmitParams
01877 {
01878     float deltaTime;
01879 
01880     NvFlowFloat3 velocityLinear;                    
01881     NvFlowFloat3 velocityCoupleRate;                
01882 
01883     float smoke;                                    
01884     float smokeCoupleRate;                          
01885 
01886     float temperature;                              
01887     float temperatureCoupleRate;                    
01888 
01889     float fuel;                                     
01890     float fuelCoupleRate;                           
01891 };
01892 
01901 NV_FLOW_API NvFlowParticleSurface* NvFlowCreateParticleSurface(NvFlowContext* context, const NvFlowParticleSurfaceDesc* desc);
01902 
01908 NV_FLOW_API void NvFlowReleaseParticleSurface(NvFlowParticleSurface* surface);
01909 
01917 NV_FLOW_API void NvFlowParticleSurfaceUpdateParticles(NvFlowParticleSurface* surface, NvFlowContext* context, const NvFlowParticleSurfaceData* data);
01918 
01926 NV_FLOW_API void NvFlowParticleSurfaceUpdateSurface(NvFlowParticleSurface* surface, NvFlowContext* context, const NvFlowParticleSurfaceParams* params);
01927 
01935 NV_FLOW_API void NvFlowParticleSurfaceAllocFunc(NvFlowParticleSurface* surface, NvFlowContext* context, const NvFlowGridEmitCustomAllocParams* params);
01936 
01946 NV_FLOW_API void NvFlowParticleSurfaceEmitVelocityFunc(NvFlowParticleSurface* surface, NvFlowContext* context, NvFlowUint* dataFrontIdx, const NvFlowGridEmitCustomEmitParams* params, const NvFlowParticleSurfaceEmitParams* emitParams);
01947 
01957 NV_FLOW_API void NvFlowParticleSurfaceEmitDensityFunc(NvFlowParticleSurface* surface, NvFlowContext* context, NvFlowUint* dataFrontIdx, const NvFlowGridEmitCustomEmitParams* params, const NvFlowParticleSurfaceEmitParams* emitParams);
01958 
01967 NV_FLOW_API NvFlowGridExport* NvFlowParticleSurfaceDebugGridExport(NvFlowParticleSurface* surface, NvFlowContext* context);
01968 
Copyright © 2014-2016 NVIDIA Corporation, 2701 San Tomas Expressway, Santa Clara, CA 95050 U.S.A. All rights reserved. www.nvidia.com