• 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 pressureLegacyMode;                
00130 
00131     bool bigEffectMode;                     
00132     float bigEffectPredictTime;             
00133 
00134     NvFlowGridDebugVisFlags debugVisFlags;  
00135 };
00136 
00142 NV_FLOW_API void NvFlowGridParamsDefaults(NvFlowGridParams* params);
00143 
00150 NV_FLOW_API void NvFlowGridSetParams(NvFlowGrid* grid, const NvFlowGridParams* params);
00151 
00153 struct NvFlowSupport
00154 {
00155     bool supportsVTR;       
00156 };
00157 
00167 NV_FLOW_API NvFlowResult NvFlowGridQuerySupport(NvFlowGrid* grid, NvFlowContext* context, NvFlowSupport* support);
00168 
00170 struct NvFlowQueryTime
00171 {
00172     float simulation;
00173 };
00174 
00184 NV_FLOW_API NvFlowResult NvFlowGridQueryTime(NvFlowGrid* grid, NvFlowQueryTime* gpuTime, NvFlowQueryTime* cpuTime);
00185 
00192 NV_FLOW_API void NvFlowGridGPUMemUsage(NvFlowGrid* grid, NvFlowUint64* numBytes);
00193 
00201 NV_FLOW_API void NvFlowGridUpdate(NvFlowGrid* grid, NvFlowContext* context, float dt);
00202 
00211 NV_FLOW_API NvFlowGridExport* NvFlowGridGetGridExport(NvFlowContext* context, NvFlowGrid* grid);
00212 
00214 // -------------------------- NvFlowGridMaterial -------------------------------
00217 
00219 struct NvFlowGridMaterialHandle
00220 {
00221     NvFlowGrid* grid;       
00222     NvFlowUint64 uid;       
00223 };
00224 
00226 enum NvFlowGridComponent
00227 {
00228     eNvFlowGridComponentVelocity = 0,
00229     eNvFlowGridComponentSmoke = 1,
00230     eNvFlowGridComponentTemperature = 2,
00231     eNvFlowGridComponentFuel = 3,
00232 
00233     eNvFlowGridNumComponents = 4
00234 };
00235 
00237 struct NvFlowGridMaterialPerComponent
00238 {
00239     float damping;                      
00240     float fade;                         
00241     float macCormackBlendFactor;        
00242     float macCormackBlendThreshold;     
00243     float allocWeight;                  
00244     float allocThreshold;               
00245 };
00246 
00248 struct NvFlowGridMaterialParams
00249 {
00250     NvFlowGridMaterialPerComponent velocity;    
00251     NvFlowGridMaterialPerComponent smoke;       
00252     NvFlowGridMaterialPerComponent temperature; 
00253     NvFlowGridMaterialPerComponent fuel;        
00254 
00255     float vorticityStrength;                    
00256     float vorticityVelocityMask;                
00257 
00258     float ignitionTemp;                         
00259     float burnPerTemp;                          
00260     float fuelPerBurn;                          
00261     float tempPerBurn;                          
00262     float smokePerBurn;                         
00263     float divergencePerBurn;                    
00264     float buoyancyPerTemp;                      
00265     float coolingRate;                          
00266 };
00267 
00273 NV_FLOW_API void NvFlowGridMaterialParamsDefaults(NvFlowGridMaterialParams* params);
00274 
00282 NV_FLOW_API NvFlowGridMaterialHandle NvFlowGridGetDefaultMaterial(NvFlowGrid* grid);
00283 
00292 NV_FLOW_API NvFlowGridMaterialHandle NvFlowGridCreateMaterial(NvFlowGrid* grid, const NvFlowGridMaterialParams* params);
00293 
00300 NV_FLOW_API void NvFlowGridReleaseMaterial(NvFlowGrid* grid, NvFlowGridMaterialHandle material);
00301 
00309 NV_FLOW_API void NvFlowGridSetMaterialParams(NvFlowGrid* grid, NvFlowGridMaterialHandle material, const NvFlowGridMaterialParams* params);
00310 
00312 // -------------------------- NvFlowShape -------------------------------
00315 
00317 enum NvFlowShapeType
00318 {
00319     eNvFlowShapeTypeSDF = 0,
00320     eNvFlowShapeTypeSphere = 1,
00321     eNvFlowShapeTypeBox = 2,
00322     eNvFlowShapeTypeCapsule = 3,
00323     eNvFlowShapeTypePlane = 4
00324 };
00325 
00327 struct NvFlowShapeSDF;
00328 
00330 struct NvFlowShapeDescSDF
00331 {
00332     NvFlowUint sdfOffset;   
00333 };
00334 
00336 struct NvFlowShapeDescSphere
00337 {
00338     float radius;           
00339 };
00340 
00342 struct NvFlowShapeDescBox
00343 {
00344     NvFlowFloat3 halfSize;  
00345 };
00346 
00348 struct NvFlowShapeDescCapsule
00349 {
00350     float radius;           
00351     float length;           
00352 };
00353 
00355 struct NvFlowShapeDescPlane
00356 {
00357     NvFlowFloat3 normal;    
00358     float distance;         
00359 };
00360 
00362 union NvFlowShapeDesc
00363 {
00364     NvFlowShapeDescSDF sdf;
00365     NvFlowShapeDescSphere sphere;
00366     NvFlowShapeDescBox box;
00367     NvFlowShapeDescCapsule capsule;
00368     NvFlowShapeDescPlane plane;
00369 };
00370 
00372 struct NvFlowShapeSDFDesc
00373 {
00374     NvFlowDim resolution;       
00375 };
00376 
00382 NV_FLOW_API void NvFlowShapeSDFDescDefaults(NvFlowShapeSDFDesc* desc);
00383 
00385 struct NvFlowShapeSDFData
00386 {
00387     float* data;                
00388     NvFlowUint rowPitch;        
00389     NvFlowUint depthPitch;      
00390     NvFlowDim dim;              
00391 };
00392 
00401 NV_FLOW_API NvFlowShapeSDF* NvFlowCreateShapeSDF(NvFlowContext* context, const NvFlowShapeSDFDesc* desc);
00402 
00411 NV_FLOW_API NvFlowShapeSDF* NvFlowCreateShapeSDFFromTexture3D(NvFlowContext* context, NvFlowTexture3D* texture);
00412 
00418 NV_FLOW_API void NvFlowReleaseShapeSDF(NvFlowShapeSDF* shape);
00419 
00428 NV_FLOW_API NvFlowShapeSDFData NvFlowShapeSDFMap(NvFlowShapeSDF* shape, NvFlowContext* context);
00429 
00436 NV_FLOW_API void NvFlowShapeSDFUnmap(NvFlowShapeSDF* shape, NvFlowContext* context);
00437 
00439 // -------------------------- NvFlowGridEmit -------------------------------
00442 
00444 enum NvFlowGridEmitMode
00445 {
00446     eNvFlowGridEmitModeDefault = 0,                 
00447     eNvFlowGridEmitModeDisableVelocity = 0x01,      
00448     eNvFlowGridEmitModeDisableDensity = 0x02,       
00449     eNvFlowGridEmitModeDisableAlloc = 0x04,         
00450     eNvFlowGridEmitModeAllocShape = 0x08,           
00451 
00452     eNvFlowGridEmitModeAllocShapeOnly = 0x0F,       
00453 };
00454 
00456 struct NvFlowGridEmitParams
00457 {
00458     NvFlowUint shapeRangeOffset;                    
00459     NvFlowUint shapeRangeSize;                      
00460     NvFlowShapeType shapeType;                      
00461     float shapeDistScale;                           
00462 
00463     NvFlowFloat4x4 bounds;                          
00464     NvFlowFloat4x4 localToWorld;                    
00465     NvFlowFloat3 centerOfMass;                      
00466 
00467     float deltaTime;                                
00468 
00469     NvFlowGridMaterialHandle material;              
00470     NvFlowUint emitMode;                            
00471     NvFlowUint numSubSteps;                         
00472 
00473     NvFlowFloat3 allocationScale;                   
00474     float allocationPredict;                        
00475     NvFlowFloat3 predictVelocity;                   
00476     float predictVelocityWeight;                    
00477 
00478     float minActiveDist;                            
00479     float maxActiveDist;                            
00480     float minEdgeDist;                              
00481     float maxEdgeDist;                              
00482     float slipThickness;                            
00483     float slipFactor;                               
00484 
00485     NvFlowFloat3 velocityLinear;                    
00486     NvFlowFloat3 velocityAngular;                   
00487     NvFlowFloat3 velocityCoupleRate;                
00488 
00489     float smoke;                                    
00490     float smokeCoupleRate;                          
00491 
00492     float temperature;                              
00493     float temperatureCoupleRate;                    
00494 
00495     float fuel;                                     
00496     float fuelCoupleRate;                           
00497     float fuelReleaseTemp;                          
00498     float fuelRelease;                              
00499 };
00500 
00506 NV_FLOW_API void NvFlowGridEmitParamsDefaults(NvFlowGridEmitParams* params);
00507 
00517 NV_FLOW_API void NvFlowGridEmit(NvFlowGrid* grid, const NvFlowShapeDesc* shapes, NvFlowUint numShapes, const NvFlowGridEmitParams* params, NvFlowUint numParams);
00518 
00526 NV_FLOW_API void NvFlowGridUpdateEmitSDFs(NvFlowGrid* grid, NvFlowShapeSDF** sdfs, NvFlowUint numSdfs);
00527 
00529 // -------------------------- NvFlowGridEmitCustom -------------------------------
00532 
00534 struct NvFlowGridEmitCustomAllocParams
00535 {
00536     NvFlowResourceRW* maskResourceRW;   
00537 
00538     NvFlowDim maskDim;                  
00539 
00540     NvFlowFloat3 gridLocation;          
00541     NvFlowFloat3 gridHalfSize;          
00542 
00543     NvFlowGridMaterialHandle material;  
00544 };
00545 
00546 typedef void(*NvFlowGridEmitCustomAllocFunc)(void* userdata, const NvFlowGridEmitCustomAllocParams* params);
00547 
00555 NV_FLOW_API void NvFlowGridEmitCustomRegisterAllocFunc(NvFlowGrid* grid, NvFlowGridEmitCustomAllocFunc func, void* userdata);
00556 
00558 struct NvFlowGridEmitCustomEmitParams
00559 {
00560     NvFlowGrid* grid;           
00561     NvFlowUint numLayers;       
00562     void* flowInternal;         
00563 };
00564 
00566 struct NvFlowGridEmitCustomEmitLayerParams
00567 {
00568     NvFlowResourceRW* dataRW[2u];               
00569     NvFlowResource* blockTable;                 
00570     NvFlowResource* blockList;                  
00571 
00572     NvFlowShaderPointParams shaderParams;       
00573 
00574     NvFlowUint numBlocks;                       
00575     NvFlowUint maxBlocks;                       
00576 
00577     NvFlowFloat3 gridLocation;                  
00578     NvFlowFloat3 gridHalfSize;                  
00579 
00580     NvFlowGridMaterialHandle material;          
00581 };
00582 
00583 typedef void(*NvFlowGridEmitCustomEmitFunc)(void* userdata, NvFlowUint* dataFrontIdx, const NvFlowGridEmitCustomEmitParams* params);
00584 
00593 NV_FLOW_API void NvFlowGridEmitCustomRegisterEmitFunc(NvFlowGrid* grid, NvFlowGridTextureChannel channel, NvFlowGridEmitCustomEmitFunc func, void* userdata);
00594 
00602 NV_FLOW_API void NvFlowGridEmitCustomGetLayerParams(const NvFlowGridEmitCustomEmitParams* emitParams, NvFlowUint layerIdx, NvFlowGridEmitCustomEmitLayerParams* emitLayerParams);
00603 
00605 // -------------------------- NvFlowGridExportImport -------------------------------
00608 
00610 struct NvFlowGridExportImportLayerMapping
00611 {
00612     NvFlowGridMaterialHandle material;          
00613 
00614     NvFlowResource* blockTable;                 
00615     NvFlowResource* blockList;                  
00616 
00617     NvFlowUint numBlocks;                       
00618 };
00619 
00621 struct NvFlowGridExportImportLayeredMapping
00622 {
00623     NvFlowShaderLinearParams shaderParams;      
00624     NvFlowUint maxBlocks;                       
00625 
00626     NvFlowUint2* layeredBlockListCPU;           
00627     NvFlowUint layeredNumBlocks;                
00628 
00629     NvFlowFloat4x4 modelMatrix;                 
00630 };
00631 
00633 // -------------------------- NvFlowGridExport -------------------------------
00636 
00638 struct NvFlowGridExportHandle
00639 {
00640     NvFlowGridExport* gridExport;           
00641     NvFlowGridTextureChannel channel;       
00642     NvFlowUint numLayerViews;               
00643 };
00644 
00646 struct NvFlowGridExportLayerView
00647 {
00648     NvFlowResource* data;                           
00649     NvFlowGridExportImportLayerMapping mapping;     
00650 };
00651 
00653 struct NvFlowGridExportLayeredView
00654 {
00655     NvFlowGridExportImportLayeredMapping mapping;   
00656 };
00657 
00659 struct NvFlowGridExportSimpleShape
00660 {
00661     NvFlowFloat4x4 localToWorld;        
00662     NvFlowShapeDesc shapeDesc;          
00663 };
00664 
00666 struct NvFlowGridExportDebugVisView
00667 {
00668     NvFlowGridDebugVisFlags debugVisFlags;      
00669 
00670     NvFlowFloat4x4* bounds;                     
00671     NvFlowUint numBounds;                       
00672     NvFlowGridExportSimpleShape* spheres;       
00673     NvFlowUint numSpheres;                      
00674     NvFlowGridExportSimpleShape* capsules;      
00675     NvFlowUint numCapsules;                     
00676     NvFlowGridExportSimpleShape* boxes;         
00677     NvFlowUint numBoxes;                        
00678 };
00679 
00689 NV_FLOW_API NvFlowGridExportHandle NvFlowGridExportGetHandle(NvFlowGridExport* gridExport, NvFlowContext* context, NvFlowGridTextureChannel channel);
00690 
00698 NV_FLOW_API void NvFlowGridExportGetLayerView(NvFlowGridExportHandle handle, NvFlowUint layerIdx, NvFlowGridExportLayerView* layerView);
00699 
00706 NV_FLOW_API void NvFlowGridExportGetLayeredView(NvFlowGridExportHandle handle, NvFlowGridExportLayeredView* layeredView);
00707 
00714 NV_FLOW_API void NvFlowGridExportGetDebugVisView(NvFlowGridExport* gridExport, NvFlowGridExportDebugVisView* view);
00715 
00717 // -------------------------- NvFlowGridImport -------------------------------
00720 
00722 struct NvFlowGridImport;
00723 
00725 struct NvFlowGridImportDesc
00726 {
00727     NvFlowGridExport* gridExport;       
00728 };
00729 
00731 enum NvFlowGridImportMode
00732 {
00733     eNvFlowGridImportModePoint = 0,     
00734     eNvFlowGridImportModeLinear = 1     
00735 };
00736 
00738 struct NvFlowGridImportParams
00739 {
00740     NvFlowGridExport* gridExport;       
00741     NvFlowGridTextureChannel channel;   
00742     NvFlowGridImportMode importMode;    
00743 };
00744 
00746 struct NvFlowGridImportHandle
00747 {
00748     NvFlowGridImport* gridImport;       
00749     NvFlowGridTextureChannel channel;   
00750     NvFlowUint numLayerViews;           
00751 };
00752 
00754 struct NvFlowGridImportLayerView
00755 {
00756     NvFlowResourceRW* dataRW;                       
00757     NvFlowResourceRW* blockTableRW;                 
00758     NvFlowResourceRW* blockListRW;                  
00759     NvFlowGridExportImportLayerMapping mapping;     
00760 };
00761 
00763 struct NvFlowGridImportLayeredView
00764 {
00765     NvFlowGridExportImportLayeredMapping mapping;   
00766 };
00767 
00776 NV_FLOW_API NvFlowGridImport* NvFlowCreateGridImport(NvFlowContext* context, const NvFlowGridImportDesc* desc);
00777 
00783 NV_FLOW_API void NvFlowReleaseGridImport(NvFlowGridImport* gridImport);
00784 
00794 NV_FLOW_API NvFlowGridImportHandle NvFlowGridImportGetHandle(NvFlowGridImport* gridImport, NvFlowContext* context, const NvFlowGridImportParams* params);
00795 
00803 NV_FLOW_API void NvFlowGridImportGetLayerView(NvFlowGridImportHandle handle, NvFlowUint layerIdx, NvFlowGridImportLayerView* layerView);
00804 
00811 NV_FLOW_API void NvFlowGridImportGetLayeredView(NvFlowGridImportHandle handle, NvFlowGridImportLayeredView* layeredView);
00812 
00820 NV_FLOW_API void NvFlowGridImportReleaseChannel(NvFlowGridImport* gridImport, NvFlowContext* context, NvFlowGridTextureChannel channel);
00821 
00830 NV_FLOW_API NvFlowGridExport* NvFlowGridImportGetGridExport(NvFlowGridImport* gridImport, NvFlowContext* context);
00831 
00833 struct NvFlowGridImportStateCPU;
00834 
00836 struct NvFlowGridImportStateCPUParams
00837 {
00838     NvFlowGridImportStateCPU* stateCPU;     
00839     NvFlowGridTextureChannel channel;       
00840     NvFlowGridImportMode importMode;        
00841 };
00842 
00850 NV_FLOW_API NvFlowGridImportStateCPU* NvFlowCreateGridImportStateCPU(NvFlowGridImport* gridImport);
00851 
00857 NV_FLOW_API void NvFlowReleaseGridImportStateCPU(NvFlowGridImportStateCPU* stateCPU);
00858 
00866 NV_FLOW_API void NvFlowGridImportUpdateStateCPU(NvFlowGridImportStateCPU* stateCPU, NvFlowContext* context, NvFlowGridExport* gridExport);
00867 
00877 NV_FLOW_API NvFlowGridImportHandle NvFlowGridImportStateCPUGetHandle(NvFlowGridImport* gridImport, NvFlowContext* context, const NvFlowGridImportStateCPUParams* params);
00878 
00880 // -------------------------- NvFlowRenderMaterial -------------------------------
00883 
00885 struct NvFlowRenderMaterialPool;
00886 
00888 struct NvFlowRenderMaterialPoolDesc
00889 {
00890     NvFlowUint colorMapResolution;      
00891 };
00892 
00901 NV_FLOW_API NvFlowRenderMaterialPool* NvFlowCreateRenderMaterialPool(NvFlowContext* context, const NvFlowRenderMaterialPoolDesc* desc);
00902 
00908 NV_FLOW_API void NvFlowReleaseRenderMaterialPool(NvFlowRenderMaterialPool* pool);
00909 
00911 struct NvFlowRenderMaterialHandle
00912 {
00913     NvFlowRenderMaterialPool* pool;         
00914     NvFlowUint64 uid;                       
00915 };
00916 
00918 enum NvFlowVolumeRenderMode
00919 {
00920     eNvFlowVolumeRenderMode_colormap = 0,       
00921     eNvFlowVolumeRenderMode_raw = 1,            
00922     eNvFlowVolumeRenderMode_rainbow = 2,        
00923     eNvFlowVolumeRenderMode_debug = 3,          
00924 
00925     eNvFlowVolumeRenderModeCount
00926 };
00927 
00929 struct NvFlowRenderMaterialParams
00930 {
00931     NvFlowGridMaterialHandle material;          
00932 
00933     float alphaScale;                           
00934     float additiveFactor;                       
00935 
00936     NvFlowFloat4 colorMapCompMask;              
00937     NvFlowFloat4 alphaCompMask;                 
00938     NvFlowFloat4 intensityCompMask;             
00939 
00940     float colorMapMinX;                         
00941     float colorMapMaxX;                         
00942     float alphaBias;                            
00943     float intensityBias;                        
00944 };
00945 
00951 NV_FLOW_API void NvFlowRenderMaterialParamsDefaults(NvFlowRenderMaterialParams* params);
00952 
00960 NV_FLOW_API NvFlowRenderMaterialHandle NvFlowGetDefaultRenderMaterial(NvFlowRenderMaterialPool* pool);
00961 
00971 NV_FLOW_API NvFlowRenderMaterialHandle NvFlowCreateRenderMaterial(NvFlowContext* context, NvFlowRenderMaterialPool* pool, const NvFlowRenderMaterialParams* params);
00972 
00978 NV_FLOW_API void NvFlowReleaseRenderMaterial(NvFlowRenderMaterialHandle handle);
00979 
00986 NV_FLOW_API void NvFlowRenderMaterialUpdate(NvFlowRenderMaterialHandle handle, const NvFlowRenderMaterialParams* params);
00987 
00989 struct NvFlowColorMapData
00990 {
00991     NvFlowFloat4* data;         
00992     NvFlowUint dim;             
00993 };
00994 
01003 NV_FLOW_API NvFlowColorMapData NvFlowRenderMaterialColorMap(NvFlowContext* context, NvFlowRenderMaterialHandle handle);
01004 
01011 NV_FLOW_API void NvFlowRenderMaterialColorUnmap(NvFlowContext* context, NvFlowRenderMaterialHandle handle);
01012 
01014 // -------------------------- NvFlowVolumeRender -------------------------------
01017 
01019 struct NvFlowVolumeRender;
01020 
01022 struct NvFlowVolumeRenderDesc
01023 {
01024     NvFlowGridExport* gridExport;               
01025 };
01026 
01035 NV_FLOW_API NvFlowVolumeRender* NvFlowCreateVolumeRender(NvFlowContext* context, const NvFlowVolumeRenderDesc* desc);
01036 
01042 NV_FLOW_API void NvFlowReleaseVolumeRender(NvFlowVolumeRender* volumeRender);
01043 
01045 enum NvFlowVolumeRenderDownsample
01046 {
01047     eNvFlowVolumeRenderDownsampleNone = 0,
01048     eNvFlowVolumeRenderDownsample2x2 = 1
01049 };
01050 
01052 enum NvFlowMultiResRayMarch
01053 {
01054     eNvFlowMultiResRayMarchDisabled = 0,
01055     eNvFlowMultiResRayMarch2x2 = 1,
01056     eNvFlowMultiResRayMarch4x4 = 2,
01057     eNvFlowMultiResRayMarch8x8 = 3,
01058     eNvFlowMultiResRayMarch16x16 = 4,
01059 };
01060 
01062 struct NvFlowVolumeRenderViewport
01063 {
01064     float topLeftX;
01065     float topLeftY;
01066     float width;
01067     float height;
01068 };
01069 
01071 struct NvFlowVolumeRenderMultiResParams
01072 {
01073     bool enabled;                           
01074     float centerWidth;                      
01075     float centerHeight;                     
01076     float centerX;                          
01077     float centerY;                          
01078     float densityScaleX[3];                 
01079     float densityScaleY[3];                 
01080     NvFlowVolumeRenderViewport viewport;    
01081     float nonMultiResWidth;                 
01082     float nonMultiResHeight;                
01083 };
01084 
01086 struct NvFlowVolumeRenderLMSParams
01087 {
01088     bool enabled;                           
01089     float warpLeft;                         
01090     float warpRight;
01091     float warpUp;
01092     float warpDown;
01093     float sizeLeft;
01094     float sizeRight;
01095     float sizeUp;
01096     float sizeDown;
01097     NvFlowVolumeRenderViewport viewport;    
01098     float nonLMSWidth;                      
01099     float nonLMSHeight;                     
01100 };
01101 
01103 struct NvFlowVolumeRenderParams
01104 {
01105     NvFlowFloat4x4 projectionMatrix;            
01106     NvFlowFloat4x4 viewMatrix;                  
01107     NvFlowFloat4x4 modelMatrix;                 
01108 
01109     NvFlowDepthStencilView* depthStencilView;   
01110     NvFlowRenderTargetView* renderTargetView;   
01111 
01112     NvFlowRenderMaterialPool* materialPool;     
01113 
01114     NvFlowVolumeRenderMode renderMode;          
01115     NvFlowGridTextureChannel renderChannel;     
01116 
01117     bool debugMode;                             
01118 
01119     NvFlowVolumeRenderDownsample downsampleFactor;  
01120     float screenPercentage;                         
01121     NvFlowMultiResRayMarch multiResRayMarch;        
01122     float multiResSamplingScale;                    
01123 
01124     bool smoothColorUpsample;                       
01125 
01126     bool preColorCompositeOnly;                     
01127     bool colorCompositeOnly;                        
01128     bool generateDepth;                             
01129     bool generateDepthDebugMode;                    
01130     float depthAlphaThreshold;                      
01131     float depthIntensityThreshold;                  
01132 
01133     NvFlowVolumeRenderMultiResParams multiRes;          
01134 
01135     NvFlowVolumeRenderLMSParams lensMatchedShading;     
01136 };
01137 
01143 NV_FLOW_API void NvFlowVolumeRenderParamsDefaults(NvFlowVolumeRenderParams* params);
01144 
01146 struct NvFlowVolumeLightingParams
01147 {
01148     NvFlowRenderMaterialPool* materialPool;     
01149 
01150     NvFlowVolumeRenderMode renderMode;          
01151     NvFlowGridTextureChannel renderChannel;     
01152 };
01153 
01164 NV_FLOW_API NvFlowGridExport* NvFlowVolumeRenderLightGridExport(NvFlowVolumeRender* volumeRender, NvFlowContext* context, NvFlowGridExport* gridExport, const NvFlowVolumeLightingParams* params);
01165 
01174 NV_FLOW_API void NvFlowVolumeRenderGridExport(NvFlowVolumeRender* volumeRender, NvFlowContext* context, NvFlowGridExport* gridExport, const NvFlowVolumeRenderParams* params);
01175 
01184 NV_FLOW_API void NvFlowVolumeRenderTexture3D(NvFlowVolumeRender* volumeRender, NvFlowContext* context, NvFlowTexture3D* density, const NvFlowVolumeRenderParams* params);
01185 
01187 // -------------------------- NvFlowVolumeShadow -------------------------------
01190 
01192 struct NvFlowVolumeShadow;
01193 
01195 struct NvFlowVolumeShadowDesc
01196 {
01197     NvFlowGridExport* gridExport;       
01198 
01199     NvFlowUint mapWidth;                
01200     NvFlowUint mapHeight;               
01201     NvFlowUint mapDepth;                
01202 
01203     float minResidentScale;             
01204     float maxResidentScale;             
01205 };
01206 
01208 struct NvFlowVolumeShadowParams
01209 {
01210     NvFlowFloat4x4 projectionMatrix;            
01211     NvFlowFloat4x4 viewMatrix;                  
01212 
01213     NvFlowRenderMaterialPool* materialPool;     
01214 
01215     NvFlowVolumeRenderMode renderMode;          
01216     NvFlowGridTextureChannel renderChannel;     
01217 
01218     float intensityScale;                       
01219     float minIntensity;                         
01220 
01221     NvFlowFloat4 shadowBlendCompMask;           
01222     float shadowBlendBias;                      
01223 };
01224 
01226 struct NvFlowVolumeShadowDebugRenderParams
01227 {
01228     NvFlowRenderTargetView* renderTargetView;   
01229 
01230     NvFlowFloat4x4 projectionMatrix;            
01231     NvFlowFloat4x4 viewMatrix;                  
01232 };
01233 
01235 struct NvFlowVolumeShadowStats
01236 {
01237     NvFlowUint shadowColumnsActive;
01238     NvFlowUint shadowBlocksActive;
01239     NvFlowUint shadowCellsActive;
01240 };
01241 
01250 NV_FLOW_API NvFlowVolumeShadow* NvFlowCreateVolumeShadow(NvFlowContext* context, const NvFlowVolumeShadowDesc* desc);
01251 
01257 NV_FLOW_API void NvFlowReleaseVolumeShadow(NvFlowVolumeShadow* volumeShadow);
01258 
01267 NV_FLOW_API void NvFlowVolumeShadowUpdate(NvFlowVolumeShadow* volumeShadow, NvFlowContext* context, NvFlowGridExport* gridExport, const NvFlowVolumeShadowParams* params);
01268 
01277 NV_FLOW_API NvFlowGridExport* NvFlowVolumeShadowGetGridExport(NvFlowVolumeShadow* volumeShadow, NvFlowContext* context);
01278 
01286 NV_FLOW_API void NvFlowVolumeShadowDebugRender(NvFlowVolumeShadow* volumeShadow, NvFlowContext* context, const NvFlowVolumeShadowDebugRenderParams* params);
01287 
01294 NV_FLOW_API void NvFlowVolumeShadowGetStats(NvFlowVolumeShadow* volumeShadow, NvFlowVolumeShadowStats* stats);
01295 
01297 // -------------------------- NvFlowCrossSection -------------------------------
01300 
01302 struct NvFlowCrossSection;
01303 
01305 struct NvFlowCrossSectionDesc
01306 {
01307     NvFlowGridExport* gridExport;       
01308 };
01309 
01311 struct NvFlowCrossSectionParams
01312 {
01313     NvFlowGridExport* gridExport;               
01314     NvFlowGridExport* gridExportDebugVis;       
01315 
01316     NvFlowFloat4x4 projectionMatrix;            
01317     NvFlowFloat4x4 viewMatrix;                  
01318 
01319     NvFlowDepthStencilView* depthStencilView;   
01320     NvFlowRenderTargetView* renderTargetView;   
01321 
01322     NvFlowRenderMaterialPool* materialPool;     
01323 
01324     NvFlowVolumeRenderMode renderMode;          
01325     NvFlowGridTextureChannel renderChannel;     
01326 
01327     NvFlowUint crossSectionAxis;                
01328     NvFlowFloat3 crossSectionPosition;          
01329     float crossSectionScale;                    
01330 
01331     float intensityScale;                       
01332 
01333     bool pointFilter;                           
01334 
01335     bool velocityVectors;                       
01336     float velocityScale;                        
01337     float vectorLengthScale;                    
01338 
01339     bool outlineCells;                          
01340 
01341     bool fullscreen;                            
01342 
01343     NvFlowFloat4 lineColor;                     
01344     NvFlowFloat4 backgroundColor;               
01345     NvFlowFloat4 cellColor;                     
01346 };
01347 
01353 NV_FLOW_API void NvFlowCrossSectionParamsDefaults(NvFlowCrossSectionParams* params);
01354 
01363 NV_FLOW_API NvFlowCrossSection* NvFlowCreateCrossSection(NvFlowContext* context, const NvFlowCrossSectionDesc* desc);
01364 
01370 NV_FLOW_API void NvFlowReleaseCrossSection(NvFlowCrossSection* crossSection);
01371 
01379 NV_FLOW_API void NvFlowCrossSectionRender(NvFlowCrossSection* crossSection, NvFlowContext* context, const NvFlowCrossSectionParams* params);
01380 
01382 // -------------------------- NvFlowGridProxy -------------------------------
01385 
01387 struct NvFlowGridProxy;
01388 
01390 enum NvFlowGridProxyType
01391 {
01392     eNvFlowGridProxyTypePassThrough = 0,    
01393     eNvFlowGridProxyTypeMultiGPU = 1,       
01394     eNvFlowGridProxyTypeInterQueue = 2,     
01395 };
01396 
01398 struct NvFlowGridProxyDesc
01399 {
01400     NvFlowContext* gridContext;         
01401     NvFlowContext* renderContext;       
01402     NvFlowContext* gridCopyContext;     
01403     NvFlowContext* renderCopyContext;   
01404 
01405     NvFlowGridExport* gridExport;       
01406 
01407     NvFlowGridProxyType proxyType;      
01408 };
01409 
01411 struct NvFlowGridProxyFlushParams
01412 {
01413     NvFlowContext* gridContext;         
01414     NvFlowContext* gridCopyContext;     
01415     NvFlowContext* renderCopyContext;   
01416 };
01417 
01425 NV_FLOW_API NvFlowGridProxy* NvFlowCreateGridProxy(const NvFlowGridProxyDesc* desc);
01426 
01432 NV_FLOW_API void NvFlowReleaseGridProxy(NvFlowGridProxy* proxy);
01433 
01441 NV_FLOW_API void NvFlowGridProxyPush(NvFlowGridProxy* proxy, NvFlowGridExport* gridExport, const NvFlowGridProxyFlushParams* params);
01442 
01449 NV_FLOW_API void NvFlowGridProxyFlush(NvFlowGridProxy* proxy, const NvFlowGridProxyFlushParams* params);
01450 
01459 NV_FLOW_API NvFlowGridExport* NvFlowGridProxyGetGridExport(NvFlowGridProxy* proxy, NvFlowContext* renderContext);
01460 
01462 // -------------------------- NvFlowDevice -------------------------------
01465 
01467 struct NvFlowDevice;
01468 
01470 enum NvFlowDeviceMode
01471 {
01472     eNvFlowDeviceModeProxy = 0,     
01473     eNvFlowDeviceModeUnique = 1,    
01474 };
01475 
01477 struct NvFlowDeviceDesc
01478 {
01479     NvFlowDeviceMode mode;          
01480     bool autoSelectDevice;          
01481     NvFlowUint adapterIdx;          
01482 };
01483 
01489 NV_FLOW_API void NvFlowDeviceDescDefaults(NvFlowDeviceDesc* desc);
01490 
01498 NV_FLOW_API bool NvFlowDedicatedDeviceAvailable(NvFlowContext* renderContext);
01499 
01507 NV_FLOW_API bool NvFlowDedicatedDeviceQueueAvailable(NvFlowContext* renderContext);
01508 
01517 NV_FLOW_API NvFlowDevice* NvFlowCreateDevice(NvFlowContext* renderContext, const NvFlowDeviceDesc* desc);
01518 
01524 NV_FLOW_API void NvFlowReleaseDevice(NvFlowDevice* device);
01525 
01527 struct NvFlowDeviceQueue;
01528 
01530 enum NvFlowDeviceQueueType
01531 {
01532     eNvFlowDeviceQueueTypeGraphics = 0,
01533     eNvFlowDeviceQueueTypeCompute = 1,
01534     eNvFlowDeviceQueueTypeCopy = 2
01535 };
01536 
01538 struct NvFlowDeviceQueueDesc
01539 {
01540     NvFlowDeviceQueueType queueType;
01541     bool lowLatency;
01542 };
01543 
01545 struct NvFlowDeviceQueueStatus
01546 {
01547     NvFlowUint framesInFlight;          
01548     NvFlowUint64 lastFenceCompleted;    
01549     NvFlowUint64 nextFenceValue;        
01550 };
01551 
01560 NV_FLOW_API NvFlowDeviceQueue* NvFlowCreateDeviceQueue(NvFlowDevice* device, const NvFlowDeviceQueueDesc* desc);
01561 
01567 NV_FLOW_API void NvFlowReleaseDeviceQueue(NvFlowDeviceQueue* deviceQueue);
01568 
01576 NV_FLOW_API NvFlowContext* NvFlowDeviceQueueCreateContext(NvFlowDeviceQueue* deviceQueue);
01577 
01585 NV_FLOW_API void NvFlowDeviceQueueUpdateContext(NvFlowDeviceQueue* deviceQueue, NvFlowContext* context, NvFlowDeviceQueueStatus* status);
01586 
01593 NV_FLOW_API void NvFlowDeviceQueueFlush(NvFlowDeviceQueue* deviceQueue, NvFlowContext* context);
01594 
01601 NV_FLOW_API void NvFlowDeviceQueueConditionalFlush(NvFlowDeviceQueue* deviceQueue, NvFlowContext* context);
01602 
01610 NV_FLOW_API void NvFlowDeviceQueueWaitOnFence(NvFlowDeviceQueue* deviceQueue, NvFlowContext* context, NvFlowUint64 fenceValue);
01611 
01613 // -------------------------- NvFlowSDFGenerator -------------------------------
01616 
01618 struct NvFlowSDFGen;
01619 
01621 struct NvFlowSDFGenDesc
01622 {
01623     NvFlowDim resolution;       
01624 };
01625 
01627 struct NvFlowSDFGenMeshParams
01628 {
01629     NvFlowUint numVertices;         
01630     float* positions;               
01631     NvFlowUint positionStride;      
01632     float* normals;                 
01633     NvFlowUint normalStride;        
01634 
01635     NvFlowUint numIndices;          
01636     NvFlowUint* indices;            
01637 
01638     NvFlowFloat4x4 modelMatrix;     
01639 
01640     NvFlowDepthStencilView* depthStencilView;   
01641     NvFlowRenderTargetView* renderTargetView;   
01642 };
01643 
01652 NV_FLOW_API NvFlowSDFGen* NvFlowCreateSDFGen(NvFlowContext* context, const NvFlowSDFGenDesc* desc);
01653 
01659 NV_FLOW_API void NvFlowReleaseSDFGen(NvFlowSDFGen* sdfGen);
01660 
01667 NV_FLOW_API void NvFlowSDFGenReset(NvFlowSDFGen* sdfGen, NvFlowContext* context);
01668 
01676 NV_FLOW_API void NvFlowSDFGenVoxelize(NvFlowSDFGen* sdfGen, NvFlowContext* context, const NvFlowSDFGenMeshParams* params);
01677 
01684 NV_FLOW_API void NvFlowSDFGenUpdate(NvFlowSDFGen* sdfGen, NvFlowContext* context);
01685 
01694 NV_FLOW_API NvFlowTexture3D* NvFlowSDFGenShape(NvFlowSDFGen* sdfGen, NvFlowContext* context);
01695 
01697 // -------------------------- NvFlowParticleSurface -------------------------------
01700 
01702 struct NvFlowParticleSurface;
01703 
01705 struct NvFlowParticleSurfaceDesc
01706 {
01707     NvFlowFloat3 initialLocation;       
01708     NvFlowFloat3 halfSize;              
01709 
01710     NvFlowDim virtualDim;               
01711     float residentScale;                
01712 
01713     NvFlowUint maxParticles;            
01714 };
01715 
01717 struct NvFlowParticleSurfaceData
01718 {
01719     const float* positions;         
01720     NvFlowUint positionStride;      
01721     NvFlowUint numParticles;        
01722 };
01723 
01725 struct NvFlowParticleSurfaceParams
01726 {
01727     float surfaceThreshold;         
01728     float smoothRadius;             
01729     bool separableSmoothing;        
01730 };
01731 
01733 struct NvFlowParticleSurfaceEmitParams
01734 {
01735     float deltaTime;
01736 
01737     NvFlowFloat3 velocityLinear;                    
01738     NvFlowFloat3 velocityCoupleRate;                
01739 
01740     float smoke;                                    
01741     float smokeCoupleRate;                          
01742 
01743     float temperature;                              
01744     float temperatureCoupleRate;                    
01745 
01746     float fuel;                                     
01747     float fuelCoupleRate;                           
01748 };
01749 
01758 NV_FLOW_API NvFlowParticleSurface* NvFlowCreateParticleSurface(NvFlowContext* context, const NvFlowParticleSurfaceDesc* desc);
01759 
01765 NV_FLOW_API void NvFlowReleaseParticleSurface(NvFlowParticleSurface* surface);
01766 
01774 NV_FLOW_API void NvFlowParticleSurfaceUpdateParticles(NvFlowParticleSurface* surface, NvFlowContext* context, const NvFlowParticleSurfaceData* data);
01775 
01783 NV_FLOW_API void NvFlowParticleSurfaceUpdateSurface(NvFlowParticleSurface* surface, NvFlowContext* context, const NvFlowParticleSurfaceParams* params);
01784 
01792 NV_FLOW_API void NvFlowParticleSurfaceAllocFunc(NvFlowParticleSurface* surface, NvFlowContext* context, const NvFlowGridEmitCustomAllocParams* params);
01793 
01803 NV_FLOW_API void NvFlowParticleSurfaceEmitVelocityFunc(NvFlowParticleSurface* surface, NvFlowContext* context, NvFlowUint* dataFrontIdx, const NvFlowGridEmitCustomEmitParams* params, const NvFlowParticleSurfaceEmitParams* emitParams);
01804 
01814 NV_FLOW_API void NvFlowParticleSurfaceEmitDensityFunc(NvFlowParticleSurface* surface, NvFlowContext* context, NvFlowUint* dataFrontIdx, const NvFlowGridEmitCustomEmitParams* params, const NvFlowParticleSurfaceEmitParams* emitParams);
01815 
01824 NV_FLOW_API NvFlowGridExport* NvFlowParticleSurfaceDebugGridExport(NvFlowParticleSurface* surface, NvFlowContext* context);
01825 
Copyright © 2014-2016 NVIDIA Corporation, 2701 San Tomas Expressway, Santa Clara, CA 95050 U.S.A. All rights reserved. www.nvidia.com