From d61c455a4775f966b44cc47804b9e0f160d3d332 Mon Sep 17 00:00:00 2001 From: bgaldrikian Date: Tue, 10 Nov 2020 20:53:31 -0800 Subject: Merge request #17 PhysX4 compatibility Other changes for linux and UE4CrossCompileLinux, and all packaging to work --- docs/source_docs/files/_asset_d_t_o_8h_source.html | 2 +- .../source_docs/files/_d_t_o_macros_8h_source.html | 2 +- .../files/_ext_px_asset_d_t_o_8h_source.html | 2 +- .../files/_ext_px_chunk_d_t_o_8h_source.html | 2 +- .../files/_ext_px_subchunk_d_t_o_8h_source.html | 2 +- docs/source_docs/files/_nv_blast_8h_source.html | 2 +- .../files/_nv_blast_actor_8h_source.html | 2 +- ..._blast_actor_serialization_block_8h_source.html | 2 +- .../files/_nv_blast_allocator_8h_source.html | 2 +- .../files/_nv_blast_array_8h_source.html | 2 +- .../files/_nv_blast_assert_8h_source.html | 2 +- .../files/_nv_blast_asset_8h_source.html | 2 +- .../files/_nv_blast_atomic_8h_source.html | 2 +- .../files/_nv_blast_bond_d_t_o_8h_source.html | 2 +- .../files/_nv_blast_chunk_d_t_o_8h_source.html | 2 +- .../files/_nv_blast_chunk_hierarchy_8h_source.html | 2 +- .../files/_nv_blast_d_link_8h_source.html | 2 +- .../files/_nv_blast_debug_render_8h_source.html | 2 +- .../_nv_blast_ext_apex_import_tool_8h_source.html | 2 +- .../_nv_blast_ext_apex_shared_parts_8h_source.html | 2 +- .../files/_nv_blast_ext_asset_utils_8h_source.html | 2 +- .../files/_nv_blast_ext_authoring_8h_source.html | 2 +- ..._blast_ext_authoring_accelerator_8h_source.html | 2 +- ...ast_ext_authoring_bond_generator_8h_source.html | 2 +- ...xt_authoring_bond_generator_impl_8h_source.html | 2 +- ...blast_ext_authoring_boolean_tool_8h_source.html | 2 +- ...authoring_collision_builder_impl_8h_source.html | 2 +- ...xt_authoring_convex_mesh_builder_8h_source.html | 2 +- .../_nv_blast_ext_authoring_cutout_8h_source.html | 2 +- ..._blast_ext_authoring_cutout_impl_8h_source.html | 2 +- ...last_ext_authoring_fracture_tool_8h_source.html | 2 +- ...ext_authoring_fracture_tool_impl_8h_source.html | 2 +- ...st_ext_authoring_internal_common_8h_source.html | 2 +- .../_nv_blast_ext_authoring_mesh_8h_source.html | 2 +- ...blast_ext_authoring_mesh_cleaner_8h_source.html | 2 +- ..._ext_authoring_mesh_cleaner_impl_8h_source.html | 2 +- ...nv_blast_ext_authoring_mesh_impl_8h_source.html | 2 +- ..._blast_ext_authoring_mesh_noiser_8h_source.html | 2 +- ..._ext_authoring_pattern_generator_8h_source.html | 2 +- ...authoring_pattern_generator_impl_8h_source.html | 2 +- ...blast_ext_authoring_perlin_noise_8h_source.html | 2 +- ...blast_ext_authoring_triangulator_8h_source.html | 2 +- .../_nv_blast_ext_authoring_types_8h_source.html | 2 +- .../_nv_blast_ext_authoring_v_s_a_8h_source.html | 2 +- .../_nv_blast_ext_custom_profiler_8h-source.html | 223 +++++++++++---------- .../files/_nv_blast_ext_custom_profiler_8h.html | 1 + .../_nv_blast_ext_custom_profiler_8h_source.html | 20 +- ..._damage_accelerator_a_a_b_b_tree_8h_source.html | 2 +- ..._ext_damage_accelerator_internal_8h_source.html | 2 +- .../_nv_blast_ext_damage_shaders_8h_source.html | 2 +- .../files/_nv_blast_ext_exporter_8h_source.html | 2 +- ...nv_blast_ext_exporter_fbx_reader_8h_source.html | 2 +- ..._nv_blast_ext_exporter_fbx_utils_8h_source.html | 2 +- ...nv_blast_ext_exporter_fbx_writer_8h_source.html | 2 +- ...last_ext_exporter_json_collision_8h_source.html | 2 +- ...nv_blast_ext_exporter_obj_reader_8h_source.html | 2 +- ...nv_blast_ext_exporter_obj_writer_8h_source.html | 2 +- ..._blast_ext_impact_damage_manager_8h_source.html | 2 +- .../_nv_blast_ext_input_stream_8h_source.html | 2 +- ...nv_blast_ext_k_j_px_input_stream_8h_source.html | 2 +- ...v_blast_ext_k_j_px_output_stream_8h_source.html | 2 +- .../_nv_blast_ext_ll_serialization_8h_source.html | 2 +- ..._blast_ext_ll_serializer_c_a_p_n_8h_source.html | 2 +- .../_nv_blast_ext_output_stream_8h_source.html | 2 +- .../files/_nv_blast_ext_px_8h_source.html | 2 +- .../files/_nv_blast_ext_px_actor_8h_source.html | 2 +- .../_nv_blast_ext_px_actor_impl_8h_source.html | 2 +- .../files/_nv_blast_ext_px_asset_8h_source.html | 2 +- .../_nv_blast_ext_px_asset_impl_8h_source.html | 2 +- ...v_blast_ext_px_collision_builder_8h_source.html | 2 +- ...st_ext_px_collision_builder_impl_8h_source.html | 2 +- .../files/_nv_blast_ext_px_family_8h_source.html | 2 +- .../_nv_blast_ext_px_family_impl_8h_source.html | 2 +- .../files/_nv_blast_ext_px_listener_8h_source.html | 2 +- .../files/_nv_blast_ext_px_manager_8h_source.html | 2 +- .../_nv_blast_ext_px_manager_impl_8h_source.html | 2 +- .../_nv_blast_ext_px_serialization_8h_source.html | 2 +- ..._blast_ext_px_serializer_c_a_p_n_8h_source.html | 2 +- ...nv_blast_ext_px_serializer_r_a_w_8h_source.html | 2 +- .../_nv_blast_ext_px_stress_solver_8h_source.html | 2 +- ..._blast_ext_px_stress_solver_impl_8h_source.html | 2 +- .../files/_nv_blast_ext_px_task_8h_source.html | 2 +- .../_nv_blast_ext_px_task_impl_8h_source.html | 2 +- .../files/_nv_blast_ext_r_t_8h_source.html | 2 +- .../files/_nv_blast_ext_r_t_impl_8h_source.html | 2 +- ...blast_ext_r_t_multithreaded_impl_8h_source.html | 2 +- .../_nv_blast_ext_serialization_8h_source.html | 2 +- ..._blast_ext_serialization_c_a_p_n_8h_source.html | 2 +- ...blast_ext_serialization_internal_8h_source.html | 2 +- .../_nv_blast_ext_stress_solver_8h_source.html | 2 +- .../files/_nv_blast_ext_sync_8h_source.html | 2 +- .../_nv_blast_ext_tk_serialization_8h_source.html | 2 +- ..._blast_ext_tk_serializer_c_a_p_n_8h_source.html | 2 +- ...nv_blast_ext_tk_serializer_r_a_w_8h_source.html | 2 +- ..._nv_blast_ext_triangle_processor_8h_source.html | 2 +- .../files/_nv_blast_family_8h_source.html | 2 +- .../files/_nv_blast_family_graph_8h_source.html | 2 +- .../files/_nv_blast_fixed_array_8h_source.html | 2 +- .../files/_nv_blast_fixed_bitmap_8h_source.html | 2 +- .../_nv_blast_fixed_bool_array_8h_source.html | 2 +- .../_nv_blast_fixed_priority_queue_8h_source.html | 2 +- .../files/_nv_blast_fixed_queue_8h_source.html | 2 +- .../files/_nv_blast_geometry_8h_source.html | 2 +- .../files/_nv_blast_globals_8h_source.html | 2 +- .../files/_nv_blast_hash_map_8h_source.html | 2 +- .../files/_nv_blast_hash_set_8h_source.html | 2 +- .../files/_nv_blast_i_d_d_t_o_8h_source.html | 2 +- .../files/_nv_blast_include_windows_8h_source.html | 2 +- .../files/_nv_blast_index_fns_8h_source.html | 2 +- .../files/_nv_blast_iterator_base_8h_source.html | 2 +- .../files/_nv_blast_math_8h_source.html | 2 +- .../files/_nv_blast_memory_8h_source.html | 2 +- .../files/_nv_blast_preprocessor_8h_source.html | 2 +- .../_nv_blast_preprocessor_internal_8h_source.html | 2 +- .../files/_nv_blast_profiler_8h_source.html | 2 +- .../_nv_blast_profiler_internal_8h_source.html | 2 +- .../files/_nv_blast_px_callbacks_8h_source.html | 2 +- .../_nv_blast_px_shared_helpers_8h_source.html | 2 +- .../files/_nv_blast_support_graph_8h_source.html | 2 +- .../files/_nv_blast_time_8h_source.html | 2 +- docs/source_docs/files/_nv_blast_tk_8h_source.html | 2 +- .../files/_nv_blast_tk_actor_8h_source.html | 2 +- .../files/_nv_blast_tk_actor_impl_8h_source.html | 2 +- .../files/_nv_blast_tk_asset_8h_source.html | 2 +- .../files/_nv_blast_tk_asset_impl_8h_source.html | 2 +- .../files/_nv_blast_tk_common_8h_source.html | 2 +- .../files/_nv_blast_tk_event_8h_source.html | 2 +- .../files/_nv_blast_tk_event_queue_8h_source.html | 2 +- .../files/_nv_blast_tk_family_8h_source.html | 2 +- .../files/_nv_blast_tk_family_impl_8h_source.html | 2 +- .../files/_nv_blast_tk_framework_8h_source.html | 2 +- .../_nv_blast_tk_framework_impl_8h_source.html | 2 +- .../files/_nv_blast_tk_g_u_i_d_8h_source.html | 2 +- .../files/_nv_blast_tk_group_8h_source.html | 2 +- .../files/_nv_blast_tk_group_impl_8h_source.html | 2 +- .../files/_nv_blast_tk_identifiable_8h_source.html | 2 +- .../files/_nv_blast_tk_joint_8h_source.html | 2 +- .../files/_nv_blast_tk_joint_impl_8h_source.html | 2 +- .../files/_nv_blast_tk_object_8h_source.html | 2 +- .../files/_nv_blast_tk_task_impl_8h_source.html | 2 +- .../files/_nv_blast_tk_type_8h_source.html | 2 +- .../files/_nv_blast_tk_type_impl_8h_source.html | 2 +- .../files/_nv_blast_types_8h_source.html | 2 +- docs/source_docs/files/_nv_c_types_8h_source.html | 2 +- .../files/_nv_preprocessor_8h_source.html | 2 +- .../_px_convex_mesh_geometry_d_t_o_8h_source.html | 2 +- .../files/_px_mesh_scale_d_t_o_8h_source.html | 2 +- .../files/_px_quat_d_t_o_8h_source.html | 2 +- .../files/_px_transform_d_t_o_8h_source.html | 2 +- .../files/_px_vec3_d_t_o_8h_source.html | 2 +- .../files/_tk_asset_d_t_o_8h_source.html | 2 +- .../_tk_asset_joint_desc_d_t_o_8h_source.html | 2 +- 152 files changed, 272 insertions(+), 270 deletions(-) (limited to 'docs/source_docs') diff --git a/docs/source_docs/files/_asset_d_t_o_8h_source.html b/docs/source_docs/files/_asset_d_t_o_8h_source.html index ec2aaf1..f954543 100755 --- a/docs/source_docs/files/_asset_d_t_o_8h_source.html +++ b/docs/source_docs/files/_asset_d_t_o_8h_source.html @@ -46,7 +46,7 @@ $(document).ready(function(){initNavTree('_asset_d_t_o_8h_source.html','');});
AssetDTO.h
-Go to the documentation of this file.
1 // This code contains NVIDIA Confidential Information and is disclosed to you
2 // under a form of NVIDIA software license agreement provided separately to you.
3 //
4 // Notice
5 // NVIDIA Corporation and its licensors retain all intellectual property and
6 // proprietary rights in and to this software and related documentation and
7 // any modifications thereto. Any use, reproduction, disclosure, or
8 // distribution of this software and related documentation without an express
9 // license agreement from NVIDIA Corporation is strictly prohibited.
10 //
11 // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12 // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15 //
16 // Information and code furnished is believed to be accurate and reliable.
17 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18 // information or for any infringement of patents or other rights of third parties that may
19 // result from its use. No license is granted by implication or otherwise under any patent
20 // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21 // This code supersedes and replaces all information previously supplied.
22 // NVIDIA Corporation products are not authorized for use as critical
23 // components in life support devices or systems without express written approval of
24 // NVIDIA Corporation.
25 //
26 // Copyright (c) 2018 NVIDIA Corporation. All rights reserved.
27 
28 
29 #pragma once
30 #include "DTOMacros.h"
31 #include "NvBlastAsset.h"
33 
#define DTO_CLASS(_NAME, _POCO, _SERIALIZER)
Definition: DTOMacros.h:31
+Go to the documentation of this file.
1 // This code contains NVIDIA Confidential Information and is disclosed to you
2 // under a form of NVIDIA software license agreement provided separately to you.
3 //
4 // Notice
5 // NVIDIA Corporation and its licensors retain all intellectual property and
6 // proprietary rights in and to this software and related documentation and
7 // any modifications thereto. Any use, reproduction, disclosure, or
8 // distribution of this software and related documentation without an express
9 // license agreement from NVIDIA Corporation is strictly prohibited.
10 //
11 // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12 // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15 //
16 // Information and code furnished is believed to be accurate and reliable.
17 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18 // information or for any infringement of patents or other rights of third parties that may
19 // result from its use. No license is granted by implication or otherwise under any patent
20 // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21 // This code supersedes and replaces all information previously supplied.
22 // NVIDIA Corporation products are not authorized for use as critical
23 // components in life support devices or systems without express written approval of
24 // NVIDIA Corporation.
25 //
26 // Copyright (c) 2020 NVIDIA Corporation. All rights reserved.
27 
28 
29 #pragma once
30 #include "DTOMacros.h"
31 #include "NvBlastAsset.h"
33 
#define DTO_CLASS(_NAME, _POCO, _SERIALIZER)
Definition: DTOMacros.h:31
Definition: NvBlastExtLlSerialization.capn.h:37
diff --git a/docs/source_docs/files/_d_t_o_macros_8h_source.html b/docs/source_docs/files/_d_t_o_macros_8h_source.html index 3244318..b17605f 100755 --- a/docs/source_docs/files/_d_t_o_macros_8h_source.html +++ b/docs/source_docs/files/_d_t_o_macros_8h_source.html @@ -46,7 +46,7 @@ $(document).ready(function(){initNavTree('_d_t_o_macros_8h_source.html','');});
DTOMacros.h
-Go to the documentation of this file.
1 // This code contains NVIDIA Confidential Information and is disclosed to you
2 // under a form of NVIDIA software license agreement provided separately to you.
3 //
4 // Notice
5 // NVIDIA Corporation and its licensors retain all intellectual property and
6 // proprietary rights in and to this software and related documentation and
7 // any modifications thereto. Any use, reproduction, disclosure, or
8 // distribution of this software and related documentation without an express
9 // license agreement from NVIDIA Corporation is strictly prohibited.
10 //
11 // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12 // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15 //
16 // Information and code furnished is believed to be accurate and reliable.
17 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18 // information or for any infringement of patents or other rights of third parties that may
19 // result from its use. No license is granted by implication or otherwise under any patent
20 // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21 // This code supersedes and replaces all information previously supplied.
22 // NVIDIA Corporation products are not authorized for use as critical
23 // components in life support devices or systems without express written approval of
24 // NVIDIA Corporation.
25 //
26 // Copyright (c) 2018 NVIDIA Corporation. All rights reserved.
27 
28 
29 #pragma once
30 
31 #define DTO_CLASS(_NAME, _POCO, _SERIALIZER) \
32 namespace Nv { \
33 namespace Blast { \
34 class _NAME ## DTO \
35 { \
36 public: \
37  \
38  static bool serialize(_SERIALIZER::Builder builder, const _POCO * poco); \
39  static _POCO* deserialize(_SERIALIZER::Reader reader); \
40  static bool deserializeInto(_SERIALIZER::Reader reader, _POCO * poco); \
41 }; \
42 } \
43 }
+Go to the documentation of this file.
1 // This code contains NVIDIA Confidential Information and is disclosed to you
2 // under a form of NVIDIA software license agreement provided separately to you.
3 //
4 // Notice
5 // NVIDIA Corporation and its licensors retain all intellectual property and
6 // proprietary rights in and to this software and related documentation and
7 // any modifications thereto. Any use, reproduction, disclosure, or
8 // distribution of this software and related documentation without an express
9 // license agreement from NVIDIA Corporation is strictly prohibited.
10 //
11 // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12 // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15 //
16 // Information and code furnished is believed to be accurate and reliable.
17 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18 // information or for any infringement of patents or other rights of third parties that may
19 // result from its use. No license is granted by implication or otherwise under any patent
20 // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21 // This code supersedes and replaces all information previously supplied.
22 // NVIDIA Corporation products are not authorized for use as critical
23 // components in life support devices or systems without express written approval of
24 // NVIDIA Corporation.
25 //
26 // Copyright (c) 2020 NVIDIA Corporation. All rights reserved.
27 
28 
29 #pragma once
30 
31 #define DTO_CLASS(_NAME, _POCO, _SERIALIZER) \
32 namespace Nv { \
33 namespace Blast { \
34 class _NAME ## DTO \
35 { \
36 public: \
37  \
38  static bool serialize(_SERIALIZER::Builder builder, const _POCO * poco); \
39  static _POCO* deserialize(_SERIALIZER::Reader reader); \
40  static bool deserializeInto(_SERIALIZER::Reader reader, _POCO * poco); \
41 }; \
42 } \
43 }
-Go to the documentation of this file.
1 // This code contains NVIDIA Confidential Information and is disclosed to you
2 // under a form of NVIDIA software license agreement provided separately to you.
3 //
4 // Notice
5 // NVIDIA Corporation and its licensors retain all intellectual property and
6 // proprietary rights in and to this software and related documentation and
7 // any modifications thereto. Any use, reproduction, disclosure, or
8 // distribution of this software and related documentation without an express
9 // license agreement from NVIDIA Corporation is strictly prohibited.
10 //
11 // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12 // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15 //
16 // Information and code furnished is believed to be accurate and reliable.
17 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18 // information or for any infringement of patents or other rights of third parties that may
19 // result from its use. No license is granted by implication or otherwise under any patent
20 // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21 // This code supersedes and replaces all information previously supplied.
22 // NVIDIA Corporation products are not authorized for use as critical
23 // components in life support devices or systems without express written approval of
24 // NVIDIA Corporation.
25 //
26 // Copyright (c) 2018 NVIDIA Corporation. All rights reserved.
27 
28 
29 #pragma once
30 #include "NvBlastBondDTO.h"
31 #include "NvBlastExtPxAsset.h"
33 
+Go to the documentation of this file.
1 // This code contains NVIDIA Confidential Information and is disclosed to you
2 // under a form of NVIDIA software license agreement provided separately to you.
3 //
4 // Notice
5 // NVIDIA Corporation and its licensors retain all intellectual property and
6 // proprietary rights in and to this software and related documentation and
7 // any modifications thereto. Any use, reproduction, disclosure, or
8 // distribution of this software and related documentation without an express
9 // license agreement from NVIDIA Corporation is strictly prohibited.
10 //
11 // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12 // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15 //
16 // Information and code furnished is believed to be accurate and reliable.
17 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18 // information or for any infringement of patents or other rights of third parties that may
19 // result from its use. No license is granted by implication or otherwise under any patent
20 // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21 // This code supersedes and replaces all information previously supplied.
22 // NVIDIA Corporation products are not authorized for use as critical
23 // components in life support devices or systems without express written approval of
24 // NVIDIA Corporation.
25 //
26 // Copyright (c) 2020 NVIDIA Corporation. All rights reserved.
27 
28 
29 #pragma once
30 #include "NvBlastBondDTO.h"
31 #include "NvBlastExtPxAsset.h"
33 
#define DTO_CLASS(_NAME, _POCO, _SERIALIZER)
Definition: DTOMacros.h:31
Definition: NvBlastExtPxAsset.h:123
diff --git a/docs/source_docs/files/_ext_px_chunk_d_t_o_8h_source.html b/docs/source_docs/files/_ext_px_chunk_d_t_o_8h_source.html index 9c1f483..a3384cf 100755 --- a/docs/source_docs/files/_ext_px_chunk_d_t_o_8h_source.html +++ b/docs/source_docs/files/_ext_px_chunk_d_t_o_8h_source.html @@ -46,7 +46,7 @@ $(document).ready(function(){initNavTree('_ext_px_chunk_d_t_o_8h_source.html',''
ExtPxChunkDTO.h
-Go to the documentation of this file.
1 // This code contains NVIDIA Confidential Information and is disclosed to you
2 // under a form of NVIDIA software license agreement provided separately to you.
3 //
4 // Notice
5 // NVIDIA Corporation and its licensors retain all intellectual property and
6 // proprietary rights in and to this software and related documentation and
7 // any modifications thereto. Any use, reproduction, disclosure, or
8 // distribution of this software and related documentation without an express
9 // license agreement from NVIDIA Corporation is strictly prohibited.
10 //
11 // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12 // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15 //
16 // Information and code furnished is believed to be accurate and reliable.
17 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18 // information or for any infringement of patents or other rights of third parties that may
19 // result from its use. No license is granted by implication or otherwise under any patent
20 // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21 // This code supersedes and replaces all information previously supplied.
22 // NVIDIA Corporation products are not authorized for use as critical
23 // components in life support devices or systems without express written approval of
24 // NVIDIA Corporation.
25 //
26 // Copyright (c) 2018 NVIDIA Corporation. All rights reserved.
27 
28 
29 #pragma once
30 #include "DTOMacros.h"
31 #include "NvBlastExtPxAsset.h"
33 
+Go to the documentation of this file.
1 // This code contains NVIDIA Confidential Information and is disclosed to you
2 // under a form of NVIDIA software license agreement provided separately to you.
3 //
4 // Notice
5 // NVIDIA Corporation and its licensors retain all intellectual property and
6 // proprietary rights in and to this software and related documentation and
7 // any modifications thereto. Any use, reproduction, disclosure, or
8 // distribution of this software and related documentation without an express
9 // license agreement from NVIDIA Corporation is strictly prohibited.
10 //
11 // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12 // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15 //
16 // Information and code furnished is believed to be accurate and reliable.
17 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18 // information or for any infringement of patents or other rights of third parties that may
19 // result from its use. No license is granted by implication or otherwise under any patent
20 // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21 // This code supersedes and replaces all information previously supplied.
22 // NVIDIA Corporation products are not authorized for use as critical
23 // components in life support devices or systems without express written approval of
24 // NVIDIA Corporation.
25 //
26 // Copyright (c) 2020 NVIDIA Corporation. All rights reserved.
27 
28 
29 #pragma once
30 #include "DTOMacros.h"
31 #include "NvBlastExtPxAsset.h"
33 
#define DTO_CLASS(_NAME, _POCO, _SERIALIZER)
Definition: DTOMacros.h:31
Definition: NvBlastExtPxAsset.h:110
diff --git a/docs/source_docs/files/_ext_px_subchunk_d_t_o_8h_source.html b/docs/source_docs/files/_ext_px_subchunk_d_t_o_8h_source.html index f8de95d..5ce51ea 100755 --- a/docs/source_docs/files/_ext_px_subchunk_d_t_o_8h_source.html +++ b/docs/source_docs/files/_ext_px_subchunk_d_t_o_8h_source.html @@ -46,7 +46,7 @@ $(document).ready(function(){initNavTree('_ext_px_subchunk_d_t_o_8h_source.html'
ExtPxSubchunkDTO.h
-Go to the documentation of this file.
1 // This code contains NVIDIA Confidential Information and is disclosed to you
2 // under a form of NVIDIA software license agreement provided separately to you.
3 //
4 // Notice
5 // NVIDIA Corporation and its licensors retain all intellectual property and
6 // proprietary rights in and to this software and related documentation and
7 // any modifications thereto. Any use, reproduction, disclosure, or
8 // distribution of this software and related documentation without an express
9 // license agreement from NVIDIA Corporation is strictly prohibited.
10 //
11 // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12 // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15 //
16 // Information and code furnished is believed to be accurate and reliable.
17 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18 // information or for any infringement of patents or other rights of third parties that may
19 // result from its use. No license is granted by implication or otherwise under any patent
20 // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21 // This code supersedes and replaces all information previously supplied.
22 // NVIDIA Corporation products are not authorized for use as critical
23 // components in life support devices or systems without express written approval of
24 // NVIDIA Corporation.
25 //
26 // Copyright (c) 2018 NVIDIA Corporation. All rights reserved.
27 
28 
29 #pragma once
30 #include "NvBlastExtPxAsset.h"
32 #include "DTOMacros.h"
33 
+Go to the documentation of this file.
1 // This code contains NVIDIA Confidential Information and is disclosed to you
2 // under a form of NVIDIA software license agreement provided separately to you.
3 //
4 // Notice
5 // NVIDIA Corporation and its licensors retain all intellectual property and
6 // proprietary rights in and to this software and related documentation and
7 // any modifications thereto. Any use, reproduction, disclosure, or
8 // distribution of this software and related documentation without an express
9 // license agreement from NVIDIA Corporation is strictly prohibited.
10 //
11 // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12 // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15 //
16 // Information and code furnished is believed to be accurate and reliable.
17 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18 // information or for any infringement of patents or other rights of third parties that may
19 // result from its use. No license is granted by implication or otherwise under any patent
20 // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21 // This code supersedes and replaces all information previously supplied.
22 // NVIDIA Corporation products are not authorized for use as critical
23 // components in life support devices or systems without express written approval of
24 // NVIDIA Corporation.
25 //
26 // Copyright (c) 2020 NVIDIA Corporation. All rights reserved.
27 
28 
29 #pragma once
30 #include "NvBlastExtPxAsset.h"
32 #include "DTOMacros.h"
33 
#define DTO_CLASS(_NAME, _POCO, _SERIALIZER)
Definition: DTOMacros.h:31
Definition: NvBlastExtPxAsset.h:98
diff --git a/docs/source_docs/files/_nv_blast_8h_source.html b/docs/source_docs/files/_nv_blast_8h_source.html index ddd7aee..881a4f1 100755 --- a/docs/source_docs/files/_nv_blast_8h_source.html +++ b/docs/source_docs/files/_nv_blast_8h_source.html @@ -46,7 +46,7 @@ $(document).ready(function(){initNavTree('_nv_blast_8h_source.html','');});
NvBlast.h
-Go to the documentation of this file.
1 // This code contains NVIDIA Confidential Information and is disclosed to you
2 // under a form of NVIDIA software license agreement provided separately to you.
3 //
4 // Notice
5 // NVIDIA Corporation and its licensors retain all intellectual property and
6 // proprietary rights in and to this software and related documentation and
7 // any modifications thereto. Any use, reproduction, disclosure, or
8 // distribution of this software and related documentation without an express
9 // license agreement from NVIDIA Corporation is strictly prohibited.
10 //
11 // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12 // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15 //
16 // Information and code furnished is believed to be accurate and reliable.
17 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18 // information or for any infringement of patents or other rights of third parties that may
19 // result from its use. No license is granted by implication or otherwise under any patent
20 // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21 // This code supersedes and replaces all information previously supplied.
22 // NVIDIA Corporation products are not authorized for use as critical
23 // components in life support devices or systems without express written approval of
24 // NVIDIA Corporation.
25 //
26 // Copyright (c) 2016-2018 NVIDIA Corporation. All rights reserved.
27 
28 
29 #ifndef NVBLAST_H
30 #define NVBLAST_H
31 
32 
33 #include "NvBlastTypes.h"
34 
35 
37 // NvBlastAsset functions
40 
51 
52 
63 
64 
89 NVBLAST_API NvBlastAsset* NvBlastCreateAsset(void* mem, const NvBlastAssetDesc* desc, void* scratch, NvBlastLog logFn);
90 
91 
102 
103 
117 
118 
128 
129 
139 NVBLAST_API bool NvBlastAssetSetID(NvBlastAsset* asset, const NvBlastID* id, NvBlastLog logFn);
140 
141 
151 
152 
161 NVBLAST_API uint32_t NvBlastAssetGetSize(const NvBlastAsset* asset, NvBlastLog logFn);
162 
163 
172 NVBLAST_API uint32_t NvBlastAssetGetChunkCount(const NvBlastAsset* asset, NvBlastLog logFn);
173 
174 
188 
189 
199 
200 
212 
213 
222 NVBLAST_API uint32_t NvBlastAssetGetBondCount(const NvBlastAsset* asset, NvBlastLog logFn);
223 
224 
234 
235 
246 NVBLAST_API const uint32_t* NvBlastAssetGetChunkToGraphNodeMap(const NvBlastAsset* asset, NvBlastLog logFn);
247 
248 
258 
259 
269 
270 
282 
284 
285 
287 // NvBlastAsset helper functions
290 
307 NVBLAST_API bool NvBlastEnsureAssetExactSupportCoverage(NvBlastChunkDesc* chunkDescs, uint32_t chunkCount, void* scratch, NvBlastLog logFn);
308 
309 
333 NVBLAST_API bool NvBlastBuildAssetDescChunkReorderMap(uint32_t* chunkReorderMap, const NvBlastChunkDesc* chunkDescs, uint32_t chunkCount, void* scratch, NvBlastLog logFn);
334 
335 
354 (
355  NvBlastChunkDesc* reorderedChunkDescs,
356  const NvBlastChunkDesc* chunkDescs,
357  uint32_t chunkCount,
358  NvBlastBondDesc* bondDescs,
359  uint32_t bondCount,
360  const uint32_t* chunkReorderMap,
361  bool keepBondNormalChunkOrder,
362  NvBlastLog logFn
363 );
364 
365 
386 (
387  NvBlastChunkDesc* chunkDescs,
388  uint32_t chunkCount,
389  NvBlastBondDesc* bondDescs,
390  uint32_t bondCount,
391  const uint32_t* chunkReorderMap,
392  bool keepBondNormalChunkOrder,
393  void* scratch,
394  NvBlastLog logFn
395 );
396 
397 
415 (
416  NvBlastChunkDesc* chunkDescs,
417  uint32_t chunkCount,
418  NvBlastBondDesc* bondDescs,
419  uint32_t bondCount,
420  uint32_t* chunkReorderMap,
421  bool keepBondNormalChunkOrder,
422  void* scratch,
423  NvBlastLog logFn
424 );
425 
427 
428 
430 // NvBlastFamily functions
433 
443 
444 
454 
455 
463 NVBLAST_API void NvBlastFamilySetAsset(NvBlastFamily* family, const NvBlastAsset* asset, NvBlastLog logFn);
464 
465 
474 NVBLAST_API uint32_t NvBlastFamilyGetSize(const NvBlastFamily* family, NvBlastLog logFn);
475 
476 
486 
487 
497 
498 
510 
511 
520 NVBLAST_API uint32_t NvBlastFamilyGetActorCount(const NvBlastFamily* family, NvBlastLog logFn);
521 
522 
535 
536 
547 NVBLAST_API uint32_t NvBlastFamilyGetActors(NvBlastActor** actors, uint32_t actorsSize, const NvBlastFamily* family, NvBlastLog logFn);
548 
549 
559 NVBLAST_API NvBlastActor* NvBlastFamilyGetChunkActor(const NvBlastFamily* family, uint32_t chunkIndex, NvBlastLog logFn);
560 
561 
571 
573 
574 
576 // NvBlastActor accessor, serialization, and deactivation functions
579 
589 
590 
601 NVBLAST_API uint32_t NvBlastActorGetVisibleChunkIndices(uint32_t* visibleChunkIndices, uint32_t visibleChunkIndicesSize, const NvBlastActor* actor, NvBlastLog logFn);
602 
603 
613 
614 
625 NVBLAST_API uint32_t NvBlastActorGetGraphNodeIndices(uint32_t* graphNodeIndices, uint32_t graphNodeIndicesSize, const NvBlastActor* actor, NvBlastLog logFn);
626 
627 
648 NVBLAST_API const float* NvBlastActorGetBondHealths(const NvBlastActor* actor, NvBlastLog logFn);
649 
650 
661 
662 
673 NVBLAST_API uint32_t NvBlastActorSerialize(void* buffer, uint32_t bufferSize, const NvBlastActor* actor, NvBlastLog logFn);
674 
675 
685 
686 
695 NVBLAST_API uint32_t NvBlastActorGetIndex(const NvBlastActor* actor, NvBlastLog logFn);
696 
697 
707 
709 
710 
712 // NvBlastActor damage and fracturing functions
715 
739 (
740  NvBlastFractureBuffers* commandBuffers,
741  const NvBlastActor* actor,
742  const NvBlastDamageProgram program,
743  const void* programParams,
744  NvBlastLog logFn,
745  NvBlastTimers* timers
746 );
747 
748 
780 (
781  NvBlastFractureBuffers* eventBuffers,
782  NvBlastActor* actor,
783  const NvBlastFractureBuffers* commands,
784  NvBlastLog logFn,
785  NvBlastTimers* timers
786 );
787 
788 
803 (
804  NvBlastActorSplitEvent* result,
805  NvBlastActor* actor,
806  uint32_t newActorsMaxCount,
807  void* scratch,
808  NvBlastLog logFn,
809  NvBlastTimers* timers
810 );
811 
812 
823 
824 
835 
836 
846 
847 
858 
859 
864 
866 
867 
869 // NvBlastTimers functions and helpers
872 
879 
880 
888 NVBLAST_API double NvBlastTicksToSeconds(int64_t ticks);
889 
891 
892 
893 #endif // ifndef NVBLAST_H
NVBLAST_API uint32_t NvBlastFamilyGetSize(const NvBlastFamily *family, NvBlastLog logFn)
+Go to the documentation of this file.
1 // This code contains NVIDIA Confidential Information and is disclosed to you
2 // under a form of NVIDIA software license agreement provided separately to you.
3 //
4 // Notice
5 // NVIDIA Corporation and its licensors retain all intellectual property and
6 // proprietary rights in and to this software and related documentation and
7 // any modifications thereto. Any use, reproduction, disclosure, or
8 // distribution of this software and related documentation without an express
9 // license agreement from NVIDIA Corporation is strictly prohibited.
10 //
11 // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12 // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15 //
16 // Information and code furnished is believed to be accurate and reliable.
17 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18 // information or for any infringement of patents or other rights of third parties that may
19 // result from its use. No license is granted by implication or otherwise under any patent
20 // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21 // This code supersedes and replaces all information previously supplied.
22 // NVIDIA Corporation products are not authorized for use as critical
23 // components in life support devices or systems without express written approval of
24 // NVIDIA Corporation.
25 //
26 // Copyright (c) 2016-2020 NVIDIA Corporation. All rights reserved.
27 
28 
29 #ifndef NVBLAST_H
30 #define NVBLAST_H
31 
32 
33 #include "NvBlastTypes.h"
34 
35 
37 // NvBlastAsset functions
40 
51 
52 
63 
64 
89 NVBLAST_API NvBlastAsset* NvBlastCreateAsset(void* mem, const NvBlastAssetDesc* desc, void* scratch, NvBlastLog logFn);
90 
91 
102 
103 
117 
118 
128 
129 
139 NVBLAST_API bool NvBlastAssetSetID(NvBlastAsset* asset, const NvBlastID* id, NvBlastLog logFn);
140 
141 
151 
152 
161 NVBLAST_API uint32_t NvBlastAssetGetSize(const NvBlastAsset* asset, NvBlastLog logFn);
162 
163 
172 NVBLAST_API uint32_t NvBlastAssetGetChunkCount(const NvBlastAsset* asset, NvBlastLog logFn);
173 
174 
188 
189 
199 
200 
212 
213 
222 NVBLAST_API uint32_t NvBlastAssetGetBondCount(const NvBlastAsset* asset, NvBlastLog logFn);
223 
224 
234 
235 
246 NVBLAST_API const uint32_t* NvBlastAssetGetChunkToGraphNodeMap(const NvBlastAsset* asset, NvBlastLog logFn);
247 
248 
258 
259 
269 
270 
282 
284 
285 
287 // NvBlastAsset helper functions
290 
307 NVBLAST_API bool NvBlastEnsureAssetExactSupportCoverage(NvBlastChunkDesc* chunkDescs, uint32_t chunkCount, void* scratch, NvBlastLog logFn);
308 
309 
333 NVBLAST_API bool NvBlastBuildAssetDescChunkReorderMap(uint32_t* chunkReorderMap, const NvBlastChunkDesc* chunkDescs, uint32_t chunkCount, void* scratch, NvBlastLog logFn);
334 
335 
354 (
355  NvBlastChunkDesc* reorderedChunkDescs,
356  const NvBlastChunkDesc* chunkDescs,
357  uint32_t chunkCount,
358  NvBlastBondDesc* bondDescs,
359  uint32_t bondCount,
360  const uint32_t* chunkReorderMap,
361  bool keepBondNormalChunkOrder,
362  NvBlastLog logFn
363 );
364 
365 
386 (
387  NvBlastChunkDesc* chunkDescs,
388  uint32_t chunkCount,
389  NvBlastBondDesc* bondDescs,
390  uint32_t bondCount,
391  const uint32_t* chunkReorderMap,
392  bool keepBondNormalChunkOrder,
393  void* scratch,
394  NvBlastLog logFn
395 );
396 
397 
415 (
416  NvBlastChunkDesc* chunkDescs,
417  uint32_t chunkCount,
418  NvBlastBondDesc* bondDescs,
419  uint32_t bondCount,
420  uint32_t* chunkReorderMap,
421  bool keepBondNormalChunkOrder,
422  void* scratch,
423  NvBlastLog logFn
424 );
425 
427 
428 
430 // NvBlastFamily functions
433 
443 
444 
454 
455 
463 NVBLAST_API void NvBlastFamilySetAsset(NvBlastFamily* family, const NvBlastAsset* asset, NvBlastLog logFn);
464 
465 
474 NVBLAST_API uint32_t NvBlastFamilyGetSize(const NvBlastFamily* family, NvBlastLog logFn);
475 
476 
486 
487 
497 
498 
510 
511 
520 NVBLAST_API uint32_t NvBlastFamilyGetActorCount(const NvBlastFamily* family, NvBlastLog logFn);
521 
522 
535 
536 
547 NVBLAST_API uint32_t NvBlastFamilyGetActors(NvBlastActor** actors, uint32_t actorsSize, const NvBlastFamily* family, NvBlastLog logFn);
548 
549 
559 NVBLAST_API NvBlastActor* NvBlastFamilyGetChunkActor(const NvBlastFamily* family, uint32_t chunkIndex, NvBlastLog logFn);
560 
561 
571 
573 
574 
576 // NvBlastActor accessor, serialization, and deactivation functions
579 
589 
590 
601 NVBLAST_API uint32_t NvBlastActorGetVisibleChunkIndices(uint32_t* visibleChunkIndices, uint32_t visibleChunkIndicesSize, const NvBlastActor* actor, NvBlastLog logFn);
602 
603 
613 
614 
625 NVBLAST_API uint32_t NvBlastActorGetGraphNodeIndices(uint32_t* graphNodeIndices, uint32_t graphNodeIndicesSize, const NvBlastActor* actor, NvBlastLog logFn);
626 
627 
648 NVBLAST_API const float* NvBlastActorGetBondHealths(const NvBlastActor* actor, NvBlastLog logFn);
649 
650 
661 
662 
673 NVBLAST_API uint32_t NvBlastActorSerialize(void* buffer, uint32_t bufferSize, const NvBlastActor* actor, NvBlastLog logFn);
674 
675 
685 
686 
695 NVBLAST_API uint32_t NvBlastActorGetIndex(const NvBlastActor* actor, NvBlastLog logFn);
696 
697 
707 
709 
710 
712 // NvBlastActor damage and fracturing functions
715 
739 (
740  NvBlastFractureBuffers* commandBuffers,
741  const NvBlastActor* actor,
742  const NvBlastDamageProgram program,
743  const void* programParams,
744  NvBlastLog logFn,
745  NvBlastTimers* timers
746 );
747 
748 
780 (
781  NvBlastFractureBuffers* eventBuffers,
782  NvBlastActor* actor,
783  const NvBlastFractureBuffers* commands,
784  NvBlastLog logFn,
785  NvBlastTimers* timers
786 );
787 
788 
803 (
804  NvBlastActorSplitEvent* result,
805  NvBlastActor* actor,
806  uint32_t newActorsMaxCount,
807  void* scratch,
808  NvBlastLog logFn,
809  NvBlastTimers* timers
810 );
811 
812 
823 
824 
835 
836 
846 
847 
858 
859 
864 
866 
867 
869 // NvBlastTimers functions and helpers
872 
879 
880 
888 NVBLAST_API double NvBlastTicksToSeconds(int64_t ticks);
889 
891 
892 
893 #endif // ifndef NVBLAST_H
NVBLAST_API uint32_t NvBlastFamilyGetSize(const NvBlastFamily *family, NvBlastLog logFn)
NVBLAST_API bool NvBlastReorderAssetDescChunks(NvBlastChunkDesc *chunkDescs, uint32_t chunkCount, NvBlastBondDesc *bondDescs, uint32_t bondCount, uint32_t *chunkReorderMap, bool keepBondNormalChunkOrder, void *scratch, NvBlastLog logFn)
NVBLAST_API uint32_t NvBlastAssetGetFormatVersion(const NvBlastAsset *asset, NvBlastLog logFn)
Definition: NvBlastTypes.h:244
diff --git a/docs/source_docs/files/_nv_blast_actor_8h_source.html b/docs/source_docs/files/_nv_blast_actor_8h_source.html index 339d3a7..e56a136 100755 --- a/docs/source_docs/files/_nv_blast_actor_8h_source.html +++ b/docs/source_docs/files/_nv_blast_actor_8h_source.html @@ -46,7 +46,7 @@ $(document).ready(function(){initNavTree('_nv_blast_actor_8h_source.html','');})
NvBlastActor.h
-Go to the documentation of this file.
1 // This code contains NVIDIA Confidential Information and is disclosed to you
2 // under a form of NVIDIA software license agreement provided separately to you.
3 //
4 // Notice
5 // NVIDIA Corporation and its licensors retain all intellectual property and
6 // proprietary rights in and to this software and related documentation and
7 // any modifications thereto. Any use, reproduction, disclosure, or
8 // distribution of this software and related documentation without an express
9 // license agreement from NVIDIA Corporation is strictly prohibited.
10 //
11 // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12 // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15 //
16 // Information and code furnished is believed to be accurate and reliable.
17 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18 // information or for any infringement of patents or other rights of third parties that may
19 // result from its use. No license is granted by implication or otherwise under any patent
20 // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21 // This code supersedes and replaces all information previously supplied.
22 // NVIDIA Corporation products are not authorized for use as critical
23 // components in life support devices or systems without express written approval of
24 // NVIDIA Corporation.
25 //
26 // Copyright (c) 2016-2018 NVIDIA Corporation. All rights reserved.
27 
28 
29 #ifndef NVBLASTACTOR_H
30 #define NVBLASTACTOR_H
31 
32 
33 #include "NvBlastAsset.h"
34 #include "NvBlastDLink.h"
35 #include "NvBlastIteratorBase.h"
36 #include "NvBlastSupportGraph.h"
37 #include "NvBlastFamilyGraph.h"
39 
40 #include <cstring>
41 
42 
43 namespace Nv
44 {
45 namespace Blast
46 {
47 
48 // Forward declarations
49 class FamilyGraph;
50 struct FamilyHeader;
51 
58 class Actor : public NvBlastActor
59 {
60  friend struct FamilyHeader;
61 
62  friend void updateVisibleChunksFromSupportChunk<>(Actor*, IndexDLink<uint32_t>*, uint32_t*, uint32_t, uint32_t, const NvBlastChunk*, uint32_t);
63 
64 public:
65  Actor() : m_familyOffset(0), m_firstVisibleChunkIndex(UINT32_MAX), m_visibleChunkCount(0), m_firstGraphNodeIndex(UINT32_MAX), m_graphNodeCount(0), m_leafChunkCount(0) {}
66 
68 
75 
81  const Asset* getAsset() const;
82 
90  bool isActive() const;
91 
97  bool isSubSupportChunk() const;
98 
105  bool isSingleSupportChunk() const;
106 
112  uint32_t getIndex() const;
113 
120  uint32_t getVisibleChunkCount() const;
121 
127  uint32_t getFirstVisibleChunkIndex() const;
128 
135  uint32_t getGraphNodeCount() const;
136 
142  uint32_t getLeafChunkCount() const;
143 
149  uint32_t getFirstGraphNodeIndex() const;
150 
156  uint32_t getFirstSubsupportChunkIndex() const;
157 
163  const SupportGraph* getGraph() const;
164 
171  FamilyGraph* getFamilyGraph() const;
172 
178  NvBlastChunk* getChunks() const;
179 
185  NvBlastBond* getBonds() const;
186 
194  float* getLowerSupportChunkHealths() const;
195 
201  float* getSubsupportChunkHealths() const;
202 
208  float* getBondHealths() const;
209 
215  const uint32_t* getGraphNodeIndexLinks() const;
216 
217 
219 
233  class VisibleChunkIt : public DListIt<uint32_t>
234  {
235  public:
237  VisibleChunkIt(const Actor& actor);
238  };
239 
253  class GraphNodeIt : public LListIt<uint32_t>
254  {
255  public:
257  GraphNodeIt(const Actor& actor);
258  };
259 
260 
262 
275  static Actor* create(NvBlastFamily* family, const NvBlastActorDesc* desc, void* scratch, NvBlastLog logFn);
276 
285  static size_t createRequiredScratch(const NvBlastFamily* family);
286 
298  static Actor* deserialize(NvBlastFamily* family, const void* buffer, NvBlastLog logFn);
299 
309  uint32_t serialize(void* buffer, uint32_t bufferSize, NvBlastLog logFn) const;
310 
318  uint32_t serializationRequiredStorage(NvBlastLog logFn) const;
319 
326  bool release();
327 
328 
330 
334  void generateFracture(NvBlastFractureBuffers* commandBuffers, const NvBlastDamageProgram& program, const void* programParams, NvBlastLog logFn, NvBlastTimers* timers) const;
335 
339  uint32_t damageBond(uint32_t nodeIndex0, uint32_t nodeIndex1, float healthDamage);
340 
344  void damageBond(uint32_t nodeIndex0, uint32_t nodeIndex1, uint32_t bondIndex, float healthDamage);
345 
349  uint32_t damageBond(const NvBlastBondFractureData& cmd);
350 
354  void applyFracture(NvBlastFractureBuffers* eventBuffers, const NvBlastFractureBuffers* commands, NvBlastLog logFn, NvBlastTimers* timers);
355 
361  size_t splitRequiredScratch() const;
362 
366  uint32_t split(NvBlastActorSplitEvent* result, uint32_t newActorsMaxCount, void* scratch, NvBlastLog logFn, NvBlastTimers* timers);
367 
377  uint32_t findIslands(void* scratch);
378 
395  uint32_t partition(Actor** newActors, uint32_t newActorsSize, NvBlastLog logFn);
396 
401 
416  uint32_t partitionSingleLowerSupportChunk(Actor** newActors, uint32_t newActorsSize, NvBlastLog logFn);
417 
432  uint32_t partitionMultipleGraphNodes(Actor** newActors, uint32_t newActorsSize, NvBlastLog logFn);
433 
437  bool isBoundToWorld() const;
438 
442  bool isSplitRequired() const;
443 
444 private:
445 
447 
455  uint32_t m_familyOffset;
456 
461  uint32_t m_firstVisibleChunkIndex;
462 
466  uint32_t m_visibleChunkCount;
467 
472  uint32_t m_firstGraphNodeIndex;
473 
477  uint32_t m_graphNodeCount;
478 
482  uint32_t m_leafChunkCount;
483 };
484 
485 } // namespace Blast
486 } // namespace Nv
487 
488 
489 #include "NvBlastFamily.h"
490 
491 
492 namespace Nv
493 {
494 namespace Blast
495 {
496 
498 
500 {
502  return (FamilyHeader*)((uintptr_t)this - (uintptr_t)m_familyOffset);
503 }
504 
505 
507 {
508  return getFamilyHeader()->m_asset;
509 }
510 
511 
513 {
514  return m_familyOffset != 0;
515 }
516 
517 
519 {
520  return m_graphNodeCount == 0;
521 }
522 
523 
525 {
526  return m_graphNodeCount == 1;
527 }
528 
529 
530 NV_INLINE uint32_t Actor::getIndex() const
531 {
533  const FamilyHeader* header = getFamilyHeader();
534  NVBLAST_ASSERT(header != nullptr);
535  const size_t index = this - header->getActors();
536  NVBLAST_ASSERT(index <= UINT32_MAX);
537  return (uint32_t)index;
538 }
539 
540 
542 {
543  return m_visibleChunkCount;
544 }
545 
546 
548 {
549  return m_firstVisibleChunkIndex;
550 }
551 
552 
554 {
555  return m_graphNodeCount;
556 }
557 
558 
560 {
561  return m_leafChunkCount;
562 }
563 
564 
566 {
567  return m_firstGraphNodeIndex;
568 }
569 
571 {
573 }
574 
576 {
577  return &getAsset()->m_graph;
578 }
579 
581 {
582  return getFamilyHeader()->getFamilyGraph();
583 }
584 
586 {
587  return getAsset()->getChunks();
588 }
589 
591 {
592  return getAsset()->getBonds();
593 }
594 
596 {
597  return getFamilyHeader()->getLowerSupportChunkHealths();
598 }
599 
601 {
603 }
604 
606 {
607  return getFamilyHeader()->getBondHealths();
608 }
609 
611 {
612  return getFamilyHeader()->getGraphNodeIndexLinks();
613 }
614 
615 
617 {
618  // Do nothing if this actor is not currently active.
619  if (!isActive())
620  {
621  return false;
622  }
623 
624  FamilyHeader* header = getFamilyHeader();
625 
626  // Clear the graph node list
627  uint32_t* graphNodeIndexLinks = getFamilyHeader()->getGraphNodeIndexLinks();
628  while (!isInvalidIndex(m_firstGraphNodeIndex))
629  {
630  const uint32_t graphNodeIndex = m_firstGraphNodeIndex;
631  m_firstGraphNodeIndex = graphNodeIndexLinks[m_firstGraphNodeIndex];
632  graphNodeIndexLinks[graphNodeIndex] = invalidIndex<uint32_t>();
633  --m_graphNodeCount;
634  }
635  NVBLAST_ASSERT(m_graphNodeCount == 0);
636 
637  const Asset* asset = getAsset();
638 
639  // Clear the visible chunk list
640  IndexDLink<uint32_t>* visibleChunkIndexLinks = header->getVisibleChunkIndexLinks();
641  uint32_t* chunkActorIndices = header->getChunkActorIndices();
642  while (!isInvalidIndex(m_firstVisibleChunkIndex))
643  {
644  // Descendants of the visible actor may be accessed again if the actor is deserialized. Clear subtree.
645  for (Asset::DepthFirstIt i(*asset, m_firstVisibleChunkIndex, true); (bool)i; ++i)
646  {
647  chunkActorIndices[(uint32_t)i] = invalidIndex<uint32_t>();
648  }
649  IndexDList<uint32_t>().removeListHead(m_firstVisibleChunkIndex, visibleChunkIndexLinks);
650  --m_visibleChunkCount;
651  }
652  NVBLAST_ASSERT(m_visibleChunkCount == 0);
653 
654  // Clear the leaf chunk count
655  m_leafChunkCount = 0;
656 
657  // This invalidates the actor and decrements the reference count
658  header->returnActor(*this);
659 
660  return true;
661 }
662 
663 
664 NV_INLINE uint32_t Actor::partition(Actor** newActors, uint32_t newActorsSize, NvBlastLog logFn)
665 {
666  NVBLASTLL_CHECK(newActorsSize == 0 || newActors != nullptr, logFn, "Nv::Blast::Actor::partition: NULL newActors pointer array input with non-zero newActorCount.", return 0);
667 
668  // Call one of two partition functions depending on the actor's support status
669  return m_graphNodeCount <= 1 ?
670  partitionSingleLowerSupportChunk(newActors, newActorsSize, logFn) : // This actor will partition into subsupport chunks
671  partitionMultipleGraphNodes(newActors, newActorsSize, logFn); // This actor will partition into support chunks
672 }
673 
674 
676 {
677  const SupportGraph& graph = *getGraph();
678 
679  if (graph.m_nodeCount == 0)
680  {
681  return false; // This shouldn't happen
682  }
683 
684  const uint32_t lastGraphChunkIndex = graph.getChunkIndices()[graph.m_nodeCount - 1];
685 
686  if (!isInvalidIndex(lastGraphChunkIndex))
687  {
688  return false; // There is no world node
689  }
690 
691  return getFamilyGraph()->getIslandIds()[graph.m_nodeCount - 1] == getIndex();
692 }
693 
694 
696 {
698 
699  if (getGraphNodeCount() <= 1)
700  {
702  float* chunkHealths = getLowerSupportChunkHealths();
703  if (chunkHealths[chunkHealthIndex] <= 0.0f)
704  {
705  const uint32_t chunkIndex = m_graphNodeCount == 0 ? m_firstVisibleChunkIndex : getGraph()->getChunkIndices()[m_firstGraphNodeIndex];
706  if (!isInvalidIndex(chunkIndex))
707  {
708  const NvBlastChunk& chunk = getChunks()[chunkIndex];
709  uint32_t childCount = chunk.childIndexStop - chunk.firstChildIndex;
710  return childCount > 0;
711  }
712  }
713  }
714  else
715  {
716  uint32_t* firstDirtyNodeIndices = getFamilyGraph()->getFirstDirtyNodeIndices();
717  if (!isInvalidIndex(firstDirtyNodeIndices[getIndex()]))
718  {
719  return true;
720  }
721 
722  }
723  return false;
724 }
725 
726 
728 
729 NV_INLINE Actor::VisibleChunkIt::VisibleChunkIt(const Actor& actor) : DListIt<uint32_t>(actor.m_firstVisibleChunkIndex, actor.getFamilyHeader()->getVisibleChunkIndexLinks())
730 {
731 }
732 
733 
735 
736 NV_INLINE Actor::GraphNodeIt::GraphNodeIt(const Actor& actor) : LListIt<uint32_t>(actor.m_firstGraphNodeIndex, actor.getFamilyHeader()->getGraphNodeIndexLinks())
737 {
738 }
739 
740 
742 
743 #if NVBLASTLL_CHECK_PARAMS
744 
747 static inline bool isValid(const NvBlastFractureBuffers* buffers)
748 {
749  if (buffers->chunkFractureCount != 0 && buffers->chunkFractures == nullptr)
750  return false;
751 
752  if (buffers->bondFractureCount != 0 && buffers->bondFractures == nullptr)
753  return false;
754 
755  return true;
756 }
757 #endif
758 
759 
760 } // namespace Blast
761 } // namespace Nv
762 
763 
764 #endif // ifndef NVBLASTACTOR_H
uint32_t getFirstSubsupportChunkIndex() const
Definition: NvBlastActor.h:570
+Go to the documentation of this file.
1 // This code contains NVIDIA Confidential Information and is disclosed to you
2 // under a form of NVIDIA software license agreement provided separately to you.
3 //
4 // Notice
5 // NVIDIA Corporation and its licensors retain all intellectual property and
6 // proprietary rights in and to this software and related documentation and
7 // any modifications thereto. Any use, reproduction, disclosure, or
8 // distribution of this software and related documentation without an express
9 // license agreement from NVIDIA Corporation is strictly prohibited.
10 //
11 // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12 // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15 //
16 // Information and code furnished is believed to be accurate and reliable.
17 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18 // information or for any infringement of patents or other rights of third parties that may
19 // result from its use. No license is granted by implication or otherwise under any patent
20 // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21 // This code supersedes and replaces all information previously supplied.
22 // NVIDIA Corporation products are not authorized for use as critical
23 // components in life support devices or systems without express written approval of
24 // NVIDIA Corporation.
25 //
26 // Copyright (c) 2016-2020 NVIDIA Corporation. All rights reserved.
27 
28 
29 #ifndef NVBLASTACTOR_H
30 #define NVBLASTACTOR_H
31 
32 
33 #include "NvBlastAsset.h"
34 #include "NvBlastDLink.h"
35 #include "NvBlastIteratorBase.h"
36 #include "NvBlastSupportGraph.h"
37 #include "NvBlastFamilyGraph.h"
39 
40 #include <cstring>
41 
42 
43 namespace Nv
44 {
45 namespace Blast
46 {
47 
48 // Forward declarations
49 class FamilyGraph;
50 struct FamilyHeader;
51 
58 class Actor : public NvBlastActor
59 {
60  friend struct FamilyHeader;
61 
62  friend void updateVisibleChunksFromSupportChunk<>(Actor*, IndexDLink<uint32_t>*, uint32_t*, uint32_t, uint32_t, const NvBlastChunk*, uint32_t);
63 
64 public:
65  Actor() : m_familyOffset(0), m_firstVisibleChunkIndex(UINT32_MAX), m_visibleChunkCount(0), m_firstGraphNodeIndex(UINT32_MAX), m_graphNodeCount(0), m_leafChunkCount(0) {}
66 
68 
75 
81  const Asset* getAsset() const;
82 
90  bool isActive() const;
91 
97  bool isSubSupportChunk() const;
98 
105  bool isSingleSupportChunk() const;
106 
112  uint32_t getIndex() const;
113 
120  uint32_t getVisibleChunkCount() const;
121 
127  uint32_t getFirstVisibleChunkIndex() const;
128 
135  uint32_t getGraphNodeCount() const;
136 
142  uint32_t getLeafChunkCount() const;
143 
149  uint32_t getFirstGraphNodeIndex() const;
150 
156  uint32_t getFirstSubsupportChunkIndex() const;
157 
163  const SupportGraph* getGraph() const;
164 
171  FamilyGraph* getFamilyGraph() const;
172 
178  NvBlastChunk* getChunks() const;
179 
185  NvBlastBond* getBonds() const;
186 
194  float* getLowerSupportChunkHealths() const;
195 
201  float* getSubsupportChunkHealths() const;
202 
208  float* getBondHealths() const;
209 
215  const uint32_t* getGraphNodeIndexLinks() const;
216 
217 
219 
233  class VisibleChunkIt : public DListIt<uint32_t>
234  {
235  public:
237  VisibleChunkIt(const Actor& actor);
238  };
239 
253  class GraphNodeIt : public LListIt<uint32_t>
254  {
255  public:
257  GraphNodeIt(const Actor& actor);
258  };
259 
260 
262 
275  static Actor* create(NvBlastFamily* family, const NvBlastActorDesc* desc, void* scratch, NvBlastLog logFn);
276 
285  static size_t createRequiredScratch(const NvBlastFamily* family);
286 
298  static Actor* deserialize(NvBlastFamily* family, const void* buffer, NvBlastLog logFn);
299 
309  uint32_t serialize(void* buffer, uint32_t bufferSize, NvBlastLog logFn) const;
310 
318  uint32_t serializationRequiredStorage(NvBlastLog logFn) const;
319 
326  bool release();
327 
328 
330 
334  void generateFracture(NvBlastFractureBuffers* commandBuffers, const NvBlastDamageProgram& program, const void* programParams, NvBlastLog logFn, NvBlastTimers* timers) const;
335 
339  uint32_t damageBond(uint32_t nodeIndex0, uint32_t nodeIndex1, float healthDamage);
340 
344  void damageBond(uint32_t nodeIndex0, uint32_t nodeIndex1, uint32_t bondIndex, float healthDamage);
345 
349  uint32_t damageBond(const NvBlastBondFractureData& cmd);
350 
354  void applyFracture(NvBlastFractureBuffers* eventBuffers, const NvBlastFractureBuffers* commands, NvBlastLog logFn, NvBlastTimers* timers);
355 
361  size_t splitRequiredScratch() const;
362 
366  uint32_t split(NvBlastActorSplitEvent* result, uint32_t newActorsMaxCount, void* scratch, NvBlastLog logFn, NvBlastTimers* timers);
367 
377  uint32_t findIslands(void* scratch);
378 
395  uint32_t partition(Actor** newActors, uint32_t newActorsSize, NvBlastLog logFn);
396 
401 
416  uint32_t partitionSingleLowerSupportChunk(Actor** newActors, uint32_t newActorsSize, NvBlastLog logFn);
417 
432  uint32_t partitionMultipleGraphNodes(Actor** newActors, uint32_t newActorsSize, NvBlastLog logFn);
433 
437  bool isBoundToWorld() const;
438 
442  bool isSplitRequired() const;
443 
444 private:
445 
447 
455  uint32_t m_familyOffset;
456 
461  uint32_t m_firstVisibleChunkIndex;
462 
466  uint32_t m_visibleChunkCount;
467 
472  uint32_t m_firstGraphNodeIndex;
473 
477  uint32_t m_graphNodeCount;
478 
482  uint32_t m_leafChunkCount;
483 };
484 
485 } // namespace Blast
486 } // namespace Nv
487 
488 
489 #include "NvBlastFamily.h"
490 
491 
492 namespace Nv
493 {
494 namespace Blast
495 {
496 
498 
500 {
502  return (FamilyHeader*)((uintptr_t)this - (uintptr_t)m_familyOffset);
503 }
504 
505 
507 {
508  return getFamilyHeader()->m_asset;
509 }
510 
511 
513 {
514  return m_familyOffset != 0;
515 }
516 
517 
519 {
520  return m_graphNodeCount == 0;
521 }
522 
523 
525 {
526  return m_graphNodeCount == 1;
527 }
528 
529 
530 NV_INLINE uint32_t Actor::getIndex() const
531 {
533  const FamilyHeader* header = getFamilyHeader();
534  NVBLAST_ASSERT(header != nullptr);
535  const size_t index = this - header->getActors();
536  NVBLAST_ASSERT(index <= UINT32_MAX);
537  return (uint32_t)index;
538 }
539 
540 
542 {
543  return m_visibleChunkCount;
544 }
545 
546 
548 {
549  return m_firstVisibleChunkIndex;
550 }
551 
552 
554 {
555  return m_graphNodeCount;
556 }
557 
558 
560 {
561  return m_leafChunkCount;
562 }
563 
564 
566 {
567  return m_firstGraphNodeIndex;
568 }
569 
571 {
573 }
574 
576 {
577  return &getAsset()->m_graph;
578 }
579 
581 {
582  return getFamilyHeader()->getFamilyGraph();
583 }
584 
586 {
587  return getAsset()->getChunks();
588 }
589 
591 {
592  return getAsset()->getBonds();
593 }
594 
596 {
597  return getFamilyHeader()->getLowerSupportChunkHealths();
598 }
599 
601 {
603 }
604 
606 {
607  return getFamilyHeader()->getBondHealths();
608 }
609 
611 {
612  return getFamilyHeader()->getGraphNodeIndexLinks();
613 }
614 
615 
617 {
618  // Do nothing if this actor is not currently active.
619  if (!isActive())
620  {
621  return false;
622  }
623 
624  FamilyHeader* header = getFamilyHeader();
625 
626  // Clear the graph node list
627  uint32_t* graphNodeIndexLinks = getFamilyHeader()->getGraphNodeIndexLinks();
628  while (!isInvalidIndex(m_firstGraphNodeIndex))
629  {
630  const uint32_t graphNodeIndex = m_firstGraphNodeIndex;
631  m_firstGraphNodeIndex = graphNodeIndexLinks[m_firstGraphNodeIndex];
632  graphNodeIndexLinks[graphNodeIndex] = invalidIndex<uint32_t>();
633  --m_graphNodeCount;
634  }
635  NVBLAST_ASSERT(m_graphNodeCount == 0);
636 
637  const Asset* asset = getAsset();
638 
639  // Clear the visible chunk list
640  IndexDLink<uint32_t>* visibleChunkIndexLinks = header->getVisibleChunkIndexLinks();
641  uint32_t* chunkActorIndices = header->getChunkActorIndices();
642  while (!isInvalidIndex(m_firstVisibleChunkIndex))
643  {
644  // Descendants of the visible actor may be accessed again if the actor is deserialized. Clear subtree.
645  for (Asset::DepthFirstIt i(*asset, m_firstVisibleChunkIndex, true); (bool)i; ++i)
646  {
647  chunkActorIndices[(uint32_t)i] = invalidIndex<uint32_t>();
648  }
649  IndexDList<uint32_t>().removeListHead(m_firstVisibleChunkIndex, visibleChunkIndexLinks);
650  --m_visibleChunkCount;
651  }
652  NVBLAST_ASSERT(m_visibleChunkCount == 0);
653 
654  // Clear the leaf chunk count
655  m_leafChunkCount = 0;
656 
657  // This invalidates the actor and decrements the reference count
658  header->returnActor(*this);
659 
660  return true;
661 }
662 
663 
664 NV_INLINE uint32_t Actor::partition(Actor** newActors, uint32_t newActorsSize, NvBlastLog logFn)
665 {
666  NVBLASTLL_CHECK(newActorsSize == 0 || newActors != nullptr, logFn, "Nv::Blast::Actor::partition: NULL newActors pointer array input with non-zero newActorCount.", return 0);
667 
668  // Call one of two partition functions depending on the actor's support status
669  return m_graphNodeCount <= 1 ?
670  partitionSingleLowerSupportChunk(newActors, newActorsSize, logFn) : // This actor will partition into subsupport chunks
671  partitionMultipleGraphNodes(newActors, newActorsSize, logFn); // This actor will partition into support chunks
672 }
673 
674 
676 {
677  const SupportGraph& graph = *getGraph();
678 
679  if (graph.m_nodeCount == 0)
680  {
681  return false; // This shouldn't happen
682  }
683 
684  const uint32_t lastGraphChunkIndex = graph.getChunkIndices()[graph.m_nodeCount - 1];
685 
686  if (!isInvalidIndex(lastGraphChunkIndex))
687  {
688  return false; // There is no world node
689  }
690 
691  return getFamilyGraph()->getIslandIds()[graph.m_nodeCount - 1] == getIndex();
692 }
693 
694 
696 {
698 
699  if (getGraphNodeCount() <= 1)
700  {
702  float* chunkHealths = getLowerSupportChunkHealths();
703  if (chunkHealths[chunkHealthIndex] <= 0.0f)
704  {
705  const uint32_t chunkIndex = m_graphNodeCount == 0 ? m_firstVisibleChunkIndex : getGraph()->getChunkIndices()[m_firstGraphNodeIndex];
706  if (!isInvalidIndex(chunkIndex))
707  {
708  const NvBlastChunk& chunk = getChunks()[chunkIndex];
709  uint32_t childCount = chunk.childIndexStop - chunk.firstChildIndex;
710  return childCount > 0;
711  }
712  }
713  }
714  else
715  {
716  uint32_t* firstDirtyNodeIndices = getFamilyGraph()->getFirstDirtyNodeIndices();
717  if (!isInvalidIndex(firstDirtyNodeIndices[getIndex()]))
718  {
719  return true;
720  }
721 
722  }
723  return false;
724 }
725 
726 
728 
729 NV_INLINE Actor::VisibleChunkIt::VisibleChunkIt(const Actor& actor) : DListIt<uint32_t>(actor.m_firstVisibleChunkIndex, actor.getFamilyHeader()->getVisibleChunkIndexLinks())
730 {
731 }
732 
733 
735 
736 NV_INLINE Actor::GraphNodeIt::GraphNodeIt(const Actor& actor) : LListIt<uint32_t>(actor.m_firstGraphNodeIndex, actor.getFamilyHeader()->getGraphNodeIndexLinks())
737 {
738 }
739 
740 
742 
743 #if NVBLASTLL_CHECK_PARAMS
744 
747 static inline bool isValid(const NvBlastFractureBuffers* buffers)
748 {
749  if (buffers->chunkFractureCount != 0 && buffers->chunkFractures == nullptr)
750  return false;
751 
752  if (buffers->bondFractureCount != 0 && buffers->bondFractures == nullptr)
753  return false;
754 
755  return true;
756 }
757 #endif
758 
759 
760 } // namespace Blast
761 } // namespace Nv
762 
763 
764 #endif // ifndef NVBLASTACTOR_H
uint32_t getFirstSubsupportChunkIndex() const
Definition: NvBlastActor.h:570
void applyFracture(NvBlastFractureBuffers *eventBuffers, const NvBlastFractureBuffers *commands, NvBlastLog logFn, NvBlastTimers *timers)
Definition: NvBlastTypes.h:395
diff --git a/docs/source_docs/files/_nv_blast_actor_serialization_block_8h_source.html b/docs/source_docs/files/_nv_blast_actor_serialization_block_8h_source.html index 778c492..9728113 100755 --- a/docs/source_docs/files/_nv_blast_actor_serialization_block_8h_source.html +++ b/docs/source_docs/files/_nv_blast_actor_serialization_block_8h_source.html @@ -46,7 +46,7 @@ $(document).ready(function(){initNavTree('_nv_blast_actor_serialization_block_8h
NvBlastActorSerializationBlock.h
-Go to the documentation of this file.
1 // This code contains NVIDIA Confidential Information and is disclosed to you
2 // under a form of NVIDIA software license agreement provided separately to you.
3 //
4 // Notice
5 // NVIDIA Corporation and its licensors retain all intellectual property and
6 // proprietary rights in and to this software and related documentation and
7 // any modifications thereto. Any use, reproduction, disclosure, or
8 // distribution of this software and related documentation without an express
9 // license agreement from NVIDIA Corporation is strictly prohibited.
10 //
11 // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12 // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15 //
16 // Information and code furnished is believed to be accurate and reliable.
17 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18 // information or for any infringement of patents or other rights of third parties that may
19 // result from its use. No license is granted by implication or otherwise under any patent
20 // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21 // This code supersedes and replaces all information previously supplied.
22 // NVIDIA Corporation products are not authorized for use as critical
23 // components in life support devices or systems without express written approval of
24 // NVIDIA Corporation.
25 //
26 // Copyright (c) 2016-2018 NVIDIA Corporation. All rights reserved.
27 
28 
29 #ifndef NVBLASTACTORSERIALIZATIONBLOCK_H
30 #define NVBLASTACTORSERIALIZATIONBLOCK_H
31 
32 
33 #include "NvBlastFixedBoolArray.h"
34 
35 
36 namespace Nv
37 {
38 namespace Blast
39 {
40 
45 {
46  enum Version
47  {
50 
51  // New formats must come before Count. They should be given descriptive names with more information in comments.
52 
55 
57  Current = Count - 1
58  };
59 };
60 
61 
70 {
74  uint32_t m_formatVersion;
75 
81  uint32_t m_size;
82 
86  uint32_t m_index;
87 
92 
96  uint32_t m_graphNodeCount;
97 
102 
106  NvBlastBlockArrayData(uint32_t, m_visibleChunkIndicesOffset, getVisibleChunkIndices, m_visibleChunkCount);
107 
111  NvBlastBlockArrayData(uint32_t, m_graphNodeIndicesOffset, getGraphNodeIndices, m_graphNodeCount);
112 
116  NvBlastBlockData(float, m_lowerSupportChunkHealthsOffset, getLowerSupportChunkHealths);
117 
121  NvBlastBlockData(float, m_bondHealthsOffset, getBondHealths);
122 
126  NvBlastBlockArrayData(uint32_t, m_fastRouteOffset, getFastRoute, m_graphNodeCount);
127 
131  NvBlastBlockArrayData(uint32_t, m_hopCountsOffset, getHopCounts, m_graphNodeCount);
132 
136  NvBlastBlockData(FixedBoolArray, m_edgeRemovedArrayOffset, getEdgeRemovedArray);
137 };
138 
139 
141 
152 NV_INLINE size_t getActorSerializationSize(uint32_t visibleChunkCount, uint32_t lowerSupportChunkCount, uint32_t graphNodeCount, uint32_t bondCount)
153 {
154  // Family offsets
155  const size_t visibleChunkIndicesOffset = align16(sizeof(ActorSerializationHeader)); // size = visibleChunkCount*sizeof(uint32_t)
156  const size_t graphNodeIndicesOffset = align16(visibleChunkIndicesOffset + visibleChunkCount*sizeof(uint32_t)); // size = graphNodeCount*sizeof(uint32_t)
157  const size_t lowerSupportHealthsOffset = align16(graphNodeIndicesOffset + graphNodeCount*sizeof(uint32_t)); // size = lowerSupportChunkCount*sizeof(float)
158  const size_t bondHealthsOffset = align16(lowerSupportHealthsOffset + lowerSupportChunkCount*sizeof(float)); // size = bondCount*sizeof(float)
159  const size_t fastRouteOffset = align16(bondHealthsOffset + bondCount*sizeof(float)); // size = graphNodeCount*sizeof(uint32_t)
160  const size_t hopCountsOffset = align16(fastRouteOffset + graphNodeCount*sizeof(uint32_t)); // size = graphNodeCount*sizeof(uint32_t)
161  const size_t edgeRemovedArrayOffset = align16(hopCountsOffset + graphNodeCount*sizeof(uint32_t)); // size = 0 or FixedBoolArray::requiredMemorySize(bondCount)
162  return align16(edgeRemovedArrayOffset + (bondCount == 0 ? 0 : FixedBoolArray::requiredMemorySize(bondCount)));
163 }
164 
165 } // namespace Blast
166 } // namespace Nv
167 
168 
169 #endif // ifndef NVBLASTACTORSERIALIZATIONBLOCK_H
Version
Definition: NvBlastActorSerializationBlock.h:46
+Go to the documentation of this file.
1 // This code contains NVIDIA Confidential Information and is disclosed to you
2 // under a form of NVIDIA software license agreement provided separately to you.
3 //
4 // Notice
5 // NVIDIA Corporation and its licensors retain all intellectual property and
6 // proprietary rights in and to this software and related documentation and
7 // any modifications thereto. Any use, reproduction, disclosure, or
8 // distribution of this software and related documentation without an express
9 // license agreement from NVIDIA Corporation is strictly prohibited.
10 //
11 // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12 // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15 //
16 // Information and code furnished is believed to be accurate and reliable.
17 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18 // information or for any infringement of patents or other rights of third parties that may
19 // result from its use. No license is granted by implication or otherwise under any patent
20 // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21 // This code supersedes and replaces all information previously supplied.
22 // NVIDIA Corporation products are not authorized for use as critical
23 // components in life support devices or systems without express written approval of
24 // NVIDIA Corporation.
25 //
26 // Copyright (c) 2016-2020 NVIDIA Corporation. All rights reserved.
27 
28 
29 #ifndef NVBLASTACTORSERIALIZATIONBLOCK_H
30 #define NVBLASTACTORSERIALIZATIONBLOCK_H
31 
32 
33 #include "NvBlastFixedBoolArray.h"
34 
35 
36 namespace Nv
37 {
38 namespace Blast
39 {
40 
45 {
46  enum Version
47  {
50 
51  // New formats must come before Count. They should be given descriptive names with more information in comments.
52 
55 
57  Current = Count - 1
58  };
59 };
60 
61 
70 {
74  uint32_t m_formatVersion;
75 
81  uint32_t m_size;
82 
86  uint32_t m_index;
87 
92 
96  uint32_t m_graphNodeCount;
97 
102 
106  NvBlastBlockArrayData(uint32_t, m_visibleChunkIndicesOffset, getVisibleChunkIndices, m_visibleChunkCount);
107 
111  NvBlastBlockArrayData(uint32_t, m_graphNodeIndicesOffset, getGraphNodeIndices, m_graphNodeCount);
112 
116  NvBlastBlockData(float, m_lowerSupportChunkHealthsOffset, getLowerSupportChunkHealths);
117 
121  NvBlastBlockData(float, m_bondHealthsOffset, getBondHealths);
122 
126  NvBlastBlockArrayData(uint32_t, m_fastRouteOffset, getFastRoute, m_graphNodeCount);
127 
131  NvBlastBlockArrayData(uint32_t, m_hopCountsOffset, getHopCounts, m_graphNodeCount);
132 
136  NvBlastBlockData(FixedBoolArray, m_edgeRemovedArrayOffset, getEdgeRemovedArray);
137 };
138 
139 
141 
152 NV_INLINE size_t getActorSerializationSize(uint32_t visibleChunkCount, uint32_t lowerSupportChunkCount, uint32_t graphNodeCount, uint32_t bondCount)
153 {
154  // Family offsets
155  const size_t visibleChunkIndicesOffset = align16(sizeof(ActorSerializationHeader)); // size = visibleChunkCount*sizeof(uint32_t)
156  const size_t graphNodeIndicesOffset = align16(visibleChunkIndicesOffset + visibleChunkCount*sizeof(uint32_t)); // size = graphNodeCount*sizeof(uint32_t)
157  const size_t lowerSupportHealthsOffset = align16(graphNodeIndicesOffset + graphNodeCount*sizeof(uint32_t)); // size = lowerSupportChunkCount*sizeof(float)
158  const size_t bondHealthsOffset = align16(lowerSupportHealthsOffset + lowerSupportChunkCount*sizeof(float)); // size = bondCount*sizeof(float)
159  const size_t fastRouteOffset = align16(bondHealthsOffset + bondCount*sizeof(float)); // size = graphNodeCount*sizeof(uint32_t)
160  const size_t hopCountsOffset = align16(fastRouteOffset + graphNodeCount*sizeof(uint32_t)); // size = graphNodeCount*sizeof(uint32_t)
161  const size_t edgeRemovedArrayOffset = align16(hopCountsOffset + graphNodeCount*sizeof(uint32_t)); // size = 0 or FixedBoolArray::requiredMemorySize(bondCount)
162  return align16(edgeRemovedArrayOffset + (bondCount == 0 ? 0 : FixedBoolArray::requiredMemorySize(bondCount)));
163 }
164 
165 } // namespace Blast
166 } // namespace Nv
167 
168 
169 #endif // ifndef NVBLASTACTORSERIALIZATIONBLOCK_H
Version
Definition: NvBlastActorSerializationBlock.h:46
Definition: NvBlastActorSerializationBlock.h:44
uint32_t m_size
Definition: NvBlastActorSerializationBlock.h:81
Definition: NvBlastFixedBoolArray.h:63
diff --git a/docs/source_docs/files/_nv_blast_allocator_8h_source.html b/docs/source_docs/files/_nv_blast_allocator_8h_source.html index 659646e..455115d 100755 --- a/docs/source_docs/files/_nv_blast_allocator_8h_source.html +++ b/docs/source_docs/files/_nv_blast_allocator_8h_source.html @@ -46,7 +46,7 @@ $(document).ready(function(){initNavTree('_nv_blast_allocator_8h_source.html',''
NvBlastAllocator.h
-Go to the documentation of this file.
1 // This code contains NVIDIA Confidential Information and is disclosed to you
2 // under a form of NVIDIA software license agreement provided separately to you.
3 //
4 // Notice
5 // NVIDIA Corporation and its licensors retain all intellectual property and
6 // proprietary rights in and to this software and related documentation and
7 // any modifications thereto. Any use, reproduction, disclosure, or
8 // distribution of this software and related documentation without an express
9 // license agreement from NVIDIA Corporation is strictly prohibited.
10 //
11 // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12 // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15 //
16 // Information and code furnished is believed to be accurate and reliable.
17 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18 // information or for any infringement of patents or other rights of third parties that may
19 // result from its use. No license is granted by implication or otherwise under any patent
20 // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21 // This code supersedes and replaces all information previously supplied.
22 // NVIDIA Corporation products are not authorized for use as critical
23 // components in life support devices or systems without express written approval of
24 // NVIDIA Corporation.
25 //
26 // Copyright (c) 2016-2018 NVIDIA Corporation. All rights reserved.
27 
28 
29 #ifndef NVBLASTALLOCATOR_H
30 #define NVBLASTALLOCATOR_H
31 
32 #include "NvBlastGlobals.h"
33 
38 namespace Nv
39 {
40 namespace Blast
41 {
42 
46 class Allocator
47 {
48 public:
49  Allocator(const char* = 0)
50  {
51  }
52 
53  void* allocate(size_t size, const char* filename, int line)
54  {
55  return NvBlastGlobalGetAllocatorCallback()->allocate(size, nullptr, filename, line);
56  }
57 
58  void deallocate(void* ptr)
59  {
61  }
62 };
63 
64 
65 } // namespace Blast
66 } // namespace Nv
67 
68 
69 #endif // #ifndef NVBLASTALLOCATOR_H
virtual void deallocate(void *ptr)=0
Frees memory previously allocated by allocate().
+Go to the documentation of this file.
1 // This code contains NVIDIA Confidential Information and is disclosed to you
2 // under a form of NVIDIA software license agreement provided separately to you.
3 //
4 // Notice
5 // NVIDIA Corporation and its licensors retain all intellectual property and
6 // proprietary rights in and to this software and related documentation and
7 // any modifications thereto. Any use, reproduction, disclosure, or
8 // distribution of this software and related documentation without an express
9 // license agreement from NVIDIA Corporation is strictly prohibited.
10 //
11 // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12 // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15 //
16 // Information and code furnished is believed to be accurate and reliable.
17 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18 // information or for any infringement of patents or other rights of third parties that may
19 // result from its use. No license is granted by implication or otherwise under any patent
20 // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21 // This code supersedes and replaces all information previously supplied.
22 // NVIDIA Corporation products are not authorized for use as critical
23 // components in life support devices or systems without express written approval of
24 // NVIDIA Corporation.
25 //
26 // Copyright (c) 2016-2020 NVIDIA Corporation. All rights reserved.
27 
28 
29 #ifndef NVBLASTALLOCATOR_H
30 #define NVBLASTALLOCATOR_H
31 
32 #include "NvBlastGlobals.h"
33 
38 namespace Nv
39 {
40 namespace Blast
41 {
42 
46 class Allocator
47 {
48 public:
49  Allocator(const char* = 0)
50  {
51  }
52 
53  void* allocate(size_t size, const char* filename, int line)
54  {
55  return NvBlastGlobalGetAllocatorCallback()->allocate(size, nullptr, filename, line);
56  }
57 
58  void deallocate(void* ptr)
59  {
61  }
62 };
63 
64 
65 } // namespace Blast
66 } // namespace Nv
67 
68 
69 #endif // #ifndef NVBLASTALLOCATOR_H
virtual void deallocate(void *ptr)=0
Frees memory previously allocated by allocate().
virtual void * allocate(size_t size, const char *typeName, const char *filename, int line)=0
Allocates size bytes of memory, which must be 16-byte aligned.
Allocator(const char *=0)
Definition: NvBlastAllocator.h:49
diff --git a/docs/source_docs/files/_nv_blast_array_8h_source.html b/docs/source_docs/files/_nv_blast_array_8h_source.html index 4911537..cb8bbf4 100755 --- a/docs/source_docs/files/_nv_blast_array_8h_source.html +++ b/docs/source_docs/files/_nv_blast_array_8h_source.html @@ -46,7 +46,7 @@ $(document).ready(function(){initNavTree('_nv_blast_array_8h_source.html','');})
NvBlastArray.h
-Go to the documentation of this file.
1 // This code contains NVIDIA Confidential Information and is disclosed to you
2 // under a form of NVIDIA software license agreement provided separately to you.
3 //
4 // Notice
5 // NVIDIA Corporation and its licensors retain all intellectual property and
6 // proprietary rights in and to this software and related documentation and
7 // any modifications thereto. Any use, reproduction, disclosure, or
8 // distribution of this software and related documentation without an express
9 // license agreement from NVIDIA Corporation is strictly prohibited.
10 //
11 // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12 // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15 //
16 // Information and code furnished is believed to be accurate and reliable.
17 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18 // information or for any infringement of patents or other rights of third parties that may
19 // result from its use. No license is granted by implication or otherwise under any patent
20 // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21 // This code supersedes and replaces all information previously supplied.
22 // NVIDIA Corporation products are not authorized for use as critical
23 // components in life support devices or systems without express written approval of
24 // NVIDIA Corporation.
25 //
26 // Copyright (c) 2016-2018 NVIDIA Corporation. All rights reserved.
27 
28 
29 #ifndef NVBLASTARRAY_H
30 #define NVBLASTARRAY_H
31 
32 
33 #include "NvBlastAllocator.h"
34 #include "PsInlineArray.h"
35 
36 
37 namespace Nv
38 {
39 namespace Blast
40 {
41 
45 template <class T>
46 struct Array
47 {
48  typedef physx::shdfnd::Array<T, Allocator> type;
49 };
50 
51 
57 template <class T, uint32_t N>
59 {
60  typedef physx::shdfnd::InlineArray<T, N, Allocator> type;
61 };
62 
63 } // namespace Blast
64 } // namespace Nv
65 
66 
67 #endif // #ifndef NVBLASTARRAY_H
Definition: NvBlastArray.h:46
+Go to the documentation of this file.
1 // This code contains NVIDIA Confidential Information and is disclosed to you
2 // under a form of NVIDIA software license agreement provided separately to you.
3 //
4 // Notice
5 // NVIDIA Corporation and its licensors retain all intellectual property and
6 // proprietary rights in and to this software and related documentation and
7 // any modifications thereto. Any use, reproduction, disclosure, or
8 // distribution of this software and related documentation without an express
9 // license agreement from NVIDIA Corporation is strictly prohibited.
10 //
11 // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12 // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15 //
16 // Information and code furnished is believed to be accurate and reliable.
17 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18 // information or for any infringement of patents or other rights of third parties that may
19 // result from its use. No license is granted by implication or otherwise under any patent
20 // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21 // This code supersedes and replaces all information previously supplied.
22 // NVIDIA Corporation products are not authorized for use as critical
23 // components in life support devices or systems without express written approval of
24 // NVIDIA Corporation.
25 //
26 // Copyright (c) 2016-2020 NVIDIA Corporation. All rights reserved.
27 
28 
29 #ifndef NVBLASTARRAY_H
30 #define NVBLASTARRAY_H
31 
32 
33 #include "NvBlastAllocator.h"
34 #include "PsInlineArray.h"
35 
36 
37 namespace Nv
38 {
39 namespace Blast
40 {
41 
45 template <class T>
46 struct Array
47 {
48  typedef physx::shdfnd::Array<T, Allocator> type;
49 };
50 
51 
57 template <class T, uint32_t N>
59 {
60  typedef physx::shdfnd::InlineArray<T, N, Allocator> type;
61 };
62 
63 } // namespace Blast
64 } // namespace Nv
65 
66 
67 #endif // #ifndef NVBLASTARRAY_H
Definition: NvBlastArray.h:46
physx::shdfnd::InlineArray< T, N, Allocator > type
Definition: NvBlastArray.h:60
Definition: NvBlastArray.h:58
physx::shdfnd::Array< T, Allocator > type
Definition: NvBlastArray.h:48
diff --git a/docs/source_docs/files/_nv_blast_assert_8h_source.html b/docs/source_docs/files/_nv_blast_assert_8h_source.html index 5941d04..9dfd8d9 100755 --- a/docs/source_docs/files/_nv_blast_assert_8h_source.html +++ b/docs/source_docs/files/_nv_blast_assert_8h_source.html @@ -46,7 +46,7 @@ $(document).ready(function(){initNavTree('_nv_blast_assert_8h_source.html','');}
NvBlastAssert.h
-Go to the documentation of this file.
1 // This code contains NVIDIA Confidential Information and is disclosed to you
2 // under a form of NVIDIA software license agreement provided separately to you.
3 //
4 // Notice
5 // NVIDIA Corporation and its licensors retain all intellectual property and
6 // proprietary rights in and to this software and related documentation and
7 // any modifications thereto. Any use, reproduction, disclosure, or
8 // distribution of this software and related documentation without an express
9 // license agreement from NVIDIA Corporation is strictly prohibited.
10 //
11 // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12 // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15 //
16 // Information and code furnished is believed to be accurate and reliable.
17 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18 // information or for any infringement of patents or other rights of third parties that may
19 // result from its use. No license is granted by implication or otherwise under any patent
20 // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21 // This code supersedes and replaces all information previously supplied.
22 // NVIDIA Corporation products are not authorized for use as critical
23 // components in life support devices or systems without express written approval of
24 // NVIDIA Corporation.
25 //
26 // Copyright (c) 2016-2018 NVIDIA Corporation. All rights reserved.
27 
28 
29 #ifndef NVBLASTASSERT_H
30 #define NVBLASTASSERT_H
31 
32 
33 #include "NvBlastPreprocessor.h"
34 
35 
36 #if !NV_ENABLE_ASSERTS
37 #define NVBLAST_ASSERT(exp) ((void)0)
38 #define NVBLAST_ALWAYS_ASSERT_MESSAGE(message) ((void)0)
39 #define NVBLAST_ASSERT_WITH_MESSAGE(condition, message) ((void)0)
40 #else
41 #if NV_VC
42 #define NVBLAST_CODE_ANALYSIS_ASSUME(exp) \
43  __analysis_assume(!!(exp)) // This macro will be used to get rid of analysis warning messages if a NVBLAST_ASSERT is used
44 // to "guard" illegal mem access, for example.
45 #else
46 #define NVBLAST_CODE_ANALYSIS_ASSUME(exp)
47 #endif
48 #define NVBLAST_ASSERT(exp) \
49 { \
50  static bool _ignore = false; \
51  if (!(exp) && !_ignore) NvBlastAssertHandler(#exp, __FILE__, __LINE__, _ignore); \
52  NVBLAST_CODE_ANALYSIS_ASSUME(exp); \
53 } ((void)0)
54 #define NVBLAST_ALWAYS_ASSERT_MESSAGE(message) \
55 { \
56  static bool _ignore = false; \
57  if(!_ignore) \
58  { \
59  NvBlastAssertHandler(message, __FILE__, __LINE__, _ignore); \
60  } \
61 } ((void)0)
62 #define NVBLAST_ASSERT_WITH_MESSAGE(exp, message) \
63 { \
64  static bool _ignore = false; \
65  if (!(exp) && !_ignore) NvBlastAssertHandler(message, __FILE__, __LINE__, _ignore); \
66  NVBLAST_CODE_ANALYSIS_ASSUME(exp); \
67 } ((void)0)
68 #endif
69 
70 #define NVBLAST_ALWAYS_ASSERT() NVBLAST_ASSERT(0)
71 
72 
73 extern "C"
74 {
75 
76 NVBLAST_API void NvBlastAssertHandler(const char* expr, const char* file, int line, bool& ignore);
77 
78 } // extern "C"
79 
80 
81 #endif // #ifndef NVBLASTASSERT_H
NVBLAST_API void NvBlastAssertHandler(const char *expr, const char *file, int line, bool &ignore)
+Go to the documentation of this file.
1 // This code contains NVIDIA Confidential Information and is disclosed to you
2 // under a form of NVIDIA software license agreement provided separately to you.
3 //
4 // Notice
5 // NVIDIA Corporation and its licensors retain all intellectual property and
6 // proprietary rights in and to this software and related documentation and
7 // any modifications thereto. Any use, reproduction, disclosure, or
8 // distribution of this software and related documentation without an express
9 // license agreement from NVIDIA Corporation is strictly prohibited.
10 //
11 // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12 // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15 //
16 // Information and code furnished is believed to be accurate and reliable.
17 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18 // information or for any infringement of patents or other rights of third parties that may
19 // result from its use. No license is granted by implication or otherwise under any patent
20 // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21 // This code supersedes and replaces all information previously supplied.
22 // NVIDIA Corporation products are not authorized for use as critical
23 // components in life support devices or systems without express written approval of
24 // NVIDIA Corporation.
25 //
26 // Copyright (c) 2016-2020 NVIDIA Corporation. All rights reserved.
27 
28 
29 #ifndef NVBLASTASSERT_H
30 #define NVBLASTASSERT_H
31 
32 
33 #include "NvBlastPreprocessor.h"
34 
35 
36 #if !NV_ENABLE_ASSERTS
37 #define NVBLAST_ASSERT(exp) ((void)0)
38 #define NVBLAST_ALWAYS_ASSERT_MESSAGE(message) ((void)0)
39 #define NVBLAST_ASSERT_WITH_MESSAGE(condition, message) ((void)0)
40 #else
41 #if NV_VC
42 #define NVBLAST_CODE_ANALYSIS_ASSUME(exp) \
43  __analysis_assume(!!(exp)) // This macro will be used to get rid of analysis warning messages if a NVBLAST_ASSERT is used
44 // to "guard" illegal mem access, for example.
45 #else
46 #define NVBLAST_CODE_ANALYSIS_ASSUME(exp)
47 #endif
48 #define NVBLAST_ASSERT(exp) \
49 { \
50  static bool _ignore = false; \
51  if (!(exp) && !_ignore) NvBlastAssertHandler(#exp, __FILE__, __LINE__, _ignore); \
52  NVBLAST_CODE_ANALYSIS_ASSUME(exp); \
53 } ((void)0)
54 #define NVBLAST_ALWAYS_ASSERT_MESSAGE(message) \
55 { \
56  static bool _ignore = false; \
57  if(!_ignore) \
58  { \
59  NvBlastAssertHandler(message, __FILE__, __LINE__, _ignore); \
60  } \
61 } ((void)0)
62 #define NVBLAST_ASSERT_WITH_MESSAGE(exp, message) \
63 { \
64  static bool _ignore = false; \
65  if (!(exp) && !_ignore) NvBlastAssertHandler(message, __FILE__, __LINE__, _ignore); \
66  NVBLAST_CODE_ANALYSIS_ASSUME(exp); \
67 } ((void)0)
68 #endif
69 
70 #define NVBLAST_ALWAYS_ASSERT() NVBLAST_ASSERT(0)
71 
72 
73 extern "C"
74 {
75 
76 NVBLAST_API void NvBlastAssertHandler(const char* expr, const char* file, int line, bool& ignore);
77 
78 } // extern "C"
79 
80 
81 #endif // #ifndef NVBLASTASSERT_H
NVBLAST_API void NvBlastAssertHandler(const char *expr, const char *file, int line, bool &ignore)
#define NVBLAST_API
Definition: NvBlastPreprocessor.h:37
diff --git a/docs/source_docs/files/_nv_blast_asset_8h_source.html b/docs/source_docs/files/_nv_blast_asset_8h_source.html index abfb857..35b8f60 100755 --- a/docs/source_docs/files/_nv_blast_asset_8h_source.html +++ b/docs/source_docs/files/_nv_blast_asset_8h_source.html @@ -46,7 +46,7 @@ $(document).ready(function(){initNavTree('_nv_blast_asset_8h_source.html','');})
NvBlastAsset.h
-Go to the documentation of this file.
1 // This code contains NVIDIA Confidential Information and is disclosed to you
2 // under a form of NVIDIA software license agreement provided separately to you.
3 //
4 // Notice
5 // NVIDIA Corporation and its licensors retain all intellectual property and
6 // proprietary rights in and to this software and related documentation and
7 // any modifications thereto. Any use, reproduction, disclosure, or
8 // distribution of this software and related documentation without an express
9 // license agreement from NVIDIA Corporation is strictly prohibited.
10 //
11 // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12 // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15 //
16 // Information and code furnished is believed to be accurate and reliable.
17 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18 // information or for any infringement of patents or other rights of third parties that may
19 // result from its use. No license is granted by implication or otherwise under any patent
20 // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21 // This code supersedes and replaces all information previously supplied.
22 // NVIDIA Corporation products are not authorized for use as critical
23 // components in life support devices or systems without express written approval of
24 // NVIDIA Corporation.
25 //
26 // Copyright (c) 2016-2018 NVIDIA Corporation. All rights reserved.
27 
28 
29 #ifndef NVBLASTASSET_H
30 #define NVBLASTASSET_H
31 
32 
33 #include "NvBlastSupportGraph.h"
34 #include "NvBlast.h"
35 #include "NvBlastAssert.h"
36 #include "NvBlastIndexFns.h"
37 #include "NvBlastChunkHierarchy.h"
38 
39 
40 namespace Nv
41 {
42 namespace Blast
43 {
44 
45 class Asset : public NvBlastAsset
46 {
47 public:
48 
53  {
54  enum Enum
55  {
56  Parent = (1 << 0),
57  Support = (1 << 1),
58  SuperSupport = (1 << 2),
59 
60  // Combinations
62  };
63  };
64 
65 
76  static Asset* create(void* mem, const NvBlastAssetDesc* desc, void* scratch, NvBlastLog logFn);
77 
84  static size_t getMemorySize(const NvBlastAssetDesc* desc);
85 
94  static size_t createRequiredScratch(const NvBlastAssetDesc* desc);
95 
96 
102  uint32_t getUpperSupportChunkCount() const;
103 
109  uint32_t getLowerSupportChunkCount() const;
110 
116  uint32_t getBondCount() const;
117 
123  uint32_t getHierarchyCount() const;
124 
132  uint32_t getContiguousLowerSupportIndex(uint32_t chunkIndex) const;
133 
134 
135  // Static functions
136 
156  static bool ensureExactSupportCoverage(uint32_t& supportChunkCount, uint32_t& leafChunkCount, char* chunkAnnotation, uint32_t chunkCount, NvBlastChunkDesc* chunkDescs, bool testOnly, NvBlastLog logFn);
157 
174  static bool testForValidChunkOrder(uint32_t chunkCount, const NvBlastChunkDesc* chunkDescs, const char* chunkAnnotation, void* scratch);
175 
176 
178 
183 
188 
192  uint32_t m_chunkCount;
193 
198 
203 
208 
212  uint32_t m_bondCount;
213 
219  NvBlastBlockArrayData(NvBlastChunk, m_chunksOffset, getChunks, m_chunkCount);
220 
229  NvBlastBlockArrayData(NvBlastBond, m_bondsOffset, getBonds, m_bondCount);
230 
237  NvBlastBlockArrayData(uint32_t, m_subtreeLeafChunkCountsOffset, getSubtreeLeafChunkCounts, m_chunkCount);
238 
244  NvBlastBlockArrayData(uint32_t, m_chunkToGraphNodeMapOffset, getChunkToGraphNodeMap, m_chunkCount);
245 
246 
248 
254  {
255  public:
257  DepthFirstIt(const Asset& asset, uint32_t startChunkIndex, bool upperSupportOnly = false) :
258  ChunkDepthFirstIt(asset.getChunks(), startChunkIndex, upperSupportOnly ? asset.getUpperSupportChunkCount() : asset.m_chunkCount) {}
259  };
260 };
261 
262 
264 
266 {
268 }
269 
270 
272 {
274 }
275 
276 
278 {
279  NVBLAST_ASSERT((m_graph.getAdjacencyPartition()[m_graph.m_nodeCount] & 1) == 0); // The bidirectional graph data should have an even number of edges
280  return m_graph.getAdjacencyPartition()[m_graph.m_nodeCount] / 2; // Directional bonds, divide by two
281 }
282 
283 
285 {
286  const NvBlastChunk* chunks = getChunks();
287  for (uint32_t i = 0; i < m_chunkCount; ++i)
288  {
289  if (!isInvalidIndex(chunks[i].parentChunkIndex))
290  {
291  return i;
292  }
293  }
294  return m_chunkCount;
295 }
296 
297 
298 NV_INLINE uint32_t Asset::getContiguousLowerSupportIndex(uint32_t chunkIndex) const
299 {
300  NVBLAST_ASSERT(chunkIndex < m_chunkCount);
301 
302  return chunkIndex < m_firstSubsupportChunkIndex ? getChunkToGraphNodeMap()[chunkIndex] : (chunkIndex - m_firstSubsupportChunkIndex + m_graph.m_nodeCount);
303 }
304 
305 
306 //JDM: Expose this so serialization layer can use it.
307 NVBLAST_API Asset* initializeAsset(void* mem, NvBlastID id, uint32_t chunkCount, uint32_t graphNodeCount, uint32_t leafChunkCount, uint32_t firstSubsupportChunkIndex, uint32_t bondCount, NvBlastLog logFn);
308 
309 } // namespace Blast
310 } // namespace Nv
311 
312 
313 #endif // ifndef NVBLASTASSET_H
uint32_t m_bondCount
Definition: NvBlastAsset.h:212
+Go to the documentation of this file.
1 // This code contains NVIDIA Confidential Information and is disclosed to you
2 // under a form of NVIDIA software license agreement provided separately to you.
3 //
4 // Notice
5 // NVIDIA Corporation and its licensors retain all intellectual property and
6 // proprietary rights in and to this software and related documentation and
7 // any modifications thereto. Any use, reproduction, disclosure, or
8 // distribution of this software and related documentation without an express
9 // license agreement from NVIDIA Corporation is strictly prohibited.
10 //
11 // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12 // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15 //
16 // Information and code furnished is believed to be accurate and reliable.
17 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18 // information or for any infringement of patents or other rights of third parties that may
19 // result from its use. No license is granted by implication or otherwise under any patent
20 // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21 // This code supersedes and replaces all information previously supplied.
22 // NVIDIA Corporation products are not authorized for use as critical
23 // components in life support devices or systems without express written approval of
24 // NVIDIA Corporation.
25 //
26 // Copyright (c) 2016-2020 NVIDIA Corporation. All rights reserved.
27 
28 
29 #ifndef NVBLASTASSET_H
30 #define NVBLASTASSET_H
31 
32 
33 #include "NvBlastSupportGraph.h"
34 #include "NvBlast.h"
35 #include "NvBlastAssert.h"
36 #include "NvBlastIndexFns.h"
37 #include "NvBlastChunkHierarchy.h"
38 
39 
40 namespace Nv
41 {
42 namespace Blast
43 {
44 
45 class Asset : public NvBlastAsset
46 {
47 public:
48 
53  {
54  enum Enum
55  {
56  Parent = (1 << 0),
57  Support = (1 << 1),
58  SuperSupport = (1 << 2),
59 
60  // Combinations
62  };
63  };
64 
65 
76  static Asset* create(void* mem, const NvBlastAssetDesc* desc, void* scratch, NvBlastLog logFn);
77 
84  static size_t getMemorySize(const NvBlastAssetDesc* desc);
85 
94  static size_t createRequiredScratch(const NvBlastAssetDesc* desc);
95 
96 
102  uint32_t getUpperSupportChunkCount() const;
103 
109  uint32_t getLowerSupportChunkCount() const;
110 
116  uint32_t getBondCount() const;
117 
123  uint32_t getHierarchyCount() const;
124 
132  uint32_t getContiguousLowerSupportIndex(uint32_t chunkIndex) const;
133 
134 
135  // Static functions
136 
156  static bool ensureExactSupportCoverage(uint32_t& supportChunkCount, uint32_t& leafChunkCount, char* chunkAnnotation, uint32_t chunkCount, NvBlastChunkDesc* chunkDescs, bool testOnly, NvBlastLog logFn);
157 
174  static bool testForValidChunkOrder(uint32_t chunkCount, const NvBlastChunkDesc* chunkDescs, const char* chunkAnnotation, void* scratch);
175 
176 
178 
183 
188 
192  uint32_t m_chunkCount;
193 
198 
203 
208 
212  uint32_t m_bondCount;
213 
219  NvBlastBlockArrayData(NvBlastChunk, m_chunksOffset, getChunks, m_chunkCount);
220 
229  NvBlastBlockArrayData(NvBlastBond, m_bondsOffset, getBonds, m_bondCount);
230 
237  NvBlastBlockArrayData(uint32_t, m_subtreeLeafChunkCountsOffset, getSubtreeLeafChunkCounts, m_chunkCount);
238 
244  NvBlastBlockArrayData(uint32_t, m_chunkToGraphNodeMapOffset, getChunkToGraphNodeMap, m_chunkCount);
245 
246 
248 
254  {
255  public:
257  DepthFirstIt(const Asset& asset, uint32_t startChunkIndex, bool upperSupportOnly = false) :
258  ChunkDepthFirstIt(asset.getChunks(), startChunkIndex, upperSupportOnly ? asset.getUpperSupportChunkCount() : asset.m_chunkCount) {}
259  };
260 };
261 
262 
264 
266 {
268 }
269 
270 
272 {
274 }
275 
276 
278 {
279  NVBLAST_ASSERT((m_graph.getAdjacencyPartition()[m_graph.m_nodeCount] & 1) == 0); // The bidirectional graph data should have an even number of edges
280  return m_graph.getAdjacencyPartition()[m_graph.m_nodeCount] / 2; // Directional bonds, divide by two
281 }
282 
283 
285 {
286  const NvBlastChunk* chunks = getChunks();
287  for (uint32_t i = 0; i < m_chunkCount; ++i)
288  {
289  if (!isInvalidIndex(chunks[i].parentChunkIndex))
290  {
291  return i;
292  }
293  }
294  return m_chunkCount;
295 }
296 
297 
298 NV_INLINE uint32_t Asset::getContiguousLowerSupportIndex(uint32_t chunkIndex) const
299 {
300  NVBLAST_ASSERT(chunkIndex < m_chunkCount);
301 
302  return chunkIndex < m_firstSubsupportChunkIndex ? getChunkToGraphNodeMap()[chunkIndex] : (chunkIndex - m_firstSubsupportChunkIndex + m_graph.m_nodeCount);
303 }
304 
305 
306 //JDM: Expose this so serialization layer can use it.
307 NVBLAST_API Asset* initializeAsset(void* mem, NvBlastID id, uint32_t chunkCount, uint32_t graphNodeCount, uint32_t leafChunkCount, uint32_t firstSubsupportChunkIndex, uint32_t bondCount, NvBlastLog logFn);
308 
309 } // namespace Blast
310 } // namespace Nv
311 
312 
313 #endif // ifndef NVBLASTASSET_H
uint32_t m_bondCount
Definition: NvBlastAsset.h:212
static size_t getMemorySize(const NvBlastAssetDesc *desc)
Definition: NvBlastSupportGraph.h:76
diff --git a/docs/source_docs/files/_nv_blast_atomic_8h_source.html b/docs/source_docs/files/_nv_blast_atomic_8h_source.html index 00a1227..cf8b6ed 100755 --- a/docs/source_docs/files/_nv_blast_atomic_8h_source.html +++ b/docs/source_docs/files/_nv_blast_atomic_8h_source.html @@ -46,7 +46,7 @@ $(document).ready(function(){initNavTree('_nv_blast_atomic_8h_source.html','');}
NvBlastAtomic.h
-Go to the documentation of this file.
1 // This code contains NVIDIA Confidential Information and is disclosed to you
2 // under a form of NVIDIA software license agreement provided separately to you.
3 //
4 // Notice
5 // NVIDIA Corporation and its licensors retain all intellectual property and
6 // proprietary rights in and to this software and related documentation and
7 // any modifications thereto. Any use, reproduction, disclosure, or
8 // distribution of this software and related documentation without an express
9 // license agreement from NVIDIA Corporation is strictly prohibited.
10 //
11 // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12 // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15 //
16 // Information and code furnished is believed to be accurate and reliable.
17 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18 // information or for any infringement of patents or other rights of third parties that may
19 // result from its use. No license is granted by implication or otherwise under any patent
20 // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21 // This code supersedes and replaces all information previously supplied.
22 // NVIDIA Corporation products are not authorized for use as critical
23 // components in life support devices or systems without express written approval of
24 // NVIDIA Corporation.
25 //
26 // Copyright (c) 2016-2018 NVIDIA Corporation. All rights reserved.
27 
28 
29 #ifndef NVBLASTATOMIC_H
30 #define NVBLASTATOMIC_H
31 
32 #include "NvBlastTypes.h"
33 
34 
35 namespace Nv
36 {
37 namespace Blast
38 {
39 
40 /* increment the specified location. Return the incremented value */
41 int32_t atomicIncrement(volatile int32_t* val);
42 
43 
44 /* decrement the specified location. Return the decremented value */
45 int32_t atomicDecrement(volatile int32_t* val);
46 
47 } // namespace Blast
48 } // namespace Nv
49 
50 #endif // #ifndef NVBLASTATOMIC_H
+Go to the documentation of this file.
1 // This code contains NVIDIA Confidential Information and is disclosed to you
2 // under a form of NVIDIA software license agreement provided separately to you.
3 //
4 // Notice
5 // NVIDIA Corporation and its licensors retain all intellectual property and
6 // proprietary rights in and to this software and related documentation and
7 // any modifications thereto. Any use, reproduction, disclosure, or
8 // distribution of this software and related documentation without an express
9 // license agreement from NVIDIA Corporation is strictly prohibited.
10 //
11 // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12 // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15 //
16 // Information and code furnished is believed to be accurate and reliable.
17 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18 // information or for any infringement of patents or other rights of third parties that may
19 // result from its use. No license is granted by implication or otherwise under any patent
20 // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21 // This code supersedes and replaces all information previously supplied.
22 // NVIDIA Corporation products are not authorized for use as critical
23 // components in life support devices or systems without express written approval of
24 // NVIDIA Corporation.
25 //
26 // Copyright (c) 2016-2020 NVIDIA Corporation. All rights reserved.
27 
28 
29 #ifndef NVBLASTATOMIC_H
30 #define NVBLASTATOMIC_H
31 
32 #include "NvBlastTypes.h"
33 
34 
35 namespace Nv
36 {
37 namespace Blast
38 {
39 
40 /* increment the specified location. Return the incremented value */
41 int32_t atomicIncrement(volatile int32_t* val);
42 
43 
44 /* decrement the specified location. Return the decremented value */
45 int32_t atomicDecrement(volatile int32_t* val);
46 
47 } // namespace Blast
48 } // namespace Nv
49 
50 #endif // #ifndef NVBLASTATOMIC_H
int32_t atomicIncrement(volatile int32_t *val)
int32_t atomicDecrement(volatile int32_t *val)
Definition: NvBlastArray.h:37
diff --git a/docs/source_docs/files/_nv_blast_bond_d_t_o_8h_source.html b/docs/source_docs/files/_nv_blast_bond_d_t_o_8h_source.html index 367321d..19c62fa 100755 --- a/docs/source_docs/files/_nv_blast_bond_d_t_o_8h_source.html +++ b/docs/source_docs/files/_nv_blast_bond_d_t_o_8h_source.html @@ -46,7 +46,7 @@ $(document).ready(function(){initNavTree('_nv_blast_bond_d_t_o_8h_source.html','
NvBlastBondDTO.h
-Go to the documentation of this file.
1 // This code contains NVIDIA Confidential Information and is disclosed to you
2 // under a form of NVIDIA software license agreement provided separately to you.
3 //
4 // Notice
5 // NVIDIA Corporation and its licensors retain all intellectual property and
6 // proprietary rights in and to this software and related documentation and
7 // any modifications thereto. Any use, reproduction, disclosure, or
8 // distribution of this software and related documentation without an express
9 // license agreement from NVIDIA Corporation is strictly prohibited.
10 //
11 // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12 // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15 //
16 // Information and code furnished is believed to be accurate and reliable.
17 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18 // information or for any infringement of patents or other rights of third parties that may
19 // result from its use. No license is granted by implication or otherwise under any patent
20 // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21 // This code supersedes and replaces all information previously supplied.
22 // NVIDIA Corporation products are not authorized for use as critical
23 // components in life support devices or systems without express written approval of
24 // NVIDIA Corporation.
25 //
26 // Copyright (c) 2018 NVIDIA Corporation. All rights reserved.
27 
28 
29 #pragma once
30 #include "DTOMacros.h"
31 #include "NvBlastTypes.h"
33 
#define DTO_CLASS(_NAME, _POCO, _SERIALIZER)
Definition: DTOMacros.h:31
+Go to the documentation of this file.
1 // This code contains NVIDIA Confidential Information and is disclosed to you
2 // under a form of NVIDIA software license agreement provided separately to you.
3 //
4 // Notice
5 // NVIDIA Corporation and its licensors retain all intellectual property and
6 // proprietary rights in and to this software and related documentation and
7 // any modifications thereto. Any use, reproduction, disclosure, or
8 // distribution of this software and related documentation without an express
9 // license agreement from NVIDIA Corporation is strictly prohibited.
10 //
11 // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12 // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15 //
16 // Information and code furnished is believed to be accurate and reliable.
17 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18 // information or for any infringement of patents or other rights of third parties that may
19 // result from its use. No license is granted by implication or otherwise under any patent
20 // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21 // This code supersedes and replaces all information previously supplied.
22 // NVIDIA Corporation products are not authorized for use as critical
23 // components in life support devices or systems without express written approval of
24 // NVIDIA Corporation.
25 //
26 // Copyright (c) 2020 NVIDIA Corporation. All rights reserved.
27 
28 
29 #pragma once
30 #include "DTOMacros.h"
31 #include "NvBlastTypes.h"
33 
#define DTO_CLASS(_NAME, _POCO, _SERIALIZER)
Definition: DTOMacros.h:31
Definition: NvBlastTypes.h:189
diff --git a/docs/source_docs/files/_nv_blast_chunk_d_t_o_8h_source.html b/docs/source_docs/files/_nv_blast_chunk_d_t_o_8h_source.html index 6df200f..03dbb80 100755 --- a/docs/source_docs/files/_nv_blast_chunk_d_t_o_8h_source.html +++ b/docs/source_docs/files/_nv_blast_chunk_d_t_o_8h_source.html @@ -46,7 +46,7 @@ $(document).ready(function(){initNavTree('_nv_blast_chunk_d_t_o_8h_source.html',
NvBlastChunkDTO.h
-Go to the documentation of this file.
1 // This code contains NVIDIA Confidential Information and is disclosed to you
2 // under a form of NVIDIA software license agreement provided separately to you.
3 //
4 // Notice
5 // NVIDIA Corporation and its licensors retain all intellectual property and
6 // proprietary rights in and to this software and related documentation and
7 // any modifications thereto. Any use, reproduction, disclosure, or
8 // distribution of this software and related documentation without an express
9 // license agreement from NVIDIA Corporation is strictly prohibited.
10 //
11 // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12 // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15 //
16 // Information and code furnished is believed to be accurate and reliable.
17 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18 // information or for any infringement of patents or other rights of third parties that may
19 // result from its use. No license is granted by implication or otherwise under any patent
20 // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21 // This code supersedes and replaces all information previously supplied.
22 // NVIDIA Corporation products are not authorized for use as critical
23 // components in life support devices or systems without express written approval of
24 // NVIDIA Corporation.
25 //
26 // Copyright (c) 2018 NVIDIA Corporation. All rights reserved.
27 
28 
29 #pragma once
30 #include "DTOMacros.h"
31 #include "NvBlastTypes.h"
33 
34 
36 
#define DTO_CLASS(_NAME, _POCO, _SERIALIZER)
Definition: DTOMacros.h:31
+Go to the documentation of this file.
1 // This code contains NVIDIA Confidential Information and is disclosed to you
2 // under a form of NVIDIA software license agreement provided separately to you.
3 //
4 // Notice
5 // NVIDIA Corporation and its licensors retain all intellectual property and
6 // proprietary rights in and to this software and related documentation and
7 // any modifications thereto. Any use, reproduction, disclosure, or
8 // distribution of this software and related documentation without an express
9 // license agreement from NVIDIA Corporation is strictly prohibited.
10 //
11 // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12 // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15 //
16 // Information and code furnished is believed to be accurate and reliable.
17 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18 // information or for any infringement of patents or other rights of third parties that may
19 // result from its use. No license is granted by implication or otherwise under any patent
20 // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21 // This code supersedes and replaces all information previously supplied.
22 // NVIDIA Corporation products are not authorized for use as critical
23 // components in life support devices or systems without express written approval of
24 // NVIDIA Corporation.
25 //
26 // Copyright (c) 2020 NVIDIA Corporation. All rights reserved.
27 
28 
29 #pragma once
30 #include "DTOMacros.h"
31 #include "NvBlastTypes.h"
33 
34 
36 
#define DTO_CLASS(_NAME, _POCO, _SERIALIZER)
Definition: DTOMacros.h:31
Definition: NvBlastTypes.h:152
diff --git a/docs/source_docs/files/_nv_blast_chunk_hierarchy_8h_source.html b/docs/source_docs/files/_nv_blast_chunk_hierarchy_8h_source.html index 29ac98b..691afa5 100755 --- a/docs/source_docs/files/_nv_blast_chunk_hierarchy_8h_source.html +++ b/docs/source_docs/files/_nv_blast_chunk_hierarchy_8h_source.html @@ -46,7 +46,7 @@ $(document).ready(function(){initNavTree('_nv_blast_chunk_hierarchy_8h_source.ht
NvBlastChunkHierarchy.h
-Go to the documentation of this file.
1 // This code contains NVIDIA Confidential Information and is disclosed to you
2 // under a form of NVIDIA software license agreement provided separately to you.
3 //
4 // Notice
5 // NVIDIA Corporation and its licensors retain all intellectual property and
6 // proprietary rights in and to this software and related documentation and
7 // any modifications thereto. Any use, reproduction, disclosure, or
8 // distribution of this software and related documentation without an express
9 // license agreement from NVIDIA Corporation is strictly prohibited.
10 //
11 // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12 // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15 //
16 // Information and code furnished is believed to be accurate and reliable.
17 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18 // information or for any infringement of patents or other rights of third parties that may
19 // result from its use. No license is granted by implication or otherwise under any patent
20 // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21 // This code supersedes and replaces all information previously supplied.
22 // NVIDIA Corporation products are not authorized for use as critical
23 // components in life support devices or systems without express written approval of
24 // NVIDIA Corporation.
25 //
26 // Copyright (c) 2016-2018 NVIDIA Corporation. All rights reserved.
27 
28 
29 #ifndef NVBLASTCHUNKHIERARCHY_H
30 #define NVBLASTCHUNKHIERARCHY_H
31 
32 
33 #include "NvBlastIndexFns.h"
34 #include "NvBlastDLink.h"
35 #include "NvBlast.h"
36 #include "NvBlastAssert.h"
37 #include "NvBlastIteratorBase.h"
38 
39 
40 namespace Nv
41 {
42 namespace Blast
43 {
44 
49 class ChunkDepthFirstIt : public IteratorBase<uint32_t>
50 {
51 public:
53  ChunkDepthFirstIt(const NvBlastChunk* chunks, uint32_t startChunkIndex, uint32_t chunkIndexLimit) :
54  IteratorBase<uint32_t>(startChunkIndex), m_chunks(chunks), m_stop(startChunkIndex), m_limit(chunkIndexLimit)
55  {
56  if (m_curr >= m_limit)
57  {
58  m_curr = invalidIndex<uint32_t>();
59  }
60  }
61 
63  uint32_t operator ++ ()
64  {
66  const NvBlastChunk* chunk = m_chunks + m_curr;
67  if (chunk->childIndexStop > chunk->firstChildIndex && chunk->firstChildIndex < m_limit)
68  {
69  m_curr = chunk->firstChildIndex;
70  }
71  else
72  {
73  for (;;)
74  {
75  if (m_curr == m_stop)
76  {
77  m_curr = invalidIndex<uint32_t>();
78  break;
79  }
80  NVBLAST_ASSERT(!isInvalidIndex(chunk->parentChunkIndex)); // This should not be possible with this search
81  const NvBlastChunk* parentChunk = m_chunks + chunk->parentChunkIndex;
82  if (++m_curr < parentChunk->childIndexStop)
83  {
84  break; // Sibling chunk is valid, that's the next chunk
85  }
86  m_curr = chunk->parentChunkIndex;
87  chunk = parentChunk;
88  }
89  }
90  return m_curr;
91  }
92 
93 private:
94  const NvBlastChunk* m_chunks;
95  uint32_t m_stop;
96  uint32_t m_limit;
97 };
98 
99 
106 (
107 uint32_t* chunkIndices,
108 uint32_t chunkIndicesSize,
109 const NvBlastChunk* chunks,
110 uint32_t chunkIndex,
111 bool includeRoot = true,
112 uint32_t chunkIndexLimit = invalidIndex<uint32_t>()
113 )
114 {
115  if (chunkIndicesSize == 0)
116  {
117  return 0;
118  }
119  uint32_t chunkIndexCount = 0;
120  bool rootHandled = false;
121  if (includeRoot)
122  {
123  chunkIndices[chunkIndexCount++] = chunkIndex;
124  rootHandled = true;
125  }
126  for (uint32_t curr = 0; !rootHandled || curr < chunkIndexCount;)
127  {
128  const NvBlastChunk& chunk = chunks[rootHandled ? chunkIndices[curr] : chunkIndex];
129  if (chunk.firstChildIndex < chunkIndexLimit)
130  {
131  const uint32_t childIndexStop = chunk.childIndexStop < chunkIndexLimit ? chunk.childIndexStop : chunkIndexLimit;
132  const uint32_t childIndexBufferStop = chunk.firstChildIndex + (chunkIndicesSize - chunkIndexCount);
133  const uint32_t stop = childIndexStop < childIndexBufferStop ? childIndexStop : childIndexBufferStop;
134  for (uint32_t childIndex = chunk.firstChildIndex; childIndex < stop; ++childIndex)
135  {
136  chunkIndices[chunkIndexCount++] = childIndex;
137  }
138  }
139  if (rootHandled)
140  {
141  ++curr;
142  }
143  rootHandled = true;
144  }
145  return chunkIndexCount;
146 }
147 
148 
152 template<class VisibilityRep>
154 (
155 VisibilityRep* actors,
156 IndexDLink<uint32_t>* visibleChunkIndexLinks,
157 uint32_t* chunkActorIndices,
158 uint32_t actorIndex,
159 uint32_t supportChunkIndex,
160 const NvBlastChunk* chunks,
161 uint32_t upperSupportChunkCount
162 )
163 {
164  uint32_t chunkIndex = supportChunkIndex;
165  uint32_t chunkActorIndex = chunkActorIndices[supportChunkIndex];
166  uint32_t newChunkActorIndex = actorIndex;
167  VisibilityRep& thisActor = actors[actorIndex];
168 
169  do
170  {
171  if (chunkActorIndex == newChunkActorIndex)
172  {
173  break; // Nothing to do
174  }
175 
176  const uint32_t parentChunkIndex = chunks[chunkIndex].parentChunkIndex;
177  const uint32_t parentChunkActorIndex = parentChunkIndex != invalidIndex<uint32_t>() ? chunkActorIndices[parentChunkIndex] : invalidIndex<uint32_t>();
178  const bool chunkVisible = chunkActorIndex != parentChunkActorIndex;
179 
180  // If the chunk is visible, it needs to be removed from its old actor's visibility list
181  if (chunkVisible && !isInvalidIndex(chunkActorIndex))
182  {
183  VisibilityRep& chunkActor = actors[chunkActorIndex];
184  IndexDList<uint32_t>().removeFromList(chunkActor.m_firstVisibleChunkIndex, visibleChunkIndexLinks, chunkIndex);
185  --chunkActor.m_visibleChunkCount;
186  }
187 
188  // Now update the chunk's actor index
189  const uint32_t oldChunkActorIndex = chunkActorIndices[chunkIndex];
190  chunkActorIndices[chunkIndex] = newChunkActorIndex;
191  if (newChunkActorIndex != invalidIndex<uint32_t>() && parentChunkActorIndex != newChunkActorIndex)
192  {
193  // The chunk is now visible. Add it to this actor's visibility list
194  IndexDList<uint32_t>().insertListHead(thisActor.m_firstVisibleChunkIndex, visibleChunkIndexLinks, chunkIndex);
195  ++thisActor.m_visibleChunkCount;
196  // Remove its children from this actor's visibility list
197  if (actorIndex != oldChunkActorIndex)
198  {
199  const NvBlastChunk& chunk = chunks[chunkIndex];
200  if (chunk.firstChildIndex < upperSupportChunkCount) // Only need to deal with upper-support children
201  {
202  for (uint32_t childChunkIndex = chunk.firstChildIndex; childChunkIndex < chunk.childIndexStop; ++childChunkIndex)
203  {
204  if (chunkActorIndices[childChunkIndex] == actorIndex)
205  {
206  IndexDList<uint32_t>().removeFromList(thisActor.m_firstVisibleChunkIndex, visibleChunkIndexLinks, childChunkIndex);
207  --thisActor.m_visibleChunkCount;
208  }
209  }
210  }
211  }
212  }
213 
214  if (parentChunkIndex != invalidIndex<uint32_t>())
215  {
216  // If all of its siblings have the same index, then the parent will too. Otherwise, the parent will have an invalid index and its children will be visible
217  const NvBlastChunk& parentChunk = chunks[parentChunkIndex];
218  bool uniform = true;
219  for (uint32_t childChunkIndex = parentChunk.firstChildIndex; uniform && childChunkIndex < parentChunk.childIndexStop; ++childChunkIndex)
220  {
221  uniform = (newChunkActorIndex == chunkActorIndices[childChunkIndex]);
222  }
223  if (!uniform)
224  {
225  newChunkActorIndex = invalidIndex<uint32_t>();
226  for (uint32_t childChunkIndex = parentChunk.firstChildIndex; childChunkIndex < parentChunk.childIndexStop; ++childChunkIndex)
227  {
228  const uint32_t childChunkActorIndex = chunkActorIndices[childChunkIndex];
229  if (childChunkActorIndex != invalidIndex<uint32_t>() && childChunkActorIndex == parentChunkActorIndex)
230  {
231  // The child was invisible. Add it to its actor's visibility list
232  VisibilityRep& childChunkActor = actors[childChunkActorIndex];
233  IndexDList<uint32_t>().insertListHead(childChunkActor.m_firstVisibleChunkIndex, visibleChunkIndexLinks, childChunkIndex);
234  ++childChunkActor.m_visibleChunkCount;
235  }
236  }
237  }
238  }
239 
240  // Climb the hierarchy
241  chunkIndex = parentChunkIndex;
242  chunkActorIndex = parentChunkActorIndex;
243  } while (chunkIndex != invalidIndex<uint32_t>());
244 }
245 
246 } // namespace Blast
247 } // namespace Nv
248 
249 
250 #endif // ifndef NVBLASTCHUNKHIERARCHY_H
+Go to the documentation of this file.
1 // This code contains NVIDIA Confidential Information and is disclosed to you
2 // under a form of NVIDIA software license agreement provided separately to you.
3 //
4 // Notice
5 // NVIDIA Corporation and its licensors retain all intellectual property and
6 // proprietary rights in and to this software and related documentation and
7 // any modifications thereto. Any use, reproduction, disclosure, or
8 // distribution of this software and related documentation without an express
9 // license agreement from NVIDIA Corporation is strictly prohibited.
10 //
11 // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12 // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15 //
16 // Information and code furnished is believed to be accurate and reliable.
17 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18 // information or for any infringement of patents or other rights of third parties that may
19 // result from its use. No license is granted by implication or otherwise under any patent
20 // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21 // This code supersedes and replaces all information previously supplied.
22 // NVIDIA Corporation products are not authorized for use as critical
23 // components in life support devices or systems without express written approval of
24 // NVIDIA Corporation.
25 //
26 // Copyright (c) 2016-2020 NVIDIA Corporation. All rights reserved.
27 
28 
29 #ifndef NVBLASTCHUNKHIERARCHY_H
30 #define NVBLASTCHUNKHIERARCHY_H
31 
32 
33 #include "NvBlastIndexFns.h"
34 #include "NvBlastDLink.h"
35 #include "NvBlast.h"
36 #include "NvBlastAssert.h"
37 #include "NvBlastIteratorBase.h"
38 
39 
40 namespace Nv
41 {
42 namespace Blast
43 {
44 
49 class ChunkDepthFirstIt : public IteratorBase<uint32_t>
50 {
51 public:
53  ChunkDepthFirstIt(const NvBlastChunk* chunks, uint32_t startChunkIndex, uint32_t chunkIndexLimit) :
54  IteratorBase<uint32_t>(startChunkIndex), m_chunks(chunks), m_stop(startChunkIndex), m_limit(chunkIndexLimit)
55  {
56  if (m_curr >= m_limit)
57  {
58  m_curr = invalidIndex<uint32_t>();
59  }
60  }
61 
63  uint32_t operator ++ ()
64  {
66  const NvBlastChunk* chunk = m_chunks + m_curr;
67  if (chunk->childIndexStop > chunk->firstChildIndex && chunk->firstChildIndex < m_limit)
68  {
69  m_curr = chunk->firstChildIndex;
70  }
71  else
72  {
73  for (;;)
74  {
75  if (m_curr == m_stop)
76  {
77  m_curr = invalidIndex<uint32_t>();
78  break;
79  }
80  NVBLAST_ASSERT(!isInvalidIndex(chunk->parentChunkIndex)); // This should not be possible with this search
81  const NvBlastChunk* parentChunk = m_chunks + chunk->parentChunkIndex;
82  if (++m_curr < parentChunk->childIndexStop)
83  {
84  break; // Sibling chunk is valid, that's the next chunk
85  }
86  m_curr = chunk->parentChunkIndex;
87  chunk = parentChunk;
88  }
89  }
90  return m_curr;
91  }
92 
93 private:
94  const NvBlastChunk* m_chunks;
95  uint32_t m_stop;
96  uint32_t m_limit;
97 };
98 
99 
106 (
107 uint32_t* chunkIndices,
108 uint32_t chunkIndicesSize,
109 const NvBlastChunk* chunks,
110 uint32_t chunkIndex,
111 bool includeRoot = true,
112 uint32_t chunkIndexLimit = invalidIndex<uint32_t>()
113 )
114 {
115  if (chunkIndicesSize == 0)
116  {
117  return 0;
118  }
119  uint32_t chunkIndexCount = 0;
120  bool rootHandled = false;
121  if (includeRoot)
122  {
123  chunkIndices[chunkIndexCount++] = chunkIndex;
124  rootHandled = true;
125  }
126  for (uint32_t curr = 0; !rootHandled || curr < chunkIndexCount;)
127  {
128  const NvBlastChunk& chunk = chunks[rootHandled ? chunkIndices[curr] : chunkIndex];
129  if (chunk.firstChildIndex < chunkIndexLimit)
130  {
131  const uint32_t childIndexStop = chunk.childIndexStop < chunkIndexLimit ? chunk.childIndexStop : chunkIndexLimit;
132  const uint32_t childIndexBufferStop = chunk.firstChildIndex + (chunkIndicesSize - chunkIndexCount);
133  const uint32_t stop = childIndexStop < childIndexBufferStop ? childIndexStop : childIndexBufferStop;
134  for (uint32_t childIndex = chunk.firstChildIndex; childIndex < stop; ++childIndex)
135  {
136  chunkIndices[chunkIndexCount++] = childIndex;
137  }
138  }
139  if (rootHandled)
140  {
141  ++curr;
142  }
143  rootHandled = true;
144  }
145  return chunkIndexCount;
146 }
147 
148 
152 template<class VisibilityRep>
154 (
155 VisibilityRep* actors,
156 IndexDLink<uint32_t>* visibleChunkIndexLinks,
157 uint32_t* chunkActorIndices,
158 uint32_t actorIndex,
159 uint32_t supportChunkIndex,
160 const NvBlastChunk* chunks,
161 uint32_t upperSupportChunkCount
162 )
163 {
164  uint32_t chunkIndex = supportChunkIndex;
165  uint32_t chunkActorIndex = chunkActorIndices[supportChunkIndex];
166  uint32_t newChunkActorIndex = actorIndex;
167  VisibilityRep& thisActor = actors[actorIndex];
168 
169  do
170  {
171  if (chunkActorIndex == newChunkActorIndex)
172  {
173  break; // Nothing to do
174  }
175 
176  const uint32_t parentChunkIndex = chunks[chunkIndex].parentChunkIndex;
177  const uint32_t parentChunkActorIndex = parentChunkIndex != invalidIndex<uint32_t>() ? chunkActorIndices[parentChunkIndex] : invalidIndex<uint32_t>();
178  const bool chunkVisible = chunkActorIndex != parentChunkActorIndex;
179 
180  // If the chunk is visible, it needs to be removed from its old actor's visibility list
181  if (chunkVisible && !isInvalidIndex(chunkActorIndex))
182  {
183  VisibilityRep& chunkActor = actors[chunkActorIndex];
184  IndexDList<uint32_t>().removeFromList(chunkActor.m_firstVisibleChunkIndex, visibleChunkIndexLinks, chunkIndex);
185  --chunkActor.m_visibleChunkCount;
186  }
187 
188  // Now update the chunk's actor index
189  const uint32_t oldChunkActorIndex = chunkActorIndices[chunkIndex];
190  chunkActorIndices[chunkIndex] = newChunkActorIndex;
191  if (newChunkActorIndex != invalidIndex<uint32_t>() && parentChunkActorIndex != newChunkActorIndex)
192  {
193  // The chunk is now visible. Add it to this actor's visibility list
194  IndexDList<uint32_t>().insertListHead(thisActor.m_firstVisibleChunkIndex, visibleChunkIndexLinks, chunkIndex);
195  ++thisActor.m_visibleChunkCount;
196  // Remove its children from this actor's visibility list
197  if (actorIndex != oldChunkActorIndex)
198  {
199  const NvBlastChunk& chunk = chunks[chunkIndex];
200  if (chunk.firstChildIndex < upperSupportChunkCount) // Only need to deal with upper-support children
201  {
202  for (uint32_t childChunkIndex = chunk.firstChildIndex; childChunkIndex < chunk.childIndexStop; ++childChunkIndex)
203  {
204  if (chunkActorIndices[childChunkIndex] == actorIndex)
205  {
206  IndexDList<uint32_t>().removeFromList(thisActor.m_firstVisibleChunkIndex, visibleChunkIndexLinks, childChunkIndex);
207  --thisActor.m_visibleChunkCount;
208  }
209  }
210  }
211  }
212  }
213 
214  if (parentChunkIndex != invalidIndex<uint32_t>())
215  {
216  // If all of its siblings have the same index, then the parent will too. Otherwise, the parent will have an invalid index and its children will be visible
217  const NvBlastChunk& parentChunk = chunks[parentChunkIndex];
218  bool uniform = true;
219  for (uint32_t childChunkIndex = parentChunk.firstChildIndex; uniform && childChunkIndex < parentChunk.childIndexStop; ++childChunkIndex)
220  {
221  uniform = (newChunkActorIndex == chunkActorIndices[childChunkIndex]);
222  }
223  if (!uniform)
224  {
225  newChunkActorIndex = invalidIndex<uint32_t>();
226  for (uint32_t childChunkIndex = parentChunk.firstChildIndex; childChunkIndex < parentChunk.childIndexStop; ++childChunkIndex)
227  {
228  const uint32_t childChunkActorIndex = chunkActorIndices[childChunkIndex];
229  if (childChunkActorIndex != invalidIndex<uint32_t>() && childChunkActorIndex == parentChunkActorIndex)
230  {
231  // The child was invisible. Add it to its actor's visibility list
232  VisibilityRep& childChunkActor = actors[childChunkActorIndex];
233  IndexDList<uint32_t>().insertListHead(childChunkActor.m_firstVisibleChunkIndex, visibleChunkIndexLinks, childChunkIndex);
234  ++childChunkActor.m_visibleChunkCount;
235  }
236  }
237  }
238  }
239 
240  // Climb the hierarchy
241  chunkIndex = parentChunkIndex;
242  chunkActorIndex = parentChunkActorIndex;
243  } while (chunkIndex != invalidIndex<uint32_t>());
244 }
245 
246 } // namespace Blast
247 } // namespace Nv
248 
249 
250 #endif // ifndef NVBLASTCHUNKHIERARCHY_H
ChunkDepthFirstIt(const NvBlastChunk *chunks, uint32_t startChunkIndex, uint32_t chunkIndexLimit)
Definition: NvBlastChunkHierarchy.h:53
Definition: NvBlastChunkHierarchy.h:49
uint32_t m_curr
Definition: NvBlastIteratorBase.h:58
diff --git a/docs/source_docs/files/_nv_blast_d_link_8h_source.html b/docs/source_docs/files/_nv_blast_d_link_8h_source.html index 0c79248..f15189d 100755 --- a/docs/source_docs/files/_nv_blast_d_link_8h_source.html +++ b/docs/source_docs/files/_nv_blast_d_link_8h_source.html @@ -46,7 +46,7 @@ $(document).ready(function(){initNavTree('_nv_blast_d_link_8h_source.html','');}
NvBlastDLink.h
-Go to the documentation of this file.
1 // This code contains NVIDIA Confidential Information and is disclosed to you
2 // under a form of NVIDIA software license agreement provided separately to you.
3 //
4 // Notice
5 // NVIDIA Corporation and its licensors retain all intellectual property and
6 // proprietary rights in and to this software and related documentation and
7 // any modifications thereto. Any use, reproduction, disclosure, or
8 // distribution of this software and related documentation without an express
9 // license agreement from NVIDIA Corporation is strictly prohibited.
10 //
11 // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12 // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15 //
16 // Information and code furnished is believed to be accurate and reliable.
17 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18 // information or for any infringement of patents or other rights of third parties that may
19 // result from its use. No license is granted by implication or otherwise under any patent
20 // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21 // This code supersedes and replaces all information previously supplied.
22 // NVIDIA Corporation products are not authorized for use as critical
23 // components in life support devices or systems without express written approval of
24 // NVIDIA Corporation.
25 //
26 // Copyright (c) 2016-2018 NVIDIA Corporation. All rights reserved.
27 
28 
29 #ifndef NVBLASTDLINK_H
30 #define NVBLASTDLINK_H
31 
32 
33 #include "NvBlastAssert.h"
34 #include "NvBlastIndexFns.h"
35 
36 
37 namespace Nv
38 {
39 namespace Blast
40 {
41 
42 template<typename IndexType>
43 struct IndexDLink
44 {
45  IndexType m_adj[2];
46 };
47 
48 
49 template<typename IndexType>
51 {
52 public:
53  void initLinksSolitary(IndexDLink<IndexType>* links, IndexType linkCount)
54  {
55  for (IndexType i = 0; i < linkCount; ++i)
56  {
57  links[i].m_adj[0] = invalidIndex<IndexType>();
58  links[i].m_adj[1] = invalidIndex<IndexType>();
59  }
60  }
61 
62  void initLinksChain(IndexDLink<IndexType>* links, IndexType linkCount)
63  {
64  if (linkCount > 0)
65  {
66  links[0].m_adj[0] = invalidIndex<IndexType>();
67  for (IndexType i = 1; i < linkCount; ++i)
68  {
69  links[i - 1].m_adj[1] = i;
70  links[i].m_adj[0] = i - 1;
71  }
72  links[linkCount - 1].m_adj[1] = invalidIndex<IndexType>();
73  }
74  }
75 
76  IndexType getAdj(IndexDLink<IndexType>* links, IndexType linkIndex, int which)
77  {
78  return links[linkIndex].m_adj[which & 1];
79  }
80 
81  void remove(IndexDLink<IndexType>* links, IndexType linkIndex)
82  {
83  IndexDLink<IndexType>& link = links[linkIndex];
84  const IndexType adj0 = link.m_adj[0];
85  const IndexType adj1 = link.m_adj[1];
86  if (!isInvalidIndex(adj1))
87  {
88  links[adj1].m_adj[0] = adj0;
89  link.m_adj[1] = invalidIndex<IndexType>();
90  }
91  if (!isInvalidIndex(adj0))
92  {
93  links[adj0].m_adj[1] = adj1;
94  link.m_adj[0] = invalidIndex<IndexType>();
95  }
96  }
97 
98  bool isSolitary(IndexDLink<IndexType>* links, IndexType linkIndex)
99  {
100  const IndexDLink<IndexType>& link = links[linkIndex];
101  return isInvalidIndex(link.m_adj[0]) && isInvalidIndex(link.m_adj[1]);
102  }
103 
104  void insertListHead(IndexType& listHead, IndexDLink<IndexType>* links, IndexType linkIndex)
105  {
106  NVBLAST_ASSERT(!isInvalidIndex(linkIndex));
107  if (!isInvalidIndex(listHead))
108  {
109  links[listHead].m_adj[0] = linkIndex;
110  }
111  links[linkIndex].m_adj[1] = listHead;
112  listHead = linkIndex;
113  }
114 
115  IndexType removeListHead(IndexType& listHead, IndexDLink<IndexType>* links)
116  {
117  const IndexType linkIndex = listHead;
118  if (!isInvalidIndex(linkIndex))
119  {
120  listHead = links[linkIndex].m_adj[1];
121  if (!isInvalidIndex(listHead))
122  {
123  links[listHead].m_adj[0] = invalidIndex<IndexType>();
124  }
125  links[linkIndex].m_adj[1] = invalidIndex<IndexType>();
126  }
127  return linkIndex;
128  }
129 
130  void removeFromList(IndexType& listHead, IndexDLink<IndexType>* links, IndexType linkIndex)
131  {
132  NVBLAST_ASSERT(!isInvalidIndex(linkIndex));
133  if (listHead == linkIndex)
134  {
135  listHead = links[linkIndex].m_adj[1];
136  }
137  remove(links, linkIndex);
138  }
139 };
140 
141 
142 struct DLink
143 {
144  DLink() : m_prev(nullptr), m_next(nullptr) {}
145 
146  DLink* getPrev() const
147  {
148  return m_prev;
149  }
150 
151  DLink* getNext() const
152  {
153  return m_next;
154  }
155 
156 private:
157  DLink* m_prev;
158  DLink* m_next;
159 
160  friend class DList;
161 };
162 
163 
164 class DList
165 {
166 public:
167  DList() : m_head(nullptr), m_tail(nullptr) {}
168 
169  bool isEmpty() const
170  {
171  NVBLAST_ASSERT((m_head == nullptr) == (m_tail == nullptr));
172  return m_head == nullptr;
173  }
174 
175  bool isSolitary(const DLink& link) const
176  {
177  return link.m_prev == nullptr && link.m_next == nullptr && m_head != &link;
178  }
179 
180  DLink* getHead() const
181  {
182  return m_head;
183  }
184 
185  DLink* getTail() const
186  {
187  return m_tail;
188  }
189 
190  bool insertHead(DLink& link)
191  {
192  NVBLAST_ASSERT(isSolitary(link));
193  if (!isSolitary(link))
194  {
195  return false;
196  }
197 
198  link.m_next = m_head;
199  if (m_head != nullptr)
200  {
201  m_head->m_prev = &link;
202  }
203  m_head = &link;
204  if (m_tail == nullptr)
205  {
206  m_tail = &link;
207  }
208 
209  return true;
210  }
211 
212  bool insertTail(DLink& link)
213  {
214  NVBLAST_ASSERT(isSolitary(link));
215  if (!isSolitary(link))
216  {
217  return false;
218  }
219 
220  link.m_prev = m_tail;
221  if (m_tail != nullptr)
222  {
223  m_tail->m_next = &link;
224  }
225  m_tail = &link;
226  if (m_head == nullptr)
227  {
228  m_head = &link;
229  }
230 
231  return true;
232  }
233 
234  void remove(DLink& link)
235  {
236  if (link.m_prev != nullptr)
237  {
238  link.m_prev->m_next = link.m_next;
239  }
240  else
241  if (m_head == &link)
242  {
243  m_head = link.m_next;
244  }
245 
246  if (link.m_next != nullptr)
247  {
248  link.m_next->m_prev = link.m_prev;
249  }
250  else
251  if (m_tail == &link)
252  {
253  m_tail = link.m_prev;
254  }
255 
256  link.m_next = link.m_prev = nullptr;
257  }
258 
259  class It
260  {
261  public:
262  enum Direction { Reverse, Forward };
263 
264  It(const DList& list, Direction dir = Forward) : m_curr(dir == Forward ? list.getHead() : list.getTail()) {}
265 
267  operator bool() const
268  {
269  return m_curr != nullptr;
270  }
271 
273  operator const DLink*() const
274  {
275  return m_curr;
276  }
277 
279  const DLink* operator ++ ()
280  {
281  return m_curr = m_curr->getNext();
282  }
283 
285  const DLink* operator -- ()
286  {
287  return m_curr = m_curr->getPrev();
288  }
289 
290  private:
291  const DLink* m_curr;
292  };
293 
294 private:
295  DLink* m_head;
296  DLink* m_tail;
297 };
298 
299 } // end namespace Blast
300 } // end namespace Nv
301 
302 
303 #endif // #ifndef NVBLASTDLINK_H
DList()
Definition: NvBlastDLink.h:167
+Go to the documentation of this file.
1 // This code contains NVIDIA Confidential Information and is disclosed to you
2 // under a form of NVIDIA software license agreement provided separately to you.
3 //
4 // Notice
5 // NVIDIA Corporation and its licensors retain all intellectual property and
6 // proprietary rights in and to this software and related documentation and
7 // any modifications thereto. Any use, reproduction, disclosure, or
8 // distribution of this software and related documentation without an express
9 // license agreement from NVIDIA Corporation is strictly prohibited.
10 //
11 // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12 // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15 //
16 // Information and code furnished is believed to be accurate and reliable.
17 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18 // information or for any infringement of patents or other rights of third parties that may
19 // result from its use. No license is granted by implication or otherwise under any patent
20 // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21 // This code supersedes and replaces all information previously supplied.
22 // NVIDIA Corporation products are not authorized for use as critical
23 // components in life support devices or systems without express written approval of
24 // NVIDIA Corporation.
25 //
26 // Copyright (c) 2016-2020 NVIDIA Corporation. All rights reserved.
27 
28 
29 #ifndef NVBLASTDLINK_H
30 #define NVBLASTDLINK_H
31 
32 
33 #include "NvBlastAssert.h"
34 #include "NvBlastIndexFns.h"
35 
36 
37 namespace Nv
38 {
39 namespace Blast
40 {
41 
42 template<typename IndexType>
43 struct IndexDLink
44 {
45  IndexType m_adj[2];
46 };
47 
48 
49 template<typename IndexType>
51 {
52 public:
53  void initLinksSolitary(IndexDLink<IndexType>* links, IndexType linkCount)
54  {
55  for (IndexType i = 0; i < linkCount; ++i)
56  {
57  links[i].m_adj[0] = invalidIndex<IndexType>();
58  links[i].m_adj[1] = invalidIndex<IndexType>();
59  }
60  }
61 
62  void initLinksChain(IndexDLink<IndexType>* links, IndexType linkCount)
63  {
64  if (linkCount > 0)
65  {
66  links[0].m_adj[0] = invalidIndex<IndexType>();
67  for (IndexType i = 1; i < linkCount; ++i)
68  {
69  links[i - 1].m_adj[1] = i;
70  links[i].m_adj[0] = i - 1;
71  }
72  links[linkCount - 1].m_adj[1] = invalidIndex<IndexType>();
73  }
74  }
75 
76  IndexType getAdj(IndexDLink<IndexType>* links, IndexType linkIndex, int which)
77  {
78  return links[linkIndex].m_adj[which & 1];
79  }
80 
81  void remove(IndexDLink<IndexType>* links, IndexType linkIndex)
82  {
83  IndexDLink<IndexType>& link = links[linkIndex];
84  const IndexType adj0 = link.m_adj[0];
85  const IndexType adj1 = link.m_adj[1];
86  if (!isInvalidIndex(adj1))
87  {
88  links[adj1].m_adj[0] = adj0;
89  link.m_adj[1] = invalidIndex<IndexType>();
90  }
91  if (!isInvalidIndex(adj0))
92  {
93  links[adj0].m_adj[1] = adj1;
94  link.m_adj[0] = invalidIndex<IndexType>();
95  }
96  }
97 
98  bool isSolitary(IndexDLink<IndexType>* links, IndexType linkIndex)
99  {
100  const IndexDLink<IndexType>& link = links[linkIndex];
101  return isInvalidIndex(link.m_adj[0]) && isInvalidIndex(link.m_adj[1]);
102  }
103 
104  void insertListHead(IndexType& listHead, IndexDLink<IndexType>* links, IndexType linkIndex)
105  {
106  NVBLAST_ASSERT(!isInvalidIndex(linkIndex));
107  if (!isInvalidIndex(listHead))
108  {
109  links[listHead].m_adj[0] = linkIndex;
110  }
111  links[linkIndex].m_adj[1] = listHead;
112  listHead = linkIndex;
113  }
114 
115  IndexType removeListHead(IndexType& listHead, IndexDLink<IndexType>* links)
116  {
117  const IndexType linkIndex = listHead;
118  if (!isInvalidIndex(linkIndex))
119  {
120  listHead = links[linkIndex].m_adj[1];
121  if (!isInvalidIndex(listHead))
122  {
123  links[listHead].m_adj[0] = invalidIndex<IndexType>();
124  }
125  links[linkIndex].m_adj[1] = invalidIndex<IndexType>();
126  }
127  return linkIndex;
128  }
129 
130  void removeFromList(IndexType& listHead, IndexDLink<IndexType>* links, IndexType linkIndex)
131  {
132  NVBLAST_ASSERT(!isInvalidIndex(linkIndex));
133  if (listHead == linkIndex)
134  {
135  listHead = links[linkIndex].m_adj[1];
136  }
137  remove(links, linkIndex);
138  }
139 };
140 
141 
142 struct DLink
143 {
144  DLink() : m_prev(nullptr), m_next(nullptr) {}
145 
146  DLink* getPrev() const
147  {
148  return m_prev;
149  }
150 
151  DLink* getNext() const
152  {
153  return m_next;
154  }
155 
156 private:
157  DLink* m_prev;
158  DLink* m_next;
159 
160  friend class DList;
161 };
162 
163 
164 class DList
165 {
166 public:
167  DList() : m_head(nullptr), m_tail(nullptr) {}
168 
169  bool isEmpty() const
170  {
171  NVBLAST_ASSERT((m_head == nullptr) == (m_tail == nullptr));
172  return m_head == nullptr;
173  }
174 
175  bool isSolitary(const DLink& link) const
176  {
177  return link.m_prev == nullptr && link.m_next == nullptr && m_head != &link;
178  }
179 
180  DLink* getHead() const
181  {
182  return m_head;
183  }
184 
185  DLink* getTail() const
186  {
187  return m_tail;
188  }
189 
190  bool insertHead(DLink& link)
191  {
192  NVBLAST_ASSERT(isSolitary(link));
193  if (!isSolitary(link))
194  {
195  return false;
196  }
197 
198  link.m_next = m_head;
199  if (m_head != nullptr)
200  {
201  m_head->m_prev = &link;
202  }
203  m_head = &link;
204  if (m_tail == nullptr)
205  {
206  m_tail = &link;
207  }
208 
209  return true;
210  }
211 
212  bool insertTail(DLink& link)
213  {
214  NVBLAST_ASSERT(isSolitary(link));
215  if (!isSolitary(link))
216  {
217  return false;
218  }
219 
220  link.m_prev = m_tail;
221  if (m_tail != nullptr)
222  {
223  m_tail->m_next = &link;
224  }
225  m_tail = &link;
226  if (m_head == nullptr)
227  {
228  m_head = &link;
229  }
230 
231  return true;
232  }
233 
234  void remove(DLink& link)
235  {
236  if (link.m_prev != nullptr)
237  {
238  link.m_prev->m_next = link.m_next;
239  }
240  else
241  if (m_head == &link)
242  {
243  m_head = link.m_next;
244  }
245 
246  if (link.m_next != nullptr)
247  {
248  link.m_next->m_prev = link.m_prev;
249  }
250  else
251  if (m_tail == &link)
252  {
253  m_tail = link.m_prev;
254  }
255 
256  link.m_next = link.m_prev = nullptr;
257  }
258 
259  class It
260  {
261  public:
262  enum Direction { Reverse, Forward };
263 
264  It(const DList& list, Direction dir = Forward) : m_curr(dir == Forward ? list.getHead() : list.getTail()) {}
265 
267  operator bool() const
268  {
269  return m_curr != nullptr;
270  }
271 
273  operator const DLink*() const
274  {
275  return m_curr;
276  }
277 
279  const DLink* operator ++ ()
280  {
281  return m_curr = m_curr->getNext();
282  }
283 
285  const DLink* operator -- ()
286  {
287  return m_curr = m_curr->getPrev();
288  }
289 
290  private:
291  const DLink* m_curr;
292  };
293 
294 private:
295  DLink* m_head;
296  DLink* m_tail;
297 };
298 
299 } // end namespace Blast
300 } // end namespace Nv
301 
302 
303 #endif // #ifndef NVBLASTDLINK_H
DList()
Definition: NvBlastDLink.h:167
bool insertTail(DLink &link)
Definition: NvBlastDLink.h:212
diff --git a/docs/source_docs/files/_nv_blast_debug_render_8h_source.html b/docs/source_docs/files/_nv_blast_debug_render_8h_source.html index 0dc15f3..06cd429 100755 --- a/docs/source_docs/files/_nv_blast_debug_render_8h_source.html +++ b/docs/source_docs/files/_nv_blast_debug_render_8h_source.html @@ -46,7 +46,7 @@ $(document).ready(function(){initNavTree('_nv_blast_debug_render_8h_source.html'
NvBlastDebugRender.h
-Go to the documentation of this file.
1 // This code contains NVIDIA Confidential Information and is disclosed to you
2 // under a form of NVIDIA software license agreement provided separately to you.
3 //
4 // Notice
5 // NVIDIA Corporation and its licensors retain all intellectual property and
6 // proprietary rights in and to this software and related documentation and
7 // any modifications thereto. Any use, reproduction, disclosure, or
8 // distribution of this software and related documentation without an express
9 // license agreement from NVIDIA Corporation is strictly prohibited.
10 //
11 // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12 // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15 //
16 // Information and code furnished is believed to be accurate and reliable.
17 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18 // information or for any infringement of patents or other rights of third parties that may
19 // result from its use. No license is granted by implication or otherwise under any patent
20 // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21 // This code supersedes and replaces all information previously supplied.
22 // NVIDIA Corporation products are not authorized for use as critical
23 // components in life support devices or systems without express written approval of
24 // NVIDIA Corporation.
25 //
26 // Copyright (c) 2016-2018 NVIDIA Corporation. All rights reserved.
27 
28 #pragma once
29 
30 #include <NvCTypes.h>
31 
32 namespace Nv
33 {
34 namespace Blast
35 {
36 
37 
41 struct DebugLine
42 {
43  DebugLine(const NvcVec3& p0, const NvcVec3& p1, uint32_t c)
44  : pos0(p0), color0(c), pos1(p1), color1(c) {}
45 
47  uint32_t color0;
49  uint32_t color1;
50 };
51 
52 
57 {
58  const DebugLine* lines;
59  uint32_t lineCount;
60 };
61 
62 
63 } // namespace Blast
64 } // namespace Nv
DebugLine(const NvcVec3 &p0, const NvcVec3 &p1, uint32_t c)
Definition: NvBlastDebugRender.h:43
+Go to the documentation of this file.
1 // This code contains NVIDIA Confidential Information and is disclosed to you
2 // under a form of NVIDIA software license agreement provided separately to you.
3 //
4 // Notice
5 // NVIDIA Corporation and its licensors retain all intellectual property and
6 // proprietary rights in and to this software and related documentation and
7 // any modifications thereto. Any use, reproduction, disclosure, or
8 // distribution of this software and related documentation without an express
9 // license agreement from NVIDIA Corporation is strictly prohibited.
10 //
11 // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12 // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15 //
16 // Information and code furnished is believed to be accurate and reliable.
17 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18 // information or for any infringement of patents or other rights of third parties that may
19 // result from its use. No license is granted by implication or otherwise under any patent
20 // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21 // This code supersedes and replaces all information previously supplied.
22 // NVIDIA Corporation products are not authorized for use as critical
23 // components in life support devices or systems without express written approval of
24 // NVIDIA Corporation.
25 //
26 // Copyright (c) 2016-2020 NVIDIA Corporation. All rights reserved.
27 
28 #pragma once
29 
30 #include <NvCTypes.h>
31 
32 namespace Nv
33 {
34 namespace Blast
35 {
36 
37 
41 struct DebugLine
42 {
43  DebugLine(const NvcVec3& p0, const NvcVec3& p1, uint32_t c)
44  : pos0(p0), color0(c), pos1(p1), color1(c) {}
45 
47  uint32_t color0;
49  uint32_t color1;
50 };
51 
52 
57 {
58  const DebugLine* lines;
59  uint32_t lineCount;
60 };
61 
62 
63 } // namespace Blast
64 } // namespace Nv
DebugLine(const NvcVec3 &p0, const NvcVec3 &p1, uint32_t c)
Definition: NvBlastDebugRender.h:43
uint32_t lineCount
Definition: NvBlastDebugRender.h:59
Definition: NvBlastDebugRender.h:56
Definition: NvBlastDebugRender.h:41
diff --git a/docs/source_docs/files/_nv_blast_ext_apex_import_tool_8h_source.html b/docs/source_docs/files/_nv_blast_ext_apex_import_tool_8h_source.html index 169c88d..ccf0960 100755 --- a/docs/source_docs/files/_nv_blast_ext_apex_import_tool_8h_source.html +++ b/docs/source_docs/files/_nv_blast_ext_apex_import_tool_8h_source.html @@ -46,7 +46,7 @@ $(document).ready(function(){initNavTree('_nv_blast_ext_apex_import_tool_8h_sour
NvBlastExtApexImportTool.h
-Go to the documentation of this file.
1 // This code contains NVIDIA Confidential Information and is disclosed to you
2 // under a form of NVIDIA software license agreement provided separately to you.
3 //
4 // Notice
5 // NVIDIA Corporation and its licensors retain all intellectual property and
6 // proprietary rights in and to this software and related documentation and
7 // any modifications thereto. Any use, reproduction, disclosure, or
8 // distribution of this software and related documentation without an express
9 // license agreement from NVIDIA Corporation is strictly prohibited.
10 //
11 // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12 // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15 //
16 // Information and code furnished is believed to be accurate and reliable.
17 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18 // information or for any infringement of patents or other rights of third parties that may
19 // result from its use. No license is granted by implication or otherwise under any patent
20 // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21 // This code supersedes and replaces all information previously supplied.
22 // NVIDIA Corporation products are not authorized for use as critical
23 // components in life support devices or systems without express written approval of
24 // NVIDIA Corporation.
25 //
26 // Copyright (c) 2016-2018 NVIDIA Corporation. All rights reserved.
27 
28 
29 #ifndef NVBLASTEXTAPEXIMPORTTOOL_H
30 #define NVBLASTEXTAPEXIMPORTTOOL_H
31 
32 #include "NvBlast.h"
33 #include <vector>
34 #include <string>
35 #include "NvBlastExtPxAsset.h"
37 #include <nvparameterized\NvSerializer.h>
38 #include <NvBlastExtExporter.h>
39 
40 namespace physx
41 {
42  class PxFoundation;
43  class PxPhysics;
44  class PxCooking;
45 
46 namespace general_PxIOStream2
47 {
48 class PxFileBuf;
49 }
50 }
51 
52 namespace NvParameterized
53 {
54  class Interface;
55 }
56 
57 namespace nvidia
58 {
59 namespace apex
60 {
61 class ApexSDK;
62 class ModuleDestructible;
63 class DestructibleAsset;
64 }
65 using namespace physx::general_PxIOStream2;
66 }
67 
68 
69 namespace Nv
70 {
71 namespace Blast
72 {
73 
74 struct CollisionHull;
75 class TkFramework;
76 
77 namespace ApexImporter
78 {
79 
81 {
91  enum InterfaceSearchMode { EXACT, FORCED, MODE_COUNT };
92 
94  {
95  setDefaults();
96  }
97 
98  void setDefaults()
99  {
100  infSearchMode = EXACT;
101  }
103 };
104 
105 
106 class ApexDestruction;
107 
108 
113 {
114 public:
115  ApexImportTool();
116  ~ApexImportTool();
117 
123  bool loadAssetFromFile(nvidia::PxFileBuf* stream, NvParameterized::Serializer::DeserializedData& data);
124 
125 
136  bool importApexAsset(std::vector<uint32_t>& chunkReorderInvMap, NvParameterized::Interface* assetNvIfc,
137  std::vector<NvBlastChunkDesc>& chunkDescriptors, std::vector<NvBlastBondDesc>& bondDescriptors, std::vector<uint32_t>& flags);
138 
150  bool importApexAsset(std::vector<uint32_t>& chunkReorderInvMap, NvParameterized::Interface* assetNvIfc,
151  std::vector<NvBlastChunkDesc>& chunkDescriptors, std::vector<NvBlastBondDesc>& bondDescriptors, std::vector<uint32_t>& flags,
152  const ApexImporterConfig& config);
153 
157  bool importRendermesh(const std::vector<uint32_t>& chunkReorderInvMap, const NvParameterized::Interface* assetNvIfc, Nv::Blast::ExporterMeshData* outputData, const char* materialsDir);
158 
159 
166  bool saveAsset(const NvBlastAsset* asset, nvidia::PxFileBuf* stream);
167 
179  bool getCollisionGeometry(const NvParameterized::Interface* assetPrm, uint32_t chunkCount, std::vector<uint32_t>& chunkReorderInvMap,
180  const std::vector<uint32_t>& apexChunkFlags, std::vector<ExtPxAssetDesc::ChunkDesc>& physicsChunks,
181  std::vector<ExtPxAssetDesc::SubchunkDesc>& physicsSubchunks, std::vector<std::vector<CollisionHull*> >& hullsDesc);
182 
184  {
185  return m_collisionBuilder;
186  }
187 
189 
190  bool isValid();
191 
192  physx::PxPhysics* getPxSdk() { return m_PhysxSDK; }
193  physx::PxCooking* getCooking() { return m_Cooking; };
194 
195 private:
196  bool importApexAssetInternal(std::vector<uint32_t>& chunkReorderInvMap, NvParameterized::Interface* assetNvIfc,
197  std::vector<NvBlastChunkDesc>& chunkDescriptors, std::vector<NvBlastBondDesc>& bondDesc, std::vector<uint32_t>& flags,
198  const ApexImporterConfig& configDesc);
199 
200 protected:
202  ApexImportTool& operator=(const ApexImportTool&);
203 
204  physx::PxFoundation* m_Foundation;
205  physx::PxPhysics* m_PhysxSDK;
206  physx::PxCooking* m_Cooking;
207 
209 };
210 
211 } // namespace ApexImporter
212 
213 } // namespace Blast
214 } // namespace Nv
215 
216 #endif // NVBLASTEXTAPEXIMPORTTOOL_H
Definition: NvBlastExtApexSharedParts.h:34
+Go to the documentation of this file.
1 // This code contains NVIDIA Confidential Information and is disclosed to you
2 // under a form of NVIDIA software license agreement provided separately to you.
3 //
4 // Notice
5 // NVIDIA Corporation and its licensors retain all intellectual property and
6 // proprietary rights in and to this software and related documentation and
7 // any modifications thereto. Any use, reproduction, disclosure, or
8 // distribution of this software and related documentation without an express
9 // license agreement from NVIDIA Corporation is strictly prohibited.
10 //
11 // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12 // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15 //
16 // Information and code furnished is believed to be accurate and reliable.
17 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18 // information or for any infringement of patents or other rights of third parties that may
19 // result from its use. No license is granted by implication or otherwise under any patent
20 // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21 // This code supersedes and replaces all information previously supplied.
22 // NVIDIA Corporation products are not authorized for use as critical
23 // components in life support devices or systems without express written approval of
24 // NVIDIA Corporation.
25 //
26 // Copyright (c) 2016-2020 NVIDIA Corporation. All rights reserved.
27 
28 
29 #ifndef NVBLASTEXTAPEXIMPORTTOOL_H
30 #define NVBLASTEXTAPEXIMPORTTOOL_H
31 
32 #include "NvBlast.h"
33 #include <vector>
34 #include <string>
35 #include "NvBlastExtPxAsset.h"
37 #include <nvparameterized\NvSerializer.h>
38 #include <NvBlastExtExporter.h>
39 
40 namespace physx
41 {
42  class PxFoundation;
43  class PxPhysics;
44  class PxCooking;
45 
46 namespace general_PxIOStream2
47 {
48 class PxFileBuf;
49 }
50 }
51 
52 namespace NvParameterized
53 {
54  class Interface;
55 }
56 
57 namespace nvidia
58 {
59 namespace apex
60 {
61 class ApexSDK;
62 class ModuleDestructible;
63 class DestructibleAsset;
64 }
65 using namespace physx::general_PxIOStream2;
66 }
67 
68 
69 namespace Nv
70 {
71 namespace Blast
72 {
73 
74 struct CollisionHull;
75 class TkFramework;
76 
77 namespace ApexImporter
78 {
79 
81 {
91  enum InterfaceSearchMode { EXACT, FORCED, MODE_COUNT };
92 
94  {
95  setDefaults();
96  }
97 
98  void setDefaults()
99  {
100  infSearchMode = EXACT;
101  }
103 };
104 
105 
106 class ApexDestruction;
107 
108 
113 {
114 public:
115  ApexImportTool();
116  ~ApexImportTool();
117 
123  bool loadAssetFromFile(nvidia::PxFileBuf* stream, NvParameterized::Serializer::DeserializedData& data);
124 
125 
136  bool importApexAsset(std::vector<uint32_t>& chunkReorderInvMap, NvParameterized::Interface* assetNvIfc,
137  std::vector<NvBlastChunkDesc>& chunkDescriptors, std::vector<NvBlastBondDesc>& bondDescriptors, std::vector<uint32_t>& flags);
138 
150  bool importApexAsset(std::vector<uint32_t>& chunkReorderInvMap, NvParameterized::Interface* assetNvIfc,
151  std::vector<NvBlastChunkDesc>& chunkDescriptors, std::vector<NvBlastBondDesc>& bondDescriptors, std::vector<uint32_t>& flags,
152  const ApexImporterConfig& config);
153 
157  bool importRendermesh(const std::vector<uint32_t>& chunkReorderInvMap, const NvParameterized::Interface* assetNvIfc, Nv::Blast::ExporterMeshData* outputData, const char* materialsDir);
158 
159 
166  bool saveAsset(const NvBlastAsset* asset, nvidia::PxFileBuf* stream);
167 
179  bool getCollisionGeometry(const NvParameterized::Interface* assetPrm, uint32_t chunkCount, std::vector<uint32_t>& chunkReorderInvMap,
180  const std::vector<uint32_t>& apexChunkFlags, std::vector<ExtPxAssetDesc::ChunkDesc>& physicsChunks,
181  std::vector<ExtPxAssetDesc::SubchunkDesc>& physicsSubchunks, std::vector<std::vector<CollisionHull*> >& hullsDesc);
182 
184  {
185  return m_collisionBuilder;
186  }
187 
189 
190  bool isValid();
191 
192  physx::PxPhysics* getPxSdk() { return m_PhysxSDK; }
193  physx::PxCooking* getCooking() { return m_Cooking; };
194 
195 private:
196  bool importApexAssetInternal(std::vector<uint32_t>& chunkReorderInvMap, NvParameterized::Interface* assetNvIfc,
197  std::vector<NvBlastChunkDesc>& chunkDescriptors, std::vector<NvBlastBondDesc>& bondDesc, std::vector<uint32_t>& flags,
198  const ApexImporterConfig& configDesc);
199 
200 protected:
202  ApexImportTool& operator=(const ApexImportTool&);
203 
204  physx::PxFoundation* m_Foundation;
205  physx::PxPhysics* m_PhysxSDK;
206  physx::PxCooking* m_Cooking;
207 
209 };
210 
211 } // namespace ApexImporter
212 
213 } // namespace Blast
214 } // namespace Nv
215 
216 #endif // NVBLASTEXTAPEXIMPORTTOOL_H
Definition: NvBlastExtApexSharedParts.h:34
ApexImporterConfig()
Definition: NvBlastExtApexImportTool.h:93
InterfaceSearchMode infSearchMode
Definition: NvBlastExtApexImportTool.h:102
diff --git a/docs/source_docs/files/_nv_blast_ext_apex_shared_parts_8h_source.html b/docs/source_docs/files/_nv_blast_ext_apex_shared_parts_8h_source.html index 2ba927f..7c38ec5 100755 --- a/docs/source_docs/files/_nv_blast_ext_apex_shared_parts_8h_source.html +++ b/docs/source_docs/files/_nv_blast_ext_apex_shared_parts_8h_source.html @@ -46,7 +46,7 @@ $(document).ready(function(){initNavTree('_nv_blast_ext_apex_shared_parts_8h_sou
NvBlastExtApexSharedParts.h
-Go to the documentation of this file.
1 // This code contains NVIDIA Confidential Information and is disclosed to you
2 // under a form of NVIDIA software license agreement provided separately to you.
3 //
4 // Notice
5 // NVIDIA Corporation and its licensors retain all intellectual property and
6 // proprietary rights in and to this software and related documentation and
7 // any modifications thereto. Any use, reproduction, disclosure, or
8 // distribution of this software and related documentation without an express
9 // license agreement from NVIDIA Corporation is strictly prohibited.
10 //
11 // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12 // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15 //
16 // Information and code furnished is believed to be accurate and reliable.
17 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18 // information or for any infringement of patents or other rights of third parties that may
19 // result from its use. No license is granted by implication or otherwise under any patent
20 // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21 // This code supersedes and replaces all information previously supplied.
22 // NVIDIA Corporation products are not authorized for use as critical
23 // components in life support devices or systems without express written approval of
24 // NVIDIA Corporation.
25 //
26 // Copyright (c) 2016-2018 NVIDIA Corporation. All rights reserved.
27 
28 
29 #ifndef NVBLASTEXTAPEXSHAREDPARTS_H
30 #define NVBLASTEXTAPEXSHAREDPARTS_H
31 
32 #include "NvBlast.h"
33 #include <PxPlane.h>
34 namespace physx
35 {
36  class PxVec3;
37  class PxTransform;
38  class PxBounds3;
39 }
40 
41 namespace Nv
42 {
43 namespace Blast
44 {
45 
46 struct Separation
47 {
48  physx::PxPlane plane;
49  float min0, max0, min1, max1;
50 
51  float getDistance()
52  {
53  return physx::PxMax(min0 - max1, min1 - max0);
54  }
55 };
56 
60 bool importerHullsInProximityApexFree( uint32_t hull0Count, const physx::PxVec3* hull0, physx::PxBounds3& hull0Bounds, const physx::PxTransform& localToWorldRT0In, const physx::PxVec3& scale0In,
61  uint32_t hull1Count, const physx::PxVec3* hull1, physx::PxBounds3& hull1Bounds, const physx::PxTransform& localToWorldRT1In, const physx::PxVec3& scale1In,
62  physx::PxF32 maxDistance, Separation* separation);
63 
64 } // namespace Blast
65 } // namespace Nv
66 
67 
68 #endif // NVBLASTEXTAPEXSHAREDPARTS_H
Definition: NvBlastExtApexSharedParts.h:34
+Go to the documentation of this file.
1 // This code contains NVIDIA Confidential Information and is disclosed to you
2 // under a form of NVIDIA software license agreement provided separately to you.
3 //
4 // Notice
5 // NVIDIA Corporation and its licensors retain all intellectual property and
6 // proprietary rights in and to this software and related documentation and
7 // any modifications thereto. Any use, reproduction, disclosure, or
8 // distribution of this software and related documentation without an express
9 // license agreement from NVIDIA Corporation is strictly prohibited.
10 //
11 // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12 // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15 //
16 // Information and code furnished is believed to be accurate and reliable.
17 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18 // information or for any infringement of patents or other rights of third parties that may
19 // result from its use. No license is granted by implication or otherwise under any patent
20 // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21 // This code supersedes and replaces all information previously supplied.
22 // NVIDIA Corporation products are not authorized for use as critical
23 // components in life support devices or systems without express written approval of
24 // NVIDIA Corporation.
25 //
26 // Copyright (c) 2016-2020 NVIDIA Corporation. All rights reserved.
27 
28 
29 #ifndef NVBLASTEXTAPEXSHAREDPARTS_H
30 #define NVBLASTEXTAPEXSHAREDPARTS_H
31 
32 #include "NvBlast.h"
33 #include <PxPlane.h>
34 namespace physx
35 {
36  class PxVec3;
37  class PxTransform;
38  class PxBounds3;
39 }
40 
41 namespace Nv
42 {
43 namespace Blast
44 {
45 
46 struct Separation
47 {
48  physx::PxPlane plane;
49  float min0, max0, min1, max1;
50 
51  float getDistance()
52  {
53  return physx::PxMax(min0 - max1, min1 - max0);
54  }
55 };
56 
60 bool importerHullsInProximityApexFree( uint32_t hull0Count, const physx::PxVec3* hull0, physx::PxBounds3& hull0Bounds, const physx::PxTransform& localToWorldRT0In, const physx::PxVec3& scale0In,
61  uint32_t hull1Count, const physx::PxVec3* hull1, physx::PxBounds3& hull1Bounds, const physx::PxTransform& localToWorldRT1In, const physx::PxVec3& scale1In,
62  physx::PxF32 maxDistance, Separation* separation);
63 
64 } // namespace Blast
65 } // namespace Nv
66 
67 
68 #endif // NVBLASTEXTAPEXSHAREDPARTS_H
Definition: NvBlastExtApexSharedParts.h:34
bool importerHullsInProximityApexFree(uint32_t hull0Count, const physx::PxVec3 *hull0, physx::PxBounds3 &hull0Bounds, const physx::PxTransform &localToWorldRT0In, const physx::PxVec3 &scale0In, uint32_t hull1Count, const physx::PxVec3 *hull1, physx::PxBounds3 &hull1Bounds, const physx::PxTransform &localToWorldRT1In, const physx::PxVec3 &scale1In, physx::PxF32 maxDistance, Separation *separation)
Definition: NvBlastExtApexSharedParts.h:46
diff --git a/docs/source_docs/files/_nv_blast_ext_asset_utils_8h_source.html b/docs/source_docs/files/_nv_blast_ext_asset_utils_8h_source.html index c04f8ef..f177c1a 100755 --- a/docs/source_docs/files/_nv_blast_ext_asset_utils_8h_source.html +++ b/docs/source_docs/files/_nv_blast_ext_asset_utils_8h_source.html @@ -46,7 +46,7 @@ $(document).ready(function(){initNavTree('_nv_blast_ext_asset_utils_8h_source.ht
NvBlastExtAssetUtils.h
-Go to the documentation of this file.
1 // This code contains NVIDIA Confidential Information and is disclosed to you
2 // under a form of NVIDIA software license agreement provided separately to you.
3 //
4 // Notice
5 // NVIDIA Corporation and its licensors retain all intellectual property and
6 // proprietary rights in and to this software and related documentation and
7 // any modifications thereto. Any use, reproduction, disclosure, or
8 // distribution of this software and related documentation without an express
9 // license agreement from NVIDIA Corporation is strictly prohibited.
10 //
11 // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12 // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15 //
16 // Information and code furnished is believed to be accurate and reliable.
17 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18 // information or for any infringement of patents or other rights of third parties that may
19 // result from its use. No license is granted by implication or otherwise under any patent
20 // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21 // This code supersedes and replaces all information previously supplied.
22 // NVIDIA Corporation products are not authorized for use as critical
23 // components in life support devices or systems without express written approval of
24 // NVIDIA Corporation.
25 //
26 // Copyright (c) 2016-2018 NVIDIA Corporation. All rights reserved.
27 
28 
29 #ifndef NVBLASTEXTASSETUTILS_H
30 #define NVBLASTEXTASSETUTILS_H
31 
32 
33 #include "NvBlastTypes.h"
34 #include "NvCTypes.h"
35 #include <stdint.h>
36 
37 
50 (
51  const NvBlastAsset* asset,
52  const uint32_t* worldBoundChunks,
53  uint32_t worldBoundChunkCount,
54  const NvcVec3* bondDirections,
55  const uint32_t* bondUserData
56 );
57 
58 
67 {
68  uint32_t componentIndices[2];
69 };
70 
71 
111 (
112  const NvBlastAsset** components,
113  const NvcVec3* scales,
114  const NvcQuat* rotations,
115  const NvcVec3* translations,
116  uint32_t componentCount,
117  const NvBlastExtAssetUtilsBondDesc* newBondDescs,
118  uint32_t newBondCount,
119  uint32_t* chunkIndexOffsets,
120  uint32_t* chunkReorderMap,
121  uint32_t chunkReorderMapSize
122 );
123 
124 
136 (
137  NvBlastAsset* asset,
138  const NvcVec3* scale,
139  const NvcQuat* rotation,
140  const NvcVec3* translation
141 );
142 
143 #endif // ifndef NVBLASTEXTASSETUTILS_H
NVBLAST_API NvBlastAsset * NvBlastExtAssetUtilsAddWorldBonds(const NvBlastAsset *asset, const uint32_t *worldBoundChunks, uint32_t worldBoundChunkCount, const NvcVec3 *bondDirections, const uint32_t *bondUserData)
+Go to the documentation of this file.
1 // This code contains NVIDIA Confidential Information and is disclosed to you
2 // under a form of NVIDIA software license agreement provided separately to you.
3 //
4 // Notice
5 // NVIDIA Corporation and its licensors retain all intellectual property and
6 // proprietary rights in and to this software and related documentation and
7 // any modifications thereto. Any use, reproduction, disclosure, or
8 // distribution of this software and related documentation without an express
9 // license agreement from NVIDIA Corporation is strictly prohibited.
10 //
11 // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12 // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15 //
16 // Information and code furnished is believed to be accurate and reliable.
17 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18 // information or for any infringement of patents or other rights of third parties that may
19 // result from its use. No license is granted by implication or otherwise under any patent
20 // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21 // This code supersedes and replaces all information previously supplied.
22 // NVIDIA Corporation products are not authorized for use as critical
23 // components in life support devices or systems without express written approval of
24 // NVIDIA Corporation.
25 //
26 // Copyright (c) 2016-2020 NVIDIA Corporation. All rights reserved.
27 
28 
29 #ifndef NVBLASTEXTASSETUTILS_H
30 #define NVBLASTEXTASSETUTILS_H
31 
32 
33 #include "NvBlastTypes.h"
34 #include "NvCTypes.h"
35 #include <stdint.h>
36 
37 
50 (
51  const NvBlastAsset* asset,
52  const uint32_t* worldBoundChunks,
53  uint32_t worldBoundChunkCount,
54  const NvcVec3* bondDirections,
55  const uint32_t* bondUserData
56 );
57 
58 
67 {
68  uint32_t componentIndices[2];
69 };
70 
71 
111 (
112  const NvBlastAsset** components,
113  const NvcVec3* scales,
114  const NvcQuat* rotations,
115  const NvcVec3* translations,
116  uint32_t componentCount,
117  const NvBlastExtAssetUtilsBondDesc* newBondDescs,
118  uint32_t newBondCount,
119  uint32_t* chunkIndexOffsets,
120  uint32_t* chunkReorderMap,
121  uint32_t chunkReorderMapSize
122 );
123 
124 
136 (
137  NvBlastAsset* asset,
138  const NvcVec3* scale,
139  const NvcQuat* rotation,
140  const NvcVec3* translation
141 );
142 
143 #endif // ifndef NVBLASTEXTASSETUTILS_H
NVBLAST_API NvBlastAsset * NvBlastExtAssetUtilsAddWorldBonds(const NvBlastAsset *asset, const uint32_t *worldBoundChunks, uint32_t worldBoundChunkCount, const NvcVec3 *bondDirections, const uint32_t *bondUserData)
uint32_t componentIndices[2]
The asset component for the corresponding chunkIndices[2] value.
Definition: NvBlastExtAssetUtils.h:68
NVBLAST_API NvBlastAssetDesc NvBlastExtAssetUtilsMergeAssets(const NvBlastAsset **components, const NvcVec3 *scales, const NvcQuat *rotations, const NvcVec3 *translations, uint32_t componentCount, const NvBlastExtAssetUtilsBondDesc *newBondDescs, uint32_t newBondCount, uint32_t *chunkIndexOffsets, uint32_t *chunkReorderMap, uint32_t chunkReorderMapSize)
diff --git a/docs/source_docs/files/_nv_blast_ext_authoring_8h_source.html b/docs/source_docs/files/_nv_blast_ext_authoring_8h_source.html index cd608e8..4d85208 100755 --- a/docs/source_docs/files/_nv_blast_ext_authoring_8h_source.html +++ b/docs/source_docs/files/_nv_blast_ext_authoring_8h_source.html @@ -46,7 +46,7 @@ $(document).ready(function(){initNavTree('_nv_blast_ext_authoring_8h_source.html
NvBlastExtAuthoring.h
-Go to the documentation of this file.
1 // This code contains NVIDIA Confidential Information and is disclosed to you
2 // under a form of NVIDIA software license agreement provided separately to you.
3 //
4 // Notice
5 // NVIDIA Corporation and its licensors retain all intellectual property and
6 // proprietary rights in and to this software and related documentation and
7 // any modifications thereto. Any use, reproduction, disclosure, or
8 // distribution of this software and related documentation without an express
9 // license agreement from NVIDIA Corporation is strictly prohibited.
10 //
11 // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12 // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15 //
16 // Information and code furnished is believed to be accurate and reliable.
17 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18 // information or for any infringement of patents or other rights of third parties that may
19 // result from its use. No license is granted by implication or otherwise under any patent
20 // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21 // This code supersedes and replaces all information previously supplied.
22 // NVIDIA Corporation products are not authorized for use as critical
23 // components in life support devices or systems without express written approval of
24 // NVIDIA Corporation.
25 //
26 // Copyright (c) 2016-2018 NVIDIA Corporation. All rights reserved.
27 
28 
29 #ifndef NVBLASTAUTHORING_H
30 #define NVBLASTAUTHORING_H
31 
33 
34 namespace Nv
35 {
36 namespace Blast
37 {
38 class Mesh;
39 class VoronoiSitesGenerator;
40 class CutoutSet;
41 class RandomGeneratorBase;
42 class FractureTool;
43 class ConvexMeshBuilder;
44 class BlastBondGenerator;
45 class MeshCleaner;
46 class PatternGenerator;
47 class Grid;
48 class GridWalker;
49 } // namespace Blast
50 } // namespace Nv
51 
53 
68 NvBlastExtAuthoringCreateMesh(const NvcVec3* positions, const NvcVec3* normals, const NvcVec2* uv,
69  uint32_t verticesCount, const uint32_t* indices, uint32_t indicesCount);
70 
85 NvBlastExtAuthoringCreateMeshOnlyTriangles(const void* vertices, uint32_t verticesCount, uint32_t* indices,
86  uint32_t indexCount, void* materials = nullptr, uint32_t materialStride = 4);
87 
102 NvBlastExtAuthoringCreateMeshFromFacets(const void* vertices, const void* edges, const void* facets,
103  uint32_t verticesCount, uint32_t edgesCount, uint32_t facetsCount);
104 
114 
117 
134 NVBLAST_API void
135 NvBlastExtAuthoringBuildCutoutSet(Nv::Blast::CutoutSet& cutoutSet, const uint8_t* pixelBuffer, uint32_t bufferWidth,
136  uint32_t bufferHeight, float segmentationErrorThreshold, float snapThreshold,
137  bool periodic, bool expandGaps);
138 
144 
150 
161  const Nv::Blast::Triangle* mesh,
162  uint32_t triangleCount,
164  Nv::Blast::CollisionHull**& convexes);
165 
166 
180  Nv::Blast::CollisionHull** in, const uint32_t* chunkDepth);
181 
182 
191  const NvcQuat* rotation, const NvcVec3* translation);
192 
202  const NvcQuat* rotation, const NvcVec3* translation);
203 
217  Nv::Blast::ConvexMeshBuilder& collisionBuilder,
218  const Nv::Blast::ConvexDecompositionParams& collisionParam,
219  int32_t defaultSupportDepth = -1);
220 
221 
226 
231 
232 
241 
252  Nv::Blast::ConvexMeshBuilder& collisionBuilder,
253  const Nv::Blast::ConvexDecompositionParams& collisionParam,
254  uint32_t chunksToProcessCount, uint32_t* chunksToProcess);
255 
261 
288  const NvBlastAsset** components, const NvcVec3* scales, const NvcQuat* rotations, const NvcVec3* translations,
289  const uint32_t** convexHullOffsets, const Nv::Blast::CollisionHull*** chunkHulls, uint32_t componentCount,
290  NvBlastExtAssetUtilsBondDesc*& newBondDescs, float maxSeparation = 0.0f);
291 
296 
301 
306 
307 #endif // ifndef NVBLASTAUTHORING_H
NVBLAST_API Nv::Blast::PatternGenerator * NvBlastExtAuthoringCreatePatternGenerator()
+Go to the documentation of this file.
1 // This code contains NVIDIA Confidential Information and is disclosed to you
2 // under a form of NVIDIA software license agreement provided separately to you.
3 //
4 // Notice
5 // NVIDIA Corporation and its licensors retain all intellectual property and
6 // proprietary rights in and to this software and related documentation and
7 // any modifications thereto. Any use, reproduction, disclosure, or
8 // distribution of this software and related documentation without an express
9 // license agreement from NVIDIA Corporation is strictly prohibited.
10 //
11 // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12 // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15 //
16 // Information and code furnished is believed to be accurate and reliable.
17 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18 // information or for any infringement of patents or other rights of third parties that may
19 // result from its use. No license is granted by implication or otherwise under any patent
20 // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21 // This code supersedes and replaces all information previously supplied.
22 // NVIDIA Corporation products are not authorized for use as critical
23 // components in life support devices or systems without express written approval of
24 // NVIDIA Corporation.
25 //
26 // Copyright (c) 2016-2020 NVIDIA Corporation. All rights reserved.
27 
28 
29 #ifndef NVBLASTAUTHORING_H
30 #define NVBLASTAUTHORING_H
31 
33 
34 namespace Nv
35 {
36 namespace Blast
37 {
38 class Mesh;
39 class VoronoiSitesGenerator;
40 class CutoutSet;
41 class RandomGeneratorBase;
42 class FractureTool;
43 class ConvexMeshBuilder;
44 class BlastBondGenerator;
45 class MeshCleaner;
46 class PatternGenerator;
47 class Grid;
48 class GridWalker;
49 } // namespace Blast
50 } // namespace Nv
51 
53 
68 NvBlastExtAuthoringCreateMesh(const NvcVec3* positions, const NvcVec3* normals, const NvcVec2* uv,
69  uint32_t verticesCount, const uint32_t* indices, uint32_t indicesCount);
70 
85 NvBlastExtAuthoringCreateMeshOnlyTriangles(const void* vertices, uint32_t verticesCount, uint32_t* indices,
86  uint32_t indexCount, void* materials = nullptr, uint32_t materialStride = 4);
87 
102 NvBlastExtAuthoringCreateMeshFromFacets(const void* vertices, const void* edges, const void* facets,
103  uint32_t verticesCount, uint32_t edgesCount, uint32_t facetsCount);
104 
114 
117 
134 NVBLAST_API void
135 NvBlastExtAuthoringBuildCutoutSet(Nv::Blast::CutoutSet& cutoutSet, const uint8_t* pixelBuffer, uint32_t bufferWidth,
136  uint32_t bufferHeight, float segmentationErrorThreshold, float snapThreshold,
137  bool periodic, bool expandGaps);
138 
144 
150 
161  const Nv::Blast::Triangle* mesh,
162  uint32_t triangleCount,
164  Nv::Blast::CollisionHull**& convexes);
165 
166 
180  Nv::Blast::CollisionHull** in, const uint32_t* chunkDepth);
181 
182 
191  const NvcQuat* rotation, const NvcVec3* translation);
192 
202  const NvcQuat* rotation, const NvcVec3* translation);
203 
217  Nv::Blast::ConvexMeshBuilder& collisionBuilder,
218  const Nv::Blast::ConvexDecompositionParams& collisionParam,
219  int32_t defaultSupportDepth = -1);
220 
221 
226 
231 
232 
241 
252  Nv::Blast::ConvexMeshBuilder& collisionBuilder,
253  const Nv::Blast::ConvexDecompositionParams& collisionParam,
254  uint32_t chunksToProcessCount, uint32_t* chunksToProcess);
255 
261 
288  const NvBlastAsset** components, const NvcVec3* scales, const NvcQuat* rotations, const NvcVec3* translations,
289  const uint32_t** convexHullOffsets, const Nv::Blast::CollisionHull*** chunkHulls, uint32_t componentCount,
290  NvBlastExtAssetUtilsBondDesc*& newBondDescs, float maxSeparation = 0.0f);
291 
296 
301 
306 
307 #endif // ifndef NVBLASTAUTHORING_H
NVBLAST_API Nv::Blast::PatternGenerator * NvBlastExtAuthoringCreatePatternGenerator()
NVBLAST_API Nv::Blast::FractureTool * NvBlastExtAuthoringCreateFractureTool()
NVBLAST_API Nv::Blast::AuthoringResult * NvBlastExtAuthoringProcessFracture(Nv::Blast::FractureTool &fTool, Nv::Blast::BlastBondGenerator &bondGenerator, Nv::Blast::ConvexMeshBuilder &collisionBuilder, const Nv::Blast::ConvexDecompositionParams &collisionParam, int32_t defaultSupportDepth=-1)
Definition: NvBlastExtAuthoringConvexMeshBuilder.h:47
diff --git a/docs/source_docs/files/_nv_blast_ext_authoring_accelerator_8h_source.html b/docs/source_docs/files/_nv_blast_ext_authoring_accelerator_8h_source.html index 0f4d4f5..42ef030 100755 --- a/docs/source_docs/files/_nv_blast_ext_authoring_accelerator_8h_source.html +++ b/docs/source_docs/files/_nv_blast_ext_authoring_accelerator_8h_source.html @@ -46,7 +46,7 @@ $(document).ready(function(){initNavTree('_nv_blast_ext_authoring_accelerator_8h
NvBlastExtAuthoringAccelerator.h
-Go to the documentation of this file.
1 // This code contains NVIDIA Confidential Information and is disclosed to you
2 // under a form of NVIDIA software license agreement provided separately to you.
3 //
4 // Notice
5 // NVIDIA Corporation and its licensors retain all intellectual property and
6 // proprietary rights in and to this software and related documentation and
7 // any modifications thereto. Any use, reproduction, disclosure, or
8 // distribution of this software and related documentation without an express
9 // license agreement from NVIDIA Corporation is strictly prohibited.
10 //
11 // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12 // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15 //
16 // Information and code furnished is believed to be accurate and reliable.
17 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18 // information or for any infringement of patents or other rights of third parties that may
19 // result from its use. No license is granted by implication or otherwise under any patent
20 // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21 // This code supersedes and replaces all information previously supplied.
22 // NVIDIA Corporation products are not authorized for use as critical
23 // components in life support devices or systems without express written approval of
24 // NVIDIA Corporation.
25 //
26 // Copyright (c) 2016-2018 NVIDIA Corporation. All rights reserved.
27 
28 
29 #ifndef NVBLASTEXTAUTHORINGACCELERATOR_H
30 #define NVBLASTEXTAUTHORINGACCELERATOR_H
31 
32 #include <set>
33 #include <vector>
35 
36 
37 namespace Nv
38 {
39  namespace Blast
40  {
41 
42  class Mesh;
43 
48  {
49  public:
50 
57  virtual void setState(const NvcBounds3* bounds) = 0;
58 
65  virtual void setState(const Vertex* pos, const Edge* ed, const Facet& fc) = 0;
70  virtual void setState(const NvcVec3& point) = 0;
75  virtual int32_t getNextFacet() = 0;
76 
77 
78  virtual void setPointCmpDirection(int32_t dir) = 0;
79 
80 
81  virtual ~SpatialAccelerator() {};
82  };
83 
84 
89  {
90  public:
94  DummyAccelerator(int32_t count);
95  virtual void setState(const NvcBounds3* bounds) override;
96  virtual void setState(const Vertex* pos, const Edge* ed, const Facet& fc) override;
97  virtual void setState(const NvcVec3& point) override;
98  virtual int32_t getNextFacet() override;
99 
100  virtual void setPointCmpDirection(int32_t dir) override {};
101  private:
102  int32_t m_count;
103  int32_t m_current;
104  };
105 
107  {
108  float coord;
109  uint32_t index;
110  bool end;
111 
112  SegmentToIndex(float c, uint32_t i, bool end) : coord(c), index(i), end(end) {};
113 
114  bool operator<(const SegmentToIndex& in) const
115  {
116  if (coord < in.coord) return true;
117  if (coord > in.coord) return false;
118  return end < in.end;
119  }
120  };
121 
122 
123 
124  class Grid
125  {
126 
127  public:
128 
129  friend class GridWalker;
130 
131  Grid(int32_t resolution);
132  void setMesh(const Nv::Blast::Mesh* m);
133 
134  private:
135  int32_t m_resolution;
136  int32_t m_r3;
137  int32_t m_mappedFacetCount;
138  NvcVec3 m_spos;
139  NvcVec3 m_deltas;
140  std::vector< std::vector<int32_t> > m_spatialMap;
141  };
142 
143  class GridWalker : public SpatialAccelerator // Iterator to traverse the grid
144  {
145  public:
146  GridWalker(Grid* grd);
147 
148  virtual void setState(const NvcBounds3* bounds) override;
149  virtual void setState(const Vertex* pos, const Edge* ed, const Facet& fc) override;
150  virtual void setState(const NvcVec3& point) override;
151  virtual int32_t getNextFacet() override;
152  virtual void setPointCmpDirection(int32_t dir) override;
153  private:
154  Grid* m_grid;
155 
156  // Iterator data
157  std::vector<uint32_t> m_alreadyGotFlag;
158  uint32_t m_alreadyGotValue;
159  std::vector<int32_t> m_cellList;
160  int32_t m_gotCells;
161  int32_t m_iteratorCell;
162  int32_t m_iteratorFacet;
163  int32_t m_pointCmdDir;
164  };
165 
166 
168  {
169  public:
174  virtual void setState(const Vertex* pos, const Edge* ed, const Facet& fc) override;
175  virtual void setState(const NvcBounds3* bounds) override;
176  virtual void setState(const NvcVec3& point) override;
177  virtual int32_t getNextFacet() override;
178  virtual void setPointCmpDirection(int32_t dir) override {};
179  private:
180 
181 
182  /*
183  For fast point test.
184  */
185  std::vector<std::vector<uint32_t> > m_xSegm;
186  std::vector<std::vector<uint32_t> > m_ySegm;
187  std::vector<std::vector<uint32_t> > m_zSegm;
188  std::vector<uint32_t> m_indices;
189  std::vector<uint32_t> m_foundx;
190  std::vector<uint32_t> m_foundy;
191 
192  uint32_t m_iterId;
193  int32_t m_current;
194  uint32_t m_facetCount;
195 
196  NvcVec3 m_minimal;
197  NvcVec3 m_maximal;
198 
199  NvcVec3 m_rescale;
200 
201 
202  };
203 
204 
211  {
212  public:
217  BBoxBasedAccelerator(const Mesh* mesh, int32_t resolution);
218  virtual ~BBoxBasedAccelerator();
219  int32_t getNextFacet() override;
220  void setState(const Vertex* pos, const Edge* ed, const Facet& fc) override;
221  void setState(const NvcBounds3* bounds) override;
222  void setState(const NvcVec3& p) override;
223  void setPointCmpDirection(int32_t dir) override {};
224  private:
225 
226  void buildAccelStructure(const Vertex* pos, const Edge* edges, const Facet* fc, int32_t facetCount);
227 
228  int32_t m_resolution;
229  NvcBounds3 m_bounds;
230  std::vector< std::vector<int32_t> > m_spatialMap;
231  std::vector<NvcBounds3> m_cells;
232 
233 
234  // Iterator data
235  std::vector<uint32_t> m_alreadyGotFlag;
236  uint32_t m_alreadyGotValue;
237  std::vector<int32_t> m_cellList;
238  int32_t m_gotCells;
239  int32_t m_iteratorCell;
240  int32_t m_iteratorFacet;
241  };
242 
243  } // namespace Blast
244 } // namsepace Nv
245 
246 
247 #endif // ifndef NVBLASTEXTAUTHORINGACCELERATOR_H
virtual void setPointCmpDirection(int32_t dir) override
Definition: NvBlastExtAuthoringAccelerator.h:178
+Go to the documentation of this file.
1 // This code contains NVIDIA Confidential Information and is disclosed to you
2 // under a form of NVIDIA software license agreement provided separately to you.
3 //
4 // Notice
5 // NVIDIA Corporation and its licensors retain all intellectual property and
6 // proprietary rights in and to this software and related documentation and
7 // any modifications thereto. Any use, reproduction, disclosure, or
8 // distribution of this software and related documentation without an express
9 // license agreement from NVIDIA Corporation is strictly prohibited.
10 //
11 // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12 // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15 //
16 // Information and code furnished is believed to be accurate and reliable.
17 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18 // information or for any infringement of patents or other rights of third parties that may
19 // result from its use. No license is granted by implication or otherwise under any patent
20 // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21 // This code supersedes and replaces all information previously supplied.
22 // NVIDIA Corporation products are not authorized for use as critical
23 // components in life support devices or systems without express written approval of
24 // NVIDIA Corporation.
25 //
26 // Copyright (c) 2016-2020 NVIDIA Corporation. All rights reserved.
27 
28 
29 #ifndef NVBLASTEXTAUTHORINGACCELERATOR_H
30 #define NVBLASTEXTAUTHORINGACCELERATOR_H
31 
32 #include <set>
33 #include <vector>
35 
36 
37 namespace Nv
38 {
39  namespace Blast
40  {
41 
42  class Mesh;
43 
48  {
49  public:
50 
57  virtual void setState(const NvcBounds3* bounds) = 0;
58 
65  virtual void setState(const Vertex* pos, const Edge* ed, const Facet& fc) = 0;
70  virtual void setState(const NvcVec3& point) = 0;
75  virtual int32_t getNextFacet() = 0;
76 
77 
78  virtual void setPointCmpDirection(int32_t dir) = 0;
79 
80 
81  virtual ~SpatialAccelerator() {};
82  };
83 
84 
89  {
90  public:
94  DummyAccelerator(int32_t count);
95  virtual void setState(const NvcBounds3* bounds) override;
96  virtual void setState(const Vertex* pos, const Edge* ed, const Facet& fc) override;
97  virtual void setState(const NvcVec3& point) override;
98  virtual int32_t getNextFacet() override;
99 
100  virtual void setPointCmpDirection(int32_t dir) override {};
101  private:
102  int32_t m_count;
103  int32_t m_current;
104  };
105 
107  {
108  float coord;
109  uint32_t index;
110  bool end;
111 
112  SegmentToIndex(float c, uint32_t i, bool end) : coord(c), index(i), end(end) {};
113 
114  bool operator<(const SegmentToIndex& in) const
115  {
116  if (coord < in.coord) return true;
117  if (coord > in.coord) return false;
118  return end < in.end;
119  }
120  };
121 
122 
123 
124  class Grid
125  {
126 
127  public:
128 
129  friend class GridWalker;
130 
131  Grid(int32_t resolution);
132  void setMesh(const Nv::Blast::Mesh* m);
133 
134  private:
135  int32_t m_resolution;
136  int32_t m_r3;
137  int32_t m_mappedFacetCount;
138  NvcVec3 m_spos;
139  NvcVec3 m_deltas;
140  std::vector< std::vector<int32_t> > m_spatialMap;
141  };
142 
143  class GridWalker : public SpatialAccelerator // Iterator to traverse the grid
144  {
145  public:
146  GridWalker(Grid* grd);
147 
148  virtual void setState(const NvcBounds3* bounds) override;
149  virtual void setState(const Vertex* pos, const Edge* ed, const Facet& fc) override;
150  virtual void setState(const NvcVec3& point) override;
151  virtual int32_t getNextFacet() override;
152  virtual void setPointCmpDirection(int32_t dir) override;
153  private:
154  Grid* m_grid;
155 
156  // Iterator data
157  std::vector<uint32_t> m_alreadyGotFlag;
158  uint32_t m_alreadyGotValue;
159  std::vector<int32_t> m_cellList;
160  int32_t m_gotCells;
161  int32_t m_iteratorCell;
162  int32_t m_iteratorFacet;
163  int32_t m_pointCmdDir;
164  };
165 
166 
168  {
169  public:
174  virtual void setState(const Vertex* pos, const Edge* ed, const Facet& fc) override;
175  virtual void setState(const NvcBounds3* bounds) override;
176  virtual void setState(const NvcVec3& point) override;
177  virtual int32_t getNextFacet() override;
178  virtual void setPointCmpDirection(int32_t dir) override {};
179  private:
180 
181 
182  /*
183  For fast point test.
184  */
185  std::vector<std::vector<uint32_t> > m_xSegm;
186  std::vector<std::vector<uint32_t> > m_ySegm;
187  std::vector<std::vector<uint32_t> > m_zSegm;
188  std::vector<uint32_t> m_indices;
189  std::vector<uint32_t> m_foundx;
190  std::vector<uint32_t> m_foundy;
191 
192  uint32_t m_iterId;
193  int32_t m_current;
194  uint32_t m_facetCount;
195 
196  NvcVec3 m_minimal;
197  NvcVec3 m_maximal;
198 
199  NvcVec3 m_rescale;
200 
201 
202  };
203 
204 
211  {
212  public:
217  BBoxBasedAccelerator(const Mesh* mesh, int32_t resolution);
218  virtual ~BBoxBasedAccelerator();
219  int32_t getNextFacet() override;
220  void setState(const Vertex* pos, const Edge* ed, const Facet& fc) override;
221  void setState(const NvcBounds3* bounds) override;
222  void setState(const NvcVec3& p) override;
223  void setPointCmpDirection(int32_t dir) override {};
224  private:
225 
226  void buildAccelStructure(const Vertex* pos, const Edge* edges, const Facet* fc, int32_t facetCount);
227 
228  int32_t m_resolution;
229  NvcBounds3 m_bounds;
230  std::vector< std::vector<int32_t> > m_spatialMap;
231  std::vector<NvcBounds3> m_cells;
232 
233 
234  // Iterator data
235  std::vector<uint32_t> m_alreadyGotFlag;
236  uint32_t m_alreadyGotValue;
237  std::vector<int32_t> m_cellList;
238  int32_t m_gotCells;
239  int32_t m_iteratorCell;
240  int32_t m_iteratorFacet;
241  };
242 
243  } // namespace Blast
244 } // namsepace Nv
245 
246 
247 #endif // ifndef NVBLASTEXTAUTHORINGACCELERATOR_H
virtual void setPointCmpDirection(int32_t dir) override
Definition: NvBlastExtAuthoringAccelerator.h:178
Definition: NvBlastExtAuthoringAccelerator.h:210
Definition: NvBlastExtAuthoringAccelerator.h:47
diff --git a/docs/source_docs/files/_nv_blast_ext_authoring_bond_generator_8h_source.html b/docs/source_docs/files/_nv_blast_ext_authoring_bond_generator_8h_source.html index b147319..6dd06a0 100755 --- a/docs/source_docs/files/_nv_blast_ext_authoring_bond_generator_8h_source.html +++ b/docs/source_docs/files/_nv_blast_ext_authoring_bond_generator_8h_source.html @@ -46,7 +46,7 @@ $(document).ready(function(){initNavTree('_nv_blast_ext_authoring_bond_generator
NvBlastExtAuthoringBondGenerator.h
-Go to the documentation of this file.
1 // This code contains NVIDIA Confidential Information and is disclosed to you
2 // under a form of NVIDIA software license agreement provided separately to you.
3 //
4 // Notice
5 // NVIDIA Corporation and its licensors retain all intellectual property and
6 // proprietary rights in and to this software and related documentation and
7 // any modifications thereto. Any use, reproduction, disclosure, or
8 // distribution of this software and related documentation without an express
9 // license agreement from NVIDIA Corporation is strictly prohibited.
10 //
11 // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12 // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15 //
16 // Information and code furnished is believed to be accurate and reliable.
17 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18 // information or for any infringement of patents or other rights of third parties that may
19 // result from its use. No license is granted by implication or otherwise under any patent
20 // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21 // This code supersedes and replaces all information previously supplied.
22 // NVIDIA Corporation products are not authorized for use as critical
23 // components in life support devices or systems without express written approval of
24 // NVIDIA Corporation.
25 //
26 // Copyright (c) 2018 NVIDIA Corporation. All rights reserved.
27 
28 
29 #ifndef NVBLASTEXTAUTHORINGBONDGENERATOR_H
30 #define NVBLASTEXTAUTHORINGBONDGENERATOR_H
31 
33 
34 struct NvBlastBondDesc;
35 struct NvBlastChunkDesc;
36 struct NvBlastBond;
37 
38 namespace Nv
39 {
40 namespace Blast
41 {
42 
43 // Forward declarations
44 class FractureTool;
45 class TriangleProcessor;
46 struct PlaneChunkIndexer;
47 
55 {
59 };
60 
61 
63 {
64  int32_t chunkId;
65  int32_t trId;
67 };
68 
69 
75 {
76 public:
77  virtual ~BlastBondGenerator() {}
78 
82  virtual void release() = 0;
83 
93  virtual int32_t buildDescFromInternalFracture(FractureTool* tool, const bool* chunkIsSupport,
94  NvBlastBondDesc*& resultBondDescs, NvBlastChunkDesc*& resultChunkDescriptors) = 0;
95 
96 
107  virtual int32_t createBondBetweenMeshes(uint32_t meshACount, const Triangle* meshA, uint32_t meshBCount, const Triangle* meshB,
108  NvBlastBond& resultBond, BondGenerationConfig conf) = 0;
109 
124  virtual int32_t createBondBetweenMeshes(uint32_t meshCount, const uint32_t* geometryOffset, const Triangle* geometry,
125  uint32_t overlapsCount, const uint32_t* overlapsA, const uint32_t* overlapsB,
126  NvBlastBondDesc*& resultBond, BondGenerationConfig cfg) = 0;
127 
128 
142  virtual int32_t bondsFromPrefractured(uint32_t meshCount, const uint32_t* geometryOffset, const Triangle* geometry,
143  const bool* chunkIsSupport, NvBlastBondDesc*& resultBondDescs,
144  BondGenerationConfig conf) = 0;
145 
160  virtual int32_t bondsFromPrefractured(uint32_t meshCount, const uint32_t* convexHullOffset, const CollisionHull** chunkHulls,
161  const bool* chunkIsSupport, const uint32_t* meshGroups, NvBlastBondDesc*& resultBondDescs, float maxSeparation) = 0;
162 
163 
164 
165 };
166 
167 } // namespace Blast
168 } // namespace Nv
169 
170 #endif // NVBLASTEXTAUTHORINGBONDGENERATOR_H
NvcPlane plane
Definition: NvBlastExtAuthoringBondGenerator.h:66
+Go to the documentation of this file.
1 // This code contains NVIDIA Confidential Information and is disclosed to you
2 // under a form of NVIDIA software license agreement provided separately to you.
3 //
4 // Notice
5 // NVIDIA Corporation and its licensors retain all intellectual property and
6 // proprietary rights in and to this software and related documentation and
7 // any modifications thereto. Any use, reproduction, disclosure, or
8 // distribution of this software and related documentation without an express
9 // license agreement from NVIDIA Corporation is strictly prohibited.
10 //
11 // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12 // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15 //
16 // Information and code furnished is believed to be accurate and reliable.
17 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18 // information or for any infringement of patents or other rights of third parties that may
19 // result from its use. No license is granted by implication or otherwise under any patent
20 // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21 // This code supersedes and replaces all information previously supplied.
22 // NVIDIA Corporation products are not authorized for use as critical
23 // components in life support devices or systems without express written approval of
24 // NVIDIA Corporation.
25 //
26 // Copyright (c) 2020 NVIDIA Corporation. All rights reserved.
27 
28 
29 #ifndef NVBLASTEXTAUTHORINGBONDGENERATOR_H
30 #define NVBLASTEXTAUTHORINGBONDGENERATOR_H
31 
33 
34 struct NvBlastBondDesc;
35 struct NvBlastChunkDesc;
36 struct NvBlastBond;
37 
38 namespace Nv
39 {
40 namespace Blast
41 {
42 
43 // Forward declarations
44 class FractureTool;
45 class TriangleProcessor;
46 struct PlaneChunkIndexer;
47 
55 {
59 };
60 
61 
63 {
64  int32_t chunkId;
65  int32_t trId;
67 };
68 
69 
75 {
76 public:
77  virtual ~BlastBondGenerator() {}
78 
82  virtual void release() = 0;
83 
93  virtual int32_t buildDescFromInternalFracture(FractureTool* tool, const bool* chunkIsSupport,
94  NvBlastBondDesc*& resultBondDescs, NvBlastChunkDesc*& resultChunkDescriptors) = 0;
95 
96 
107  virtual int32_t createBondBetweenMeshes(uint32_t meshACount, const Triangle* meshA, uint32_t meshBCount, const Triangle* meshB,
108  NvBlastBond& resultBond, BondGenerationConfig conf) = 0;
109 
124  virtual int32_t createBondBetweenMeshes(uint32_t meshCount, const uint32_t* geometryOffset, const Triangle* geometry,
125  uint32_t overlapsCount, const uint32_t* overlapsA, const uint32_t* overlapsB,
126  NvBlastBondDesc*& resultBond, BondGenerationConfig cfg) = 0;
127 
128 
142  virtual int32_t bondsFromPrefractured(uint32_t meshCount, const uint32_t* geometryOffset, const Triangle* geometry,
143  const bool* chunkIsSupport, NvBlastBondDesc*& resultBondDescs,
144  BondGenerationConfig conf) = 0;
145 
160  virtual int32_t bondsFromPrefractured(uint32_t meshCount, const uint32_t* convexHullOffset, const CollisionHull** chunkHulls,
161  const bool* chunkIsSupport, const uint32_t* meshGroups, NvBlastBondDesc*& resultBondDescs, float maxSeparation) = 0;
162 
163 
164 
165 };
166 
167 } // namespace Blast
168 } // namespace Nv
169 
170 #endif // NVBLASTEXTAUTHORINGBONDGENERATOR_H
NvcPlane plane
Definition: NvBlastExtAuthoringBondGenerator.h:66
int32_t trId
Definition: NvBlastExtAuthoringBondGenerator.h:65
BondGenMode
Definition: NvBlastExtAuthoringBondGenerator.h:56
Definition: NvBlastTypes.h:189
diff --git a/docs/source_docs/files/_nv_blast_ext_authoring_bond_generator_impl_8h_source.html b/docs/source_docs/files/_nv_blast_ext_authoring_bond_generator_impl_8h_source.html index a298a44..d8d6850 100755 --- a/docs/source_docs/files/_nv_blast_ext_authoring_bond_generator_impl_8h_source.html +++ b/docs/source_docs/files/_nv_blast_ext_authoring_bond_generator_impl_8h_source.html @@ -46,7 +46,7 @@ $(document).ready(function(){initNavTree('_nv_blast_ext_authoring_bond_generator
NvBlastExtAuthoringBondGeneratorImpl.h
-Go to the documentation of this file.
1 // This code contains NVIDIA Confidential Information and is disclosed to you
2 // under a form of NVIDIA software license agreement provided separately to you.
3 //
4 // Notice
5 // NVIDIA Corporation and its licensors retain all intellectual property and
6 // proprietary rights in and to this software and related documentation and
7 // any modifications thereto. Any use, reproduction, disclosure, or
8 // distribution of this software and related documentation without an express
9 // license agreement from NVIDIA Corporation is strictly prohibited.
10 //
11 // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12 // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15 //
16 // Information and code furnished is believed to be accurate and reliable.
17 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18 // information or for any infringement of patents or other rights of third parties that may
19 // result from its use. No license is granted by implication or otherwise under any patent
20 // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21 // This code supersedes and replaces all information previously supplied.
22 // NVIDIA Corporation products are not authorized for use as critical
23 // components in life support devices or systems without express written approval of
24 // NVIDIA Corporation.
25 //
26 // Copyright (c) 2018 NVIDIA Corporation. All rights reserved.
27 
28 
29 #ifndef NVBLASTEXTAUTHORINGBONDGENERATORIMPL_H
30 #define NVBLASTEXTAUTHORINGBONDGENERATORIMPL_H
31 
34 #include <PxPlane.h>
36 #include <vector>
37 #include <set>
38 
39 namespace Nv
40 {
41 namespace Blast
42 {
43 
49 {
50 public:
51 
53  : mConvexMeshBuilder(builder) {};
54 
55  virtual void release() override;
56 
57  virtual int32_t buildDescFromInternalFracture(FractureTool* tool, const bool* chunkIsSupport,
58  NvBlastBondDesc*& resultBondDescs, NvBlastChunkDesc*& resultChunkDescriptors) override;
59 
60  virtual int32_t createBondBetweenMeshes(uint32_t meshACount, const Triangle* meshA, uint32_t meshBCount, const Triangle* meshB,
61  NvBlastBond& resultBond, BondGenerationConfig conf) override;
62 
63  virtual int32_t createBondBetweenMeshes(uint32_t meshCount, const uint32_t* geometryOffset, const Triangle* geometry,
64  uint32_t overlapsCount, const uint32_t* overlapsA, const uint32_t* overlapsB,
65  NvBlastBondDesc*& resultBond, BondGenerationConfig cfg) override;
66 
67  virtual int32_t bondsFromPrefractured(uint32_t meshCount, const uint32_t* geometryOffset, const Triangle* geometry,
68  const bool* chunkIsSupport, NvBlastBondDesc*& resultBondDescs,
69  BondGenerationConfig conf) override;
70 
71  virtual int32_t bondsFromPrefractured(uint32_t meshCount, const uint32_t* convexHullOffset, const CollisionHull** chunkHulls,
72  const bool* chunkIsSupport, const uint32_t* meshGroups, NvBlastBondDesc*& resultBondDescs, float maxSeparation) override;
73 
74 
75 
76 private:
77  float processWithMidplanes(TriangleProcessor* trProcessor, const Triangle* mA, uint32_t mavc, const Triangle* mB, uint32_t mbvc, const CollisionHull* hull1, const CollisionHull* hull2,
78  const std::vector<physx::PxVec3>& hull1p, const std::vector<physx::PxVec3>& hull2p,
79  physx::PxVec3& normal, physx::PxVec3& centroid, float maxRelSeparation);
80 
81  int32_t createFullBondListAveraged( uint32_t meshCount, const uint32_t* geometryOffset, const Triangle* geometry, const CollisionHull** chunkHulls,
82  const bool* supportFlags, const uint32_t* meshGroups, NvBlastBondDesc*& resultBondDescs, BondGenerationConfig conf, std::set<std::pair<uint32_t, uint32_t> >* pairNotToTest = nullptr);
83  int32_t createFullBondListExact( uint32_t meshCount, const uint32_t* geometryOffset, const Triangle* geometry,
84  const bool* supportFlags, NvBlastBondDesc*& resultBondDescs, BondGenerationConfig conf);
85  int32_t createFullBondListExactInternal(uint32_t meshCount, const uint32_t* geometryOffset, const Triangle* geometry,
86  std::vector<PlaneChunkIndexer>& planeTriangleMapping , NvBlastBondDesc*& resultBondDescs);
87  int32_t createBondForcedInternal( const std::vector<physx::PxVec3>& hull0, const std::vector<physx::PxVec3>& hull1,const CollisionHull& cHull0,
88  const CollisionHull& cHull1, physx::PxBounds3 bound0, physx::PxBounds3 bound1, NvBlastBond& resultBond, float overlapping);
89 
90  void buildGeometryCache(uint32_t meshCount, const uint32_t* geometryOffset, const Triangle* geometry);
91  void resetGeometryCache();
92 
93  ConvexMeshBuilder* mConvexMeshBuilder;
94 
95  std::vector<std::vector<Triangle> > mGeometryCache;
96 
97  std::vector<PlaneChunkIndexer> mPlaneCache;
98  std::vector<CollisionHull*> mCHullCache;
99  std::vector<std::vector<physx::PxVec3> > mHullsPointsCache;
100  std::vector<physx::PxBounds3 > mBoundsCache;
101 
102 
103 };
104 
105 } // namespace Blast
106 } // namespace Nv
107 
108 #endif // NVBLASTEXTAUTHORINGBONDGENERATORIMPL_H
Definition: NvBlastExtAuthoringConvexMeshBuilder.h:47
+Go to the documentation of this file.
1 // This code contains NVIDIA Confidential Information and is disclosed to you
2 // under a form of NVIDIA software license agreement provided separately to you.
3 //
4 // Notice
5 // NVIDIA Corporation and its licensors retain all intellectual property and
6 // proprietary rights in and to this software and related documentation and
7 // any modifications thereto. Any use, reproduction, disclosure, or
8 // distribution of this software and related documentation without an express
9 // license agreement from NVIDIA Corporation is strictly prohibited.
10 //
11 // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12 // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15 //
16 // Information and code furnished is believed to be accurate and reliable.
17 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18 // information or for any infringement of patents or other rights of third parties that may
19 // result from its use. No license is granted by implication or otherwise under any patent
20 // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21 // This code supersedes and replaces all information previously supplied.
22 // NVIDIA Corporation products are not authorized for use as critical
23 // components in life support devices or systems without express written approval of
24 // NVIDIA Corporation.
25 //
26 // Copyright (c) 2020 NVIDIA Corporation. All rights reserved.
27 
28 
29 #ifndef NVBLASTEXTAUTHORINGBONDGENERATORIMPL_H
30 #define NVBLASTEXTAUTHORINGBONDGENERATORIMPL_H
31 
34 #include <PxPlane.h>
36 #include <vector>
37 #include <set>
38 
39 namespace Nv
40 {
41 namespace Blast
42 {
43 
49 {
50 public:
51 
53  : mConvexMeshBuilder(builder) {};
54 
55  virtual void release() override;
56 
57  virtual int32_t buildDescFromInternalFracture(FractureTool* tool, const bool* chunkIsSupport,
58  NvBlastBondDesc*& resultBondDescs, NvBlastChunkDesc*& resultChunkDescriptors) override;
59 
60  virtual int32_t createBondBetweenMeshes(uint32_t meshACount, const Triangle* meshA, uint32_t meshBCount, const Triangle* meshB,
61  NvBlastBond& resultBond, BondGenerationConfig conf) override;
62 
63  virtual int32_t createBondBetweenMeshes(uint32_t meshCount, const uint32_t* geometryOffset, const Triangle* geometry,
64  uint32_t overlapsCount, const uint32_t* overlapsA, const uint32_t* overlapsB,
65  NvBlastBondDesc*& resultBond, BondGenerationConfig cfg) override;
66 
67  virtual int32_t bondsFromPrefractured(uint32_t meshCount, const uint32_t* geometryOffset, const Triangle* geometry,
68  const bool* chunkIsSupport, NvBlastBondDesc*& resultBondDescs,
69  BondGenerationConfig conf) override;
70 
71  virtual int32_t bondsFromPrefractured(uint32_t meshCount, const uint32_t* convexHullOffset, const CollisionHull** chunkHulls,
72  const bool* chunkIsSupport, const uint32_t* meshGroups, NvBlastBondDesc*& resultBondDescs, float maxSeparation) override;
73 
74 
75 
76 private:
77  float processWithMidplanes(TriangleProcessor* trProcessor, const Triangle* mA, uint32_t mavc, const Triangle* mB, uint32_t mbvc, const CollisionHull* hull1, const CollisionHull* hull2,
78  const std::vector<physx::PxVec3>& hull1p, const std::vector<physx::PxVec3>& hull2p,
79  physx::PxVec3& normal, physx::PxVec3& centroid, float maxRelSeparation);
80 
81  int32_t createFullBondListAveraged( uint32_t meshCount, const uint32_t* geometryOffset, const Triangle* geometry, const CollisionHull** chunkHulls,
82  const bool* supportFlags, const uint32_t* meshGroups, NvBlastBondDesc*& resultBondDescs, BondGenerationConfig conf, std::set<std::pair<uint32_t, uint32_t> >* pairNotToTest = nullptr);
83  int32_t createFullBondListExact( uint32_t meshCount, const uint32_t* geometryOffset, const Triangle* geometry,
84  const bool* supportFlags, NvBlastBondDesc*& resultBondDescs, BondGenerationConfig conf);
85  int32_t createFullBondListExactInternal(uint32_t meshCount, const uint32_t* geometryOffset, const Triangle* geometry,
86  std::vector<PlaneChunkIndexer>& planeTriangleMapping , NvBlastBondDesc*& resultBondDescs);
87  int32_t createBondForcedInternal( const std::vector<physx::PxVec3>& hull0, const std::vector<physx::PxVec3>& hull1,const CollisionHull& cHull0,
88  const CollisionHull& cHull1, physx::PxBounds3 bound0, physx::PxBounds3 bound1, NvBlastBond& resultBond, float overlapping);
89 
90  void buildGeometryCache(uint32_t meshCount, const uint32_t* geometryOffset, const Triangle* geometry);
91  void resetGeometryCache();
92 
93  ConvexMeshBuilder* mConvexMeshBuilder;
94 
95  std::vector<std::vector<Triangle> > mGeometryCache;
96 
97  std::vector<PlaneChunkIndexer> mPlaneCache;
98  std::vector<CollisionHull*> mCHullCache;
99  std::vector<std::vector<physx::PxVec3> > mHullsPointsCache;
100  std::vector<physx::PxBounds3 > mBoundsCache;
101 
102 
103 };
104 
105 } // namespace Blast
106 } // namespace Nv
107 
108 #endif // NVBLASTEXTAUTHORINGBONDGENERATORIMPL_H
Definition: NvBlastExtAuthoringConvexMeshBuilder.h:47
Definition: NvBlastTypes.h:189
NV_INLINE float normal(const float a[3], float r[3])
Definition: NvBlastMath.h:93
Definition: NvBlastTypes.h:322
diff --git a/docs/source_docs/files/_nv_blast_ext_authoring_boolean_tool_8h_source.html b/docs/source_docs/files/_nv_blast_ext_authoring_boolean_tool_8h_source.html index 0b48ae9..84062c8 100755 --- a/docs/source_docs/files/_nv_blast_ext_authoring_boolean_tool_8h_source.html +++ b/docs/source_docs/files/_nv_blast_ext_authoring_boolean_tool_8h_source.html @@ -46,7 +46,7 @@ $(document).ready(function(){initNavTree('_nv_blast_ext_authoring_boolean_tool_8
NvBlastExtAuthoringBooleanTool.h
-Go to the documentation of this file.
1 // This code contains NVIDIA Confidential Information and is disclosed to you
2 // under a form of NVIDIA software license agreement provided separately to you.
3 //
4 // Notice
5 // NVIDIA Corporation and its licensors retain all intellectual property and
6 // proprietary rights in and to this software and related documentation and
7 // any modifications thereto. Any use, reproduction, disclosure, or
8 // distribution of this software and related documentation without an express
9 // license agreement from NVIDIA Corporation is strictly prohibited.
10 //
11 // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12 // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15 //
16 // Information and code furnished is believed to be accurate and reliable.
17 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18 // information or for any infringement of patents or other rights of third parties that may
19 // result from its use. No license is granted by implication or otherwise under any patent
20 // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21 // This code supersedes and replaces all information previously supplied.
22 // NVIDIA Corporation products are not authorized for use as critical
23 // components in life support devices or systems without express written approval of
24 // NVIDIA Corporation.
25 //
26 // Copyright (c) 2016-2018 NVIDIA Corporation. All rights reserved.
27 
28 
29 #ifndef NVBLASTEXTAUTHORINGBOOLEANTOOL_H
30 #define NVBLASTEXTAUTHORINGBOOLEANTOOL_H
31 
34 #include <vector>
35 #include "NvBlastTypes.h"
36 
37 
38 namespace Nv
39 {
40 namespace Blast
41 {
42 
43 class Mesh;
44 
49 {
50  int32_t ca, cb, ci;
51  BooleanConf(int32_t a, int32_t b, int32_t c) : ca(a), cb(b), ci(c)
52  {
53  }
54 };
55 
56 
57 namespace BooleanConfigurations
58 {
63 {
64  return BooleanConf(0, 0, 1);
65 }
66 
71 {
72  return BooleanConf(1, 1, -1);
73 }
78 {
79  return BooleanConf(1, 0, -1);
80 }
81 }
82 
87 {
88  int32_t edId;
91  EdgeFacetIntersectionData(int32_t edId, int32_t intersType, Vertex& inters) : edId(edId), intersectionType(intersType), intersectionPoint(inters)
92  { }
93  EdgeFacetIntersectionData(int32_t edId) : edId(edId)
94  { }
95  bool operator<(const EdgeFacetIntersectionData& b) const
96  {
97  return edId < b.edId;
98  }
99 };
100 
101 
102 class SpatialAccelerator;
103 
109 {
110 
111 public:
113  ~BooleanEvaluator();
114 
123  void performBoolean(const Mesh* meshA, const Mesh* meshB, SpatialAccelerator* spAccelA, SpatialAccelerator* spAccelB, BooleanConf mode);
124 
131  void performBoolean(const Mesh* meshA, const Mesh* meshB, BooleanConf mode);
132 
142  void performFastCutting(const Mesh* meshA, const Mesh* meshB, SpatialAccelerator* spAccelA, SpatialAccelerator* spAccelB, BooleanConf mode);
143 
151  void performFastCutting(const Mesh* meshA, const Mesh* meshB, BooleanConf mode);
152 
159  int32_t isPointContainedInMesh(const Mesh* mesh, const NvcVec3& point);
167  int32_t isPointContainedInMesh(const Mesh* mesh, SpatialAccelerator* spAccel, const NvcVec3& point);
168 
169 
174  Mesh* createNewMesh();
175 
179  void reset();
180 
181 private:
182 
183  void buildFaceFaceIntersections(BooleanConf);
184  void buildFastFaceFaceIntersection(BooleanConf);
185  void collectRetainedPartsFromA(BooleanConf mode);
186  void collectRetainedPartsFromB(BooleanConf mode);
187 
188  int32_t addIfNotExist(Vertex& p);
189  void addEdgeIfValid(EdgeWithParent& ed);
190 private:
191 
192  int32_t vertexMeshStatus03(const NvcVec3& p, const Mesh* mesh);
193  int32_t vertexMeshStatus30(const NvcVec3& p, const Mesh* mesh);
194 
195  const Mesh* mMeshA;
196  const Mesh* mMeshB;
197 
198  SpatialAccelerator* mAcceleratorA;
199  SpatialAccelerator* mAcceleratorB;
200 
201  std::vector<EdgeWithParent> mEdgeAggregate;
202  std::vector<Vertex> mVerticesAggregate;
203 
204  std::vector<std::vector<EdgeFacetIntersectionData> > mEdgeFacetIntersectionData12;
205  std::vector<std::vector<EdgeFacetIntersectionData> > mEdgeFacetIntersectionData21;
206 };
207 
208 } // namespace Blast
209 } // namespace Nv
210 
211 
212 #endif // ifndef NVBLASTEXTAUTHORINGBOOLEANTOOL_H
Vertex intersectionPoint
Definition: NvBlastExtAuthoringBooleanTool.h:90
+Go to the documentation of this file.
1 // This code contains NVIDIA Confidential Information and is disclosed to you
2 // under a form of NVIDIA software license agreement provided separately to you.
3 //
4 // Notice
5 // NVIDIA Corporation and its licensors retain all intellectual property and
6 // proprietary rights in and to this software and related documentation and
7 // any modifications thereto. Any use, reproduction, disclosure, or
8 // distribution of this software and related documentation without an express
9 // license agreement from NVIDIA Corporation is strictly prohibited.
10 //
11 // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12 // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15 //
16 // Information and code furnished is believed to be accurate and reliable.
17 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18 // information or for any infringement of patents or other rights of third parties that may
19 // result from its use. No license is granted by implication or otherwise under any patent
20 // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21 // This code supersedes and replaces all information previously supplied.
22 // NVIDIA Corporation products are not authorized for use as critical
23 // components in life support devices or systems without express written approval of
24 // NVIDIA Corporation.
25 //
26 // Copyright (c) 2016-2020 NVIDIA Corporation. All rights reserved.
27 
28 
29 #ifndef NVBLASTEXTAUTHORINGBOOLEANTOOL_H
30 #define NVBLASTEXTAUTHORINGBOOLEANTOOL_H
31 
34 #include <vector>
35 #include "NvBlastTypes.h"
36 
37 
38 namespace Nv
39 {
40 namespace Blast
41 {
42 
43 class Mesh;
44 
49 {
50  int32_t ca, cb, ci;
51  BooleanConf(int32_t a, int32_t b, int32_t c) : ca(a), cb(b), ci(c)
52  {
53  }
54 };
55 
56 
57 namespace BooleanConfigurations
58 {
63 {
64  return BooleanConf(0, 0, 1);
65 }
66 
71 {
72  return BooleanConf(1, 1, -1);
73 }
78 {
79  return BooleanConf(1, 0, -1);
80 }
81 }
82 
87 {
88  int32_t edId;
91  EdgeFacetIntersectionData(int32_t edId, int32_t intersType, Vertex& inters) : edId(edId), intersectionType(intersType), intersectionPoint(inters)
92  { }
93  EdgeFacetIntersectionData(int32_t edId) : edId(edId)
94  { }
95  bool operator<(const EdgeFacetIntersectionData& b) const
96  {
97  return edId < b.edId;
98  }
99 };
100 
101 
102 class SpatialAccelerator;
103 
109 {
110 
111 public:
113  ~BooleanEvaluator();
114 
123  void performBoolean(const Mesh* meshA, const Mesh* meshB, SpatialAccelerator* spAccelA, SpatialAccelerator* spAccelB, BooleanConf mode);
124 
131  void performBoolean(const Mesh* meshA, const Mesh* meshB, BooleanConf mode);
132 
142  void performFastCutting(const Mesh* meshA, const Mesh* meshB, SpatialAccelerator* spAccelA, SpatialAccelerator* spAccelB, BooleanConf mode);
143 
151  void performFastCutting(const Mesh* meshA, const Mesh* meshB, BooleanConf mode);
152 
159  int32_t isPointContainedInMesh(const Mesh* mesh, const NvcVec3& point);
167  int32_t isPointContainedInMesh(const Mesh* mesh, SpatialAccelerator* spAccel, const NvcVec3& point);
168 
169 
174  Mesh* createNewMesh();
175 
179  void reset();
180 
181 private:
182 
183  void buildFaceFaceIntersections(BooleanConf);
184  void buildFastFaceFaceIntersection(BooleanConf);
185  void collectRetainedPartsFromA(BooleanConf mode);
186  void collectRetainedPartsFromB(BooleanConf mode);
187 
188  int32_t addIfNotExist(Vertex& p);
189  void addEdgeIfValid(EdgeWithParent& ed);
190 private:
191 
192  int32_t vertexMeshStatus03(const NvcVec3& p, const Mesh* mesh);
193  int32_t vertexMeshStatus30(const NvcVec3& p, const Mesh* mesh);
194 
195  const Mesh* mMeshA;
196  const Mesh* mMeshB;
197 
198  SpatialAccelerator* mAcceleratorA;
199  SpatialAccelerator* mAcceleratorB;
200 
201  std::vector<EdgeWithParent> mEdgeAggregate;
202  std::vector<Vertex> mVerticesAggregate;
203 
204  std::vector<std::vector<EdgeFacetIntersectionData> > mEdgeFacetIntersectionData12;
205  std::vector<std::vector<EdgeFacetIntersectionData> > mEdgeFacetIntersectionData21;
206 };
207 
208 } // namespace Blast
209 } // namespace Nv
210 
211 
212 #endif // ifndef NVBLASTEXTAUTHORINGBOOLEANTOOL_H
Vertex intersectionPoint
Definition: NvBlastExtAuthoringBooleanTool.h:90
Definition: NvBlastExtAuthoringBooleanTool.h:108
Definition: NvBlastExtAuthoringInternalCommon.h:48
diff --git a/docs/source_docs/files/_nv_blast_ext_authoring_collision_builder_impl_8h_source.html b/docs/source_docs/files/_nv_blast_ext_authoring_collision_builder_impl_8h_source.html index 8b9c87e..f3eab2c 100755 --- a/docs/source_docs/files/_nv_blast_ext_authoring_collision_builder_impl_8h_source.html +++ b/docs/source_docs/files/_nv_blast_ext_authoring_collision_builder_impl_8h_source.html @@ -46,7 +46,7 @@ $(document).ready(function(){initNavTree('_nv_blast_ext_authoring_collision_buil
NvBlastExtAuthoringCollisionBuilderImpl.h
-Go to the documentation of this file.
1 // This code contains NVIDIA Confidential Information and is disclosed to you
2 // under a form of NVIDIA software license agreement provided separately to you.
3 //
4 // Notice
5 // NVIDIA Corporation and its licensors retain all intellectual property and
6 // proprietary rights in and to this software and related documentation and
7 // any modifications thereto. Any use, reproduction, disclosure, or
8 // distribution of this software and related documentation without an express
9 // license agreement from NVIDIA Corporation is strictly prohibited.
10 //
11 // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12 // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15 //
16 // Information and code furnished is believed to be accurate and reliable.
17 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18 // information or for any infringement of patents or other rights of third parties that may
19 // result from its use. No license is granted by implication or otherwise under any patent
20 // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21 // This code supersedes and replaces all information previously supplied.
22 // NVIDIA Corporation products are not authorized for use as critical
23 // components in life support devices or systems without express written approval of
24 // NVIDIA Corporation.
25 //
26 // Copyright (c) 2016-2018 NVIDIA Corporation. All rights reserved.
27 
28 
29 #ifndef NVBLASTEXTAUTHORINGCOLLISIONBUILDERIIMPL_H
30 #define NVBLASTEXTAUTHORINGCOLLISIONBUILDERIIMPL_H
31 
34 
35 namespace Nv
36 {
37 namespace Blast
38 {
39 
40 
41 void trimCollisionGeometry(ConvexMeshBuilder& cmb, uint32_t chunksCount, CollisionHull** in, const uint32_t* chunkDepth);
42 
43 int32_t buildMeshConvexDecomposition(ConvexMeshBuilder& cmb, const Triangle* mesh, uint32_t triangleCount,
44  const ConvexDecompositionParams& params, CollisionHull**& convexes);
45 
46 } // namespace Blast
47 } // namespace Nv
48 
49 
50 #endif // ifndef NVBLASTEXTAUTHORINGCOLLISIONBUILDERIIMPL_H
+Go to the documentation of this file.
1 // This code contains NVIDIA Confidential Information and is disclosed to you
2 // under a form of NVIDIA software license agreement provided separately to you.
3 //
4 // Notice
5 // NVIDIA Corporation and its licensors retain all intellectual property and
6 // proprietary rights in and to this software and related documentation and
7 // any modifications thereto. Any use, reproduction, disclosure, or
8 // distribution of this software and related documentation without an express
9 // license agreement from NVIDIA Corporation is strictly prohibited.
10 //
11 // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12 // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15 //
16 // Information and code furnished is believed to be accurate and reliable.
17 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18 // information or for any infringement of patents or other rights of third parties that may
19 // result from its use. No license is granted by implication or otherwise under any patent
20 // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21 // This code supersedes and replaces all information previously supplied.
22 // NVIDIA Corporation products are not authorized for use as critical
23 // components in life support devices or systems without express written approval of
24 // NVIDIA Corporation.
25 //
26 // Copyright (c) 2016-2020 NVIDIA Corporation. All rights reserved.
27 
28 
29 #ifndef NVBLASTEXTAUTHORINGCOLLISIONBUILDERIIMPL_H
30 #define NVBLASTEXTAUTHORINGCOLLISIONBUILDERIIMPL_H
31 
34 
35 namespace Nv
36 {
37 namespace Blast
38 {
39 
40 
41 void trimCollisionGeometry(ConvexMeshBuilder& cmb, uint32_t chunksCount, CollisionHull** in, const uint32_t* chunkDepth);
42 
43 int32_t buildMeshConvexDecomposition(ConvexMeshBuilder& cmb, const Triangle* mesh, uint32_t triangleCount,
44  const ConvexDecompositionParams& params, CollisionHull**& convexes);
45 
46 } // namespace Blast
47 } // namespace Nv
48 
49 
50 #endif // ifndef NVBLASTEXTAUTHORINGCOLLISIONBUILDERIIMPL_H
void trimCollisionGeometry(ConvexMeshBuilder &cmb, uint32_t chunksCount, CollisionHull **in, const uint32_t *chunkDepth)
int32_t buildMeshConvexDecomposition(ConvexMeshBuilder &cmb, const Triangle *mesh, uint32_t triangleCount, const ConvexDecompositionParams &params, CollisionHull **&convexes)
diff --git a/docs/source_docs/files/_nv_blast_ext_authoring_convex_mesh_builder_8h_source.html b/docs/source_docs/files/_nv_blast_ext_authoring_convex_mesh_builder_8h_source.html index 5a9fed0..79bbd98 100644 --- a/docs/source_docs/files/_nv_blast_ext_authoring_convex_mesh_builder_8h_source.html +++ b/docs/source_docs/files/_nv_blast_ext_authoring_convex_mesh_builder_8h_source.html @@ -46,7 +46,7 @@ $(document).ready(function(){initNavTree('_nv_blast_ext_authoring_convex_mesh_bu
NvBlastExtAuthoringConvexMeshBuilder.h
-Go to the documentation of this file.
1 // This code contains NVIDIA Confidential Information and is disclosed to you
2 // under a form of NVIDIA software license agreement provided separately to you.
3 //
4 // Notice
5 // NVIDIA Corporation and its licensors retain all intellectual property and
6 // proprietary rights in and to this software and related documentation and
7 // any modifications thereto. Any use, reproduction, disclosure, or
8 // distribution of this software and related documentation without an express
9 // license agreement from NVIDIA Corporation is strictly prohibited.
10 //
11 // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12 // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15 //
16 // Information and code furnished is believed to be accurate and reliable.
17 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18 // information or for any infringement of patents or other rights of third parties that may
19 // result from its use. No license is granted by implication or otherwise under any patent
20 // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21 // This code supersedes and replaces all information previously supplied.
22 // NVIDIA Corporation products are not authorized for use as critical
23 // components in life support devices or systems without express written approval of
24 // NVIDIA Corporation.
25 //
26 // Copyright (c) 2016-2018 NVIDIA Corporation. All rights reserved.
27 
28 
29 #ifndef NVBLASTEXTAUTHORINGCONVEXMESHBUILDER_H
30 #define NVBLASTEXTAUTHORINGCONVEXMESHBUILDER_H
31 
32 #include "NvCTypes.h"
33 
34 namespace Nv
35 {
36 namespace Blast
37 {
38 
39 struct CollisionHull;
40 
48 {
49 public:
50 
54  virtual void release() = 0;
55 
62  virtual CollisionHull* buildCollisionGeometry(uint32_t verticesCount, const NvcVec3* vertexData) = 0;
63 
67  virtual void releaseCollisionHull(CollisionHull* hull) const = 0;
68 };
69 
70 } // namespace Blast
71 } // namespace Nv
72 
73 
74 #endif // ifndef NVBLASTEXTAUTHORINGCONVEXMESHBUILDER_H
Definition: NvBlastExtAuthoringConvexMeshBuilder.h:47
+Go to the documentation of this file.
1 // This code contains NVIDIA Confidential Information and is disclosed to you
2 // under a form of NVIDIA software license agreement provided separately to you.
3 //
4 // Notice
5 // NVIDIA Corporation and its licensors retain all intellectual property and
6 // proprietary rights in and to this software and related documentation and
7 // any modifications thereto. Any use, reproduction, disclosure, or
8 // distribution of this software and related documentation without an express
9 // license agreement from NVIDIA Corporation is strictly prohibited.
10 //
11 // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12 // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15 //
16 // Information and code furnished is believed to be accurate and reliable.
17 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18 // information or for any infringement of patents or other rights of third parties that may
19 // result from its use. No license is granted by implication or otherwise under any patent
20 // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21 // This code supersedes and replaces all information previously supplied.
22 // NVIDIA Corporation products are not authorized for use as critical
23 // components in life support devices or systems without express written approval of
24 // NVIDIA Corporation.
25 //
26 // Copyright (c) 2016-2020 NVIDIA Corporation. All rights reserved.
27 
28 
29 #ifndef NVBLASTEXTAUTHORINGCONVEXMESHBUILDER_H
30 #define NVBLASTEXTAUTHORINGCONVEXMESHBUILDER_H
31 
32 #include "NvCTypes.h"
33 
34 namespace Nv
35 {
36 namespace Blast
37 {
38 
39 struct CollisionHull;
40 
48 {
49 public:
50 
54  virtual void release() = 0;
55 
62  virtual CollisionHull* buildCollisionGeometry(uint32_t verticesCount, const NvcVec3* vertexData) = 0;
63 
67  virtual void releaseCollisionHull(CollisionHull* hull) const = 0;
68 };
69 
70 } // namespace Blast
71 } // namespace Nv
72 
73 
74 #endif // ifndef NVBLASTEXTAUTHORINGCONVEXMESHBUILDER_H
Definition: NvBlastExtAuthoringConvexMeshBuilder.h:47
virtual CollisionHull * buildCollisionGeometry(uint32_t verticesCount, const NvcVec3 *vertexData)=0
Definition: NvBlastExtAuthoringTypes.h:133
diff --git a/docs/source_docs/files/_nv_blast_ext_authoring_cutout_8h_source.html b/docs/source_docs/files/_nv_blast_ext_authoring_cutout_8h_source.html index 365a85a..a277f69 100755 --- a/docs/source_docs/files/_nv_blast_ext_authoring_cutout_8h_source.html +++ b/docs/source_docs/files/_nv_blast_ext_authoring_cutout_8h_source.html @@ -46,7 +46,7 @@ $(document).ready(function(){initNavTree('_nv_blast_ext_authoring_cutout_8h_sour
NvBlastExtAuthoringCutout.h
-Go to the documentation of this file.
1 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
2 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
3 //
4 // Information and code furnished is believed to be accurate and reliable.
5 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
6 // information or for any infringement of patents or other rights of third parties that may
7 // result from its use. No license is granted by implication or otherwise under any patent
8 // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
9 // This code supersedes and replaces all information previously supplied.
10 // NVIDIA Corporation products are not authorized for use as critical
11 // components in life support devices or systems without express written approval of
12 // NVIDIA Corporation.
13 //
14 // Copyright (c) 2016-2018 NVIDIA Corporation. All rights reserved.
15 
16 #ifndef NVBLASTAUTHORINGCUTOUT_H
17 #define NVBLASTAUTHORINGCUTOUT_H
18 
20 
21 
22 namespace Nv
23 {
24 namespace Blast
25 {
26 
36 class CutoutSet
37 {
38 public:
40  virtual uint32_t getCutoutCount() const = 0;
41 
46  virtual uint32_t getCutoutVertexCount(uint32_t cutoutIndex, uint32_t loopIndex) const = 0;
47 
52  virtual uint32_t getCutoutLoopCount(uint32_t cutoutIndex) const = 0;
53 
58  virtual const NvcVec3& getCutoutVertex(uint32_t cutoutIndex, uint32_t loopIndex, uint32_t vertexIndex) const = 0;
59 
63  virtual bool isCutoutVertexToggleSmoothingGroup(uint32_t cutoutIndex, uint32_t loopIndex, uint32_t vertexIndex) const = 0;
64 
68  virtual bool isPeriodic() const = 0;
69 
73  virtual const NvcVec2& getDimensions() const = 0;
74 
76  virtual void release() = 0;
77 
78 protected:
80  virtual ~CutoutSet() {}
81 };
82 
83 } // namespace Blast
84 } // namespace Nv
85 
86 
87 #endif // idndef NVBLASTAUTHORINGCUTOUT_H
virtual const NvcVec3 & getCutoutVertex(uint32_t cutoutIndex, uint32_t loopIndex, uint32_t vertexIndex) const =0
+Go to the documentation of this file.
1 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
2 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
3 //
4 // Information and code furnished is believed to be accurate and reliable.
5 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
6 // information or for any infringement of patents or other rights of third parties that may
7 // result from its use. No license is granted by implication or otherwise under any patent
8 // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
9 // This code supersedes and replaces all information previously supplied.
10 // NVIDIA Corporation products are not authorized for use as critical
11 // components in life support devices or systems without express written approval of
12 // NVIDIA Corporation.
13 //
14 // Copyright (c) 2016-2020 NVIDIA Corporation. All rights reserved.
15 
16 #ifndef NVBLASTAUTHORINGCUTOUT_H
17 #define NVBLASTAUTHORINGCUTOUT_H
18 
20 
21 
22 namespace Nv
23 {
24 namespace Blast
25 {
26 
36 class CutoutSet
37 {
38 public:
40  virtual uint32_t getCutoutCount() const = 0;
41 
46  virtual uint32_t getCutoutVertexCount(uint32_t cutoutIndex, uint32_t loopIndex) const = 0;
47 
52  virtual uint32_t getCutoutLoopCount(uint32_t cutoutIndex) const = 0;
53 
58  virtual const NvcVec3& getCutoutVertex(uint32_t cutoutIndex, uint32_t loopIndex, uint32_t vertexIndex) const = 0;
59 
63  virtual bool isCutoutVertexToggleSmoothingGroup(uint32_t cutoutIndex, uint32_t loopIndex, uint32_t vertexIndex) const = 0;
64 
68  virtual bool isPeriodic() const = 0;
69 
73  virtual const NvcVec2& getDimensions() const = 0;
74 
76  virtual void release() = 0;
77 
78 protected:
80  virtual ~CutoutSet() {}
81 };
82 
83 } // namespace Blast
84 } // namespace Nv
85 
86 
87 #endif // idndef NVBLASTAUTHORINGCUTOUT_H
virtual const NvcVec3 & getCutoutVertex(uint32_t cutoutIndex, uint32_t loopIndex, uint32_t vertexIndex) const =0
virtual ~CutoutSet()
Definition: NvBlastExtAuthoringCutout.h:80
Definition: NvBlastExtAuthoringCutout.h:36
diff --git a/docs/source_docs/files/_nv_blast_ext_authoring_cutout_impl_8h_source.html b/docs/source_docs/files/_nv_blast_ext_authoring_cutout_impl_8h_source.html index 2857547..695b594 100755 --- a/docs/source_docs/files/_nv_blast_ext_authoring_cutout_impl_8h_source.html +++ b/docs/source_docs/files/_nv_blast_ext_authoring_cutout_impl_8h_source.html @@ -46,7 +46,7 @@ $(document).ready(function(){initNavTree('_nv_blast_ext_authoring_cutout_impl_8h
NvBlastExtAuthoringCutoutImpl.h
-Go to the documentation of this file.
1 // This code contains NVIDIA Confidential Information and is disclosed to you
2 // under a form of NVIDIA software license agreement provided separately to you.
3 //
4 // Notice
5 // NVIDIA Corporation and its licensors retain all intellectual property and
6 // proprietary rights in and to this software and related documentation and
7 // any modifications thereto. Any use, reproduction, disclosure, or
8 // distribution of this software and related documentation without an express
9 // license agreement from NVIDIA Corporation is strictly prohibited.
10 //
11 // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12 // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15 //
16 // Information and code furnished is believed to be accurate and reliable.
17 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18 // information or for any infringement of patents or other rights of third parties that may
19 // result from its use. No license is granted by implication or otherwise under any patent
20 // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21 // This code supersedes and replaces all information previously supplied.
22 // NVIDIA Corporation products are not authorized for use as critical
23 // components in life support devices or systems without express written approval of
24 // NVIDIA Corporation.
25 //
26 // Copyright (c) 2016-2018 NVIDIA Corporation. All rights reserved.
27 
28 
29 #ifndef NVBLASTAUTHORINGFCUTOUTIMPL_H
30 #define NVBLASTAUTHORINGFCUTOUTIMPL_H
31 
33 #include <vector>
34 #include <PxVec2.h>
35 #include <PxVec3.h>
36 #include <PxMat44.h>
37 
38 namespace Nv
39 {
40 namespace Blast
41 {
42 
43 struct PolyVert
44 {
45  uint16_t index;
46  uint16_t flags;
47 };
48 
49 struct ConvexLoop
50 {
51  std::vector<PolyVert> polyVerts;
52 };
53 
54 struct Cutout
55 {
56  std::vector<physx::PxVec3> vertices;
57  //std::vector<ConvexLoop> convexLoops;
58  std::vector<physx::PxVec3> smoothingGroups;
59 };
60 
61 struct POINT2D
62 {
63  POINT2D() {}
64  POINT2D(int32_t _x, int32_t _y) : x(_x), y(_y) {}
65 
66  int32_t x;
67  int32_t y;
68 
69  bool operator==(const POINT2D& other) const
70  {
71  return x == other.x && y == other.y;
72  }
73  bool operator<(const POINT2D& other) const
74  {
75  if (x == other.x) return y < other.y;
76  return x < other.x;
77  }
78 };
79 
80 struct CutoutSetImpl : public CutoutSet
81 {
82  CutoutSetImpl() : periodic(false), dimensions(0.0f)
83  {
84  }
85 
86  uint32_t getCutoutCount() const
87  {
88  return (uint32_t)cutouts.size() - 1;
89  }
90 
91  uint32_t getCutoutVertexCount(uint32_t cutoutIndex, uint32_t loopIndex) const
92  {
93  return (uint32_t)cutoutLoops[cutouts[cutoutIndex] + loopIndex].vertices.size();
94  }
95  uint32_t getCutoutLoopCount(uint32_t cutoutIndex) const
96  {
97  return (uint32_t)cutouts[cutoutIndex + 1] - cutouts[cutoutIndex];
98  }
99 
100  const NvcVec3& getCutoutVertex(uint32_t cutoutIndex, uint32_t loopIndex, uint32_t vertexIndex) const;
101 
102  bool isCutoutVertexToggleSmoothingGroup(uint32_t cutoutIndex, uint32_t loopIndex, uint32_t vertexIndex) const
103  {
104  auto& vRef = cutoutLoops[cutouts[cutoutIndex] + loopIndex].vertices[vertexIndex];
105  for (auto& v : cutoutLoops[cutouts[cutoutIndex] + loopIndex].smoothingGroups)
106  {
107  if ((vRef - v).magnitudeSquared() < 1e-5)
108  {
109  return true;
110  }
111  }
112  return false;
113  }
114 
115  bool isPeriodic() const
116  {
117  return periodic;
118  }
119  const NvcVec2& getDimensions() const;
120 
121  //void serialize(physx::PxFileBuf& stream) const;
122  //void deserialize(physx::PxFileBuf& stream);
123 
124  void release()
125  {
126  delete this;
127  }
128 
129  std::vector<Cutout> cutoutLoops;
130  std::vector<uint32_t> cutouts;
131  bool periodic;
132  physx::PxVec2 dimensions;
133 };
134 
135 void createCutoutSet(Nv::Blast::CutoutSetImpl& cutoutSet, const uint8_t* pixelBuffer, uint32_t bufferWidth, uint32_t bufferHeight,
136  float segmentationErrorThreshold, float snapThreshold, bool periodic, bool expandGaps);
137 
138 
139 } // namespace Blast
140 } // namespace Nv
141 
142 #endif // ifndef NVBLASTAUTHORINGFCUTOUTIMPL_H
std::vector< physx::PxVec3 > vertices
Definition: NvBlastExtAuthoringCutoutImpl.h:56
+Go to the documentation of this file.
1 // This code contains NVIDIA Confidential Information and is disclosed to you
2 // under a form of NVIDIA software license agreement provided separately to you.
3 //
4 // Notice
5 // NVIDIA Corporation and its licensors retain all intellectual property and
6 // proprietary rights in and to this software and related documentation and
7 // any modifications thereto. Any use, reproduction, disclosure, or
8 // distribution of this software and related documentation without an express
9 // license agreement from NVIDIA Corporation is strictly prohibited.
10 //
11 // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12 // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15 //
16 // Information and code furnished is believed to be accurate and reliable.
17 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18 // information or for any infringement of patents or other rights of third parties that may
19 // result from its use. No license is granted by implication or otherwise under any patent
20 // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21 // This code supersedes and replaces all information previously supplied.
22 // NVIDIA Corporation products are not authorized for use as critical
23 // components in life support devices or systems without express written approval of
24 // NVIDIA Corporation.
25 //
26 // Copyright (c) 2016-2020 NVIDIA Corporation. All rights reserved.
27 
28 
29 #ifndef NVBLASTAUTHORINGFCUTOUTIMPL_H
30 #define NVBLASTAUTHORINGFCUTOUTIMPL_H
31 
33 #include <vector>
34 #include <PxVec2.h>
35 #include <PxVec3.h>
36 #include <PxMat44.h>
37 
38 namespace Nv
39 {
40 namespace Blast
41 {
42 
43 struct PolyVert
44 {
45  uint16_t index;
46  uint16_t flags;
47 };
48 
49 struct ConvexLoop
50 {
51  std::vector<PolyVert> polyVerts;
52 };
53 
54 struct Cutout
55 {
56  std::vector<physx::PxVec3> vertices;
57  //std::vector<ConvexLoop> convexLoops;
58  std::vector<physx::PxVec3> smoothingGroups;
59 };
60 
61 struct POINT2D
62 {
63  POINT2D() {}
64  POINT2D(int32_t _x, int32_t _y) : x(_x), y(_y) {}
65 
66  int32_t x;
67  int32_t y;
68 
69  bool operator==(const POINT2D& other) const
70  {
71  return x == other.x && y == other.y;
72  }
73  bool operator<(const POINT2D& other) const
74  {
75  if (x == other.x) return y < other.y;
76  return x < other.x;
77  }
78 };
79 
80 struct CutoutSetImpl : public CutoutSet
81 {
82  CutoutSetImpl() : periodic(false), dimensions(0.0f)
83  {
84  }
85 
86  uint32_t getCutoutCount() const
87  {
88  return (uint32_t)cutouts.size() - 1;
89  }
90 
91  uint32_t getCutoutVertexCount(uint32_t cutoutIndex, uint32_t loopIndex) const
92  {
93  return (uint32_t)cutoutLoops[cutouts[cutoutIndex] + loopIndex].vertices.size();
94  }
95  uint32_t getCutoutLoopCount(uint32_t cutoutIndex) const
96  {
97  return (uint32_t)cutouts[cutoutIndex + 1] - cutouts[cutoutIndex];
98  }
99 
100  const NvcVec3& getCutoutVertex(uint32_t cutoutIndex, uint32_t loopIndex, uint32_t vertexIndex) const;
101 
102  bool isCutoutVertexToggleSmoothingGroup(uint32_t cutoutIndex, uint32_t loopIndex, uint32_t vertexIndex) const
103  {
104  auto& vRef = cutoutLoops[cutouts[cutoutIndex] + loopIndex].vertices[vertexIndex];
105  for (auto& v : cutoutLoops[cutouts[cutoutIndex] + loopIndex].smoothingGroups)
106  {
107  if ((vRef - v).magnitudeSquared() < 1e-5)
108  {
109  return true;
110  }
111  }
112  return false;
113  }
114 
115  bool isPeriodic() const
116  {
117  return periodic;
118  }
119  const NvcVec2& getDimensions() const;
120 
121  //void serialize(physx::PxFileBuf& stream) const;
122  //void deserialize(physx::PxFileBuf& stream);
123 
124  void release()
125  {
126  delete this;
127  }
128 
129  std::vector<Cutout> cutoutLoops;
130  std::vector<uint32_t> cutouts;
131  bool periodic;
132  physx::PxVec2 dimensions;
133 };
134 
135 void createCutoutSet(Nv::Blast::CutoutSetImpl& cutoutSet, const uint8_t* pixelBuffer, uint32_t bufferWidth, uint32_t bufferHeight,
136  float segmentationErrorThreshold, float snapThreshold, bool periodic, bool expandGaps);
137 
138 
139 } // namespace Blast
140 } // namespace Nv
141 
142 #endif // ifndef NVBLASTAUTHORINGFCUTOUTIMPL_H
std::vector< physx::PxVec3 > vertices
Definition: NvBlastExtAuthoringCutoutImpl.h:56
SIMD_FORCE_INLINE const btScalar & x() const
Return the x value.
Definition: btVector3.h:275
Definition: NvBlastExtAuthoringCutout.h:36
Definition: NvBlastExtAuthoringCutoutImpl.h:61
diff --git a/docs/source_docs/files/_nv_blast_ext_authoring_fracture_tool_8h_source.html b/docs/source_docs/files/_nv_blast_ext_authoring_fracture_tool_8h_source.html index dca90a8..7d4f34a 100755 --- a/docs/source_docs/files/_nv_blast_ext_authoring_fracture_tool_8h_source.html +++ b/docs/source_docs/files/_nv_blast_ext_authoring_fracture_tool_8h_source.html @@ -46,7 +46,7 @@ $(document).ready(function(){initNavTree('_nv_blast_ext_authoring_fracture_tool_
NvBlastExtAuthoringFractureTool.h
-Go to the documentation of this file.
1 // This code contains NVIDIA Confidential Information and is disclosed to you
2 // under a form of NVIDIA software license agreement provided separately to you.
3 //
4 // Notice
5 // NVIDIA Corporation and its licensors retain all intellectual property and
6 // proprietary rights in and to this software and related documentation and
7 // any modifications thereto. Any use, reproduction, disclosure, or
8 // distribution of this software and related documentation without an express
9 // license agreement from NVIDIA Corporation is strictly prohibited.
10 //
11 // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12 // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15 //
16 // Information and code furnished is believed to be accurate and reliable.
17 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18 // information or for any infringement of patents or other rights of third parties that may
19 // result from its use. No license is granted by implication or otherwise under any patent
20 // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21 // This code supersedes and replaces all information previously supplied.
22 // NVIDIA Corporation products are not authorized for use as critical
23 // components in life support devices or systems without express written approval of
24 // NVIDIA Corporation.
25 //
26 // Copyright (c) 2016-2018 NVIDIA Corporation. All rights reserved.
27 
28 
29 #ifndef NVBLASTAUTHORINGFRACTURETOOL_H
30 #define NVBLASTAUTHORINGFRACTURETOOL_H
31 
33 
34 namespace Nv
35 {
36 namespace Blast
37 {
38 
39 class SpatialAccelerator;
40 class Triangulator;
41 class Mesh;
42 class CutoutSet;
43 
44 /*
45  Chunk data, chunk with chunkId == 0 is always source mesh.
46 */
47 struct ChunkInfo
48 {
50  {
51  NO_FLAGS = 0,
52  APPROXIMATE_BONDING = 1 // Created by island splitting or chunk merge, etc. and should check for inexact bonds
53  };
54 
56  int32_t parent;
57  int32_t chunkId;
58  uint32_t flags;
59  bool isLeaf;
60  bool isChanged;
61 };
62 
67 {
68  public:
69  // Generates uniformly distributed value in [0, 1] range.
70  virtual float getRandomValue() = 0;
71  // Seeds random value generator
72  virtual void seed(int32_t seed) = 0;
73  virtual ~RandomGeneratorBase(){};
74 };
75 
76 /*
77  Noise fracturing configuration for chunks's faces
78 */
80 {
86  float amplitude = 0.f;
87 
91  float frequency = 1.f;
92 
96  uint32_t octaveNumber = 1;
97 
101  NvcVec3 samplingInterval = { 1, 1, 1 };
102 };
103 
104 /*
105  Slicing fracturing configuration
106 */
108 {
112  int32_t x_slices = 1, y_slices = 1, z_slices = 1;
113 
117  float offset_variations = 0.f;
118 
122  float angle_variations = 0.f;
123 
124  /*
125  Noise parameters for faces between sliced chunks
126  */
128 };
129 
134 {
139  CutoutSet* cutoutSet = nullptr;
140 
145  NvcTransform transform = {{0, 0, 0, 1}, {0, 0, 0}};
146 
152  NvcVec2 scale = { -1, -1 };
153 
157  float aperture = 0.f;
158 
163  bool isRelativeTransform = true;
164 
168  bool useSmoothing = false;
169 
174 };
175 
180 {
181  public:
183 
187  virtual void release() = 0;
188 
192  virtual void setBaseMesh(const Mesh* mesh) = 0;
193 
199  virtual uint32_t getVoronoiSites(const NvcVec3*& sites) = 0;
200 
205  virtual void addSite(const NvcVec3& site) = 0;
210  virtual void uniformlyGenerateSitesInMesh(uint32_t numberOfSites) = 0;
211 
218  virtual void clusteredSitesGeneration(uint32_t numberOfClusters, uint32_t sitesPerCluster, float clusterRadius) = 0;
219 
230  virtual void radialPattern(const NvcVec3& center, const NvcVec3& normal, float radius, int32_t angularSteps,
231  int32_t radialSteps, float angleOffset = 0.0f, float variability = 0.0f) = 0;
232 
239  virtual void generateInSphere(const uint32_t count, const float radius, const NvcVec3& center) = 0;
240 
245  virtual void setStencil(const Mesh* stencil) = 0;
246 
250  virtual void clearStencil() = 0;
251 
258  virtual void deleteInSphere(const float radius, const NvcVec3& center, const float eraserProbability = 1) = 0;
259 };
260 
265 {
266 
267  public:
268  virtual ~FractureTool() {}
269 
273  virtual void release() = 0;
274 
278  virtual void reset() = 0;
279 
280 
284  virtual void setSourceMesh(const Mesh* mesh) = 0;
285 
289  virtual int32_t setChunkMesh(const Mesh* mesh, int32_t parentId) = 0;
290 
294  virtual void setInteriorMaterialId(int32_t materialId) = 0;
295 
299  virtual int32_t getInteriorMaterialId() const = 0;
300 
304  virtual void replaceMaterialId(int32_t oldMaterialId, int32_t newMaterialId) = 0;
305 
309  virtual Mesh* createChunkMesh(int32_t chunkId) = 0;
310 
315  virtual void getTransformation(NvcVec3& offset, float& scale) = 0;
316 
317 
326  virtual int32_t
327  voronoiFracturing(uint32_t chunkId, uint32_t cellCount, const NvcVec3* cellPoints, bool replaceChunk) = 0;
328 
340  virtual int32_t voronoiFracturing(uint32_t chunkId, uint32_t cellCount, const NvcVec3* cellPoints,
341  const NvcVec3& scale, const NvcQuat& rotation, bool replaceChunk) = 0;
342 
343 
355  virtual int32_t
356  slicing(uint32_t chunkId, const SlicingConfiguration& conf, bool replaceChunk, RandomGeneratorBase* rnd) = 0;
357 
371  virtual int32_t cut(uint32_t chunkId, const NvcVec3& normal, const NvcVec3& position,
372  const NoiseConfiguration& noise, bool replaceChunk, RandomGeneratorBase* rnd) = 0;
373 
385  virtual int32_t cutout(uint32_t chunkId, CutoutConfiguration conf, bool replaceChunk, RandomGeneratorBase* rnd) = 0;
386 
387 
391  virtual void finalizeFracturing() = 0;
392 
396  virtual uint32_t getChunkCount() const = 0;
397 
401  virtual const ChunkInfo& getChunkInfo(int32_t chunkIndex) = 0;
402 
410  virtual float getMeshOverlap(const Mesh& meshA, const Mesh& meshB) = 0;
411 
418  virtual uint32_t getBaseMesh(int32_t chunkIndex, Triangle*& output) = 0;
419 
427  virtual uint32_t updateBaseMesh(int32_t chunkIndex, Triangle* output) = 0;
428 
434  virtual int32_t getChunkIndex(int32_t chunkId) = 0;
435 
441  virtual int32_t getChunkId(int32_t chunkIndex) = 0;
442 
448  virtual int32_t getChunkDepth(int32_t chunkId) = 0;
449 
456  virtual uint32_t getChunksIdAtDepth(uint32_t depth, int32_t*& chunkIds) = 0;
457 
467  virtual uint32_t
468  getBufferedBaseMeshes(Vertex*& vertexBuffer, uint32_t*& indexBuffer, uint32_t*& indexBufferOffsets) = 0;
469 
474  virtual void setRemoveIslands(bool isRemoveIslands) = 0;
475 
481  virtual int32_t islandDetectionAndRemoving(int32_t chunkId, bool createAtNewDepth = false) = 0;
482 
487  virtual bool isMeshContainOpenEdges(const Mesh* input) = 0;
488 
495  virtual bool deleteChunkSubhierarchy(int32_t chunkId, bool deleteRoot = false) = 0;
496 
510  virtual void uniteChunks(uint32_t threshold, uint32_t targetClusterSize,
511  const uint32_t* chunksToMerge, uint32_t mergeChunkCount,
512  const NvcVec2i* adjChunks, uint32_t adjChunksSize,
513  bool removeOriginalChunks = false) = 0;
514 
521  virtual bool setApproximateBonding(uint32_t chunkIndex, bool useApproximateBonding) = 0;
522 
528  virtual void fitUvToRect(float side, uint32_t chunkId) = 0;
529 
534  virtual void fitAllUvToRect(float side) = 0;
535 };
536 
537 } // namespace Blast
538 } // namespace Nv
539 
540 #endif // ifndef NVBLASTAUTHORINGFRACTURETOOL_H
Definition: NvBlastExtAuthoringFractureTool.h:107
+Go to the documentation of this file.
1 // This code contains NVIDIA Confidential Information and is disclosed to you
2 // under a form of NVIDIA software license agreement provided separately to you.
3 //
4 // Notice
5 // NVIDIA Corporation and its licensors retain all intellectual property and
6 // proprietary rights in and to this software and related documentation and
7 // any modifications thereto. Any use, reproduction, disclosure, or
8 // distribution of this software and related documentation without an express
9 // license agreement from NVIDIA Corporation is strictly prohibited.
10 //
11 // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12 // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15 //
16 // Information and code furnished is believed to be accurate and reliable.
17 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18 // information or for any infringement of patents or other rights of third parties that may
19 // result from its use. No license is granted by implication or otherwise under any patent
20 // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21 // This code supersedes and replaces all information previously supplied.
22 // NVIDIA Corporation products are not authorized for use as critical
23 // components in life support devices or systems without express written approval of
24 // NVIDIA Corporation.
25 //
26 // Copyright (c) 2016-2020 NVIDIA Corporation. All rights reserved.
27 
28 
29 #ifndef NVBLASTAUTHORINGFRACTURETOOL_H
30 #define NVBLASTAUTHORINGFRACTURETOOL_H
31 
33 
34 namespace Nv
35 {
36 namespace Blast
37 {
38 
39 class SpatialAccelerator;
40 class Triangulator;
41 class Mesh;
42 class CutoutSet;
43 
44 /*
45  Chunk data, chunk with chunkId == 0 is always source mesh.
46 */
47 struct ChunkInfo
48 {
50  {
51  NO_FLAGS = 0,
52  APPROXIMATE_BONDING = 1 // Created by island splitting or chunk merge, etc. and should check for inexact bonds
53  };
54 
56  int32_t parent;
57  int32_t chunkId;
58  uint32_t flags;
59  bool isLeaf;
60  bool isChanged;
61 };
62 
67 {
68  public:
69  // Generates uniformly distributed value in [0, 1] range.
70  virtual float getRandomValue() = 0;
71  // Seeds random value generator
72  virtual void seed(int32_t seed) = 0;
73  virtual ~RandomGeneratorBase(){};
74 };
75 
76 /*
77  Noise fracturing configuration for chunks's faces
78 */
80 {
86  float amplitude = 0.f;
87 
91  float frequency = 1.f;
92 
96  uint32_t octaveNumber = 1;
97 
101  NvcVec3 samplingInterval = { 1, 1, 1 };
102 };
103 
104 /*
105  Slicing fracturing configuration
106 */
108 {
112  int32_t x_slices = 1, y_slices = 1, z_slices = 1;
113 
117  float offset_variations = 0.f;
118 
122  float angle_variations = 0.f;
123 
124  /*
125  Noise parameters for faces between sliced chunks
126  */
128 };
129 
134 {
139  CutoutSet* cutoutSet = nullptr;
140 
145  NvcTransform transform = {{0, 0, 0, 1}, {0, 0, 0}};
146 
152  NvcVec2 scale = { -1, -1 };
153 
157  float aperture = 0.f;
158 
163  bool isRelativeTransform = true;
164 
168  bool useSmoothing = false;
169 
174 };
175 
180 {
181  public:
183 
187  virtual void release() = 0;
188 
192  virtual void setBaseMesh(const Mesh* mesh) = 0;
193 
199  virtual uint32_t getVoronoiSites(const NvcVec3*& sites) = 0;
200 
205  virtual void addSite(const NvcVec3& site) = 0;
210  virtual void uniformlyGenerateSitesInMesh(uint32_t numberOfSites) = 0;
211 
218  virtual void clusteredSitesGeneration(uint32_t numberOfClusters, uint32_t sitesPerCluster, float clusterRadius) = 0;
219 
230  virtual void radialPattern(const NvcVec3& center, const NvcVec3& normal, float radius, int32_t angularSteps,
231  int32_t radialSteps, float angleOffset = 0.0f, float variability = 0.0f) = 0;
232 
239  virtual void generateInSphere(const uint32_t count, const float radius, const NvcVec3& center) = 0;
240 
245  virtual void setStencil(const Mesh* stencil) = 0;
246 
250  virtual void clearStencil() = 0;
251 
258  virtual void deleteInSphere(const float radius, const NvcVec3& center, const float eraserProbability = 1) = 0;
259 };
260 
265 {
266 
267  public:
268  virtual ~FractureTool() {}
269 
273  virtual void release() = 0;
274 
278  virtual void reset() = 0;
279 
280 
284  virtual void setSourceMesh(const Mesh* mesh) = 0;
285 
289  virtual int32_t setChunkMesh(const Mesh* mesh, int32_t parentId) = 0;
290 
294  virtual void setInteriorMaterialId(int32_t materialId) = 0;
295 
299  virtual int32_t getInteriorMaterialId() const = 0;
300 
304  virtual void replaceMaterialId(int32_t oldMaterialId, int32_t newMaterialId) = 0;
305 
309  virtual Mesh* createChunkMesh(int32_t chunkId) = 0;
310 
315  virtual void getTransformation(NvcVec3& offset, float& scale) = 0;
316 
317 
326  virtual int32_t
327  voronoiFracturing(uint32_t chunkId, uint32_t cellCount, const NvcVec3* cellPoints, bool replaceChunk) = 0;
328 
340  virtual int32_t voronoiFracturing(uint32_t chunkId, uint32_t cellCount, const NvcVec3* cellPoints,
341  const NvcVec3& scale, const NvcQuat& rotation, bool replaceChunk) = 0;
342 
343 
355  virtual int32_t
356  slicing(uint32_t chunkId, const SlicingConfiguration& conf, bool replaceChunk, RandomGeneratorBase* rnd) = 0;
357 
371  virtual int32_t cut(uint32_t chunkId, const NvcVec3& normal, const NvcVec3& position,
372  const NoiseConfiguration& noise, bool replaceChunk, RandomGeneratorBase* rnd) = 0;
373 
385  virtual int32_t cutout(uint32_t chunkId, CutoutConfiguration conf, bool replaceChunk, RandomGeneratorBase* rnd) = 0;
386 
387 
391  virtual void finalizeFracturing() = 0;
392 
396  virtual uint32_t getChunkCount() const = 0;
397 
401  virtual const ChunkInfo& getChunkInfo(int32_t chunkIndex) = 0;
402 
410  virtual float getMeshOverlap(const Mesh& meshA, const Mesh& meshB) = 0;
411 
418  virtual uint32_t getBaseMesh(int32_t chunkIndex, Triangle*& output) = 0;
419 
427  virtual uint32_t updateBaseMesh(int32_t chunkIndex, Triangle* output) = 0;
428 
434  virtual int32_t getChunkIndex(int32_t chunkId) = 0;
435 
441  virtual int32_t getChunkId(int32_t chunkIndex) = 0;
442 
448  virtual int32_t getChunkDepth(int32_t chunkId) = 0;
449 
456  virtual uint32_t getChunksIdAtDepth(uint32_t depth, int32_t*& chunkIds) = 0;
457 
467  virtual uint32_t
468  getBufferedBaseMeshes(Vertex*& vertexBuffer, uint32_t*& indexBuffer, uint32_t*& indexBufferOffsets) = 0;
469 
474  virtual void setRemoveIslands(bool isRemoveIslands) = 0;
475 
481  virtual int32_t islandDetectionAndRemoving(int32_t chunkId, bool createAtNewDepth = false) = 0;
482 
487  virtual bool isMeshContainOpenEdges(const Mesh* input) = 0;
488 
495  virtual bool deleteChunkSubhierarchy(int32_t chunkId, bool deleteRoot = false) = 0;
496 
510  virtual void uniteChunks(uint32_t threshold, uint32_t targetClusterSize,
511  const uint32_t* chunksToMerge, uint32_t mergeChunkCount,
512  const NvcVec2i* adjChunks, uint32_t adjChunksSize,
513  bool removeOriginalChunks = false) = 0;
514 
521  virtual bool setApproximateBonding(uint32_t chunkIndex, bool useApproximateBonding) = 0;
522 
528  virtual void fitUvToRect(float side, uint32_t chunkId) = 0;
529 
534  virtual void fitAllUvToRect(float side) = 0;
535 };
536 
537 } // namespace Blast
538 } // namespace Nv
539 
540 #endif // ifndef NVBLASTAUTHORINGFRACTURETOOL_H
Definition: NvBlastExtAuthoringFractureTool.h:107
Definition: NvBlastExtAuthoringFractureTool.h:47
Definition: NvBlastExtAuthoringFractureTool.h:179
NV_INLINE float normal(const float a[3], float r[3])
Definition: NvBlastMath.h:93
diff --git a/docs/source_docs/files/_nv_blast_ext_authoring_fracture_tool_impl_8h_source.html b/docs/source_docs/files/_nv_blast_ext_authoring_fracture_tool_impl_8h_source.html index 5f02e2c..15997ef 100755 --- a/docs/source_docs/files/_nv_blast_ext_authoring_fracture_tool_impl_8h_source.html +++ b/docs/source_docs/files/_nv_blast_ext_authoring_fracture_tool_impl_8h_source.html @@ -46,7 +46,7 @@ $(document).ready(function(){initNavTree('_nv_blast_ext_authoring_fracture_tool_
NvBlastExtAuthoringFractureToolImpl.h
-Go to the documentation of this file.
1 // This code contains NVIDIA Confidential Information and is disclosed to you
2 // under a form of NVIDIA software license agreement provided separately to you.
3 //
4 // Notice
5 // NVIDIA Corporation and its licensors retain all intellectual property and
6 // proprietary rights in and to this software and related documentation and
7 // any modifications thereto. Any use, reproduction, disclosure, or
8 // distribution of this software and related documentation without an express
9 // license agreement from NVIDIA Corporation is strictly prohibited.
10 //
11 // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12 // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15 //
16 // Information and code furnished is believed to be accurate and reliable.
17 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18 // information or for any infringement of patents or other rights of third parties that may
19 // result from its use. No license is granted by implication or otherwise under any patent
20 // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21 // This code supersedes and replaces all information previously supplied.
22 // NVIDIA Corporation products are not authorized for use as critical
23 // components in life support devices or systems without express written approval of
24 // NVIDIA Corporation.
25 //
26 // Copyright (c) 2016-2018 NVIDIA Corporation. All rights reserved.
27 
28 #ifndef NVBLASTAUTHORINGFRACTURETOOLIMPL_H
29 #define NVBLASTAUTHORINGFRACTURETOOLIMPL_H
30 
33 #include <vector>
34 #include <set>
35 
36 namespace Nv
37 {
38 namespace Blast
39 {
40 
41 class SpatialAccelerator;
42 class Triangulator;
43 
44 
49 {
50 public:
51 
61 
62  void release() override;
63 
67  void setBaseMesh(const Mesh* m) override;
68 
75  uint32_t getVoronoiSites(const NvcVec3*& sites) override;
76 
81  void addSite(const NvcVec3& site) override;
86  void uniformlyGenerateSitesInMesh(uint32_t numberOfSites) override;
87 
94  void clusteredSitesGeneration(uint32_t numberOfClusters, uint32_t sitesPerCluster, float clusterRadius) override;
95 
106  void radialPattern(const NvcVec3& center, const NvcVec3& normal, float radius, int32_t angularSteps, int32_t radialSteps, float angleOffset = 0.0f, float variability = 0.0f) override;
107 
114  void generateInSphere(const uint32_t count, const float radius, const NvcVec3& center) override;
119  void setStencil(const Mesh* stencil) override;
123  void clearStencil() override;
124 
131  void deleteInSphere(const float radius, const NvcVec3& center, const float eraserProbability = 1) override;
132 
133 private:
134  std::vector <NvcVec3> mGeneratedSites;
135  const Mesh* mMesh;
136  const Mesh* mStencil;
137  RandomGeneratorBase* mRnd;
138  SpatialAccelerator* mAccelerator;
139 };
140 
141 
142 
147 {
148 
149 public:
150 
155  {
156  mPlaneIndexerOffset = 1;
157  mChunkIdCounter = 0;
158  mRemoveIslands = false;
159  mInteriorMaterialId = kMaterialInteriorId;
160  }
161 
163  {
164  reset();
165  }
166 
167  void release() override;
168 
172  void reset() override;
173 
177  void setInteriorMaterialId(int32_t materialId) override;
178 
182  int32_t getInteriorMaterialId() const override;
183 
187  void replaceMaterialId(int32_t oldMaterialId, int32_t newMaterialId) override;
188 
192  void setSourceMesh(const Mesh* mesh) override;
193 
197  int32_t setChunkMesh(const Mesh* mesh, int32_t parentId) override;
198 
202  Mesh* createChunkMesh(int32_t chunkId) override;
203 
208  void getTransformation(NvcVec3& offset, float& scale) override;
209 
210 
219  int32_t voronoiFracturing(uint32_t chunkId, uint32_t cellCount, const NvcVec3* cellPoints, bool replaceChunk) override;
220 
232  int32_t voronoiFracturing(uint32_t chunkId, uint32_t cellCount, const NvcVec3* cellPoints, const NvcVec3& scale, const NvcQuat& rotation, bool replaceChunk) override;
233 
234 
245  int32_t slicing(uint32_t chunkId, const SlicingConfiguration& conf, bool replaceChunk, RandomGeneratorBase* rnd) override;
246 
247 
260  int32_t cut(uint32_t chunkId, const NvcVec3& normal, const NvcVec3& position, const NoiseConfiguration& noise, bool replaceChunk, RandomGeneratorBase* rnd) override;
261 
272  int32_t cutout(uint32_t chunkId, CutoutConfiguration conf, bool replaceChunk, RandomGeneratorBase* rnd) override;
273 
274 
278  void finalizeFracturing() override;
279 
280  uint32_t getChunkCount() const override;
281 
285  const ChunkInfo& getChunkInfo(int32_t chunkIndex) override;
286 
294  float getMeshOverlap(const Mesh& meshA, const Mesh& meshB) override;
295 
303  uint32_t getBaseMesh(int32_t chunkIndex, Triangle*& output) override;
304 
312  uint32_t updateBaseMesh(int32_t chunkIndex, Triangle* output) override;
313 
319  int32_t getChunkIndex(int32_t chunkId) override;
320 
326  int32_t getChunkId(int32_t chunkIndex) override;
327 
333  int32_t getChunkDepth(int32_t chunkId) override;
334 
342  uint32_t getChunksIdAtDepth(uint32_t depth, int32_t*& chunkIds) override;
343 
344 
355  uint32_t getBufferedBaseMeshes(Vertex*& vertexBuffer, uint32_t*& indexBuffer, uint32_t*& indexBufferOffsets) override;
356 
361  void setRemoveIslands(bool isRemoveIslands) override;
362 
368  int32_t islandDetectionAndRemoving(int32_t chunkId, bool createAtNewDepth = false) override;
369 
374  bool isMeshContainOpenEdges(const Mesh* input) override;
375 
376  bool deleteChunkSubhierarchy(int32_t chunkId, bool deleteRoot = false) override;
377 
378  void uniteChunks(uint32_t threshold, uint32_t targetClusterSize,
379  const uint32_t* chunksToMerge, uint32_t mergeChunkCount,
380  const NvcVec2i* adjChunks, uint32_t adjChunksSize,
381  bool removeOriginalChunks = false) override;
382 
383  bool setApproximateBonding(uint32_t chunkId, bool useApproximateBonding) override;
384 
390  void fitUvToRect(float side, uint32_t chunkId) override;
391 
396  void fitAllUvToRect(float side) override;
397 
398 
399 
400 private:
401  bool isAncestorForChunk(int32_t ancestorId, int32_t chunkId);
402  int32_t slicingNoisy(uint32_t chunkId, const SlicingConfiguration& conf, bool replaceChunk, RandomGeneratorBase* rnd);
403  uint32_t stretchGroup(const std::vector<uint32_t>& group, std::vector<std::vector<uint32_t>>& graph);
404  void rebuildAdjGraph(const std::vector<uint32_t>& chunksToRebuild, const NvcVec2i* adjChunks, uint32_t adjChunksSize,
405  std::vector<std::vector<uint32_t> >& chunkGraph);
406  void fitAllUvToRect(float side, std::set<uint32_t>& mask);
407  void markLeaves();
408 
412  uint32_t createNewChunk(uint32_t parentId);
413 
414 
415 protected:
421 
422  /* Chunk mesh wrappers */
423  std::vector<Triangulator*> mChunkPostprocessors;
424 
425 
426 
429  std::vector<ChunkInfo> mChunkData;
430 
433 };
434 
435 void findCellBasePlanes(const std::vector<NvcVec3>& sites, std::vector<std::vector<int32_t> >& neighboors);
436 Mesh* getCellMesh(class BooleanEvaluator& eval, int32_t planeIndexerOffset, int32_t cellId, const std::vector<NvcVec3>& sites, std::vector < std::vector<int32_t> >& neighboors, int32_t interiorMaterialId, NvcVec3 origin);
437 
438 } // namespace Blast
439 } // namespace Nv
440 
441 
442 #endif // ifndef NVBLASTAUTHORINGFRACTURETOOLIMPL_H
Definition: NvBlastExtAuthoringFractureTool.h:107
+Go to the documentation of this file.
1 // This code contains NVIDIA Confidential Information and is disclosed to you
2 // under a form of NVIDIA software license agreement provided separately to you.
3 //
4 // Notice
5 // NVIDIA Corporation and its licensors retain all intellectual property and
6 // proprietary rights in and to this software and related documentation and
7 // any modifications thereto. Any use, reproduction, disclosure, or
8 // distribution of this software and related documentation without an express
9 // license agreement from NVIDIA Corporation is strictly prohibited.
10 //
11 // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12 // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15 //
16 // Information and code furnished is believed to be accurate and reliable.
17 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18 // information or for any infringement of patents or other rights of third parties that may
19 // result from its use. No license is granted by implication or otherwise under any patent
20 // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21 // This code supersedes and replaces all information previously supplied.
22 // NVIDIA Corporation products are not authorized for use as critical
23 // components in life support devices or systems without express written approval of
24 // NVIDIA Corporation.
25 //
26 // Copyright (c) 2016-2020 NVIDIA Corporation. All rights reserved.
27 
28 #ifndef NVBLASTAUTHORINGFRACTURETOOLIMPL_H
29 #define NVBLASTAUTHORINGFRACTURETOOLIMPL_H
30 
33 #include <vector>
34 #include <set>
35 
36 namespace Nv
37 {
38 namespace Blast
39 {
40 
41 class SpatialAccelerator;
42 class Triangulator;
43 
44 
49 {
50 public:
51 
61 
62  void release() override;
63 
67  void setBaseMesh(const Mesh* m) override;
68 
75  uint32_t getVoronoiSites(const NvcVec3*& sites) override;
76 
81  void addSite(const NvcVec3& site) override;
86  void uniformlyGenerateSitesInMesh(uint32_t numberOfSites) override;
87 
94  void clusteredSitesGeneration(uint32_t numberOfClusters, uint32_t sitesPerCluster, float clusterRadius) override;
95 
106  void radialPattern(const NvcVec3& center, const NvcVec3& normal, float radius, int32_t angularSteps, int32_t radialSteps, float angleOffset = 0.0f, float variability = 0.0f) override;
107 
114  void generateInSphere(const uint32_t count, const float radius, const NvcVec3& center) override;
119  void setStencil(const Mesh* stencil) override;
123  void clearStencil() override;
124 
131  void deleteInSphere(const float radius, const NvcVec3& center, const float eraserProbability = 1) override;
132 
133 private:
134  std::vector <NvcVec3> mGeneratedSites;
135  const Mesh* mMesh;
136  const Mesh* mStencil;
137  RandomGeneratorBase* mRnd;
138  SpatialAccelerator* mAccelerator;
139 };
140 
141 
142 
147 {
148 
149 public:
150 
155  {
156  mPlaneIndexerOffset = 1;
157  mChunkIdCounter = 0;
158  mRemoveIslands = false;
159  mInteriorMaterialId = kMaterialInteriorId;
160  }
161 
163  {
164  reset();
165  }
166 
167  void release() override;
168 
172  void reset() override;
173 
177  void setInteriorMaterialId(int32_t materialId) override;
178 
182  int32_t getInteriorMaterialId() const override;
183 
187  void replaceMaterialId(int32_t oldMaterialId, int32_t newMaterialId) override;
188 
192  void setSourceMesh(const Mesh* mesh) override;
193 
197  int32_t setChunkMesh(const Mesh* mesh, int32_t parentId) override;
198 
202  Mesh* createChunkMesh(int32_t chunkId) override;
203 
208  void getTransformation(NvcVec3& offset, float& scale) override;
209 
210 
219  int32_t voronoiFracturing(uint32_t chunkId, uint32_t cellCount, const NvcVec3* cellPoints, bool replaceChunk) override;
220 
232  int32_t voronoiFracturing(uint32_t chunkId, uint32_t cellCount, const NvcVec3* cellPoints, const NvcVec3& scale, const NvcQuat& rotation, bool replaceChunk) override;
233 
234 
245  int32_t slicing(uint32_t chunkId, const SlicingConfiguration& conf, bool replaceChunk, RandomGeneratorBase* rnd) override;
246 
247 
260  int32_t cut(uint32_t chunkId, const NvcVec3& normal, const NvcVec3& position, const NoiseConfiguration& noise, bool replaceChunk, RandomGeneratorBase* rnd) override;
261 
272  int32_t cutout(uint32_t chunkId, CutoutConfiguration conf, bool replaceChunk, RandomGeneratorBase* rnd) override;
273 
274 
278  void finalizeFracturing() override;
279 
280  uint32_t getChunkCount() const override;
281 
285  const ChunkInfo& getChunkInfo(int32_t chunkIndex) override;
286 
294  float getMeshOverlap(const Mesh& meshA, const Mesh& meshB) override;
295 
303  uint32_t getBaseMesh(int32_t chunkIndex, Triangle*& output) override;
304 
312  uint32_t updateBaseMesh(int32_t chunkIndex, Triangle* output) override;
313 
319  int32_t getChunkIndex(int32_t chunkId) override;
320 
326  int32_t getChunkId(int32_t chunkIndex) override;
327 
333  int32_t getChunkDepth(int32_t chunkId) override;
334 
342  uint32_t getChunksIdAtDepth(uint32_t depth, int32_t*& chunkIds) override;
343 
344 
355  uint32_t getBufferedBaseMeshes(Vertex*& vertexBuffer, uint32_t*& indexBuffer, uint32_t*& indexBufferOffsets) override;
356 
361  void setRemoveIslands(bool isRemoveIslands) override;
362 
368  int32_t islandDetectionAndRemoving(int32_t chunkId, bool createAtNewDepth = false) override;
369 
374  bool isMeshContainOpenEdges(const Mesh* input) override;
375 
376  bool deleteChunkSubhierarchy(int32_t chunkId, bool deleteRoot = false) override;
377 
378  void uniteChunks(uint32_t threshold, uint32_t targetClusterSize,
379  const uint32_t* chunksToMerge, uint32_t mergeChunkCount,
380  const NvcVec2i* adjChunks, uint32_t adjChunksSize,
381  bool removeOriginalChunks = false) override;
382 
383  bool setApproximateBonding(uint32_t chunkId, bool useApproximateBonding) override;
384 
390  void fitUvToRect(float side, uint32_t chunkId) override;
391 
396  void fitAllUvToRect(float side) override;
397 
398 
399 
400 private:
401  bool isAncestorForChunk(int32_t ancestorId, int32_t chunkId);
402  int32_t slicingNoisy(uint32_t chunkId, const SlicingConfiguration& conf, bool replaceChunk, RandomGeneratorBase* rnd);
403  uint32_t stretchGroup(const std::vector<uint32_t>& group, std::vector<std::vector<uint32_t>>& graph);
404  void rebuildAdjGraph(const std::vector<uint32_t>& chunksToRebuild, const NvcVec2i* adjChunks, uint32_t adjChunksSize,
405  std::vector<std::vector<uint32_t> >& chunkGraph);
406  void fitAllUvToRect(float side, std::set<uint32_t>& mask);
407  void markLeaves();
408 
412  uint32_t createNewChunk(uint32_t parentId);
413 
414 
415 protected:
421 
422  /* Chunk mesh wrappers */
423  std::vector<Triangulator*> mChunkPostprocessors;
424 
425 
426 
429  std::vector<ChunkInfo> mChunkData;
430 
433 };
434 
435 void findCellBasePlanes(const std::vector<NvcVec3>& sites, std::vector<std::vector<int32_t> >& neighboors);
436 Mesh* getCellMesh(class BooleanEvaluator& eval, int32_t planeIndexerOffset, int32_t cellId, const std::vector<NvcVec3>& sites, std::vector < std::vector<int32_t> >& neighboors, int32_t interiorMaterialId, NvcVec3 origin);
437 
438 } // namespace Blast
439 } // namespace Nv
440 
441 
442 #endif // ifndef NVBLASTAUTHORINGFRACTURETOOLIMPL_H
Definition: NvBlastExtAuthoringFractureTool.h:107
void generateInSphere(const uint32_t count, const float radius, const NvcVec3 &center) override
Definition: NvBlastExtAuthoringFractureTool.h:47
uint32_t getVoronoiSites(const NvcVec3 *&sites) override
diff --git a/docs/source_docs/files/_nv_blast_ext_authoring_internal_common_8h_source.html b/docs/source_docs/files/_nv_blast_ext_authoring_internal_common_8h_source.html index d78bd76..76b3490 100755 --- a/docs/source_docs/files/_nv_blast_ext_authoring_internal_common_8h_source.html +++ b/docs/source_docs/files/_nv_blast_ext_authoring_internal_common_8h_source.html @@ -46,7 +46,7 @@ $(document).ready(function(){initNavTree('_nv_blast_ext_authoring_internal_commo
NvBlastExtAuthoringInternalCommon.h
-Go to the documentation of this file.
1 // This code contains NVIDIA Confidential Information and is disclosed to you
2 // under a form of NVIDIA software license agreement provided separately to you.
3 //
4 // Notice
5 // NVIDIA Corporation and its licensors retain all intellectual property and
6 // proprietary rights in and to this software and related documentation and
7 // any modifications thereto. Any use, reproduction, disclosure, or
8 // distribution of this software and related documentation without an express
9 // license agreement from NVIDIA Corporation is strictly prohibited.
10 //
11 // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12 // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15 //
16 // Information and code furnished is believed to be accurate and reliable.
17 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18 // information or for any infringement of patents or other rights of third parties that may
19 // result from its use. No license is granted by implication or otherwise under any patent
20 // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21 // This code supersedes and replaces all information previously supplied.
22 // NVIDIA Corporation products are not authorized for use as critical
23 // components in life support devices or systems without express written approval of
24 // NVIDIA Corporation.
25 //
26 // Copyright (c) 2018 NVIDIA Corporation. All rights reserved.
27 
28 
29 #ifndef NVBLASTINTERNALCOMMON_H
30 #define NVBLASTINTERNALCOMMON_H
32 #include "NvBlastPxSharedHelpers.h"
33 #include <PxVec2.h>
34 #include <PxVec3.h>
35 #include <PxPlane.h>
36 #include <PxBounds3.h>
37 #include <PxMath.h>
38 #include <algorithm>
39 
40 namespace Nv
41 {
42 namespace Blast
43 {
44 
49 {
50  uint32_t s, e; // Starting and ending vertices
51  uint32_t parent; // Parent facet index
52  EdgeWithParent() : s(0), e(0), parent(0) {}
53  EdgeWithParent(uint32_t s, uint32_t e, uint32_t p) : s(s), e(e), parent(p) {}
54 };
55 
56 
61 {
62  bool operator()(const EdgeWithParent& a, const EdgeWithParent& b) const
63  {
64  if (a.parent == b.parent)
65  {
66  if (a.s == b.s)
67  {
68  return a.e < b.e;
69  }
70  else
71  {
72  return a.s < b.s;
73  }
74  }
75  else
76  {
77  return a.parent < b.parent;
78  }
79  }
80 };
81 
82 inline bool operator<(const Edge& a, const Edge& b)
83 {
84  if (a.s == b.s)
85  return a.e < b.e;
86  else
87  return a.s < b.s;
88 }
89 
94 {
95  YZ_PLANE = 1 << 1,
96  XY_PLANE = 1 << 2,
97  ZX_PLANE = 1 << 3,
98 
100 };
101 
106 {
107  float maxv = std::max(std::abs(normal.x), std::max(std::abs(normal.y), std::abs(normal.z)));
108  ProjectionDirections retVal;
109  if (maxv == std::abs(normal.x))
110  {
111  retVal = YZ_PLANE;
112  if (normal.x < 0) retVal = (ProjectionDirections)((int)retVal | (int)OPPOSITE_WINDING);
113  return retVal;
114  }
115  if (maxv == std::abs(normal.y))
116  {
117  retVal = ZX_PLANE;
118  if (normal.y > 0) retVal = (ProjectionDirections)((int)retVal | (int)OPPOSITE_WINDING);
119  return retVal;
120  }
121  retVal = XY_PLANE;
122  if (normal.z < 0) retVal = (ProjectionDirections)((int)retVal | (int)OPPOSITE_WINDING);
123  return retVal;
124 }
125 
126 
130 NV_FORCE_INLINE physx::PxVec2 getProjectedPoint(const physx::PxVec3& point, ProjectionDirections dir)
131 {
132  if (dir & YZ_PLANE)
133  {
134  return physx::PxVec2(point.y, point.z);
135  }
136  if (dir & ZX_PLANE)
137  {
138  return physx::PxVec2(point.x, point.z);
139  }
140  return physx::PxVec2(point.x, point.y);
141 }
142 
144 {
145  return getProjectedPoint((const physx::PxVec3&)point, dir);
146 }
147 
151 NV_FORCE_INLINE physx::PxVec2 getProjectedPointWithWinding(const physx::PxVec3& point, ProjectionDirections dir)
152 {
153  if (dir & YZ_PLANE)
154  {
155  if (dir & OPPOSITE_WINDING)
156  {
157  return physx::PxVec2(point.z, point.y);
158  }
159  else
160  return physx::PxVec2(point.y, point.z);
161  }
162  if (dir & ZX_PLANE)
163  {
164  if (dir & OPPOSITE_WINDING)
165  {
166  return physx::PxVec2(point.z, point.x);
167  }
168  return physx::PxVec2(point.x, point.z);
169  }
170  if (dir & OPPOSITE_WINDING)
171  {
172  return physx::PxVec2(point.y, point.x);
173  }
174  return physx::PxVec2(point.x, point.y);
175 }
176 
177 
178 
179 #define MAXIMUM_EXTENT 1000 * 1000 * 1000
180 #define BBOX_TEST_EPS 1e-5f
181 
185 NV_INLINE bool weakBoundingBoxIntersection(const physx::PxBounds3& aBox, const physx::PxBounds3& bBox)
186 {
187  if (std::max(aBox.minimum.x, bBox.minimum.x) > std::min(aBox.maximum.x, bBox.maximum.x) + BBOX_TEST_EPS)
188  return false;
189  if (std::max(aBox.minimum.y, bBox.minimum.y) > std::min(aBox.maximum.y, bBox.maximum.y) + BBOX_TEST_EPS)
190  return false;
191  if (std::max(aBox.minimum.z, bBox.minimum.z) > std::min(aBox.maximum.z, bBox.maximum.z) + BBOX_TEST_EPS)
192  return false;
193  return true;
194 }
195 
196 
197 
201 NV_INLINE bool getPlaneSegmentIntersection(const physx::PxPlane& pl, const physx::PxVec3& a, const physx::PxVec3& b,
202  physx::PxVec3& result)
203 {
204  float div = (b - a).dot(pl.n);
205  if (physx::PxAbs(div) < 0.0001f)
206  {
207  if (pl.contains(a))
208  {
209  result = a;
210  return true;
211  }
212  else
213  {
214  return false;
215  }
216  }
217  float t = (-a.dot(pl.n) - pl.d) / div;
218  if (t < 0.0f || t > 1.0f)
219  {
220  return false;
221  }
222  result = (b - a) * t + a;
223  return true;
224 }
225 
226 
227 #define POS_COMPARISON_OFFSET 1e-5f
228 #define NORM_COMPARISON_OFFSET 1e-3f
229 
232 struct VrtComp
233 {
234  bool operator()(const Vertex& a, const Vertex& b) const
235  {
236  if (a.p.x + POS_COMPARISON_OFFSET < b.p.x) return true;
237  if (a.p.x - POS_COMPARISON_OFFSET > b.p.x) return false;
238  if (a.p.y + POS_COMPARISON_OFFSET < b.p.y) return true;
239  if (a.p.y - POS_COMPARISON_OFFSET > b.p.y) return false;
240  if (a.p.z + POS_COMPARISON_OFFSET < b.p.z) return true;
241  if (a.p.z - POS_COMPARISON_OFFSET > b.p.z) return false;
242 
243  if (a.n.x + NORM_COMPARISON_OFFSET < b.n.x) return true;
244  if (a.n.x - NORM_COMPARISON_OFFSET > b.n.x) return false;
245  if (a.n.y + NORM_COMPARISON_OFFSET < b.n.y) return true;
246  if (a.n.y - NORM_COMPARISON_OFFSET > b.n.y) return false;
247  if (a.n.z + NORM_COMPARISON_OFFSET < b.n.z) return true;
248  if (a.n.z - NORM_COMPARISON_OFFSET > b.n.z) return false;
249 
250 
251  if (a.uv[0].x + NORM_COMPARISON_OFFSET < b.uv[0].x) return true;
252  if (a.uv[0].x - NORM_COMPARISON_OFFSET > b.uv[0].x) return false;
253  if (a.uv[0].y + NORM_COMPARISON_OFFSET < b.uv[0].y) return true;
254  return false;
255  };
256 };
257 
262 {
263  bool operator()(const NvcVec3& a, const NvcVec3& b) const
264  {
265  if (a.x + POS_COMPARISON_OFFSET < b.x) return true;
266  if (a.x - POS_COMPARISON_OFFSET > b.x) return false;
267  if (a.y + POS_COMPARISON_OFFSET < b.y) return true;
268  if (a.y - POS_COMPARISON_OFFSET > b.y) return false;
269  if (a.z + POS_COMPARISON_OFFSET < b.z) return true;
270  if (a.z - POS_COMPARISON_OFFSET > b.z) return false;
271  return false;
272  };
273  bool operator()(const Vertex& a, const Vertex& b) const
274  {
275  return operator()(a.p, b.p);
276  };
277 };
278 
279 
281 {
282  if (hull.pointsCount == 0)
283  {
284  return 0.0f;
285  }
286 
287  // Find an approximate centroid for a more accurate calculation
288  NvcVec3 centroid = { 0.0f, 0.0f, 0.0f };
289  for (uint32_t i = 0; i < hull.pointsCount; ++i)
290  {
291  centroid = centroid + hull.points[i];
292  }
293  centroid = centroid / hull.pointsCount;
294 
295  float volume = 0.0f;
296 
297  for (uint32_t i = 0; i < hull.polygonDataCount; ++i)
298  {
299  const HullPolygon& poly = hull.polygonData[i];
300  if (poly.vertexCount < 3)
301  {
302  continue;
303  }
304  const uint32_t i0 = hull.indices[poly.indexBase];
305  uint32_t i1 = hull.indices[poly.indexBase + 1];
306  for (uint32_t j = 2; j < poly.vertexCount; ++j)
307  {
308  const uint32_t i2 = hull.indices[poly.indexBase + j];
309  const NvcVec3 a = hull.points[i0] - centroid;
310  const NvcVec3 b = hull.points[i1] - centroid;
311  const NvcVec3 c = hull.points[i2] - centroid;
312  volume +=
313  (a.x * b.y * c.z - a.x * b.z * c.y - a.y * b.x * c.z + a.y * b.z * c.x + a.z * b.x * c.y - a.z * b.y * c.x);
314  i1 = i2;
315  }
316  }
317  return (1.0f / 6.0f) * std::abs(volume);
318 }
319 
320 } // namespace Blast
321 } // namespace Nv
322 
323 #endif
bool operator()(const Vertex &a, const Vertex &b) const
Definition: NvBlastExtAuthoringInternalCommon.h:273
+Go to the documentation of this file.
1 // This code contains NVIDIA Confidential Information and is disclosed to you
2 // under a form of NVIDIA software license agreement provided separately to you.
3 //
4 // Notice
5 // NVIDIA Corporation and its licensors retain all intellectual property and
6 // proprietary rights in and to this software and related documentation and
7 // any modifications thereto. Any use, reproduction, disclosure, or
8 // distribution of this software and related documentation without an express
9 // license agreement from NVIDIA Corporation is strictly prohibited.
10 //
11 // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12 // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15 //
16 // Information and code furnished is believed to be accurate and reliable.
17 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18 // information or for any infringement of patents or other rights of third parties that may
19 // result from its use. No license is granted by implication or otherwise under any patent
20 // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21 // This code supersedes and replaces all information previously supplied.
22 // NVIDIA Corporation products are not authorized for use as critical
23 // components in life support devices or systems without express written approval of
24 // NVIDIA Corporation.
25 //
26 // Copyright (c) 2020 NVIDIA Corporation. All rights reserved.
27 
28 
29 #ifndef NVBLASTINTERNALCOMMON_H
30 #define NVBLASTINTERNALCOMMON_H
32 #include "NvBlastPxSharedHelpers.h"
33 #include <PxVec2.h>
34 #include <PxVec3.h>
35 #include <PxPlane.h>
36 #include <PxBounds3.h>
37 #include <PxMath.h>
38 #include <algorithm>
39 
40 namespace Nv
41 {
42 namespace Blast
43 {
44 
49 {
50  uint32_t s, e; // Starting and ending vertices
51  uint32_t parent; // Parent facet index
52  EdgeWithParent() : s(0), e(0), parent(0) {}
53  EdgeWithParent(uint32_t s, uint32_t e, uint32_t p) : s(s), e(e), parent(p) {}
54 };
55 
56 
61 {
62  bool operator()(const EdgeWithParent& a, const EdgeWithParent& b) const
63  {
64  if (a.parent == b.parent)
65  {
66  if (a.s == b.s)
67  {
68  return a.e < b.e;
69  }
70  else
71  {
72  return a.s < b.s;
73  }
74  }
75  else
76  {
77  return a.parent < b.parent;
78  }
79  }
80 };
81 
82 inline bool operator<(const Edge& a, const Edge& b)
83 {
84  if (a.s == b.s)
85  return a.e < b.e;
86  else
87  return a.s < b.s;
88 }
89 
94 {
95  YZ_PLANE = 1 << 1,
96  XY_PLANE = 1 << 2,
97  ZX_PLANE = 1 << 3,
98 
100 };
101 
106 {
107  float maxv = std::max(std::abs(normal.x), std::max(std::abs(normal.y), std::abs(normal.z)));
108  ProjectionDirections retVal;
109  if (maxv == std::abs(normal.x))
110  {
111  retVal = YZ_PLANE;
112  if (normal.x < 0) retVal = (ProjectionDirections)((int)retVal | (int)OPPOSITE_WINDING);
113  return retVal;
114  }
115  if (maxv == std::abs(normal.y))
116  {
117  retVal = ZX_PLANE;
118  if (normal.y > 0) retVal = (ProjectionDirections)((int)retVal | (int)OPPOSITE_WINDING);
119  return retVal;
120  }
121  retVal = XY_PLANE;
122  if (normal.z < 0) retVal = (ProjectionDirections)((int)retVal | (int)OPPOSITE_WINDING);
123  return retVal;
124 }
125 
126 
130 NV_FORCE_INLINE physx::PxVec2 getProjectedPoint(const physx::PxVec3& point, ProjectionDirections dir)
131 {
132  if (dir & YZ_PLANE)
133  {
134  return physx::PxVec2(point.y, point.z);
135  }
136  if (dir & ZX_PLANE)
137  {
138  return physx::PxVec2(point.x, point.z);
139  }
140  return physx::PxVec2(point.x, point.y);
141 }
142 
144 {
145  return getProjectedPoint((const physx::PxVec3&)point, dir);
146 }
147 
151 NV_FORCE_INLINE physx::PxVec2 getProjectedPointWithWinding(const physx::PxVec3& point, ProjectionDirections dir)
152 {
153  if (dir & YZ_PLANE)
154  {
155  if (dir & OPPOSITE_WINDING)
156  {
157  return physx::PxVec2(point.z, point.y);
158  }
159  else
160  return physx::PxVec2(point.y, point.z);
161  }
162  if (dir & ZX_PLANE)
163  {
164  if (dir & OPPOSITE_WINDING)
165  {
166  return physx::PxVec2(point.z, point.x);
167  }
168  return physx::PxVec2(point.x, point.z);
169  }
170  if (dir & OPPOSITE_WINDING)
171  {
172  return physx::PxVec2(point.y, point.x);
173  }
174  return physx::PxVec2(point.x, point.y);
175 }
176 
177 
178 
179 #define MAXIMUM_EXTENT 1000 * 1000 * 1000
180 #define BBOX_TEST_EPS 1e-5f
181 
185 NV_INLINE bool weakBoundingBoxIntersection(const physx::PxBounds3& aBox, const physx::PxBounds3& bBox)
186 {
187  if (std::max(aBox.minimum.x, bBox.minimum.x) > std::min(aBox.maximum.x, bBox.maximum.x) + BBOX_TEST_EPS)
188  return false;
189  if (std::max(aBox.minimum.y, bBox.minimum.y) > std::min(aBox.maximum.y, bBox.maximum.y) + BBOX_TEST_EPS)
190  return false;
191  if (std::max(aBox.minimum.z, bBox.minimum.z) > std::min(aBox.maximum.z, bBox.maximum.z) + BBOX_TEST_EPS)
192  return false;
193  return true;
194 }
195 
196 
197 
201 NV_INLINE bool getPlaneSegmentIntersection(const physx::PxPlane& pl, const physx::PxVec3& a, const physx::PxVec3& b,
202  physx::PxVec3& result)
203 {
204  float div = (b - a).dot(pl.n);
205  if (physx::PxAbs(div) < 0.0001f)
206  {
207  if (pl.contains(a))
208  {
209  result = a;
210  return true;
211  }
212  else
213  {
214  return false;
215  }
216  }
217  float t = (-a.dot(pl.n) - pl.d) / div;
218  if (t < 0.0f || t > 1.0f)
219  {
220  return false;
221  }
222  result = (b - a) * t + a;
223  return true;
224 }
225 
226 
227 #define POS_COMPARISON_OFFSET 1e-5f
228 #define NORM_COMPARISON_OFFSET 1e-3f
229 
232 struct VrtComp
233 {
234  bool operator()(const Vertex& a, const Vertex& b) const
235  {
236  if (a.p.x + POS_COMPARISON_OFFSET < b.p.x) return true;
237  if (a.p.x - POS_COMPARISON_OFFSET > b.p.x) return false;
238  if (a.p.y + POS_COMPARISON_OFFSET < b.p.y) return true;
239  if (a.p.y - POS_COMPARISON_OFFSET > b.p.y) return false;
240  if (a.p.z + POS_COMPARISON_OFFSET < b.p.z) return true;
241  if (a.p.z - POS_COMPARISON_OFFSET > b.p.z) return false;
242 
243  if (a.n.x + NORM_COMPARISON_OFFSET < b.n.x) return true;
244  if (a.n.x - NORM_COMPARISON_OFFSET > b.n.x) return false;
245  if (a.n.y + NORM_COMPARISON_OFFSET < b.n.y) return true;
246  if (a.n.y - NORM_COMPARISON_OFFSET > b.n.y) return false;
247  if (a.n.z + NORM_COMPARISON_OFFSET < b.n.z) return true;
248  if (a.n.z - NORM_COMPARISON_OFFSET > b.n.z) return false;
249 
250 
251  if (a.uv[0].x + NORM_COMPARISON_OFFSET < b.uv[0].x) return true;
252  if (a.uv[0].x - NORM_COMPARISON_OFFSET > b.uv[0].x) return false;
253  if (a.uv[0].y + NORM_COMPARISON_OFFSET < b.uv[0].y) return true;
254  return false;
255  };
256 };
257 
262 {
263  bool operator()(const NvcVec3& a, const NvcVec3& b) const
264  {
265  if (a.x + POS_COMPARISON_OFFSET < b.x) return true;
266  if (a.x - POS_COMPARISON_OFFSET > b.x) return false;
267  if (a.y + POS_COMPARISON_OFFSET < b.y) return true;
268  if (a.y - POS_COMPARISON_OFFSET > b.y) return false;
269  if (a.z + POS_COMPARISON_OFFSET < b.z) return true;
270  if (a.z - POS_COMPARISON_OFFSET > b.z) return false;
271  return false;
272  };
273  bool operator()(const Vertex& a, const Vertex& b) const
274  {
275  return operator()(a.p, b.p);
276  };
277 };
278 
279 
281 {
282  if (hull.pointsCount == 0)
283  {
284  return 0.0f;
285  }
286 
287  // Find an approximate centroid for a more accurate calculation
288  NvcVec3 centroid = { 0.0f, 0.0f, 0.0f };
289  for (uint32_t i = 0; i < hull.pointsCount; ++i)
290  {
291  centroid = centroid + hull.points[i];
292  }
293  centroid = centroid / hull.pointsCount;
294 
295  float volume = 0.0f;
296 
297  for (uint32_t i = 0; i < hull.polygonDataCount; ++i)
298  {
299  const HullPolygon& poly = hull.polygonData[i];
300  if (poly.vertexCount < 3)
301  {
302  continue;
303  }
304  const uint32_t i0 = hull.indices[poly.indexBase];
305  uint32_t i1 = hull.indices[poly.indexBase + 1];
306  for (uint32_t j = 2; j < poly.vertexCount; ++j)
307  {
308  const uint32_t i2 = hull.indices[poly.indexBase + j];
309  const NvcVec3 a = hull.points[i0] - centroid;
310  const NvcVec3 b = hull.points[i1] - centroid;
311  const NvcVec3 c = hull.points[i2] - centroid;
312  volume +=
313  (a.x * b.y * c.z - a.x * b.z * c.y - a.y * b.x * c.z + a.y * b.z * c.x + a.z * b.x * c.y - a.z * b.y * c.x);
314  i1 = i2;
315  }
316  }
317  return (1.0f / 6.0f) * std::abs(volume);
318 }
319 
320 } // namespace Blast
321 } // namespace Nv
322 
323 #endif
bool operator()(const Vertex &a, const Vertex &b) const
Definition: NvBlastExtAuthoringInternalCommon.h:273
ProjectionDirections
Definition: NvBlastExtAuthoringInternalCommon.h:93
uint32_t e
Definition: NvBlastExtAuthoringTypes.h:61
uint32_t s
Definition: NvBlastExtAuthoringInternalCommon.h:50
diff --git a/docs/source_docs/files/_nv_blast_ext_authoring_mesh_8h_source.html b/docs/source_docs/files/_nv_blast_ext_authoring_mesh_8h_source.html index 08a154c..b6a2c93 100755 --- a/docs/source_docs/files/_nv_blast_ext_authoring_mesh_8h_source.html +++ b/docs/source_docs/files/_nv_blast_ext_authoring_mesh_8h_source.html @@ -46,7 +46,7 @@ $(document).ready(function(){initNavTree('_nv_blast_ext_authoring_mesh_8h_source
NvBlastExtAuthoringMesh.h
-Go to the documentation of this file.
1 // This code contains NVIDIA Confidential Information and is disclosed to you
2 // under a form of NVIDIA software license agreement provided separately to you.
3 //
4 // Notice
5 // NVIDIA Corporation and its licensors retain all intellectual property and
6 // proprietary rights in and to this software and related documentation and
7 // any modifications thereto. Any use, reproduction, disclosure, or
8 // distribution of this software and related documentation without an express
9 // license agreement from NVIDIA Corporation is strictly prohibited.
10 //
11 // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12 // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15 //
16 // Information and code furnished is believed to be accurate and reliable.
17 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18 // information or for any infringement of patents or other rights of third parties that may
19 // result from its use. No license is granted by implication or otherwise under any patent
20 // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21 // This code supersedes and replaces all information previously supplied.
22 // NVIDIA Corporation products are not authorized for use as critical
23 // components in life support devices or systems without express written approval of
24 // NVIDIA Corporation.
25 //
26 // Copyright (c) 2016-2018 NVIDIA Corporation. All rights reserved.
27 
28 
29 #ifndef NVBLASTAUTHORINGMESH_H
30 #define NVBLASTAUTHORINGMESH_H
31 
33 
34 namespace Nv
35 {
36 namespace Blast
37 {
38 
42 class Mesh
43 {
44 public:
45 
46  virtual ~Mesh() {}
47 
51  virtual void release() = 0;
52 
56  virtual bool isValid() const = 0;
57 
61  virtual Vertex* getVerticesWritable() = 0;
62 
66  virtual const Vertex* getVertices() const = 0;
67 
68 
72  virtual Edge* getEdgesWritable() = 0;
73 
77  virtual const Edge* getEdges() const = 0;
78 
82  virtual Facet* getFacetsBufferWritable() = 0;
83 
87  virtual const Facet* getFacetsBuffer() const = 0;
88 
92  virtual Facet* getFacetWritable(int32_t facet) = 0;
96  virtual const Facet* getFacet(int32_t facet) const = 0;
97 
101  virtual uint32_t getEdgesCount() const = 0;
102 
106  virtual uint32_t getVerticesCount() const = 0;
107 
111  virtual uint32_t getFacetCount() const = 0;
112 
116  virtual const NvcBounds3& getBoundingBox() const = 0;
117 
121  virtual NvcBounds3& getBoundingBoxWritable() = 0;
122 
123 
127  virtual void setMaterialId(const int32_t* materialIds) = 0;
128 
132  virtual void replaceMaterialId(int32_t oldMaterialId, int32_t newMaterialId) = 0;
133 
137  virtual void setSmoothingGroup(const int32_t* smoothingGroups) = 0;
138 
142  virtual void recalculateBoundingBox() = 0;
143 
148  virtual float getMeshVolume() = 0;
149 
150 
154  virtual void calcPerFacetBounds() = 0;
155 
159  virtual const NvcBounds3* getFacetBound(uint32_t index) const = 0;
160 
161 };
162 
163 } // namespace Blast
164 } // namespace Nv
165 
166 
167 #endif // ifndef NVBLASTAUTHORINGMESH_H
virtual Edge * getEdgesWritable()=0
+Go to the documentation of this file.
1 // This code contains NVIDIA Confidential Information and is disclosed to you
2 // under a form of NVIDIA software license agreement provided separately to you.
3 //
4 // Notice
5 // NVIDIA Corporation and its licensors retain all intellectual property and
6 // proprietary rights in and to this software and related documentation and
7 // any modifications thereto. Any use, reproduction, disclosure, or
8 // distribution of this software and related documentation without an express
9 // license agreement from NVIDIA Corporation is strictly prohibited.
10 //
11 // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12 // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15 //
16 // Information and code furnished is believed to be accurate and reliable.
17 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18 // information or for any infringement of patents or other rights of third parties that may
19 // result from its use. No license is granted by implication or otherwise under any patent
20 // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21 // This code supersedes and replaces all information previously supplied.
22 // NVIDIA Corporation products are not authorized for use as critical
23 // components in life support devices or systems without express written approval of
24 // NVIDIA Corporation.
25 //
26 // Copyright (c) 2016-2020 NVIDIA Corporation. All rights reserved.
27 
28 
29 #ifndef NVBLASTAUTHORINGMESH_H
30 #define NVBLASTAUTHORINGMESH_H
31 
33 
34 namespace Nv
35 {
36 namespace Blast
37 {
38 
42 class Mesh
43 {
44 public:
45 
46  virtual ~Mesh() {}
47 
51  virtual void release() = 0;
52 
56  virtual bool isValid() const = 0;
57 
61  virtual Vertex* getVerticesWritable() = 0;
62 
66  virtual const Vertex* getVertices() const = 0;
67 
68 
72  virtual Edge* getEdgesWritable() = 0;
73 
77  virtual const Edge* getEdges() const = 0;
78 
82  virtual Facet* getFacetsBufferWritable() = 0;
83 
87  virtual const Facet* getFacetsBuffer() const = 0;
88 
92  virtual Facet* getFacetWritable(int32_t facet) = 0;
96  virtual const Facet* getFacet(int32_t facet) const = 0;
97 
101  virtual uint32_t getEdgesCount() const = 0;
102 
106  virtual uint32_t getVerticesCount() const = 0;
107 
111  virtual uint32_t getFacetCount() const = 0;
112 
116  virtual const NvcBounds3& getBoundingBox() const = 0;
117 
121  virtual NvcBounds3& getBoundingBoxWritable() = 0;
122 
123 
127  virtual void setMaterialId(const int32_t* materialIds) = 0;
128 
132  virtual void replaceMaterialId(int32_t oldMaterialId, int32_t newMaterialId) = 0;
133 
137  virtual void setSmoothingGroup(const int32_t* smoothingGroups) = 0;
138 
142  virtual void recalculateBoundingBox() = 0;
143 
148  virtual float getMeshVolume() = 0;
149 
150 
154  virtual void calcPerFacetBounds() = 0;
155 
159  virtual const NvcBounds3* getFacetBound(uint32_t index) const = 0;
160 
161 };
162 
163 } // namespace Blast
164 } // namespace Nv
165 
166 
167 #endif // ifndef NVBLASTAUTHORINGMESH_H
virtual Edge * getEdgesWritable()=0
virtual Facet * getFacetWritable(int32_t facet)=0
virtual void setSmoothingGroup(const int32_t *smoothingGroups)=0
virtual Facet * getFacetsBufferWritable()=0
diff --git a/docs/source_docs/files/_nv_blast_ext_authoring_mesh_cleaner_8h_source.html b/docs/source_docs/files/_nv_blast_ext_authoring_mesh_cleaner_8h_source.html index 3310ebc..1aa481d 100755 --- a/docs/source_docs/files/_nv_blast_ext_authoring_mesh_cleaner_8h_source.html +++ b/docs/source_docs/files/_nv_blast_ext_authoring_mesh_cleaner_8h_source.html @@ -46,7 +46,7 @@ $(document).ready(function(){initNavTree('_nv_blast_ext_authoring_mesh_cleaner_8
NvBlastExtAuthoringMeshCleaner.h
-Go to the documentation of this file.
1 // This code contains NVIDIA Confidential Information and is disclosed to you
2 // under a form of NVIDIA software license agreement provided separately to you.
3 //
4 // Notice
5 // NVIDIA Corporation and its licensors retain all intellectual property and
6 // proprietary rights in and to this software and related documentation and
7 // any modifications thereto. Any use, reproduction, disclosure, or
8 // distribution of this software and related documentation without an express
9 // license agreement from NVIDIA Corporation is strictly prohibited.
10 //
11 // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12 // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15 //
16 // Information and code furnished is believed to be accurate and reliable.
17 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18 // information or for any infringement of patents or other rights of third parties that may
19 // result from its use. No license is granted by implication or otherwise under any patent
20 // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21 // This code supersedes and replaces all information previously supplied.
22 // NVIDIA Corporation products are not authorized for use as critical
23 // components in life support devices or systems without express written approval of
24 // NVIDIA Corporation.
25 //
26 // Copyright (c) 2016-2018 NVIDIA Corporation. All rights reserved.
27 
28 
29 #ifndef NVBLASTEXTAUTHORINGMESHCLEANER_H
30 #define NVBLASTEXTAUTHORINGMESHCLEANER_H
31 
33 
45 namespace Nv
46 {
47 namespace Blast
48 {
49 
50 class Mesh;
51 
53 {
54 public:
55  virtual ~MeshCleaner() {}
56 
62  virtual Mesh* cleanMesh(const Mesh* mesh) = 0;
63 
64  virtual void release() = 0;
65 };
66 
67 
68 } // namespace Blast
69 } // namespace Nv
70 
71 #endif // ifndef NVBLASTEXTAUTHORINGMESHCLEANER_H
virtual ~MeshCleaner()
Definition: NvBlastExtAuthoringMeshCleaner.h:55
+Go to the documentation of this file.
1 // This code contains NVIDIA Confidential Information and is disclosed to you
2 // under a form of NVIDIA software license agreement provided separately to you.
3 //
4 // Notice
5 // NVIDIA Corporation and its licensors retain all intellectual property and
6 // proprietary rights in and to this software and related documentation and
7 // any modifications thereto. Any use, reproduction, disclosure, or
8 // distribution of this software and related documentation without an express
9 // license agreement from NVIDIA Corporation is strictly prohibited.
10 //
11 // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12 // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15 //
16 // Information and code furnished is believed to be accurate and reliable.
17 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18 // information or for any infringement of patents or other rights of third parties that may
19 // result from its use. No license is granted by implication or otherwise under any patent
20 // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21 // This code supersedes and replaces all information previously supplied.
22 // NVIDIA Corporation products are not authorized for use as critical
23 // components in life support devices or systems without express written approval of
24 // NVIDIA Corporation.
25 //
26 // Copyright (c) 2016-2020 NVIDIA Corporation. All rights reserved.
27 
28 
29 #ifndef NVBLASTEXTAUTHORINGMESHCLEANER_H
30 #define NVBLASTEXTAUTHORINGMESHCLEANER_H
31 
33 
45 namespace Nv
46 {
47 namespace Blast
48 {
49 
50 class Mesh;
51 
53 {
54 public:
55  virtual ~MeshCleaner() {}
56 
62  virtual Mesh* cleanMesh(const Mesh* mesh) = 0;
63 
64  virtual void release() = 0;
65 };
66 
67 
68 } // namespace Blast
69 } // namespace Nv
70 
71 #endif // ifndef NVBLASTEXTAUTHORINGMESHCLEANER_H
virtual ~MeshCleaner()
Definition: NvBlastExtAuthoringMeshCleaner.h:55
Definition: NvBlastExtAuthoringMeshCleaner.h:52
Definition: NvBlastExtAuthoringMesh.h:42
diff --git a/docs/source_docs/files/_nv_blast_ext_authoring_mesh_cleaner_impl_8h_source.html b/docs/source_docs/files/_nv_blast_ext_authoring_mesh_cleaner_impl_8h_source.html index a7aa9a3..7ac15fb 100755 --- a/docs/source_docs/files/_nv_blast_ext_authoring_mesh_cleaner_impl_8h_source.html +++ b/docs/source_docs/files/_nv_blast_ext_authoring_mesh_cleaner_impl_8h_source.html @@ -46,7 +46,7 @@ $(document).ready(function(){initNavTree('_nv_blast_ext_authoring_mesh_cleaner_i
NvBlastExtAuthoringMeshCleanerImpl.h
-Go to the documentation of this file.
1 // This code contains NVIDIA Confidential Information and is disclosed to you
2 // under a form of NVIDIA software license agreement provided separately to you.
3 //
4 // Notice
5 // NVIDIA Corporation and its licensors retain all intellectual property and
6 // proprietary rights in and to this software and related documentation and
7 // any modifications thereto. Any use, reproduction, disclosure, or
8 // distribution of this software and related documentation without an express
9 // license agreement from NVIDIA Corporation is strictly prohibited.
10 //
11 // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12 // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15 //
16 // Information and code furnished is believed to be accurate and reliable.
17 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18 // information or for any infringement of patents or other rights of third parties that may
19 // result from its use. No license is granted by implication or otherwise under any patent
20 // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21 // This code supersedes and replaces all information previously supplied.
22 // NVIDIA Corporation products are not authorized for use as critical
23 // components in life support devices or systems without express written approval of
24 // NVIDIA Corporation.
25 //
26 // Copyright (c) 2016-2018 NVIDIA Corporation. All rights reserved.
27 
28 #ifndef NVBLASTEXTAUTHORINGMESHCLEANERIMPL_H
29 #define NVBLASTEXTAUTHORINGMESHCLEANERIMPL_H
30 
32 
33 namespace Nv
34 {
35 namespace Blast
36 {
37 
38 class Mesh;
39 
41 {
42 public:
48  virtual Mesh* cleanMesh(const Nv::Blast::Mesh* mesh) override;
49  virtual void release() override;
50 
52 };
53 
54 }
55 }
56 
57 #endif //NVBLASTEXTAUTHORINGMESHCLEANERIMPL_H
Definition: NvBlastExtAuthoringMeshCleaner.h:52
+Go to the documentation of this file.
1 // This code contains NVIDIA Confidential Information and is disclosed to you
2 // under a form of NVIDIA software license agreement provided separately to you.
3 //
4 // Notice
5 // NVIDIA Corporation and its licensors retain all intellectual property and
6 // proprietary rights in and to this software and related documentation and
7 // any modifications thereto. Any use, reproduction, disclosure, or
8 // distribution of this software and related documentation without an express
9 // license agreement from NVIDIA Corporation is strictly prohibited.
10 //
11 // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12 // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15 //
16 // Information and code furnished is believed to be accurate and reliable.
17 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18 // information or for any infringement of patents or other rights of third parties that may
19 // result from its use. No license is granted by implication or otherwise under any patent
20 // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21 // This code supersedes and replaces all information previously supplied.
22 // NVIDIA Corporation products are not authorized for use as critical
23 // components in life support devices or systems without express written approval of
24 // NVIDIA Corporation.
25 //
26 // Copyright (c) 2016-2020 NVIDIA Corporation. All rights reserved.
27 
28 #ifndef NVBLASTEXTAUTHORINGMESHCLEANERIMPL_H
29 #define NVBLASTEXTAUTHORINGMESHCLEANERIMPL_H
30 
32 
33 namespace Nv
34 {
35 namespace Blast
36 {
37 
38 class Mesh;
39 
41 {
42 public:
48  virtual Mesh* cleanMesh(const Nv::Blast::Mesh* mesh) override;
49  virtual void release() override;
50 
52 };
53 
54 }
55 }
56 
57 #endif //NVBLASTEXTAUTHORINGMESHCLEANERIMPL_H
Definition: NvBlastExtAuthoringMeshCleaner.h:52
Definition: NvBlastExtAuthoringMesh.h:42
Definition: NvBlastExtAuthoringMeshCleanerImpl.h:40
diff --git a/docs/source_docs/files/_nv_blast_ext_authoring_mesh_impl_8h_source.html b/docs/source_docs/files/_nv_blast_ext_authoring_mesh_impl_8h_source.html index d34a4c2..8c74ac7 100755 --- a/docs/source_docs/files/_nv_blast_ext_authoring_mesh_impl_8h_source.html +++ b/docs/source_docs/files/_nv_blast_ext_authoring_mesh_impl_8h_source.html @@ -46,7 +46,7 @@ $(document).ready(function(){initNavTree('_nv_blast_ext_authoring_mesh_impl_8h_s
NvBlastExtAuthoringMeshImpl.h
-Go to the documentation of this file.
1 // This code contains NVIDIA Confidential Information and is disclosed to you
2 // under a form of NVIDIA software license agreement provided separately to you.
3 //
4 // Notice
5 // NVIDIA Corporation and its licensors retain all intellectual property and
6 // proprietary rights in and to this software and related documentation and
7 // any modifications thereto. Any use, reproduction, disclosure, or
8 // distribution of this software and related documentation without an express
9 // license agreement from NVIDIA Corporation is strictly prohibited.
10 //
11 // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12 // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15 //
16 // Information and code furnished is believed to be accurate and reliable.
17 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18 // information or for any infringement of patents or other rights of third parties that may
19 // result from its use. No license is granted by implication or otherwise under any patent
20 // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21 // This code supersedes and replaces all information previously supplied.
22 // NVIDIA Corporation products are not authorized for use as critical
23 // components in life support devices or systems without express written approval of
24 // NVIDIA Corporation.
25 //
26 // Copyright (c) 2016-2018 NVIDIA Corporation. All rights reserved.
27 
28 #ifndef NVBLASTAUTHORINGMESHIMPL_H
29 #define NVBLASTAUTHORINGMESHIMPL_H
30 
32 #include <PxBounds3.h>
33 #include <vector>
34 #include <map>
35 #include <set>
36 
37 namespace Nv
38 {
39 namespace Blast
40 {
41 
45 class MeshImpl : public Mesh
46 {
47 public:
48 
58  MeshImpl(const NvcVec3* position, const NvcVec3* normals, const NvcVec2* uv, uint32_t verticesCount, const uint32_t* indices, uint32_t indicesCount);
59 
69  MeshImpl(const Vertex* vertices, const Edge* edges, const Facet* facets, uint32_t posCount, uint32_t edgesCount, uint32_t facetsCount);
70 
71  MeshImpl(const Vertex* vertices, uint32_t count);
72 
73  MeshImpl(const Vertex* vertices, uint32_t count, uint32_t* indices, uint32_t indexCount, void* materials, uint32_t materialStride);
74 
75  ~MeshImpl();
76 
77  virtual void release() override;
78 
82  bool isValid() const override;
83 
87  Vertex* getVerticesWritable() override;
88 
92  Edge* getEdgesWritable() override;
93 
97  Facet* getFacetsBufferWritable() override;
98 
102  const Vertex* getVertices() const override;
103 
107  const Edge* getEdges() const override;
108 
112  const Facet* getFacetsBuffer() const override;
113 
117  Facet* getFacetWritable(int32_t facet) override;
118 
122  const Facet* getFacet(int32_t facet) const override;
123 
127  uint32_t getEdgesCount() const override;
128 
132  uint32_t getVerticesCount() const override;
133 
137  uint32_t getFacetCount() const override;
138 
139 
143  const NvcBounds3& getBoundingBox() const override;
144 
149 
153  void recalculateBoundingBox() override;
154 
159  float getMeshVolume() override;
160 
161 
165  void setMaterialId(const int32_t* materialIds) override;
166 
170  void replaceMaterialId(int32_t oldMaterialId, int32_t newMaterialId) override;
171 
175  void setSmoothingGroup(const int32_t* smoothingGroups) override;
176 
180  virtual void calcPerFacetBounds() override;
181 
185  virtual const NvcBounds3* getFacetBound(uint32_t index) const override;
186 
187 private:
188  std::vector<Vertex> mVertices;
189  std::vector<Edge> mEdges;
190  std::vector<Facet> mFacets;
191  physx::PxBounds3 mBounds;
192  std::vector<physx::PxBounds3> mPerFacetBounds;
193 };
194 
195 } // namespace Blast
196 } // namespace Nv
197 
198 
199 #endif // ifndef NVBLASTAUTHORINGMESHIMPL_H
virtual void release() override
+Go to the documentation of this file.
1 // This code contains NVIDIA Confidential Information and is disclosed to you
2 // under a form of NVIDIA software license agreement provided separately to you.
3 //
4 // Notice
5 // NVIDIA Corporation and its licensors retain all intellectual property and
6 // proprietary rights in and to this software and related documentation and
7 // any modifications thereto. Any use, reproduction, disclosure, or
8 // distribution of this software and related documentation without an express
9 // license agreement from NVIDIA Corporation is strictly prohibited.
10 //
11 // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12 // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15 //
16 // Information and code furnished is believed to be accurate and reliable.
17 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18 // information or for any infringement of patents or other rights of third parties that may
19 // result from its use. No license is granted by implication or otherwise under any patent
20 // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21 // This code supersedes and replaces all information previously supplied.
22 // NVIDIA Corporation products are not authorized for use as critical
23 // components in life support devices or systems without express written approval of
24 // NVIDIA Corporation.
25 //
26 // Copyright (c) 2016-2020 NVIDIA Corporation. All rights reserved.
27 
28 #ifndef NVBLASTAUTHORINGMESHIMPL_H
29 #define NVBLASTAUTHORINGMESHIMPL_H
30 
32 #include <PxBounds3.h>
33 #include <vector>
34 #include <map>
35 #include <set>
36 
37 namespace Nv
38 {
39 namespace Blast
40 {
41 
45 class MeshImpl : public Mesh
46 {
47 public:
48 
58  MeshImpl(const NvcVec3* position, const NvcVec3* normals, const NvcVec2* uv, uint32_t verticesCount, const uint32_t* indices, uint32_t indicesCount);
59 
69  MeshImpl(const Vertex* vertices, const Edge* edges, const Facet* facets, uint32_t posCount, uint32_t edgesCount, uint32_t facetsCount);
70 
71  MeshImpl(const Vertex* vertices, uint32_t count);
72 
73  MeshImpl(const Vertex* vertices, uint32_t count, uint32_t* indices, uint32_t indexCount, void* materials, uint32_t materialStride);
74 
75  ~MeshImpl();
76 
77  virtual void release() override;
78 
82  bool isValid() const override;
83 
87  Vertex* getVerticesWritable() override;
88 
92  Edge* getEdgesWritable() override;
93 
97  Facet* getFacetsBufferWritable() override;
98 
102  const Vertex* getVertices() const override;
103 
107  const Edge* getEdges() const override;
108 
112  const Facet* getFacetsBuffer() const override;
113 
117  Facet* getFacetWritable(int32_t facet) override;
118 
122  const Facet* getFacet(int32_t facet) const override;
123 
127  uint32_t getEdgesCount() const override;
128 
132  uint32_t getVerticesCount() const override;
133 
137  uint32_t getFacetCount() const override;
138 
139 
143  const NvcBounds3& getBoundingBox() const override;
144 
149 
153  void recalculateBoundingBox() override;
154 
159  float getMeshVolume() override;
160 
161 
165  void setMaterialId(const int32_t* materialIds) override;
166 
170  void replaceMaterialId(int32_t oldMaterialId, int32_t newMaterialId) override;
171 
175  void setSmoothingGroup(const int32_t* smoothingGroups) override;
176 
180  virtual void calcPerFacetBounds() override;
181 
185  virtual const NvcBounds3* getFacetBound(uint32_t index) const override;
186 
187 private:
188  std::vector<Vertex> mVertices;
189  std::vector<Edge> mEdges;
190  std::vector<Facet> mFacets;
191  physx::PxBounds3 mBounds;
192  std::vector<physx::PxBounds3> mPerFacetBounds;
193 };
194 
195 } // namespace Blast
196 } // namespace Nv
197 
198 
199 #endif // ifndef NVBLASTAUTHORINGMESHIMPL_H
virtual void release() override
Facet * getFacetWritable(int32_t facet) override
uint32_t getFacetCount() const override
const Facet * getFacetsBuffer() const override
diff --git a/docs/source_docs/files/_nv_blast_ext_authoring_mesh_noiser_8h_source.html b/docs/source_docs/files/_nv_blast_ext_authoring_mesh_noiser_8h_source.html index 4208a41..a068de6 100755 --- a/docs/source_docs/files/_nv_blast_ext_authoring_mesh_noiser_8h_source.html +++ b/docs/source_docs/files/_nv_blast_ext_authoring_mesh_noiser_8h_source.html @@ -46,7 +46,7 @@ $(document).ready(function(){initNavTree('_nv_blast_ext_authoring_mesh_noiser_8h
NvBlastExtAuthoringMeshNoiser.h
-Go to the documentation of this file.
1 // This code contains NVIDIA Confidential Information and is disclosed to you
2 // under a form of NVIDIA software license agreement provided separately to you.
3 //
4 // Notice
5 // NVIDIA Corporation and its licensors retain all intellectual property and
6 // proprietary rights in and to this software and related documentation and
7 // any modifications thereto. Any use, reproduction, disclosure, or
8 // distribution of this software and related documentation without an express
9 // license agreement from NVIDIA Corporation is strictly prohibited.
10 //
11 // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12 // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15 //
16 // Information and code furnished is believed to be accurate and reliable.
17 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18 // information or for any infringement of patents or other rights of third parties that may
19 // result from its use. No license is granted by implication or otherwise under any patent
20 // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21 // This code supersedes and replaces all information previously supplied.
22 // NVIDIA Corporation products are not authorized for use as critical
23 // components in life support devices or systems without express written approval of
24 // NVIDIA Corporation.
25 //
26 // Copyright (c) 2016-2018 NVIDIA Corporation. All rights reserved.
27 
28 
29 #ifndef NVBLASTEXTAUTHORINGMESHNOISER_H
30 #define NVBLASTEXTAUTHORINGMESHNOISER_H
31 #include <vector>
32 #include <map>
34 
35 namespace Nv
36 {
37  namespace Blast
38  {
39  class SimplexNoise;
40 
45  {
46  int32_t tr[2];
47  int32_t c;
49  {
50  c = 0;
51  }
55  void add(int32_t t)
56  {
57  tr[c] = t;
58  ++c;
59  }
63  void replace(int32_t from, int32_t to)
64  {
65  if (tr[0] == from)
66  {
67  tr[0] = to;
68  }
69  else
70  {
71  if (c == 2 && tr[1] == from)
72  {
73  tr[1] = to;
74  }
75  }
76  }
80  int32_t getNot(int32_t id)
81  {
82  if (tr[0] != id)
83  {
84  return tr[0];
85  }
86  if (c == 2 && tr[1] != id)
87  {
88  return tr[1];
89  }
90  return -1;
91  }
92 
93  };
94 
99  class MeshNoiser
100  {
101  public:
103  {
104  reset();
105  }
106 
107  void reset();
108 
112  enum EdgeFlag { INTERNAL_EDGE, EXTERNAL_BORDER_EDGE, INTERNAL_BORDER_EDGE, EXTERNAL_EDGE, NONE };
113 
114 
118  void setMesh(const std::vector<Triangle>& mesh);
119 
124  void tesselateInternalSurface(float maxLen);
125 
133  void applyNoise(SimplexNoise& noise, float falloff, int32_t relaxIterations, float relaxFactor);
134 
135  std::vector<Triangle> getMesh();
136 
137  private:
138  physx::PxVec3 mOffset;
139  float mScale;
140  bool isTesselated;
144  std::vector<Vertex> mVertices;
145  std::vector<TriangleIndexed> mTriangles;
146  std::vector<Edge> mEdges;
147  std::map<Vertex, int32_t, VrtComp> mVertMap;
148  std::map<Edge, int32_t> mEdgeMap;
149 
150 
154  std::vector<Triangle> mResultTriangles;
155 
156 
157  int32_t addVerticeIfNotExist(const Vertex& p);
158  int32_t addEdge(const Edge& e);
159  int32_t findEdge(const Edge& e);
160 
161 
162 
163  void collapseEdge(int32_t id);
164  void divideEdge(int32_t id);
165  void updateVertEdgeInfo();
166  void updateEdgeTriangleInfo();
167  void relax(int32_t iterations, float factor, std::vector<Vertex>& vertices);
168  void recalcNoiseDirs();
169 
170 
171  std::vector<bool> mRestrictionFlag;
172  std::vector<EdgeFlag> mEdgeFlag;
173  std::vector<EdgeToTriangles> mTrMeshEdToTr;
174  std::vector<int32_t> mVertexValence;
175  std::vector<std::vector<int32_t> > mVertexToTriangleMap;
176 
177 
178 
179  std::vector<float> mVerticesDistances;
180  std::vector<physx::PxVec3> mVerticesNormalsSmoothed;
181  std::vector<uint32_t> mPositionMappedVrt;
182  std::vector<std::vector<int32_t> > mGeometryGraph;
183 
184  void prebuildEdgeFlagArray();
185  void computePositionedMapping();
186  void computeFalloffAndNormals();
187 
188  void prebuildTesselatedTriangles();
189  };
190 
191  } // namespace Blast
192 } // namespace Nv
193 #endif // ! NVBLASTEXTAUTHORINGMESHNOISER_H
MeshNoiser()
Definition: NvBlastExtAuthoringMeshNoiser.h:102
+Go to the documentation of this file.
1 // This code contains NVIDIA Confidential Information and is disclosed to you
2 // under a form of NVIDIA software license agreement provided separately to you.
3 //
4 // Notice
5 // NVIDIA Corporation and its licensors retain all intellectual property and
6 // proprietary rights in and to this software and related documentation and
7 // any modifications thereto. Any use, reproduction, disclosure, or
8 // distribution of this software and related documentation without an express
9 // license agreement from NVIDIA Corporation is strictly prohibited.
10 //
11 // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12 // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15 //
16 // Information and code furnished is believed to be accurate and reliable.
17 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18 // information or for any infringement of patents or other rights of third parties that may
19 // result from its use. No license is granted by implication or otherwise under any patent
20 // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21 // This code supersedes and replaces all information previously supplied.
22 // NVIDIA Corporation products are not authorized for use as critical
23 // components in life support devices or systems without express written approval of
24 // NVIDIA Corporation.
25 //
26 // Copyright (c) 2016-2020 NVIDIA Corporation. All rights reserved.
27 
28 
29 #ifndef NVBLASTEXTAUTHORINGMESHNOISER_H
30 #define NVBLASTEXTAUTHORINGMESHNOISER_H
31 #include <vector>
32 #include <map>
34 
35 namespace Nv
36 {
37  namespace Blast
38  {
39  class SimplexNoise;
40 
45  {
46  int32_t tr[2];
47  int32_t c;
49  {
50  c = 0;
51  }
55  void add(int32_t t)
56  {
57  tr[c] = t;
58  ++c;
59  }
63  void replace(int32_t from, int32_t to)
64  {
65  if (tr[0] == from)
66  {
67  tr[0] = to;
68  }
69  else
70  {
71  if (c == 2 && tr[1] == from)
72  {
73  tr[1] = to;
74  }
75  }
76  }
80  int32_t getNot(int32_t id)
81  {
82  if (tr[0] != id)
83  {
84  return tr[0];
85  }
86  if (c == 2 && tr[1] != id)
87  {
88  return tr[1];
89  }
90  return -1;
91  }
92 
93  };
94 
99  class MeshNoiser
100  {
101  public:
103  {
104  reset();
105  }
106 
107  void reset();
108 
112  enum EdgeFlag { INTERNAL_EDGE, EXTERNAL_BORDER_EDGE, INTERNAL_BORDER_EDGE, EXTERNAL_EDGE, NONE };
113 
114 
118  void setMesh(const std::vector<Triangle>& mesh);
119 
124  void tesselateInternalSurface(float maxLen);
125 
133  void applyNoise(SimplexNoise& noise, float falloff, int32_t relaxIterations, float relaxFactor);
134 
135  std::vector<Triangle> getMesh();
136 
137  private:
138  physx::PxVec3 mOffset;
139  float mScale;
140  bool isTesselated;
144  std::vector<Vertex> mVertices;
145  std::vector<TriangleIndexed> mTriangles;
146  std::vector<Edge> mEdges;
147  std::map<Vertex, int32_t, VrtComp> mVertMap;
148  std::map<Edge, int32_t> mEdgeMap;
149 
150 
154  std::vector<Triangle> mResultTriangles;
155 
156 
157  int32_t addVerticeIfNotExist(const Vertex& p);
158  int32_t addEdge(const Edge& e);
159  int32_t findEdge(const Edge& e);
160 
161 
162 
163  void collapseEdge(int32_t id);
164  void divideEdge(int32_t id);
165  void updateVertEdgeInfo();
166  void updateEdgeTriangleInfo();
167  void relax(int32_t iterations, float factor, std::vector<Vertex>& vertices);
168  void recalcNoiseDirs();
169 
170 
171  std::vector<bool> mRestrictionFlag;
172  std::vector<EdgeFlag> mEdgeFlag;
173  std::vector<EdgeToTriangles> mTrMeshEdToTr;
174  std::vector<int32_t> mVertexValence;
175  std::vector<std::vector<int32_t> > mVertexToTriangleMap;
176 
177 
178 
179  std::vector<float> mVerticesDistances;
180  std::vector<physx::PxVec3> mVerticesNormalsSmoothed;
181  std::vector<uint32_t> mPositionMappedVrt;
182  std::vector<std::vector<int32_t> > mGeometryGraph;
183 
184  void prebuildEdgeFlagArray();
185  void computePositionedMapping();
186  void computeFalloffAndNormals();
187 
188  void prebuildTesselatedTriangles();
189  };
190 
191  } // namespace Blast
192 } // namespace Nv
193 #endif // ! NVBLASTEXTAUTHORINGMESHNOISER_H
MeshNoiser()
Definition: NvBlastExtAuthoringMeshNoiser.h:102
EdgeToTriangles()
Definition: NvBlastExtAuthoringMeshNoiser.h:48
void add(int32_t t)
Definition: NvBlastExtAuthoringMeshNoiser.h:55
int32_t c
Definition: NvBlastExtAuthoringMeshNoiser.h:47
diff --git a/docs/source_docs/files/_nv_blast_ext_authoring_pattern_generator_8h_source.html b/docs/source_docs/files/_nv_blast_ext_authoring_pattern_generator_8h_source.html index e96a7e0..5e638a2 100644 --- a/docs/source_docs/files/_nv_blast_ext_authoring_pattern_generator_8h_source.html +++ b/docs/source_docs/files/_nv_blast_ext_authoring_pattern_generator_8h_source.html @@ -46,7 +46,7 @@ $(document).ready(function(){initNavTree('_nv_blast_ext_authoring_pattern_genera
NvBlastExtAuthoringPatternGenerator.h
-Go to the documentation of this file.
1 // This code contains NVIDIA Confidential Information and is disclosed to you
2 // under a form of NVIDIA software license agreement provided separately to you.
3 //
4 // Notice
5 // NVIDIA Corporation and its licensors retain all intellectual property and
6 // proprietary rights in and to this software and related documentation and
7 // any modifications thereto. Any use, reproduction, disclosure, or
8 // distribution of this software and related documentation without an express
9 // license agreement from NVIDIA Corporation is strictly prohibited.
10 //
11 // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12 // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15 //
16 // Information and code furnished is believed to be accurate and reliable.
17 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18 // information or for any infringement of patents or other rights of third parties that may
19 // result from its use. No license is granted by implication or otherwise under any patent
20 // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21 // This code supersedes and replaces all information previously supplied.
22 // NVIDIA Corporation products are not authorized for use as critical
23 // components in life support devices or systems without express written approval of
24 // NVIDIA Corporation.
25 //
26 // Copyright (c) 2016-2018 NVIDIA Corporation. All rights reserved.
27 
28 
29 #ifndef NVBLASTEXTAUTHORINGPATTERNGENERATOR_H
30 #define NVBLASTEXTAUTHORINGPATTERNGENERATOR_H
31 
32 #include "NvBlastGlobals.h"
33 
34 namespace Nv
35 {
36  namespace Blast
37  {
38  typedef float (*RNG_CALLBACK)(void);
39 
41  {
42  RNG_CALLBACK RNG = nullptr;
43 
44  uint32_t interiorMaterialId = 1000;
45  };
46 
48  {
49  uint32_t cellsCount = 2;
50 
51  float radiusMin = 0.0f;
52  float radiusMax = 1.0f;
53  float radiusDistr = 1.0f;
54 
55  float debrisRadiusMult = 1.0f;
56  };
57 
59  {
60  uint32_t cellsCount;
61 
62  float radiusMin;
63  float radiusMax;
64  };
65 
67  {
68  float radiusMin = 0.0f;
69  float radiusMax = 1.0f;
70 
71  uint32_t radialSteps = 3;
72  uint32_t angularSteps = 8;
73 
74  float aperture = .0f;
75 
76  float angularNoiseAmplitude = 0.0f;
77 
78  float radialNoiseAmplitude = 0.0f;
79  float radialNoiseFrequency = 0.0f;
80 
81  float debrisRadiusMult = 1.0f;
82  };
83 
84 
86  {
91  float angle; // For cone shape activation
93  {
94  Point = 0,
96  Cone
97  };
98  ActivationDistanceType activationType = Point;
99  // ----------------------------------------------
100 
101 
102  uint32_t cellsCount;
103  class Mesh** cellsMeshes = nullptr;
104 
105  virtual void release() = 0;
106  };
107 
109  {
110  public:
111  virtual DamagePattern* generateUniformPattern(const UniformPatternDesc* desc) = 0;
112  virtual DamagePattern* generateBeamPattern(const BeamPatternDesc* desc) = 0;
113  virtual DamagePattern* generateRegularRadialPattern(const RegularRadialPatternDesc* desc) = 0;
114 
115 
116  virtual DamagePattern* generateVoronoiPattern(uint32_t pointCount, const NvcVec3* points, int32_t interiorMaterialId) = 0;
117  virtual void release() = 0;
118  };
119 
121 
122  } // namespace Blast
123 } // namespace Nv
124 
125 
126 #endif // ifndef NVBLASTEXTAUTHORINGMESHCLEANER_H
NVBLAST_API void savePatternToObj(DamagePattern *pattern)
+Go to the documentation of this file.
1 // This code contains NVIDIA Confidential Information and is disclosed to you
2 // under a form of NVIDIA software license agreement provided separately to you.
3 //
4 // Notice
5 // NVIDIA Corporation and its licensors retain all intellectual property and
6 // proprietary rights in and to this software and related documentation and
7 // any modifications thereto. Any use, reproduction, disclosure, or
8 // distribution of this software and related documentation without an express
9 // license agreement from NVIDIA Corporation is strictly prohibited.
10 //
11 // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12 // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15 //
16 // Information and code furnished is believed to be accurate and reliable.
17 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18 // information or for any infringement of patents or other rights of third parties that may
19 // result from its use. No license is granted by implication or otherwise under any patent
20 // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21 // This code supersedes and replaces all information previously supplied.
22 // NVIDIA Corporation products are not authorized for use as critical
23 // components in life support devices or systems without express written approval of
24 // NVIDIA Corporation.
25 //
26 // Copyright (c) 2016-2020 NVIDIA Corporation. All rights reserved.
27 
28 
29 #ifndef NVBLASTEXTAUTHORINGPATTERNGENERATOR_H
30 #define NVBLASTEXTAUTHORINGPATTERNGENERATOR_H
31 
32 #include "NvBlastGlobals.h"
33 
34 namespace Nv
35 {
36  namespace Blast
37  {
38  typedef float (*RNG_CALLBACK)(void);
39 
41  {
42  RNG_CALLBACK RNG = nullptr;
43 
44  uint32_t interiorMaterialId = 1000;
45  };
46 
48  {
49  uint32_t cellsCount = 2;
50 
51  float radiusMin = 0.0f;
52  float radiusMax = 1.0f;
53  float radiusDistr = 1.0f;
54 
55  float debrisRadiusMult = 1.0f;
56  };
57 
59  {
60  uint32_t cellsCount;
61 
62  float radiusMin;
63  float radiusMax;
64  };
65 
67  {
68  float radiusMin = 0.0f;
69  float radiusMax = 1.0f;
70 
71  uint32_t radialSteps = 3;
72  uint32_t angularSteps = 8;
73 
74  float aperture = .0f;
75 
76  float angularNoiseAmplitude = 0.0f;
77 
78  float radialNoiseAmplitude = 0.0f;
79  float radialNoiseFrequency = 0.0f;
80 
81  float debrisRadiusMult = 1.0f;
82  };
83 
84 
86  {
91  float angle; // For cone shape activation
93  {
94  Point = 0,
96  Cone
97  };
98  ActivationDistanceType activationType = Point;
99  // ----------------------------------------------
100 
101 
102  uint32_t cellsCount;
103  class Mesh** cellsMeshes = nullptr;
104 
105  virtual void release() = 0;
106  };
107 
109  {
110  public:
111  virtual DamagePattern* generateUniformPattern(const UniformPatternDesc* desc) = 0;
112  virtual DamagePattern* generateBeamPattern(const BeamPatternDesc* desc) = 0;
113  virtual DamagePattern* generateRegularRadialPattern(const RegularRadialPatternDesc* desc) = 0;
114 
115 
116  virtual DamagePattern* generateVoronoiPattern(uint32_t pointCount, const NvcVec3* points, int32_t interiorMaterialId) = 0;
117  virtual void release() = 0;
118  };
119 
121 
122  } // namespace Blast
123 } // namespace Nv
124 
125 
126 #endif // ifndef NVBLASTEXTAUTHORINGMESHCLEANER_H
NVBLAST_API void savePatternToObj(DamagePattern *pattern)
float radiusMax
Definition: NvBlastExtAuthoringPatternGenerator.h:63
Definition: NvBlastExtAuthoringPatternGenerator.h:47
float radiusMin
Definition: NvBlastExtAuthoringPatternGenerator.h:62
diff --git a/docs/source_docs/files/_nv_blast_ext_authoring_pattern_generator_impl_8h_source.html b/docs/source_docs/files/_nv_blast_ext_authoring_pattern_generator_impl_8h_source.html index ca66ea6..79d1230 100644 --- a/docs/source_docs/files/_nv_blast_ext_authoring_pattern_generator_impl_8h_source.html +++ b/docs/source_docs/files/_nv_blast_ext_authoring_pattern_generator_impl_8h_source.html @@ -46,7 +46,7 @@ $(document).ready(function(){initNavTree('_nv_blast_ext_authoring_pattern_genera
NvBlastExtAuthoringPatternGeneratorImpl.h
-Go to the documentation of this file.
1 // This code contains NVIDIA Confidential Information and is disclosed to you
2 // under a form of NVIDIA software license agreement provided separately to you.
3 //
4 // Notice
5 // NVIDIA Corporation and its licensors retain all intellectual property and
6 // proprietary rights in and to this software and related documentation and
7 // any modifications thereto. Any use, reproduction, disclosure, or
8 // distribution of this software and related documentation without an express
9 // license agreement from NVIDIA Corporation is strictly prohibited.
10 //
11 // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12 // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15 //
16 // Information and code furnished is believed to be accurate and reliable.
17 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18 // information or for any infringement of patents or other rights of third parties that may
19 // result from its use. No license is granted by implication or otherwise under any patent
20 // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21 // This code supersedes and replaces all information previously supplied.
22 // NVIDIA Corporation products are not authorized for use as critical
23 // components in life support devices or systems without express written approval of
24 // NVIDIA Corporation.
25 //
26 // Copyright (c) 2016-2018 NVIDIA Corporation. All rights reserved.
27 
28 
29 #ifndef NVBLASTEXTAUTHORINGPATTERNGENERATORIMPL_H
30 #define NVBLASTEXTAUTHORINGPATTERNGENERATORIMPL_H
31 
34 
35 
36 namespace Nv
37 {
38 namespace Blast
39 {
40 
42  {
43  public:
44  virtual DamagePattern* generateUniformPattern(const UniformPatternDesc* desc) override;
45  virtual DamagePattern* generateBeamPattern(const BeamPatternDesc* desc) override;
47  virtual void release() override;
48 
49  virtual DamagePattern* generateVoronoiPattern(uint32_t pointCount, const NvcVec3* points, int32_t interiorMaterialId) override;
50  private:
51  DamagePattern* generateVoronoiPatternInternal(uint32_t pointCount, const NvcVec3* points, int32_t interiorMaterialId, float angle = 0.0f);
52  };
53 
54 
55 } // namespace Blast
56 } // namespace Nv
57 
58 #endif // ifndef NVBLASTEXTAUTHORINGMESHCLEANER_H
+Go to the documentation of this file.
1 // This code contains NVIDIA Confidential Information and is disclosed to you
2 // under a form of NVIDIA software license agreement provided separately to you.
3 //
4 // Notice
5 // NVIDIA Corporation and its licensors retain all intellectual property and
6 // proprietary rights in and to this software and related documentation and
7 // any modifications thereto. Any use, reproduction, disclosure, or
8 // distribution of this software and related documentation without an express
9 // license agreement from NVIDIA Corporation is strictly prohibited.
10 //
11 // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12 // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15 //
16 // Information and code furnished is believed to be accurate and reliable.
17 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18 // information or for any infringement of patents or other rights of third parties that may
19 // result from its use. No license is granted by implication or otherwise under any patent
20 // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21 // This code supersedes and replaces all information previously supplied.
22 // NVIDIA Corporation products are not authorized for use as critical
23 // components in life support devices or systems without express written approval of
24 // NVIDIA Corporation.
25 //
26 // Copyright (c) 2016-2020 NVIDIA Corporation. All rights reserved.
27 
28 
29 #ifndef NVBLASTEXTAUTHORINGPATTERNGENERATORIMPL_H
30 #define NVBLASTEXTAUTHORINGPATTERNGENERATORIMPL_H
31 
34 
35 
36 namespace Nv
37 {
38 namespace Blast
39 {
40 
42  {
43  public:
44  virtual DamagePattern* generateUniformPattern(const UniformPatternDesc* desc) override;
45  virtual DamagePattern* generateBeamPattern(const BeamPatternDesc* desc) override;
47  virtual void release() override;
48 
49  virtual DamagePattern* generateVoronoiPattern(uint32_t pointCount, const NvcVec3* points, int32_t interiorMaterialId) override;
50  private:
51  DamagePattern* generateVoronoiPatternInternal(uint32_t pointCount, const NvcVec3* points, int32_t interiorMaterialId, float angle = 0.0f);
52  };
53 
54 
55 } // namespace Blast
56 } // namespace Nv
57 
58 #endif // ifndef NVBLASTEXTAUTHORINGMESHCLEANER_H
virtual DamagePattern * generateVoronoiPattern(uint32_t pointCount, const NvcVec3 *points, int32_t interiorMaterialId) override
Definition: NvBlastExtAuthoringPatternGenerator.h:47
diff --git a/docs/source_docs/files/_nv_blast_ext_authoring_perlin_noise_8h_source.html b/docs/source_docs/files/_nv_blast_ext_authoring_perlin_noise_8h_source.html index d0c6d15..4f5cd51 100755 --- a/docs/source_docs/files/_nv_blast_ext_authoring_perlin_noise_8h_source.html +++ b/docs/source_docs/files/_nv_blast_ext_authoring_perlin_noise_8h_source.html @@ -46,7 +46,7 @@ $(document).ready(function(){initNavTree('_nv_blast_ext_authoring_perlin_noise_8
NvBlastExtAuthoringPerlinNoise.h
-Go to the documentation of this file.
1 // This code contains NVIDIA Confidential Information and is disclosed to you
2 // under a form of NVIDIA software license agreement provided separately to you.
3 //
4 // Notice
5 // NVIDIA Corporation and its licensors retain all intellectual property and
6 // proprietary rights in and to this software and related documentation and
7 // any modifications thereto. Any use, reproduction, disclosure, or
8 // distribution of this software and related documentation without an express
9 // license agreement from NVIDIA Corporation is strictly prohibited.
10 //
11 // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12 // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15 //
16 // Information and code furnished is believed to be accurate and reliable.
17 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18 // information or for any infringement of patents or other rights of third parties that may
19 // result from its use. No license is granted by implication or otherwise under any patent
20 // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21 // This code supersedes and replaces all information previously supplied.
22 // NVIDIA Corporation products are not authorized for use as critical
23 // components in life support devices or systems without express written approval of
24 // NVIDIA Corporation.
25 //
26 // Copyright (c) 2018 NVIDIA Corporation. All rights reserved.
27 
28 
29 #ifndef NVBLASTEXTAUTHORINGPERLINNOISE_H
30 #define NVBLASTEXTAUTHORINGPERLINNOISE_H
31 
33 
34 #include <PxVec4.h>
35 #include <PxVec3.h>
36 
37 #define PERLIN_NOISE_SAMPLE_TABLE 512
38 using physx::PxVec3;
39 namespace Nv
40 {
41 namespace Blast
42 {
43 
44 /***********
45  Noise generation routines, copied from Apex.
46 */
47 
48 
49 NV_INLINE float at3(const float& rx, const float& ry, const float& rz, const PxVec3 q)
50 {
51  return rx * q[0] + ry * q[1] + rz * q[2];
52 }
53 
54 NV_INLINE float fade(float t) { return t * t * t * (t * (t * 6.0f - 15.0f) + 10.0f); }
55 
56 NV_INLINE float lerp(float t, float a, float b) { return a + t * (b - a); }
57 
58 NV_INLINE void setup(int i, PxVec3 point, float& t, int& b0, int& b1, float& r0, float& r1)
59 {
60  t = point[i] + (0x1000);
61  b0 = ((int)t) & (PERLIN_NOISE_SAMPLE_TABLE - 1);
62  b1 = (b0 + 1) & (PERLIN_NOISE_SAMPLE_TABLE - 1);
63  r0 = t - (int)t;
64  r1 = r0 - 1.0f;
65 }
66 
67 
68 NV_INLINE float noiseSample(PxVec3 point, int* p, PxVec3* g)
69 {
70  int bx0, bx1, by0, by1, bz0, bz1, b00, b10, b01, b11;
71  float rx0, rx1, ry0, ry1, rz0, rz1, sy, sz, a, b, c, d, t, u, v;
72  PxVec3 q;
73  int i, j;
74 
75  setup(0, point, t, bx0, bx1, rx0, rx1);
76  setup(1, point, t, by0, by1, ry0, ry1);
77  setup(2, point, t, bz0, bz1, rz0, rz1);
78 
79  i = p[bx0];
80  j = p[bx1];
81 
82  b00 = p[i + by0];
83  b10 = p[j + by0];
84  b01 = p[i + by1];
85  b11 = p[j + by1];
86 
87  t = fade(rx0);
88  sy = fade(ry0);
89  sz = fade(rz0);
90 
91  q = g[b00 + bz0]; u = at3(rx0, ry0, rz0, q);
92  q = g[b10 + bz0]; v = at3(rx1, ry0, rz0, q);
93  a = lerp(t, u, v);
94 
95  q = g[b01 + bz0]; u = at3(rx0, ry1, rz0, q);
96  q = g[b11 + bz0]; v = at3(rx1, ry1, rz0, q);
97  b = lerp(t, u, v);
98 
99  c = lerp(sy, a, b);
100 
101  q = g[b00 + bz1]; u = at3(rx0, ry0, rz1, q);
102  q = g[b10 + bz1]; v = at3(rx1, ry0, rz1, q);
103  a = lerp(t, u, v);
104 
105  q = g[b01 + bz1]; u = at3(rx0, ry1, rz1, q);
106  q = g[b11 + bz1]; v = at3(rx1, ry1, rz1, q);
107  b = lerp(t, u, v);
108 
109  d = lerp(sy, a, b);
110 
111  return lerp(sz, c, d);
112 }
113 
118 {
119 public:
126  PerlinNoise(Nv::Blast::RandomGeneratorBase* rnd, int octaves = 1, float frequency = 1., float amplitude = 1.)
127  : mRnd(rnd),
128  mOctaves(octaves),
129  mFrequency(frequency),
130  mAmplitude(amplitude),
131  mbInit(false)
132  {
133 
134  }
135 
136  /*
137  Reset state of noise generator
138  \param[in] octaves Number of noise octaves
139  \param[in] frequency Frequency of noise
140  \param[in] amplitude Amplitude of noise
141  */
142  void reset(int octaves = 1, float frequency = 1.f, float amplitude = 1.f)
143  {
144  mOctaves = octaves;
145  mFrequency = frequency;
146  mAmplitude = amplitude;
147  init();
148  }
149 
153  float sample(const physx::PxVec3& point)
154  {
155  return perlinNoise(point);
156  }
157 
158 private:
159  PerlinNoise& operator=(const PerlinNoise&);
160 
161  float perlinNoise(physx::PxVec3 point)
162  {
163  if (!mbInit)
164  init();
165 
166  const int octaves = mOctaves;
167  const float frequency = mFrequency;
168  float amplitude = mAmplitude;
169  float result = 0.0f;
170 
171  point *= frequency;
172 
173  for (int i = 0; i < octaves; ++i)
174  {
175  PxVec3 lpnt;
176  lpnt[0] = point.x;
177  lpnt[1] = point.y;
178  lpnt[2] = point.z;
179  result += (noiseSample(lpnt, p, g)) * amplitude;
180  point *= 2.0f;
181  amplitude *= 0.5f;
182  }
183  return result;
184  }
185 
186  void init(void)
187  {
188  mbInit = true;
189 
190  unsigned i, j;
191  int k;
192 
193  for (i = 0; i < (unsigned)PERLIN_NOISE_SAMPLE_TABLE; i++)
194  {
195  p[i] = (int)i;
196  for (j = 0; j < 3; ++j)
197  g[i][j] = mRnd->getRandomValue();
198  g[i].normalize();
199  }
200 
201  while (--i)
202  {
203  k = p[i];
204  j = static_cast<uint32_t>(mRnd->getRandomValue() * PERLIN_NOISE_SAMPLE_TABLE);
205  p[i] = p[j];
206  p[j] = k;
207  }
208 
209  for (i = 0; i < PERLIN_NOISE_SAMPLE_TABLE + 2; ++i)
210  {
211  p[(unsigned)PERLIN_NOISE_SAMPLE_TABLE + i] = p[i];
212  for (j = 0; j < 3; ++j)
213  g[(unsigned)PERLIN_NOISE_SAMPLE_TABLE + i][j] = g[i][j];
214  }
215 
216  }
217 
219  int mOctaves;
220  float mFrequency;
221  float mAmplitude;
222 
223  // Permutation vector
224  int p[(unsigned)(PERLIN_NOISE_SAMPLE_TABLE + PERLIN_NOISE_SAMPLE_TABLE + 2)];
225  // Gradient vector
226  PxVec3 g[(unsigned)(PERLIN_NOISE_SAMPLE_TABLE + PERLIN_NOISE_SAMPLE_TABLE + 2)];
227 
228  bool mbInit;
229 };
230 
231 
236 {
237 
238  int32_t mOctaves;
239  float mAmplitude;
240  float mFrequency;
241  int32_t mSeed;
242 
243  static const int X_NOISE_GEN = 1619;
244  static const int Y_NOISE_GEN = 31337;
245  static const int Z_NOISE_GEN = 6971;
246  static const int W_NOISE_GEN = 1999;
247  static const int SEED_NOISE_GEN = 1013;
248  static const int SHIFT_NOISE_GEN = 8;
249 
250  NV_INLINE int fastfloor(float x)
251  {
252  return (x >= 0) ? (int)x : (int)(x - 1);
253  }
254 
255  SimplexNoise& operator=(const SimplexNoise&)
256  {
257  return *this;
258  }
259 
260 public:
267  SimplexNoise(float ampl, float freq, int32_t octaves, int32_t seed) : mOctaves(octaves), mAmplitude(ampl), mFrequency(freq), mSeed(seed) {};
268  // 4D simplex noise
269  // returns: (x,y,z) = noise grad, w = noise value
270 
280  physx::PxVec4 eval4D(float x, float y, float z, float w, int seed)
281  {
282  // The skewing and unskewing factors are hairy again for the 4D case
283  const float F4 = (physx::PxSqrt(5.0f) - 1.0f) / 4.0f;
284  const float G4 = (5.0f - physx::PxSqrt(5.0f)) / 20.0f;
285  // Skew the (x,y,z,w) space to determine which cell of 24 simplices we're in
286  float s = (x + y + z + w) * F4; // Factor for 4D skewing
287  int ix = fastfloor(x + s);
288  int iy = fastfloor(y + s);
289  int iz = fastfloor(z + s);
290  int iw = fastfloor(w + s);
291  float tu = (ix + iy + iz + iw) * G4; // Factor for 4D unskewing
292  // Unskew the cell origin back to (x,y,z,w) space
293  float x0 = x - (ix - tu); // The x,y,z,w distances from the cell origin
294  float y0 = y - (iy - tu);
295  float z0 = z - (iz - tu);
296  float w0 = w - (iw - tu);
297 
298  int c = (x0 > y0) ? (1 << 0) : (1 << 2);
299  c += (x0 > z0) ? (1 << 0) : (1 << 4);
300  c += (x0 > w0) ? (1 << 0) : (1 << 6);
301  c += (y0 > z0) ? (1 << 2) : (1 << 4);
302  c += (y0 > w0) ? (1 << 2) : (1 << 6);
303  c += (z0 > w0) ? (1 << 4) : (1 << 6);
304 
305  physx::PxVec4 res;
306  res.setZero();
307 
308  // Calculate the contribution from the five corners
309  for (int p = 4; p >= 0; --p)
310  {
311  int ixp = ((c >> 0) & 3) >= p ? 1 : 0;
312  int iyp = ((c >> 2) & 3) >= p ? 1 : 0;
313  int izp = ((c >> 4) & 3) >= p ? 1 : 0;
314  int iwp = ((c >> 6) & 3) >= p ? 1 : 0;
315 
316  float xp = x0 - ixp + (4 - p) * G4;
317  float yp = y0 - iyp + (4 - p) * G4;
318  float zp = z0 - izp + (4 - p) * G4;
319  float wp = w0 - iwp + (4 - p) * G4;
320 
321  float t = 0.6f - xp * xp - yp * yp - zp * zp - wp * wp;
322  if (t > 0)
323  {
324  //get index
325  int gradIndex = int((
326  X_NOISE_GEN * (ix + ixp)
327  + Y_NOISE_GEN * (iy + iyp)
328  + Z_NOISE_GEN * (iz + izp)
329  + W_NOISE_GEN * (iw + iwp)
330  + SEED_NOISE_GEN * seed)
331  & 0xffffffff);
332  gradIndex ^= (gradIndex >> SHIFT_NOISE_GEN);
333  gradIndex &= 31;
334 
335  physx::PxVec4 g;
336  {
337  const int h = gradIndex;
338  const int hs = 2 - (h >> 4);
339  const int h1 = (h >> 3);
340  g.x = (h1 == 0) ? 0.0f : ((h & 4) ? -1.0f : 1.0f);
341  g.y = (h1 == 1) ? 0.0f : ((h & (hs << 1)) ? -1.0f : 1.0f);
342  g.z = (h1 == 2) ? 0.0f : ((h & hs) ? -1.0f : 1.0f);
343  g.w = (h1 == 3) ? 0.0f : ((h & 1) ? -1.0f : 1.0f);
344  }
345  float gdot = (g.x * xp + g.y * yp + g.z * zp + g.w * wp);
346 
347  float t2 = t * t;
348  float t3 = t2 * t;
349  float t4 = t3 * t;
350 
351  float dt4gdot = 8 * t3 * gdot;
352 
353  res.x += t4 * g.x - dt4gdot * xp;
354  res.y += t4 * g.y - dt4gdot * yp;
355  res.z += t4 * g.z - dt4gdot * zp;
356  res.w += t4 * gdot;
357  }
358  }
359  // scale the result to cover the range [-1,1]
360  res *= 27;
361  return res;
362  }
363 
369  float sample(physx::PxVec3 p)
370  {
371  p *= mFrequency;
372  float result = 0.0f;
373  float alpha = 1;
374  for (int32_t i = 1; i <= mOctaves; ++i)
375  {
376  result += eval4D(p.x * i, p.y * i, p.z * i, i * 5.0f, mSeed).w * alpha;
377  alpha *= 0.45;
378  }
379  return result * mAmplitude;
380  }
381 
382 };
383 
384 
385  } // Blast namespace
386 } // Nv namespace
387 
388 
389 
390 #endif
SimplexNoise(float ampl, float freq, int32_t octaves, int32_t seed)
Definition: NvBlastExtAuthoringPerlinNoise.h:267
+Go to the documentation of this file.
1 // This code contains NVIDIA Confidential Information and is disclosed to you
2 // under a form of NVIDIA software license agreement provided separately to you.
3 //
4 // Notice
5 // NVIDIA Corporation and its licensors retain all intellectual property and
6 // proprietary rights in and to this software and related documentation and
7 // any modifications thereto. Any use, reproduction, disclosure, or
8 // distribution of this software and related documentation without an express
9 // license agreement from NVIDIA Corporation is strictly prohibited.
10 //
11 // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12 // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15 //
16 // Information and code furnished is believed to be accurate and reliable.
17 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18 // information or for any infringement of patents or other rights of third parties that may
19 // result from its use. No license is granted by implication or otherwise under any patent
20 // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21 // This code supersedes and replaces all information previously supplied.
22 // NVIDIA Corporation products are not authorized for use as critical
23 // components in life support devices or systems without express written approval of
24 // NVIDIA Corporation.
25 //
26 // Copyright (c) 2020 NVIDIA Corporation. All rights reserved.
27 
28 
29 #ifndef NVBLASTEXTAUTHORINGPERLINNOISE_H
30 #define NVBLASTEXTAUTHORINGPERLINNOISE_H
31 
33 
34 #include <PxVec4.h>
35 #include <PxVec3.h>
36 
37 #define PERLIN_NOISE_SAMPLE_TABLE 512
38 using physx::PxVec3;
39 namespace Nv
40 {
41 namespace Blast
42 {
43 
44 /***********
45  Noise generation routines, copied from Apex.
46 */
47 
48 
49 NV_INLINE float at3(const float& rx, const float& ry, const float& rz, const PxVec3 q)
50 {
51  return rx * q[0] + ry * q[1] + rz * q[2];
52 }
53 
54 NV_INLINE float fade(float t) { return t * t * t * (t * (t * 6.0f - 15.0f) + 10.0f); }
55 
56 NV_INLINE float lerp(float t, float a, float b) { return a + t * (b - a); }
57 
58 NV_INLINE void setup(int i, PxVec3 point, float& t, int& b0, int& b1, float& r0, float& r1)
59 {
60  t = point[i] + (0x1000);
61  b0 = ((int)t) & (PERLIN_NOISE_SAMPLE_TABLE - 1);
62  b1 = (b0 + 1) & (PERLIN_NOISE_SAMPLE_TABLE - 1);
63  r0 = t - (int)t;
64  r1 = r0 - 1.0f;
65 }
66 
67 
68 NV_INLINE float noiseSample(PxVec3 point, int* p, PxVec3* g)
69 {
70  int bx0, bx1, by0, by1, bz0, bz1, b00, b10, b01, b11;
71  float rx0, rx1, ry0, ry1, rz0, rz1, sy, sz, a, b, c, d, t, u, v;
72  PxVec3 q;
73  int i, j;
74 
75  setup(0, point, t, bx0, bx1, rx0, rx1);
76  setup(1, point, t, by0, by1, ry0, ry1);
77  setup(2, point, t, bz0, bz1, rz0, rz1);
78 
79  i = p[bx0];
80  j = p[bx1];
81 
82  b00 = p[i + by0];
83  b10 = p[j + by0];
84  b01 = p[i + by1];
85  b11 = p[j + by1];
86 
87  t = fade(rx0);
88  sy = fade(ry0);
89  sz = fade(rz0);
90 
91  q = g[b00 + bz0]; u = at3(rx0, ry0, rz0, q);
92  q = g[b10 + bz0]; v = at3(rx1, ry0, rz0, q);
93  a = lerp(t, u, v);
94 
95  q = g[b01 + bz0]; u = at3(rx0, ry1, rz0, q);
96  q = g[b11 + bz0]; v = at3(rx1, ry1, rz0, q);
97  b = lerp(t, u, v);
98 
99  c = lerp(sy, a, b);
100 
101  q = g[b00 + bz1]; u = at3(rx0, ry0, rz1, q);
102  q = g[b10 + bz1]; v = at3(rx1, ry0, rz1, q);
103  a = lerp(t, u, v);
104 
105  q = g[b01 + bz1]; u = at3(rx0, ry1, rz1, q);
106  q = g[b11 + bz1]; v = at3(rx1, ry1, rz1, q);
107  b = lerp(t, u, v);
108 
109  d = lerp(sy, a, b);
110 
111  return lerp(sz, c, d);
112 }
113 
118 {
119 public:
126  PerlinNoise(Nv::Blast::RandomGeneratorBase* rnd, int octaves = 1, float frequency = 1., float amplitude = 1.)
127  : mRnd(rnd),
128  mOctaves(octaves),
129  mFrequency(frequency),
130  mAmplitude(amplitude),
131  mbInit(false)
132  {
133 
134  }
135 
136  /*
137  Reset state of noise generator
138  \param[in] octaves Number of noise octaves
139  \param[in] frequency Frequency of noise
140  \param[in] amplitude Amplitude of noise
141  */
142  void reset(int octaves = 1, float frequency = 1.f, float amplitude = 1.f)
143  {
144  mOctaves = octaves;
145  mFrequency = frequency;
146  mAmplitude = amplitude;
147  init();
148  }
149 
153  float sample(const physx::PxVec3& point)
154  {
155  return perlinNoise(point);
156  }
157 
158 private:
159  PerlinNoise& operator=(const PerlinNoise&);
160 
161  float perlinNoise(physx::PxVec3 point)
162  {
163  if (!mbInit)
164  init();
165 
166  const int octaves = mOctaves;
167  const float frequency = mFrequency;
168  float amplitude = mAmplitude;
169  float result = 0.0f;
170 
171  point *= frequency;
172 
173  for (int i = 0; i < octaves; ++i)
174  {
175  PxVec3 lpnt;
176  lpnt[0] = point.x;
177  lpnt[1] = point.y;
178  lpnt[2] = point.z;
179  result += (noiseSample(lpnt, p, g)) * amplitude;
180  point *= 2.0f;
181  amplitude *= 0.5f;
182  }
183  return result;
184  }
185 
186  void init(void)
187  {
188  mbInit = true;
189 
190  unsigned i, j;
191  int k;
192 
193  for (i = 0; i < (unsigned)PERLIN_NOISE_SAMPLE_TABLE; i++)
194  {
195  p[i] = (int)i;
196  for (j = 0; j < 3; ++j)
197  g[i][j] = mRnd->getRandomValue();
198  g[i].normalize();
199  }
200 
201  while (--i)
202  {
203  k = p[i];
204  j = static_cast<uint32_t>(mRnd->getRandomValue() * PERLIN_NOISE_SAMPLE_TABLE);
205  p[i] = p[j];
206  p[j] = k;
207  }
208 
209  for (i = 0; i < PERLIN_NOISE_SAMPLE_TABLE + 2; ++i)
210  {
211  p[(unsigned)PERLIN_NOISE_SAMPLE_TABLE + i] = p[i];
212  for (j = 0; j < 3; ++j)
213  g[(unsigned)PERLIN_NOISE_SAMPLE_TABLE + i][j] = g[i][j];
214  }
215 
216  }
217 
219  int mOctaves;
220  float mFrequency;
221  float mAmplitude;
222 
223  // Permutation vector
224  int p[(unsigned)(PERLIN_NOISE_SAMPLE_TABLE + PERLIN_NOISE_SAMPLE_TABLE + 2)];
225  // Gradient vector
226  PxVec3 g[(unsigned)(PERLIN_NOISE_SAMPLE_TABLE + PERLIN_NOISE_SAMPLE_TABLE + 2)];
227 
228  bool mbInit;
229 };
230 
231 
236 {
237 
238  int32_t mOctaves;
239  float mAmplitude;
240  float mFrequency;
241  int32_t mSeed;
242 
243  static const int X_NOISE_GEN = 1619;
244  static const int Y_NOISE_GEN = 31337;
245  static const int Z_NOISE_GEN = 6971;
246  static const int W_NOISE_GEN = 1999;
247  static const int SEED_NOISE_GEN = 1013;
248  static const int SHIFT_NOISE_GEN = 8;
249 
250  NV_INLINE int fastfloor(float x)
251  {
252  return (x >= 0) ? (int)x : (int)(x - 1);
253  }
254 
255  SimplexNoise& operator=(const SimplexNoise&)
256  {
257  return *this;
258  }
259 
260 public:
267  SimplexNoise(float ampl, float freq, int32_t octaves, int32_t seed) : mOctaves(octaves), mAmplitude(ampl), mFrequency(freq), mSeed(seed) {};
268  // 4D simplex noise
269  // returns: (x,y,z) = noise grad, w = noise value
270 
280  physx::PxVec4 eval4D(float x, float y, float z, float w, int seed)
281  {
282  // The skewing and unskewing factors are hairy again for the 4D case
283  const float F4 = (physx::PxSqrt(5.0f) - 1.0f) / 4.0f;
284  const float G4 = (5.0f - physx::PxSqrt(5.0f)) / 20.0f;
285  // Skew the (x,y,z,w) space to determine which cell of 24 simplices we're in
286  float s = (x + y + z + w) * F4; // Factor for 4D skewing
287  int ix = fastfloor(x + s);
288  int iy = fastfloor(y + s);
289  int iz = fastfloor(z + s);
290  int iw = fastfloor(w + s);
291  float tu = (ix + iy + iz + iw) * G4; // Factor for 4D unskewing
292  // Unskew the cell origin back to (x,y,z,w) space
293  float x0 = x - (ix - tu); // The x,y,z,w distances from the cell origin
294  float y0 = y - (iy - tu);
295  float z0 = z - (iz - tu);
296  float w0 = w - (iw - tu);
297 
298  int c = (x0 > y0) ? (1 << 0) : (1 << 2);
299  c += (x0 > z0) ? (1 << 0) : (1 << 4);
300  c += (x0 > w0) ? (1 << 0) : (1 << 6);
301  c += (y0 > z0) ? (1 << 2) : (1 << 4);
302  c += (y0 > w0) ? (1 << 2) : (1 << 6);
303  c += (z0 > w0) ? (1 << 4) : (1 << 6);
304 
305  physx::PxVec4 res;
306  res.setZero();
307 
308  // Calculate the contribution from the five corners
309  for (int p = 4; p >= 0; --p)
310  {
311  int ixp = ((c >> 0) & 3) >= p ? 1 : 0;
312  int iyp = ((c >> 2) & 3) >= p ? 1 : 0;
313  int izp = ((c >> 4) & 3) >= p ? 1 : 0;
314  int iwp = ((c >> 6) & 3) >= p ? 1 : 0;
315 
316  float xp = x0 - ixp + (4 - p) * G4;
317  float yp = y0 - iyp + (4 - p) * G4;
318  float zp = z0 - izp + (4 - p) * G4;
319  float wp = w0 - iwp + (4 - p) * G4;
320 
321  float t = 0.6f - xp * xp - yp * yp - zp * zp - wp * wp;
322  if (t > 0)
323  {
324  //get index
325  int gradIndex = int((
326  X_NOISE_GEN * (ix + ixp)
327  + Y_NOISE_GEN * (iy + iyp)
328  + Z_NOISE_GEN * (iz + izp)
329  + W_NOISE_GEN * (iw + iwp)
330  + SEED_NOISE_GEN * seed)
331  & 0xffffffff);
332  gradIndex ^= (gradIndex >> SHIFT_NOISE_GEN);
333  gradIndex &= 31;
334 
335  physx::PxVec4 g;
336  {
337  const int h = gradIndex;
338  const int hs = 2 - (h >> 4);
339  const int h1 = (h >> 3);
340  g.x = (h1 == 0) ? 0.0f : ((h & 4) ? -1.0f : 1.0f);
341  g.y = (h1 == 1) ? 0.0f : ((h & (hs << 1)) ? -1.0f : 1.0f);
342  g.z = (h1 == 2) ? 0.0f : ((h & hs) ? -1.0f : 1.0f);
343  g.w = (h1 == 3) ? 0.0f : ((h & 1) ? -1.0f : 1.0f);
344  }
345  float gdot = (g.x * xp + g.y * yp + g.z * zp + g.w * wp);
346 
347  float t2 = t * t;
348  float t3 = t2 * t;
349  float t4 = t3 * t;
350 
351  float dt4gdot = 8 * t3 * gdot;
352 
353  res.x += t4 * g.x - dt4gdot * xp;
354  res.y += t4 * g.y - dt4gdot * yp;
355  res.z += t4 * g.z - dt4gdot * zp;
356  res.w += t4 * gdot;
357  }
358  }
359  // scale the result to cover the range [-1,1]
360  res *= 27;
361  return res;
362  }
363 
369  float sample(physx::PxVec3 p)
370  {
371  p *= mFrequency;
372  float result = 0.0f;
373  float alpha = 1;
374  for (int32_t i = 1; i <= mOctaves; ++i)
375  {
376  result += eval4D(p.x * i, p.y * i, p.z * i, i * 5.0f, mSeed).w * alpha;
377  alpha *= 0.45;
378  }
379  return result * mAmplitude;
380  }
381 
382 };
383 
384 
385  } // Blast namespace
386 } // Nv namespace
387 
388 
389 
390 #endif
SimplexNoise(float ampl, float freq, int32_t octaves, int32_t seed)
Definition: NvBlastExtAuthoringPerlinNoise.h:267
physx::PxVec4 eval4D(float x, float y, float z, float w, int seed)
Definition: NvBlastExtAuthoringPerlinNoise.h:280
SIMD_FORCE_INLINE const btScalar & x() const
Return the x value.
Definition: btVector3.h:275
float sample(physx::PxVec3 p)
Definition: NvBlastExtAuthoringPerlinNoise.h:369
diff --git a/docs/source_docs/files/_nv_blast_ext_authoring_triangulator_8h_source.html b/docs/source_docs/files/_nv_blast_ext_authoring_triangulator_8h_source.html index 19783dc..1c13846 100755 --- a/docs/source_docs/files/_nv_blast_ext_authoring_triangulator_8h_source.html +++ b/docs/source_docs/files/_nv_blast_ext_authoring_triangulator_8h_source.html @@ -46,7 +46,7 @@ $(document).ready(function(){initNavTree('_nv_blast_ext_authoring_triangulator_8
NvBlastExtAuthoringTriangulator.h
-Go to the documentation of this file.
1 // This code contains NVIDIA Confidential Information and is disclosed to you
2 // under a form of NVIDIA software license agreement provided separately to you.
3 //
4 // Notice
5 // NVIDIA Corporation and its licensors retain all intellectual property and
6 // proprietary rights in and to this software and related documentation and
7 // any modifications thereto. Any use, reproduction, disclosure, or
8 // distribution of this software and related documentation without an express
9 // license agreement from NVIDIA Corporation is strictly prohibited.
10 //
11 // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12 // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15 //
16 // Information and code furnished is believed to be accurate and reliable.
17 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18 // information or for any infringement of patents or other rights of third parties that may
19 // result from its use. No license is granted by implication or otherwise under any patent
20 // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21 // This code supersedes and replaces all information previously supplied.
22 // NVIDIA Corporation products are not authorized for use as critical
23 // components in life support devices or systems without express written approval of
24 // NVIDIA Corporation.
25 //
26 // Copyright (c) 2016-2018 NVIDIA Corporation. All rights reserved.
27 
28 
29 #ifndef NVBLASTEXTAUTHORINGTRIANGULATOR_H
30 #define NVBLASTEXTAUTHORINGTRIANGULATOR_H
31 
32 
33 #include <vector>
34 #include <map>
38 
39 namespace Nv
40 {
41 namespace Blast
42 {
43 
44 
49 {
50 public:
55  void triangulate(const Mesh* mesh);
56 
60  std::vector<Triangle>& getBaseMesh()
61  {
62  return mBaseMeshUVFittedTriangles;
63  }
64 
65  std::vector<Triangle>& getBaseMeshNotFitted()
66  {
67  return mBaseMeshResultTriangles;
68  }
69 
70 
74  std::vector<TriangleIndexed>& getBaseMeshIndexed()
75  {
76  return mBaseMeshTriangles;
77  }
81  std::vector<uint32_t>& getBaseMapping()
82  {
83  return mBaseMapping;
84  };
88  std::vector<int32_t>& getPositionedMapping()
89  {
90  return mPositionMappedVrt;
91  };
96  {
97  return static_cast<uint32_t>(mVertices.size());
98  }
99 
103  void reset();
104 
105  int32_t& getParentChunkId() { return parentChunkId; };
106 
107 private:
108 
109  int32_t parentChunkId;
110 
111  int32_t addVerticeIfNotExist(const Vertex& p);
112  void addEdgeIfValid(EdgeWithParent& ed);
113 
114  /* Data used before triangulation to build polygon loops*/
115 
116  std::vector<Vertex> mVertices;
117  std::vector<EdgeWithParent> mBaseMeshEdges;
118  std::map<Vertex, int32_t, VrtComp> mVertMap;
119  std::map<EdgeWithParent, int32_t, EdgeComparator> mEdgeMap;
120  std::vector<uint32_t> mBaseMapping;
121  std::vector<int32_t> mPositionMappedVrt;
122  /* ------------------------------------------------------------ */
123 
124 
128  void prepare(const Mesh* mesh);
129 
130 
131 
132  void triangulatePolygonWithEarClipping(std::vector<uint32_t>& inputPolygon, Vertex* vert, ProjectionDirections dir);
133  void buildPolygonAndTriangulate(std::vector<Edge>& edges, Vertex* vertices, int32_t userData, int32_t materialId, int32_t smoothingGroup);
134  void computePositionedMapping();
135 
136  std::vector<TriangleIndexed> mBaseMeshTriangles;
140  std::vector<Triangle> mBaseMeshResultTriangles;
141  std::vector<Triangle> mBaseMeshUVFittedTriangles;
142 };
143 
144 } // namespace Blast
145 } // namespace Nv
146 
147 
148 #endif // ifndef NVBLASTEXTAUTHORINGTRIANGULATOR_H
ProjectionDirections
Definition: NvBlastExtAuthoringInternalCommon.h:93
+Go to the documentation of this file.
1 // This code contains NVIDIA Confidential Information and is disclosed to you
2 // under a form of NVIDIA software license agreement provided separately to you.
3 //
4 // Notice
5 // NVIDIA Corporation and its licensors retain all intellectual property and
6 // proprietary rights in and to this software and related documentation and
7 // any modifications thereto. Any use, reproduction, disclosure, or
8 // distribution of this software and related documentation without an express
9 // license agreement from NVIDIA Corporation is strictly prohibited.
10 //
11 // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12 // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15 //
16 // Information and code furnished is believed to be accurate and reliable.
17 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18 // information or for any infringement of patents or other rights of third parties that may
19 // result from its use. No license is granted by implication or otherwise under any patent
20 // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21 // This code supersedes and replaces all information previously supplied.
22 // NVIDIA Corporation products are not authorized for use as critical
23 // components in life support devices or systems without express written approval of
24 // NVIDIA Corporation.
25 //
26 // Copyright (c) 2016-2020 NVIDIA Corporation. All rights reserved.
27 
28 
29 #ifndef NVBLASTEXTAUTHORINGTRIANGULATOR_H
30 #define NVBLASTEXTAUTHORINGTRIANGULATOR_H
31 
32 
33 #include <vector>
34 #include <map>
38 
39 namespace Nv
40 {
41 namespace Blast
42 {
43 
44 
49 {
50 public:
55  void triangulate(const Mesh* mesh);
56 
60  std::vector<Triangle>& getBaseMesh()
61  {
62  return mBaseMeshUVFittedTriangles;
63  }
64 
65  std::vector<Triangle>& getBaseMeshNotFitted()
66  {
67  return mBaseMeshResultTriangles;
68  }
69 
70 
74  std::vector<TriangleIndexed>& getBaseMeshIndexed()
75  {
76  return mBaseMeshTriangles;
77  }
81  std::vector<uint32_t>& getBaseMapping()
82  {
83  return mBaseMapping;
84  };
88  std::vector<int32_t>& getPositionedMapping()
89  {
90  return mPositionMappedVrt;
91  };
96  {
97  return static_cast<uint32_t>(mVertices.size());
98  }
99 
103  void reset();
104 
105  int32_t& getParentChunkId() { return parentChunkId; };
106 
107 private:
108 
109  int32_t parentChunkId;
110 
111  int32_t addVerticeIfNotExist(const Vertex& p);
112  void addEdgeIfValid(EdgeWithParent& ed);
113 
114  /* Data used before triangulation to build polygon loops*/
115 
116  std::vector<Vertex> mVertices;
117  std::vector<EdgeWithParent> mBaseMeshEdges;
118  std::map<Vertex, int32_t, VrtComp> mVertMap;
119  std::map<EdgeWithParent, int32_t, EdgeComparator> mEdgeMap;
120  std::vector<uint32_t> mBaseMapping;
121  std::vector<int32_t> mPositionMappedVrt;
122  /* ------------------------------------------------------------ */
123 
124 
128  void prepare(const Mesh* mesh);
129 
130 
131 
132  void triangulatePolygonWithEarClipping(std::vector<uint32_t>& inputPolygon, Vertex* vert, ProjectionDirections dir);
133  void buildPolygonAndTriangulate(std::vector<Edge>& edges, Vertex* vertices, int32_t userData, int32_t materialId, int32_t smoothingGroup);
134  void computePositionedMapping();
135 
136  std::vector<TriangleIndexed> mBaseMeshTriangles;
140  std::vector<Triangle> mBaseMeshResultTriangles;
141  std::vector<Triangle> mBaseMeshUVFittedTriangles;
142 };
143 
144 } // namespace Blast
145 } // namespace Nv
146 
147 
148 #endif // ifndef NVBLASTEXTAUTHORINGTRIANGULATOR_H
ProjectionDirections
Definition: NvBlastExtAuthoringInternalCommon.h:93
std::vector< int32_t > & getPositionedMapping()
Definition: NvBlastExtAuthoringTriangulator.h:88
std::vector< Triangle > & getBaseMeshNotFitted()
Definition: NvBlastExtAuthoringTriangulator.h:65
Definition: NvBlastExtAuthoringInternalCommon.h:48
diff --git a/docs/source_docs/files/_nv_blast_ext_authoring_types_8h_source.html b/docs/source_docs/files/_nv_blast_ext_authoring_types_8h_source.html index aa3181e..412d152 100755 --- a/docs/source_docs/files/_nv_blast_ext_authoring_types_8h_source.html +++ b/docs/source_docs/files/_nv_blast_ext_authoring_types_8h_source.html @@ -46,7 +46,7 @@ $(document).ready(function(){initNavTree('_nv_blast_ext_authoring_types_8h_sourc
NvBlastExtAuthoringTypes.h
-Go to the documentation of this file.
1 // This code contains NVIDIA Confidential Information and is disclosed to you
2 // under a form of NVIDIA software license agreement provided separately to you.
3 //
4 // Notice
5 // NVIDIA Corporation and its licensors retain all intellectual property and
6 // proprietary rights in and to this software and related documentation and
7 // any modifications thereto. Any use, reproduction, disclosure, or
8 // distribution of this software and related documentation without an express
9 // license agreement from NVIDIA Corporation is strictly prohibited.
10 //
11 // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12 // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15 //
16 // Information and code furnished is believed to be accurate and reliable.
17 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18 // information or for any infringement of patents or other rights of third parties that may
19 // result from its use. No license is granted by implication or otherwise under any patent
20 // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21 // This code supersedes and replaces all information previously supplied.
22 // NVIDIA Corporation products are not authorized for use as critical
23 // components in life support devices or systems without express written approval of
24 // NVIDIA Corporation.
25 //
26 // Copyright (c) 2016-2018 NVIDIA Corporation. All rights reserved.
27 
28 
29 #ifndef NVBLASTAUTHORINGTYPES_H
30 #define NVBLASTAUTHORINGTYPES_H
31 
32 #include "NvBlastTypes.h"
33 #include "NvCTypes.h"
34 
35 namespace Nv
36 {
37 namespace Blast
38 {
42 const uint32_t kMaterialInteriorId = 1000;
43 
47 const uint32_t kSmoothingGroupInteriorId = 1000;
48 
53 
57 struct Edge
58 {
59  Edge(uint32_t s = kNotValidVertexIndex, uint32_t e = kNotValidVertexIndex) : s(s), e(e) {}
60  uint32_t s;
61  uint32_t e;
62 };
63 
67 struct Vertex
68 {
69  Vertex() {};
70  Vertex(const NvcVec3& p, const NvcVec3& n, const NvcVec2& _uv) : p(p), n(n) { uv[0] = _uv; }
71  NvcVec3 p; // Position
72  NvcVec3 n; // Normal
73  NvcVec2 uv[1]; // UV-coordinates array, currently supported only one UV coordinate.
74 };
75 
79 struct Triangle
80 {
81  Triangle() {};
82  Triangle(const Vertex& a, const Vertex& b, const Vertex& c, int32_t ud = 0, int32_t mid = 0, int32_t sid = 0)
83  : a(a), b(b), c(c), userData(ud), materialId(mid), smoothingGroup(sid) {}
84  Vertex a, b, c;
85  int32_t userData;
86  int32_t materialId;
87  int32_t smoothingGroup;
88 };
89 
94 {
95  TriangleIndexed(uint32_t ea, uint32_t eb, uint32_t ec, int32_t mid = 0, int32_t sid = 0, int32_t ud = 0)
96  : ea(ea), eb(eb), ec(ec), materialId(mid), smoothingGroup(sid), userData(ud) {}
97  uint32_t ea, eb, ec;
98  int32_t materialId;
99  int32_t smoothingGroup;
100  int32_t userData;
101 };
102 
106 struct Facet
107 {
108  Facet(int32_t fen = 0, uint32_t ec = 0, int64_t ud = 0, int32_t mid = 0, int32_t sid = 0)
109  : firstEdgeNumber(fen), edgesCount(ec), userData(ud), materialId(mid), smoothingGroup(sid) {}
111  uint32_t edgesCount;
112  int64_t userData;
113  int32_t materialId;
114  int32_t smoothingGroup;
115 };
116 
121 {
122  // Polygon base plane
123  float plane[4];
124  // Number vertices in polygon
125  uint16_t vertexCount;
126  // First index in CollisionHull.indices array for this polygon
127  uint16_t indexBase;
128 };
129 
134 {
135  uint32_t pointsCount;
136  uint32_t indicesCount;
139  uint32_t* indices;
141 };
142 
149 {
150  uint32_t chunkCount; // Number of chunks in Blast asset
151 
152  uint32_t bondCount; // Number of bonds in Blast asset
153 
154  NvBlastAsset* asset; // Blast asset
155 
161 
167  uint32_t* geometryOffset;
168 
169  Triangle* geometry; // Raw array of Triangle for all chunks
170 
171  NvBlastChunkDesc* chunkDescs; // Array of chunk descriptors. Contains chunkCount elements
172 
173  NvBlastBondDesc* bondDescs; // Array of bond descriptors. Contains bondCount elements
174 
181 
182  CollisionHull** collisionHull; // Raw array of pointers to collision hull for all chunks.
183 
187  const char** materialNames;
192  uint32_t materialCount;
193 };
194 
196 {
197  uint32_t maximumNumberOfHulls = 8; // Maximum number of convex hull generated for one chunk. If equal to 1 convex
198  // decomposition is disabled.
199  uint32_t maximumNumberOfVerticesPerHull = 64; // Controls the maximum number of triangles per convex-hull
200  // (default=64, range=4-1024)
201  uint32_t voxelGridResolution = 1000000; // Voxel grid resolution used for chunk convex decomposition
202  // (default=1,000,000, range=10,000-16,000,000).
203  float concavity = 0.0025f; // Value between 0 and 1, controls how accurate hull generation is
204 };
205 
206 } // namespace Blast
207 } // namespace Nv
208 
209 
210 #endif // ifndef NVBLASTAUTHORINGTYPES_H
uint32_t indicesCount
Definition: NvBlastExtAuthoringTypes.h:136
+Go to the documentation of this file.
1 // This code contains NVIDIA Confidential Information and is disclosed to you
2 // under a form of NVIDIA software license agreement provided separately to you.
3 //
4 // Notice
5 // NVIDIA Corporation and its licensors retain all intellectual property and
6 // proprietary rights in and to this software and related documentation and
7 // any modifications thereto. Any use, reproduction, disclosure, or
8 // distribution of this software and related documentation without an express
9 // license agreement from NVIDIA Corporation is strictly prohibited.
10 //
11 // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12 // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15 //
16 // Information and code furnished is believed to be accurate and reliable.
17 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18 // information or for any infringement of patents or other rights of third parties that may
19 // result from its use. No license is granted by implication or otherwise under any patent
20 // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21 // This code supersedes and replaces all information previously supplied.
22 // NVIDIA Corporation products are not authorized for use as critical
23 // components in life support devices or systems without express written approval of
24 // NVIDIA Corporation.
25 //
26 // Copyright (c) 2016-2020 NVIDIA Corporation. All rights reserved.
27 
28 
29 #ifndef NVBLASTAUTHORINGTYPES_H
30 #define NVBLASTAUTHORINGTYPES_H
31 
32 #include "NvBlastTypes.h"
33 #include "NvCTypes.h"
34 
35 namespace Nv
36 {
37 namespace Blast
38 {
42 const uint32_t kMaterialInteriorId = 1000;
43 
47 const uint32_t kSmoothingGroupInteriorId = 1000;
48 
53 
57 struct Edge
58 {
59  Edge(uint32_t s = kNotValidVertexIndex, uint32_t e = kNotValidVertexIndex) : s(s), e(e) {}
60  uint32_t s;
61  uint32_t e;
62 };
63 
67 struct Vertex
68 {
69  Vertex() {};
70  Vertex(const NvcVec3& p, const NvcVec3& n, const NvcVec2& _uv) : p(p), n(n) { uv[0] = _uv; }
71  NvcVec3 p; // Position
72  NvcVec3 n; // Normal
73  NvcVec2 uv[1]; // UV-coordinates array, currently supported only one UV coordinate.
74 };
75 
79 struct Triangle
80 {
81  Triangle() {};
82  Triangle(const Vertex& a, const Vertex& b, const Vertex& c, int32_t ud = 0, int32_t mid = 0, int32_t sid = 0)
83  : a(a), b(b), c(c), userData(ud), materialId(mid), smoothingGroup(sid) {}
84  Vertex a, b, c;
85  int32_t userData;
86  int32_t materialId;
87  int32_t smoothingGroup;
88 };
89 
94 {
95  TriangleIndexed(uint32_t ea, uint32_t eb, uint32_t ec, int32_t mid = 0, int32_t sid = 0, int32_t ud = 0)
96  : ea(ea), eb(eb), ec(ec), materialId(mid), smoothingGroup(sid), userData(ud) {}
97  uint32_t ea, eb, ec;
98  int32_t materialId;
99  int32_t smoothingGroup;
100  int32_t userData;
101 };
102 
106 struct Facet
107 {
108  Facet(int32_t fen = 0, uint32_t ec = 0, int64_t ud = 0, int32_t mid = 0, int32_t sid = 0)
109  : firstEdgeNumber(fen), edgesCount(ec), userData(ud), materialId(mid), smoothingGroup(sid) {}
111  uint32_t edgesCount;
112  int64_t userData;
113  int32_t materialId;
114  int32_t smoothingGroup;
115 };
116 
121 {
122  // Polygon base plane
123  float plane[4];
124  // Number vertices in polygon
125  uint16_t vertexCount;
126  // First index in CollisionHull.indices array for this polygon
127  uint16_t indexBase;
128 };
129 
134 {
135  uint32_t pointsCount;
136  uint32_t indicesCount;
139  uint32_t* indices;
141 };
142 
149 {
150  uint32_t chunkCount; // Number of chunks in Blast asset
151 
152  uint32_t bondCount; // Number of bonds in Blast asset
153 
154  NvBlastAsset* asset; // Blast asset
155 
161 
167  uint32_t* geometryOffset;
168 
169  Triangle* geometry; // Raw array of Triangle for all chunks
170 
171  NvBlastChunkDesc* chunkDescs; // Array of chunk descriptors. Contains chunkCount elements
172 
173  NvBlastBondDesc* bondDescs; // Array of bond descriptors. Contains bondCount elements
174 
181 
182  CollisionHull** collisionHull; // Raw array of pointers to collision hull for all chunks.
183 
187  const char** materialNames;
192  uint32_t materialCount;
193 };
194 
196 {
197  uint32_t maximumNumberOfHulls = 8; // Maximum number of convex hull generated for one chunk. If equal to 1 convex
198  // decomposition is disabled.
199  uint32_t maximumNumberOfVerticesPerHull = 64; // Controls the maximum number of triangles per convex-hull
200  // (default=64, range=4-1024)
201  uint32_t voxelGridResolution = 1000000; // Voxel grid resolution used for chunk convex decomposition
202  // (default=1,000,000, range=10,000-16,000,000).
203  float concavity = 0.0025f; // Value between 0 and 1, controls how accurate hull generation is
204 };
205 
206 } // namespace Blast
207 } // namespace Nv
208 
209 
210 #endif // ifndef NVBLASTAUTHORINGTYPES_H
uint32_t indicesCount
Definition: NvBlastExtAuthoringTypes.h:136
#define UINT32_MAX
Definition: NvBlastPreprocessorInternal.h:68
uint32_t e
Definition: NvBlastExtAuthoringTypes.h:61
NvBlastBondDesc * bondDescs
Definition: NvBlastExtAuthoringTypes.h:173
diff --git a/docs/source_docs/files/_nv_blast_ext_authoring_v_s_a_8h_source.html b/docs/source_docs/files/_nv_blast_ext_authoring_v_s_a_8h_source.html index f8da78e..a29eb1a 100755 --- a/docs/source_docs/files/_nv_blast_ext_authoring_v_s_a_8h_source.html +++ b/docs/source_docs/files/_nv_blast_ext_authoring_v_s_a_8h_source.html @@ -46,7 +46,7 @@ $(document).ready(function(){initNavTree('_nv_blast_ext_authoring_v_s_a_8h_sourc
NvBlastExtAuthoringVSA.h
-Go to the documentation of this file.
1 // This code contains NVIDIA Confidential Information and is disclosed to you
2 // under a form of NVIDIA software license agreement provided separately to you.
3 //
4 // Notice
5 // NVIDIA Corporation and its licensors retain all intellectual property and
6 // proprietary rights in and to this software and related documentation and
7 // any modifications thereto. Any use, reproduction, disclosure, or
8 // distribution of this software and related documentation without an express
9 // license agreement from NVIDIA Corporation is strictly prohibited.
10 //
11 // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12 // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15 //
16 // Information and code furnished is believed to be accurate and reliable.
17 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18 // information or for any infringement of patents or other rights of third parties that may
19 // result from its use. No license is granted by implication or otherwise under any patent
20 // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21 // This code supersedes and replaces all information previously supplied.
22 // NVIDIA Corporation products are not authorized for use as critical
23 // components in life support devices or systems without express written approval of
24 // NVIDIA Corporation.
25 //
26 // Copyright (c) 2016-2018 NVIDIA Corporation. All rights reserved.
27 
28 
29 #ifndef NVBLASTEXTAUTHORINGVSA_H
30 #define NVBLASTEXTAUTHORINGVSA_H
31 
32 namespace Nv
33 {
34 namespace Blast
35 {
36 
37 /*
38  This code copied from APEX GSA
39 */
40 
41 namespace VSA
42 {
43 typedef float real;
44 
46 {
47  virtual real farthest_halfspace(real plane[4], const real point[4]) = 0;
48 };
49 
50 
51 // Simple types and operations for internal calculations
52 struct Vec3 { real x, y, z; }; // 3-vector
53 inline Vec3 vec3(real x, real y, real z) { Vec3 r; r.x = x; r.y = y; r.z = z; return r; } // vector builder
54 inline Vec3 operator + (const Vec3& a, const Vec3& b) { return vec3(a.x + b.x, a.y + b.y, a.z + b.z); } // vector addition
55 inline Vec3 operator * (real s, const Vec3& v) { return vec3(s*v.x, s*v.y, s*v.z); } // scalar multiplication
56 inline real operator | (const Vec3& a, const Vec3& b) { return a.x*b.x + a.y*b.y + a.z*b.z; } // dot product
57 inline Vec3 operator ^ (const Vec3& a, const Vec3& b) { return vec3(a.y*b.z - b.y*a.z, a.z*b.x - b.z*a.x, a.x*b.y - b.x*a.y); } // cross product
58 
59 struct Vec4 { Vec3 v; real w; }; // 4-vector split into 3-vector and scalar parts
60 inline Vec4 vec4(const Vec3& v, real w) { Vec4 r; r.v = v; r.w = w; return r; } // vector builder
61 inline real operator | (const Vec4& a, const Vec4& b) { return (a.v | b.v) + a.w*b.w; } // dot product
62 
63 // More accurate perpendicular
64 inline Vec3 perp(const Vec3& a, const Vec3& b)
65 {
66  Vec3 c = a^b; // Cross-product gives perpendicular
67 #if VS3D_HIGH_ACCURACY || REAL_DOUBLE
68  const real c2 = c | c;
69  if (c2 != 0) c = c + (1 / c2)*((a | c)*(c^b) + (b | c)*(a^c)); // Improvement to (a b)^T(c) = (0)
70 #endif
71  return c;
72 }
73 
74 // Square
75 inline real sq(real x) { return x*x; }
76 
77 // Returns index of the extremal element in a three-element set {e0, e1, e2} based upon comparisons c_ij. The extremal index m is such that c_mn is true, or e_m == e_n, for all n.
78 inline int ext_index(int c_10, int c_21, int c_20) { return c_10 << c_21 | (c_21&c_20) << 1; }
79 
80 // Returns index (0, 1, or 2) of minimum argument
81 inline int index_of_min(real x0, real x1, real x2) { return ext_index((int)(x1 < x0), (int)(x2 < x1), (int)(x2 < x0)); }
82 
83 // Compare fractions with positive deominators. Returns a_num*sqrt(a_rden2) > b_num*sqrt(b_rden2)
84 inline bool frac_gt(real a_num, real a_rden2, real b_num, real b_rden2)
85 {
86  const bool a_num_neg = a_num < 0;
87  const bool b_num_neg = b_num < 0;
88  return a_num_neg != b_num_neg ? b_num_neg : ((a_num*a_num*a_rden2 > b_num*b_num*b_rden2) != a_num_neg);
89 }
90 
91 // Returns index (0, 1, or 2) of maximum fraction with positive deominators
92 inline int index_of_max_frac(real x0_num, real x0_rden2, real x1_num, real x1_rden2, real x2_num, real x2_rden2)
93 {
94  return ext_index((int)frac_gt(x1_num, x1_rden2, x0_num, x0_rden2), (int)frac_gt(x2_num, x2_rden2, x1_num, x1_rden2), (int)frac_gt(x2_num, x2_rden2, x0_num, x0_rden2));
95 }
96 
97 // Compare values given their signs and squares. Returns a > b. a2 and b2 may have any constant offset applied to them.
98 inline bool sgn_sq_gt(real sgn_a, real a2, real sgn_b, real b2) { return sgn_a*sgn_b < 0 ? (sgn_b < 0) : ((a2 > b2) != (sgn_a < 0)); }
99 
100 // Returns index (0, 1, or 2) of maximum value given their signs and squares. sq_x0, sq_x1, and sq_x2 may have any constant offset applied to them.
101 inline int index_of_max_sgn_sq(real sgn_x0, real sq_x0, real sgn_x1, real sq_x1, real sgn_x2, real sq_x2)
102 {
103  return ext_index((int)sgn_sq_gt(sgn_x1, sq_x1, sgn_x0, sq_x0), (int)sgn_sq_gt(sgn_x2, sq_x2, sgn_x1, sq_x1), (int)sgn_sq_gt(sgn_x2, sq_x2, sgn_x0, sq_x0));
104 }
105 
106 // Project 2D (homogeneous) vector onto 2D half-space boundary
107 inline void project2D(Vec3& r, const Vec3& plane, real delta, real recip_n2, real eps2)
108 {
109  r = r + (-delta*recip_n2)*vec3(plane.x, plane.y, 0);
110  r = r + (-(r | plane)*recip_n2)*vec3(plane.x, plane.y, 0); // Second projection for increased accuracy
111  if ((r | r) > eps2) return;
112  r = (-plane.z*recip_n2)*vec3(plane.x, plane.y, 0);
113  r.z = 1;
114 }
115 
116 
117 // Update function for vs3d_test
118 static bool vs3d_update(Vec4& p, Vec4 S[4], int& plane_count, const Vec4& q, real eps2)
119 {
120  // h plane is the last plane
121  const Vec4& h = S[plane_count - 1];
122 
123  // Handle plane_count == 1 specially (optimization; this could be commented out)
124  if (plane_count == 1)
125  {
126  // Solution is objective projected onto h plane
127  p = q;
128  p.v = p.v + -(p | h)*h.v;
129  if ((p | p) <= eps2) p = vec4(-h.w*h.v, 1); // If p == 0 then q is a direction vector, any point in h is a support point
130  return true;
131  }
132 
133  // Create basis in the h plane
134  const int min_i = index_of_min(h.v.x*h.v.x, h.v.y*h.v.y, h.v.z*h.v.z);
135  const Vec3 y = h.v^vec3((real)(min_i == 0), (real)(min_i == 1), (real)(min_i == 2));
136  const Vec3 x = y^h.v;
137 
138  // Use reduced vector r instead of p
139  Vec3 r = { x | q.v, y | q.v, q.w*(y | y) }; // (x|x) = (y|y) = square of plane basis scale
140 
141  // If r == 0 (within epsilon), then it is a direction vector, and we have a bounded solution
142  if ((r | r) <= eps2) r.z = 1;
143 
144  // Create plane equations in the h plane. These will not be normalized in general.
145  int N = 0; // Plane count in h subspace
146  Vec3 R[3]; // Planes in h subspace
147  real recip_n2[3]; // Plane normal vector reciprocal lengths squared
148  real delta[3]; // Signed distance of objective to the planes
149  int index[3]; // Keep track of original plane indices
150  for (int i = 0; i < plane_count - 1; ++i)
151  {
152  const Vec3& vi = S[i].v;
153  const real cos_theta = h.v | vi;
154  R[N] = vec3(x | vi, y | vi, S[i].w - h.w*cos_theta);
155  index[N] = i;
156  const real n2 = R[N].x*R[N].x + R[N].y*R[N].y;
157  if (n2 >= eps2)
158  {
159  const real lin_norm = (real)1.5 - (real)0.5*n2; // 1st-order approximation to 1/sqrt(n2) expanded about n2 = 1
160  R[N] = lin_norm*R[N]; // We don't need normalized plane equations, but rescaling (even with an approximate normalization) gives better numerical behavior
161  recip_n2[N] = 1 / (R[N].x*R[N].x + R[N].y*R[N].y);
162  delta[N] = r | R[N];
163  ++N; // Keep this plane
164  }
165  else if (cos_theta < 0) return false; // Parallel cases are redundant and rejected, anti-parallel cases are 1D voids
166  }
167 
168  // Now work with the N-sized R array of half-spaces in the h plane
169  switch (N)
170  {
171  case 1: one_plane :
172  if (delta[0] < 0) N = 0; // S[0] is redundant, eliminate it
173  else project2D(r, R[0], delta[0], recip_n2[0], eps2);
174  break;
175  case 2: two_planes :
176  if (delta[0] < 0 && delta[1] < 0) N = 0; // S[0] and S[1] are redundant, eliminate them
177  else
178  {
179  const int max_d_index = (int)frac_gt(delta[1], recip_n2[1], delta[0], recip_n2[0]);
180  project2D(r, R[max_d_index], delta[max_d_index], recip_n2[max_d_index], eps2);
181  const int min_d_index = max_d_index ^ 1;
182  const real new_delta_min = r | R[min_d_index];
183  if (new_delta_min < 0)
184  {
185  index[0] = index[max_d_index];
186  N = 1; // S[min_d_index] is redundant, eliminate it
187  }
188  else
189  {
190  // Set r to the intersection of R[0] and R[1] and keep both
191  r = perp(R[0], R[1]);
192  if (r.z*r.z*recip_n2[0] * recip_n2[1] < eps2)
193  {
194  if (R[0].x*R[1].x + R[0].y*R[1].y < 0) return false; // 2D void found
195  goto one_plane;
196  }
197  r = (1 / r.z)*r; // We could just as well multiply r by sgn(r.z); we just need to ensure r.z > 0
198  }
199  }
200  break;
201  case 3:
202  if (delta[0] < 0 && delta[1] < 0 && delta[2] < 0) N = 0; // S[0], S[1], and S[2] are redundant, eliminate them
203  else
204  {
205  const Vec3 row_x = { R[0].x, R[1].x, R[2].x };
206  const Vec3 row_y = { R[0].y, R[1].y, R[2].y };
207  const Vec3 row_w = { R[0].z, R[1].z, R[2].z };
208  const Vec3 cof_w = perp(row_x, row_y);
209  const bool detR_pos = (row_w | cof_w) > 0;
210  const int nrw_sgn0 = cof_w.x*cof_w.x*recip_n2[1] * recip_n2[2] < eps2 ? 0 : (((int)((cof_w.x > 0) == detR_pos) << 1) - 1);
211  const int nrw_sgn1 = cof_w.y*cof_w.y*recip_n2[2] * recip_n2[0] < eps2 ? 0 : (((int)((cof_w.y > 0) == detR_pos) << 1) - 1);
212  const int nrw_sgn2 = cof_w.z*cof_w.z*recip_n2[0] * recip_n2[1] < eps2 ? 0 : (((int)((cof_w.z > 0) == detR_pos) << 1) - 1);
213 
214  if ((nrw_sgn0 | nrw_sgn1 | nrw_sgn2) >= 0) return false; // 3D void found
215 
216  const int positive_width_count = ((nrw_sgn0 >> 1) & 1) + ((nrw_sgn1 >> 1) & 1) + ((nrw_sgn2 >> 1) & 1);
217  if (positive_width_count == 1)
218  {
219  // A single positive width results from a redundant plane. Eliminate it and peform N = 2 calculation.
220  const int pos_width_index = ((nrw_sgn1 >> 1) & 1) | (nrw_sgn2 & 2); // Calculates which index corresponds to the positive-width side
221  R[pos_width_index] = R[2];
222  recip_n2[pos_width_index] = recip_n2[2];
223  delta[pos_width_index] = delta[2];
224  index[pos_width_index] = index[2];
225  N = 2;
226  goto two_planes;
227  }
228 
229  // Find the max dot product of r and R[i]/|R_normal[i]|. For numerical accuracy when the angle between r and the i^{th} plane normal is small, we take some care below:
230  const int max_d_index = r.z != 0
231  ? index_of_max_frac(delta[0], recip_n2[0], delta[1], recip_n2[1], delta[2], recip_n2[2]) // displacement term resolves small-angle ambiguity, just use dot product
232  : index_of_max_sgn_sq(delta[0], -sq(r.x*R[0].y - r.y*R[0].x)*recip_n2[0], delta[1], -sq(r.x*R[1].y - r.y*R[1].x)*recip_n2[1], delta[2], -sq(r.x*R[2].y - r.y*R[2].x)*recip_n2[2]); // No displacement term. Use wedge product to find the sine of the angle.
233 
234  // Project r onto max-d plane
235  project2D(r, R[max_d_index], delta[max_d_index], recip_n2[max_d_index], eps2);
236  N = 1; // Unless we use a vertex in the loop below
237  const int index_max = index[max_d_index];
238 
239  // The number of finite widths should be >= 2. If not, it should be 0, but in any case it implies three parallel lines in the plane, which we should not have here.
240  // If we do have three parallel lines (# of finite widths < 2), we've picked the line corresponding to the half-plane farthest from r, which is correct.
241  const int finite_width_count = (nrw_sgn0 & 1) + (nrw_sgn1 & 1) + (nrw_sgn2 & 1);
242  if (finite_width_count >= 2)
243  {
244  const int i_remaining[2] = { (1 << max_d_index) & 3, (3 >> max_d_index) ^ 1 }; // = {(max_d_index+1)%3, (max_d_index+2)%3}
245  const int i_select = (int)frac_gt(delta[i_remaining[1]], recip_n2[i_remaining[1]], delta[i_remaining[0]], recip_n2[i_remaining[0]]); // Select the greater of the remaining dot products
246  for (int i = 0; i < 2; ++i)
247  {
248  const int j = i_remaining[i_select^i]; // i = 0 => the next-greatest, i = 1 => the least
249  if ((r | R[j]) >= 0)
250  {
251  r = perp(R[max_d_index], R[j]);
252  r = (1 / r.z)*r; // We could just as well multiply r by sgn(r.z); we just need to ensure r.z > 0
253  index[1] = index[j];
254  N = 2;
255  break;
256  }
257  }
258  }
259 
260  index[0] = index_max;
261  }
262  break;
263  }
264 
265  // Transform r back to 3D space
266  p = vec4(r.x*x + r.y*y + (-r.z*h.w)*h.v, r.z);
267 
268  // Pack S array with kept planes
269  if (N < 2 || index[1] != 0) { for (int i = 0; i < N; ++i) S[i] = S[index[i]]; } // Safe to copy columns in order
270  else { const Vec4 temp = S[0]; S[0] = S[index[0]]; S[1] = temp; } // Otherwise use temp storage to avoid overwrite
271  S[N] = h;
272  plane_count = N + 1;
273 
274  return true;
275 }
276 
277 
278 // Performs the VS algorithm for D = 3
279 inline int vs3d_test(VS3D_Halfspace_Set& halfspace_set, real* q = nullptr)
280 {
281  // Objective = q if it is not NULL, otherwise it is the origin represented in homogeneous coordinates
282  const Vec4 objective = q ? (q[3] != 0 ? vec4((1 / q[3])*vec3(q[0], q[1], q[2]), 1) : *(Vec4*)q) : vec4(vec3(0, 0, 0), 1);
283 
284  // Tolerance for 3D void simplex algorithm
285  const real eps_f = (real)1 / (sizeof(real) == 4 ? (1L << 23) : (1LL << 52)); // Floating-point epsilon
286 #if VS3D_HIGH_ACCURACY || REAL_DOUBLE
287  const real eps = 8 * eps_f;
288 #else
289  const real eps = 80 * eps_f;
290 #endif
291  const real eps2 = eps*eps; // Using epsilon squared
292 
293  // Maximum allowed iterations of main loop. If exceeded, error code is returned
294  const int max_iteration_count = 50;
295 
296  // State
297  Vec4 S[4]; // Up to 4 planes
298  int plane_count = 0; // Number of valid planes
299  Vec4 p = objective; // Test point, initialized to objective
300 
301  // Default result, changed to valid result if found in loop below
302  int result = -1;
303 
304  // Iterate until a stopping condition is met or the maximum number of iterations is reached
305  for (int i = 0; result < 0 && i < max_iteration_count; ++i)
306  {
307  Vec4& plane = S[plane_count++];
308  real delta = halfspace_set.farthest_halfspace(&plane.v.x, &p.v.x);
309 #if VS3D_UNNORMALIZED_PLANE_HANDLING != 0
310  const real recip_norm = vs3d_recip_sqrt(plane.v | plane.v);
311  plane = vec4(recip_norm*plane.v, recip_norm*plane.w);
312  delta *= recip_norm;
313 #endif
314  if (delta <= 0 || delta*delta <= eps2*(p | p)) result = 1; // Intersection found
315  else if (!vs3d_update(p, S, plane_count, objective, eps2)) result = 0; // Void simplex found
316  }
317 
318  // If q is given, fill it with the solution (normalize p.w if it is not zero)
319  if (q) *(Vec4*)q = (p.w != 0) ? vec4((1 / p.w)*p.v, 1) : p;
320 
321  return result;
322 }
323 
324 } // namespace VSA
325 
326 } // namespace Blast
327 } // namespace Nv
328 
329 
330 #endif // ifndef NVBLASTEXTAUTHORINGVSA_H
Definition: NvBlastExtAuthoringVSA.h:45
+Go to the documentation of this file.
1 // This code contains NVIDIA Confidential Information and is disclosed to you
2 // under a form of NVIDIA software license agreement provided separately to you.
3 //
4 // Notice
5 // NVIDIA Corporation and its licensors retain all intellectual property and
6 // proprietary rights in and to this software and related documentation and
7 // any modifications thereto. Any use, reproduction, disclosure, or
8 // distribution of this software and related documentation without an express
9 // license agreement from NVIDIA Corporation is strictly prohibited.
10 //
11 // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12 // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15 //
16 // Information and code furnished is believed to be accurate and reliable.
17 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18 // information or for any infringement of patents or other rights of third parties that may
19 // result from its use. No license is granted by implication or otherwise under any patent
20 // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21 // This code supersedes and replaces all information previously supplied.
22 // NVIDIA Corporation products are not authorized for use as critical
23 // components in life support devices or systems without express written approval of
24 // NVIDIA Corporation.
25 //
26 // Copyright (c) 2016-2020 NVIDIA Corporation. All rights reserved.
27 
28 
29 #ifndef NVBLASTEXTAUTHORINGVSA_H
30 #define NVBLASTEXTAUTHORINGVSA_H
31 
32 namespace Nv
33 {
34 namespace Blast
35 {
36 
37 /*
38  This code copied from APEX GSA
39 */
40 
41 namespace VSA
42 {
43 typedef float real;
44 
46 {
47  virtual real farthest_halfspace(real plane[4], const real point[4]) = 0;
48 };
49 
50 
51 // Simple types and operations for internal calculations
52 struct Vec3 { real x, y, z; }; // 3-vector
53 inline Vec3 vec3(real x, real y, real z) { Vec3 r; r.x = x; r.y = y; r.z = z; return r; } // vector builder
54 inline Vec3 operator + (const Vec3& a, const Vec3& b) { return vec3(a.x + b.x, a.y + b.y, a.z + b.z); } // vector addition
55 inline Vec3 operator * (real s, const Vec3& v) { return vec3(s*v.x, s*v.y, s*v.z); } // scalar multiplication
56 inline real operator | (const Vec3& a, const Vec3& b) { return a.x*b.x + a.y*b.y + a.z*b.z; } // dot product
57 inline Vec3 operator ^ (const Vec3& a, const Vec3& b) { return vec3(a.y*b.z - b.y*a.z, a.z*b.x - b.z*a.x, a.x*b.y - b.x*a.y); } // cross product
58 
59 struct Vec4 { Vec3 v; real w; }; // 4-vector split into 3-vector and scalar parts
60 inline Vec4 vec4(const Vec3& v, real w) { Vec4 r; r.v = v; r.w = w; return r; } // vector builder
61 inline real operator | (const Vec4& a, const Vec4& b) { return (a.v | b.v) + a.w*b.w; } // dot product
62 
63 // More accurate perpendicular
64 inline Vec3 perp(const Vec3& a, const Vec3& b)
65 {
66  Vec3 c = a^b; // Cross-product gives perpendicular
67 #if VS3D_HIGH_ACCURACY || REAL_DOUBLE
68  const real c2 = c | c;
69  if (c2 != 0) c = c + (1 / c2)*((a | c)*(c^b) + (b | c)*(a^c)); // Improvement to (a b)^T(c) = (0)
70 #endif
71  return c;
72 }
73 
74 // Square
75 inline real sq(real x) { return x*x; }
76 
77 // Returns index of the extremal element in a three-element set {e0, e1, e2} based upon comparisons c_ij. The extremal index m is such that c_mn is true, or e_m == e_n, for all n.
78 inline int ext_index(int c_10, int c_21, int c_20) { return c_10 << c_21 | (c_21&c_20) << 1; }
79 
80 // Returns index (0, 1, or 2) of minimum argument
81 inline int index_of_min(real x0, real x1, real x2) { return ext_index((int)(x1 < x0), (int)(x2 < x1), (int)(x2 < x0)); }
82 
83 // Compare fractions with positive deominators. Returns a_num*sqrt(a_rden2) > b_num*sqrt(b_rden2)
84 inline bool frac_gt(real a_num, real a_rden2, real b_num, real b_rden2)
85 {
86  const bool a_num_neg = a_num < 0;
87  const bool b_num_neg = b_num < 0;
88  return a_num_neg != b_num_neg ? b_num_neg : ((a_num*a_num*a_rden2 > b_num*b_num*b_rden2) != a_num_neg);
89 }
90 
91 // Returns index (0, 1, or 2) of maximum fraction with positive deominators
92 inline int index_of_max_frac(real x0_num, real x0_rden2, real x1_num, real x1_rden2, real x2_num, real x2_rden2)
93 {
94  return ext_index((int)frac_gt(x1_num, x1_rden2, x0_num, x0_rden2), (int)frac_gt(x2_num, x2_rden2, x1_num, x1_rden2), (int)frac_gt(x2_num, x2_rden2, x0_num, x0_rden2));
95 }
96 
97 // Compare values given their signs and squares. Returns a > b. a2 and b2 may have any constant offset applied to them.
98 inline bool sgn_sq_gt(real sgn_a, real a2, real sgn_b, real b2) { return sgn_a*sgn_b < 0 ? (sgn_b < 0) : ((a2 > b2) != (sgn_a < 0)); }
99 
100 // Returns index (0, 1, or 2) of maximum value given their signs and squares. sq_x0, sq_x1, and sq_x2 may have any constant offset applied to them.
101 inline int index_of_max_sgn_sq(real sgn_x0, real sq_x0, real sgn_x1, real sq_x1, real sgn_x2, real sq_x2)
102 {
103  return ext_index((int)sgn_sq_gt(sgn_x1, sq_x1, sgn_x0, sq_x0), (int)sgn_sq_gt(sgn_x2, sq_x2, sgn_x1, sq_x1), (int)sgn_sq_gt(sgn_x2, sq_x2, sgn_x0, sq_x0));
104 }
105 
106 // Project 2D (homogeneous) vector onto 2D half-space boundary
107 inline void project2D(Vec3& r, const Vec3& plane, real delta, real recip_n2, real eps2)
108 {
109  r = r + (-delta*recip_n2)*vec3(plane.x, plane.y, 0);
110  r = r + (-(r | plane)*recip_n2)*vec3(plane.x, plane.y, 0); // Second projection for increased accuracy
111  if ((r | r) > eps2) return;
112  r = (-plane.z*recip_n2)*vec3(plane.x, plane.y, 0);
113  r.z = 1;
114 }
115 
116 
117 // Update function for vs3d_test
118 static bool vs3d_update(Vec4& p, Vec4 S[4], int& plane_count, const Vec4& q, real eps2)
119 {
120  // h plane is the last plane
121  const Vec4& h = S[plane_count - 1];
122 
123  // Handle plane_count == 1 specially (optimization; this could be commented out)
124  if (plane_count == 1)
125  {
126  // Solution is objective projected onto h plane
127  p = q;
128  p.v = p.v + -(p | h)*h.v;
129  if ((p | p) <= eps2) p = vec4(-h.w*h.v, 1); // If p == 0 then q is a direction vector, any point in h is a support point
130  return true;
131  }
132 
133  // Create basis in the h plane
134  const int min_i = index_of_min(h.v.x*h.v.x, h.v.y*h.v.y, h.v.z*h.v.z);
135  const Vec3 y = h.v^vec3((real)(min_i == 0), (real)(min_i == 1), (real)(min_i == 2));
136  const Vec3 x = y^h.v;
137 
138  // Use reduced vector r instead of p
139  Vec3 r = { x | q.v, y | q.v, q.w*(y | y) }; // (x|x) = (y|y) = square of plane basis scale
140 
141  // If r == 0 (within epsilon), then it is a direction vector, and we have a bounded solution
142  if ((r | r) <= eps2) r.z = 1;
143 
144  // Create plane equations in the h plane. These will not be normalized in general.
145  int N = 0; // Plane count in h subspace
146  Vec3 R[3]; // Planes in h subspace
147  real recip_n2[3]; // Plane normal vector reciprocal lengths squared
148  real delta[3]; // Signed distance of objective to the planes
149  int index[3]; // Keep track of original plane indices
150  for (int i = 0; i < plane_count - 1; ++i)
151  {
152  const Vec3& vi = S[i].v;
153  const real cos_theta = h.v | vi;
154  R[N] = vec3(x | vi, y | vi, S[i].w - h.w*cos_theta);
155  index[N] = i;
156  const real n2 = R[N].x*R[N].x + R[N].y*R[N].y;
157  if (n2 >= eps2)
158  {
159  const real lin_norm = (real)1.5 - (real)0.5*n2; // 1st-order approximation to 1/sqrt(n2) expanded about n2 = 1
160  R[N] = lin_norm*R[N]; // We don't need normalized plane equations, but rescaling (even with an approximate normalization) gives better numerical behavior
161  recip_n2[N] = 1 / (R[N].x*R[N].x + R[N].y*R[N].y);
162  delta[N] = r | R[N];
163  ++N; // Keep this plane
164  }
165  else if (cos_theta < 0) return false; // Parallel cases are redundant and rejected, anti-parallel cases are 1D voids
166  }
167 
168  // Now work with the N-sized R array of half-spaces in the h plane
169  switch (N)
170  {
171  case 1: one_plane :
172  if (delta[0] < 0) N = 0; // S[0] is redundant, eliminate it
173  else project2D(r, R[0], delta[0], recip_n2[0], eps2);
174  break;
175  case 2: two_planes :
176  if (delta[0] < 0 && delta[1] < 0) N = 0; // S[0] and S[1] are redundant, eliminate them
177  else
178  {
179  const int max_d_index = (int)frac_gt(delta[1], recip_n2[1], delta[0], recip_n2[0]);
180  project2D(r, R[max_d_index], delta[max_d_index], recip_n2[max_d_index], eps2);
181  const int min_d_index = max_d_index ^ 1;
182  const real new_delta_min = r | R[min_d_index];
183  if (new_delta_min < 0)
184  {
185  index[0] = index[max_d_index];
186  N = 1; // S[min_d_index] is redundant, eliminate it
187  }
188  else
189  {
190  // Set r to the intersection of R[0] and R[1] and keep both
191  r = perp(R[0], R[1]);
192  if (r.z*r.z*recip_n2[0] * recip_n2[1] < eps2)
193  {
194  if (R[0].x*R[1].x + R[0].y*R[1].y < 0) return false; // 2D void found
195  goto one_plane;
196  }
197  r = (1 / r.z)*r; // We could just as well multiply r by sgn(r.z); we just need to ensure r.z > 0
198  }
199  }
200  break;
201  case 3:
202  if (delta[0] < 0 && delta[1] < 0 && delta[2] < 0) N = 0; // S[0], S[1], and S[2] are redundant, eliminate them
203  else
204  {
205  const Vec3 row_x = { R[0].x, R[1].x, R[2].x };
206  const Vec3 row_y = { R[0].y, R[1].y, R[2].y };
207  const Vec3 row_w = { R[0].z, R[1].z, R[2].z };
208  const Vec3 cof_w = perp(row_x, row_y);
209  const bool detR_pos = (row_w | cof_w) > 0;
210  const int nrw_sgn0 = cof_w.x*cof_w.x*recip_n2[1] * recip_n2[2] < eps2 ? 0 : (((int)((cof_w.x > 0) == detR_pos) << 1) - 1);
211  const int nrw_sgn1 = cof_w.y*cof_w.y*recip_n2[2] * recip_n2[0] < eps2 ? 0 : (((int)((cof_w.y > 0) == detR_pos) << 1) - 1);
212  const int nrw_sgn2 = cof_w.z*cof_w.z*recip_n2[0] * recip_n2[1] < eps2 ? 0 : (((int)((cof_w.z > 0) == detR_pos) << 1) - 1);
213 
214  if ((nrw_sgn0 | nrw_sgn1 | nrw_sgn2) >= 0) return false; // 3D void found
215 
216  const int positive_width_count = ((nrw_sgn0 >> 1) & 1) + ((nrw_sgn1 >> 1) & 1) + ((nrw_sgn2 >> 1) & 1);
217  if (positive_width_count == 1)
218  {
219  // A single positive width results from a redundant plane. Eliminate it and peform N = 2 calculation.
220  const int pos_width_index = ((nrw_sgn1 >> 1) & 1) | (nrw_sgn2 & 2); // Calculates which index corresponds to the positive-width side
221  R[pos_width_index] = R[2];
222  recip_n2[pos_width_index] = recip_n2[2];
223  delta[pos_width_index] = delta[2];
224  index[pos_width_index] = index[2];
225  N = 2;
226  goto two_planes;
227  }
228 
229  // Find the max dot product of r and R[i]/|R_normal[i]|. For numerical accuracy when the angle between r and the i^{th} plane normal is small, we take some care below:
230  const int max_d_index = r.z != 0
231  ? index_of_max_frac(delta[0], recip_n2[0], delta[1], recip_n2[1], delta[2], recip_n2[2]) // displacement term resolves small-angle ambiguity, just use dot product
232  : index_of_max_sgn_sq(delta[0], -sq(r.x*R[0].y - r.y*R[0].x)*recip_n2[0], delta[1], -sq(r.x*R[1].y - r.y*R[1].x)*recip_n2[1], delta[2], -sq(r.x*R[2].y - r.y*R[2].x)*recip_n2[2]); // No displacement term. Use wedge product to find the sine of the angle.
233 
234  // Project r onto max-d plane
235  project2D(r, R[max_d_index], delta[max_d_index], recip_n2[max_d_index], eps2);
236  N = 1; // Unless we use a vertex in the loop below
237  const int index_max = index[max_d_index];
238 
239  // The number of finite widths should be >= 2. If not, it should be 0, but in any case it implies three parallel lines in the plane, which we should not have here.
240  // If we do have three parallel lines (# of finite widths < 2), we've picked the line corresponding to the half-plane farthest from r, which is correct.
241  const int finite_width_count = (nrw_sgn0 & 1) + (nrw_sgn1 & 1) + (nrw_sgn2 & 1);
242  if (finite_width_count >= 2)
243  {
244  const int i_remaining[2] = { (1 << max_d_index) & 3, (3 >> max_d_index) ^ 1 }; // = {(max_d_index+1)%3, (max_d_index+2)%3}
245  const int i_select = (int)frac_gt(delta[i_remaining[1]], recip_n2[i_remaining[1]], delta[i_remaining[0]], recip_n2[i_remaining[0]]); // Select the greater of the remaining dot products
246  for (int i = 0; i < 2; ++i)
247  {
248  const int j = i_remaining[i_select^i]; // i = 0 => the next-greatest, i = 1 => the least
249  if ((r | R[j]) >= 0)
250  {
251  r = perp(R[max_d_index], R[j]);
252  r = (1 / r.z)*r; // We could just as well multiply r by sgn(r.z); we just need to ensure r.z > 0
253  index[1] = index[j];
254  N = 2;
255  break;
256  }
257  }
258  }
259 
260  index[0] = index_max;
261  }
262  break;
263  }
264 
265  // Transform r back to 3D space
266  p = vec4(r.x*x + r.y*y + (-r.z*h.w)*h.v, r.z);
267 
268  // Pack S array with kept planes
269  if (N < 2 || index[1] != 0) { for (int i = 0; i < N; ++i) S[i] = S[index[i]]; } // Safe to copy columns in order
270  else { const Vec4 temp = S[0]; S[0] = S[index[0]]; S[1] = temp; } // Otherwise use temp storage to avoid overwrite
271  S[N] = h;
272  plane_count = N + 1;
273 
274  return true;
275 }
276 
277 
278 // Performs the VS algorithm for D = 3
279 inline int vs3d_test(VS3D_Halfspace_Set& halfspace_set, real* q = nullptr)
280 {
281  // Objective = q if it is not NULL, otherwise it is the origin represented in homogeneous coordinates
282  const Vec4 objective = q ? (q[3] != 0 ? vec4((1 / q[3])*vec3(q[0], q[1], q[2]), 1) : *(Vec4*)q) : vec4(vec3(0, 0, 0), 1);
283 
284  // Tolerance for 3D void simplex algorithm
285  const real eps_f = (real)1 / (sizeof(real) == 4 ? (1L << 23) : (1LL << 52)); // Floating-point epsilon
286 #if VS3D_HIGH_ACCURACY || REAL_DOUBLE
287  const real eps = 8 * eps_f;
288 #else
289  const real eps = 80 * eps_f;
290 #endif
291  const real eps2 = eps*eps; // Using epsilon squared
292 
293  // Maximum allowed iterations of main loop. If exceeded, error code is returned
294  const int max_iteration_count = 50;
295 
296  // State
297  Vec4 S[4]; // Up to 4 planes
298  int plane_count = 0; // Number of valid planes
299  Vec4 p = objective; // Test point, initialized to objective
300 
301  // Default result, changed to valid result if found in loop below
302  int result = -1;
303 
304  // Iterate until a stopping condition is met or the maximum number of iterations is reached
305  for (int i = 0; result < 0 && i < max_iteration_count; ++i)
306  {
307  Vec4& plane = S[plane_count++];
308  real delta = halfspace_set.farthest_halfspace(&plane.v.x, &p.v.x);
309 #if VS3D_UNNORMALIZED_PLANE_HANDLING != 0
310  const real recip_norm = vs3d_recip_sqrt(plane.v | plane.v);
311  plane = vec4(recip_norm*plane.v, recip_norm*plane.w);
312  delta *= recip_norm;
313 #endif
314  if (delta <= 0 || delta*delta <= eps2*(p | p)) result = 1; // Intersection found
315  else if (!vs3d_update(p, S, plane_count, objective, eps2)) result = 0; // Void simplex found
316  }
317 
318  // If q is given, fill it with the solution (normalize p.w if it is not zero)
319  if (q) *(Vec4*)q = (p.w != 0) ? vec4((1 / p.w)*p.v, 1) : p;
320 
321  return result;
322 }
323 
324 } // namespace VSA
325 
326 } // namespace Blast
327 } // namespace Nv
328 
329 
330 #endif // ifndef NVBLASTEXTAUTHORINGVSA_H
Definition: NvBlastExtAuthoringVSA.h:45
Vec4 vec4(const Vec3 &v, real w)
Definition: NvBlastExtAuthoringVSA.h:60
real z
Definition: NvBlastExtAuthoringVSA.h:52
bool frac_gt(real a_num, real a_rden2, real b_num, real b_rden2)
Definition: NvBlastExtAuthoringVSA.h:84
diff --git a/docs/source_docs/files/_nv_blast_ext_custom_profiler_8h-source.html b/docs/source_docs/files/_nv_blast_ext_custom_profiler_8h-source.html index 2493b21..996752d 100755 --- a/docs/source_docs/files/_nv_blast_ext_custom_profiler_8h-source.html +++ b/docs/source_docs/files/_nv_blast_ext_custom_profiler_8h-source.html @@ -69,120 +69,121 @@ 00031 00032 #include "NvBlastProfiler.h" 00033 #include "PxProfiler.h" -00034 -00035 #if NV_NVTX -00036 #include "nvToolsExt.h" -00037 NV_INLINE void platformZoneStart(const char* name) { nvtxRangePushA(name); } -00038 NV_INLINE void platformZoneEnd() { nvtxRangePop(); } -00039 -00040 #elif NV_XBOXONE -00041 #include "xboxone/NvBlastProfilerXB1.h" -00042 -00043 #elif NV_PS4 -00044 #include "ps4/NvBlastProfilerPS4.h" -00045 -00046 #else -00047 NV_INLINE void platformZoneStart(const char*) { } -00048 NV_INLINE void platformZoneEnd() { } -00049 -00050 #endif -00051 -00052 #define SUPPORTS_THREAD_LOCAL (!NV_VC || NV_VC > 12) -00053 -00054 namespace Nv -00055 { -00056 namespace Blast -00057 { -00058 -00059 struct ExtProfileData -00060 { -00061 const char* name; -00062 void* data; -00063 }; -00064 -00065 #if SUPPORTS_THREAD_LOCAL -00066 static const int32_t PROFILER_MAX_NESTED_DEPTH = 64; -00067 static thread_local ExtProfileData th_ProfileData[PROFILER_MAX_NESTED_DEPTH]; -00068 static thread_local int32_t th_depth = 0; -00069 #endif -00070 -00071 -00076 class ExtCustomProfiler : public ProfilerCallback -00077 { -00078 public: -00082 ExtCustomProfiler() : m_platformEnabled(false) {} -00083 +00034 #include <PxFoundation.h> +00035 +00036 #if NV_NVTX +00037 #include "nvToolsExt.h" +00038 NV_INLINE void platformZoneStart(const char* name) { nvtxRangePushA(name); } +00039 NV_INLINE void platformZoneEnd() { nvtxRangePop(); } +00040 +00041 #elif NV_XBOXONE +00042 #include "xboxone/NvBlastProfilerXB1.h" +00043 +00044 #elif NV_PS4 +00045 #include "ps4/NvBlastProfilerPS4.h" +00046 +00047 #else +00048 NV_INLINE void platformZoneStart(const char*) { } +00049 NV_INLINE void platformZoneEnd() { } +00050 +00051 #endif +00052 +00053 #define SUPPORTS_THREAD_LOCAL (!NV_VC || NV_VC > 12) +00054 +00055 namespace Nv +00056 { +00057 namespace Blast +00058 { +00059 +00060 struct ExtProfileData +00061 { +00062 const char* name; +00063 void* data; +00064 }; +00065 +00066 #if SUPPORTS_THREAD_LOCAL +00067 static const int32_t PROFILER_MAX_NESTED_DEPTH = 64; +00068 static thread_local ExtProfileData th_ProfileData[PROFILER_MAX_NESTED_DEPTH]; +00069 static thread_local int32_t th_depth = 0; +00070 #endif +00071 +00072 +00077 class ExtCustomProfiler : public ProfilerCallback +00078 { +00079 public: +00083 ExtCustomProfiler() : m_platformEnabled(false) {} 00084 -00086 -00087 virtual void zoneStart(const char* name) override -00088 { -00089 -00090 #if SUPPORTS_THREAD_LOCAL -00091 if (PxGetProfilerCallback()) -00092 { -00093 void* data = PxGetProfilerCallback()->zoneStart(name, false, 0xb1a57); -00094 -00095 if (th_depth < PROFILER_MAX_NESTED_DEPTH && th_depth >= 0) -00096 { -00097 th_ProfileData[th_depth].name = name; -00098 th_ProfileData[th_depth].data = data; -00099 th_depth++; -00100 } -00101 else -00102 { -00103 assert(th_depth < PROFILER_MAX_NESTED_DEPTH && th_depth >= 0); -00104 } -00105 } -00106 #endif -00107 -00108 if (m_platformEnabled) -00109 { -00110 platformZoneStart(name); -00111 } -00112 } -00113 -00114 virtual void zoneEnd() override -00115 { -00116 -00117 #if SUPPORTS_THREAD_LOCAL -00118 if (PxGetProfilerCallback()) -00119 { -00120 th_depth--; -00121 -00122 if (th_depth >= 0) -00123 { -00124 ExtProfileData& pd = th_ProfileData[th_depth]; -00125 PxGetProfilerCallback()->zoneEnd(pd.data, pd.name, false, 0xb1a57); -00126 } -00127 else -00128 { -00129 assert(th_depth >= 0); -00130 } -00131 } -00132 #endif -00133 -00134 if (m_platformEnabled) -00135 { -00136 platformZoneEnd(); -00137 } -00138 } -00139 +00085 +00087 +00088 virtual void zoneStart(const char* name) override +00089 { +00090 +00091 #if SUPPORTS_THREAD_LOCAL +00092 if (PxGetProfilerCallback()) +00093 { +00094 void* data = PxGetProfilerCallback()->zoneStart(name, false, 0xb1a57); +00095 +00096 if (th_depth < PROFILER_MAX_NESTED_DEPTH && th_depth >= 0) +00097 { +00098 th_ProfileData[th_depth].name = name; +00099 th_ProfileData[th_depth].data = data; +00100 th_depth++; +00101 } +00102 else +00103 { +00104 assert(th_depth < PROFILER_MAX_NESTED_DEPTH && th_depth >= 0); +00105 } +00106 } +00107 #endif +00108 +00109 if (m_platformEnabled) +00110 { +00111 platformZoneStart(name); +00112 } +00113 } +00114 +00115 virtual void zoneEnd() override +00116 { +00117 +00118 #if SUPPORTS_THREAD_LOCAL +00119 if (PxGetProfilerCallback()) +00120 { +00121 th_depth--; +00122 +00123 if (th_depth >= 0) +00124 { +00125 ExtProfileData& pd = th_ProfileData[th_depth]; +00126 PxGetProfilerCallback()->zoneEnd(pd.data, pd.name, false, 0xb1a57); +00127 } +00128 else +00129 { +00130 assert(th_depth >= 0); +00131 } +00132 } +00133 #endif +00134 +00135 if (m_platformEnabled) +00136 { +00137 platformZoneEnd(); +00138 } +00139 } 00140 -00142 -00148 void setPlatformEnabled(bool enabled) -00149 { -00150 m_platformEnabled = enabled; -00151 } -00152 -00153 private: -00154 bool m_platformEnabled; -00155 }; -00156 -00157 } // namespace Blast -00158 } // namespace Nv -00159 +00141 +00143 +00149 void setPlatformEnabled(bool enabled) +00150 { +00151 m_platformEnabled = enabled; +00152 } +00153 +00154 private: +00155 bool m_platformEnabled; +00156 }; +00157 +00158 } // namespace Blast +00159 } // namespace Nv 00160 -00161 #endif // NVBLASTDEFAULTPROFILER_H +00161 +00162 #endif // NVBLASTDEFAULTPROFILER_H