refactor: change repo layout
This commit is contained in:
364
Assets/BMapBindings/BMapSharp/.editorconfig
Normal file
364
Assets/BMapBindings/BMapSharp/.editorconfig
Normal file
@@ -0,0 +1,364 @@
|
||||
root = true
|
||||
|
||||
# All files
|
||||
[*]
|
||||
indent_style = space
|
||||
|
||||
# Xml files
|
||||
[*.xml]
|
||||
indent_size = 2
|
||||
|
||||
# C# files
|
||||
[*.cs]
|
||||
|
||||
#### Core EditorConfig Options ####
|
||||
|
||||
# Indentation and spacing
|
||||
indent_size = 4
|
||||
tab_width = 4
|
||||
|
||||
# New line preferences
|
||||
end_of_line = crlf
|
||||
insert_final_newline = false
|
||||
|
||||
#### .NET Coding Conventions ####
|
||||
[*.{cs,vb}]
|
||||
|
||||
# Organize usings
|
||||
dotnet_separate_import_directive_groups = false
|
||||
dotnet_sort_system_directives_first = false
|
||||
file_header_template = unset
|
||||
|
||||
# this. and Me. preferences
|
||||
dotnet_style_qualification_for_event = false:silent
|
||||
dotnet_style_qualification_for_field = false:silent
|
||||
dotnet_style_qualification_for_method = false:silent
|
||||
dotnet_style_qualification_for_property = false:silent
|
||||
|
||||
# Language keywords vs BCL types preferences
|
||||
dotnet_style_predefined_type_for_locals_parameters_members = true:silent
|
||||
dotnet_style_predefined_type_for_member_access = true:silent
|
||||
|
||||
# Parentheses preferences
|
||||
dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:silent
|
||||
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:silent
|
||||
dotnet_style_parentheses_in_other_operators = never_if_unnecessary:silent
|
||||
dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:silent
|
||||
|
||||
# Modifier preferences
|
||||
dotnet_style_require_accessibility_modifiers = for_non_interface_members:silent
|
||||
|
||||
# Expression-level preferences
|
||||
dotnet_style_coalesce_expression = true:suggestion
|
||||
dotnet_style_collection_initializer = true:suggestion
|
||||
dotnet_style_explicit_tuple_names = true:suggestion
|
||||
dotnet_style_null_propagation = true:suggestion
|
||||
dotnet_style_object_initializer = true:suggestion
|
||||
dotnet_style_operator_placement_when_wrapping = beginning_of_line
|
||||
dotnet_style_prefer_auto_properties = true:suggestion
|
||||
dotnet_style_prefer_compound_assignment = true:suggestion
|
||||
dotnet_style_prefer_conditional_expression_over_assignment = true:suggestion
|
||||
dotnet_style_prefer_conditional_expression_over_return = true:suggestion
|
||||
dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
|
||||
dotnet_style_prefer_inferred_tuple_names = true:suggestion
|
||||
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion
|
||||
dotnet_style_prefer_simplified_boolean_expressions = true:suggestion
|
||||
dotnet_style_prefer_simplified_interpolation = true:suggestion
|
||||
|
||||
# Field preferences
|
||||
dotnet_style_readonly_field = true:warning
|
||||
|
||||
# Parameter preferences
|
||||
dotnet_code_quality_unused_parameters = all:suggestion
|
||||
|
||||
# Suppression preferences
|
||||
dotnet_remove_unnecessary_suppression_exclusions = none
|
||||
|
||||
#### C# Coding Conventions ####
|
||||
[*.cs]
|
||||
|
||||
# var preferences
|
||||
csharp_style_var_elsewhere = false:silent
|
||||
csharp_style_var_for_built_in_types = false:silent
|
||||
csharp_style_var_when_type_is_apparent = false:silent
|
||||
|
||||
# Expression-bodied members
|
||||
csharp_style_expression_bodied_accessors = true:silent
|
||||
csharp_style_expression_bodied_constructors = false:silent
|
||||
csharp_style_expression_bodied_indexers = true:silent
|
||||
csharp_style_expression_bodied_lambdas = true:suggestion
|
||||
csharp_style_expression_bodied_local_functions = false:silent
|
||||
csharp_style_expression_bodied_methods = false:silent
|
||||
csharp_style_expression_bodied_operators = false:silent
|
||||
csharp_style_expression_bodied_properties = true:silent
|
||||
|
||||
# Pattern matching preferences
|
||||
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
|
||||
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
|
||||
csharp_style_prefer_not_pattern = true:suggestion
|
||||
csharp_style_prefer_pattern_matching = true:silent
|
||||
csharp_style_prefer_switch_expression = true:suggestion
|
||||
|
||||
# Null-checking preferences
|
||||
csharp_style_conditional_delegate_call = true:suggestion
|
||||
|
||||
# Modifier preferences
|
||||
csharp_prefer_static_local_function = true:warning
|
||||
csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:silent
|
||||
|
||||
# Code-block preferences
|
||||
csharp_prefer_braces = true:silent
|
||||
csharp_prefer_simple_using_statement = true:suggestion
|
||||
|
||||
# Expression-level preferences
|
||||
csharp_prefer_simple_default_expression = true:suggestion
|
||||
csharp_style_deconstructed_variable_declaration = true:suggestion
|
||||
csharp_style_inlined_variable_declaration = true:suggestion
|
||||
csharp_style_pattern_local_over_anonymous_function = true:suggestion
|
||||
csharp_style_prefer_index_operator = true:suggestion
|
||||
csharp_style_prefer_range_operator = true:suggestion
|
||||
csharp_style_throw_expression = true:suggestion
|
||||
csharp_style_unused_value_assignment_preference = discard_variable:suggestion
|
||||
csharp_style_unused_value_expression_statement_preference = discard_variable:silent
|
||||
|
||||
# 'using' directive preferences
|
||||
csharp_using_directive_placement = outside_namespace:silent
|
||||
|
||||
#### C# Formatting Rules ####
|
||||
|
||||
# New line preferences
|
||||
csharp_new_line_before_catch = false
|
||||
csharp_new_line_before_else = false
|
||||
csharp_new_line_before_finally = false
|
||||
csharp_new_line_before_members_in_anonymous_types = true
|
||||
csharp_new_line_before_members_in_object_initializers = true
|
||||
csharp_new_line_before_open_brace = none
|
||||
csharp_new_line_between_query_expression_clauses = true
|
||||
|
||||
# Indentation preferences
|
||||
csharp_indent_block_contents = true
|
||||
csharp_indent_braces = false
|
||||
csharp_indent_case_contents = true
|
||||
csharp_indent_case_contents_when_block = true
|
||||
csharp_indent_labels = one_less_than_current
|
||||
csharp_indent_switch_labels = true
|
||||
|
||||
# Space preferences
|
||||
csharp_space_after_cast = false
|
||||
csharp_space_after_colon_in_inheritance_clause = true
|
||||
csharp_space_after_comma = true
|
||||
csharp_space_after_dot = false
|
||||
csharp_space_after_keywords_in_control_flow_statements = true
|
||||
csharp_space_after_semicolon_in_for_statement = true
|
||||
csharp_space_around_binary_operators = before_and_after
|
||||
csharp_space_around_declaration_statements = false
|
||||
csharp_space_before_colon_in_inheritance_clause = true
|
||||
csharp_space_before_comma = false
|
||||
csharp_space_before_dot = false
|
||||
csharp_space_before_open_square_brackets = false
|
||||
csharp_space_before_semicolon_in_for_statement = false
|
||||
csharp_space_between_empty_square_brackets = false
|
||||
csharp_space_between_method_call_empty_parameter_list_parentheses = false
|
||||
csharp_space_between_method_call_name_and_opening_parenthesis = false
|
||||
csharp_space_between_method_call_parameter_list_parentheses = false
|
||||
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
|
||||
csharp_space_between_method_declaration_name_and_open_parenthesis = false
|
||||
csharp_space_between_method_declaration_parameter_list_parentheses = false
|
||||
csharp_space_between_parentheses = false
|
||||
csharp_space_between_square_brackets = false
|
||||
|
||||
# Wrapping preferences
|
||||
csharp_preserve_single_line_blocks = true
|
||||
csharp_preserve_single_line_statements = true
|
||||
|
||||
#### Naming styles ####
|
||||
[*.{cs,vb}]
|
||||
|
||||
# Naming rules
|
||||
|
||||
dotnet_naming_rule.types_and_namespaces_should_be_pascalcase.severity = suggestion
|
||||
dotnet_naming_rule.types_and_namespaces_should_be_pascalcase.symbols = types_and_namespaces
|
||||
dotnet_naming_rule.types_and_namespaces_should_be_pascalcase.style = pascalcase
|
||||
|
||||
dotnet_naming_rule.interfaces_should_be_ipascalcase.severity = suggestion
|
||||
dotnet_naming_rule.interfaces_should_be_ipascalcase.symbols = interfaces
|
||||
dotnet_naming_rule.interfaces_should_be_ipascalcase.style = ipascalcase
|
||||
|
||||
dotnet_naming_rule.type_parameters_should_be_tpascalcase.severity = suggestion
|
||||
dotnet_naming_rule.type_parameters_should_be_tpascalcase.symbols = type_parameters
|
||||
dotnet_naming_rule.type_parameters_should_be_tpascalcase.style = tpascalcase
|
||||
|
||||
dotnet_naming_rule.methods_should_be_pascalcase.severity = suggestion
|
||||
dotnet_naming_rule.methods_should_be_pascalcase.symbols = methods
|
||||
dotnet_naming_rule.methods_should_be_pascalcase.style = pascalcase
|
||||
|
||||
dotnet_naming_rule.properties_should_be_pascalcase.severity = suggestion
|
||||
dotnet_naming_rule.properties_should_be_pascalcase.symbols = properties
|
||||
dotnet_naming_rule.properties_should_be_pascalcase.style = pascalcase
|
||||
|
||||
dotnet_naming_rule.events_should_be_pascalcase.severity = suggestion
|
||||
dotnet_naming_rule.events_should_be_pascalcase.symbols = events
|
||||
dotnet_naming_rule.events_should_be_pascalcase.style = pascalcase
|
||||
|
||||
dotnet_naming_rule.local_variables_should_be_camelcase.severity = suggestion
|
||||
dotnet_naming_rule.local_variables_should_be_camelcase.symbols = local_variables
|
||||
dotnet_naming_rule.local_variables_should_be_camelcase.style = camelcase
|
||||
|
||||
dotnet_naming_rule.local_constants_should_be_camelcase.severity = suggestion
|
||||
dotnet_naming_rule.local_constants_should_be_camelcase.symbols = local_constants
|
||||
dotnet_naming_rule.local_constants_should_be_camelcase.style = camelcase
|
||||
|
||||
dotnet_naming_rule.parameters_should_be_camelcase.severity = suggestion
|
||||
dotnet_naming_rule.parameters_should_be_camelcase.symbols = parameters
|
||||
dotnet_naming_rule.parameters_should_be_camelcase.style = camelcase
|
||||
|
||||
dotnet_naming_rule.public_fields_should_be_pascalcase.severity = suggestion
|
||||
dotnet_naming_rule.public_fields_should_be_pascalcase.symbols = public_fields
|
||||
dotnet_naming_rule.public_fields_should_be_pascalcase.style = pascalcase
|
||||
|
||||
dotnet_naming_rule.private_fields_should_be__camelcase.severity = suggestion
|
||||
dotnet_naming_rule.private_fields_should_be__camelcase.symbols = private_fields
|
||||
dotnet_naming_rule.private_fields_should_be__camelcase.style = _camelcase
|
||||
|
||||
dotnet_naming_rule.private_static_fields_should_be_s_camelcase.severity = suggestion
|
||||
dotnet_naming_rule.private_static_fields_should_be_s_camelcase.symbols = private_static_fields
|
||||
dotnet_naming_rule.private_static_fields_should_be_s_camelcase.style = s_camelcase
|
||||
|
||||
dotnet_naming_rule.public_constant_fields_should_be_pascalcase.severity = suggestion
|
||||
dotnet_naming_rule.public_constant_fields_should_be_pascalcase.symbols = public_constant_fields
|
||||
dotnet_naming_rule.public_constant_fields_should_be_pascalcase.style = pascalcase
|
||||
|
||||
dotnet_naming_rule.private_constant_fields_should_be_pascalcase.severity = suggestion
|
||||
dotnet_naming_rule.private_constant_fields_should_be_pascalcase.symbols = private_constant_fields
|
||||
dotnet_naming_rule.private_constant_fields_should_be_pascalcase.style = pascalcase
|
||||
|
||||
dotnet_naming_rule.public_static_readonly_fields_should_be_pascalcase.severity = suggestion
|
||||
dotnet_naming_rule.public_static_readonly_fields_should_be_pascalcase.symbols = public_static_readonly_fields
|
||||
dotnet_naming_rule.public_static_readonly_fields_should_be_pascalcase.style = pascalcase
|
||||
|
||||
dotnet_naming_rule.private_static_readonly_fields_should_be_pascalcase.severity = suggestion
|
||||
dotnet_naming_rule.private_static_readonly_fields_should_be_pascalcase.symbols = private_static_readonly_fields
|
||||
dotnet_naming_rule.private_static_readonly_fields_should_be_pascalcase.style = pascalcase
|
||||
|
||||
dotnet_naming_rule.enums_should_be_pascalcase.severity = suggestion
|
||||
dotnet_naming_rule.enums_should_be_pascalcase.symbols = enums
|
||||
dotnet_naming_rule.enums_should_be_pascalcase.style = pascalcase
|
||||
|
||||
dotnet_naming_rule.local_functions_should_be_pascalcase.severity = suggestion
|
||||
dotnet_naming_rule.local_functions_should_be_pascalcase.symbols = local_functions
|
||||
dotnet_naming_rule.local_functions_should_be_pascalcase.style = pascalcase
|
||||
|
||||
dotnet_naming_rule.non_field_members_should_be_pascalcase.severity = suggestion
|
||||
dotnet_naming_rule.non_field_members_should_be_pascalcase.symbols = non_field_members
|
||||
dotnet_naming_rule.non_field_members_should_be_pascalcase.style = pascalcase
|
||||
|
||||
# Symbol specifications
|
||||
|
||||
dotnet_naming_symbols.interfaces.applicable_kinds = interface
|
||||
dotnet_naming_symbols.interfaces.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||
dotnet_naming_symbols.interfaces.required_modifiers =
|
||||
|
||||
dotnet_naming_symbols.enums.applicable_kinds = enum
|
||||
dotnet_naming_symbols.enums.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||
dotnet_naming_symbols.enums.required_modifiers =
|
||||
|
||||
dotnet_naming_symbols.events.applicable_kinds = event
|
||||
dotnet_naming_symbols.events.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||
dotnet_naming_symbols.events.required_modifiers =
|
||||
|
||||
dotnet_naming_symbols.methods.applicable_kinds = method
|
||||
dotnet_naming_symbols.methods.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||
dotnet_naming_symbols.methods.required_modifiers =
|
||||
|
||||
dotnet_naming_symbols.properties.applicable_kinds = property
|
||||
dotnet_naming_symbols.properties.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||
dotnet_naming_symbols.properties.required_modifiers =
|
||||
|
||||
dotnet_naming_symbols.public_fields.applicable_kinds = field
|
||||
dotnet_naming_symbols.public_fields.applicable_accessibilities = public, internal
|
||||
dotnet_naming_symbols.public_fields.required_modifiers =
|
||||
|
||||
dotnet_naming_symbols.private_fields.applicable_kinds = field
|
||||
dotnet_naming_symbols.private_fields.applicable_accessibilities = private, protected, protected_internal, private_protected
|
||||
dotnet_naming_symbols.private_fields.required_modifiers =
|
||||
|
||||
dotnet_naming_symbols.private_static_fields.applicable_kinds = field
|
||||
dotnet_naming_symbols.private_static_fields.applicable_accessibilities = private, protected, protected_internal, private_protected
|
||||
dotnet_naming_symbols.private_static_fields.required_modifiers = static
|
||||
|
||||
dotnet_naming_symbols.types_and_namespaces.applicable_kinds = namespace, class, struct, interface, enum
|
||||
dotnet_naming_symbols.types_and_namespaces.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||
dotnet_naming_symbols.types_and_namespaces.required_modifiers =
|
||||
|
||||
dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method
|
||||
dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||
dotnet_naming_symbols.non_field_members.required_modifiers =
|
||||
|
||||
dotnet_naming_symbols.type_parameters.applicable_kinds = namespace
|
||||
dotnet_naming_symbols.type_parameters.applicable_accessibilities = *
|
||||
dotnet_naming_symbols.type_parameters.required_modifiers =
|
||||
|
||||
dotnet_naming_symbols.private_constant_fields.applicable_kinds = field
|
||||
dotnet_naming_symbols.private_constant_fields.applicable_accessibilities = private, protected, protected_internal, private_protected
|
||||
dotnet_naming_symbols.private_constant_fields.required_modifiers = const
|
||||
|
||||
dotnet_naming_symbols.local_variables.applicable_kinds = local
|
||||
dotnet_naming_symbols.local_variables.applicable_accessibilities = local
|
||||
dotnet_naming_symbols.local_variables.required_modifiers =
|
||||
|
||||
dotnet_naming_symbols.local_constants.applicable_kinds = local
|
||||
dotnet_naming_symbols.local_constants.applicable_accessibilities = local
|
||||
dotnet_naming_symbols.local_constants.required_modifiers = const
|
||||
|
||||
dotnet_naming_symbols.parameters.applicable_kinds = parameter
|
||||
dotnet_naming_symbols.parameters.applicable_accessibilities = *
|
||||
dotnet_naming_symbols.parameters.required_modifiers =
|
||||
|
||||
dotnet_naming_symbols.public_constant_fields.applicable_kinds = field
|
||||
dotnet_naming_symbols.public_constant_fields.applicable_accessibilities = public, internal
|
||||
dotnet_naming_symbols.public_constant_fields.required_modifiers = const
|
||||
|
||||
dotnet_naming_symbols.public_static_readonly_fields.applicable_kinds = field
|
||||
dotnet_naming_symbols.public_static_readonly_fields.applicable_accessibilities = public, internal
|
||||
dotnet_naming_symbols.public_static_readonly_fields.required_modifiers = readonly, static
|
||||
|
||||
dotnet_naming_symbols.private_static_readonly_fields.applicable_kinds = field
|
||||
dotnet_naming_symbols.private_static_readonly_fields.applicable_accessibilities = private, protected, protected_internal, private_protected
|
||||
dotnet_naming_symbols.private_static_readonly_fields.required_modifiers = readonly, static
|
||||
|
||||
dotnet_naming_symbols.local_functions.applicable_kinds = local_function
|
||||
dotnet_naming_symbols.local_functions.applicable_accessibilities = *
|
||||
dotnet_naming_symbols.local_functions.required_modifiers =
|
||||
|
||||
# Naming styles
|
||||
|
||||
dotnet_naming_style.pascalcase.required_prefix =
|
||||
dotnet_naming_style.pascalcase.required_suffix =
|
||||
dotnet_naming_style.pascalcase.word_separator =
|
||||
dotnet_naming_style.pascalcase.capitalization = pascal_case
|
||||
|
||||
dotnet_naming_style.ipascalcase.required_prefix = I
|
||||
dotnet_naming_style.ipascalcase.required_suffix =
|
||||
dotnet_naming_style.ipascalcase.word_separator =
|
||||
dotnet_naming_style.ipascalcase.capitalization = pascal_case
|
||||
|
||||
dotnet_naming_style.tpascalcase.required_prefix = T
|
||||
dotnet_naming_style.tpascalcase.required_suffix =
|
||||
dotnet_naming_style.tpascalcase.word_separator =
|
||||
dotnet_naming_style.tpascalcase.capitalization = pascal_case
|
||||
|
||||
dotnet_naming_style._camelcase.required_prefix = _
|
||||
dotnet_naming_style._camelcase.required_suffix =
|
||||
dotnet_naming_style._camelcase.word_separator =
|
||||
dotnet_naming_style._camelcase.capitalization = camel_case
|
||||
|
||||
dotnet_naming_style.camelcase.required_prefix =
|
||||
dotnet_naming_style.camelcase.required_suffix =
|
||||
dotnet_naming_style.camelcase.word_separator =
|
||||
dotnet_naming_style.camelcase.capitalization = camel_case
|
||||
|
||||
dotnet_naming_style.s_camelcase.required_prefix = s_
|
||||
dotnet_naming_style.s_camelcase.required_suffix =
|
||||
dotnet_naming_style.s_camelcase.word_separator =
|
||||
dotnet_naming_style.s_camelcase.capitalization = camel_case
|
||||
|
||||
398
Assets/BMapBindings/BMapSharp/.gitignore
vendored
Normal file
398
Assets/BMapBindings/BMapSharp/.gitignore
vendored
Normal file
@@ -0,0 +1,398 @@
|
||||
## Ignore Visual Studio temporary files, build results, and
|
||||
## files generated by popular Visual Studio add-ons.
|
||||
##
|
||||
## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore
|
||||
|
||||
# User-specific files
|
||||
*.rsuser
|
||||
*.suo
|
||||
*.user
|
||||
*.userosscache
|
||||
*.sln.docstates
|
||||
|
||||
# User-specific files (MonoDevelop/Xamarin Studio)
|
||||
*.userprefs
|
||||
|
||||
# Mono auto generated files
|
||||
mono_crash.*
|
||||
|
||||
# Build results
|
||||
[Dd]ebug/
|
||||
[Dd]ebugPublic/
|
||||
[Rr]elease/
|
||||
[Rr]eleases/
|
||||
x64/
|
||||
x86/
|
||||
[Ww][Ii][Nn]32/
|
||||
[Aa][Rr][Mm]/
|
||||
[Aa][Rr][Mm]64/
|
||||
bld/
|
||||
[Bb]in/
|
||||
[Oo]bj/
|
||||
[Ll]og/
|
||||
[Ll]ogs/
|
||||
|
||||
# Visual Studio 2015/2017 cache/options directory
|
||||
.vs/
|
||||
# Uncomment if you have tasks that create the project's static files in wwwroot
|
||||
#wwwroot/
|
||||
|
||||
# Visual Studio 2017 auto generated files
|
||||
Generated\ Files/
|
||||
|
||||
# MSTest test Results
|
||||
[Tt]est[Rr]esult*/
|
||||
[Bb]uild[Ll]og.*
|
||||
|
||||
# NUnit
|
||||
*.VisualState.xml
|
||||
TestResult.xml
|
||||
nunit-*.xml
|
||||
|
||||
# Build Results of an ATL Project
|
||||
[Dd]ebugPS/
|
||||
[Rr]eleasePS/
|
||||
dlldata.c
|
||||
|
||||
# Benchmark Results
|
||||
BenchmarkDotNet.Artifacts/
|
||||
|
||||
# .NET Core
|
||||
project.lock.json
|
||||
project.fragment.lock.json
|
||||
artifacts/
|
||||
|
||||
# ASP.NET Scaffolding
|
||||
ScaffoldingReadMe.txt
|
||||
|
||||
# StyleCop
|
||||
StyleCopReport.xml
|
||||
|
||||
# Files built by Visual Studio
|
||||
*_i.c
|
||||
*_p.c
|
||||
*_h.h
|
||||
*.ilk
|
||||
*.meta
|
||||
*.obj
|
||||
*.iobj
|
||||
*.pch
|
||||
*.pdb
|
||||
*.ipdb
|
||||
*.pgc
|
||||
*.pgd
|
||||
*.rsp
|
||||
*.sbr
|
||||
*.tlb
|
||||
*.tli
|
||||
*.tlh
|
||||
*.tmp
|
||||
*.tmp_proj
|
||||
*_wpftmp.csproj
|
||||
*.log
|
||||
*.tlog
|
||||
*.vspscc
|
||||
*.vssscc
|
||||
.builds
|
||||
*.pidb
|
||||
*.svclog
|
||||
*.scc
|
||||
|
||||
# Chutzpah Test files
|
||||
_Chutzpah*
|
||||
|
||||
# Visual C++ cache files
|
||||
ipch/
|
||||
*.aps
|
||||
*.ncb
|
||||
*.opendb
|
||||
*.opensdf
|
||||
*.sdf
|
||||
*.cachefile
|
||||
*.VC.db
|
||||
*.VC.VC.opendb
|
||||
|
||||
# Visual Studio profiler
|
||||
*.psess
|
||||
*.vsp
|
||||
*.vspx
|
||||
*.sap
|
||||
|
||||
# Visual Studio Trace Files
|
||||
*.e2e
|
||||
|
||||
# TFS 2012 Local Workspace
|
||||
$tf/
|
||||
|
||||
# Guidance Automation Toolkit
|
||||
*.gpState
|
||||
|
||||
# ReSharper is a .NET coding add-in
|
||||
_ReSharper*/
|
||||
*.[Rr]e[Ss]harper
|
||||
*.DotSettings.user
|
||||
|
||||
# TeamCity is a build add-in
|
||||
_TeamCity*
|
||||
|
||||
# DotCover is a Code Coverage Tool
|
||||
*.dotCover
|
||||
|
||||
# AxoCover is a Code Coverage Tool
|
||||
.axoCover/*
|
||||
!.axoCover/settings.json
|
||||
|
||||
# Coverlet is a free, cross platform Code Coverage Tool
|
||||
coverage*.json
|
||||
coverage*.xml
|
||||
coverage*.info
|
||||
|
||||
# Visual Studio code coverage results
|
||||
*.coverage
|
||||
*.coveragexml
|
||||
|
||||
# NCrunch
|
||||
_NCrunch_*
|
||||
.*crunch*.local.xml
|
||||
nCrunchTemp_*
|
||||
|
||||
# MightyMoose
|
||||
*.mm.*
|
||||
AutoTest.Net/
|
||||
|
||||
# Web workbench (sass)
|
||||
.sass-cache/
|
||||
|
||||
# Installshield output folder
|
||||
[Ee]xpress/
|
||||
|
||||
# DocProject is a documentation generator add-in
|
||||
DocProject/buildhelp/
|
||||
DocProject/Help/*.HxT
|
||||
DocProject/Help/*.HxC
|
||||
DocProject/Help/*.hhc
|
||||
DocProject/Help/*.hhk
|
||||
DocProject/Help/*.hhp
|
||||
DocProject/Help/Html2
|
||||
DocProject/Help/html
|
||||
|
||||
# Click-Once directory
|
||||
publish/
|
||||
|
||||
# Publish Web Output
|
||||
*.[Pp]ublish.xml
|
||||
*.azurePubxml
|
||||
# Note: Comment the next line if you want to checkin your web deploy settings,
|
||||
# but database connection strings (with potential passwords) will be unencrypted
|
||||
*.pubxml
|
||||
*.publishproj
|
||||
|
||||
# Microsoft Azure Web App publish settings. Comment the next line if you want to
|
||||
# checkin your Azure Web App publish settings, but sensitive information contained
|
||||
# in these scripts will be unencrypted
|
||||
PublishScripts/
|
||||
|
||||
# NuGet Packages
|
||||
*.nupkg
|
||||
# NuGet Symbol Packages
|
||||
*.snupkg
|
||||
# The packages folder can be ignored because of Package Restore
|
||||
**/[Pp]ackages/*
|
||||
# except build/, which is used as an MSBuild target.
|
||||
!**/[Pp]ackages/build/
|
||||
# Uncomment if necessary however generally it will be regenerated when needed
|
||||
#!**/[Pp]ackages/repositories.config
|
||||
# NuGet v3's project.json files produces more ignorable files
|
||||
*.nuget.props
|
||||
*.nuget.targets
|
||||
|
||||
# Microsoft Azure Build Output
|
||||
csx/
|
||||
*.build.csdef
|
||||
|
||||
# Microsoft Azure Emulator
|
||||
ecf/
|
||||
rcf/
|
||||
|
||||
# Windows Store app package directories and files
|
||||
AppPackages/
|
||||
BundleArtifacts/
|
||||
Package.StoreAssociation.xml
|
||||
_pkginfo.txt
|
||||
*.appx
|
||||
*.appxbundle
|
||||
*.appxupload
|
||||
|
||||
# Visual Studio cache files
|
||||
# files ending in .cache can be ignored
|
||||
*.[Cc]ache
|
||||
# but keep track of directories ending in .cache
|
||||
!?*.[Cc]ache/
|
||||
|
||||
# Others
|
||||
ClientBin/
|
||||
~$*
|
||||
*~
|
||||
*.dbmdl
|
||||
*.dbproj.schemaview
|
||||
*.jfm
|
||||
*.pfx
|
||||
*.publishsettings
|
||||
orleans.codegen.cs
|
||||
|
||||
# Including strong name files can present a security risk
|
||||
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
|
||||
#*.snk
|
||||
|
||||
# Since there are multiple workflows, uncomment next line to ignore bower_components
|
||||
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
|
||||
#bower_components/
|
||||
|
||||
# RIA/Silverlight projects
|
||||
Generated_Code/
|
||||
|
||||
# Backup & report files from converting an old project file
|
||||
# to a newer Visual Studio version. Backup files are not needed,
|
||||
# because we have git ;-)
|
||||
_UpgradeReport_Files/
|
||||
Backup*/
|
||||
UpgradeLog*.XML
|
||||
UpgradeLog*.htm
|
||||
ServiceFabricBackup/
|
||||
*.rptproj.bak
|
||||
|
||||
# SQL Server files
|
||||
*.mdf
|
||||
*.ldf
|
||||
*.ndf
|
||||
|
||||
# Business Intelligence projects
|
||||
*.rdl.data
|
||||
*.bim.layout
|
||||
*.bim_*.settings
|
||||
*.rptproj.rsuser
|
||||
*- [Bb]ackup.rdl
|
||||
*- [Bb]ackup ([0-9]).rdl
|
||||
*- [Bb]ackup ([0-9][0-9]).rdl
|
||||
|
||||
# Microsoft Fakes
|
||||
FakesAssemblies/
|
||||
|
||||
# GhostDoc plugin setting file
|
||||
*.GhostDoc.xml
|
||||
|
||||
# Node.js Tools for Visual Studio
|
||||
.ntvs_analysis.dat
|
||||
node_modules/
|
||||
|
||||
# Visual Studio 6 build log
|
||||
*.plg
|
||||
|
||||
# Visual Studio 6 workspace options file
|
||||
*.opt
|
||||
|
||||
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
|
||||
*.vbw
|
||||
|
||||
# Visual Studio 6 auto-generated project file (contains which files were open etc.)
|
||||
*.vbp
|
||||
|
||||
# Visual Studio 6 workspace and project file (working project files containing files to include in project)
|
||||
*.dsw
|
||||
*.dsp
|
||||
|
||||
# Visual Studio 6 technical files
|
||||
*.ncb
|
||||
*.aps
|
||||
|
||||
# Visual Studio LightSwitch build output
|
||||
**/*.HTMLClient/GeneratedArtifacts
|
||||
**/*.DesktopClient/GeneratedArtifacts
|
||||
**/*.DesktopClient/ModelManifest.xml
|
||||
**/*.Server/GeneratedArtifacts
|
||||
**/*.Server/ModelManifest.xml
|
||||
_Pvt_Extensions
|
||||
|
||||
# Paket dependency manager
|
||||
.paket/paket.exe
|
||||
paket-files/
|
||||
|
||||
# FAKE - F# Make
|
||||
.fake/
|
||||
|
||||
# CodeRush personal settings
|
||||
.cr/personal
|
||||
|
||||
# Python Tools for Visual Studio (PTVS)
|
||||
__pycache__/
|
||||
*.pyc
|
||||
|
||||
# Cake - Uncomment if you are using it
|
||||
# tools/**
|
||||
# !tools/packages.config
|
||||
|
||||
# Tabs Studio
|
||||
*.tss
|
||||
|
||||
# Telerik's JustMock configuration file
|
||||
*.jmconfig
|
||||
|
||||
# BizTalk build output
|
||||
*.btp.cs
|
||||
*.btm.cs
|
||||
*.odx.cs
|
||||
*.xsd.cs
|
||||
|
||||
# OpenCover UI analysis results
|
||||
OpenCover/
|
||||
|
||||
# Azure Stream Analytics local run output
|
||||
ASALocalRun/
|
||||
|
||||
# MSBuild Binary and Structured Log
|
||||
*.binlog
|
||||
|
||||
# NVidia Nsight GPU debugger configuration file
|
||||
*.nvuser
|
||||
|
||||
# MFractors (Xamarin productivity tool) working folder
|
||||
.mfractor/
|
||||
|
||||
# Local History for Visual Studio
|
||||
.localhistory/
|
||||
|
||||
# Visual Studio History (VSHistory) files
|
||||
.vshistory/
|
||||
|
||||
# BeatPulse healthcheck temp database
|
||||
healthchecksdb
|
||||
|
||||
# Backup folder for Package Reference Convert tool in Visual Studio 2017
|
||||
MigrationBackup/
|
||||
|
||||
# Ionide (cross platform F# VS Code tools) working folder
|
||||
.ionide/
|
||||
|
||||
# Fody - auto-generated XML schema
|
||||
FodyWeavers.xsd
|
||||
|
||||
# VS Code files for those working on multiple tools
|
||||
.vscode/*
|
||||
!.vscode/settings.json
|
||||
!.vscode/tasks.json
|
||||
!.vscode/launch.json
|
||||
!.vscode/extensions.json
|
||||
*.code-workspace
|
||||
|
||||
# Local History for Visual Studio Code
|
||||
.history/
|
||||
|
||||
# Windows Installer files from build outputs
|
||||
*.cab
|
||||
*.msi
|
||||
*.msix
|
||||
*.msm
|
||||
*.msp
|
||||
|
||||
# JetBrains Rider
|
||||
*.sln.iml
|
||||
28
Assets/BMapBindings/BMapSharp/BMapSharp.sln
Normal file
28
Assets/BMapBindings/BMapSharp/BMapSharp.sln
Normal file
@@ -0,0 +1,28 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.0.31903.59
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BMapSharp", "BMapSharp\BMapSharp.csproj", "{604F426A-EC91-4E17-BE58-74565B24946C}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BMapSharpTestbench", "BMapSharpTestbench\BMapSharpTestbench.csproj", "{3490D77F-119B-48EF-AA0B-E715EBE80DAA}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{604F426A-EC91-4E17-BE58-74565B24946C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{604F426A-EC91-4E17-BE58-74565B24946C}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{604F426A-EC91-4E17-BE58-74565B24946C}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{604F426A-EC91-4E17-BE58-74565B24946C}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{3490D77F-119B-48EF-AA0B-E715EBE80DAA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{3490D77F-119B-48EF-AA0B-E715EBE80DAA}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{3490D77F-119B-48EF-AA0B-E715EBE80DAA}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{3490D77F-119B-48EF-AA0B-E715EBE80DAA}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
364
Assets/BMapBindings/BMapSharp/BMapSharp/.editorconfig
Normal file
364
Assets/BMapBindings/BMapSharp/BMapSharp/.editorconfig
Normal file
@@ -0,0 +1,364 @@
|
||||
root = true
|
||||
|
||||
# All files
|
||||
[*]
|
||||
indent_style = space
|
||||
|
||||
# Xml files
|
||||
[*.xml]
|
||||
indent_size = 2
|
||||
|
||||
# C# files
|
||||
[*.cs]
|
||||
|
||||
#### Core EditorConfig Options ####
|
||||
|
||||
# Indentation and spacing
|
||||
indent_size = 4
|
||||
tab_width = 4
|
||||
|
||||
# New line preferences
|
||||
end_of_line = crlf
|
||||
insert_final_newline = false
|
||||
|
||||
#### .NET Coding Conventions ####
|
||||
[*.{cs,vb}]
|
||||
|
||||
# Organize usings
|
||||
dotnet_separate_import_directive_groups = false
|
||||
dotnet_sort_system_directives_first = false
|
||||
file_header_template = unset
|
||||
|
||||
# this. and Me. preferences
|
||||
dotnet_style_qualification_for_event = false:silent
|
||||
dotnet_style_qualification_for_field = false:silent
|
||||
dotnet_style_qualification_for_method = false:silent
|
||||
dotnet_style_qualification_for_property = false:silent
|
||||
|
||||
# Language keywords vs BCL types preferences
|
||||
dotnet_style_predefined_type_for_locals_parameters_members = true:silent
|
||||
dotnet_style_predefined_type_for_member_access = true:silent
|
||||
|
||||
# Parentheses preferences
|
||||
dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:silent
|
||||
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:silent
|
||||
dotnet_style_parentheses_in_other_operators = never_if_unnecessary:silent
|
||||
dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:silent
|
||||
|
||||
# Modifier preferences
|
||||
dotnet_style_require_accessibility_modifiers = for_non_interface_members:silent
|
||||
|
||||
# Expression-level preferences
|
||||
dotnet_style_coalesce_expression = true:suggestion
|
||||
dotnet_style_collection_initializer = true:suggestion
|
||||
dotnet_style_explicit_tuple_names = true:suggestion
|
||||
dotnet_style_null_propagation = true:suggestion
|
||||
dotnet_style_object_initializer = true:suggestion
|
||||
dotnet_style_operator_placement_when_wrapping = beginning_of_line
|
||||
dotnet_style_prefer_auto_properties = true:suggestion
|
||||
dotnet_style_prefer_compound_assignment = true:suggestion
|
||||
dotnet_style_prefer_conditional_expression_over_assignment = true:suggestion
|
||||
dotnet_style_prefer_conditional_expression_over_return = true:suggestion
|
||||
dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
|
||||
dotnet_style_prefer_inferred_tuple_names = true:suggestion
|
||||
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion
|
||||
dotnet_style_prefer_simplified_boolean_expressions = true:suggestion
|
||||
dotnet_style_prefer_simplified_interpolation = true:suggestion
|
||||
|
||||
# Field preferences
|
||||
dotnet_style_readonly_field = true:warning
|
||||
|
||||
# Parameter preferences
|
||||
dotnet_code_quality_unused_parameters = all:suggestion
|
||||
|
||||
# Suppression preferences
|
||||
dotnet_remove_unnecessary_suppression_exclusions = none
|
||||
|
||||
#### C# Coding Conventions ####
|
||||
[*.cs]
|
||||
|
||||
# var preferences
|
||||
csharp_style_var_elsewhere = false:silent
|
||||
csharp_style_var_for_built_in_types = false:silent
|
||||
csharp_style_var_when_type_is_apparent = false:silent
|
||||
|
||||
# Expression-bodied members
|
||||
csharp_style_expression_bodied_accessors = true:silent
|
||||
csharp_style_expression_bodied_constructors = false:silent
|
||||
csharp_style_expression_bodied_indexers = true:silent
|
||||
csharp_style_expression_bodied_lambdas = true:suggestion
|
||||
csharp_style_expression_bodied_local_functions = false:silent
|
||||
csharp_style_expression_bodied_methods = false:silent
|
||||
csharp_style_expression_bodied_operators = false:silent
|
||||
csharp_style_expression_bodied_properties = true:silent
|
||||
|
||||
# Pattern matching preferences
|
||||
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
|
||||
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
|
||||
csharp_style_prefer_not_pattern = true:suggestion
|
||||
csharp_style_prefer_pattern_matching = true:silent
|
||||
csharp_style_prefer_switch_expression = true:suggestion
|
||||
|
||||
# Null-checking preferences
|
||||
csharp_style_conditional_delegate_call = true:suggestion
|
||||
|
||||
# Modifier preferences
|
||||
csharp_prefer_static_local_function = true:warning
|
||||
csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:silent
|
||||
|
||||
# Code-block preferences
|
||||
csharp_prefer_braces = true:silent
|
||||
csharp_prefer_simple_using_statement = true:suggestion
|
||||
|
||||
# Expression-level preferences
|
||||
csharp_prefer_simple_default_expression = true:suggestion
|
||||
csharp_style_deconstructed_variable_declaration = true:suggestion
|
||||
csharp_style_inlined_variable_declaration = true:suggestion
|
||||
csharp_style_pattern_local_over_anonymous_function = true:suggestion
|
||||
csharp_style_prefer_index_operator = true:suggestion
|
||||
csharp_style_prefer_range_operator = true:suggestion
|
||||
csharp_style_throw_expression = true:suggestion
|
||||
csharp_style_unused_value_assignment_preference = discard_variable:suggestion
|
||||
csharp_style_unused_value_expression_statement_preference = discard_variable:silent
|
||||
|
||||
# 'using' directive preferences
|
||||
csharp_using_directive_placement = outside_namespace:silent
|
||||
|
||||
#### C# Formatting Rules ####
|
||||
|
||||
# New line preferences
|
||||
csharp_new_line_before_catch = false
|
||||
csharp_new_line_before_else = false
|
||||
csharp_new_line_before_finally = false
|
||||
csharp_new_line_before_members_in_anonymous_types = true
|
||||
csharp_new_line_before_members_in_object_initializers = true
|
||||
csharp_new_line_before_open_brace = none
|
||||
csharp_new_line_between_query_expression_clauses = true
|
||||
|
||||
# Indentation preferences
|
||||
csharp_indent_block_contents = true
|
||||
csharp_indent_braces = false
|
||||
csharp_indent_case_contents = true
|
||||
csharp_indent_case_contents_when_block = true
|
||||
csharp_indent_labels = one_less_than_current
|
||||
csharp_indent_switch_labels = true
|
||||
|
||||
# Space preferences
|
||||
csharp_space_after_cast = false
|
||||
csharp_space_after_colon_in_inheritance_clause = true
|
||||
csharp_space_after_comma = true
|
||||
csharp_space_after_dot = false
|
||||
csharp_space_after_keywords_in_control_flow_statements = true
|
||||
csharp_space_after_semicolon_in_for_statement = true
|
||||
csharp_space_around_binary_operators = before_and_after
|
||||
csharp_space_around_declaration_statements = false
|
||||
csharp_space_before_colon_in_inheritance_clause = true
|
||||
csharp_space_before_comma = false
|
||||
csharp_space_before_dot = false
|
||||
csharp_space_before_open_square_brackets = false
|
||||
csharp_space_before_semicolon_in_for_statement = false
|
||||
csharp_space_between_empty_square_brackets = false
|
||||
csharp_space_between_method_call_empty_parameter_list_parentheses = false
|
||||
csharp_space_between_method_call_name_and_opening_parenthesis = false
|
||||
csharp_space_between_method_call_parameter_list_parentheses = false
|
||||
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
|
||||
csharp_space_between_method_declaration_name_and_open_parenthesis = false
|
||||
csharp_space_between_method_declaration_parameter_list_parentheses = false
|
||||
csharp_space_between_parentheses = false
|
||||
csharp_space_between_square_brackets = false
|
||||
|
||||
# Wrapping preferences
|
||||
csharp_preserve_single_line_blocks = true
|
||||
csharp_preserve_single_line_statements = true
|
||||
|
||||
#### Naming styles ####
|
||||
[*.{cs,vb}]
|
||||
|
||||
# Naming rules
|
||||
|
||||
dotnet_naming_rule.types_and_namespaces_should_be_pascalcase.severity = suggestion
|
||||
dotnet_naming_rule.types_and_namespaces_should_be_pascalcase.symbols = types_and_namespaces
|
||||
dotnet_naming_rule.types_and_namespaces_should_be_pascalcase.style = pascalcase
|
||||
|
||||
dotnet_naming_rule.interfaces_should_be_ipascalcase.severity = suggestion
|
||||
dotnet_naming_rule.interfaces_should_be_ipascalcase.symbols = interfaces
|
||||
dotnet_naming_rule.interfaces_should_be_ipascalcase.style = ipascalcase
|
||||
|
||||
dotnet_naming_rule.type_parameters_should_be_tpascalcase.severity = suggestion
|
||||
dotnet_naming_rule.type_parameters_should_be_tpascalcase.symbols = type_parameters
|
||||
dotnet_naming_rule.type_parameters_should_be_tpascalcase.style = tpascalcase
|
||||
|
||||
dotnet_naming_rule.methods_should_be_pascalcase.severity = suggestion
|
||||
dotnet_naming_rule.methods_should_be_pascalcase.symbols = methods
|
||||
dotnet_naming_rule.methods_should_be_pascalcase.style = pascalcase
|
||||
|
||||
dotnet_naming_rule.properties_should_be_pascalcase.severity = suggestion
|
||||
dotnet_naming_rule.properties_should_be_pascalcase.symbols = properties
|
||||
dotnet_naming_rule.properties_should_be_pascalcase.style = pascalcase
|
||||
|
||||
dotnet_naming_rule.events_should_be_pascalcase.severity = suggestion
|
||||
dotnet_naming_rule.events_should_be_pascalcase.symbols = events
|
||||
dotnet_naming_rule.events_should_be_pascalcase.style = pascalcase
|
||||
|
||||
dotnet_naming_rule.local_variables_should_be_camelcase.severity = suggestion
|
||||
dotnet_naming_rule.local_variables_should_be_camelcase.symbols = local_variables
|
||||
dotnet_naming_rule.local_variables_should_be_camelcase.style = camelcase
|
||||
|
||||
dotnet_naming_rule.local_constants_should_be_camelcase.severity = suggestion
|
||||
dotnet_naming_rule.local_constants_should_be_camelcase.symbols = local_constants
|
||||
dotnet_naming_rule.local_constants_should_be_camelcase.style = camelcase
|
||||
|
||||
dotnet_naming_rule.parameters_should_be_camelcase.severity = suggestion
|
||||
dotnet_naming_rule.parameters_should_be_camelcase.symbols = parameters
|
||||
dotnet_naming_rule.parameters_should_be_camelcase.style = camelcase
|
||||
|
||||
dotnet_naming_rule.public_fields_should_be_pascalcase.severity = suggestion
|
||||
dotnet_naming_rule.public_fields_should_be_pascalcase.symbols = public_fields
|
||||
dotnet_naming_rule.public_fields_should_be_pascalcase.style = pascalcase
|
||||
|
||||
dotnet_naming_rule.private_fields_should_be__camelcase.severity = suggestion
|
||||
dotnet_naming_rule.private_fields_should_be__camelcase.symbols = private_fields
|
||||
dotnet_naming_rule.private_fields_should_be__camelcase.style = _camelcase
|
||||
|
||||
dotnet_naming_rule.private_static_fields_should_be_s_camelcase.severity = suggestion
|
||||
dotnet_naming_rule.private_static_fields_should_be_s_camelcase.symbols = private_static_fields
|
||||
dotnet_naming_rule.private_static_fields_should_be_s_camelcase.style = s_camelcase
|
||||
|
||||
dotnet_naming_rule.public_constant_fields_should_be_pascalcase.severity = suggestion
|
||||
dotnet_naming_rule.public_constant_fields_should_be_pascalcase.symbols = public_constant_fields
|
||||
dotnet_naming_rule.public_constant_fields_should_be_pascalcase.style = pascalcase
|
||||
|
||||
dotnet_naming_rule.private_constant_fields_should_be_pascalcase.severity = suggestion
|
||||
dotnet_naming_rule.private_constant_fields_should_be_pascalcase.symbols = private_constant_fields
|
||||
dotnet_naming_rule.private_constant_fields_should_be_pascalcase.style = pascalcase
|
||||
|
||||
dotnet_naming_rule.public_static_readonly_fields_should_be_pascalcase.severity = suggestion
|
||||
dotnet_naming_rule.public_static_readonly_fields_should_be_pascalcase.symbols = public_static_readonly_fields
|
||||
dotnet_naming_rule.public_static_readonly_fields_should_be_pascalcase.style = pascalcase
|
||||
|
||||
dotnet_naming_rule.private_static_readonly_fields_should_be_pascalcase.severity = suggestion
|
||||
dotnet_naming_rule.private_static_readonly_fields_should_be_pascalcase.symbols = private_static_readonly_fields
|
||||
dotnet_naming_rule.private_static_readonly_fields_should_be_pascalcase.style = pascalcase
|
||||
|
||||
dotnet_naming_rule.enums_should_be_pascalcase.severity = suggestion
|
||||
dotnet_naming_rule.enums_should_be_pascalcase.symbols = enums
|
||||
dotnet_naming_rule.enums_should_be_pascalcase.style = pascalcase
|
||||
|
||||
dotnet_naming_rule.local_functions_should_be_pascalcase.severity = suggestion
|
||||
dotnet_naming_rule.local_functions_should_be_pascalcase.symbols = local_functions
|
||||
dotnet_naming_rule.local_functions_should_be_pascalcase.style = pascalcase
|
||||
|
||||
dotnet_naming_rule.non_field_members_should_be_pascalcase.severity = suggestion
|
||||
dotnet_naming_rule.non_field_members_should_be_pascalcase.symbols = non_field_members
|
||||
dotnet_naming_rule.non_field_members_should_be_pascalcase.style = pascalcase
|
||||
|
||||
# Symbol specifications
|
||||
|
||||
dotnet_naming_symbols.interfaces.applicable_kinds = interface
|
||||
dotnet_naming_symbols.interfaces.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||
dotnet_naming_symbols.interfaces.required_modifiers =
|
||||
|
||||
dotnet_naming_symbols.enums.applicable_kinds = enum
|
||||
dotnet_naming_symbols.enums.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||
dotnet_naming_symbols.enums.required_modifiers =
|
||||
|
||||
dotnet_naming_symbols.events.applicable_kinds = event
|
||||
dotnet_naming_symbols.events.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||
dotnet_naming_symbols.events.required_modifiers =
|
||||
|
||||
dotnet_naming_symbols.methods.applicable_kinds = method
|
||||
dotnet_naming_symbols.methods.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||
dotnet_naming_symbols.methods.required_modifiers =
|
||||
|
||||
dotnet_naming_symbols.properties.applicable_kinds = property
|
||||
dotnet_naming_symbols.properties.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||
dotnet_naming_symbols.properties.required_modifiers =
|
||||
|
||||
dotnet_naming_symbols.public_fields.applicable_kinds = field
|
||||
dotnet_naming_symbols.public_fields.applicable_accessibilities = public, internal
|
||||
dotnet_naming_symbols.public_fields.required_modifiers =
|
||||
|
||||
dotnet_naming_symbols.private_fields.applicable_kinds = field
|
||||
dotnet_naming_symbols.private_fields.applicable_accessibilities = private, protected, protected_internal, private_protected
|
||||
dotnet_naming_symbols.private_fields.required_modifiers =
|
||||
|
||||
dotnet_naming_symbols.private_static_fields.applicable_kinds = field
|
||||
dotnet_naming_symbols.private_static_fields.applicable_accessibilities = private, protected, protected_internal, private_protected
|
||||
dotnet_naming_symbols.private_static_fields.required_modifiers = static
|
||||
|
||||
dotnet_naming_symbols.types_and_namespaces.applicable_kinds = namespace, class, struct, interface, enum
|
||||
dotnet_naming_symbols.types_and_namespaces.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||
dotnet_naming_symbols.types_and_namespaces.required_modifiers =
|
||||
|
||||
dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method
|
||||
dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||
dotnet_naming_symbols.non_field_members.required_modifiers =
|
||||
|
||||
dotnet_naming_symbols.type_parameters.applicable_kinds = namespace
|
||||
dotnet_naming_symbols.type_parameters.applicable_accessibilities = *
|
||||
dotnet_naming_symbols.type_parameters.required_modifiers =
|
||||
|
||||
dotnet_naming_symbols.private_constant_fields.applicable_kinds = field
|
||||
dotnet_naming_symbols.private_constant_fields.applicable_accessibilities = private, protected, protected_internal, private_protected
|
||||
dotnet_naming_symbols.private_constant_fields.required_modifiers = const
|
||||
|
||||
dotnet_naming_symbols.local_variables.applicable_kinds = local
|
||||
dotnet_naming_symbols.local_variables.applicable_accessibilities = local
|
||||
dotnet_naming_symbols.local_variables.required_modifiers =
|
||||
|
||||
dotnet_naming_symbols.local_constants.applicable_kinds = local
|
||||
dotnet_naming_symbols.local_constants.applicable_accessibilities = local
|
||||
dotnet_naming_symbols.local_constants.required_modifiers = const
|
||||
|
||||
dotnet_naming_symbols.parameters.applicable_kinds = parameter
|
||||
dotnet_naming_symbols.parameters.applicable_accessibilities = *
|
||||
dotnet_naming_symbols.parameters.required_modifiers =
|
||||
|
||||
dotnet_naming_symbols.public_constant_fields.applicable_kinds = field
|
||||
dotnet_naming_symbols.public_constant_fields.applicable_accessibilities = public, internal
|
||||
dotnet_naming_symbols.public_constant_fields.required_modifiers = const
|
||||
|
||||
dotnet_naming_symbols.public_static_readonly_fields.applicable_kinds = field
|
||||
dotnet_naming_symbols.public_static_readonly_fields.applicable_accessibilities = public, internal
|
||||
dotnet_naming_symbols.public_static_readonly_fields.required_modifiers = readonly, static
|
||||
|
||||
dotnet_naming_symbols.private_static_readonly_fields.applicable_kinds = field
|
||||
dotnet_naming_symbols.private_static_readonly_fields.applicable_accessibilities = private, protected, protected_internal, private_protected
|
||||
dotnet_naming_symbols.private_static_readonly_fields.required_modifiers = readonly, static
|
||||
|
||||
dotnet_naming_symbols.local_functions.applicable_kinds = local_function
|
||||
dotnet_naming_symbols.local_functions.applicable_accessibilities = *
|
||||
dotnet_naming_symbols.local_functions.required_modifiers =
|
||||
|
||||
# Naming styles
|
||||
|
||||
dotnet_naming_style.pascalcase.required_prefix =
|
||||
dotnet_naming_style.pascalcase.required_suffix =
|
||||
dotnet_naming_style.pascalcase.word_separator =
|
||||
dotnet_naming_style.pascalcase.capitalization = pascal_case
|
||||
|
||||
dotnet_naming_style.ipascalcase.required_prefix = I
|
||||
dotnet_naming_style.ipascalcase.required_suffix =
|
||||
dotnet_naming_style.ipascalcase.word_separator =
|
||||
dotnet_naming_style.ipascalcase.capitalization = pascal_case
|
||||
|
||||
dotnet_naming_style.tpascalcase.required_prefix = T
|
||||
dotnet_naming_style.tpascalcase.required_suffix =
|
||||
dotnet_naming_style.tpascalcase.word_separator =
|
||||
dotnet_naming_style.tpascalcase.capitalization = pascal_case
|
||||
|
||||
dotnet_naming_style._camelcase.required_prefix = _
|
||||
dotnet_naming_style._camelcase.required_suffix =
|
||||
dotnet_naming_style._camelcase.word_separator =
|
||||
dotnet_naming_style._camelcase.capitalization = camel_case
|
||||
|
||||
dotnet_naming_style.camelcase.required_prefix =
|
||||
dotnet_naming_style.camelcase.required_suffix =
|
||||
dotnet_naming_style.camelcase.word_separator =
|
||||
dotnet_naming_style.camelcase.capitalization = camel_case
|
||||
|
||||
dotnet_naming_style.s_camelcase.required_prefix = s_
|
||||
dotnet_naming_style.s_camelcase.required_suffix =
|
||||
dotnet_naming_style.s_camelcase.word_separator =
|
||||
dotnet_naming_style.s_camelcase.capitalization = camel_case
|
||||
|
||||
1375
Assets/BMapBindings/BMapSharp/BMapSharp/BMap.cs
Normal file
1375
Assets/BMapBindings/BMapSharp/BMapSharp/BMap.cs
Normal file
File diff suppressed because it is too large
Load Diff
23
Assets/BMapBindings/BMapSharp/BMapSharp/BMapSharp.csproj
Normal file
23
Assets/BMapBindings/BMapSharp/BMapSharp/BMapSharp.csproj
Normal file
@@ -0,0 +1,23 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
|
||||
<PackageId>BMapSharp</PackageId>
|
||||
<Version>1.0.0</Version>
|
||||
<Authors>yyc12345</Authors>
|
||||
<Company>BearKidsTeam</Company>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="$([System.OperatingSystem]::IsWindows())">
|
||||
<DefineConstants>BMAP_OS_WINDOWS</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="$([System.OperatingSystem]::IsLinux()) Or $([System.OperatingSystem]::IsFreeBSD())">
|
||||
<DefineConstants>BMAP_OS_LINUX</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="$([System.OperatingSystem]::IsMacOS())">
|
||||
<DefineConstants>BMAP_OS_MACOS</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
617
Assets/BMapBindings/BMapSharp/BMapSharp/BMapWrapper.cs
Normal file
617
Assets/BMapBindings/BMapSharp/BMapSharp/BMapWrapper.cs
Normal file
@@ -0,0 +1,617 @@
|
||||
using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using BMapSharp.VirtoolsTypes;
|
||||
|
||||
namespace BMapSharp.BMapWrapper {
|
||||
|
||||
/// <summary>
|
||||
/// The guard of native BMap environment.
|
||||
/// This class initialize native BMap environment when constructing and free it when destructing.
|
||||
/// </summary>
|
||||
internal sealed class BMapGuard : SafeHandle {
|
||||
private static readonly IntPtr MAGIC_HANDLE = (IntPtr)61;
|
||||
internal BMapGuard() : base(Utils.INVALID_PTR, true) {
|
||||
BMapException.ThrowIfFailed(BMap.BMInit());
|
||||
this.handle = MAGIC_HANDLE;
|
||||
}
|
||||
|
||||
public override bool IsInvalid => this.handle == Utils.INVALID_PTR;
|
||||
protected override bool ReleaseHandle() {
|
||||
return BMap.BMDispose();
|
||||
}
|
||||
}
|
||||
|
||||
public static class Utils {
|
||||
|
||||
#region Constant Values
|
||||
|
||||
/// <summary>The representation of invalid raw pointer.</summary>
|
||||
internal static readonly IntPtr INVALID_PTR = IntPtr.Zero;
|
||||
/// <summary>The representation of invalid CK_ID.</summary>
|
||||
internal static readonly uint INVALID_CKID = 0u;
|
||||
/// <summary>
|
||||
/// The function used as callback for BMap.
|
||||
/// It just writes the data in console.
|
||||
/// </summary>
|
||||
internal static void BMapSharpCallback(string msg) {
|
||||
Console.WriteLine($"[BMapSharp] {msg}");
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Help Functions
|
||||
|
||||
private static void StructAssigner<T>(IntPtr pstruct, uint count, IEnumerable<T> iem) {
|
||||
var stride = Marshal.SizeOf<T>();
|
||||
var itor = iem.GetEnumerator();
|
||||
for (uint i = 0; i < count; ++i) {
|
||||
if (!itor.MoveNext()) throw new BMapException("The length of given data is too short when assigning struct array.");
|
||||
Marshal.StructureToPtr<T>(itor.Current, pstruct, false);
|
||||
pstruct += stride;
|
||||
}
|
||||
}
|
||||
internal static void VxVector3Assigner(IntPtr pstruct, uint count, IEnumerable<VxVector3> iem)
|
||||
=> StructAssigner<VxVector3>(pstruct, count, iem);
|
||||
internal static void VxVector2Assigner(IntPtr pstruct, uint count, IEnumerable<VxVector2> iem)
|
||||
=> StructAssigner<VxVector2>(pstruct, count, iem);
|
||||
internal static void CKFaceIndicesAssigner(IntPtr pstruct, uint count, IEnumerable<CKFaceIndices> iem)
|
||||
=> StructAssigner<CKFaceIndices>(pstruct, count, iem);
|
||||
internal static void CKShortFaceIndicesAssigner(IntPtr pstruct, uint count, IEnumerable<CKShortFaceIndices> iem)
|
||||
=> StructAssigner<CKShortFaceIndices>(pstruct, count, iem);
|
||||
internal static void ShortAssigner(IntPtr pstruct, uint count, IEnumerable<short> iem)
|
||||
=> StructAssigner<short>(pstruct, count, iem);
|
||||
internal static void CKIDAssigner(IntPtr pstruct, uint count, IEnumerable<uint> iem)
|
||||
=> StructAssigner<uint>(pstruct, count, iem);
|
||||
internal static void CKDWORDAssigner(IntPtr pstruct, uint count, IEnumerable<uint> iem)
|
||||
=> StructAssigner<uint>(pstruct, count, iem);
|
||||
|
||||
private static IEnumerable<T> StructIterator<T>(IntPtr pstruct, uint count) {
|
||||
var stride = Marshal.SizeOf<T>();
|
||||
for (uint i = 0; i < count; ++i) {
|
||||
yield return Marshal.PtrToStructure<T>(pstruct);
|
||||
pstruct += stride;
|
||||
}
|
||||
}
|
||||
internal static IEnumerable<VxVector3> VxVector3Iterator(IntPtr pstruct, uint count)
|
||||
=> StructIterator<VxVector3>(pstruct, count);
|
||||
internal static IEnumerable<VxVector2> VxVector2Iterator(IntPtr pstruct, uint count)
|
||||
=> StructIterator<VxVector2>(pstruct, count);
|
||||
internal static IEnumerable<CKFaceIndices> CKFaceIndicesIterator(IntPtr pstruct, uint count)
|
||||
=> StructIterator<CKFaceIndices>(pstruct, count);
|
||||
internal static IEnumerable<CKShortFaceIndices> CKShortFaceIndicesIterator(IntPtr pstruct, uint count)
|
||||
=> StructIterator<CKShortFaceIndices>(pstruct, count);
|
||||
internal static IEnumerable<short> ShortIterator(IntPtr pstruct, uint count)
|
||||
=> StructIterator<short>(pstruct, count);
|
||||
internal static IEnumerable<uint> CKIDIterator(IntPtr pstruct, uint count)
|
||||
=> StructIterator<uint>(pstruct, count);
|
||||
internal static IEnumerable<uint> CKDWORDIterator(IntPtr pstruct, uint count)
|
||||
=> StructIterator<uint>(pstruct, count);
|
||||
|
||||
#endregion
|
||||
|
||||
#region End User Exposed
|
||||
|
||||
private static readonly BMapGuard Singleton = new BMapGuard();
|
||||
public static bool IsBMapAvailable() {
|
||||
return !Singleton.IsInvalid;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
// TODO: Maybe I need to implement IEquatable, IComparable<T>, and IComparable for AbstractPointer and AbstractCKObject.
|
||||
// But I give it up. I am lazy. What I have written barely works for me now.
|
||||
|
||||
public abstract class AbstractPointer : SafeHandle, IEquatable<AbstractPointer> {
|
||||
internal AbstractPointer(IntPtr raw_pointer) : base(Utils.INVALID_PTR, true) {
|
||||
this.handle = raw_pointer;
|
||||
}
|
||||
|
||||
public override bool IsInvalid => this.handle == Utils.INVALID_PTR;
|
||||
protected override bool ReleaseHandle() => throw new NotImplementedException();
|
||||
|
||||
internal bool isValid() => this.handle != Utils.INVALID_PTR;
|
||||
internal IntPtr getPointer() => this.handle;
|
||||
|
||||
#region IEquatable
|
||||
|
||||
public override bool Equals(object obj) => this.Equals(obj as AbstractPointer);
|
||||
public bool Equals(AbstractPointer obj) {
|
||||
if (obj is null) return false;
|
||||
// Optimization for a common success case
|
||||
if (Object.ReferenceEquals(this, obj)) return true;
|
||||
// If run-time types are not exactly the same, return false.
|
||||
if (this.GetType() != obj.GetType()) return false;
|
||||
// Return true if the fields match.
|
||||
return this.handle == obj.handle;
|
||||
}
|
||||
|
||||
public override int GetHashCode() => this.handle.GetHashCode();
|
||||
|
||||
public static bool operator ==(AbstractPointer lhs, AbstractPointer rhs) {
|
||||
if (lhs is null) {
|
||||
if (rhs is null) return true;
|
||||
// Only left side is null.
|
||||
return false;
|
||||
}
|
||||
// Equals handles case of null on right side
|
||||
return lhs.Equals(rhs);
|
||||
}
|
||||
public static bool operator !=(AbstractPointer lhs, AbstractPointer rhs) => !(lhs == rhs);
|
||||
|
||||
#endregion
|
||||
|
||||
#region Misc
|
||||
|
||||
public override string ToString() => this.handle.ToString();
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
public abstract class AbstractCKObject : SafeHandle, IEquatable<AbstractCKObject> {
|
||||
// Same as AbstractPointer, but not own this handle.
|
||||
internal AbstractCKObject(IntPtr raw_pointer, uint ckid) : base(Utils.INVALID_PTR, false) {
|
||||
this.handle = raw_pointer;
|
||||
m_CKID = ckid;
|
||||
}
|
||||
|
||||
public override bool IsInvalid => this.handle == Utils.INVALID_PTR;
|
||||
protected override bool ReleaseHandle() => throw new NotImplementedException();
|
||||
|
||||
private readonly uint m_CKID;
|
||||
internal bool isValid() => this.handle != Utils.INVALID_PTR && m_CKID != Utils.INVALID_CKID;
|
||||
internal IntPtr getPointer() => this.handle;
|
||||
internal uint getCKID() => m_CKID;
|
||||
|
||||
#region IEquatable
|
||||
|
||||
public override bool Equals(object obj) => this.Equals(obj as AbstractCKObject);
|
||||
public bool Equals(AbstractCKObject obj) {
|
||||
if (obj is null) return false;
|
||||
// Optimization for a common success case
|
||||
if (Object.ReferenceEquals(this, obj)) return true;
|
||||
// If run-time types are not exactly the same, return false.
|
||||
if (this.GetType() != obj.GetType()) return false;
|
||||
// Return true if the fields match.
|
||||
return (this.m_CKID == obj.m_CKID) && (this.handle == obj.handle);
|
||||
}
|
||||
|
||||
public override int GetHashCode() => HashCode.Combine(this.handle, m_CKID);
|
||||
|
||||
public static bool operator ==(AbstractCKObject lhs, AbstractCKObject rhs) {
|
||||
if (lhs is null) {
|
||||
if (rhs is null) return true;
|
||||
// Only left side is null.
|
||||
return false;
|
||||
}
|
||||
// Equals handles case of null on right side
|
||||
return lhs.Equals(rhs);
|
||||
}
|
||||
public static bool operator !=(AbstractCKObject lhs, AbstractCKObject rhs) => !(lhs == rhs);
|
||||
|
||||
#endregion
|
||||
|
||||
#region Misc
|
||||
|
||||
public override string ToString() => $"{this.handle}, {m_CKID}";
|
||||
|
||||
#endregion
|
||||
|
||||
#region Subclass Utilities
|
||||
|
||||
protected delegate bool FctGenericValueGetter<T>(IntPtr bmf, uint id, out T val);
|
||||
protected delegate bool FctGenericValueSetter<T>(IntPtr bmf, uint id, T val);
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
protected T getGenericValue<T>(FctGenericValueGetter<T> fct) {
|
||||
BMapException.ThrowIfFailed(fct(getPointer(), getCKID(), out T out_val));
|
||||
return out_val;
|
||||
}
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
protected void setGenericValue<T>(FctGenericValueSetter<T> fct, T val) {
|
||||
BMapException.ThrowIfFailed(fct(getPointer(), getCKID(), val));
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
public class BMObject : AbstractCKObject {
|
||||
internal BMObject(IntPtr raw_pointer, uint ckid) : base(raw_pointer, ckid) { }
|
||||
|
||||
public string GetName() => getGenericValue<string>(BMap.BMObject_GetName);
|
||||
public void SetName(string name) => setGenericValue<string>(BMap.BMObject_SetName, name);
|
||||
}
|
||||
|
||||
public class BMTexture : BMObject {
|
||||
internal BMTexture(IntPtr raw_pointer, uint ckid) : base(raw_pointer, ckid) { }
|
||||
|
||||
public string GetFileName() => getGenericValue<string>(BMap.BMTexture_GetFileName);
|
||||
|
||||
public void LoadImage(string filepath) {
|
||||
BMapException.ThrowIfFailed(BMap.BMTexture_LoadImage(getPointer(), getCKID(), filepath));
|
||||
}
|
||||
public void SaveImage(string filepath) {
|
||||
BMapException.ThrowIfFailed(BMap.BMTexture_SaveImage(getPointer(), getCKID(), filepath));
|
||||
}
|
||||
|
||||
public CK_TEXTURE_SAVEOPTIONS GetSaveOptions() => getGenericValue<CK_TEXTURE_SAVEOPTIONS>(BMap.BMTexture_GetSaveOptions);
|
||||
public void SetSaveOptions(CK_TEXTURE_SAVEOPTIONS opt) => setGenericValue<CK_TEXTURE_SAVEOPTIONS>(BMap.BMTexture_SetSaveOptions, opt);
|
||||
public VX_PIXELFORMAT GetVideoFormat() => getGenericValue<VX_PIXELFORMAT>(BMap.BMTexture_GetVideoFormat);
|
||||
public void SetVideoFormat(VX_PIXELFORMAT vfmt) => setGenericValue<VX_PIXELFORMAT>(BMap.BMTexture_SetVideoFormat, vfmt);
|
||||
}
|
||||
|
||||
public class BMMaterial : BMObject {
|
||||
internal BMMaterial(IntPtr raw_pointer, uint ckid) : base(raw_pointer, ckid) { }
|
||||
|
||||
public VxColor GetDiffuse() => getGenericValue<VxColor>(BMap.BMMaterial_GetDiffuse);
|
||||
public void SetDiffuse(VxColor col) => setGenericValue<VxColor>(BMap.BMMaterial_SetDiffuse, col);
|
||||
public VxColor GetAmbient() => getGenericValue<VxColor>(BMap.BMMaterial_GetAmbient);
|
||||
public void SetAmbient(VxColor col) => setGenericValue<VxColor>(BMap.BMMaterial_SetAmbient, col);
|
||||
public VxColor GetSpecular() => getGenericValue<VxColor>(BMap.BMMaterial_GetSpecular);
|
||||
public void SetSpecular(VxColor col) => setGenericValue<VxColor>(BMap.BMMaterial_SetSpecular, col);
|
||||
public VxColor GetEmissive() => getGenericValue<VxColor>(BMap.BMMaterial_GetEmissive);
|
||||
public void SetEmissive(VxColor col) => setGenericValue<VxColor>(BMap.BMMaterial_SetEmissive, col);
|
||||
|
||||
public float GetSpecularPower() => getGenericValue<float>(BMap.BMMaterial_GetSpecularPower);
|
||||
public void SetSpecularPower(float val) => setGenericValue<float>(BMap.BMMaterial_SetSpecularPower, val);
|
||||
|
||||
public VxColor GetTextureBorderColor() {
|
||||
BMapException.ThrowIfFailed(BMap.BMMaterial_GetTextureBorderColor(getPointer(), getCKID(), out uint out_val));
|
||||
return new VxColor(out_val);
|
||||
}
|
||||
public void SetTextureBorderColor(VxColor col) {
|
||||
BMapException.ThrowIfFailed(BMap.BMMaterial_SetTextureBorderColor(getPointer(), getCKID(), col.ToDword()));
|
||||
}
|
||||
|
||||
public VXTEXTURE_BLENDMODE GetTextureBlendMode() => getGenericValue<VXTEXTURE_BLENDMODE>(BMap.BMMaterial_GetTextureBlendMode);
|
||||
public void SetTextureBlendMode(VXTEXTURE_BLENDMODE val) => setGenericValue<VXTEXTURE_BLENDMODE>(BMap.BMMaterial_SetTextureBlendMode, val);
|
||||
public VXTEXTURE_FILTERMODE GetTextureMinMode() => getGenericValue<VXTEXTURE_FILTERMODE>(BMap.BMMaterial_GetTextureMinMode);
|
||||
public void SetTextureMinMode(VXTEXTURE_FILTERMODE val) => setGenericValue<VXTEXTURE_FILTERMODE>(BMap.BMMaterial_SetTextureMinMode, val);
|
||||
public VXTEXTURE_FILTERMODE GetTextureMagMode() => getGenericValue<VXTEXTURE_FILTERMODE>(BMap.BMMaterial_GetTextureMagMode);
|
||||
public void SetTextureMagMode(VXTEXTURE_FILTERMODE val) => setGenericValue<VXTEXTURE_FILTERMODE>(BMap.BMMaterial_SetTextureMagMode, val);
|
||||
public VXTEXTURE_ADDRESSMODE GetTextureAddressMode() => getGenericValue<VXTEXTURE_ADDRESSMODE>(BMap.BMMaterial_GetTextureAddressMode);
|
||||
public void SetTextureAddressMode(VXTEXTURE_ADDRESSMODE val) => setGenericValue<VXTEXTURE_ADDRESSMODE>(BMap.BMMaterial_SetTextureAddressMode, val);
|
||||
public VXBLEND_MODE GetSourceBlend() => getGenericValue<VXBLEND_MODE>(BMap.BMMaterial_GetSourceBlend);
|
||||
public void SetSourceBlend(VXBLEND_MODE val) => setGenericValue<VXBLEND_MODE>(BMap.BMMaterial_SetSourceBlend, val);
|
||||
public VXBLEND_MODE GetDestBlend() => getGenericValue<VXBLEND_MODE>(BMap.BMMaterial_GetDestBlend);
|
||||
public void SetDestBlend(VXBLEND_MODE val) => setGenericValue<VXBLEND_MODE>(BMap.BMMaterial_SetDestBlend, val);
|
||||
public VXFILL_MODE GetFillMode() => getGenericValue<VXFILL_MODE>(BMap.BMMaterial_GetFillMode);
|
||||
public void SetFillMode(VXFILL_MODE val) => setGenericValue<VXFILL_MODE>(BMap.BMMaterial_SetFillMode, val);
|
||||
public VXSHADE_MODE GetShadeMode() => getGenericValue<VXSHADE_MODE>(BMap.BMMaterial_GetShadeMode);
|
||||
public void SetShadeMode(VXSHADE_MODE val) => setGenericValue<VXSHADE_MODE>(BMap.BMMaterial_SetShadeMode, val);
|
||||
|
||||
public bool GetAlphaTestEnabled() => getGenericValue<bool>(BMap.BMMaterial_GetAlphaTestEnabled);
|
||||
public void SetAlphaTestEnabled(bool val) => setGenericValue<bool>(BMap.BMMaterial_SetAlphaTestEnabled, val);
|
||||
public bool GetAlphaBlendEnabled() => getGenericValue<bool>(BMap.BMMaterial_GetAlphaBlendEnabled);
|
||||
public void SetAlphaBlendEnabled(bool val) => setGenericValue<bool>(BMap.BMMaterial_SetAlphaBlendEnabled, val);
|
||||
public bool GetPerspectiveCorrectionEnabled() => getGenericValue<bool>(BMap.BMMaterial_GetPerspectiveCorrectionEnabled);
|
||||
public void SetPerspectiveCorrectionEnabled(bool val) => setGenericValue<bool>(BMap.BMMaterial_SetPerspectiveCorrectionEnabled, val);
|
||||
public bool GetZWriteEnabled() => getGenericValue<bool>(BMap.BMMaterial_GetZWriteEnabled);
|
||||
public void SetZWriteEnabled(bool val) => setGenericValue<bool>(BMap.BMMaterial_SetZWriteEnabled, val);
|
||||
public bool GetTwoSidedEnabled() => getGenericValue<bool>(BMap.BMMaterial_GetTwoSidedEnabled);
|
||||
public void SetTwoSidedEnabled(bool val) => setGenericValue<bool>(BMap.BMMaterial_SetTwoSidedEnabled, val);
|
||||
|
||||
public byte GetAlphaRef() => getGenericValue<byte>(BMap.BMMaterial_GetAlphaRef);
|
||||
public void SetAlphaRef(byte val) => setGenericValue<byte>(BMap.BMMaterial_SetAlphaRef, val);
|
||||
|
||||
public VXCMPFUNC GetAlphaFunc() => getGenericValue<VXCMPFUNC>(BMap.BMMaterial_GetAlphaFunc);
|
||||
public void SetAlphaFunc(VXCMPFUNC val) => setGenericValue<VXCMPFUNC>(BMap.BMMaterial_SetAlphaFunc, val);
|
||||
public VXCMPFUNC GetZFunc() => getGenericValue<VXCMPFUNC>(BMap.BMMaterial_GetZFunc);
|
||||
public void SetZFunc(VXCMPFUNC val) => setGenericValue<VXCMPFUNC>(BMap.BMMaterial_SetZFunc, val);
|
||||
|
||||
}
|
||||
|
||||
public class BMMesh : BMObject {
|
||||
internal BMMesh(IntPtr raw_pointer, uint ckid) : base(raw_pointer, ckid) { }
|
||||
|
||||
public VXMESH_LITMODE GetLitMode() => getGenericValue<VXMESH_LITMODE>(BMap.BMMesh_GetLitMode);
|
||||
public void SetLitMode(VXMESH_LITMODE mode) => setGenericValue<VXMESH_LITMODE>(BMap.BMMesh_SetLitMode, mode);
|
||||
|
||||
public uint GetVertexCount() => getGenericValue<uint>(BMap.BMMesh_GetVertexCount);
|
||||
public void SetVertexCount(uint count) => setGenericValue<uint>(BMap.BMMesh_SetVertexCount, count);
|
||||
public IEnumerable<VxVector3> GetVertexPositions() {
|
||||
BMapException.ThrowIfFailed(BMap.BMMesh_GetVertexPositions(getPointer(), getCKID(), out IntPtr out_mem));
|
||||
return Utils.VxVector3Iterator(out_mem, GetVertexCount());
|
||||
}
|
||||
public void SetVertexPositions(IEnumerable<VxVector3> iem) {
|
||||
BMapException.ThrowIfFailed(BMap.BMMesh_GetVertexPositions(getPointer(), getCKID(), out IntPtr out_mem));
|
||||
Utils.VxVector3Assigner(out_mem, GetVertexCount(), iem);
|
||||
}
|
||||
public IEnumerable<VxVector3> GetVertexNormals() {
|
||||
BMapException.ThrowIfFailed(BMap.BMMesh_GetVertexNormals(getPointer(), getCKID(), out IntPtr out_mem));
|
||||
return Utils.VxVector3Iterator(out_mem, GetVertexCount());
|
||||
}
|
||||
public void SetVertexNormals(IEnumerable<VxVector3> iem) {
|
||||
BMapException.ThrowIfFailed(BMap.BMMesh_GetVertexNormals(getPointer(), getCKID(), out IntPtr out_mem));
|
||||
Utils.VxVector3Assigner(out_mem, GetVertexCount(), iem);
|
||||
}
|
||||
public IEnumerable<VxVector2> GetVertexUVs() {
|
||||
BMapException.ThrowIfFailed(BMap.BMMesh_GetVertexUVs(getPointer(), getCKID(), out IntPtr out_mem));
|
||||
return Utils.VxVector2Iterator(out_mem, GetVertexCount());
|
||||
}
|
||||
public void SetVertexUVs(IEnumerable<VxVector2> iem) {
|
||||
BMapException.ThrowIfFailed(BMap.BMMesh_GetVertexUVs(getPointer(), getCKID(), out IntPtr out_mem));
|
||||
Utils.VxVector2Assigner(out_mem, GetVertexCount(), iem);
|
||||
}
|
||||
|
||||
public uint GetFaceCount() => getGenericValue<uint>(BMap.BMMesh_GetFaceCount);
|
||||
public void SetFaceCount(uint count) => setGenericValue<uint>(BMap.BMMesh_SetFaceCount, count);
|
||||
public IEnumerable<CKShortFaceIndices> GetFaceIndices() {
|
||||
BMapException.ThrowIfFailed(BMap.BMMesh_GetFaceIndices(getPointer(), getCKID(), out IntPtr out_mem));
|
||||
return Utils.CKShortFaceIndicesIterator(out_mem, GetFaceCount());
|
||||
}
|
||||
public void SetFaceIndices(IEnumerable<CKShortFaceIndices> iem) {
|
||||
BMapException.ThrowIfFailed(BMap.BMMesh_GetFaceIndices(getPointer(), getCKID(), out IntPtr out_mem));
|
||||
Utils.CKShortFaceIndicesAssigner(out_mem, GetFaceCount(), iem);
|
||||
}
|
||||
public IEnumerable<short> GetFaceMaterialSlotIndexs() {
|
||||
BMapException.ThrowIfFailed(BMap.BMMesh_GetFaceMaterialSlotIndexs(getPointer(), getCKID(), out IntPtr out_mem));
|
||||
return Utils.ShortIterator(out_mem, GetFaceCount());
|
||||
}
|
||||
public void SetFaceMaterialSlotIndexs(IEnumerable<short> iem) {
|
||||
BMapException.ThrowIfFailed(BMap.BMMesh_GetFaceMaterialSlotIndexs(getPointer(), getCKID(), out IntPtr out_mem));
|
||||
Utils.ShortAssigner(out_mem, GetFaceCount(), iem);
|
||||
}
|
||||
|
||||
public uint GetMaterialSlotCount() => getGenericValue<uint>(BMap.BMMesh_GetMaterialSlotCount);
|
||||
public void SetMaterialSlotCount(uint count) => setGenericValue<uint>(BMap.BMMesh_SetMaterialSlotCount, count);
|
||||
public IEnumerable<BMMaterial> GetMaterialSlots() {
|
||||
uint count = GetMaterialSlotCount();
|
||||
for (uint i = 0; i < count; ++i) {
|
||||
BMapException.ThrowIfFailed(BMap.BMMesh_GetMaterialSlot(getPointer(), getCKID(), i, out uint out_mtlid));
|
||||
if (out_mtlid == Utils.INVALID_CKID) yield return null;
|
||||
else yield return new BMMaterial(getPointer(), out_mtlid);
|
||||
}
|
||||
}
|
||||
public void SetMaterialSlots(IEnumerable<BMMaterial> iem) {
|
||||
uint count = GetMaterialSlotCount();
|
||||
var itor = iem.GetEnumerator();
|
||||
for (uint i = 0; i < count; ++i) {
|
||||
if (!itor.MoveNext()) throw new BMapException("The length of given material array is too short when assigning material slots.");
|
||||
uint mtlid = itor.Current is null ? Utils.INVALID_CKID : itor.Current.getCKID();
|
||||
BMapException.ThrowIfFailed(BMap.BMMesh_SetMaterialSlot(getPointer(), getCKID(), i, mtlid));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class BM3dEntity : BMObject {
|
||||
internal BM3dEntity(IntPtr raw_pointer, uint ckid) : base(raw_pointer, ckid) { }
|
||||
|
||||
public VxMatrix GetWorldMatrix() => getGenericValue<VxMatrix>(BMap.BM3dEntity_GetWorldMatrix);
|
||||
public void SetWorldMatrix(VxMatrix mat) => setGenericValue<VxMatrix>(BMap.BM3dEntity_SetWorldMatrix, mat);
|
||||
|
||||
public BMMesh GetCurrentMesh() {
|
||||
BMapException.ThrowIfFailed(BMap.BM3dEntity_GetCurrentMesh(getPointer(), getCKID(), out uint out_meshid));
|
||||
if (out_meshid == Utils.INVALID_CKID) return null;
|
||||
else return new BMMesh(getPointer(), out_meshid);
|
||||
}
|
||||
public void SetCurrentMesh(BMMesh mesh) {
|
||||
uint meshid = (mesh is null) ? Utils.INVALID_CKID : mesh.getCKID();
|
||||
BMapException.ThrowIfFailed(BMap.BM3dEntity_SetCurrentMesh(getPointer(), getCKID(), meshid));
|
||||
}
|
||||
|
||||
public bool GetVisibility() => getGenericValue<bool>(BMap.BM3dEntity_GetVisibility);
|
||||
public void SetVisibility(bool visb) => setGenericValue<bool>(BMap.BM3dEntity_SetVisibility, visb);
|
||||
}
|
||||
|
||||
public class BM3dObject : BM3dEntity {
|
||||
internal BM3dObject(IntPtr raw_pointer, uint ckid) : base(raw_pointer, ckid) { }
|
||||
}
|
||||
|
||||
public class BMLight : BM3dEntity {
|
||||
internal BMLight(IntPtr raw_pointer, uint ckid) : base(raw_pointer, ckid) { }
|
||||
|
||||
// Name `GetType` is conflict with C# base class function name.
|
||||
// So we add a `Light` prefix for it.
|
||||
public VXLIGHT_TYPE GetLightType() => getGenericValue<VXLIGHT_TYPE>(BMap.BMLight_GetType);
|
||||
public void SetLightType(VXLIGHT_TYPE val) => setGenericValue<VXLIGHT_TYPE>(BMap.BMLight_SetType, val);
|
||||
|
||||
public VxColor GetColor() => getGenericValue<VxColor>(BMap.BMLight_GetColor);
|
||||
public void SetColor(VxColor col) => setGenericValue<VxColor>(BMap.BMLight_SetColor, col);
|
||||
|
||||
public float GetConstantAttenuation() => getGenericValue<float>(BMap.BMLight_GetConstantAttenuation);
|
||||
public void SetConstantAttenuation(float val) => setGenericValue<float>(BMap.BMLight_SetConstantAttenuation, val);
|
||||
public float GetLinearAttenuation() => getGenericValue<float>(BMap.BMLight_GetLinearAttenuation);
|
||||
public void SetLinearAttenuation(float val) => setGenericValue<float>(BMap.BMLight_SetLinearAttenuation, val);
|
||||
public float GetQuadraticAttenuation() => getGenericValue<float>(BMap.BMLight_GetQuadraticAttenuation);
|
||||
public void SetQuadraticAttenuation(float val) => setGenericValue<float>(BMap.BMLight_SetQuadraticAttenuation, val);
|
||||
|
||||
public float GetRange() => getGenericValue<float>(BMap.BMLight_GetRange);
|
||||
public void SetRange(float val) => setGenericValue<float>(BMap.BMLight_SetRange, val);
|
||||
|
||||
public float GetHotSpot() => getGenericValue<float>(BMap.BMLight_GetHotSpot);
|
||||
public void SetHotSpot(float val) => setGenericValue<float>(BMap.BMLight_SetHotSpot, val);
|
||||
public float GetFalloff() => getGenericValue<float>(BMap.BMLight_GetFalloff);
|
||||
public void SetFalloff(float val) => setGenericValue<float>(BMap.BMLight_SetFalloff, val);
|
||||
public float GetFalloffShape() => getGenericValue<float>(BMap.BMLight_GetFalloffShape);
|
||||
public void SetFalloffShape(float val) => setGenericValue<float>(BMap.BMLight_SetFalloffShape, val);
|
||||
}
|
||||
|
||||
public class BMTargetLight : BMLight {
|
||||
internal BMTargetLight(IntPtr raw_pointer, uint ckid) : base(raw_pointer, ckid) { }
|
||||
}
|
||||
|
||||
public class BMGroup : BMObject {
|
||||
internal BMGroup(IntPtr raw_pointer, uint ckid) : base(raw_pointer, ckid) { }
|
||||
|
||||
public void AddObject(BM3dObject member) {
|
||||
BMapException.ThrowIfFailed(BMap.BMGroup_AddObject(getPointer(), getCKID(), member.getCKID()));
|
||||
}
|
||||
|
||||
public uint GetObjectCount() => getGenericValue<uint>(BMap.BMGroup_GetObjectCount);
|
||||
public IEnumerable<BM3dObject> GetObjects() {
|
||||
var size = GetObjectCount();
|
||||
for (uint i = 0; i < size; ++i) {
|
||||
BMapException.ThrowIfFailed(BMap.BMGroup_GetObject(getPointer(), getCKID(), i, out uint out_objid));
|
||||
yield return new BM3dObject(getPointer(), out_objid);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class BMFileReader : AbstractPointer {
|
||||
private static IntPtr allocateHandle(string file_name, string temp_folder, string texture_folder, string[] encodings) {
|
||||
BMapException.ThrowIfFailed(BMap.BMFile_Load(
|
||||
file_name, temp_folder, texture_folder,
|
||||
Utils.BMapSharpCallback,
|
||||
(uint)encodings.Length, encodings,
|
||||
out IntPtr out_file
|
||||
));
|
||||
return out_file;
|
||||
}
|
||||
protected override bool ReleaseHandle() {
|
||||
return BMap.BMFile_Free(this.getPointer());
|
||||
}
|
||||
public BMFileReader(string file_name, string temp_folder, string texture_folder, string[] encodings)
|
||||
: base(allocateHandle(file_name, temp_folder, texture_folder, encodings)) { }
|
||||
|
||||
private delegate bool FctProtoGetCount(IntPtr bmf, out uint cnt);
|
||||
private delegate bool FctProtoGetObject(IntPtr bmf, uint idx, out uint id);
|
||||
private delegate T FctProtoCreateInstance<T>(IntPtr bmf, uint id);
|
||||
private uint getCKObjectCount(FctProtoGetCount fct_cnt) {
|
||||
BMapException.ThrowIfFailed(fct_cnt(this.getPointer(), out uint out_count));
|
||||
return out_count;
|
||||
}
|
||||
private IEnumerable<T> getCKObjects<T>(FctProtoGetCount fct_cnt, FctProtoGetObject fct_obj, FctProtoCreateInstance<T> fct_crt) {
|
||||
uint count = getCKObjectCount(fct_cnt);
|
||||
for (uint i = 0; i < count; ++i) {
|
||||
BMapException.ThrowIfFailed(fct_obj(this.getPointer(), i, out uint out_id));
|
||||
yield return fct_crt(this.getPointer(), out_id);
|
||||
}
|
||||
}
|
||||
|
||||
public uint GetTextureCount() =>
|
||||
getCKObjectCount(BMap.BMFile_GetTextureCount);
|
||||
public IEnumerable<BMTexture> GetTextures() =>
|
||||
getCKObjects<BMTexture>(BMap.BMFile_GetTextureCount, BMap.BMFile_GetTexture, (bmf, id) => new BMTexture(bmf, id));
|
||||
public uint GetMaterialCount() =>
|
||||
getCKObjectCount(BMap.BMFile_GetMaterialCount);
|
||||
public IEnumerable<BMMaterial> GetMaterials() =>
|
||||
getCKObjects<BMMaterial>(BMap.BMFile_GetMaterialCount, BMap.BMFile_GetMaterial, (bmf, id) => new BMMaterial(bmf, id));
|
||||
public uint GetMeshCount() =>
|
||||
getCKObjectCount(BMap.BMFile_GetMeshCount);
|
||||
public IEnumerable<BMMesh> GetMeshes() =>
|
||||
getCKObjects<BMMesh>(BMap.BMFile_GetMeshCount, BMap.BMFile_GetMesh, (bmf, id) => new BMMesh(bmf, id));
|
||||
public uint Get3dObjectCount() =>
|
||||
getCKObjectCount(BMap.BMFile_Get3dObjectCount);
|
||||
public IEnumerable<BM3dObject> Get3dObjects() =>
|
||||
getCKObjects<BM3dObject>(BMap.BMFile_Get3dObjectCount, BMap.BMFile_Get3dObject, (bmf, id) => new BM3dObject(bmf, id));
|
||||
public uint GetGroupCount() =>
|
||||
getCKObjectCount(BMap.BMFile_GetGroupCount);
|
||||
public IEnumerable<BMGroup> GetGroups() =>
|
||||
getCKObjects<BMGroup>(BMap.BMFile_GetGroupCount, BMap.BMFile_GetGroup, (bmf, id) => new BMGroup(bmf, id));
|
||||
public uint GetTargetLightCount() =>
|
||||
getCKObjectCount(BMap.BMFile_GetTargetLightCount);
|
||||
public IEnumerable<BMTargetLight> GetTargetLights() =>
|
||||
getCKObjects<BMTargetLight>(BMap.BMFile_GetTargetLightCount, BMap.BMFile_GetTargetLight, (bmf, id) => new BMTargetLight(bmf, id));
|
||||
|
||||
}
|
||||
|
||||
public sealed class BMFileWriter : AbstractPointer {
|
||||
private static IntPtr allocateHandle(string temp_folder, string texture_folder, string[] encodings) {
|
||||
BMapException.ThrowIfFailed(BMap.BMFile_Create(
|
||||
temp_folder, texture_folder,
|
||||
Utils.BMapSharpCallback,
|
||||
(uint)encodings.Length, encodings,
|
||||
out IntPtr out_file
|
||||
));
|
||||
return out_file;
|
||||
}
|
||||
protected override bool ReleaseHandle() {
|
||||
return BMap.BMFile_Free(this.getPointer());
|
||||
}
|
||||
public BMFileWriter(string temp_folder, string texture_folder, string[] encodings)
|
||||
: base(allocateHandle(temp_folder, texture_folder, encodings)) { }
|
||||
|
||||
public void Save(string filename, CK_TEXTURE_SAVEOPTIONS texture_save_opt, bool use_compress, int compress_level) {
|
||||
BMapException.ThrowIfFailed(BMap.BMFile_Save(
|
||||
getPointer(),
|
||||
filename,
|
||||
texture_save_opt,
|
||||
use_compress,
|
||||
compress_level
|
||||
));
|
||||
}
|
||||
|
||||
private delegate bool FctProtoCreateObject(IntPtr bmf, out uint id);
|
||||
private delegate T FctProtoCreateInstance<T>(IntPtr bmf, uint id);
|
||||
private T createCKObject<T>(FctProtoCreateObject fct_crt, FctProtoCreateInstance<T> fct_inst) {
|
||||
BMapException.ThrowIfFailed(fct_crt(this.getPointer(), out uint out_id));
|
||||
return fct_inst(this.getPointer(), out_id);
|
||||
}
|
||||
|
||||
public BMTexture CreateTexture() => createCKObject<BMTexture>(BMap.BMFile_CreateTexture, (bmf, id) => new BMTexture(bmf, id));
|
||||
public BMMaterial CreateMaterial() => createCKObject<BMMaterial>(BMap.BMFile_CreateMaterial, (bmf, id) => new BMMaterial(bmf, id));
|
||||
public BMMesh CreateMesh() => createCKObject<BMMesh>(BMap.BMFile_CreateMesh, (bmf, id) => new BMMesh(bmf, id));
|
||||
public BM3dObject Create3dObject() => createCKObject<BM3dObject>(BMap.BMFile_Create3dObject, (bmf, id) => new BM3dObject(bmf, id));
|
||||
public BMGroup CreateGroup() => createCKObject<BMGroup>(BMap.BMFile_CreateGroup, (bmf, id) => new BMGroup(bmf, id));
|
||||
public BMTargetLight CreateTargetLight() => createCKObject<BMTargetLight>(BMap.BMFile_CreateTargetLight, (bmf, id) => new BMTargetLight(bmf, id));
|
||||
}
|
||||
|
||||
public sealed class BMMeshTrans : AbstractPointer {
|
||||
private static IntPtr allocateHandle() {
|
||||
BMapException.ThrowIfFailed(BMap.BMMeshTrans_New(out IntPtr out_trans));
|
||||
return out_trans;
|
||||
}
|
||||
protected override bool ReleaseHandle() {
|
||||
return BMap.BMMeshTrans_Delete(this.getPointer());
|
||||
}
|
||||
public BMMeshTrans() : base(allocateHandle()) { }
|
||||
|
||||
public void Parse(BMMesh objmesh) {
|
||||
BMapException.ThrowIfFailed(BMap.BMMeshTrans_Parse(
|
||||
getPointer(),
|
||||
objmesh.getPointer(),
|
||||
objmesh.getCKID()
|
||||
));
|
||||
}
|
||||
|
||||
public void PrepareVertex(uint count, IEnumerable<VxVector3> iem) {
|
||||
// Prepare count first
|
||||
BMapException.ThrowIfFailed(BMap.BMMeshTrans_PrepareVertexCount(getPointer(), count));
|
||||
// Then put data
|
||||
BMapException.ThrowIfFailed(BMap.BMMeshTrans_PrepareVertex(getPointer(), out IntPtr out_mem));
|
||||
Utils.VxVector3Assigner(out_mem, count, iem);
|
||||
}
|
||||
public void PrepareNormal(uint count, IEnumerable<VxVector3> iem) {
|
||||
// Prepare count first
|
||||
BMapException.ThrowIfFailed(BMap.BMMeshTrans_PrepareNormalCount(getPointer(), count));
|
||||
// Then put data
|
||||
BMapException.ThrowIfFailed(BMap.BMMeshTrans_PrepareNormal(getPointer(), out IntPtr out_mem));
|
||||
Utils.VxVector3Assigner(out_mem, count, iem);
|
||||
}
|
||||
public void PrepareUV(uint count, IEnumerable<VxVector2> iem) {
|
||||
// Prepare count first
|
||||
BMapException.ThrowIfFailed(BMap.BMMeshTrans_PrepareUVCount(getPointer(), count));
|
||||
// Then put data
|
||||
BMapException.ThrowIfFailed(BMap.BMMeshTrans_PrepareUV(getPointer(), out IntPtr out_mem));
|
||||
Utils.VxVector2Assigner(out_mem, count, iem);
|
||||
}
|
||||
|
||||
public void PrepareMtlSlot(uint count, IEnumerable<BMMaterial> iem) {
|
||||
// Prepare count first
|
||||
BMapException.ThrowIfFailed(BMap.BMMeshTrans_PrepareMtlSlotCount(getPointer(), count));
|
||||
// Then put data
|
||||
BMapException.ThrowIfFailed(BMap.BMMeshTrans_PrepareMtlSlot(getPointer(), out IntPtr out_mem));
|
||||
var cast_iem = iem.Select((mtl) => mtl is null ? Utils.INVALID_CKID : mtl.getCKID());
|
||||
Utils.CKIDAssigner(out_mem, count, cast_iem);
|
||||
}
|
||||
|
||||
public void PrepareFace(uint count, IEnumerable<CKFaceIndices> vec_idx, IEnumerable<CKFaceIndices> nml_idx, IEnumerable<CKFaceIndices> uv_idx, IEnumerable<uint> mtl_idx) {
|
||||
// Prepare count first
|
||||
BMapException.ThrowIfFailed(BMap.BMMeshTrans_PrepareFaceCount(getPointer(), count));
|
||||
// Get data address
|
||||
BMapException.ThrowIfFailed(BMap.BMMeshTrans_PrepareFaceVertexIndices(getPointer(), out IntPtr raw_vec_idx));
|
||||
BMapException.ThrowIfFailed(BMap.BMMeshTrans_PrepareFaceNormalIndices(getPointer(), out IntPtr raw_nml_idx));
|
||||
BMapException.ThrowIfFailed(BMap.BMMeshTrans_PrepareFaceUVIndices(getPointer(), out IntPtr raw_uv_idx));
|
||||
BMapException.ThrowIfFailed(BMap.BMMeshTrans_PrepareFaceMtlSlot(getPointer(), out IntPtr raw_mtl_idx));
|
||||
// Assign data
|
||||
Utils.CKFaceIndicesAssigner(raw_vec_idx, count, vec_idx);
|
||||
Utils.CKFaceIndicesAssigner(raw_nml_idx, count, nml_idx);
|
||||
Utils.CKFaceIndicesAssigner(raw_uv_idx, count, uv_idx);
|
||||
Utils.CKDWORDAssigner(raw_mtl_idx, count, mtl_idx);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
311
Assets/BMapBindings/BMapSharp/BMapSharp/VirtoolsTypes.cs
Normal file
311
Assets/BMapBindings/BMapSharp/BMapSharp/VirtoolsTypes.cs
Normal file
@@ -0,0 +1,311 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Numerics;
|
||||
|
||||
namespace BMapSharp.VirtoolsTypes {
|
||||
|
||||
// NOTE: Structures defined in there is only served for marshaling.
|
||||
// You should not use them in hash set or anything else,
|
||||
// because they do not have proper hash function and compare function.
|
||||
// You should use the managed type generated by them instead.
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 4, CharSet = CharSet.Ansi)]
|
||||
public struct VxVector2 {
|
||||
[MarshalAs(UnmanagedType.R4)]
|
||||
public float X, Y;
|
||||
|
||||
public VxVector2(float _x = 0.0f, float _y = 0.0f) {
|
||||
X = _x; Y = _y;
|
||||
}
|
||||
public VxVector2(Vector2 vec) {
|
||||
FromManaged(vec);
|
||||
}
|
||||
|
||||
public void FromManaged(Vector2 vec) {
|
||||
X = vec.X; Y = vec.Y;
|
||||
}
|
||||
public Vector2 ToManaged() {
|
||||
return new Vector2(X, Y);
|
||||
}
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 4, CharSet = CharSet.Ansi)]
|
||||
public struct VxVector3 {
|
||||
[MarshalAs(UnmanagedType.R4)]
|
||||
public float X, Y, Z;
|
||||
|
||||
public VxVector3(float _x = 0.0f, float _y = 0.0f, float _z = 0.0f) {
|
||||
X = _x; Y = _y; Z = _z;
|
||||
}
|
||||
public VxVector3(Vector3 vec) {
|
||||
FromManaged(vec);
|
||||
}
|
||||
|
||||
public void FromManaged(Vector3 vec) {
|
||||
X = vec.X; Y = vec.Y; Z = vec.Z;
|
||||
}
|
||||
public Vector3 ToManaged() {
|
||||
return new Vector3(X, Y, Z);
|
||||
}
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 4, CharSet = CharSet.Ansi)]
|
||||
public struct VxColor {
|
||||
[MarshalAs(UnmanagedType.R4)]
|
||||
public float R, G, B, A;
|
||||
|
||||
public VxColor(float _r, float _g, float _b, float _a) {
|
||||
A = _a; R = _r; G = _g; B = _b;
|
||||
Regulate();
|
||||
}
|
||||
public VxColor(Vector4 col) {
|
||||
FromManagedRGBA(col);
|
||||
}
|
||||
public VxColor(Vector3 col) {
|
||||
FromManagedRGB(col);
|
||||
}
|
||||
public VxColor(uint val) {
|
||||
FromDword(val);
|
||||
}
|
||||
|
||||
public void FromManagedRGBA(Vector4 col) {
|
||||
R = col.X; G = col.Y; B = col.Z; A = col.W;
|
||||
Regulate();
|
||||
}
|
||||
public Vector4 ToManagedRGBA() {
|
||||
return new Vector4(R, G, B, A);
|
||||
}
|
||||
public void FromManagedRGB(Vector3 col) {
|
||||
R = col.X; G = col.Y; B = col.Z; A = 1.0f;
|
||||
Regulate();
|
||||
}
|
||||
public Vector3 ToManagedRGB() {
|
||||
return new Vector3(R, G, B);
|
||||
}
|
||||
public void FromDword(uint val) {
|
||||
B = (val & 0xFFu) / 255.0f;
|
||||
val >>= 8;
|
||||
G = (val & 0xFFu) / 255.0f;
|
||||
val >>= 8;
|
||||
R = (val & 0xFFu) / 255.0f;
|
||||
val >>= 8;
|
||||
A = (val & 0xFFu) / 255.0f;
|
||||
}
|
||||
public uint ToDword() {
|
||||
// regulate self first
|
||||
Regulate();
|
||||
// build result
|
||||
uint val = 0u;
|
||||
val |= (uint)(A * 255.0f);
|
||||
val <<= 8;
|
||||
val |= (uint)(R * 255.0f);
|
||||
val <<= 8;
|
||||
val |= (uint)(G * 255.0f);
|
||||
val <<= 8;
|
||||
val |= (uint)(B * 255.0f);
|
||||
return val;
|
||||
}
|
||||
|
||||
public static float ClampFactor(float factor) {
|
||||
return System.Math.Clamp(factor, 0.0f, 1.0f);
|
||||
}
|
||||
public void Regulate() {
|
||||
A = ClampFactor(A);
|
||||
R = ClampFactor(R);
|
||||
G = ClampFactor(G);
|
||||
B = ClampFactor(B);
|
||||
}
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 4, CharSet = CharSet.Ansi)]
|
||||
public struct VxMatrix {
|
||||
[MarshalAs(UnmanagedType.R4)]
|
||||
public float M11, M12, M13, M14;
|
||||
[MarshalAs(UnmanagedType.R4)]
|
||||
public float M21, M22, M23, M24;
|
||||
[MarshalAs(UnmanagedType.R4)]
|
||||
public float M31, M32, M33, M34;
|
||||
[MarshalAs(UnmanagedType.R4)]
|
||||
public float M41, M42, M43, M44;
|
||||
|
||||
public VxMatrix(float m11 = 1.0f, float m12 = 0.0f, float m13 = 0.0f, float m14 = 0.0f,
|
||||
float m21 = 0.0f, float m22 = 1.0f, float m23 = 0.0f, float m24 = 0.0f,
|
||||
float m31 = 0.0f, float m32 = 0.0f, float m33 = 1.0f, float m34 = 0.0f,
|
||||
float m41 = 0.0f, float m42 = 0.0f, float m43 = 0.0f, float m44 = 1.0f) {
|
||||
M11 = m11; M12 = m12; M13 = m13; M14 = m14;
|
||||
M21 = m21; M22 = m22; M23 = m23; M24 = m24;
|
||||
M31 = m31; M32 = m32; M33 = m33; M34 = m34;
|
||||
M41 = m41; M42 = m42; M43 = m43; M44 = m44;
|
||||
}
|
||||
public void Reset() {
|
||||
M11 = 1.0f; M12 = 0.0f; M13 = 0.0f; M14 = 0.0f;
|
||||
M21 = 0.0f; M22 = 1.0f; M23 = 0.0f; M24 = 0.0f;
|
||||
M31 = 0.0f; M32 = 0.0f; M33 = 1.0f; M34 = 0.0f;
|
||||
M41 = 0.0f; M42 = 0.0f; M43 = 0.0f; M44 = 1.0f;
|
||||
}
|
||||
public void FromManaged(Matrix4x4 mat) {
|
||||
M11 = mat.M11; M12 = mat.M12; M13 = mat.M13; M14 = mat.M14;
|
||||
M21 = mat.M21; M22 = mat.M22; M23 = mat.M23; M24 = mat.M24;
|
||||
M31 = mat.M31; M32 = mat.M32; M33 = mat.M33; M34 = mat.M34;
|
||||
M41 = mat.M41; M42 = mat.M42; M43 = mat.M43; M44 = mat.M44;
|
||||
}
|
||||
public Matrix4x4 ToManaged() {
|
||||
return new Matrix4x4(
|
||||
M11, M12, M13, M14,
|
||||
M21, M22, M23, M24,
|
||||
M31, M32, M33, M34,
|
||||
M41, M42, M43, M44
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 4, CharSet = CharSet.Ansi)]
|
||||
public struct CKFaceIndices {
|
||||
[MarshalAs(UnmanagedType.U4)]
|
||||
public uint I1, I2, I3;
|
||||
|
||||
public CKFaceIndices(uint i1 = 0u, uint i2 = 0u, uint i3 = 0u) {
|
||||
I1 = i1;
|
||||
I2 = i2;
|
||||
I3 = i3;
|
||||
}
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 4, CharSet = CharSet.Ansi)]
|
||||
public struct CKShortFaceIndices {
|
||||
[MarshalAs(UnmanagedType.U2)]
|
||||
public ushort I1, I2, I3;
|
||||
|
||||
public CKShortFaceIndices(ushort i1 = 0, ushort i2 = 0, ushort i3 = 0) {
|
||||
I1 = i1;
|
||||
I2 = i2;
|
||||
I3 = i3;
|
||||
}
|
||||
}
|
||||
|
||||
public enum CK_TEXTURE_SAVEOPTIONS : uint {
|
||||
CKTEXTURE_RAWDATA = 0, /**< Save raw data inside file. The bitmap is saved in a raw 32 bit per pixel format. */
|
||||
CKTEXTURE_EXTERNAL = 1, /**< Store only the file name for the texture. The bitmap file must be present in the bitmap paths when loading the composition. */
|
||||
CKTEXTURE_IMAGEFORMAT = 2, /**< Save using format specified. The bitmap data will be converted to the specified format by the correspondant bitmap plugin and saved inside file. */
|
||||
CKTEXTURE_USEGLOBAL = 3, /**< Use Global settings, that is the settings given with CKContext::SetGlobalImagesSaveOptions. (Not valid when using CKContext::SetImagesSaveOptions). */
|
||||
CKTEXTURE_INCLUDEORIGINALFILE = 4, /**< Insert original image file inside CMO file. The bitmap file that was used originally for the texture or sprite will be append to the composition file and extracted when the file is loaded. */
|
||||
}
|
||||
|
||||
public enum VX_PIXELFORMAT : uint {
|
||||
UNKNOWN_PF = 0, /**< Unknown pixel format */
|
||||
_32_ARGB8888 = 1, /**< 32-bit ARGB pixel format with alpha */
|
||||
_32_RGB888 = 2, /**< 32-bit RGB pixel format without alpha */
|
||||
_24_RGB888 = 3, /**< 24-bit RGB pixel format */
|
||||
_16_RGB565 = 4, /**< 16-bit RGB pixel format */
|
||||
_16_RGB555 = 5, /**< 16-bit RGB pixel format (5 bits per color) */
|
||||
_16_ARGB1555 = 6, /**< 16-bit ARGB pixel format (5 bits per color + 1 bit for alpha) */
|
||||
_16_ARGB4444 = 7, /**< 16-bit ARGB pixel format (4 bits per color) */
|
||||
_8_RGB332 = 8, /**< 8-bit RGB pixel format */
|
||||
_8_ARGB2222 = 9, /**< 8-bit ARGB pixel format */
|
||||
_32_ABGR8888 = 10, /**< 32-bit ABGR pixel format */
|
||||
_32_RGBA8888 = 11, /**< 32-bit RGBA pixel format */
|
||||
_32_BGRA8888 = 12, /**< 32-bit BGRA pixel format */
|
||||
_32_BGR888 = 13, /**< 32-bit BGR pixel format */
|
||||
_24_BGR888 = 14, /**< 24-bit BGR pixel format */
|
||||
_16_BGR565 = 15, /**< 16-bit BGR pixel format */
|
||||
_16_BGR555 = 16, /**< 16-bit BGR pixel format (5 bits per color) */
|
||||
_16_ABGR1555 = 17, /**< 16-bit ABGR pixel format (5 bits per color + 1 bit for alpha) */
|
||||
_16_ABGR4444 = 18, /**< 16-bit ABGR pixel format (4 bits per color) */
|
||||
_DXT1 = 19, /**< S3/DirectX Texture Compression 1 */
|
||||
_DXT2 = 20, /**< S3/DirectX Texture Compression 2 */
|
||||
_DXT3 = 21, /**< S3/DirectX Texture Compression 3 */
|
||||
_DXT4 = 22, /**< S3/DirectX Texture Compression 4 */
|
||||
_DXT5 = 23, /**< S3/DirectX Texture Compression 5 */
|
||||
_16_V8U8 = 24, /**< 16-bit Bump Map format format (8 bits per color) */
|
||||
_32_V16U16 = 25, /**< 32-bit Bump Map format format (16 bits per color) */
|
||||
_16_L6V5U5 = 26, /**< 16-bit Bump Map format format with luminance */
|
||||
_32_X8L8V8U8 = 27, /**< 32-bit Bump Map format format with luminance */
|
||||
_8_ABGR8888_CLUT = 28, /**< 8 bits indexed CLUT (ABGR) */
|
||||
_8_ARGB8888_CLUT = 29, /**< 8 bits indexed CLUT (ARGB) */
|
||||
_4_ABGR8888_CLUT = 30, /**< 4 bits indexed CLUT (ABGR) */
|
||||
_4_ARGB8888_CLUT = 31, /**< 4 bits indexed CLUT (ARGB) */
|
||||
}
|
||||
|
||||
public enum VXLIGHT_TYPE : uint {
|
||||
VX_LIGHTPOINT = 1, /**< The Light is a point of light */
|
||||
VX_LIGHTSPOT = 2, /**< The light is a spotlight */
|
||||
VX_LIGHTDIREC = 3, /**< The light is directional light : Lights comes from an infinite point so only direction of light can be given */
|
||||
// VX_LIGHTPARA = 4UL, /**< Obsolete, do not use */
|
||||
}
|
||||
|
||||
public enum VXTEXTURE_BLENDMODE : uint {
|
||||
VXTEXTUREBLEND_DECAL = 1, /**< Texture replace any material information */
|
||||
VXTEXTUREBLEND_MODULATE = 2, /**< Texture and material are combine. Alpha information of the texture replace material alpha component. */
|
||||
VXTEXTUREBLEND_DECALALPHA = 3, /**< Alpha information in the texture specify how material and texture are combined. Alpha information of the texture replace material alpha component. */
|
||||
VXTEXTUREBLEND_MODULATEALPHA = 4, /**< Alpha information in the texture specify how material and texture are combined */
|
||||
VXTEXTUREBLEND_DECALMASK = 5,
|
||||
VXTEXTUREBLEND_MODULATEMASK = 6,
|
||||
VXTEXTUREBLEND_COPY = 7, /**< Equivalent to DECAL */
|
||||
VXTEXTUREBLEND_ADD = 8,
|
||||
VXTEXTUREBLEND_DOTPRODUCT3 = 9, /**< Perform a Dot Product 3 between texture (normal map) and a referential vector given in VXRENDERSTATE_TEXTUREFACTOR. */
|
||||
VXTEXTUREBLEND_MAX = 10,
|
||||
}
|
||||
|
||||
public enum VXTEXTURE_FILTERMODE : uint {
|
||||
VXTEXTUREFILTER_NEAREST = 1, /**< No Filter */
|
||||
VXTEXTUREFILTER_LINEAR = 2, /**< Bilinear Interpolation */
|
||||
VXTEXTUREFILTER_MIPNEAREST = 3, /**< Mip mapping */
|
||||
VXTEXTUREFILTER_MIPLINEAR = 4, /**< Mip Mapping with Bilinear interpolation */
|
||||
VXTEXTUREFILTER_LINEARMIPNEAREST = 5, /**< Mip Mapping with Bilinear interpolation between mipmap levels. */
|
||||
VXTEXTUREFILTER_LINEARMIPLINEAR = 6, /**< Trilinear Filtering */
|
||||
VXTEXTUREFILTER_ANISOTROPIC = 7, /**< Anisotropic filtering */
|
||||
}
|
||||
|
||||
public enum VXTEXTURE_ADDRESSMODE : uint {
|
||||
VXTEXTURE_ADDRESSWRAP = 1, /**< Default mesh wrap mode is used (see CKMesh::SetWrapMode) */
|
||||
VXTEXTURE_ADDRESSMIRROR = 2, /**< Texture coordinates outside the range [0..1] are flipped evenly. */
|
||||
VXTEXTURE_ADDRESSCLAMP = 3, /**< Texture coordinates greater than 1.0 are set to 1.0, and values less than 0.0 are set to 0.0. */
|
||||
VXTEXTURE_ADDRESSBORDER = 4, /**< When texture coordinates are greater than 1.0 or less than 0.0 texture is set to a color defined in CKMaterial::SetTextureBorderColor. */
|
||||
VXTEXTURE_ADDRESSMIRRORONCE = 5, /**< */
|
||||
}
|
||||
|
||||
public enum VXBLEND_MODE : uint {
|
||||
VXBLEND_ZERO = 1, /**< Blend factor is (0, 0, 0, 0). */
|
||||
VXBLEND_ONE = 2, /**< Blend factor is (1, 1, 1, 1). */
|
||||
VXBLEND_SRCCOLOR = 3, /**< Blend factor is (Rs, Gs, Bs, As). */
|
||||
VXBLEND_INVSRCCOLOR = 4, /**< Blend factor is (1-Rs, 1-Gs, 1-Bs, 1-As). */
|
||||
VXBLEND_SRCALPHA = 5, /**< Blend factor is (As, As, As, As). */
|
||||
VXBLEND_INVSRCALPHA = 6, /**< Blend factor is (1-As, 1-As, 1-As, 1-As). */
|
||||
VXBLEND_DESTALPHA = 7, /**< Blend factor is (Ad, Ad, Ad, Ad). */
|
||||
VXBLEND_INVDESTALPHA = 8, /**< Blend factor is (1-Ad, 1-Ad, 1-Ad, 1-Ad). */
|
||||
VXBLEND_DESTCOLOR = 9, /**< Blend factor is (Rd, Gd, Bd, Ad). */
|
||||
VXBLEND_INVDESTCOLOR = 10, /**< Blend factor is (1-Rd, 1-Gd, 1-Bd, 1-Ad). */
|
||||
VXBLEND_SRCALPHASAT = 11, /**< Blend factor is (f, f, f, 1); f = min(As, 1-Ad). */
|
||||
// VXBLEND_BOTHSRCALPHA = 12, /**< Source blend factor is (As, As, As, As) and destination blend factor is (1-As, 1-As, 1-As, 1-As) */
|
||||
// VXBLEND_BOTHINVSRCALPHA = 13, /**< Source blend factor is (1-As, 1-As, 1-As, 1-As) and destination blend factor is (As, As, As, As) */
|
||||
}
|
||||
|
||||
public enum VXFILL_MODE : uint {
|
||||
VXFILL_POINT = 1, /**< Vertices rendering */
|
||||
VXFILL_WIREFRAME = 2, /**< Edges rendering */
|
||||
VXFILL_SOLID = 3, /**< Face rendering */
|
||||
}
|
||||
|
||||
public enum VXSHADE_MODE : uint {
|
||||
VXSHADE_FLAT = 1, /**< Flat Shading */
|
||||
VXSHADE_GOURAUD = 2, /**< Gouraud Shading */
|
||||
VXSHADE_PHONG = 3, /**< Phong Shading (Not yet supported by most implementation) */
|
||||
}
|
||||
|
||||
public enum VXCMPFUNC : uint {
|
||||
VXCMP_NEVER = 1, /**< Always fail the test. */
|
||||
VXCMP_LESS = 2, /**< Accept if value if less than current value. */
|
||||
VXCMP_EQUAL = 3, /**< Accept if value if equal than current value. */
|
||||
VXCMP_LESSEQUAL = 4, /**< Accept if value if less or equal than current value. */
|
||||
VXCMP_GREATER = 5, /**< Accept if value if greater than current value. */
|
||||
VXCMP_NOTEQUAL = 6, /**< Accept if value if different than current value. */
|
||||
VXCMP_GREATEREQUAL = 7, /**< Accept if value if greater or equal current value. */
|
||||
VXCMP_ALWAYS = 8, /**< Always accept the test. */
|
||||
}
|
||||
|
||||
public enum VXMESH_LITMODE : uint {
|
||||
VX_PRELITMESH = 0, /**< Lighting use color information store with vertices */
|
||||
VX_LITMESH = 1, /**< Lighting is done by renderer using normals and face material information. */
|
||||
}
|
||||
|
||||
}
|
||||
364
Assets/BMapBindings/BMapSharp/BMapSharpTestbench/.editorconfig
Normal file
364
Assets/BMapBindings/BMapSharp/BMapSharpTestbench/.editorconfig
Normal file
@@ -0,0 +1,364 @@
|
||||
root = true
|
||||
|
||||
# All files
|
||||
[*]
|
||||
indent_style = space
|
||||
|
||||
# Xml files
|
||||
[*.xml]
|
||||
indent_size = 2
|
||||
|
||||
# C# files
|
||||
[*.cs]
|
||||
|
||||
#### Core EditorConfig Options ####
|
||||
|
||||
# Indentation and spacing
|
||||
indent_size = 4
|
||||
tab_width = 4
|
||||
|
||||
# New line preferences
|
||||
end_of_line = crlf
|
||||
insert_final_newline = false
|
||||
|
||||
#### .NET Coding Conventions ####
|
||||
[*.{cs,vb}]
|
||||
|
||||
# Organize usings
|
||||
dotnet_separate_import_directive_groups = false
|
||||
dotnet_sort_system_directives_first = false
|
||||
file_header_template = unset
|
||||
|
||||
# this. and Me. preferences
|
||||
dotnet_style_qualification_for_event = false:silent
|
||||
dotnet_style_qualification_for_field = false:silent
|
||||
dotnet_style_qualification_for_method = false:silent
|
||||
dotnet_style_qualification_for_property = false:silent
|
||||
|
||||
# Language keywords vs BCL types preferences
|
||||
dotnet_style_predefined_type_for_locals_parameters_members = true:silent
|
||||
dotnet_style_predefined_type_for_member_access = true:silent
|
||||
|
||||
# Parentheses preferences
|
||||
dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:silent
|
||||
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:silent
|
||||
dotnet_style_parentheses_in_other_operators = never_if_unnecessary:silent
|
||||
dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:silent
|
||||
|
||||
# Modifier preferences
|
||||
dotnet_style_require_accessibility_modifiers = for_non_interface_members:silent
|
||||
|
||||
# Expression-level preferences
|
||||
dotnet_style_coalesce_expression = true:suggestion
|
||||
dotnet_style_collection_initializer = true:suggestion
|
||||
dotnet_style_explicit_tuple_names = true:suggestion
|
||||
dotnet_style_null_propagation = true:suggestion
|
||||
dotnet_style_object_initializer = true:suggestion
|
||||
dotnet_style_operator_placement_when_wrapping = beginning_of_line
|
||||
dotnet_style_prefer_auto_properties = true:suggestion
|
||||
dotnet_style_prefer_compound_assignment = true:suggestion
|
||||
dotnet_style_prefer_conditional_expression_over_assignment = true:suggestion
|
||||
dotnet_style_prefer_conditional_expression_over_return = true:suggestion
|
||||
dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
|
||||
dotnet_style_prefer_inferred_tuple_names = true:suggestion
|
||||
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion
|
||||
dotnet_style_prefer_simplified_boolean_expressions = true:suggestion
|
||||
dotnet_style_prefer_simplified_interpolation = true:suggestion
|
||||
|
||||
# Field preferences
|
||||
dotnet_style_readonly_field = true:warning
|
||||
|
||||
# Parameter preferences
|
||||
dotnet_code_quality_unused_parameters = all:suggestion
|
||||
|
||||
# Suppression preferences
|
||||
dotnet_remove_unnecessary_suppression_exclusions = none
|
||||
|
||||
#### C# Coding Conventions ####
|
||||
[*.cs]
|
||||
|
||||
# var preferences
|
||||
csharp_style_var_elsewhere = false:silent
|
||||
csharp_style_var_for_built_in_types = false:silent
|
||||
csharp_style_var_when_type_is_apparent = false:silent
|
||||
|
||||
# Expression-bodied members
|
||||
csharp_style_expression_bodied_accessors = true:silent
|
||||
csharp_style_expression_bodied_constructors = false:silent
|
||||
csharp_style_expression_bodied_indexers = true:silent
|
||||
csharp_style_expression_bodied_lambdas = true:suggestion
|
||||
csharp_style_expression_bodied_local_functions = false:silent
|
||||
csharp_style_expression_bodied_methods = false:silent
|
||||
csharp_style_expression_bodied_operators = false:silent
|
||||
csharp_style_expression_bodied_properties = true:silent
|
||||
|
||||
# Pattern matching preferences
|
||||
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
|
||||
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
|
||||
csharp_style_prefer_not_pattern = true:suggestion
|
||||
csharp_style_prefer_pattern_matching = true:silent
|
||||
csharp_style_prefer_switch_expression = true:suggestion
|
||||
|
||||
# Null-checking preferences
|
||||
csharp_style_conditional_delegate_call = true:suggestion
|
||||
|
||||
# Modifier preferences
|
||||
csharp_prefer_static_local_function = true:warning
|
||||
csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:silent
|
||||
|
||||
# Code-block preferences
|
||||
csharp_prefer_braces = true:silent
|
||||
csharp_prefer_simple_using_statement = true:suggestion
|
||||
|
||||
# Expression-level preferences
|
||||
csharp_prefer_simple_default_expression = true:suggestion
|
||||
csharp_style_deconstructed_variable_declaration = true:suggestion
|
||||
csharp_style_inlined_variable_declaration = true:suggestion
|
||||
csharp_style_pattern_local_over_anonymous_function = true:suggestion
|
||||
csharp_style_prefer_index_operator = true:suggestion
|
||||
csharp_style_prefer_range_operator = true:suggestion
|
||||
csharp_style_throw_expression = true:suggestion
|
||||
csharp_style_unused_value_assignment_preference = discard_variable:suggestion
|
||||
csharp_style_unused_value_expression_statement_preference = discard_variable:silent
|
||||
|
||||
# 'using' directive preferences
|
||||
csharp_using_directive_placement = outside_namespace:silent
|
||||
|
||||
#### C# Formatting Rules ####
|
||||
|
||||
# New line preferences
|
||||
csharp_new_line_before_catch = false
|
||||
csharp_new_line_before_else = false
|
||||
csharp_new_line_before_finally = false
|
||||
csharp_new_line_before_members_in_anonymous_types = true
|
||||
csharp_new_line_before_members_in_object_initializers = true
|
||||
csharp_new_line_before_open_brace = none
|
||||
csharp_new_line_between_query_expression_clauses = true
|
||||
|
||||
# Indentation preferences
|
||||
csharp_indent_block_contents = true
|
||||
csharp_indent_braces = false
|
||||
csharp_indent_case_contents = true
|
||||
csharp_indent_case_contents_when_block = true
|
||||
csharp_indent_labels = one_less_than_current
|
||||
csharp_indent_switch_labels = true
|
||||
|
||||
# Space preferences
|
||||
csharp_space_after_cast = false
|
||||
csharp_space_after_colon_in_inheritance_clause = true
|
||||
csharp_space_after_comma = true
|
||||
csharp_space_after_dot = false
|
||||
csharp_space_after_keywords_in_control_flow_statements = true
|
||||
csharp_space_after_semicolon_in_for_statement = true
|
||||
csharp_space_around_binary_operators = before_and_after
|
||||
csharp_space_around_declaration_statements = false
|
||||
csharp_space_before_colon_in_inheritance_clause = true
|
||||
csharp_space_before_comma = false
|
||||
csharp_space_before_dot = false
|
||||
csharp_space_before_open_square_brackets = false
|
||||
csharp_space_before_semicolon_in_for_statement = false
|
||||
csharp_space_between_empty_square_brackets = false
|
||||
csharp_space_between_method_call_empty_parameter_list_parentheses = false
|
||||
csharp_space_between_method_call_name_and_opening_parenthesis = false
|
||||
csharp_space_between_method_call_parameter_list_parentheses = false
|
||||
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
|
||||
csharp_space_between_method_declaration_name_and_open_parenthesis = false
|
||||
csharp_space_between_method_declaration_parameter_list_parentheses = false
|
||||
csharp_space_between_parentheses = false
|
||||
csharp_space_between_square_brackets = false
|
||||
|
||||
# Wrapping preferences
|
||||
csharp_preserve_single_line_blocks = true
|
||||
csharp_preserve_single_line_statements = true
|
||||
|
||||
#### Naming styles ####
|
||||
[*.{cs,vb}]
|
||||
|
||||
# Naming rules
|
||||
|
||||
dotnet_naming_rule.types_and_namespaces_should_be_pascalcase.severity = suggestion
|
||||
dotnet_naming_rule.types_and_namespaces_should_be_pascalcase.symbols = types_and_namespaces
|
||||
dotnet_naming_rule.types_and_namespaces_should_be_pascalcase.style = pascalcase
|
||||
|
||||
dotnet_naming_rule.interfaces_should_be_ipascalcase.severity = suggestion
|
||||
dotnet_naming_rule.interfaces_should_be_ipascalcase.symbols = interfaces
|
||||
dotnet_naming_rule.interfaces_should_be_ipascalcase.style = ipascalcase
|
||||
|
||||
dotnet_naming_rule.type_parameters_should_be_tpascalcase.severity = suggestion
|
||||
dotnet_naming_rule.type_parameters_should_be_tpascalcase.symbols = type_parameters
|
||||
dotnet_naming_rule.type_parameters_should_be_tpascalcase.style = tpascalcase
|
||||
|
||||
dotnet_naming_rule.methods_should_be_pascalcase.severity = suggestion
|
||||
dotnet_naming_rule.methods_should_be_pascalcase.symbols = methods
|
||||
dotnet_naming_rule.methods_should_be_pascalcase.style = pascalcase
|
||||
|
||||
dotnet_naming_rule.properties_should_be_pascalcase.severity = suggestion
|
||||
dotnet_naming_rule.properties_should_be_pascalcase.symbols = properties
|
||||
dotnet_naming_rule.properties_should_be_pascalcase.style = pascalcase
|
||||
|
||||
dotnet_naming_rule.events_should_be_pascalcase.severity = suggestion
|
||||
dotnet_naming_rule.events_should_be_pascalcase.symbols = events
|
||||
dotnet_naming_rule.events_should_be_pascalcase.style = pascalcase
|
||||
|
||||
dotnet_naming_rule.local_variables_should_be_camelcase.severity = suggestion
|
||||
dotnet_naming_rule.local_variables_should_be_camelcase.symbols = local_variables
|
||||
dotnet_naming_rule.local_variables_should_be_camelcase.style = camelcase
|
||||
|
||||
dotnet_naming_rule.local_constants_should_be_camelcase.severity = suggestion
|
||||
dotnet_naming_rule.local_constants_should_be_camelcase.symbols = local_constants
|
||||
dotnet_naming_rule.local_constants_should_be_camelcase.style = camelcase
|
||||
|
||||
dotnet_naming_rule.parameters_should_be_camelcase.severity = suggestion
|
||||
dotnet_naming_rule.parameters_should_be_camelcase.symbols = parameters
|
||||
dotnet_naming_rule.parameters_should_be_camelcase.style = camelcase
|
||||
|
||||
dotnet_naming_rule.public_fields_should_be_pascalcase.severity = suggestion
|
||||
dotnet_naming_rule.public_fields_should_be_pascalcase.symbols = public_fields
|
||||
dotnet_naming_rule.public_fields_should_be_pascalcase.style = pascalcase
|
||||
|
||||
dotnet_naming_rule.private_fields_should_be__camelcase.severity = suggestion
|
||||
dotnet_naming_rule.private_fields_should_be__camelcase.symbols = private_fields
|
||||
dotnet_naming_rule.private_fields_should_be__camelcase.style = _camelcase
|
||||
|
||||
dotnet_naming_rule.private_static_fields_should_be_s_camelcase.severity = suggestion
|
||||
dotnet_naming_rule.private_static_fields_should_be_s_camelcase.symbols = private_static_fields
|
||||
dotnet_naming_rule.private_static_fields_should_be_s_camelcase.style = s_camelcase
|
||||
|
||||
dotnet_naming_rule.public_constant_fields_should_be_pascalcase.severity = suggestion
|
||||
dotnet_naming_rule.public_constant_fields_should_be_pascalcase.symbols = public_constant_fields
|
||||
dotnet_naming_rule.public_constant_fields_should_be_pascalcase.style = pascalcase
|
||||
|
||||
dotnet_naming_rule.private_constant_fields_should_be_pascalcase.severity = suggestion
|
||||
dotnet_naming_rule.private_constant_fields_should_be_pascalcase.symbols = private_constant_fields
|
||||
dotnet_naming_rule.private_constant_fields_should_be_pascalcase.style = pascalcase
|
||||
|
||||
dotnet_naming_rule.public_static_readonly_fields_should_be_pascalcase.severity = suggestion
|
||||
dotnet_naming_rule.public_static_readonly_fields_should_be_pascalcase.symbols = public_static_readonly_fields
|
||||
dotnet_naming_rule.public_static_readonly_fields_should_be_pascalcase.style = pascalcase
|
||||
|
||||
dotnet_naming_rule.private_static_readonly_fields_should_be_pascalcase.severity = suggestion
|
||||
dotnet_naming_rule.private_static_readonly_fields_should_be_pascalcase.symbols = private_static_readonly_fields
|
||||
dotnet_naming_rule.private_static_readonly_fields_should_be_pascalcase.style = pascalcase
|
||||
|
||||
dotnet_naming_rule.enums_should_be_pascalcase.severity = suggestion
|
||||
dotnet_naming_rule.enums_should_be_pascalcase.symbols = enums
|
||||
dotnet_naming_rule.enums_should_be_pascalcase.style = pascalcase
|
||||
|
||||
dotnet_naming_rule.local_functions_should_be_pascalcase.severity = suggestion
|
||||
dotnet_naming_rule.local_functions_should_be_pascalcase.symbols = local_functions
|
||||
dotnet_naming_rule.local_functions_should_be_pascalcase.style = pascalcase
|
||||
|
||||
dotnet_naming_rule.non_field_members_should_be_pascalcase.severity = suggestion
|
||||
dotnet_naming_rule.non_field_members_should_be_pascalcase.symbols = non_field_members
|
||||
dotnet_naming_rule.non_field_members_should_be_pascalcase.style = pascalcase
|
||||
|
||||
# Symbol specifications
|
||||
|
||||
dotnet_naming_symbols.interfaces.applicable_kinds = interface
|
||||
dotnet_naming_symbols.interfaces.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||
dotnet_naming_symbols.interfaces.required_modifiers =
|
||||
|
||||
dotnet_naming_symbols.enums.applicable_kinds = enum
|
||||
dotnet_naming_symbols.enums.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||
dotnet_naming_symbols.enums.required_modifiers =
|
||||
|
||||
dotnet_naming_symbols.events.applicable_kinds = event
|
||||
dotnet_naming_symbols.events.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||
dotnet_naming_symbols.events.required_modifiers =
|
||||
|
||||
dotnet_naming_symbols.methods.applicable_kinds = method
|
||||
dotnet_naming_symbols.methods.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||
dotnet_naming_symbols.methods.required_modifiers =
|
||||
|
||||
dotnet_naming_symbols.properties.applicable_kinds = property
|
||||
dotnet_naming_symbols.properties.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||
dotnet_naming_symbols.properties.required_modifiers =
|
||||
|
||||
dotnet_naming_symbols.public_fields.applicable_kinds = field
|
||||
dotnet_naming_symbols.public_fields.applicable_accessibilities = public, internal
|
||||
dotnet_naming_symbols.public_fields.required_modifiers =
|
||||
|
||||
dotnet_naming_symbols.private_fields.applicable_kinds = field
|
||||
dotnet_naming_symbols.private_fields.applicable_accessibilities = private, protected, protected_internal, private_protected
|
||||
dotnet_naming_symbols.private_fields.required_modifiers =
|
||||
|
||||
dotnet_naming_symbols.private_static_fields.applicable_kinds = field
|
||||
dotnet_naming_symbols.private_static_fields.applicable_accessibilities = private, protected, protected_internal, private_protected
|
||||
dotnet_naming_symbols.private_static_fields.required_modifiers = static
|
||||
|
||||
dotnet_naming_symbols.types_and_namespaces.applicable_kinds = namespace, class, struct, interface, enum
|
||||
dotnet_naming_symbols.types_and_namespaces.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||
dotnet_naming_symbols.types_and_namespaces.required_modifiers =
|
||||
|
||||
dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method
|
||||
dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||
dotnet_naming_symbols.non_field_members.required_modifiers =
|
||||
|
||||
dotnet_naming_symbols.type_parameters.applicable_kinds = namespace
|
||||
dotnet_naming_symbols.type_parameters.applicable_accessibilities = *
|
||||
dotnet_naming_symbols.type_parameters.required_modifiers =
|
||||
|
||||
dotnet_naming_symbols.private_constant_fields.applicable_kinds = field
|
||||
dotnet_naming_symbols.private_constant_fields.applicable_accessibilities = private, protected, protected_internal, private_protected
|
||||
dotnet_naming_symbols.private_constant_fields.required_modifiers = const
|
||||
|
||||
dotnet_naming_symbols.local_variables.applicable_kinds = local
|
||||
dotnet_naming_symbols.local_variables.applicable_accessibilities = local
|
||||
dotnet_naming_symbols.local_variables.required_modifiers =
|
||||
|
||||
dotnet_naming_symbols.local_constants.applicable_kinds = local
|
||||
dotnet_naming_symbols.local_constants.applicable_accessibilities = local
|
||||
dotnet_naming_symbols.local_constants.required_modifiers = const
|
||||
|
||||
dotnet_naming_symbols.parameters.applicable_kinds = parameter
|
||||
dotnet_naming_symbols.parameters.applicable_accessibilities = *
|
||||
dotnet_naming_symbols.parameters.required_modifiers =
|
||||
|
||||
dotnet_naming_symbols.public_constant_fields.applicable_kinds = field
|
||||
dotnet_naming_symbols.public_constant_fields.applicable_accessibilities = public, internal
|
||||
dotnet_naming_symbols.public_constant_fields.required_modifiers = const
|
||||
|
||||
dotnet_naming_symbols.public_static_readonly_fields.applicable_kinds = field
|
||||
dotnet_naming_symbols.public_static_readonly_fields.applicable_accessibilities = public, internal
|
||||
dotnet_naming_symbols.public_static_readonly_fields.required_modifiers = readonly, static
|
||||
|
||||
dotnet_naming_symbols.private_static_readonly_fields.applicable_kinds = field
|
||||
dotnet_naming_symbols.private_static_readonly_fields.applicable_accessibilities = private, protected, protected_internal, private_protected
|
||||
dotnet_naming_symbols.private_static_readonly_fields.required_modifiers = readonly, static
|
||||
|
||||
dotnet_naming_symbols.local_functions.applicable_kinds = local_function
|
||||
dotnet_naming_symbols.local_functions.applicable_accessibilities = *
|
||||
dotnet_naming_symbols.local_functions.required_modifiers =
|
||||
|
||||
# Naming styles
|
||||
|
||||
dotnet_naming_style.pascalcase.required_prefix =
|
||||
dotnet_naming_style.pascalcase.required_suffix =
|
||||
dotnet_naming_style.pascalcase.word_separator =
|
||||
dotnet_naming_style.pascalcase.capitalization = pascal_case
|
||||
|
||||
dotnet_naming_style.ipascalcase.required_prefix = I
|
||||
dotnet_naming_style.ipascalcase.required_suffix =
|
||||
dotnet_naming_style.ipascalcase.word_separator =
|
||||
dotnet_naming_style.ipascalcase.capitalization = pascal_case
|
||||
|
||||
dotnet_naming_style.tpascalcase.required_prefix = T
|
||||
dotnet_naming_style.tpascalcase.required_suffix =
|
||||
dotnet_naming_style.tpascalcase.word_separator =
|
||||
dotnet_naming_style.tpascalcase.capitalization = pascal_case
|
||||
|
||||
dotnet_naming_style._camelcase.required_prefix = _
|
||||
dotnet_naming_style._camelcase.required_suffix =
|
||||
dotnet_naming_style._camelcase.word_separator =
|
||||
dotnet_naming_style._camelcase.capitalization = camel_case
|
||||
|
||||
dotnet_naming_style.camelcase.required_prefix =
|
||||
dotnet_naming_style.camelcase.required_suffix =
|
||||
dotnet_naming_style.camelcase.word_separator =
|
||||
dotnet_naming_style.camelcase.capitalization = camel_case
|
||||
|
||||
dotnet_naming_style.s_camelcase.required_prefix = s_
|
||||
dotnet_naming_style.s_camelcase.required_suffix =
|
||||
dotnet_naming_style.s_camelcase.word_separator =
|
||||
dotnet_naming_style.s_camelcase.capitalization = camel_case
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\BMapSharp\BMapSharp.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="System.CommandLine" Version="2.0.0-beta4.22272.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
219
Assets/BMapBindings/BMapSharp/BMapSharpTestbench/Program.cs
Normal file
219
Assets/BMapBindings/BMapSharp/BMapSharpTestbench/Program.cs
Normal file
@@ -0,0 +1,219 @@
|
||||
using BMapSharp.BMapWrapper;
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.CommandLine;
|
||||
|
||||
namespace BMapSharpTestbench {
|
||||
internal class Program {
|
||||
|
||||
static void Main(string[] args) {
|
||||
// Parse arguments
|
||||
var resolved_args = ResolveArguments(args);
|
||||
if (resolved_args is null) {
|
||||
// just silent quit
|
||||
Environment.Exit(0);
|
||||
}
|
||||
|
||||
// Check environment
|
||||
Console.OutputEncoding = Encoding.UTF8;
|
||||
if (!BMapSharp.BMapWrapper.Utils.IsBMapAvailable()) {
|
||||
Console.WriteLine("Fail to initialize native BMap.");
|
||||
Environment.Exit(0);
|
||||
}
|
||||
|
||||
// Waiting debugger
|
||||
int pid = System.Diagnostics.Process.GetCurrentProcess().Id;
|
||||
Console.WriteLine($"C# PID is {pid}. Waiting debugger, press any key to continue...");
|
||||
Console.ReadKey(true);
|
||||
|
||||
// Start testbench
|
||||
string file_name = resolved_args.mFileName; // "LightCameraTest.nmo";
|
||||
string temp_folder = resolved_args.mTempFolder; // "Temp";
|
||||
string texture_folder = resolved_args.mTextureFolder; // "F:\\Ballance\\Ballance\\Textures";
|
||||
string[] encodings = resolved_args.mEncodings; // ["cp1252", "gb2312"];
|
||||
|
||||
using (var reader = new BMapSharp.BMapWrapper.BMFileReader(file_name, temp_folder, texture_folder, encodings)) {
|
||||
TestCommon(reader);
|
||||
TestIEquatable(reader);
|
||||
}
|
||||
|
||||
Console.WriteLine("Press any key to quit...");
|
||||
Console.ReadKey(true);
|
||||
|
||||
}
|
||||
|
||||
class BMapSharpArguments {
|
||||
public string mFileName;
|
||||
public string mTempFolder;
|
||||
public string mTextureFolder;
|
||||
public string[] mEncodings;
|
||||
}
|
||||
|
||||
static BMapSharpArguments ResolveArguments(string[] args) {
|
||||
// define arguments
|
||||
var fileNameOpt = new Option<string>
|
||||
("--file-path", "The path to input Virtools file.");
|
||||
fileNameOpt.IsRequired = true;
|
||||
var tempFolderOpt = new Option<string>
|
||||
("--temp-dir", "The temp folder used by BMap.");
|
||||
tempFolderOpt.IsRequired = true;
|
||||
var textureFolderOpt = new Option<string>
|
||||
("--texture-dir", "The texture folder containing Ballance texture resources.");
|
||||
textureFolderOpt.IsRequired = true;
|
||||
var encodingsOpt = new Option<IEnumerable<string>>
|
||||
("--encodings", "The encodings used to parse the names stroed in input Virtools file.");
|
||||
encodingsOpt.IsRequired = true;
|
||||
encodingsOpt.Arity = ArgumentArity.OneOrMore;
|
||||
encodingsOpt.AllowMultipleArgumentsPerToken = true;
|
||||
|
||||
// init root command
|
||||
var rootCommand = new RootCommand("The testbench of BMapSharp.");
|
||||
rootCommand.Add(fileNameOpt);
|
||||
rootCommand.Add(tempFolderOpt);
|
||||
rootCommand.Add(textureFolderOpt);
|
||||
rootCommand.Add(encodingsOpt);
|
||||
|
||||
// init result container
|
||||
BMapSharpArguments ret = new BMapSharpArguments();
|
||||
// set handler
|
||||
rootCommand.SetHandler((context) => {
|
||||
ret.mFileName = context.ParseResult.GetValueForOption(fileNameOpt);
|
||||
ret.mTempFolder = context.ParseResult.GetValueForOption(tempFolderOpt);
|
||||
ret.mTextureFolder = context.ParseResult.GetValueForOption(textureFolderOpt);
|
||||
ret.mEncodings = context.ParseResult.GetValueForOption(encodingsOpt).ToArray();
|
||||
context.ExitCode = 61;
|
||||
});
|
||||
|
||||
// execute root command and return value.
|
||||
if (rootCommand.Invoke(args) != 61) return null;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void TestCommon(BMapSharp.BMapWrapper.BMFileReader reader) {
|
||||
// Console.WriteLine("===== Groups =====");
|
||||
// foreach (var gp in reader.GetGroups()) {
|
||||
// Console.WriteLine(gp.GetName());
|
||||
// foreach (var gp_item in gp.GetObjects()) {
|
||||
// Console.WriteLine($"\t{gp_item.GetName()}");
|
||||
// }
|
||||
// }
|
||||
|
||||
// Console.WriteLine("===== 3dObjects =====");
|
||||
// foreach (var obj in reader.Get3dObjects()) {
|
||||
// Console.WriteLine(obj.GetName());
|
||||
|
||||
// var current_mesh = obj.GetCurrentMesh();
|
||||
// var mesh_name = current_mesh is null ? "<null>" : current_mesh.GetName();
|
||||
// Console.WriteLine($"\tMesh: {mesh_name}");
|
||||
// Console.WriteLine($"\tVisibility: {obj.GetVisibility()}");
|
||||
// Console.WriteLine($"\tMatrix: {obj.GetWorldMatrix().ToManaged()}");
|
||||
// }
|
||||
|
||||
// Console.WriteLine("===== Meshes =====");
|
||||
// foreach (var mesh in reader.GetMeshes()) {
|
||||
// Console.WriteLine(mesh.GetName());
|
||||
|
||||
// Console.WriteLine($"\tLit Mode: {mesh.GetLitMode()}");
|
||||
// Console.WriteLine($"\tVertex Count: {mesh.GetVertexCount()}");
|
||||
// Console.WriteLine($"\tFace Count: {mesh.GetFaceCount()}");
|
||||
// Console.WriteLine($"\tMaterial Slot Count: {mesh.GetMaterialSlotCount()}");
|
||||
// }
|
||||
|
||||
// Console.WriteLine("===== Materials =====");
|
||||
// foreach (var mtl in reader.GetMaterials()) {
|
||||
// Console.WriteLine(mtl.GetName());
|
||||
|
||||
// Console.WriteLine($"\tDiffuse: {mtl.GetDiffuse().ToManagedRGBA()}");
|
||||
// Console.WriteLine($"\tAmbient: {mtl.GetAmbient().ToManagedRGBA()}");
|
||||
// Console.WriteLine($"\tSpecular: {mtl.GetSpecular().ToManagedRGBA()}");
|
||||
// Console.WriteLine($"\tEmissive: {mtl.GetEmissive().ToManagedRGBA()}");
|
||||
|
||||
// Console.WriteLine($"\tSpecular Power: {mtl.GetSpecularPower()}");
|
||||
|
||||
// Console.WriteLine($"\tTexture Border Color: {mtl.GetTextureBorderColor().ToManagedRGBA()}");
|
||||
|
||||
// Console.WriteLine($"\tTexture Blend Mode: {mtl.GetTextureBlendMode()}");
|
||||
// Console.WriteLine($"\tTexture Min Mode: {mtl.GetTextureMinMode()}");
|
||||
// Console.WriteLine($"\tTexture Mag Mode: {mtl.GetTextureMagMode()}");
|
||||
// Console.WriteLine($"\tSource Blend: {mtl.GetSourceBlend()}");
|
||||
// Console.WriteLine($"\tDest Blend: {mtl.GetDestBlend()}");
|
||||
// Console.WriteLine($"\tFill Mode: {mtl.GetFillMode()}");
|
||||
// Console.WriteLine($"\tShade Mode: {mtl.GetShadeMode()}");
|
||||
|
||||
// Console.WriteLine($"\tAlpha Test Enabled: {mtl.GetAlphaTestEnabled()}");
|
||||
// Console.WriteLine($"\tAlpha Blend Enabled: {mtl.GetAlphaBlendEnabled()}");
|
||||
// Console.WriteLine($"\tPerspective Correction Enabled: {mtl.GetPerspectiveCorrectionEnabled()}");
|
||||
// Console.WriteLine($"\tZ Write Enabled: {mtl.GetZWriteEnabled()}");
|
||||
// Console.WriteLine($"\tTwo Sided Enabled: {mtl.GetTwoSidedEnabled()}");
|
||||
|
||||
// Console.WriteLine($"\tAlpha Ref: {mtl.GetAlphaRef()}");
|
||||
|
||||
// Console.WriteLine($"\tAlpha Func: {mtl.GetAlphaFunc()}");
|
||||
// Console.WriteLine($"\tZ Func: {mtl.GetZFunc()}");
|
||||
// }
|
||||
|
||||
// Console.WriteLine("===== Textures =====");
|
||||
// foreach (var tex in reader.GetTextures()) {
|
||||
// Console.WriteLine(tex.GetName());
|
||||
|
||||
// Console.WriteLine($"\tFile Name: {tex.GetFileName()}");
|
||||
// Console.WriteLine($"\tSave Options: {tex.GetSaveOptions()}");
|
||||
// Console.WriteLine($"\tVideo Format: {tex.GetVideoFormat()}");
|
||||
// }
|
||||
|
||||
Console.WriteLine("===== Target Lights =====");
|
||||
foreach (var lit in reader.GetTargetLights()) {
|
||||
Console.WriteLine(lit.GetName());
|
||||
|
||||
Console.WriteLine($"\tVisibility: {lit.GetVisibility()}");
|
||||
Console.WriteLine($"\tMatrix: {lit.GetWorldMatrix().ToManaged()}");
|
||||
|
||||
Console.WriteLine($"Type: {lit.GetLightType()}");
|
||||
Console.WriteLine($"Color: {lit.GetColor().ToManagedRGBA()}");
|
||||
Console.WriteLine($"Constant Attenuation: {lit.GetConstantAttenuation()}");
|
||||
Console.WriteLine($"Linear Attenuation: {lit.GetLinearAttenuation()}");
|
||||
Console.WriteLine($"Quadratic Attenuation: {lit.GetQuadraticAttenuation()}");
|
||||
Console.WriteLine($"Range: {lit.GetRange()}");
|
||||
Console.WriteLine($"Hot Spot: {lit.GetHotSpot()}");
|
||||
Console.WriteLine($"Falloff: {lit.GetFalloff()}");
|
||||
Console.WriteLine($"Falloff Shape: {lit.GetFalloffShape()}");
|
||||
}
|
||||
|
||||
Console.WriteLine("===== END =====");
|
||||
}
|
||||
|
||||
static void TestIEquatable(BMapSharp.BMapWrapper.BMFileReader reader) {
|
||||
if (reader.Get3dObjectCount() < 2u) {
|
||||
Debug.Fail(
|
||||
"Invalid file for test IEquatable.",
|
||||
"We can not perform IEquatable test because the length of 3dObject is too short (must greater than 2). Please choose another file to perform."
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
// Prepare test variables
|
||||
var all_3dobjects = new List<BM3dObject>(reader.Get3dObjects());
|
||||
var first_3dobj = all_3dobjects[0];
|
||||
var second_3dobj = all_3dobjects[1];
|
||||
all_3dobjects = new List<BM3dObject>(reader.Get3dObjects());
|
||||
var first_3dobj_again = all_3dobjects[0];
|
||||
Debug.Assert(!Object.ReferenceEquals(first_3dobj, first_3dobj_again));
|
||||
|
||||
// Hashtable test
|
||||
var test_hashset = new HashSet<BM3dObject>();
|
||||
Debug.Assert(test_hashset.Add(first_3dobj));
|
||||
Debug.Assert(!test_hashset.Add(first_3dobj_again));
|
||||
Debug.Assert(test_hashset.Add(second_3dobj));
|
||||
|
||||
// Dictionary test
|
||||
var test_dictionary = new Dictionary<BM3dObject, string>();
|
||||
Debug.Assert(test_dictionary.TryAdd(first_3dobj, first_3dobj.GetName()));
|
||||
Debug.Assert(!test_dictionary.TryAdd(first_3dobj_again, first_3dobj_again.GetName()));
|
||||
Debug.Assert(test_dictionary.TryAdd(second_3dobj, second_3dobj.GetName()));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
9
Assets/BMapBindings/BMapSharp/README.md
Normal file
9
Assets/BMapBindings/BMapSharp/README.md
Normal file
@@ -0,0 +1,9 @@
|
||||
# BMapSharp
|
||||
|
||||
The core of BMapSharp project is placed within `BMapSharp` subdirectory. This directory also contain a testbench project of `BMapSharp`, called `BMapSharpTestbench`. You can build it and do basic test for `BMapSharp`.
|
||||
|
||||
The native BMap library should be placed together with managed `BMapSharp` dynamic library. I use gitignore file to filter all native binary so you need put them manually. The native BMap library must be named as `BMap.dll` (in Windows), `BMap.so` (in Linux or BSD), or `BMap.dylib` (in macOS). If you still can not load BMap or your system is not listed above, you should name it as `BMap.bin`.
|
||||
|
||||
The most content of `VirtoolsTypes.cs` is generated by EnumsMigration, and the most content of `BMap.cs` is generated by BMapBindings. You should watch these file changes if corresponding C++ code or structures are changed.
|
||||
|
||||
Since BMap 0.3.0, testbench use command line arguments, instead of hardcode variables in code, as the arguments of BMap. It is convenient that debug BMapSharp without any modification of source code. For a brief instruction, you may need to launch BMapSharpTestbench in following command (just an example. you can modify it as you wished): `dotnet run -- --file-path "LightCameraTest.nmo" --temp-dir "Temp" --texture-dir "F:/Ballance/Ballance/Textures" --encodings cp1252 gb2312`.
|
||||
150
Assets/BMapBindings/PyBMap/.gitignore
vendored
Normal file
150
Assets/BMapBindings/PyBMap/.gitignore
vendored
Normal file
@@ -0,0 +1,150 @@
|
||||
# -------------------- Personal --------------------
|
||||
# Ignore VSCode
|
||||
.vscode/
|
||||
|
||||
# Ignore binary BMap stuff
|
||||
*.dll
|
||||
*.pdb
|
||||
*.so
|
||||
*.dylib
|
||||
*.bin
|
||||
|
||||
# -------------------- Python --------------------
|
||||
# Byte-compiled / optimized / DLL files
|
||||
__pycache__/
|
||||
*.py[cod]
|
||||
*$py.class
|
||||
|
||||
# C extensions
|
||||
*.so
|
||||
|
||||
# Distribution / packaging
|
||||
.Python
|
||||
build/
|
||||
develop-eggs/
|
||||
dist/
|
||||
downloads/
|
||||
eggs/
|
||||
.eggs/
|
||||
lib/
|
||||
lib64/
|
||||
parts/
|
||||
sdist/
|
||||
var/
|
||||
wheels/
|
||||
share/python-wheels/
|
||||
*.egg-info/
|
||||
.installed.cfg
|
||||
*.egg
|
||||
MANIFEST
|
||||
|
||||
# PyInstaller
|
||||
# Usually these files are written by a python script from a template
|
||||
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
||||
*.manifest
|
||||
*.spec
|
||||
|
||||
# Installer logs
|
||||
pip-log.txt
|
||||
pip-delete-this-directory.txt
|
||||
|
||||
# Unit test / coverage reports
|
||||
htmlcov/
|
||||
.tox/
|
||||
.nox/
|
||||
.coverage
|
||||
.coverage.*
|
||||
.cache
|
||||
nosetests.xml
|
||||
coverage.xml
|
||||
*.cover
|
||||
*.py,cover
|
||||
.hypothesis/
|
||||
.pytest_cache/
|
||||
cover/
|
||||
|
||||
# Translations
|
||||
*.mo
|
||||
*.pot
|
||||
|
||||
# Django stuff:
|
||||
*.log
|
||||
local_settings.py
|
||||
db.sqlite3
|
||||
db.sqlite3-journal
|
||||
|
||||
# Flask stuff:
|
||||
instance/
|
||||
.webassets-cache
|
||||
|
||||
# Scrapy stuff:
|
||||
.scrapy
|
||||
|
||||
# Sphinx documentation
|
||||
docs/_build/
|
||||
|
||||
# PyBuilder
|
||||
.pybuilder/
|
||||
target/
|
||||
|
||||
# Jupyter Notebook
|
||||
.ipynb_checkpoints
|
||||
|
||||
# IPython
|
||||
profile_default/
|
||||
ipython_config.py
|
||||
|
||||
# pyenv
|
||||
# For a library or package, you might want to ignore these files since the code is
|
||||
# intended to run in multiple environments; otherwise, check them in:
|
||||
# .python-version
|
||||
|
||||
# pipenv
|
||||
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
||||
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
||||
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
||||
# install all needed dependencies.
|
||||
#Pipfile.lock
|
||||
|
||||
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
|
||||
__pypackages__/
|
||||
|
||||
# Celery stuff
|
||||
celerybeat-schedule
|
||||
celerybeat.pid
|
||||
|
||||
# SageMath parsed files
|
||||
*.sage.py
|
||||
|
||||
# Environments
|
||||
.env
|
||||
.venv
|
||||
env/
|
||||
venv/
|
||||
ENV/
|
||||
env.bak/
|
||||
venv.bak/
|
||||
|
||||
# Spyder project settings
|
||||
.spyderproject
|
||||
.spyproject
|
||||
|
||||
# Rope project settings
|
||||
.ropeproject
|
||||
|
||||
# mkdocs documentation
|
||||
/site
|
||||
|
||||
# mypy
|
||||
.mypy_cache/
|
||||
.dmypy.json
|
||||
dmypy.json
|
||||
|
||||
# Pyre type checker
|
||||
.pyre/
|
||||
|
||||
# pytype static type analyzer
|
||||
.pytype/
|
||||
|
||||
# Cython debug symbols
|
||||
cython_debug/
|
||||
0
Assets/BMapBindings/PyBMap/PyBMap/__init__.py
Normal file
0
Assets/BMapBindings/PyBMap/PyBMap/__init__.py
Normal file
913
Assets/BMapBindings/PyBMap/PyBMap/bmap.py
Normal file
913
Assets/BMapBindings/PyBMap/PyBMap/bmap.py
Normal file
@@ -0,0 +1,913 @@
|
||||
import ctypes, os, sys, typing
|
||||
|
||||
#region Type Defines
|
||||
|
||||
class BMapException(Exception):
|
||||
"""
|
||||
The exception thrown by BMap bindings.
|
||||
"""
|
||||
pass
|
||||
|
||||
bm_CKSTRING = ctypes.c_char_p
|
||||
bm_CKSTRING_p = ctypes.POINTER(bm_CKSTRING)
|
||||
bm_CKDWORD = ctypes.c_uint32
|
||||
bm_CKDWORD_p = ctypes.POINTER(bm_CKDWORD)
|
||||
bm_CKDWORD_pp = ctypes.POINTER(bm_CKDWORD_p)
|
||||
bm_CKWORD = ctypes.c_uint16
|
||||
bm_CKWORD_p = ctypes.POINTER(bm_CKWORD)
|
||||
bm_CKWORD_pp = ctypes.POINTER(bm_CKWORD_p)
|
||||
bm_CKID = ctypes.c_uint32
|
||||
bm_CKID_p = ctypes.POINTER(bm_CKID)
|
||||
bm_CKID_pp = ctypes.POINTER(bm_CKID_p)
|
||||
bm_CKFLOAT = ctypes.c_float
|
||||
bm_CKFLOAT_p = ctypes.POINTER(bm_CKFLOAT)
|
||||
bm_CKINT = ctypes.c_int32
|
||||
bm_CKBYTE = ctypes.c_uint8
|
||||
bm_CKBYTE_p = ctypes.POINTER(bm_CKBYTE)
|
||||
|
||||
bm_enum = bm_CKDWORD
|
||||
bm_enum_p = ctypes.POINTER(bm_enum)
|
||||
bm_bool = ctypes.c_bool
|
||||
bm_bool_p = ctypes.POINTER(bm_bool)
|
||||
bm_void_p = ctypes.c_void_p
|
||||
bm_void_pp = ctypes.POINTER(ctypes.c_void_p)
|
||||
|
||||
bm_callback = ctypes.CFUNCTYPE(None, bm_CKSTRING)
|
||||
|
||||
class bm_VxVector2(ctypes.Structure):
|
||||
_fields_ = [
|
||||
('x', bm_CKFLOAT),
|
||||
('y', bm_CKFLOAT),
|
||||
]
|
||||
bm_VxVector2_p = ctypes.POINTER(bm_VxVector2)
|
||||
bm_VxVector2_pp = ctypes.POINTER(bm_VxVector2_p)
|
||||
class bm_VxVector3(ctypes.Structure):
|
||||
_fields_ = [
|
||||
('x', bm_CKFLOAT),
|
||||
('y', bm_CKFLOAT),
|
||||
('z', bm_CKFLOAT),
|
||||
]
|
||||
bm_VxVector3_p = ctypes.POINTER(bm_VxVector3)
|
||||
bm_VxVector3_pp = ctypes.POINTER(bm_VxVector3_p)
|
||||
class bm_VxColor(ctypes.Structure):
|
||||
_fields_ = [
|
||||
('r', bm_CKFLOAT),
|
||||
('g', bm_CKFLOAT),
|
||||
('b', bm_CKFLOAT),
|
||||
('a', bm_CKFLOAT),
|
||||
]
|
||||
bm_VxColor_p = ctypes.POINTER(bm_VxColor)
|
||||
class bm_VxMatrix(ctypes.Structure):
|
||||
_fields_ = list(
|
||||
(f'i{idx}', bm_CKFLOAT) for idx in range(16)
|
||||
)
|
||||
bm_VxMatrix_p = ctypes.POINTER(bm_VxMatrix)
|
||||
|
||||
#endregion
|
||||
|
||||
#region BMap Loader
|
||||
|
||||
_g_BMapLibName: str
|
||||
|
||||
if sys.platform.startswith('win32') or sys.platform.startswith('cygwin'):
|
||||
_g_BMapLibName = "BMap.dll"
|
||||
elif sys.platform.startswith('linux') or sys.platform.startswith('freebsd'):
|
||||
_g_BMapLibName = "BMap.so"
|
||||
elif sys.platform.startswith('darwin'):
|
||||
_g_BMapLibName = "BMap.dylib"
|
||||
else:
|
||||
_g_BMapLibName = "BMap.bin"
|
||||
|
||||
_g_BMapLibPath: str = os.path.join(os.path.dirname(__file__), _g_BMapLibName)
|
||||
|
||||
_g_BMapModule: ctypes.CDLL | None = None
|
||||
try:
|
||||
_g_BMapModule = ctypes.cdll.LoadLibrary(_g_BMapLibPath)
|
||||
except:
|
||||
print(f'Fail to load native BMap dynamic library file "{_g_BMapLibPath}".')
|
||||
_g_BMapModule = None
|
||||
|
||||
def is_bmap_available() -> bool:
|
||||
return _g_BMapModule is not None
|
||||
|
||||
def _bmap_error_check(result: bool, func, args):
|
||||
if not result:
|
||||
raise BMapException("BMap operation failed.")
|
||||
return result
|
||||
|
||||
def _create_bmap_func(fct_name: str, fct_params: list[typing.Any]) -> typing.Callable[..., bm_bool]:
|
||||
if _g_BMapModule is None: return None
|
||||
|
||||
cache: typing.Callable[..., bm_bool] = getattr(_g_BMapModule, fct_name)
|
||||
cache.argtypes = fct_params
|
||||
cache.restype = bm_bool
|
||||
cache.errcheck = _bmap_error_check
|
||||
return cache
|
||||
|
||||
#endregion
|
||||
|
||||
#region Function Defines
|
||||
|
||||
##### GENERATED FUNCTIONS BEGIN #####
|
||||
|
||||
## BMInit
|
||||
# @return True if no error, otherwise False.
|
||||
BMInit = _create_bmap_func('BMInit', [])
|
||||
## BMDispose
|
||||
# @return True if no error, otherwise False.
|
||||
BMDispose = _create_bmap_func('BMDispose', [])
|
||||
## BMFile_Load
|
||||
# @param file_name[in] Type: LibCmo::CKSTRING.
|
||||
# @param temp_folder[in] Type: LibCmo::CKSTRING.
|
||||
# @param texture_folder[in] Type: LibCmo::CKSTRING.
|
||||
# @param raw_callback[in] Type: BMap::NakedOutputCallback.
|
||||
# @param encoding_count[in] Type: LibCmo::CKDWORD.
|
||||
# @param encodings[in] Type: LibCmo::CKSTRING*.
|
||||
# @param out_file[out] Type: BMap::BMFile*. Use ctypes.byref(data) pass it.
|
||||
# @return True if no error, otherwise False.
|
||||
BMFile_Load = _create_bmap_func('BMFile_Load', [bm_CKSTRING, bm_CKSTRING, bm_CKSTRING, bm_callback, bm_CKDWORD, bm_CKSTRING_p, bm_void_pp])
|
||||
## BMFile_Create
|
||||
# @param temp_folder[in] Type: LibCmo::CKSTRING.
|
||||
# @param texture_folder[in] Type: LibCmo::CKSTRING.
|
||||
# @param raw_callback[in] Type: BMap::NakedOutputCallback.
|
||||
# @param encoding_count[in] Type: LibCmo::CKDWORD.
|
||||
# @param encodings[in] Type: LibCmo::CKSTRING*.
|
||||
# @param out_file[out] Type: BMap::BMFile*. Use ctypes.byref(data) pass it.
|
||||
# @return True if no error, otherwise False.
|
||||
BMFile_Create = _create_bmap_func('BMFile_Create', [bm_CKSTRING, bm_CKSTRING, bm_callback, bm_CKDWORD, bm_CKSTRING_p, bm_void_pp])
|
||||
## BMFile_Save
|
||||
# @param map_file[in] Type: BMap::BMFile*.
|
||||
# @param file_name[in] Type: LibCmo::CKSTRING.
|
||||
# @param texture_save_opt[in] Type: LibCmo::CK2::CK_TEXTURE_SAVEOPTIONS.
|
||||
# @param use_compress[in] Type: bool.
|
||||
# @param compreess_level[in] Type: LibCmo::CKINT.
|
||||
# @return True if no error, otherwise False.
|
||||
BMFile_Save = _create_bmap_func('BMFile_Save', [bm_void_p, bm_CKSTRING, bm_enum, bm_bool, bm_CKINT])
|
||||
## BMFile_Free
|
||||
# @param map_file[in] Type: BMap::BMFile*.
|
||||
# @return True if no error, otherwise False.
|
||||
BMFile_Free = _create_bmap_func('BMFile_Free', [bm_void_p])
|
||||
## BMFile_GetGroupCount
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param out_count[out] Type: LibCmo::CKDWORD. Use ctypes.byref(data) pass it.
|
||||
# @return True if no error, otherwise False.
|
||||
BMFile_GetGroupCount = _create_bmap_func('BMFile_GetGroupCount', [bm_void_p, bm_CKDWORD_p])
|
||||
## BMFile_GetGroup
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param idx[in] Type: LibCmo::CKDWORD.
|
||||
# @param out_id[out] Type: LibCmo::CK2::CK_ID. Use ctypes.byref(data) pass it.
|
||||
# @return True if no error, otherwise False.
|
||||
BMFile_GetGroup = _create_bmap_func('BMFile_GetGroup', [bm_void_p, bm_CKDWORD, bm_CKID_p])
|
||||
## BMFile_CreateGroup
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param out_id[out] Type: LibCmo::CK2::CK_ID. Use ctypes.byref(data) pass it.
|
||||
# @return True if no error, otherwise False.
|
||||
BMFile_CreateGroup = _create_bmap_func('BMFile_CreateGroup', [bm_void_p, bm_CKID_p])
|
||||
## BMFile_Get3dObjectCount
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param out_count[out] Type: LibCmo::CKDWORD. Use ctypes.byref(data) pass it.
|
||||
# @return True if no error, otherwise False.
|
||||
BMFile_Get3dObjectCount = _create_bmap_func('BMFile_Get3dObjectCount', [bm_void_p, bm_CKDWORD_p])
|
||||
## BMFile_Get3dObject
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param idx[in] Type: LibCmo::CKDWORD.
|
||||
# @param out_id[out] Type: LibCmo::CK2::CK_ID. Use ctypes.byref(data) pass it.
|
||||
# @return True if no error, otherwise False.
|
||||
BMFile_Get3dObject = _create_bmap_func('BMFile_Get3dObject', [bm_void_p, bm_CKDWORD, bm_CKID_p])
|
||||
## BMFile_Create3dObject
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param out_id[out] Type: LibCmo::CK2::CK_ID. Use ctypes.byref(data) pass it.
|
||||
# @return True if no error, otherwise False.
|
||||
BMFile_Create3dObject = _create_bmap_func('BMFile_Create3dObject', [bm_void_p, bm_CKID_p])
|
||||
## BMFile_GetMeshCount
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param out_count[out] Type: LibCmo::CKDWORD. Use ctypes.byref(data) pass it.
|
||||
# @return True if no error, otherwise False.
|
||||
BMFile_GetMeshCount = _create_bmap_func('BMFile_GetMeshCount', [bm_void_p, bm_CKDWORD_p])
|
||||
## BMFile_GetMesh
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param idx[in] Type: LibCmo::CKDWORD.
|
||||
# @param out_id[out] Type: LibCmo::CK2::CK_ID. Use ctypes.byref(data) pass it.
|
||||
# @return True if no error, otherwise False.
|
||||
BMFile_GetMesh = _create_bmap_func('BMFile_GetMesh', [bm_void_p, bm_CKDWORD, bm_CKID_p])
|
||||
## BMFile_CreateMesh
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param out_id[out] Type: LibCmo::CK2::CK_ID. Use ctypes.byref(data) pass it.
|
||||
# @return True if no error, otherwise False.
|
||||
BMFile_CreateMesh = _create_bmap_func('BMFile_CreateMesh', [bm_void_p, bm_CKID_p])
|
||||
## BMFile_GetMaterialCount
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param out_count[out] Type: LibCmo::CKDWORD. Use ctypes.byref(data) pass it.
|
||||
# @return True if no error, otherwise False.
|
||||
BMFile_GetMaterialCount = _create_bmap_func('BMFile_GetMaterialCount', [bm_void_p, bm_CKDWORD_p])
|
||||
## BMFile_GetMaterial
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param idx[in] Type: LibCmo::CKDWORD.
|
||||
# @param out_id[out] Type: LibCmo::CK2::CK_ID. Use ctypes.byref(data) pass it.
|
||||
# @return True if no error, otherwise False.
|
||||
BMFile_GetMaterial = _create_bmap_func('BMFile_GetMaterial', [bm_void_p, bm_CKDWORD, bm_CKID_p])
|
||||
## BMFile_CreateMaterial
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param out_id[out] Type: LibCmo::CK2::CK_ID. Use ctypes.byref(data) pass it.
|
||||
# @return True if no error, otherwise False.
|
||||
BMFile_CreateMaterial = _create_bmap_func('BMFile_CreateMaterial', [bm_void_p, bm_CKID_p])
|
||||
## BMFile_GetTextureCount
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param out_count[out] Type: LibCmo::CKDWORD. Use ctypes.byref(data) pass it.
|
||||
# @return True if no error, otherwise False.
|
||||
BMFile_GetTextureCount = _create_bmap_func('BMFile_GetTextureCount', [bm_void_p, bm_CKDWORD_p])
|
||||
## BMFile_GetTexture
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param idx[in] Type: LibCmo::CKDWORD.
|
||||
# @param out_id[out] Type: LibCmo::CK2::CK_ID. Use ctypes.byref(data) pass it.
|
||||
# @return True if no error, otherwise False.
|
||||
BMFile_GetTexture = _create_bmap_func('BMFile_GetTexture', [bm_void_p, bm_CKDWORD, bm_CKID_p])
|
||||
## BMFile_CreateTexture
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param out_id[out] Type: LibCmo::CK2::CK_ID. Use ctypes.byref(data) pass it.
|
||||
# @return True if no error, otherwise False.
|
||||
BMFile_CreateTexture = _create_bmap_func('BMFile_CreateTexture', [bm_void_p, bm_CKID_p])
|
||||
## BMFile_GetTargetLightCount
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param out_count[out] Type: LibCmo::CKDWORD. Use ctypes.byref(data) pass it.
|
||||
# @return True if no error, otherwise False.
|
||||
BMFile_GetTargetLightCount = _create_bmap_func('BMFile_GetTargetLightCount', [bm_void_p, bm_CKDWORD_p])
|
||||
## BMFile_GetTargetLight
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param idx[in] Type: LibCmo::CKDWORD.
|
||||
# @param out_id[out] Type: LibCmo::CK2::CK_ID. Use ctypes.byref(data) pass it.
|
||||
# @return True if no error, otherwise False.
|
||||
BMFile_GetTargetLight = _create_bmap_func('BMFile_GetTargetLight', [bm_void_p, bm_CKDWORD, bm_CKID_p])
|
||||
## BMFile_CreateTargetLight
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param out_id[out] Type: LibCmo::CK2::CK_ID. Use ctypes.byref(data) pass it.
|
||||
# @return True if no error, otherwise False.
|
||||
BMFile_CreateTargetLight = _create_bmap_func('BMFile_CreateTargetLight', [bm_void_p, bm_CKID_p])
|
||||
## BMMeshTrans_New
|
||||
# @param out_trans[out] Type: BMap::BMMeshTransition*. Use ctypes.byref(data) pass it.
|
||||
# @return True if no error, otherwise False.
|
||||
BMMeshTrans_New = _create_bmap_func('BMMeshTrans_New', [bm_void_pp])
|
||||
## BMMeshTrans_Delete
|
||||
# @param trans[in] Type: BMap::BMMeshTransition*.
|
||||
# @return True if no error, otherwise False.
|
||||
BMMeshTrans_Delete = _create_bmap_func('BMMeshTrans_Delete', [bm_void_p])
|
||||
## BMMeshTrans_PrepareVertexCount
|
||||
# @param trans[in] Type: BMap::BMMeshTransition*. The pointer to corresponding BMMeshTransition.
|
||||
# @param count[in] Type: LibCmo::CKDWORD.
|
||||
# @return True if no error, otherwise False.
|
||||
BMMeshTrans_PrepareVertexCount = _create_bmap_func('BMMeshTrans_PrepareVertexCount', [bm_void_p, bm_CKDWORD])
|
||||
## BMMeshTrans_PrepareVertex
|
||||
# @param trans[in] Type: BMap::BMMeshTransition*. The pointer to corresponding BMMeshTransition.
|
||||
# @param out_mem[out] Type: LibCmo::VxMath::VxVector3*. Use ctypes.byref(data) pass it.
|
||||
# @return True if no error, otherwise False.
|
||||
BMMeshTrans_PrepareVertex = _create_bmap_func('BMMeshTrans_PrepareVertex', [bm_void_p, bm_VxVector3_pp])
|
||||
## BMMeshTrans_PrepareNormalCount
|
||||
# @param trans[in] Type: BMap::BMMeshTransition*. The pointer to corresponding BMMeshTransition.
|
||||
# @param count[in] Type: LibCmo::CKDWORD.
|
||||
# @return True if no error, otherwise False.
|
||||
BMMeshTrans_PrepareNormalCount = _create_bmap_func('BMMeshTrans_PrepareNormalCount', [bm_void_p, bm_CKDWORD])
|
||||
## BMMeshTrans_PrepareNormal
|
||||
# @param trans[in] Type: BMap::BMMeshTransition*. The pointer to corresponding BMMeshTransition.
|
||||
# @param out_mem[out] Type: LibCmo::VxMath::VxVector3*. Use ctypes.byref(data) pass it.
|
||||
# @return True if no error, otherwise False.
|
||||
BMMeshTrans_PrepareNormal = _create_bmap_func('BMMeshTrans_PrepareNormal', [bm_void_p, bm_VxVector3_pp])
|
||||
## BMMeshTrans_PrepareUVCount
|
||||
# @param trans[in] Type: BMap::BMMeshTransition*. The pointer to corresponding BMMeshTransition.
|
||||
# @param count[in] Type: LibCmo::CKDWORD.
|
||||
# @return True if no error, otherwise False.
|
||||
BMMeshTrans_PrepareUVCount = _create_bmap_func('BMMeshTrans_PrepareUVCount', [bm_void_p, bm_CKDWORD])
|
||||
## BMMeshTrans_PrepareUV
|
||||
# @param trans[in] Type: BMap::BMMeshTransition*. The pointer to corresponding BMMeshTransition.
|
||||
# @param out_mem[out] Type: LibCmo::VxMath::VxVector2*. Use ctypes.byref(data) pass it.
|
||||
# @return True if no error, otherwise False.
|
||||
BMMeshTrans_PrepareUV = _create_bmap_func('BMMeshTrans_PrepareUV', [bm_void_p, bm_VxVector2_pp])
|
||||
## BMMeshTrans_PrepareMtlSlotCount
|
||||
# @param trans[in] Type: BMap::BMMeshTransition*. The pointer to corresponding BMMeshTransition.
|
||||
# @param count[in] Type: LibCmo::CKDWORD.
|
||||
# @return True if no error, otherwise False.
|
||||
BMMeshTrans_PrepareMtlSlotCount = _create_bmap_func('BMMeshTrans_PrepareMtlSlotCount', [bm_void_p, bm_CKDWORD])
|
||||
## BMMeshTrans_PrepareMtlSlot
|
||||
# @param trans[in] Type: BMap::BMMeshTransition*. The pointer to corresponding BMMeshTransition.
|
||||
# @param out_mem[out] Type: LibCmo::CK2::CK_ID*. Use ctypes.byref(data) pass it.
|
||||
# @return True if no error, otherwise False.
|
||||
BMMeshTrans_PrepareMtlSlot = _create_bmap_func('BMMeshTrans_PrepareMtlSlot', [bm_void_p, bm_CKID_pp])
|
||||
## BMMeshTrans_PrepareFaceCount
|
||||
# @param trans[in] Type: BMap::BMMeshTransition*. The pointer to corresponding BMMeshTransition.
|
||||
# @param count[in] Type: LibCmo::CKDWORD.
|
||||
# @return True if no error, otherwise False.
|
||||
BMMeshTrans_PrepareFaceCount = _create_bmap_func('BMMeshTrans_PrepareFaceCount', [bm_void_p, bm_CKDWORD])
|
||||
## BMMeshTrans_PrepareFaceVertexIndices
|
||||
# @param trans[in] Type: BMap::BMMeshTransition*. The pointer to corresponding BMMeshTransition.
|
||||
# @param out_mem[out] Type: LibCmo::CKDWORD*. Use ctypes.byref(data) pass it.
|
||||
# @return True if no error, otherwise False.
|
||||
BMMeshTrans_PrepareFaceVertexIndices = _create_bmap_func('BMMeshTrans_PrepareFaceVertexIndices', [bm_void_p, bm_CKDWORD_pp])
|
||||
## BMMeshTrans_PrepareFaceNormalIndices
|
||||
# @param trans[in] Type: BMap::BMMeshTransition*. The pointer to corresponding BMMeshTransition.
|
||||
# @param out_mem[out] Type: LibCmo::CKDWORD*. Use ctypes.byref(data) pass it.
|
||||
# @return True if no error, otherwise False.
|
||||
BMMeshTrans_PrepareFaceNormalIndices = _create_bmap_func('BMMeshTrans_PrepareFaceNormalIndices', [bm_void_p, bm_CKDWORD_pp])
|
||||
## BMMeshTrans_PrepareFaceUVIndices
|
||||
# @param trans[in] Type: BMap::BMMeshTransition*. The pointer to corresponding BMMeshTransition.
|
||||
# @param out_mem[out] Type: LibCmo::CKDWORD*. Use ctypes.byref(data) pass it.
|
||||
# @return True if no error, otherwise False.
|
||||
BMMeshTrans_PrepareFaceUVIndices = _create_bmap_func('BMMeshTrans_PrepareFaceUVIndices', [bm_void_p, bm_CKDWORD_pp])
|
||||
## BMMeshTrans_PrepareFaceMtlSlot
|
||||
# @param trans[in] Type: BMap::BMMeshTransition*. The pointer to corresponding BMMeshTransition.
|
||||
# @param out_mem[out] Type: LibCmo::CKDWORD*. Use ctypes.byref(data) pass it.
|
||||
# @return True if no error, otherwise False.
|
||||
BMMeshTrans_PrepareFaceMtlSlot = _create_bmap_func('BMMeshTrans_PrepareFaceMtlSlot', [bm_void_p, bm_CKDWORD_pp])
|
||||
## BMMeshTrans_Parse
|
||||
# @param trans[in] Type: BMap::BMMeshTransition*. The pointer to corresponding BMMeshTransition.
|
||||
# @param bmfile[in] Type: BMap::BMFile*.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID.
|
||||
# @return True if no error, otherwise False.
|
||||
BMMeshTrans_Parse = _create_bmap_func('BMMeshTrans_Parse', [bm_void_p, bm_void_p, bm_CKID])
|
||||
## BMObject_GetName
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param out_name[out] Type: LibCmo::CKSTRING. Use ctypes.byref(data) pass it.
|
||||
# @return True if no error, otherwise False.
|
||||
BMObject_GetName = _create_bmap_func('BMObject_GetName', [bm_void_p, bm_CKID, bm_CKSTRING_p])
|
||||
## BMObject_SetName
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param name[in] Type: LibCmo::CKSTRING.
|
||||
# @return True if no error, otherwise False.
|
||||
BMObject_SetName = _create_bmap_func('BMObject_SetName', [bm_void_p, bm_CKID, bm_CKSTRING])
|
||||
## BMGroup_AddObject
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param memberid[in] Type: LibCmo::CK2::CK_ID.
|
||||
# @return True if no error, otherwise False.
|
||||
BMGroup_AddObject = _create_bmap_func('BMGroup_AddObject', [bm_void_p, bm_CKID, bm_CKID])
|
||||
## BMGroup_GetObjectCount
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param out_count[out] Type: LibCmo::CKDWORD. Use ctypes.byref(data) pass it.
|
||||
# @return True if no error, otherwise False.
|
||||
BMGroup_GetObjectCount = _create_bmap_func('BMGroup_GetObjectCount', [bm_void_p, bm_CKID, bm_CKDWORD_p])
|
||||
## BMGroup_GetObject
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param pos[in] Type: LibCmo::CKDWORD.
|
||||
# @param out_objid[out] Type: LibCmo::CK2::CK_ID. Use ctypes.byref(data) pass it.
|
||||
# @return True if no error, otherwise False.
|
||||
BMGroup_GetObject = _create_bmap_func('BMGroup_GetObject', [bm_void_p, bm_CKID, bm_CKDWORD, bm_CKID_p])
|
||||
## BMTexture_GetFileName
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param out_filename[out] Type: LibCmo::CKSTRING. Use ctypes.byref(data) pass it.
|
||||
# @return True if no error, otherwise False.
|
||||
BMTexture_GetFileName = _create_bmap_func('BMTexture_GetFileName', [bm_void_p, bm_CKID, bm_CKSTRING_p])
|
||||
## BMTexture_LoadImage
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param filename[in] Type: LibCmo::CKSTRING.
|
||||
# @return True if no error, otherwise False.
|
||||
BMTexture_LoadImage = _create_bmap_func('BMTexture_LoadImage', [bm_void_p, bm_CKID, bm_CKSTRING])
|
||||
## BMTexture_SaveImage
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param filename[in] Type: LibCmo::CKSTRING.
|
||||
# @return True if no error, otherwise False.
|
||||
BMTexture_SaveImage = _create_bmap_func('BMTexture_SaveImage', [bm_void_p, bm_CKID, bm_CKSTRING])
|
||||
## BMTexture_GetSaveOptions
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param out_saveopt[out] Type: LibCmo::CK2::CK_TEXTURE_SAVEOPTIONS. Use ctypes.byref(data) pass it.
|
||||
# @return True if no error, otherwise False.
|
||||
BMTexture_GetSaveOptions = _create_bmap_func('BMTexture_GetSaveOptions', [bm_void_p, bm_CKID, bm_enum_p])
|
||||
## BMTexture_SetSaveOptions
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param saveopt[in] Type: LibCmo::CK2::CK_TEXTURE_SAVEOPTIONS.
|
||||
# @return True if no error, otherwise False.
|
||||
BMTexture_SetSaveOptions = _create_bmap_func('BMTexture_SetSaveOptions', [bm_void_p, bm_CKID, bm_enum])
|
||||
## BMTexture_GetVideoFormat
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param out_vfmt[out] Type: LibCmo::VxMath::VX_PIXELFORMAT. Use ctypes.byref(data) pass it.
|
||||
# @return True if no error, otherwise False.
|
||||
BMTexture_GetVideoFormat = _create_bmap_func('BMTexture_GetVideoFormat', [bm_void_p, bm_CKID, bm_enum_p])
|
||||
## BMTexture_SetVideoFormat
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param vfmt[in] Type: LibCmo::VxMath::VX_PIXELFORMAT.
|
||||
# @return True if no error, otherwise False.
|
||||
BMTexture_SetVideoFormat = _create_bmap_func('BMTexture_SetVideoFormat', [bm_void_p, bm_CKID, bm_enum])
|
||||
## BMMaterial_GetDiffuse
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param out_val[out] Type: LibCmo::VxMath::VxColor. Use ctypes.byref(data) pass it.
|
||||
# @return True if no error, otherwise False.
|
||||
BMMaterial_GetDiffuse = _create_bmap_func('BMMaterial_GetDiffuse', [bm_void_p, bm_CKID, bm_VxColor_p])
|
||||
## BMMaterial_SetDiffuse
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param col[in] Type: LibCmo::VxMath::VxColor.
|
||||
# @return True if no error, otherwise False.
|
||||
BMMaterial_SetDiffuse = _create_bmap_func('BMMaterial_SetDiffuse', [bm_void_p, bm_CKID, bm_VxColor])
|
||||
## BMMaterial_GetAmbient
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param out_val[out] Type: LibCmo::VxMath::VxColor. Use ctypes.byref(data) pass it.
|
||||
# @return True if no error, otherwise False.
|
||||
BMMaterial_GetAmbient = _create_bmap_func('BMMaterial_GetAmbient', [bm_void_p, bm_CKID, bm_VxColor_p])
|
||||
## BMMaterial_SetAmbient
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param col[in] Type: LibCmo::VxMath::VxColor.
|
||||
# @return True if no error, otherwise False.
|
||||
BMMaterial_SetAmbient = _create_bmap_func('BMMaterial_SetAmbient', [bm_void_p, bm_CKID, bm_VxColor])
|
||||
## BMMaterial_GetSpecular
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param out_val[out] Type: LibCmo::VxMath::VxColor. Use ctypes.byref(data) pass it.
|
||||
# @return True if no error, otherwise False.
|
||||
BMMaterial_GetSpecular = _create_bmap_func('BMMaterial_GetSpecular', [bm_void_p, bm_CKID, bm_VxColor_p])
|
||||
## BMMaterial_SetSpecular
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param col[in] Type: LibCmo::VxMath::VxColor.
|
||||
# @return True if no error, otherwise False.
|
||||
BMMaterial_SetSpecular = _create_bmap_func('BMMaterial_SetSpecular', [bm_void_p, bm_CKID, bm_VxColor])
|
||||
## BMMaterial_GetEmissive
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param out_val[out] Type: LibCmo::VxMath::VxColor. Use ctypes.byref(data) pass it.
|
||||
# @return True if no error, otherwise False.
|
||||
BMMaterial_GetEmissive = _create_bmap_func('BMMaterial_GetEmissive', [bm_void_p, bm_CKID, bm_VxColor_p])
|
||||
## BMMaterial_SetEmissive
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param col[in] Type: LibCmo::VxMath::VxColor.
|
||||
# @return True if no error, otherwise False.
|
||||
BMMaterial_SetEmissive = _create_bmap_func('BMMaterial_SetEmissive', [bm_void_p, bm_CKID, bm_VxColor])
|
||||
## BMMaterial_GetSpecularPower
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param out_val[out] Type: LibCmo::CKFLOAT. Use ctypes.byref(data) pass it.
|
||||
# @return True if no error, otherwise False.
|
||||
BMMaterial_GetSpecularPower = _create_bmap_func('BMMaterial_GetSpecularPower', [bm_void_p, bm_CKID, bm_CKFLOAT_p])
|
||||
## BMMaterial_SetSpecularPower
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param val[in] Type: LibCmo::CKFLOAT.
|
||||
# @return True if no error, otherwise False.
|
||||
BMMaterial_SetSpecularPower = _create_bmap_func('BMMaterial_SetSpecularPower', [bm_void_p, bm_CKID, bm_CKFLOAT])
|
||||
## BMMaterial_GetTexture
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param out_texid[out] Type: LibCmo::CK2::CK_ID. Use ctypes.byref(data) pass it.
|
||||
# @return True if no error, otherwise False.
|
||||
BMMaterial_GetTexture = _create_bmap_func('BMMaterial_GetTexture', [bm_void_p, bm_CKID, bm_CKID_p])
|
||||
## BMMaterial_SetTexture
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param texid[in] Type: LibCmo::CK2::CK_ID.
|
||||
# @return True if no error, otherwise False.
|
||||
BMMaterial_SetTexture = _create_bmap_func('BMMaterial_SetTexture', [bm_void_p, bm_CKID, bm_CKID])
|
||||
## BMMaterial_GetTextureBorderColor
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param out_val[out] Type: LibCmo::CKDWORD. Use ctypes.byref(data) pass it.
|
||||
# @return True if no error, otherwise False.
|
||||
BMMaterial_GetTextureBorderColor = _create_bmap_func('BMMaterial_GetTextureBorderColor', [bm_void_p, bm_CKID, bm_CKDWORD_p])
|
||||
## BMMaterial_SetTextureBorderColor
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param val[in] Type: LibCmo::CKDWORD.
|
||||
# @return True if no error, otherwise False.
|
||||
BMMaterial_SetTextureBorderColor = _create_bmap_func('BMMaterial_SetTextureBorderColor', [bm_void_p, bm_CKID, bm_CKDWORD])
|
||||
## BMMaterial_GetTextureBlendMode
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param out_val[out] Type: LibCmo::VxMath::VXTEXTURE_BLENDMODE. Use ctypes.byref(data) pass it.
|
||||
# @return True if no error, otherwise False.
|
||||
BMMaterial_GetTextureBlendMode = _create_bmap_func('BMMaterial_GetTextureBlendMode', [bm_void_p, bm_CKID, bm_enum_p])
|
||||
## BMMaterial_SetTextureBlendMode
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param val[in] Type: LibCmo::VxMath::VXTEXTURE_BLENDMODE.
|
||||
# @return True if no error, otherwise False.
|
||||
BMMaterial_SetTextureBlendMode = _create_bmap_func('BMMaterial_SetTextureBlendMode', [bm_void_p, bm_CKID, bm_enum])
|
||||
## BMMaterial_GetTextureMinMode
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param out_val[out] Type: LibCmo::VxMath::VXTEXTURE_FILTERMODE. Use ctypes.byref(data) pass it.
|
||||
# @return True if no error, otherwise False.
|
||||
BMMaterial_GetTextureMinMode = _create_bmap_func('BMMaterial_GetTextureMinMode', [bm_void_p, bm_CKID, bm_enum_p])
|
||||
## BMMaterial_SetTextureMinMode
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param val[in] Type: LibCmo::VxMath::VXTEXTURE_FILTERMODE.
|
||||
# @return True if no error, otherwise False.
|
||||
BMMaterial_SetTextureMinMode = _create_bmap_func('BMMaterial_SetTextureMinMode', [bm_void_p, bm_CKID, bm_enum])
|
||||
## BMMaterial_GetTextureMagMode
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param out_val[out] Type: LibCmo::VxMath::VXTEXTURE_FILTERMODE. Use ctypes.byref(data) pass it.
|
||||
# @return True if no error, otherwise False.
|
||||
BMMaterial_GetTextureMagMode = _create_bmap_func('BMMaterial_GetTextureMagMode', [bm_void_p, bm_CKID, bm_enum_p])
|
||||
## BMMaterial_SetTextureMagMode
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param val[in] Type: LibCmo::VxMath::VXTEXTURE_FILTERMODE.
|
||||
# @return True if no error, otherwise False.
|
||||
BMMaterial_SetTextureMagMode = _create_bmap_func('BMMaterial_SetTextureMagMode', [bm_void_p, bm_CKID, bm_enum])
|
||||
## BMMaterial_GetTextureAddressMode
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param out_val[out] Type: LibCmo::VxMath::VXTEXTURE_ADDRESSMODE. Use ctypes.byref(data) pass it.
|
||||
# @return True if no error, otherwise False.
|
||||
BMMaterial_GetTextureAddressMode = _create_bmap_func('BMMaterial_GetTextureAddressMode', [bm_void_p, bm_CKID, bm_enum_p])
|
||||
## BMMaterial_SetTextureAddressMode
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param val[in] Type: LibCmo::VxMath::VXTEXTURE_ADDRESSMODE.
|
||||
# @return True if no error, otherwise False.
|
||||
BMMaterial_SetTextureAddressMode = _create_bmap_func('BMMaterial_SetTextureAddressMode', [bm_void_p, bm_CKID, bm_enum])
|
||||
## BMMaterial_GetSourceBlend
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param out_val[out] Type: LibCmo::VxMath::VXBLEND_MODE. Use ctypes.byref(data) pass it.
|
||||
# @return True if no error, otherwise False.
|
||||
BMMaterial_GetSourceBlend = _create_bmap_func('BMMaterial_GetSourceBlend', [bm_void_p, bm_CKID, bm_enum_p])
|
||||
## BMMaterial_SetSourceBlend
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param val[in] Type: LibCmo::VxMath::VXBLEND_MODE.
|
||||
# @return True if no error, otherwise False.
|
||||
BMMaterial_SetSourceBlend = _create_bmap_func('BMMaterial_SetSourceBlend', [bm_void_p, bm_CKID, bm_enum])
|
||||
## BMMaterial_GetDestBlend
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param out_val[out] Type: LibCmo::VxMath::VXBLEND_MODE. Use ctypes.byref(data) pass it.
|
||||
# @return True if no error, otherwise False.
|
||||
BMMaterial_GetDestBlend = _create_bmap_func('BMMaterial_GetDestBlend', [bm_void_p, bm_CKID, bm_enum_p])
|
||||
## BMMaterial_SetDestBlend
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param val[in] Type: LibCmo::VxMath::VXBLEND_MODE.
|
||||
# @return True if no error, otherwise False.
|
||||
BMMaterial_SetDestBlend = _create_bmap_func('BMMaterial_SetDestBlend', [bm_void_p, bm_CKID, bm_enum])
|
||||
## BMMaterial_GetFillMode
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param out_val[out] Type: LibCmo::VxMath::VXFILL_MODE. Use ctypes.byref(data) pass it.
|
||||
# @return True if no error, otherwise False.
|
||||
BMMaterial_GetFillMode = _create_bmap_func('BMMaterial_GetFillMode', [bm_void_p, bm_CKID, bm_enum_p])
|
||||
## BMMaterial_SetFillMode
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param val[in] Type: LibCmo::VxMath::VXFILL_MODE.
|
||||
# @return True if no error, otherwise False.
|
||||
BMMaterial_SetFillMode = _create_bmap_func('BMMaterial_SetFillMode', [bm_void_p, bm_CKID, bm_enum])
|
||||
## BMMaterial_GetShadeMode
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param out_val[out] Type: LibCmo::VxMath::VXSHADE_MODE. Use ctypes.byref(data) pass it.
|
||||
# @return True if no error, otherwise False.
|
||||
BMMaterial_GetShadeMode = _create_bmap_func('BMMaterial_GetShadeMode', [bm_void_p, bm_CKID, bm_enum_p])
|
||||
## BMMaterial_SetShadeMode
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param val[in] Type: LibCmo::VxMath::VXSHADE_MODE.
|
||||
# @return True if no error, otherwise False.
|
||||
BMMaterial_SetShadeMode = _create_bmap_func('BMMaterial_SetShadeMode', [bm_void_p, bm_CKID, bm_enum])
|
||||
## BMMaterial_GetAlphaTestEnabled
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param out_val[out] Type: bool. Use ctypes.byref(data) pass it.
|
||||
# @return True if no error, otherwise False.
|
||||
BMMaterial_GetAlphaTestEnabled = _create_bmap_func('BMMaterial_GetAlphaTestEnabled', [bm_void_p, bm_CKID, bm_bool_p])
|
||||
## BMMaterial_SetAlphaTestEnabled
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param enabled[in] Type: bool.
|
||||
# @return True if no error, otherwise False.
|
||||
BMMaterial_SetAlphaTestEnabled = _create_bmap_func('BMMaterial_SetAlphaTestEnabled', [bm_void_p, bm_CKID, bm_bool])
|
||||
## BMMaterial_GetAlphaBlendEnabled
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param out_val[out] Type: bool. Use ctypes.byref(data) pass it.
|
||||
# @return True if no error, otherwise False.
|
||||
BMMaterial_GetAlphaBlendEnabled = _create_bmap_func('BMMaterial_GetAlphaBlendEnabled', [bm_void_p, bm_CKID, bm_bool_p])
|
||||
## BMMaterial_SetAlphaBlendEnabled
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param enabled[in] Type: bool.
|
||||
# @return True if no error, otherwise False.
|
||||
BMMaterial_SetAlphaBlendEnabled = _create_bmap_func('BMMaterial_SetAlphaBlendEnabled', [bm_void_p, bm_CKID, bm_bool])
|
||||
## BMMaterial_GetPerspectiveCorrectionEnabled
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param out_val[out] Type: bool. Use ctypes.byref(data) pass it.
|
||||
# @return True if no error, otherwise False.
|
||||
BMMaterial_GetPerspectiveCorrectionEnabled = _create_bmap_func('BMMaterial_GetPerspectiveCorrectionEnabled', [bm_void_p, bm_CKID, bm_bool_p])
|
||||
## BMMaterial_SetPerspectiveCorrectionEnabled
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param enabled[in] Type: bool.
|
||||
# @return True if no error, otherwise False.
|
||||
BMMaterial_SetPerspectiveCorrectionEnabled = _create_bmap_func('BMMaterial_SetPerspectiveCorrectionEnabled', [bm_void_p, bm_CKID, bm_bool])
|
||||
## BMMaterial_GetZWriteEnabled
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param out_val[out] Type: bool. Use ctypes.byref(data) pass it.
|
||||
# @return True if no error, otherwise False.
|
||||
BMMaterial_GetZWriteEnabled = _create_bmap_func('BMMaterial_GetZWriteEnabled', [bm_void_p, bm_CKID, bm_bool_p])
|
||||
## BMMaterial_SetZWriteEnabled
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param enabled[in] Type: bool.
|
||||
# @return True if no error, otherwise False.
|
||||
BMMaterial_SetZWriteEnabled = _create_bmap_func('BMMaterial_SetZWriteEnabled', [bm_void_p, bm_CKID, bm_bool])
|
||||
## BMMaterial_GetTwoSidedEnabled
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param out_val[out] Type: bool. Use ctypes.byref(data) pass it.
|
||||
# @return True if no error, otherwise False.
|
||||
BMMaterial_GetTwoSidedEnabled = _create_bmap_func('BMMaterial_GetTwoSidedEnabled', [bm_void_p, bm_CKID, bm_bool_p])
|
||||
## BMMaterial_SetTwoSidedEnabled
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param enabled[in] Type: bool.
|
||||
# @return True if no error, otherwise False.
|
||||
BMMaterial_SetTwoSidedEnabled = _create_bmap_func('BMMaterial_SetTwoSidedEnabled', [bm_void_p, bm_CKID, bm_bool])
|
||||
## BMMaterial_GetAlphaRef
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param out_val[out] Type: LibCmo::CKBYTE. Use ctypes.byref(data) pass it.
|
||||
# @return True if no error, otherwise False.
|
||||
BMMaterial_GetAlphaRef = _create_bmap_func('BMMaterial_GetAlphaRef', [bm_void_p, bm_CKID, bm_CKBYTE_p])
|
||||
## BMMaterial_SetAlphaRef
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param val[in] Type: LibCmo::CKBYTE.
|
||||
# @return True if no error, otherwise False.
|
||||
BMMaterial_SetAlphaRef = _create_bmap_func('BMMaterial_SetAlphaRef', [bm_void_p, bm_CKID, bm_CKBYTE])
|
||||
## BMMaterial_GetAlphaFunc
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param out_val[out] Type: LibCmo::VxMath::VXCMPFUNC. Use ctypes.byref(data) pass it.
|
||||
# @return True if no error, otherwise False.
|
||||
BMMaterial_GetAlphaFunc = _create_bmap_func('BMMaterial_GetAlphaFunc', [bm_void_p, bm_CKID, bm_enum_p])
|
||||
## BMMaterial_SetAlphaFunc
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param val[in] Type: LibCmo::VxMath::VXCMPFUNC.
|
||||
# @return True if no error, otherwise False.
|
||||
BMMaterial_SetAlphaFunc = _create_bmap_func('BMMaterial_SetAlphaFunc', [bm_void_p, bm_CKID, bm_enum])
|
||||
## BMMaterial_GetZFunc
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param out_val[out] Type: LibCmo::VxMath::VXCMPFUNC. Use ctypes.byref(data) pass it.
|
||||
# @return True if no error, otherwise False.
|
||||
BMMaterial_GetZFunc = _create_bmap_func('BMMaterial_GetZFunc', [bm_void_p, bm_CKID, bm_enum_p])
|
||||
## BMMaterial_SetZFunc
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param val[in] Type: LibCmo::VxMath::VXCMPFUNC.
|
||||
# @return True if no error, otherwise False.
|
||||
BMMaterial_SetZFunc = _create_bmap_func('BMMaterial_SetZFunc', [bm_void_p, bm_CKID, bm_enum])
|
||||
## BMMesh_GetLitMode
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param out_mode[out] Type: LibCmo::VxMath::VXMESH_LITMODE. Use ctypes.byref(data) pass it.
|
||||
# @return True if no error, otherwise False.
|
||||
BMMesh_GetLitMode = _create_bmap_func('BMMesh_GetLitMode', [bm_void_p, bm_CKID, bm_enum_p])
|
||||
## BMMesh_SetLitMode
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param mode[in] Type: LibCmo::VxMath::VXMESH_LITMODE.
|
||||
# @return True if no error, otherwise False.
|
||||
BMMesh_SetLitMode = _create_bmap_func('BMMesh_SetLitMode', [bm_void_p, bm_CKID, bm_enum])
|
||||
## BMMesh_GetVertexCount
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param out_count[out] Type: LibCmo::CKDWORD. Use ctypes.byref(data) pass it.
|
||||
# @return True if no error, otherwise False.
|
||||
BMMesh_GetVertexCount = _create_bmap_func('BMMesh_GetVertexCount', [bm_void_p, bm_CKID, bm_CKDWORD_p])
|
||||
## BMMesh_SetVertexCount
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param count[in] Type: LibCmo::CKDWORD.
|
||||
# @return True if no error, otherwise False.
|
||||
BMMesh_SetVertexCount = _create_bmap_func('BMMesh_SetVertexCount', [bm_void_p, bm_CKID, bm_CKDWORD])
|
||||
## BMMesh_GetVertexPositions
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param out_mem[out] Type: LibCmo::VxMath::VxVector3*. Use ctypes.byref(data) pass it.
|
||||
# @return True if no error, otherwise False.
|
||||
BMMesh_GetVertexPositions = _create_bmap_func('BMMesh_GetVertexPositions', [bm_void_p, bm_CKID, bm_VxVector3_pp])
|
||||
## BMMesh_GetVertexNormals
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param out_mem[out] Type: LibCmo::VxMath::VxVector3*. Use ctypes.byref(data) pass it.
|
||||
# @return True if no error, otherwise False.
|
||||
BMMesh_GetVertexNormals = _create_bmap_func('BMMesh_GetVertexNormals', [bm_void_p, bm_CKID, bm_VxVector3_pp])
|
||||
## BMMesh_GetVertexUVs
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param out_mem[out] Type: LibCmo::VxMath::VxVector2*. Use ctypes.byref(data) pass it.
|
||||
# @return True if no error, otherwise False.
|
||||
BMMesh_GetVertexUVs = _create_bmap_func('BMMesh_GetVertexUVs', [bm_void_p, bm_CKID, bm_VxVector2_pp])
|
||||
## BMMesh_GetFaceCount
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param out_count[out] Type: LibCmo::CKDWORD. Use ctypes.byref(data) pass it.
|
||||
# @return True if no error, otherwise False.
|
||||
BMMesh_GetFaceCount = _create_bmap_func('BMMesh_GetFaceCount', [bm_void_p, bm_CKID, bm_CKDWORD_p])
|
||||
## BMMesh_SetFaceCount
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param count[in] Type: LibCmo::CKDWORD.
|
||||
# @return True if no error, otherwise False.
|
||||
BMMesh_SetFaceCount = _create_bmap_func('BMMesh_SetFaceCount', [bm_void_p, bm_CKID, bm_CKDWORD])
|
||||
## BMMesh_GetFaceIndices
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param out_mem[out] Type: LibCmo::CKWORD*. Use ctypes.byref(data) pass it.
|
||||
# @return True if no error, otherwise False.
|
||||
BMMesh_GetFaceIndices = _create_bmap_func('BMMesh_GetFaceIndices', [bm_void_p, bm_CKID, bm_CKWORD_pp])
|
||||
## BMMesh_GetFaceMaterialSlotIndexs
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param out_mem[out] Type: LibCmo::CKWORD*. Use ctypes.byref(data) pass it.
|
||||
# @return True if no error, otherwise False.
|
||||
BMMesh_GetFaceMaterialSlotIndexs = _create_bmap_func('BMMesh_GetFaceMaterialSlotIndexs', [bm_void_p, bm_CKID, bm_CKWORD_pp])
|
||||
## BMMesh_GetMaterialSlotCount
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param out_count[out] Type: LibCmo::CKDWORD. Use ctypes.byref(data) pass it.
|
||||
# @return True if no error, otherwise False.
|
||||
BMMesh_GetMaterialSlotCount = _create_bmap_func('BMMesh_GetMaterialSlotCount', [bm_void_p, bm_CKID, bm_CKDWORD_p])
|
||||
## BMMesh_SetMaterialSlotCount
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param count[in] Type: LibCmo::CKDWORD.
|
||||
# @return True if no error, otherwise False.
|
||||
BMMesh_SetMaterialSlotCount = _create_bmap_func('BMMesh_SetMaterialSlotCount', [bm_void_p, bm_CKID, bm_CKDWORD])
|
||||
## BMMesh_GetMaterialSlot
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param index[in] Type: LibCmo::CKDWORD.
|
||||
# @param out_mtlid[out] Type: LibCmo::CK2::CK_ID. Use ctypes.byref(data) pass it.
|
||||
# @return True if no error, otherwise False.
|
||||
BMMesh_GetMaterialSlot = _create_bmap_func('BMMesh_GetMaterialSlot', [bm_void_p, bm_CKID, bm_CKDWORD, bm_CKID_p])
|
||||
## BMMesh_SetMaterialSlot
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param index[in] Type: LibCmo::CKDWORD.
|
||||
# @param mtlid[in] Type: LibCmo::CK2::CK_ID.
|
||||
# @return True if no error, otherwise False.
|
||||
BMMesh_SetMaterialSlot = _create_bmap_func('BMMesh_SetMaterialSlot', [bm_void_p, bm_CKID, bm_CKDWORD, bm_CKID])
|
||||
## BM3dEntity_GetWorldMatrix
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param out_mat[out] Type: LibCmo::VxMath::VxMatrix. Use ctypes.byref(data) pass it.
|
||||
# @return True if no error, otherwise False.
|
||||
BM3dEntity_GetWorldMatrix = _create_bmap_func('BM3dEntity_GetWorldMatrix', [bm_void_p, bm_CKID, bm_VxMatrix_p])
|
||||
## BM3dEntity_SetWorldMatrix
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param mat[in] Type: LibCmo::VxMath::VxMatrix.
|
||||
# @return True if no error, otherwise False.
|
||||
BM3dEntity_SetWorldMatrix = _create_bmap_func('BM3dEntity_SetWorldMatrix', [bm_void_p, bm_CKID, bm_VxMatrix])
|
||||
## BM3dEntity_GetCurrentMesh
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param out_meshid[out] Type: LibCmo::CK2::CK_ID. Use ctypes.byref(data) pass it.
|
||||
# @return True if no error, otherwise False.
|
||||
BM3dEntity_GetCurrentMesh = _create_bmap_func('BM3dEntity_GetCurrentMesh', [bm_void_p, bm_CKID, bm_CKID_p])
|
||||
## BM3dEntity_SetCurrentMesh
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param meshid[in] Type: LibCmo::CK2::CK_ID.
|
||||
# @return True if no error, otherwise False.
|
||||
BM3dEntity_SetCurrentMesh = _create_bmap_func('BM3dEntity_SetCurrentMesh', [bm_void_p, bm_CKID, bm_CKID])
|
||||
## BM3dEntity_GetVisibility
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param out_isVisible[out] Type: bool. Use ctypes.byref(data) pass it.
|
||||
# @return True if no error, otherwise False.
|
||||
BM3dEntity_GetVisibility = _create_bmap_func('BM3dEntity_GetVisibility', [bm_void_p, bm_CKID, bm_bool_p])
|
||||
## BM3dEntity_SetVisibility
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param is_visible[in] Type: bool.
|
||||
# @return True if no error, otherwise False.
|
||||
BM3dEntity_SetVisibility = _create_bmap_func('BM3dEntity_SetVisibility', [bm_void_p, bm_CKID, bm_bool])
|
||||
## BMLight_GetType
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param out_val[out] Type: LibCmo::VxMath::VXLIGHT_TYPE. Use ctypes.byref(data) pass it.
|
||||
# @return True if no error, otherwise False.
|
||||
BMLight_GetType = _create_bmap_func('BMLight_GetType', [bm_void_p, bm_CKID, bm_enum_p])
|
||||
## BMLight_SetType
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param val[in] Type: LibCmo::VxMath::VXLIGHT_TYPE.
|
||||
# @return True if no error, otherwise False.
|
||||
BMLight_SetType = _create_bmap_func('BMLight_SetType', [bm_void_p, bm_CKID, bm_enum])
|
||||
## BMLight_GetColor
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param out_val[out] Type: LibCmo::VxMath::VxColor. Use ctypes.byref(data) pass it.
|
||||
# @return True if no error, otherwise False.
|
||||
BMLight_GetColor = _create_bmap_func('BMLight_GetColor', [bm_void_p, bm_CKID, bm_VxColor_p])
|
||||
## BMLight_SetColor
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param col[in] Type: LibCmo::VxMath::VxColor.
|
||||
# @return True if no error, otherwise False.
|
||||
BMLight_SetColor = _create_bmap_func('BMLight_SetColor', [bm_void_p, bm_CKID, bm_VxColor])
|
||||
## BMLight_GetConstantAttenuation
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param out_val[out] Type: LibCmo::CKFLOAT. Use ctypes.byref(data) pass it.
|
||||
# @return True if no error, otherwise False.
|
||||
BMLight_GetConstantAttenuation = _create_bmap_func('BMLight_GetConstantAttenuation', [bm_void_p, bm_CKID, bm_CKFLOAT_p])
|
||||
## BMLight_SetConstantAttenuation
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param val[in] Type: LibCmo::CKFLOAT.
|
||||
# @return True if no error, otherwise False.
|
||||
BMLight_SetConstantAttenuation = _create_bmap_func('BMLight_SetConstantAttenuation', [bm_void_p, bm_CKID, bm_CKFLOAT])
|
||||
## BMLight_GetLinearAttenuation
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param out_val[out] Type: LibCmo::CKFLOAT. Use ctypes.byref(data) pass it.
|
||||
# @return True if no error, otherwise False.
|
||||
BMLight_GetLinearAttenuation = _create_bmap_func('BMLight_GetLinearAttenuation', [bm_void_p, bm_CKID, bm_CKFLOAT_p])
|
||||
## BMLight_SetLinearAttenuation
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param val[in] Type: LibCmo::CKFLOAT.
|
||||
# @return True if no error, otherwise False.
|
||||
BMLight_SetLinearAttenuation = _create_bmap_func('BMLight_SetLinearAttenuation', [bm_void_p, bm_CKID, bm_CKFLOAT])
|
||||
## BMLight_GetQuadraticAttenuation
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param out_val[out] Type: LibCmo::CKFLOAT. Use ctypes.byref(data) pass it.
|
||||
# @return True if no error, otherwise False.
|
||||
BMLight_GetQuadraticAttenuation = _create_bmap_func('BMLight_GetQuadraticAttenuation', [bm_void_p, bm_CKID, bm_CKFLOAT_p])
|
||||
## BMLight_SetQuadraticAttenuation
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param val[in] Type: LibCmo::CKFLOAT.
|
||||
# @return True if no error, otherwise False.
|
||||
BMLight_SetQuadraticAttenuation = _create_bmap_func('BMLight_SetQuadraticAttenuation', [bm_void_p, bm_CKID, bm_CKFLOAT])
|
||||
## BMLight_GetRange
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param out_val[out] Type: LibCmo::CKFLOAT. Use ctypes.byref(data) pass it.
|
||||
# @return True if no error, otherwise False.
|
||||
BMLight_GetRange = _create_bmap_func('BMLight_GetRange', [bm_void_p, bm_CKID, bm_CKFLOAT_p])
|
||||
## BMLight_SetRange
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param val[in] Type: LibCmo::CKFLOAT.
|
||||
# @return True if no error, otherwise False.
|
||||
BMLight_SetRange = _create_bmap_func('BMLight_SetRange', [bm_void_p, bm_CKID, bm_CKFLOAT])
|
||||
## BMLight_GetHotSpot
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param out_val[out] Type: LibCmo::CKFLOAT. Use ctypes.byref(data) pass it.
|
||||
# @return True if no error, otherwise False.
|
||||
BMLight_GetHotSpot = _create_bmap_func('BMLight_GetHotSpot', [bm_void_p, bm_CKID, bm_CKFLOAT_p])
|
||||
## BMLight_SetHotSpot
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param val[in] Type: LibCmo::CKFLOAT.
|
||||
# @return True if no error, otherwise False.
|
||||
BMLight_SetHotSpot = _create_bmap_func('BMLight_SetHotSpot', [bm_void_p, bm_CKID, bm_CKFLOAT])
|
||||
## BMLight_GetFalloff
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param out_val[out] Type: LibCmo::CKFLOAT. Use ctypes.byref(data) pass it.
|
||||
# @return True if no error, otherwise False.
|
||||
BMLight_GetFalloff = _create_bmap_func('BMLight_GetFalloff', [bm_void_p, bm_CKID, bm_CKFLOAT_p])
|
||||
## BMLight_SetFalloff
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param val[in] Type: LibCmo::CKFLOAT.
|
||||
# @return True if no error, otherwise False.
|
||||
BMLight_SetFalloff = _create_bmap_func('BMLight_SetFalloff', [bm_void_p, bm_CKID, bm_CKFLOAT])
|
||||
## BMLight_GetFalloffShape
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param out_val[out] Type: LibCmo::CKFLOAT. Use ctypes.byref(data) pass it.
|
||||
# @return True if no error, otherwise False.
|
||||
BMLight_GetFalloffShape = _create_bmap_func('BMLight_GetFalloffShape', [bm_void_p, bm_CKID, bm_CKFLOAT_p])
|
||||
## BMLight_SetFalloffShape
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param val[in] Type: LibCmo::CKFLOAT.
|
||||
# @return True if no error, otherwise False.
|
||||
BMLight_SetFalloffShape = _create_bmap_func('BMLight_SetFalloffShape', [bm_void_p, bm_CKID, bm_CKFLOAT])
|
||||
|
||||
##### GENERATED FUNCTIONS END #####
|
||||
|
||||
#endregion
|
||||
821
Assets/BMapBindings/PyBMap/PyBMap/bmap_wrapper.py
Normal file
821
Assets/BMapBindings/PyBMap/PyBMap/bmap_wrapper.py
Normal file
@@ -0,0 +1,821 @@
|
||||
import ctypes, typing, atexit, enum
|
||||
from . import bmap, virtools_types
|
||||
|
||||
#region Basic Class & Constant Defines
|
||||
|
||||
g_InvalidPtr: bmap.bm_void_p = bmap.bm_void_p(0)
|
||||
g_InvalidCKID: int = 0
|
||||
g_BMapEncoding: str = "utf-8"
|
||||
|
||||
def _python_callback(strl: bytes):
|
||||
"""
|
||||
The Python type callback for BMFile.
|
||||
Simply add a prefix when output.
|
||||
Need a convertion before passing to BMFile.
|
||||
"""
|
||||
# YYC Remarks:
|
||||
# The passing value to this function is bytes, not bmap.bm_CKSTRING.
|
||||
# I think Python do an auto convertion in there.
|
||||
if strl is not None:
|
||||
print(f'[PyBMap] {strl.decode(g_BMapEncoding)}')
|
||||
_g_RawCallback: bmap.bm_callback = bmap.bm_callback(_python_callback)
|
||||
|
||||
#endregion
|
||||
|
||||
#region Help Functions
|
||||
|
||||
class _Utils:
|
||||
@staticmethod
|
||||
def raise_out_of_length_exception() -> None:
|
||||
raise bmap.BMapException("The length of given data is too short when assigning struct array.")
|
||||
|
||||
@staticmethod
|
||||
def _vector_assigner(pdata: typing.Any, item_count: int, factor_count: int, itor: typing.Iterator[tuple[typing.Any, ...]]) -> None:
|
||||
idx: int = 0
|
||||
try:
|
||||
for _i in range(item_count):
|
||||
user_vector: tuple[typing.Any, ...] = next(itor)
|
||||
for _j in range(factor_count):
|
||||
pdata[idx] = user_vector[_j]
|
||||
idx += 1
|
||||
except StopIteration:
|
||||
_Utils.raise_out_of_length_exception()
|
||||
|
||||
@staticmethod
|
||||
def _vector_iterator(pdata: typing.Any, item_count: int, factor_count: int) -> typing.Iterator[tuple[typing.Any, ...]]:
|
||||
idx: int = 0
|
||||
for _i in range(item_count):
|
||||
yield tuple(map(
|
||||
lambda _j: pdata[idx + _j],
|
||||
range(factor_count)
|
||||
))
|
||||
idx += factor_count
|
||||
|
||||
@staticmethod
|
||||
def vxvector3_assigner(pvector: bmap.bm_VxVector3_p, count: int, itor: typing.Iterator[virtools_types.VxVector3]) -> None:
|
||||
_Utils._vector_assigner(ctypes.cast(pvector, bmap.bm_CKFLOAT_p), count, 3, map(lambda v: (v.x, v.y, v.z), itor))
|
||||
@staticmethod
|
||||
def vxvector3_iterator(pvector: bmap.bm_VxVector3_p, count: int) -> typing.Iterator[virtools_types.VxVector3]:
|
||||
return map(
|
||||
lambda v: virtools_types.VxVector3(*v),
|
||||
_Utils._vector_iterator(ctypes.cast(pvector, bmap.bm_CKFLOAT_p), count, 3)
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def vxvector2_assigner(pvector: bmap.bm_VxVector2_p, count: int, itor: typing.Iterator[virtools_types.VxVector2]) -> None:
|
||||
_Utils._vector_assigner(ctypes.cast(pvector, bmap.bm_CKFLOAT_p), count, 2, map(lambda v: (v.x, v.y), itor))
|
||||
@staticmethod
|
||||
def vxvector2_iterator(pvector: bmap.bm_VxVector2_p, count: int) -> typing.Iterator[virtools_types.VxVector2]:
|
||||
return map(
|
||||
lambda v: virtools_types.VxVector2(*v),
|
||||
_Utils._vector_iterator(ctypes.cast(pvector, bmap.bm_CKFLOAT_p), count, 2)
|
||||
)
|
||||
|
||||
"""!
|
||||
@remarks
|
||||
bmap.bm_CKWORD_p | bmap.bm_CKDWORD_p is just a type hint.
|
||||
We actually do not need distinguish them in code.
|
||||
Because the stride when increasing them is decided by their runtime type.
|
||||
"""
|
||||
|
||||
@staticmethod
|
||||
def ckfaceindices_assigner(pindices: bmap.bm_CKWORD_p | bmap.bm_CKDWORD_p, count: int, itor: typing.Iterator[virtools_types.CKFaceIndices]) -> None:
|
||||
_Utils._vector_assigner(pindices, count, 3, map(lambda v: (v.i1, v.i2, v.i3), itor))
|
||||
@staticmethod
|
||||
def ckfaceindices_iterator(pindices: bmap.bm_CKWORD_p | bmap.bm_CKDWORD_p, count: int) -> typing.Iterator[virtools_types.CKFaceIndices]:
|
||||
return map(
|
||||
lambda v: virtools_types.CKFaceIndices(*v),
|
||||
_Utils._vector_iterator(pindices, count, 3)
|
||||
)
|
||||
|
||||
#endregion
|
||||
|
||||
#region Basic Classes
|
||||
|
||||
class _AbstractPointer():
|
||||
__mRawPointer: int
|
||||
|
||||
def __init__(self, raw_pointer: bmap.bm_void_p):
|
||||
self._set_pointer(raw_pointer)
|
||||
|
||||
def _is_valid(self) -> bool:
|
||||
return self.__mRawPointer != 0
|
||||
|
||||
def _get_pointer(self) -> bmap.bm_void_p:
|
||||
return bmap.bm_void_p(self.__mRawPointer)
|
||||
|
||||
def _set_pointer(self, raw_pointer: bmap.bm_void_p):
|
||||
if raw_pointer.value is None:
|
||||
self.__mRawPointer = 0
|
||||
else:
|
||||
self.__mRawPointer = raw_pointer.value
|
||||
|
||||
def __eq__(self, obj: object) -> bool:
|
||||
if isinstance(obj, self.__class__):
|
||||
return obj.__mRawPointer == self.__mRawPointer
|
||||
else:
|
||||
return False
|
||||
|
||||
def __hash__(self) -> int:
|
||||
return hash(self.__mRawPointer)
|
||||
|
||||
TEnumType = typing.TypeVar('TEnumType', bound = enum.IntEnum)
|
||||
TIntegralType = bmap.bm_CKDWORD | bmap.bm_CKWORD | bmap.bm_CKINT | bmap.bm_CKBYTE | bmap.bm_CKID
|
||||
TFloatPointType = bmap.bm_CKFLOAT
|
||||
TPointerType = typing.TypeVar('TPointerType')
|
||||
|
||||
class _AbstractCKObject(_AbstractPointer):
|
||||
__mCKID: int
|
||||
|
||||
def __init__(self, raw_pointer: bmap.bm_void_p, ckid: bmap.bm_CKID):
|
||||
_AbstractPointer.__init__(self, raw_pointer)
|
||||
self.__mCKID = ckid.value
|
||||
|
||||
def _is_valid(self) -> bool:
|
||||
return _AbstractPointer._is_valid(self) and self.__mCKID != 0
|
||||
|
||||
def _get_ckid(self) -> bmap.bm_CKID:
|
||||
return bmap.bm_CKID(self.__mCKID)
|
||||
|
||||
def __eq__(self, obj: object) -> bool:
|
||||
if not _AbstractPointer.__eq__(self, obj): return False
|
||||
|
||||
if isinstance(obj, self.__class__):
|
||||
return obj.__mCKID == self.__mCKID
|
||||
else:
|
||||
return False
|
||||
|
||||
def __hash__(self) -> int:
|
||||
return hash((_AbstractPointer.__hash__(self), self.__mCKID))
|
||||
|
||||
# Convenient Value Getter Setter
|
||||
# Focusing on those which widely called types.
|
||||
|
||||
def _get_primitive_value(self, primitive_type_: typing.Any, getter_: typing.Callable[[bmap.bm_void_p, bmap.bm_CKID, typing.Any], bmap.bm_bool]) -> typing.Any:
|
||||
data = primitive_type_()
|
||||
getter_(self._get_pointer(), self._get_ckid(), ctypes.byref(data))
|
||||
return data.value
|
||||
def _set_primitive_value(self, primitive_type_: typing.Any, setter_: typing.Callable[[bmap.bm_void_p, bmap.bm_CKID, typing.Any], bmap.bm_bool], data_: typing.Any) -> None:
|
||||
data = primitive_type_(data_)
|
||||
setter_(self._get_pointer(), self._get_ckid(), data)
|
||||
|
||||
def _get_integral_value(self, integral_type_: type[TIntegralType], getter_: typing.Callable[[bmap.bm_void_p, bmap.bm_CKID, typing.Any], bmap.bm_bool]) -> int:
|
||||
return self._get_primitive_value(integral_type_, getter_)
|
||||
def _set_integral_value(self, integral_type_: type[TIntegralType], setter_: typing.Callable[[bmap.bm_void_p, bmap.bm_CKID, typing.Any], bmap.bm_bool], data_: int) -> None:
|
||||
self._set_primitive_value(integral_type_, setter_, data_)
|
||||
|
||||
def _get_float_point_value(self, float_point_type_: type[TFloatPointType], getter_: typing.Callable[[bmap.bm_void_p, bmap.bm_CKID, typing.Any], bmap.bm_bool]) -> float:
|
||||
return self._get_primitive_value(float_point_type_, getter_)
|
||||
def _set_float_point_value(self, float_point_type_: type[TFloatPointType], setter_: typing.Callable[[bmap.bm_void_p, bmap.bm_CKID, typing.Any], bmap.bm_bool], data_: float) -> None:
|
||||
self._set_primitive_value(float_point_type_, setter_, data_)
|
||||
|
||||
def _get_bool_value(self, getter_: typing.Callable[[bmap.bm_void_p, bmap.bm_CKID, bmap.bm_bool_p], bmap.bm_bool]) -> bool:
|
||||
return self._get_primitive_value(bmap.bm_bool, getter_)
|
||||
def _set_bool_value(self, setter_: typing.Callable[[bmap.bm_void_p, bmap.bm_CKID, bmap.bm_bool], bmap.bm_bool], data_: bool) -> None:
|
||||
self._set_primitive_value(bmap.bm_bool, setter_, data_)
|
||||
|
||||
def _get_enum_value(self, enum_type_: type[TEnumType], getter_: typing.Callable[[bmap.bm_void_p, bmap.bm_CKID, bmap.bm_enum_p], bmap.bm_bool]) -> TEnumType:
|
||||
return enum_type_(self._get_primitive_value(bmap.bm_enum, getter_))
|
||||
def _set_enum_value(self, setter_: typing.Callable[[bmap.bm_void_p, bmap.bm_CKID, bmap.bm_enum], bmap.bm_bool], data_: TEnumType) -> None:
|
||||
self._set_primitive_value(bmap.bm_enum, setter_, data_.value)
|
||||
|
||||
def _get_str_value(self, getter_: typing.Callable[[bmap.bm_void_p, bmap.bm_CKID, bmap.bm_CKSTRING_p], bmap.bm_bool]) -> str | None:
|
||||
data: bmap.bm_CKSTRING = bmap.bm_CKSTRING()
|
||||
getter_(self._get_pointer(), self._get_ckid(), ctypes.byref(data))
|
||||
if data.value is None: return None
|
||||
else: return data.value.decode(g_BMapEncoding)
|
||||
def _set_str_value(self, setter_: typing.Callable[[bmap.bm_void_p, bmap.bm_CKID, bmap.bm_CKSTRING], bmap.bm_bool], data_: str | None) -> None:
|
||||
data: bmap.bm_CKSTRING
|
||||
if data_ is None: data = bmap.bm_CKSTRING(0)
|
||||
else: data = bmap.bm_CKSTRING(data_.encode(g_BMapEncoding))
|
||||
setter_(self._get_pointer(), self._get_ckid(), data)
|
||||
|
||||
def _set_vxcolor_value(self,
|
||||
setter_: typing.Callable[[bmap.bm_void_p, bmap.bm_CKID, bmap.bm_VxColor], bmap.bm_bool],
|
||||
col_: virtools_types.VxColor) -> None:
|
||||
# set to raw color
|
||||
col: bmap.bm_VxColor = bmap.bm_VxColor()
|
||||
(col.r, col.g, col.b, col.a) = (col_.r, col_.g, col_.b, col_.a)
|
||||
# assign
|
||||
setter_(self._get_pointer(), self._get_ckid(), col)
|
||||
def _get_vxcolor_value(self,
|
||||
getter_: typing.Callable[[bmap.bm_void_p, bmap.bm_CKID, bmap.bm_VxColor_p], bmap.bm_bool]) -> virtools_types.VxColor:
|
||||
# get raw color
|
||||
col: bmap.bm_VxColor = bmap.bm_VxColor()
|
||||
getter_(self._get_pointer(), self._get_ckid(), ctypes.byref(col))
|
||||
# get from raw color
|
||||
ret: virtools_types.VxColor = virtools_types.VxColor()
|
||||
(ret.r, ret.g, ret.b, ret.a) = (col.r, col.g, col.b, col.a)
|
||||
return ret
|
||||
|
||||
def _get_pointer_value(self, ptr_type_: type[TPointerType], getter_: typing.Callable[[bmap.bm_void_p, bmap.bm_CKID, typing.Any], bmap.bm_bool]) -> TPointerType:
|
||||
data = ptr_type_()
|
||||
getter_(self._get_pointer(), self._get_ckid(), ctypes.byref(data))
|
||||
return data
|
||||
|
||||
TCKObject = typing.TypeVar('TCKObject', bound = _AbstractCKObject)
|
||||
|
||||
#endregion
|
||||
|
||||
#region Validation Check, Init and Dispose
|
||||
|
||||
def is_bmap_available() -> bool:
|
||||
return bmap.is_bmap_available()
|
||||
|
||||
# init module self and register exit function
|
||||
if is_bmap_available():
|
||||
bmap.BMInit()
|
||||
|
||||
def _auto_exit():
|
||||
bmap.BMDispose()
|
||||
atexit.register(_auto_exit)
|
||||
|
||||
#endregion
|
||||
|
||||
#region Real Type Defines
|
||||
|
||||
"""!
|
||||
@remarks
|
||||
BMFileReader, BMFileWriter, and BMMeshTrans can be create by given constructor.
|
||||
But they must be destroyed by calling dispose(). Otherwise it may cause memory leak.
|
||||
You also can use python `with` statement to achieve this automatically.
|
||||
|
||||
BMObject, BMTexture, BMMaterial, BMMesh, and BM3dObject should NOT be constructed from given constructor.
|
||||
They must be obtained from BMFileReader, BMFileWriter, and BMMeshTrans.
|
||||
Thus BMObject, BMTexture, BMMaterial, BMMesh, and BM3dObject also do not need to free
|
||||
because these resources are sotred in BMFileReader, BMFileWriter, and BMMeshTrans.
|
||||
We just provide them as a visitor.
|
||||
"""
|
||||
|
||||
class BMObject(_AbstractCKObject):
|
||||
def get_name(self) -> str | None:
|
||||
return self._get_str_value(bmap.BMObject_GetName)
|
||||
def set_name(self, name_: str | None) -> None:
|
||||
self._set_str_value(bmap.BMObject_SetName, name_)
|
||||
|
||||
class BMTexture(BMObject):
|
||||
def get_file_name(self) -> str | None:
|
||||
return self._get_str_value(bmap.BMTexture_GetFileName)
|
||||
|
||||
def load_image(self, filepath: str) -> None:
|
||||
filename: bmap.bm_CKSTRING = bmap.bm_CKSTRING(filepath.encode(g_BMapEncoding))
|
||||
bmap.BMTexture_LoadImage(self._get_pointer(), self._get_ckid(), filename)
|
||||
def save_image(self, filepath: str) -> None:
|
||||
filename: bmap.bm_CKSTRING = bmap.bm_CKSTRING(filepath.encode(g_BMapEncoding))
|
||||
bmap.BMTexture_SaveImage(self._get_pointer(), self._get_ckid(), filename)
|
||||
|
||||
def get_save_options(self) -> virtools_types.CK_TEXTURE_SAVEOPTIONS:
|
||||
return self._get_enum_value(virtools_types.CK_TEXTURE_SAVEOPTIONS, bmap.BMTexture_GetSaveOptions)
|
||||
def set_save_options(self, opt_: virtools_types.CK_TEXTURE_SAVEOPTIONS) -> None:
|
||||
self._set_enum_value(bmap.BMTexture_SetSaveOptions, opt_)
|
||||
def get_video_format(self) -> virtools_types.VX_PIXELFORMAT:
|
||||
return self._get_enum_value(virtools_types.VX_PIXELFORMAT, bmap.BMTexture_GetVideoFormat)
|
||||
def set_video_format(self, fmt_: virtools_types.VX_PIXELFORMAT) -> None:
|
||||
self._set_enum_value(bmap.BMTexture_SetVideoFormat, fmt_)
|
||||
|
||||
class BMMaterial(BMObject):
|
||||
def get_diffuse(self) -> virtools_types.VxColor:
|
||||
return self._get_vxcolor_value(bmap.BMMaterial_GetDiffuse)
|
||||
def set_diffuse(self, col: virtools_types.VxColor) -> None:
|
||||
self._set_vxcolor_value(bmap.BMMaterial_SetDiffuse, col)
|
||||
def get_ambient(self) -> virtools_types.VxColor:
|
||||
return self._get_vxcolor_value(bmap.BMMaterial_GetAmbient)
|
||||
def set_ambient(self, col: virtools_types.VxColor) -> None:
|
||||
self._set_vxcolor_value(bmap.BMMaterial_SetAmbient, col)
|
||||
def get_specular(self) -> virtools_types.VxColor:
|
||||
return self._get_vxcolor_value(bmap.BMMaterial_GetSpecular)
|
||||
def set_specular(self, col: virtools_types.VxColor) -> None:
|
||||
self._set_vxcolor_value(bmap.BMMaterial_SetSpecular, col)
|
||||
def get_emissive(self) -> virtools_types.VxColor:
|
||||
return self._get_vxcolor_value(bmap.BMMaterial_GetEmissive)
|
||||
def set_emissive(self, col: virtools_types.VxColor) -> None:
|
||||
self._set_vxcolor_value(bmap.BMMaterial_SetEmissive, col)
|
||||
|
||||
def get_specular_power(self) -> float:
|
||||
return self._get_float_point_value(bmap.bm_CKFLOAT, bmap.BMMaterial_GetSpecularPower)
|
||||
def set_specular_power(self, power_: float) -> None:
|
||||
self._set_float_point_value(bmap.bm_CKFLOAT, bmap.BMMaterial_SetSpecularPower, power_)
|
||||
|
||||
def get_texture(self) -> BMTexture | None:
|
||||
objid: bmap.bm_CKID = bmap.bm_CKID()
|
||||
bmap.BMMaterial_GetTexture(self._get_pointer(), self._get_ckid(), ctypes.byref(objid))
|
||||
if objid.value == g_InvalidCKID: return None
|
||||
else: return BMTexture(self._get_pointer(), objid)
|
||||
|
||||
def set_texture(self, tex_: BMTexture | None) -> None:
|
||||
objid: bmap.bm_CKID = bmap.bm_CKID(g_InvalidCKID)
|
||||
if tex_ is not None: objid = tex_._get_ckid()
|
||||
bmap.BMMaterial_SetTexture(self._get_pointer(), self._get_ckid(), objid)
|
||||
|
||||
def get_texture_border_color(self) -> virtools_types.VxColor:
|
||||
dword_color: int = self._get_integral_value(bmap.bm_CKDWORD, bmap.BMMaterial_GetTextureBorderColor)
|
||||
ret: virtools_types.VxColor = virtools_types.VxColor()
|
||||
ret.from_dword(dword_color)
|
||||
return ret
|
||||
def set_texture_border_color(self, col_: virtools_types.VxColor) -> None:
|
||||
self._set_integral_value(bmap.bm_CKDWORD, bmap.BMMaterial_SetTextureBorderColor, col_.to_dword())
|
||||
|
||||
def get_texture_blend_mode(self) -> virtools_types.VXTEXTURE_BLENDMODE:
|
||||
return self._get_enum_value(virtools_types.VXTEXTURE_BLENDMODE, bmap.BMMaterial_GetTextureBlendMode)
|
||||
def set_texture_blend_mode(self, data_: virtools_types.VXTEXTURE_BLENDMODE) -> None:
|
||||
self._set_enum_value(bmap.BMMaterial_SetTextureBlendMode, data_)
|
||||
def get_texture_min_mode(self) -> virtools_types.VXTEXTURE_FILTERMODE:
|
||||
return self._get_enum_value(virtools_types.VXTEXTURE_FILTERMODE, bmap.BMMaterial_GetTextureMinMode)
|
||||
def set_texture_min_mode(self, data_: virtools_types.VXTEXTURE_FILTERMODE) -> None:
|
||||
self._set_enum_value(bmap.BMMaterial_SetTextureMinMode, data_)
|
||||
def get_texture_mag_mode(self) -> virtools_types.VXTEXTURE_FILTERMODE:
|
||||
return self._get_enum_value(virtools_types.VXTEXTURE_FILTERMODE, bmap.BMMaterial_GetTextureMagMode)
|
||||
def set_texture_mag_mode(self, data_: virtools_types.VXTEXTURE_FILTERMODE) -> None:
|
||||
self._set_enum_value(bmap.BMMaterial_SetTextureMagMode, data_)
|
||||
def get_texture_address_mode(self) -> virtools_types.VXTEXTURE_ADDRESSMODE:
|
||||
return self._get_enum_value(virtools_types.VXTEXTURE_ADDRESSMODE, bmap.BMMaterial_GetTextureAddressMode)
|
||||
def set_texture_address_mode(self, data_: virtools_types.VXTEXTURE_ADDRESSMODE) -> None:
|
||||
self._set_enum_value(bmap.BMMaterial_SetTextureAddressMode, data_)
|
||||
def get_source_blend(self) -> virtools_types.VXBLEND_MODE:
|
||||
return self._get_enum_value(virtools_types.VXBLEND_MODE, bmap.BMMaterial_GetSourceBlend)
|
||||
def set_source_blend(self, data_: virtools_types.VXBLEND_MODE) -> None:
|
||||
self._set_enum_value(bmap.BMMaterial_SetSourceBlend, data_)
|
||||
def get_dest_blend(self) -> virtools_types.VXBLEND_MODE:
|
||||
return self._get_enum_value(virtools_types.VXBLEND_MODE, bmap.BMMaterial_GetDestBlend)
|
||||
def set_dest_blend(self, data_: virtools_types.VXBLEND_MODE) -> None:
|
||||
self._set_enum_value(bmap.BMMaterial_SetDestBlend, data_)
|
||||
def get_fill_mode(self) -> virtools_types.VXFILL_MODE:
|
||||
return self._get_enum_value(virtools_types.VXFILL_MODE, bmap.BMMaterial_GetFillMode)
|
||||
def set_fill_mode(self, data_: virtools_types.VXFILL_MODE) -> None:
|
||||
self._set_enum_value(bmap.BMMaterial_SetFillMode, data_)
|
||||
def get_shade_mode(self) -> virtools_types.VXSHADE_MODE:
|
||||
return self._get_enum_value(virtools_types.VXSHADE_MODE, bmap.BMMaterial_GetShadeMode)
|
||||
def set_shade_mode(self, data_: virtools_types.VXSHADE_MODE) -> None:
|
||||
self._set_enum_value(bmap.BMMaterial_SetShadeMode, data_)
|
||||
|
||||
def get_alpha_test_enabled(self) -> bool:
|
||||
return self._get_bool_value(bmap.BMMaterial_GetAlphaTestEnabled)
|
||||
def set_alpha_test_enabled(self, data_: bool) -> None:
|
||||
self._set_bool_value(bmap.BMMaterial_SetAlphaTestEnabled, data_)
|
||||
def get_alpha_blend_enabled(self) -> bool:
|
||||
return self._get_bool_value(bmap.BMMaterial_GetAlphaBlendEnabled)
|
||||
def set_alpha_blend_enabled(self, data_: bool) -> None:
|
||||
self._set_bool_value(bmap.BMMaterial_SetAlphaBlendEnabled, data_)
|
||||
def get_perspective_correction_enabled(self) -> bool:
|
||||
return self._get_bool_value(bmap.BMMaterial_GetPerspectiveCorrectionEnabled)
|
||||
def set_perspective_correction_enabled(self, data_: bool) -> None:
|
||||
self._set_bool_value(bmap.BMMaterial_SetPerspectiveCorrectionEnabled, data_)
|
||||
def get_z_write_enabled(self) -> bool:
|
||||
return self._get_bool_value(bmap.BMMaterial_GetZWriteEnabled)
|
||||
def set_z_write_enabled(self, data_: bool) -> None:
|
||||
self._set_bool_value(bmap.BMMaterial_SetZWriteEnabled, data_)
|
||||
def get_two_sided_enabled(self) -> bool:
|
||||
return self._get_bool_value(bmap.BMMaterial_GetTwoSidedEnabled)
|
||||
def set_two_sided_enabled(self, data_: bool) -> None:
|
||||
self._set_bool_value(bmap.BMMaterial_SetTwoSidedEnabled, data_)
|
||||
|
||||
def get_alpha_ref(self) -> int:
|
||||
return self._get_integral_value(bmap.bm_CKBYTE, bmap.BMMaterial_GetAlphaRef)
|
||||
def set_alpha_ref(self, data_: int):
|
||||
self._set_integral_value(bmap.bm_CKBYTE, bmap.BMMaterial_SetAlphaRef, data_)
|
||||
|
||||
def get_alpha_func(self) -> virtools_types.VXCMPFUNC:
|
||||
return self._get_enum_value(virtools_types.VXCMPFUNC, bmap.BMMaterial_GetAlphaFunc)
|
||||
def set_alpha_func(self, data_: virtools_types.VXCMPFUNC) -> None:
|
||||
self._set_enum_value(bmap.BMMaterial_SetAlphaFunc, data_)
|
||||
def get_z_func(self) -> virtools_types.VXCMPFUNC:
|
||||
return self._get_enum_value(virtools_types.VXCMPFUNC, bmap.BMMaterial_GetZFunc)
|
||||
def set_z_func(self, data_: virtools_types.VXCMPFUNC) -> None:
|
||||
self._set_enum_value(bmap.BMMaterial_SetZFunc, data_)
|
||||
|
||||
class BMMesh(BMObject):
|
||||
|
||||
def get_lit_mode(self) -> virtools_types.VXMESH_LITMODE:
|
||||
return self._get_enum_value(virtools_types.VXMESH_LITMODE, bmap.BMMesh_GetLitMode)
|
||||
def set_lit_mode(self, mode_: virtools_types.VXMESH_LITMODE) -> None:
|
||||
self._set_enum_value(bmap.BMMesh_SetLitMode, mode_)
|
||||
|
||||
def get_vertex_count(self) -> int:
|
||||
return self._get_integral_value(bmap.bm_CKDWORD, bmap.BMMesh_GetVertexCount)
|
||||
def set_vertex_count(self, count_: int) -> None:
|
||||
self._set_integral_value(bmap.bm_CKDWORD, bmap.BMMesh_SetVertexCount, count_)
|
||||
|
||||
def get_vertex_positions(self) -> typing.Iterator[virtools_types.VxVector3]:
|
||||
# get raw pointer and return
|
||||
raw_vector = self._get_pointer_value(bmap.bm_VxVector3_p, bmap.BMMesh_GetVertexPositions)
|
||||
return _Utils.vxvector3_iterator(raw_vector, self.get_vertex_count())
|
||||
def set_vertex_positions(self, itor: typing.Iterator[virtools_types.VxVector3]) -> None:
|
||||
# get raw float pointer and assign
|
||||
raw_vector = self._get_pointer_value(bmap.bm_VxVector3_p, bmap.BMMesh_GetVertexPositions)
|
||||
_Utils.vxvector3_assigner(raw_vector, self.get_vertex_count(), itor)
|
||||
|
||||
def get_vertex_normals(self) -> typing.Iterator[virtools_types.VxVector3]:
|
||||
raw_vector = self._get_pointer_value(bmap.bm_VxVector3_p, bmap.BMMesh_GetVertexNormals)
|
||||
return _Utils.vxvector3_iterator(raw_vector, self.get_vertex_count())
|
||||
def set_vertex_normals(self, itor: typing.Iterator[virtools_types.VxVector3]) -> None:
|
||||
raw_vector = self._get_pointer_value(bmap.bm_VxVector3_p, bmap.BMMesh_GetVertexNormals)
|
||||
_Utils.vxvector3_assigner(raw_vector, self.get_vertex_count(), itor)
|
||||
|
||||
def get_vertex_uvs(self) -> typing.Iterator[virtools_types.VxVector2]:
|
||||
raw_vector = self._get_pointer_value(bmap.bm_VxVector2_p, bmap.BMMesh_GetVertexUVs)
|
||||
return _Utils.vxvector2_iterator(raw_vector, self.get_vertex_count())
|
||||
def set_vertex_uvs(self, itor: typing.Iterator[virtools_types.VxVector2]) -> None:
|
||||
raw_vector = self._get_pointer_value(bmap.bm_VxVector2_p, bmap.BMMesh_GetVertexUVs)
|
||||
_Utils.vxvector2_assigner(raw_vector, self.get_vertex_count(), itor)
|
||||
|
||||
def get_face_count(self) -> int:
|
||||
return self._get_integral_value(bmap.bm_CKDWORD, bmap.BMMesh_GetFaceCount)
|
||||
def set_face_count(self, count_: int) -> None:
|
||||
self._set_integral_value(bmap.bm_CKDWORD, bmap.BMMesh_SetFaceCount, count_)
|
||||
|
||||
def get_face_indices(self) -> typing.Iterator[virtools_types.CKFaceIndices]:
|
||||
raw_idx = self._get_pointer_value(bmap.bm_CKWORD_p, bmap.BMMesh_GetFaceIndices)
|
||||
return _Utils.ckfaceindices_iterator(raw_idx, self.get_face_count())
|
||||
def set_face_indices(self, itor: typing.Iterator[virtools_types.CKFaceIndices]) -> None:
|
||||
raw_idx = self._get_pointer_value(bmap.bm_CKWORD_p, bmap.BMMesh_GetFaceIndices)
|
||||
_Utils.ckfaceindices_assigner(raw_idx, self.get_face_count(), itor)
|
||||
|
||||
def get_face_material_slot_indexs(self) -> typing.Iterator[int]:
|
||||
raw_idx = self._get_pointer_value(bmap.bm_CKWORD_p, bmap.BMMesh_GetFaceMaterialSlotIndexs)
|
||||
for i in range(self.get_face_count()):
|
||||
yield raw_idx[i]
|
||||
|
||||
def set_face_material_slot_indexs(self, itor: typing.Iterator[int]) -> None:
|
||||
raw_idx = self._get_pointer_value(bmap.bm_CKWORD_p, bmap.BMMesh_GetFaceMaterialSlotIndexs)
|
||||
try:
|
||||
for i in range(self.get_face_count()):
|
||||
raw_idx[i] = next(itor)
|
||||
except StopIteration:
|
||||
_Utils.raise_out_of_length_exception()
|
||||
|
||||
def get_material_slot_count(self) -> int:
|
||||
return self._get_integral_value(bmap.bm_CKDWORD, bmap.BMMesh_GetMaterialSlotCount)
|
||||
def set_material_slot_count(self, count_: int) -> None:
|
||||
self._set_integral_value(bmap.bm_CKDWORD, bmap.BMMesh_SetMaterialSlotCount, count_)
|
||||
|
||||
def get_material_slots(self) -> typing.Iterator[BMMaterial | None]:
|
||||
idx: bmap.bm_CKDWORD = bmap.bm_CKDWORD()
|
||||
mtlid: bmap.bm_CKID = bmap.bm_CKID()
|
||||
for i in range(self.get_material_slot_count()):
|
||||
idx.value = i
|
||||
bmap.BMMesh_GetMaterialSlot(self._get_pointer(), self._get_ckid(), idx, ctypes.byref(mtlid))
|
||||
if mtlid.value == g_InvalidCKID:
|
||||
yield None
|
||||
else:
|
||||
yield BMMaterial(self._get_pointer(), mtlid)
|
||||
|
||||
def set_material_slots(self, itor: typing.Iterator[BMMaterial | None]) -> None:
|
||||
idx: bmap.bm_CKDWORD = bmap.bm_CKDWORD()
|
||||
mtlid: bmap.bm_CKID = bmap.bm_CKID()
|
||||
try:
|
||||
for i in range(self.get_material_slot_count()):
|
||||
idx.value = i
|
||||
# analyze mtl item
|
||||
mtlobj: BMMaterial | None = next(itor)
|
||||
if mtlobj is None:
|
||||
mtlid.value = g_InvalidCKID
|
||||
else:
|
||||
mtlid = mtlobj._get_ckid()
|
||||
# set
|
||||
bmap.BMMesh_SetMaterialSlot(self._get_pointer(), self._get_ckid(), idx, mtlid)
|
||||
except StopIteration:
|
||||
_Utils.raise_out_of_length_exception()
|
||||
|
||||
class BM3dEntity(BMObject):
|
||||
def get_world_matrix(self) -> virtools_types.VxMatrix:
|
||||
mat: bmap.bm_VxMatrix = bmap.bm_VxMatrix()
|
||||
bmap.BM3dEntity_GetWorldMatrix(self._get_pointer(), self._get_ckid(), ctypes.byref(mat))
|
||||
# use cast & pointer to get matrix data conveniently
|
||||
flat: bmap.bm_CKFLOAT_p = ctypes.cast(ctypes.byref(mat), bmap.bm_CKFLOAT_p)
|
||||
ret: virtools_types.VxMatrix = virtools_types.VxMatrix()
|
||||
ret.from_const(tuple(flat[i] for i in range(16)))
|
||||
return ret
|
||||
|
||||
def set_world_matrix(self, mat_: virtools_types.VxMatrix) -> None:
|
||||
# star syntax expand the tuple as the argument.
|
||||
mat: bmap.bm_VxMatrix = bmap.bm_VxMatrix(*(mat_.to_const()))
|
||||
bmap.BM3dEntity_SetWorldMatrix(self._get_pointer(), self._get_ckid(), mat)
|
||||
|
||||
def get_current_mesh(self) -> BMMesh | None:
|
||||
ckid: bmap.bm_CKID = bmap.bm_CKID()
|
||||
bmap.BM3dEntity_GetCurrentMesh(self._get_pointer(), self._get_ckid(), ctypes.byref(ckid))
|
||||
if ckid.value == g_InvalidCKID:
|
||||
return None
|
||||
else:
|
||||
return BMMesh(self._get_pointer(), ckid)
|
||||
|
||||
def set_current_mesh(self, mesh: BMMesh | None) -> None:
|
||||
ckid: bmap.bm_CKID = bmap.bm_CKID(g_InvalidCKID)
|
||||
if mesh is not None:
|
||||
ckid = mesh._get_ckid()
|
||||
bmap.BM3dEntity_SetCurrentMesh(self._get_pointer(), self._get_ckid(), ckid)
|
||||
|
||||
def get_visibility(self) -> bool:
|
||||
return self._get_bool_value(bmap.BM3dEntity_GetVisibility)
|
||||
def set_visibility(self, visb_: bool) -> None:
|
||||
self._set_bool_value(bmap.BM3dEntity_SetVisibility, visb_)
|
||||
|
||||
class BM3dObject(BM3dEntity):
|
||||
pass
|
||||
|
||||
class BMLight(BM3dEntity):
|
||||
def get_type(self) -> virtools_types.VXLIGHT_TYPE:
|
||||
return self._get_enum_value(virtools_types.VXLIGHT_TYPE, bmap.BMLight_GetType)
|
||||
def set_type(self, data_: virtools_types.VXLIGHT_TYPE) -> None:
|
||||
self._set_enum_value(bmap.BMLight_SetType, data_)
|
||||
|
||||
def get_color(self) -> virtools_types.VxColor:
|
||||
return self._get_vxcolor_value(bmap.BMLight_GetColor)
|
||||
def set_color(self, col: virtools_types.VxColor) -> None:
|
||||
self._set_vxcolor_value(bmap.BMLight_SetColor, col)
|
||||
|
||||
def get_constant_attenuation(self) -> float:
|
||||
return self._get_float_point_value(bmap.bm_CKFLOAT, bmap.BMLight_GetConstantAttenuation)
|
||||
def set_constant_attenuation(self, val_: float) -> None:
|
||||
self._set_float_point_value(bmap.bm_CKFLOAT, bmap.BMLight_SetConstantAttenuation, val_)
|
||||
def get_linear_attenuation(self) -> float:
|
||||
return self._get_float_point_value(bmap.bm_CKFLOAT, bmap.BMLight_GetLinearAttenuation)
|
||||
def set_linear_attenuation(self, val_: float) -> None:
|
||||
self._set_float_point_value(bmap.bm_CKFLOAT, bmap.BMLight_SetLinearAttenuation, val_)
|
||||
def get_quadratic_attenuation(self) -> float:
|
||||
return self._get_float_point_value(bmap.bm_CKFLOAT, bmap.BMLight_GetQuadraticAttenuation)
|
||||
def set_quadratic_attenuation(self, val_: float) -> None:
|
||||
self._set_float_point_value(bmap.bm_CKFLOAT, bmap.BMLight_SetQuadraticAttenuation, val_)
|
||||
|
||||
def get_range(self) -> float:
|
||||
return self._get_float_point_value(bmap.bm_CKFLOAT, bmap.BMLight_GetRange)
|
||||
def set_range(self, val_: float) -> None:
|
||||
self._set_float_point_value(bmap.bm_CKFLOAT, bmap.BMLight_SetRange, val_)
|
||||
|
||||
def get_hot_spot(self) -> float:
|
||||
return self._get_float_point_value(bmap.bm_CKFLOAT, bmap.BMLight_GetHotSpot)
|
||||
def set_hot_spot(self, val_: float) -> None:
|
||||
self._set_float_point_value(bmap.bm_CKFLOAT, bmap.BMLight_SetHotSpot, val_)
|
||||
def get_falloff(self) -> float:
|
||||
return self._get_float_point_value(bmap.bm_CKFLOAT, bmap.BMLight_GetFalloff)
|
||||
def set_falloff(self, val_: float) -> None:
|
||||
self._set_float_point_value(bmap.bm_CKFLOAT, bmap.BMLight_SetFalloff, val_)
|
||||
def get_falloff_shape(self) -> float:
|
||||
return self._get_float_point_value(bmap.bm_CKFLOAT, bmap.BMLight_GetFalloffShape)
|
||||
def set_falloff_shape(self, val_: float) -> None:
|
||||
self._set_float_point_value(bmap.bm_CKFLOAT, bmap.BMLight_SetFalloffShape, val_)
|
||||
|
||||
class BMTargetLight(BMLight):
|
||||
pass
|
||||
|
||||
class BMGroup(BMObject):
|
||||
def add_object(self, member: BM3dObject) -> None:
|
||||
bmap.BMGroup_AddObject(self._get_pointer(), self._get_ckid(), member._get_ckid())
|
||||
|
||||
def get_object_count(self) -> int:
|
||||
return self._get_integral_value(bmap.bm_CKDWORD, bmap.BMGroup_GetObjectCount)
|
||||
|
||||
def get_objects(self) -> typing.Iterator[BM3dObject]:
|
||||
# get list size
|
||||
csize: int = self.get_object_count()
|
||||
# iterate list
|
||||
cidx: bmap.bm_CKDWORD = bmap.bm_CKDWORD()
|
||||
retid: bmap.bm_CKID = bmap.bm_CKID()
|
||||
for i in range(csize):
|
||||
cidx.value = i
|
||||
bmap.BMGroup_GetObject(self._get_pointer(), self._get_ckid(), cidx, ctypes.byref(retid))
|
||||
# return visitor
|
||||
yield BM3dObject(self._get_pointer(), retid)
|
||||
|
||||
class BMFileReader(_AbstractPointer):
|
||||
def __init__(self, file_name_: str, temp_folder_: str, texture_folder_: str, encodings_: tuple[str]):
|
||||
# create param
|
||||
file_name: bmap.bm_CKSTRING = bmap.bm_CKSTRING(file_name_.encode(g_BMapEncoding))
|
||||
temp_folder: bmap.bm_CKSTRING = bmap.bm_CKSTRING(temp_folder_.encode(g_BMapEncoding))
|
||||
texture_folder: bmap.bm_CKSTRING = bmap.bm_CKSTRING(texture_folder_.encode(g_BMapEncoding))
|
||||
encoding_count: bmap.bm_CKDWORD = bmap.bm_CKDWORD(len(encodings_))
|
||||
encodings: ctypes.Array = (bmap.bm_CKSTRING * len(encodings_))(
|
||||
*(strl.encode(g_BMapEncoding) for strl in encodings_)
|
||||
)
|
||||
out_file: bmap.bm_void_p = bmap.bm_void_p()
|
||||
# exec
|
||||
bmap.BMFile_Load(
|
||||
file_name, temp_folder, texture_folder, _g_RawCallback,
|
||||
encoding_count, encodings,
|
||||
ctypes.byref(out_file)
|
||||
)
|
||||
# init self
|
||||
_AbstractPointer.__init__(self, out_file)
|
||||
|
||||
def __enter__(self):
|
||||
return self
|
||||
|
||||
def __exit__(self, exc_type, exc_value, traceback):
|
||||
self.dispose()
|
||||
|
||||
def dispose(self) -> None:
|
||||
if self._is_valid():
|
||||
bmap.BMFile_Free(self._get_pointer())
|
||||
self._set_pointer(g_InvalidPtr)
|
||||
|
||||
def __get_ckobject_count(self,
|
||||
count_getter: typing.Callable[[bmap.bm_void_p, bmap.bm_CKDWORD_p], bmap.bm_bool]) -> int:
|
||||
# get size
|
||||
csize: bmap.bm_CKDWORD = bmap.bm_CKDWORD()
|
||||
count_getter(self._get_pointer(), ctypes.byref(csize))
|
||||
return csize.value
|
||||
|
||||
def __get_ckobjects(self,
|
||||
class_type: type[TCKObject],
|
||||
count_getter: typing.Callable[[bmap.bm_void_p, bmap.bm_CKDWORD_p], bmap.bm_bool],
|
||||
obj_getter: typing.Callable[[bmap.bm_void_p, bmap.bm_CKDWORD, bmap.bm_CKID_p], bmap.bm_bool]) -> typing.Iterator[TCKObject]:
|
||||
# get size first
|
||||
csize: int = self.__get_ckobject_count(count_getter)
|
||||
|
||||
# iterate list
|
||||
cidx: bmap.bm_CKDWORD = bmap.bm_CKDWORD()
|
||||
retid: bmap.bm_CKID = bmap.bm_CKID()
|
||||
for i in range(csize):
|
||||
cidx.value = i
|
||||
obj_getter(self._get_pointer(), cidx, ctypes.byref(retid))
|
||||
# yield return constructed obj visitor
|
||||
yield class_type(self._get_pointer(), retid)
|
||||
|
||||
def get_texture_count(self) -> int:
|
||||
return self.__get_ckobject_count(bmap.BMFile_GetTextureCount)
|
||||
def get_textures(self) -> typing.Iterator[BMTexture]:
|
||||
return self.__get_ckobjects(BMTexture, bmap.BMFile_GetTextureCount, bmap.BMFile_GetTexture)
|
||||
def get_material_count(self) -> int:
|
||||
return self.__get_ckobject_count(bmap.BMFile_GetMaterialCount)
|
||||
def get_materials(self) -> typing.Iterator[BMMaterial]:
|
||||
return self.__get_ckobjects(BMMaterial, bmap.BMFile_GetMaterialCount, bmap.BMFile_GetMaterial)
|
||||
def get_mesh_count(self) -> int:
|
||||
return self.__get_ckobject_count(bmap.BMFile_GetMeshCount)
|
||||
def get_meshs(self) -> typing.Iterator[BMMesh]:
|
||||
return self.__get_ckobjects(BMMesh, bmap.BMFile_GetMeshCount, bmap.BMFile_GetMesh)
|
||||
def get_3dobject_count(self) -> int:
|
||||
return self.__get_ckobject_count(bmap.BMFile_Get3dObjectCount)
|
||||
def get_3dobjects(self) -> typing.Iterator[BM3dObject]:
|
||||
return self.__get_ckobjects(BM3dObject, bmap.BMFile_Get3dObjectCount, bmap.BMFile_Get3dObject)
|
||||
def get_group_count(self) -> int:
|
||||
return self.__get_ckobject_count(bmap.BMFile_GetGroupCount)
|
||||
def get_groups(self) -> typing.Iterator[BMGroup]:
|
||||
return self.__get_ckobjects(BMGroup, bmap.BMFile_GetGroupCount, bmap.BMFile_GetGroup)
|
||||
def get_target_light_count(self) -> int:
|
||||
return self.__get_ckobject_count(bmap.BMFile_GetTargetLightCount)
|
||||
def get_target_lights(self) -> typing.Iterator[BMTargetLight]:
|
||||
return self.__get_ckobjects(BMTargetLight, bmap.BMFile_GetTargetLightCount, bmap.BMFile_GetTargetLight)
|
||||
|
||||
class BMFileWriter(_AbstractPointer):
|
||||
def __init__(self, temp_folder_: str, texture_folder_: str, encodings_: tuple[str]):
|
||||
# create param
|
||||
temp_folder: bmap.bm_CKSTRING = bmap.bm_CKSTRING(temp_folder_.encode(g_BMapEncoding))
|
||||
texture_folder: bmap.bm_CKSTRING = bmap.bm_CKSTRING(texture_folder_.encode(g_BMapEncoding))
|
||||
encoding_count: bmap.bm_CKDWORD = bmap.bm_CKDWORD(len(encodings_))
|
||||
encodings: ctypes.Array = (bmap.bm_CKSTRING * len(encodings_))(
|
||||
*(strl.encode(g_BMapEncoding) for strl in encodings_)
|
||||
)
|
||||
out_file: bmap.bm_void_p = bmap.bm_void_p()
|
||||
# exec
|
||||
bmap.BMFile_Create(
|
||||
temp_folder, texture_folder, _g_RawCallback,
|
||||
encoding_count, encodings,
|
||||
ctypes.byref(out_file)
|
||||
)
|
||||
# init self
|
||||
_AbstractPointer.__init__(self, out_file)
|
||||
|
||||
def __enter__(self):
|
||||
return self
|
||||
|
||||
def __exit__(self, exc_type, exc_value, traceback):
|
||||
self.dispose()
|
||||
|
||||
def save(self, file_name_: str, texture_save_opt_: virtools_types.CK_TEXTURE_SAVEOPTIONS, use_compress_: bool, compress_level_: int) -> None:
|
||||
# create param
|
||||
file_name: bmap.bm_CKSTRING = bmap.bm_CKSTRING(file_name_.encode(g_BMapEncoding))
|
||||
texture_save_opt: bmap.bm_enum = bmap.bm_enum(texture_save_opt_.value)
|
||||
use_compress: bmap.bm_bool = bmap.bm_bool(use_compress_)
|
||||
compress_level: bmap.bm_CKINT = bmap.bm_CKINT(compress_level_)
|
||||
# exec
|
||||
bmap.BMFile_Save(self._get_pointer(), file_name, texture_save_opt, use_compress, compress_level)
|
||||
|
||||
def dispose(self) -> None:
|
||||
if self._is_valid():
|
||||
bmap.BMFile_Free(self._get_pointer())
|
||||
self._set_pointer(g_InvalidPtr)
|
||||
|
||||
def __create_ckobject(self,
|
||||
class_type: type[TCKObject],
|
||||
creator: typing.Callable[[bmap.bm_void_p, bmap.bm_CKID_p], bmap.bm_bool]) -> TCKObject:
|
||||
# prepare id container
|
||||
retid: bmap.bm_CKID = bmap.bm_CKID()
|
||||
# create new one
|
||||
creator(self._get_pointer(), ctypes.byref(retid))
|
||||
# return visitor
|
||||
return class_type(self._get_pointer(), retid)
|
||||
|
||||
def create_texture(self) -> BMTexture:
|
||||
return self.__create_ckobject(BMTexture, bmap.BMFile_CreateTexture)
|
||||
def create_material(self) -> BMMaterial:
|
||||
return self.__create_ckobject(BMMaterial, bmap.BMFile_CreateMaterial)
|
||||
def create_mesh(self) -> BMMesh:
|
||||
return self.__create_ckobject(BMMesh, bmap.BMFile_CreateMesh)
|
||||
def create_3dobject(self) -> BM3dObject:
|
||||
return self.__create_ckobject(BM3dObject, bmap.BMFile_Create3dObject)
|
||||
def create_group(self) -> BMGroup:
|
||||
return self.__create_ckobject(BMGroup, bmap.BMFile_CreateGroup)
|
||||
def create_target_light(self) -> BMTargetLight:
|
||||
return self.__create_ckobject(BMTargetLight, bmap.BMFile_CreateTargetLight)
|
||||
|
||||
class BMMeshTrans(_AbstractPointer):
|
||||
def __init__(self):
|
||||
ptr: bmap.bm_void_p = bmap.bm_void_p()
|
||||
bmap.BMMeshTrans_New(ctypes.byref(ptr))
|
||||
_AbstractPointer.__init__(self, ptr)
|
||||
|
||||
def __enter__(self):
|
||||
return self
|
||||
|
||||
def __exit__(self, exc_type, exc_value, traceback):
|
||||
self.dispose()
|
||||
|
||||
def dispose(self) -> None:
|
||||
if self._is_valid():
|
||||
bmap.BMMeshTrans_Delete(self._get_pointer())
|
||||
self._set_pointer(g_InvalidPtr)
|
||||
|
||||
def parse(self, objmesh: BMMesh) -> None:
|
||||
bmap.BMMeshTrans_Parse(self._get_pointer(), objmesh._get_pointer(), objmesh._get_ckid())
|
||||
|
||||
def prepare_vertex(self, count: int, itor: typing.Iterator[virtools_types.VxVector3]) -> None:
|
||||
# prepare count first
|
||||
csize: bmap.bm_CKDWORD = bmap.bm_CKDWORD(count)
|
||||
bmap.BMMeshTrans_PrepareVertexCount(self._get_pointer(), csize)
|
||||
# get raw pointer and conv to float ptr for convenient visit
|
||||
raw_vector: bmap.bm_VxVector3_p = bmap.bm_VxVector3_p()
|
||||
bmap.BMMeshTrans_PrepareVertex(self._get_pointer(), ctypes.byref(raw_vector))
|
||||
# set by pointer
|
||||
_Utils.vxvector3_assigner(raw_vector, count, itor)
|
||||
|
||||
def prepare_normal(self, count: int, itor: typing.Iterator[virtools_types.VxVector3]) -> None:
|
||||
csize: bmap.bm_CKDWORD = bmap.bm_CKDWORD(count)
|
||||
bmap.BMMeshTrans_PrepareNormalCount(self._get_pointer(), csize)
|
||||
|
||||
raw_vector: bmap.bm_VxVector3_p = bmap.bm_VxVector3_p()
|
||||
bmap.BMMeshTrans_PrepareNormal(self._get_pointer(), ctypes.byref(raw_vector))
|
||||
|
||||
_Utils.vxvector3_assigner(raw_vector, count, itor)
|
||||
|
||||
def prepare_uv(self, count: int, itor: typing.Iterator[virtools_types.VxVector2]) -> None:
|
||||
csize: bmap.bm_CKDWORD = bmap.bm_CKDWORD(count)
|
||||
bmap.BMMeshTrans_PrepareUVCount(self._get_pointer(), csize)
|
||||
|
||||
raw_vector: bmap.bm_VxVector2_p = bmap.bm_VxVector2_p()
|
||||
bmap.BMMeshTrans_PrepareUV(self._get_pointer(), ctypes.byref(raw_vector))
|
||||
|
||||
_Utils.vxvector2_assigner(raw_vector, count, itor)
|
||||
|
||||
def prepare_mtl_slot(self, count: int, itor: typing.Iterator[BMMaterial | None]) -> None:
|
||||
csize: bmap.bm_CKDWORD = bmap.bm_CKDWORD(count)
|
||||
bmap.BMMeshTrans_PrepareMtlSlotCount(self._get_pointer(), csize)
|
||||
|
||||
raw_ckid: bmap.bm_CKID_p = bmap.bm_CKID_p()
|
||||
bmap.BMMeshTrans_PrepareMtlSlot(self._get_pointer(), ctypes.byref(raw_ckid))
|
||||
try:
|
||||
idx: int = 0
|
||||
for _ in range(count):
|
||||
usermtl: BMMaterial | None = next(itor)
|
||||
if usermtl is None:
|
||||
raw_ckid[idx] = g_InvalidCKID
|
||||
else:
|
||||
raw_ckid[idx] = usermtl._get_ckid().value
|
||||
idx += 1
|
||||
except StopIteration:
|
||||
_Utils.raise_out_of_length_exception()
|
||||
|
||||
def prepare_face(self,
|
||||
count: int,
|
||||
vec_idx: typing.Iterator[virtools_types.CKFaceIndices],
|
||||
nml_idx: typing.Iterator[virtools_types.CKFaceIndices],
|
||||
uv_idx: typing.Iterator[virtools_types.CKFaceIndices],
|
||||
mtl_idx: typing.Iterator[int]) -> None:
|
||||
# prepare face size
|
||||
csize: bmap.bm_CKDWORD = bmap.bm_CKDWORD(count)
|
||||
bmap.BMMeshTrans_PrepareFaceCount(self._get_pointer(), csize)
|
||||
|
||||
# get 4 raw pointer for following assign
|
||||
raw_vec_idx: bmap.bm_CKDWORD_p = bmap.bm_CKDWORD_p()
|
||||
raw_nml_idx: bmap.bm_CKDWORD_p = bmap.bm_CKDWORD_p()
|
||||
raw_uv_idx: bmap.bm_CKDWORD_p = bmap.bm_CKDWORD_p()
|
||||
raw_mtl_idx: bmap.bm_CKDWORD_p = bmap.bm_CKDWORD_p()
|
||||
bmap.BMMeshTrans_PrepareFaceVertexIndices(self._get_pointer(), ctypes.byref(raw_vec_idx))
|
||||
bmap.BMMeshTrans_PrepareFaceNormalIndices(self._get_pointer(), ctypes.byref(raw_nml_idx))
|
||||
bmap.BMMeshTrans_PrepareFaceUVIndices(self._get_pointer(), ctypes.byref(raw_uv_idx))
|
||||
bmap.BMMeshTrans_PrepareFaceMtlSlot(self._get_pointer(), ctypes.byref(raw_mtl_idx))
|
||||
|
||||
# iterate and assign
|
||||
# assigne triple indices
|
||||
_Utils.ckfaceindices_assigner(raw_vec_idx, count, vec_idx)
|
||||
_Utils.ckfaceindices_assigner(raw_nml_idx, count, nml_idx)
|
||||
_Utils.ckfaceindices_assigner(raw_uv_idx, count, uv_idx)
|
||||
# assign mtl index
|
||||
try:
|
||||
idx: int = 0
|
||||
for _ in range(count):
|
||||
raw_mtl_idx[idx] = next(mtl_idx)
|
||||
idx += 1
|
||||
except StopIteration:
|
||||
_Utils.raise_out_of_length_exception()
|
||||
|
||||
#endregion
|
||||
327
Assets/BMapBindings/PyBMap/PyBMap/virtools_types.py
Normal file
327
Assets/BMapBindings/PyBMap/PyBMap/virtools_types.py
Normal file
@@ -0,0 +1,327 @@
|
||||
import typing, enum
|
||||
|
||||
ConstVxVector2 = tuple[float, float]
|
||||
ConstVxVector3 = tuple[float, float, float]
|
||||
ConstVxVector4 = tuple[float, float, float, float]
|
||||
|
||||
class VxVector2():
|
||||
x: float
|
||||
y: float
|
||||
|
||||
def __init__(self, _x: float = 0.0, _y: float = 0.0):
|
||||
self.x = _x
|
||||
self.y = _y
|
||||
|
||||
def from_const(self, cv: ConstVxVector2) -> None:
|
||||
(self.x, self.y, ) = cv
|
||||
|
||||
def to_const(self) -> ConstVxVector2:
|
||||
return (self.x, self.y, )
|
||||
|
||||
class VxVector3():
|
||||
x: float
|
||||
y: float
|
||||
z: float
|
||||
|
||||
def __init__(self, _x: float = 0.0, _y: float = 0.0, _z: float = 0.0):
|
||||
self.x = _x
|
||||
self.y = _y
|
||||
self.z = _z
|
||||
|
||||
def from_const(self, cv: ConstVxVector3) -> None:
|
||||
(self.x, self.y, self.z) = cv
|
||||
|
||||
def to_const(self) -> ConstVxVector3:
|
||||
return (self.x, self.y, self.z)
|
||||
|
||||
ConstCKFaceIndices = tuple[int, int, int]
|
||||
|
||||
class CKFaceIndices():
|
||||
i1: int
|
||||
i2: int
|
||||
i3: int
|
||||
|
||||
def __init__(self, i1_: int = 0, i2_: int = 0, i3_: int = 0):
|
||||
self.i1 = i1_
|
||||
self.i2 = i2_
|
||||
self.i3 = i3_
|
||||
|
||||
def from_const(self, cv: ConstCKFaceIndices) -> None:
|
||||
(self.i1, self.i2, self.i3) = cv
|
||||
|
||||
def to_const(self) -> ConstCKFaceIndices:
|
||||
return (self.i1, self.i2, self.i3)
|
||||
|
||||
ConstVxColorRGBA = tuple[float, float, float, float]
|
||||
ConstVxColorRGB = tuple[float, float, float]
|
||||
|
||||
class VxColor():
|
||||
"""
|
||||
The Color struct support RGBA.
|
||||
"""
|
||||
a: float
|
||||
r: float
|
||||
g: float
|
||||
b: float
|
||||
def __init__(self, _r: float = 0.0, _g: float = 0.0, _b: float = 0.0, _a: float = 1.0):
|
||||
self.r = _r
|
||||
self.g = _g
|
||||
self.b = _b
|
||||
self.a = _a
|
||||
self.regulate()
|
||||
|
||||
def to_const_rgba(self) -> ConstVxColorRGBA:
|
||||
return (self.r, self.g, self.b, self.a)
|
||||
|
||||
def to_const_rgb(self) -> ConstVxColorRGB:
|
||||
return (self.r, self.g, self.b)
|
||||
|
||||
def from_const_rgba(self, val: ConstVxColorRGBA) -> None:
|
||||
(self.r, self.g, self.b, self.a) = val
|
||||
self.regulate()
|
||||
|
||||
def from_const_rgb(self, val: ConstVxColorRGB) -> None:
|
||||
(self.r, self.g, self.b) = val
|
||||
self.a = 1.0
|
||||
self.regulate()
|
||||
|
||||
def from_dword(self, val: int) -> None:
|
||||
self.b = float(val & 0xFF) / 255.0
|
||||
val >>= 8
|
||||
self.g = float(val & 0xFF) / 255.0
|
||||
val >>= 8
|
||||
self.r = float(val & 0xFF) / 255.0
|
||||
val >>= 8
|
||||
self.a = float(val & 0xFF) / 255.0
|
||||
val >>= 8
|
||||
|
||||
def to_dword(self) -> int:
|
||||
# regulate self
|
||||
self.regulate()
|
||||
# construct value
|
||||
val: int = 0
|
||||
val |= int(self.a * 255)
|
||||
val <<= 8
|
||||
val |= int(self.r * 255)
|
||||
val <<= 8
|
||||
val |= int(self.g * 255)
|
||||
val <<= 8
|
||||
val |= int(self.b * 255)
|
||||
return val
|
||||
|
||||
def clone(self):
|
||||
return VxColor(self.r, self.g, self.b, self.a)
|
||||
|
||||
@staticmethod
|
||||
def _clamp_factor(val: float) -> float:
|
||||
if val > 1.0: return 1.0
|
||||
elif val < 0.0: return 0.0
|
||||
else: return val
|
||||
|
||||
def regulate(self):
|
||||
self.a = VxColor._clamp_factor(self.a)
|
||||
self.r = VxColor._clamp_factor(self.r)
|
||||
self.g = VxColor._clamp_factor(self.g)
|
||||
self.b = VxColor._clamp_factor(self.b)
|
||||
|
||||
ConstVxMatrix = tuple[
|
||||
float, float, float, float,
|
||||
float, float, float, float,
|
||||
float, float, float, float,
|
||||
float, float, float, float
|
||||
]
|
||||
|
||||
class VxMatrix():
|
||||
"""
|
||||
The Matrix representation.
|
||||
The bracket statement exactly equal with Virtools.
|
||||
"""
|
||||
data: list[list[float]]
|
||||
|
||||
def __init__(self):
|
||||
# init array
|
||||
self.data = [[0] * 4 for i in range(4)]
|
||||
# set to identy
|
||||
self.reset()
|
||||
|
||||
def _get_raw(self) -> list[list[float]]:
|
||||
return self.data
|
||||
|
||||
def reset(self) -> None:
|
||||
# reset to identy
|
||||
for i in range(4):
|
||||
for j in range(4):
|
||||
self.data[i][j] = 0.0
|
||||
|
||||
self.data[0][0] = 1.0
|
||||
self.data[1][1] = 1.0
|
||||
self.data[2][2] = 1.0
|
||||
self.data[3][3] = 1.0
|
||||
|
||||
def from_const(self, cm: ConstVxMatrix) -> None:
|
||||
(
|
||||
self.data[0][0], self.data[0][1], self.data[0][2], self.data[0][3],
|
||||
self.data[1][0], self.data[1][1], self.data[1][2], self.data[1][3],
|
||||
self.data[2][0], self.data[2][1], self.data[2][2], self.data[2][3],
|
||||
self.data[3][0], self.data[3][1], self.data[3][2], self.data[3][3]
|
||||
) = cm
|
||||
|
||||
def to_const(self) -> ConstVxMatrix:
|
||||
return (
|
||||
self.data[0][0], self.data[0][1], self.data[0][2], self.data[0][3],
|
||||
self.data[1][0], self.data[1][1], self.data[1][2], self.data[1][3],
|
||||
self.data[2][0], self.data[2][1], self.data[2][2], self.data[2][3],
|
||||
self.data[3][0], self.data[3][1], self.data[3][2], self.data[3][3]
|
||||
)
|
||||
|
||||
class CK_TEXTURE_SAVEOPTIONS(enum.IntEnum):
|
||||
"""!
|
||||
Specify the way textures or sprites will be saved
|
||||
"""
|
||||
CKTEXTURE_RAWDATA = 0 ##< Save raw data inside file. The bitmap is saved in a raw 32 bit per pixel format.
|
||||
CKTEXTURE_EXTERNAL = 1 ##< Store only the file name for the texture. The bitmap file must be present in the bitmap paths when loading the composition.
|
||||
CKTEXTURE_IMAGEFORMAT = 2 ##< Save using format specified. The bitmap data will be converted to the specified format by the correspondant bitmap plugin and saved inside file.
|
||||
CKTEXTURE_USEGLOBAL = 3 ##< Use Global settings, that is the settings given with CKContext::SetGlobalImagesSaveOptions. (Not valid when using CKContext::SetImagesSaveOptions).
|
||||
CKTEXTURE_INCLUDEORIGINALFILE = 4 ##< Insert original image file inside CMO file. The bitmap file that was used originally for the texture or sprite will be append to the composition file and extracted when the file is loaded.
|
||||
|
||||
class VX_PIXELFORMAT(enum.IntEnum):
|
||||
"""!
|
||||
Pixel format types.
|
||||
"""
|
||||
#UNKNOWN_PF = 0 ##< Unknown pixel format
|
||||
_32_ARGB8888 = 1 ##< 32-bit ARGB pixel format with alpha
|
||||
_32_RGB888 = 2 ##< 32-bit RGB pixel format without alpha
|
||||
_24_RGB888 = 3 ##< 24-bit RGB pixel format
|
||||
_16_RGB565 = 4 ##< 16-bit RGB pixel format
|
||||
_16_RGB555 = 5 ##< 16-bit RGB pixel format (5 bits per color)
|
||||
_16_ARGB1555 = 6 ##< 16-bit ARGB pixel format (5 bits per color + 1 bit for alpha)
|
||||
_16_ARGB4444 = 7 ##< 16-bit ARGB pixel format (4 bits per color)
|
||||
_8_RGB332 = 8 ##< 8-bit RGB pixel format
|
||||
_8_ARGB2222 = 9 ##< 8-bit ARGB pixel format
|
||||
_32_ABGR8888 = 10 ##< 32-bit ABGR pixel format
|
||||
_32_RGBA8888 = 11 ##< 32-bit RGBA pixel format
|
||||
_32_BGRA8888 = 12 ##< 32-bit BGRA pixel format
|
||||
_32_BGR888 = 13 ##< 32-bit BGR pixel format
|
||||
_24_BGR888 = 14 ##< 24-bit BGR pixel format
|
||||
_16_BGR565 = 15 ##< 16-bit BGR pixel format
|
||||
_16_BGR555 = 16 ##< 16-bit BGR pixel format (5 bits per color)
|
||||
_16_ABGR1555 = 17 ##< 16-bit ABGR pixel format (5 bits per color + 1 bit for alpha)
|
||||
_16_ABGR4444 = 18 ##< 16-bit ABGR pixel format (4 bits per color)
|
||||
_DXT1 = 19 ##< S3/DirectX Texture Compression 1
|
||||
_DXT2 = 20 ##< S3/DirectX Texture Compression 2
|
||||
_DXT3 = 21 ##< S3/DirectX Texture Compression 3
|
||||
_DXT4 = 22 ##< S3/DirectX Texture Compression 4
|
||||
_DXT5 = 23 ##< S3/DirectX Texture Compression 5
|
||||
_16_V8U8 = 24 ##< 16-bit Bump Map format format (8 bits per color)
|
||||
_32_V16U16 = 25 ##< 32-bit Bump Map format format (16 bits per color)
|
||||
_16_L6V5U5 = 26 ##< 16-bit Bump Map format format with luminance
|
||||
_32_X8L8V8U8 = 27 ##< 32-bit Bump Map format format with luminance
|
||||
_8_ABGR8888_CLUT = 28 ##< 8 bits indexed CLUT (ABGR)
|
||||
_8_ARGB8888_CLUT = 29 ##< 8 bits indexed CLUT (ARGB)
|
||||
_4_ABGR8888_CLUT = 30 ##< 4 bits indexed CLUT (ABGR)
|
||||
_4_ARGB8888_CLUT = 31 ##< 4 bits indexed CLUT (ARGB)
|
||||
|
||||
class VXLIGHT_TYPE(enum.IntEnum):
|
||||
"""!
|
||||
Light type
|
||||
"""
|
||||
VX_LIGHTPOINT = 1 ##< The Light is a point of light
|
||||
VX_LIGHTSPOT = 2 ##< The light is a spotlight
|
||||
VX_LIGHTDIREC = 3 ##< The light is directional light : Lights comes from an infinite point so only direction of light can be given
|
||||
#VX_LIGHTPARA = 4 ##< Obsolete, do not use
|
||||
|
||||
class VXTEXTURE_BLENDMODE(enum.IntEnum):
|
||||
"""!
|
||||
Blend Mode Flags
|
||||
"""
|
||||
VXTEXTUREBLEND_DECAL = 1 ##< Texture replace any material information
|
||||
VXTEXTUREBLEND_MODULATE = 2 ##< Texture and material are combine. Alpha information of the texture replace material alpha component.
|
||||
VXTEXTUREBLEND_DECALALPHA = 3 ##< Alpha information in the texture specify how material and texture are combined. Alpha information of the texture replace material alpha component.
|
||||
VXTEXTUREBLEND_MODULATEALPHA = 4 ##< Alpha information in the texture specify how material and texture are combined
|
||||
VXTEXTUREBLEND_DECALMASK = 5
|
||||
VXTEXTUREBLEND_MODULATEMASK = 6
|
||||
VXTEXTUREBLEND_COPY = 7 ##< Equivalent to DECAL
|
||||
VXTEXTUREBLEND_ADD = 8
|
||||
VXTEXTUREBLEND_DOTPRODUCT3 = 9 ##< Perform a Dot Product 3 between texture (normal map) and a referential vector given in VXRENDERSTATE_TEXTUREFACTOR.
|
||||
VXTEXTUREBLEND_MAX = 10
|
||||
|
||||
class VXTEXTURE_FILTERMODE(enum.IntEnum):
|
||||
"""!
|
||||
Filter Mode Options
|
||||
"""
|
||||
VXTEXTUREFILTER_NEAREST = 1 ##< No Filter
|
||||
VXTEXTUREFILTER_LINEAR = 2 ##< Bilinear Interpolation
|
||||
VXTEXTUREFILTER_MIPNEAREST = 3 ##< Mip mapping
|
||||
VXTEXTUREFILTER_MIPLINEAR = 4 ##< Mip Mapping with Bilinear interpolation
|
||||
VXTEXTUREFILTER_LINEARMIPNEAREST = 5 ##< Mip Mapping with Bilinear interpolation between mipmap levels.
|
||||
VXTEXTUREFILTER_LINEARMIPLINEAR = 6 ##< Trilinear Filtering
|
||||
VXTEXTUREFILTER_ANISOTROPIC = 7 ##< Anisotropic filtering
|
||||
|
||||
class VXTEXTURE_ADDRESSMODE(enum.IntEnum):
|
||||
"""!
|
||||
Texture addressing modes.
|
||||
"""
|
||||
VXTEXTURE_ADDRESSWRAP = 1 ##< Default mesh wrap mode is used (see CKMesh::SetWrapMode)
|
||||
VXTEXTURE_ADDRESSMIRROR = 2 ##< Texture coordinates outside the range [0..1] are flipped evenly.
|
||||
VXTEXTURE_ADDRESSCLAMP = 3 ##< Texture coordinates greater than 1.0 are set to 1.0, and values less than 0.0 are set to 0.0.
|
||||
VXTEXTURE_ADDRESSBORDER = 4 ##< When texture coordinates are greater than 1.0 or less than 0.0 texture is set to a color defined in CKMaterial::SetTextureBorderColor.
|
||||
VXTEXTURE_ADDRESSMIRRORONCE = 5 ##<
|
||||
|
||||
class VXBLEND_MODE(enum.IntEnum):
|
||||
"""!
|
||||
Blending Mode options
|
||||
"""
|
||||
VXBLEND_ZERO = 1 ##< Blend factor is (0, 0, 0, 0).
|
||||
VXBLEND_ONE = 2 ##< Blend factor is (1, 1, 1, 1).
|
||||
VXBLEND_SRCCOLOR = 3 ##< Blend factor is (Rs, Gs, Bs, As).
|
||||
VXBLEND_INVSRCCOLOR = 4 ##< Blend factor is (1-Rs, 1-Gs, 1-Bs, 1-As).
|
||||
VXBLEND_SRCALPHA = 5 ##< Blend factor is (As, As, As, As).
|
||||
VXBLEND_INVSRCALPHA = 6 ##< Blend factor is (1-As, 1-As, 1-As, 1-As).
|
||||
VXBLEND_DESTALPHA = 7 ##< Blend factor is (Ad, Ad, Ad, Ad).
|
||||
VXBLEND_INVDESTALPHA = 8 ##< Blend factor is (1-Ad, 1-Ad, 1-Ad, 1-Ad).
|
||||
VXBLEND_DESTCOLOR = 9 ##< Blend factor is (Rd, Gd, Bd, Ad).
|
||||
VXBLEND_INVDESTCOLOR = 10 ##< Blend factor is (1-Rd, 1-Gd, 1-Bd, 1-Ad).
|
||||
VXBLEND_SRCALPHASAT = 11 ##< Blend factor is (f, f, f, 1); f = min(As, 1-Ad).
|
||||
#VXBLEND_BOTHSRCALPHA = 12 ##< Source blend factor is (As, As, As, As) and destination blend factor is (1-As, 1-As, 1-As, 1-As)
|
||||
#VXBLEND_BOTHINVSRCALPHA = 13 ##< Source blend factor is (1-As, 1-As, 1-As, 1-As) and destination blend factor is (As, As, As, As)
|
||||
|
||||
class VXFILL_MODE(enum.IntEnum):
|
||||
"""!
|
||||
Fill Mode Options
|
||||
"""
|
||||
VXFILL_POINT = 1 ##< Vertices rendering
|
||||
VXFILL_WIREFRAME = 2 ##< Edges rendering
|
||||
VXFILL_SOLID = 3 ##< Face rendering
|
||||
|
||||
class VXSHADE_MODE(enum.IntEnum):
|
||||
"""!
|
||||
Shade Mode Options
|
||||
"""
|
||||
VXSHADE_FLAT = 1 ##< Flat Shading
|
||||
VXSHADE_GOURAUD = 2 ##< Gouraud Shading
|
||||
VXSHADE_PHONG = 3 ##< Phong Shading (Not yet supported by most implementation)
|
||||
|
||||
class VXCMPFUNC(enum.IntEnum):
|
||||
"""!
|
||||
Comparison Function
|
||||
"""
|
||||
VXCMP_NEVER = 1 ##< Always fail the test.
|
||||
VXCMP_LESS = 2 ##< Accept if value if less than current value.
|
||||
VXCMP_EQUAL = 3 ##< Accept if value if equal than current value.
|
||||
VXCMP_LESSEQUAL = 4 ##< Accept if value if less or equal than current value.
|
||||
VXCMP_GREATER = 5 ##< Accept if value if greater than current value.
|
||||
VXCMP_NOTEQUAL = 6 ##< Accept if value if different than current value.
|
||||
VXCMP_GREATEREQUAL = 7 ##< Accept if value if greater or equal current value.
|
||||
VXCMP_ALWAYS = 8 ##< Always accept the test.
|
||||
|
||||
class VXMESH_LITMODE(enum.IntEnum):
|
||||
"""!
|
||||
{filename:VXMESH_LITMODE}
|
||||
Summary: Mesh lighting options
|
||||
|
||||
Remarks:
|
||||
+ The VXMESH_LITMODE is used by CKMesh::SetLitMode to specify how lighting is done.
|
||||
See Also: CKMaterial,CKMesh
|
||||
"""
|
||||
VX_PRELITMESH = 0 ##< Lighting use color information store with vertices
|
||||
VX_LITMESH = 1 ##< Lighting is done by renderer using normals and face material information.
|
||||
9
Assets/BMapBindings/PyBMap/README.md
Normal file
9
Assets/BMapBindings/PyBMap/README.md
Normal file
@@ -0,0 +1,9 @@
|
||||
# PyBMap
|
||||
|
||||
The real scripts are placed in sub PyBMap folder. This folder is served for testbench scripts placing. You can run `testbench.py` to do a basic test for PyBMap but you may need some essential files to run this testbench which were written in `testbench.py`.
|
||||
|
||||
The native BMap library should be placed in sub PyBMap folder, and I have used gitignore file to filter them. The native BMap library must be named as `BMap.dll` (in Windows), `BMap.so` (in Linux or BSD), or `BMap.dylib` (in macOS). If you still can not load BMap or your system is not listed above, you should name it as `BMap.bin`.
|
||||
|
||||
Please note the most content of `virtools_types.py` are generated by EnumsMigration sub-project. Additionally the most content of `bmap.py` is generated by BMapBindings. So if some structs are updated, do not forget checking these files.
|
||||
|
||||
Since BMap 0.3.0, testbench use command line arguments, instead of hardcode variables in code, as the arguments of BMap. It is convenient that debug BMapSharp without any modification of source code. For a brief instruction, you may need to launch BMapSharpTestbench in following command (just an example. you can modify it as you wished): `py testbench.py --file-path "LightCameraTest.nmo" --temp-dir "Temp" --texture-dir "F:/Ballance/Ballance/Textures" --encodings cp1252 gb2312`.
|
||||
178
Assets/BMapBindings/PyBMap/testbench.py
Normal file
178
Assets/BMapBindings/PyBMap/testbench.py
Normal file
@@ -0,0 +1,178 @@
|
||||
import os
|
||||
import argparse
|
||||
import PyBMap.bmap_wrapper as bmap
|
||||
|
||||
def main(file_name: str, temp_folder: str, texture_folder: str, encodings: tuple[str, ...]) -> None:
|
||||
input(f'Python PID is {os.getpid()}. Waiting for debugger, press any key to continue...')
|
||||
|
||||
# file_name: str = 'LightCameraTest.nmo'
|
||||
# temp_folder: str = 'Temp'
|
||||
# texture_folder: str = 'F:\\Ballance\\Ballance\\Textures'
|
||||
# encodings: tuple[str, ...] = ('cp1252', )
|
||||
with bmap.BMFileReader(file_name, temp_folder, texture_folder, encodings) as reader:
|
||||
test_common(reader)
|
||||
test_equatable(reader)
|
||||
|
||||
def test_common(reader: bmap.BMFileReader):
|
||||
# print('===== Groups =====')
|
||||
# for gp in reader.get_groups():
|
||||
# print(gp.get_name())
|
||||
# for gp_item in gp.get_objects():
|
||||
# print(f'\t{gp_item.get_name()}')
|
||||
|
||||
# print('===== 3dObjects =====')
|
||||
# for obj in reader.get_3dobjects():
|
||||
# print(obj.get_name())
|
||||
|
||||
# current_mesh = obj.get_current_mesh()
|
||||
# mesh_name = '<null>' if current_mesh is None else current_mesh.get_name()
|
||||
# print(f'\tMesh: {mesh_name}')
|
||||
# print(f'\tVisibility: {obj.get_visibility()}')
|
||||
# print(f'\tMatrix: {obj.get_world_matrix().to_const()}')
|
||||
|
||||
# print('===== Meshes =====')
|
||||
# for mesh in reader.get_meshs():
|
||||
# print(mesh.get_name())
|
||||
|
||||
# print(f'\tLit Mode: {mesh.get_lit_mode()}')
|
||||
# print(f'\tVertex Count: {mesh.get_vertex_count()}')
|
||||
# print(f'\tFace Count: {mesh.get_face_count()}')
|
||||
# print(f'\tMaterial Slot Count: {mesh.get_material_slot_count()}')
|
||||
|
||||
# print('===== Materials =====')
|
||||
# for mtl in reader.get_materials():
|
||||
# print(mtl.get_name())
|
||||
|
||||
# print(f'\tDiffuse: {mtl.get_diffuse().to_const_rgba()}')
|
||||
# print(f'\tAmbient: {mtl.get_ambient().to_const_rgba()}')
|
||||
# print(f'\tSpecular: {mtl.get_specular().to_const_rgba()}')
|
||||
# print(f'\tEmissive: {mtl.get_emissive().to_const_rgba()}')
|
||||
|
||||
# print(f'\tSpecular Power: {mtl.get_specular_power()}')
|
||||
|
||||
# print(f'\tTexture Border Color: {mtl.get_texture_border_color().to_const_rgba()}')
|
||||
|
||||
# print(f'\tTexture Blend Mode: {mtl.get_texture_blend_mode()}')
|
||||
# print(f'\tTexture Min Mode: {mtl.get_texture_min_mode()}')
|
||||
# print(f'\tTexture Mag Mode: {mtl.get_texture_mag_mode()}')
|
||||
# print(f'\tSource Blend: {mtl.get_source_blend()}')
|
||||
# print(f'\tDest Blend: {mtl.get_dest_blend()}')
|
||||
# print(f'\tFill Mode: {mtl.get_fill_mode()}')
|
||||
# print(f'\tShade Mode: {mtl.get_shade_mode()}')
|
||||
|
||||
# print(f'\tAlpha Test Enabled: {mtl.get_alpha_test_enabled()}')
|
||||
# print(f'\tAlpha Blend Enabled: {mtl.get_alpha_blend_enabled()}')
|
||||
# print(f'\tPerspective Correction Enabled: {mtl.get_perspective_correction_enabled()}')
|
||||
# print(f'\tZ Write Enabled: {mtl.get_z_write_enabled()}')
|
||||
# print(f'\tTwo Sided Enabled: {mtl.get_two_sided_enabled()}')
|
||||
|
||||
# print(f'\tAlpha Ref: {mtl.get_alpha_ref()}')
|
||||
|
||||
# print(f'\tAlpha Func: {mtl.get_alpha_func()}')
|
||||
# print(f'\tZ Func: {mtl.get_z_func()}')
|
||||
|
||||
# print('===== Textures =====')
|
||||
# for tex in reader.get_textures():
|
||||
# print(tex.get_name())
|
||||
|
||||
# print(f'\tFile Name: {tex.get_file_name()}')
|
||||
# print(f'\tSave Options: {tex.get_save_options()}')
|
||||
# print(f'\tVideo Format: {tex.get_video_format()}')
|
||||
|
||||
print('===== Target Lights =====')
|
||||
for lit in reader.get_target_lights():
|
||||
print(lit.get_name())
|
||||
|
||||
print(f'\tVisibility: {lit.get_visibility()}')
|
||||
print(f'\tMatrix: {lit.get_world_matrix().to_const()}')
|
||||
|
||||
print(f'\tType: {lit.get_type()}')
|
||||
print(f'\tColor: {lit.get_color().to_const_rgba()}')
|
||||
print(f'\tConstant Attenuation: {lit.get_constant_attenuation()}')
|
||||
print(f'\tLinear Attenuation: {lit.get_linear_attenuation()}')
|
||||
print(f'\tQuadratic Attenuation: {lit.get_quadratic_attenuation()}')
|
||||
print(f'\tRange: {lit.get_range()}')
|
||||
print(f'\tHot Spot: {lit.get_hot_spot()}')
|
||||
print(f'\tFalloff: {lit.get_falloff()}')
|
||||
print(f'\tFalloff Shape: {lit.get_falloff_shape()}')
|
||||
|
||||
print('===== END =====')
|
||||
|
||||
def test_equatable(reader: bmap.BMFileReader):
|
||||
# Check requirements
|
||||
assert (reader.get_3dobject_count() >= 2), '''
|
||||
Invalid file for test IEquatable.
|
||||
We can not perform IEquatable test because the length of 3dObject is too short (must greater than 2). Please choose another file to perform.
|
||||
'''
|
||||
|
||||
# Prepare variables
|
||||
all_3dobjects: tuple[bmap.BM3dObject, ...] = tuple(reader.get_3dobjects())
|
||||
first_3dobj: bmap.BM3dObject = all_3dobjects[0]
|
||||
second_3dobj: bmap.BM3dObject = all_3dobjects[1]
|
||||
all_3dobjects = tuple(reader.get_3dobjects())
|
||||
first_3dobj_again: bmap.BM3dObject = all_3dobjects[0]
|
||||
|
||||
# Test set
|
||||
test_set: set[bmap.BM3dObject] = set()
|
||||
|
||||
test_set.add(first_3dobj)
|
||||
assert len(test_set) == 1
|
||||
|
||||
assert first_3dobj in test_set
|
||||
assert first_3dobj_again in test_set
|
||||
assert second_3dobj not in test_set
|
||||
|
||||
test_set.add(first_3dobj_again)
|
||||
assert len(test_set) == 1
|
||||
test_set.add(second_3dobj)
|
||||
assert len(test_set) == 2
|
||||
|
||||
assert second_3dobj in test_set
|
||||
|
||||
# Test dict
|
||||
test_dict: dict[bmap.BM3dObject, str | None] = {}
|
||||
|
||||
test_dict[first_3dobj] = first_3dobj.get_name()
|
||||
assert len(test_dict) == 1
|
||||
|
||||
assert first_3dobj in test_dict
|
||||
assert first_3dobj_again in test_dict
|
||||
assert second_3dobj not in test_dict
|
||||
|
||||
test_dict[first_3dobj_again] = first_3dobj_again.get_name()
|
||||
assert len(test_dict) == 1
|
||||
test_dict[second_3dobj] = second_3dobj.get_name()
|
||||
assert len(test_dict) == 2
|
||||
|
||||
assert second_3dobj in test_dict
|
||||
|
||||
if __name__ == '__main__':
|
||||
# parse argument
|
||||
parser = argparse.ArgumentParser(
|
||||
prog='PyBMap Testbench',
|
||||
description='The testbench of PyBMap.'
|
||||
)
|
||||
parser.add_argument(
|
||||
'--file-path',
|
||||
action='store', dest='file_path', required=True,
|
||||
help='The path to input Virtools file.'
|
||||
)
|
||||
parser.add_argument(
|
||||
'--temp-dir',
|
||||
action='store', dest='temp_dir', required=True,
|
||||
help='The temp folder used by BMap.'
|
||||
)
|
||||
parser.add_argument(
|
||||
'--texture-dir',
|
||||
action='store', dest='texture_dir', required=True,
|
||||
help='The texture folder containing Ballance texture resources.'
|
||||
)
|
||||
parser.add_argument(
|
||||
'--encodings',
|
||||
action='extend', nargs='+', dest='encodings', required=True,
|
||||
help='The encodings used to parse the names stroed in input Virtools file.'
|
||||
)
|
||||
args = parser.parse_args()
|
||||
|
||||
# run main function
|
||||
main(args.file_path, args.temp_dir, args.texture_dir, tuple(args.encodings))
|
||||
182
Assets/CodeGen/BMapBindings/.gitignore
vendored
Normal file
182
Assets/CodeGen/BMapBindings/.gitignore
vendored
Normal file
@@ -0,0 +1,182 @@
|
||||
# ===== Result =====
|
||||
dest/*
|
||||
!dest/*.gitkeep
|
||||
|
||||
# ===== Antlr =====
|
||||
*.interp
|
||||
*.tokens
|
||||
|
||||
ExpFctsLexer*.java
|
||||
ExpFctsParser*.java
|
||||
|
||||
# ===== Python =====
|
||||
# Byte-compiled / optimized / DLL files
|
||||
__pycache__/
|
||||
*.py[cod]
|
||||
*$py.class
|
||||
|
||||
# C extensions
|
||||
*.so
|
||||
|
||||
# Distribution / packaging
|
||||
.Python
|
||||
build/
|
||||
develop-eggs/
|
||||
dist/
|
||||
downloads/
|
||||
eggs/
|
||||
.eggs/
|
||||
lib/
|
||||
lib64/
|
||||
parts/
|
||||
sdist/
|
||||
var/
|
||||
wheels/
|
||||
share/python-wheels/
|
||||
*.egg-info/
|
||||
.installed.cfg
|
||||
*.egg
|
||||
MANIFEST
|
||||
|
||||
# PyInstaller
|
||||
# Usually these files are written by a python script from a template
|
||||
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
||||
*.manifest
|
||||
*.spec
|
||||
|
||||
# Installer logs
|
||||
pip-log.txt
|
||||
pip-delete-this-directory.txt
|
||||
|
||||
# Unit test / coverage reports
|
||||
htmlcov/
|
||||
.tox/
|
||||
.nox/
|
||||
.coverage
|
||||
.coverage.*
|
||||
.cache
|
||||
nosetests.xml
|
||||
coverage.xml
|
||||
*.cover
|
||||
*.py,cover
|
||||
.hypothesis/
|
||||
.pytest_cache/
|
||||
cover/
|
||||
|
||||
# Translations
|
||||
*.mo
|
||||
*.pot
|
||||
|
||||
# Django stuff:
|
||||
*.log
|
||||
local_settings.py
|
||||
db.sqlite3
|
||||
db.sqlite3-journal
|
||||
|
||||
# Flask stuff:
|
||||
instance/
|
||||
.webassets-cache
|
||||
|
||||
# Scrapy stuff:
|
||||
.scrapy
|
||||
|
||||
# Sphinx documentation
|
||||
docs/_build/
|
||||
|
||||
# PyBuilder
|
||||
.pybuilder/
|
||||
target/
|
||||
|
||||
# Jupyter Notebook
|
||||
.ipynb_checkpoints
|
||||
|
||||
# IPython
|
||||
profile_default/
|
||||
ipython_config.py
|
||||
|
||||
# pyenv
|
||||
# For a library or package, you might want to ignore these files since the code is
|
||||
# intended to run in multiple environments; otherwise, check them in:
|
||||
# .python-version
|
||||
|
||||
# pipenv
|
||||
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
||||
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
||||
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
||||
# install all needed dependencies.
|
||||
#Pipfile.lock
|
||||
|
||||
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
|
||||
__pypackages__/
|
||||
|
||||
# Celery stuff
|
||||
celerybeat-schedule
|
||||
celerybeat.pid
|
||||
|
||||
# SageMath parsed files
|
||||
*.sage.py
|
||||
|
||||
# Environments
|
||||
.env
|
||||
.venv
|
||||
env/
|
||||
venv/
|
||||
ENV/
|
||||
env.bak/
|
||||
venv.bak/
|
||||
|
||||
# Spyder project settings
|
||||
.spyderproject
|
||||
.spyproject
|
||||
|
||||
# Rope project settings
|
||||
.ropeproject
|
||||
|
||||
# mkdocs documentation
|
||||
/site
|
||||
|
||||
# mypy
|
||||
.mypy_cache/
|
||||
.dmypy.json
|
||||
dmypy.json
|
||||
|
||||
# Pyre type checker
|
||||
.pyre/
|
||||
|
||||
# pytype static type analyzer
|
||||
.pytype/
|
||||
|
||||
# Cython debug symbols
|
||||
cython_debug/
|
||||
|
||||
# ===== Eclipse =====
|
||||
# Eclipse projects
|
||||
.classpath
|
||||
.project
|
||||
.settings/
|
||||
.metadata
|
||||
|
||||
# Compiled class file
|
||||
*.class
|
||||
|
||||
# Log file
|
||||
*.log
|
||||
|
||||
# BlueJ files
|
||||
*.ctxt
|
||||
|
||||
# Mobile Tools for Java (J2ME)
|
||||
.mtj.tmp/
|
||||
|
||||
# Package Files #
|
||||
*.jar
|
||||
*.war
|
||||
*.nar
|
||||
*.ear
|
||||
*.zip
|
||||
*.tar.gz
|
||||
*.rar
|
||||
|
||||
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
|
||||
hs_err_pid*
|
||||
replay_pid*
|
||||
286
Assets/CodeGen/BMapBindings/CSharpWriter.java
Normal file
286
Assets/CodeGen/BMapBindings/CSharpWriter.java
Normal file
@@ -0,0 +1,286 @@
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.util.Vector;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class CSharpWriter {
|
||||
|
||||
/**
|
||||
* The class represent the C# type corresponding to extracted variable type.
|
||||
*/
|
||||
private static class CsInteropType {
|
||||
public CsInteropType() {
|
||||
mMarshalAs = null;
|
||||
mCsType = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* The argument of MarshalAsAttribute constructor. In generation, this field
|
||||
* should be used like this: "[MarshalAs(THIS)]" (for parameter) or "[return:
|
||||
* MarshalAs(THIS)]" (for return value).
|
||||
*/
|
||||
public String mMarshalAs;
|
||||
/**
|
||||
* The C# type used in interop function declaration for corresponding parameter.
|
||||
*/
|
||||
public String mCsType;
|
||||
}
|
||||
|
||||
/**
|
||||
* C# specified function which get C# used interop MarshalAs constructor
|
||||
* arguments and C# type used in interop function declaration.
|
||||
*
|
||||
* @param vt The instance of {@linkplain VariableType} for fetching interop
|
||||
* type.
|
||||
* @return The corresponding interop type of given variable type.
|
||||
*/
|
||||
private static CsInteropType getCsInteropType(ExpFctParamDecl paramdecl) {
|
||||
// get essential variable type properties first
|
||||
VariableType vt = paramdecl.mVarType;
|
||||
String vt_base_type = vt.getBaseType();
|
||||
int vt_pointer_level = vt.getPointerLevel();
|
||||
|
||||
// create return value
|
||||
CsInteropType ret = new CsInteropType();
|
||||
|
||||
// use "switch" to check variable type
|
||||
switch (vt_base_type) {
|
||||
case "CKSTRING":
|
||||
// decide direction cookies
|
||||
String direction_cookie = "";
|
||||
if (paramdecl.mIsInput) {
|
||||
direction_cookie = "In";
|
||||
} else {
|
||||
direction_cookie = "Out";
|
||||
}
|
||||
// only allow 0 and 1 pointer level for string.
|
||||
switch (vt_pointer_level) {
|
||||
case 0:
|
||||
ret.mMarshalAs = "UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(BMStringMarshaler), MarshalCookie = \"" + direction_cookie + "\"";
|
||||
// ret.mMarshalAs = "UnmanagedType.LPUTF8Str";
|
||||
ret.mCsType = "string";
|
||||
break;
|
||||
case 1:
|
||||
ret.mMarshalAs = "UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(BMStringArrayMarshaler), MarshalCookie = \"" + direction_cookie + "\"";
|
||||
ret.mCsType = "string[]";
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case "CKDWORD":
|
||||
if (vt_pointer_level == 0) {
|
||||
ret.mMarshalAs = "UnmanagedType.U4";
|
||||
ret.mCsType = "uint";
|
||||
} else {
|
||||
ret.mMarshalAs = "UnmanagedType.SysInt";
|
||||
ret.mCsType = "IntPtr";
|
||||
}
|
||||
break;
|
||||
case "CKWORD":
|
||||
if (vt_pointer_level == 0) {
|
||||
ret.mMarshalAs = "UnmanagedType.U2";
|
||||
ret.mCsType = "ushort";
|
||||
} else {
|
||||
ret.mMarshalAs = "UnmanagedType.SysInt";
|
||||
ret.mCsType = "IntPtr";
|
||||
}
|
||||
break;
|
||||
case "CKINT":
|
||||
if (vt_pointer_level == 0) {
|
||||
ret.mMarshalAs = "UnmanagedType.I4";
|
||||
ret.mCsType = "int";
|
||||
} else {
|
||||
ret.mMarshalAs = "UnmanagedType.SysInt";
|
||||
ret.mCsType = "IntPtr";
|
||||
}
|
||||
break;
|
||||
case "bool":
|
||||
if (vt_pointer_level == 0) {
|
||||
ret.mMarshalAs = "UnmanagedType.U1";
|
||||
ret.mCsType = "bool";
|
||||
} else {
|
||||
ret.mMarshalAs = "UnmanagedType.SysInt";
|
||||
ret.mCsType = "IntPtr";
|
||||
}
|
||||
break;
|
||||
case "CKFLOAT":
|
||||
if (vt_pointer_level == 0) {
|
||||
ret.mMarshalAs = "UnmanagedType.R4";
|
||||
ret.mCsType = "float";
|
||||
} else {
|
||||
ret.mMarshalAs = "UnmanagedType.SysInt";
|
||||
ret.mCsType = "IntPtr";
|
||||
}
|
||||
break;
|
||||
case "CKBYTE":
|
||||
if (vt_pointer_level == 0) {
|
||||
ret.mMarshalAs = "UnmanagedType.U1";
|
||||
ret.mCsType = "byte";
|
||||
} else {
|
||||
ret.mMarshalAs = "UnmanagedType.SysInt";
|
||||
ret.mCsType = "IntPtr";
|
||||
}
|
||||
break;
|
||||
case "CK_ID":
|
||||
if (vt_pointer_level == 0) {
|
||||
ret.mMarshalAs = "UnmanagedType.U4";
|
||||
ret.mCsType = "uint";
|
||||
} else {
|
||||
ret.mMarshalAs = "UnmanagedType.SysInt";
|
||||
ret.mCsType = "IntPtr";
|
||||
}
|
||||
break;
|
||||
case "NakedOutputCallback":
|
||||
// callback actually is a function pointer
|
||||
// so it only allow base type without any pointer level.
|
||||
if (vt_pointer_level == 0) {
|
||||
ret.mMarshalAs = "UnmanagedType.FunctionPtr";
|
||||
ret.mCsType = "OutputCallback";
|
||||
}
|
||||
break;
|
||||
case "BMFile":
|
||||
// In any case, BMFile only should be raw pointer
|
||||
if (vt_pointer_level != 0) {
|
||||
ret.mMarshalAs = "UnmanagedType.SysInt";
|
||||
ret.mCsType = "IntPtr";
|
||||
}
|
||||
break;
|
||||
case "BMMeshTransition":
|
||||
// In any case, BMMeshTransition only should be raw pointer
|
||||
if (vt_pointer_level != 0) {
|
||||
ret.mMarshalAs = "UnmanagedType.SysInt";
|
||||
ret.mCsType = "IntPtr";
|
||||
}
|
||||
break;
|
||||
case "VxVector3":
|
||||
if (vt_pointer_level == 0) {
|
||||
ret.mMarshalAs = "UnmanagedType.Struct";
|
||||
ret.mCsType = "VxVector3";
|
||||
} else {
|
||||
ret.mMarshalAs = "UnmanagedType.SysInt";
|
||||
ret.mCsType = "IntPtr";
|
||||
}
|
||||
break;
|
||||
case "VxVector2":
|
||||
if (vt_pointer_level == 0) {
|
||||
ret.mMarshalAs = "UnmanagedType.Struct";
|
||||
ret.mCsType = "VxVector2";
|
||||
} else {
|
||||
ret.mMarshalAs = "UnmanagedType.SysInt";
|
||||
ret.mCsType = "IntPtr";
|
||||
}
|
||||
break;
|
||||
case "VxColor":
|
||||
if (vt_pointer_level == 0) {
|
||||
ret.mMarshalAs = "UnmanagedType.Struct";
|
||||
ret.mCsType = "VxColor";
|
||||
} else {
|
||||
ret.mMarshalAs = "UnmanagedType.SysInt";
|
||||
ret.mCsType = "IntPtr";
|
||||
}
|
||||
break;
|
||||
case "VxMatrix":
|
||||
if (vt_pointer_level == 0) {
|
||||
ret.mMarshalAs = "UnmanagedType.Struct";
|
||||
ret.mCsType = "VxMatrix";
|
||||
} else {
|
||||
ret.mMarshalAs = "UnmanagedType.SysInt";
|
||||
ret.mCsType = "IntPtr";
|
||||
}
|
||||
break;
|
||||
case "CK_TEXTURE_SAVEOPTIONS":
|
||||
case "VX_PIXELFORMAT":
|
||||
case "VXLIGHT_TYPE":
|
||||
case "VXTEXTURE_BLENDMODE":
|
||||
case "VXTEXTURE_FILTERMODE":
|
||||
case "VXTEXTURE_ADDRESSMODE":
|
||||
case "VXBLEND_MODE":
|
||||
case "VXFILL_MODE":
|
||||
case "VXSHADE_MODE":
|
||||
case "VXCMPFUNC":
|
||||
case "VXMESH_LITMODE":
|
||||
// all enum type use the same strategy
|
||||
if (vt_pointer_level == 0) {
|
||||
// all enum type should be marshaled as its underlying type
|
||||
// but we can use its name in C# directly.
|
||||
ret.mMarshalAs = "UnmanagedType.U4";
|
||||
ret.mCsType = vt_base_type;
|
||||
} else {
|
||||
// for pointer type, use IntPtr instead.
|
||||
ret.mMarshalAs = "UnmanagedType.SysInt";
|
||||
ret.mCsType = "IntPtr";
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// check whether we successfully get result
|
||||
if (ret.mMarshalAs == null || ret.mCsType == null) {
|
||||
throw new IllegalArgumentException("Unexpected type: " + vt.toCType());
|
||||
}
|
||||
|
||||
// return value
|
||||
return ret;
|
||||
}
|
||||
|
||||
public static void writeCSharpCode(Vector<ExpFctDecl> data) throws Exception {
|
||||
OutputStreamWriter writer = CommonHelper.openWriter("dest/BMExports.cs");
|
||||
IndentHelper helper = new IndentHelper(writer);
|
||||
|
||||
// write function decls
|
||||
for (ExpFctDecl fctdecl : data) {
|
||||
// write annotation
|
||||
// summary (just plain function name)
|
||||
helper.printf("/// <summary>%s</summary>", fctdecl.mFctName);
|
||||
// parameter list
|
||||
for (ExpFctParamDecl paramdecl : fctdecl.mFctParams) {
|
||||
helper.printf("/// <param name=\"%s\">Type: %s. %s%s</param>", paramdecl.mVarName,
|
||||
paramdecl.mVarType.toCType(), (paramdecl.mIsInput ? "" : "This is OUT parameter. "),
|
||||
paramdecl.mVarDesc);
|
||||
}
|
||||
// return value
|
||||
helper.puts("/// <returns>True if no error, otherwise False.</returns>");
|
||||
|
||||
// write real function declaration
|
||||
// first, write DllImportAttribute
|
||||
helper.printf(
|
||||
"[DllImport(g_DllName, EntryPoint = \"%s\", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi, ExactSpelling = true)]",
|
||||
fctdecl.mFctName);
|
||||
// second, write return value MarshalAsAttribute
|
||||
helper.printf("[return: MarshalAs(UnmanagedType.U1)]");
|
||||
// then, before we write function body, we need origanize its parameter list
|
||||
// first
|
||||
Vector<String> cs_param_list = new Vector<String>();
|
||||
for (ExpFctParamDecl paramdecl : fctdecl.mFctParams) {
|
||||
// create string builder
|
||||
StringBuilder sb = new StringBuilder();
|
||||
// push in out symbol
|
||||
if (paramdecl.mIsInput) {
|
||||
sb.append("[In, ");
|
||||
} else {
|
||||
sb.append("[Out, ");
|
||||
}
|
||||
// get interop type now
|
||||
CsInteropType interop_type = getCsInteropType(paramdecl);
|
||||
// push MarshalAsAttribute
|
||||
sb.append("MarshalAs(");
|
||||
sb.append(interop_type.mMarshalAs);
|
||||
sb.append(")] ");
|
||||
// push out keyword if parameter is out parameter
|
||||
if (!paramdecl.mIsInput) {
|
||||
sb.append("out ");
|
||||
}
|
||||
// push parameter cs type
|
||||
sb.append(interop_type.mCsType);
|
||||
sb.append(" ");
|
||||
// push parameter name
|
||||
sb.append(paramdecl.mVarName);
|
||||
// insert built string into list
|
||||
cs_param_list.add(sb.toString());
|
||||
}
|
||||
// join built parameter list and output real function declaration
|
||||
helper.printf("internal static extern bool %s(%s);", fctdecl.mFctName,
|
||||
cs_param_list.stream().collect(Collectors.joining(", ")));
|
||||
}
|
||||
|
||||
writer.close();
|
||||
}
|
||||
|
||||
}
|
||||
31
Assets/CodeGen/BMapBindings/CommonHelper.java
Normal file
31
Assets/CodeGen/BMapBindings/CommonHelper.java
Normal file
@@ -0,0 +1,31 @@
|
||||
//import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
//import java.io.InputStreamReader;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
public class CommonHelper {
|
||||
|
||||
// public static InputStreamReader openReader(String filename) throws Exception {
|
||||
// FileInputStream fs = new FileInputStream(filename);
|
||||
// return new InputStreamReader(fs, StandardCharsets.UTF_8);
|
||||
// }
|
||||
|
||||
public static OutputStreamWriter openWriter(String filename) throws Exception {
|
||||
FileOutputStream fs = new FileOutputStream(filename);
|
||||
return new OutputStreamWriter(fs, StandardCharsets.UTF_8);
|
||||
}
|
||||
|
||||
// public static void writeSnippet(OutputStreamWriter writer, String snippet_path) throws Exception {
|
||||
// // open snippet
|
||||
// InputStreamReader reader = openReader(snippet_path);
|
||||
// // write into writer
|
||||
// reader.transferTo(writer);
|
||||
// reader.close();
|
||||
// }
|
||||
|
||||
public static String getDoxygenInOutStr(boolean isInput) {
|
||||
return isInput ? "in" : "out";
|
||||
}
|
||||
|
||||
}
|
||||
29
Assets/CodeGen/BMapBindings/ExpFctDecl.java
Normal file
29
Assets/CodeGen/BMapBindings/ExpFctDecl.java
Normal file
@@ -0,0 +1,29 @@
|
||||
import java.util.Vector;
|
||||
|
||||
/**
|
||||
* The class represent an export BMap function.
|
||||
*/
|
||||
public class ExpFctDecl {
|
||||
|
||||
/**
|
||||
* The name of this function.
|
||||
*/
|
||||
public String mFctName;
|
||||
/**
|
||||
* The return value type of this function.
|
||||
*/
|
||||
public VariableType mFctRetType;
|
||||
/**
|
||||
* The parameters (arguments) list of this function. Each items are
|
||||
* {@linkplain ExpFctParamDecl} and represent parameter one by one from left to
|
||||
* right.
|
||||
*/
|
||||
public Vector<ExpFctParamDecl> mFctParams;
|
||||
|
||||
public ExpFctDecl() {
|
||||
mFctName = "";
|
||||
mFctRetType = new VariableType();
|
||||
mFctParams = new Vector<ExpFctParamDecl>();
|
||||
}
|
||||
|
||||
}
|
||||
48
Assets/CodeGen/BMapBindings/ExpFctParamDecl.java
Normal file
48
Assets/CodeGen/BMapBindings/ExpFctParamDecl.java
Normal file
@@ -0,0 +1,48 @@
|
||||
|
||||
/**
|
||||
* The class represent a single parameter (argument) of function. This class
|
||||
* usually is the member of {@linkplain ExpFctDecl}.
|
||||
*/
|
||||
public class ExpFctParamDecl {
|
||||
|
||||
/**
|
||||
* The type of this parameter.
|
||||
*/
|
||||
public VariableType mVarType;
|
||||
/**
|
||||
* The name of this parameter.
|
||||
*/
|
||||
public String mVarName;
|
||||
/**
|
||||
* True if this paramter is marked as input parameter, otherwise false.
|
||||
* <p>
|
||||
* Input parameter and output paramter is commonly used in C/C++ code. By using
|
||||
* this feature, each function can receive multiple arguments and return
|
||||
* multiple arguments without defining a struct to hold it.
|
||||
* <p>
|
||||
* The type of input parameter is itself. However, the type of output parameter
|
||||
* is the pointer of itself. So you may need get its pointer type when
|
||||
* processing output paramter, especially for the scenario that the target
|
||||
* language do not support explicit output parameter keyword.
|
||||
*/
|
||||
public boolean mIsInput;
|
||||
/**
|
||||
* The description of this parameter.
|
||||
* <p>
|
||||
* This description is generated by this program. It will indicate the
|
||||
* underlying C++ type to tell end user how to treat this paramter because some
|
||||
* target languages' native calling style can not represent these detail.
|
||||
* <p>
|
||||
* In this program, this field must be written as a annotation of corresponding
|
||||
* function.
|
||||
*/
|
||||
public String mVarDesc;
|
||||
|
||||
public ExpFctParamDecl() {
|
||||
mVarType = new VariableType();
|
||||
mVarName = "";
|
||||
mVarDesc = "";
|
||||
mIsInput = true;
|
||||
}
|
||||
|
||||
}
|
||||
23
Assets/CodeGen/BMapBindings/ExpFctsLexer.g4
Normal file
23
Assets/CodeGen/BMapBindings/ExpFctsLexer.g4
Normal file
@@ -0,0 +1,23 @@
|
||||
lexer grammar ExpFctsLexer;
|
||||
|
||||
// keywords
|
||||
EXPFCTS_EXPORT: 'BMAP_EXPORT' ;
|
||||
EXPFCTS_FILE_DECL: 'BMPARAM_FILE_DECL' ;
|
||||
EXPFCTS_MESHTRANS_DECL: 'BMPARAM_MESHTRANS_DECL' ;
|
||||
EXPFCTS_OBJECT_DECL: 'BMPARAM_OBJECT_DECL' ;
|
||||
EXPFCTS_PARAM_IN: 'BMPARAM_IN' ;
|
||||
EXPFCTS_PARAM_OUT: 'BMPARAM_OUT' ;
|
||||
|
||||
// symbols
|
||||
EXPFCTS_LPARENTHESES: '(' ;
|
||||
EXPFCTS_RPARENTHESES: ')' ;
|
||||
EXPFCTS_COMMA: ',' ;
|
||||
EXPFCTS_SEMICOLON: ';' ;
|
||||
EXPFCTS_STAR: '*' ;
|
||||
EXPFCTS_DOUBLE_COLON: '::' ;
|
||||
|
||||
// identifider
|
||||
EXPFCTS_IDENTIFIER: [_a-zA-Z][_a-zA-Z0-9]* ;
|
||||
|
||||
// remove whitespace and line break
|
||||
EXPFCTS_WS: [ \t\n\r\f]+ -> skip ;
|
||||
21
Assets/CodeGen/BMapBindings/ExpFctsParser.g4
Normal file
21
Assets/CodeGen/BMapBindings/ExpFctsParser.g4
Normal file
@@ -0,0 +1,21 @@
|
||||
parser grammar ExpFctsParser;
|
||||
options { tokenVocab = ExpFctsLexer; }
|
||||
|
||||
program: fctDecl* ;
|
||||
|
||||
fctDecl
|
||||
: EXPFCTS_EXPORT varType EXPFCTS_IDENTIFIER '(' (fctArg (',' fctArg)*)? ')' ';'
|
||||
;
|
||||
|
||||
fctArg
|
||||
: EXPFCTS_FILE_DECL '(' EXPFCTS_IDENTIFIER ')' # fctArgFileDecl
|
||||
| EXPFCTS_MESHTRANS_DECL '(' EXPFCTS_IDENTIFIER ')' #fctArgMeshTransDecl
|
||||
| EXPFCTS_OBJECT_DECL '(' EXPFCTS_IDENTIFIER ',' EXPFCTS_IDENTIFIER ')' # fctArgObjDecl
|
||||
| EXPFCTS_PARAM_IN '(' varType ',' EXPFCTS_IDENTIFIER ')' # fctArgParamIn
|
||||
| EXPFCTS_PARAM_OUT '(' varType ',' EXPFCTS_IDENTIFIER ')' # fctArgParamOut
|
||||
;
|
||||
|
||||
varType
|
||||
: EXPFCTS_IDENTIFIER ('::' EXPFCTS_IDENTIFIER)* '*'*
|
||||
;
|
||||
|
||||
134
Assets/CodeGen/BMapBindings/ExpFctsWalker.java
Normal file
134
Assets/CodeGen/BMapBindings/ExpFctsWalker.java
Normal file
@@ -0,0 +1,134 @@
|
||||
import java.util.Collections;
|
||||
import java.util.Vector;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.antlr.v4.runtime.*;
|
||||
import org.antlr.v4.runtime.tree.*;
|
||||
|
||||
public class ExpFctsWalker extends ExpFctsParserBaseListener {
|
||||
|
||||
public ExpFctsWalker() {
|
||||
mFctList = new Vector<ExpFctDecl>();
|
||||
mCurrentFct = null;
|
||||
mCurrentParam = null;
|
||||
}
|
||||
|
||||
public Vector<ExpFctDecl> getResult() {
|
||||
return mFctList;
|
||||
}
|
||||
|
||||
private Vector<ExpFctDecl> mFctList;
|
||||
private ExpFctDecl mCurrentFct;
|
||||
private ExpFctParamDecl mCurrentParam;
|
||||
|
||||
@Override
|
||||
public void enterProgram(ExpFctsParser.ProgramContext ctx) {
|
||||
mFctList.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enterFctDecl(ExpFctsParser.FctDeclContext ctx) {
|
||||
mCurrentFct = new ExpFctDecl();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exitFctDecl(ExpFctsParser.FctDeclContext ctx) {
|
||||
// set name
|
||||
mCurrentFct.mFctName = ctx.EXPFCTS_IDENTIFIER().getText();
|
||||
// check return type
|
||||
if (!mCurrentFct.mFctRetType.isValid() || mCurrentFct.mFctRetType.isPointer()
|
||||
|| !mCurrentFct.mFctRetType.getBaseType().equals("bool"))
|
||||
throw new IllegalArgumentException("invalid interface function return type. must be bool.");
|
||||
|
||||
// add into list
|
||||
mFctList.add(mCurrentFct);
|
||||
mCurrentFct = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exitFctArgFileDecl(ExpFctsParser.FctArgFileDeclContext ctx) {
|
||||
ExpFctParamDecl decl = new ExpFctParamDecl();
|
||||
decl.mVarName = ctx.EXPFCTS_IDENTIFIER().getText();
|
||||
decl.mVarDesc = "The pointer to corresponding BMFile.";
|
||||
decl.mIsInput = true;
|
||||
decl.mVarType.fromCType("BMap::BMFile*");
|
||||
mCurrentFct.mFctParams.add(decl);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exitFctArgMeshTransDecl(ExpFctsParser.FctArgMeshTransDeclContext ctx) {
|
||||
ExpFctParamDecl decl = new ExpFctParamDecl();
|
||||
decl.mVarName = ctx.EXPFCTS_IDENTIFIER().getText();
|
||||
decl.mVarDesc = "The pointer to corresponding BMMeshTransition.";
|
||||
decl.mIsInput = true;
|
||||
decl.mVarType.fromCType("BMap::BMMeshTransition*");
|
||||
mCurrentFct.mFctParams.add(decl);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exitFctArgObjDecl(ExpFctsParser.FctArgObjDeclContext ctx) {
|
||||
ExpFctParamDecl first_decl = new ExpFctParamDecl();
|
||||
first_decl.mVarName = ctx.EXPFCTS_IDENTIFIER(0).getText();
|
||||
first_decl.mVarDesc = "The pointer to corresponding BMFile.";
|
||||
first_decl.mIsInput = true;
|
||||
first_decl.mVarType.fromCType("BMap::BMFile*");
|
||||
mCurrentFct.mFctParams.add(first_decl);
|
||||
|
||||
ExpFctParamDecl second_decl = new ExpFctParamDecl();
|
||||
second_decl.mVarName = ctx.EXPFCTS_IDENTIFIER(1).getText();
|
||||
second_decl.mVarDesc = "The CKID of object you accessing.";
|
||||
second_decl.mIsInput = true;
|
||||
second_decl.mVarType.fromCType("LibCmo::CK2::CK_ID");
|
||||
mCurrentFct.mFctParams.add(second_decl);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enterFctArgParamIn(ExpFctsParser.FctArgParamInContext ctx) {
|
||||
mCurrentParam = new ExpFctParamDecl();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exitFctArgParamIn(ExpFctsParser.FctArgParamInContext ctx) {
|
||||
mCurrentParam.mVarName = ctx.EXPFCTS_IDENTIFIER().getText();
|
||||
mCurrentParam.mIsInput = true;
|
||||
|
||||
mCurrentFct.mFctParams.add(mCurrentParam);
|
||||
mCurrentParam = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enterFctArgParamOut(ExpFctsParser.FctArgParamOutContext ctx) {
|
||||
mCurrentParam = new ExpFctParamDecl();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exitFctArgParamOut(ExpFctsParser.FctArgParamOutContext ctx) {
|
||||
mCurrentParam.mVarName = ctx.EXPFCTS_IDENTIFIER().getText();
|
||||
mCurrentParam.mIsInput = false;
|
||||
// set to its pointer type
|
||||
// mCurrentParam.mVarType = mCurrentParam.mVarType.getPointerOfThis();
|
||||
|
||||
mCurrentFct.mFctParams.add(mCurrentParam);
|
||||
mCurrentParam = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exitVarType(ExpFctsParser.VarTypeContext ctx) {
|
||||
// get namespace parts and join them
|
||||
String ctype = ctx.EXPFCTS_IDENTIFIER().stream().map(value -> value.getText())
|
||||
.collect(Collectors.joining("::"));
|
||||
// add star if necessary
|
||||
if (ctx.EXPFCTS_STAR() != null) {
|
||||
ctype += String.join("", Collections.nCopies(ctx.EXPFCTS_STAR().size(), "*"));
|
||||
}
|
||||
|
||||
if (!mCurrentFct.mFctRetType.isValid()) {
|
||||
// fill function ret type first
|
||||
mCurrentFct.mFctRetType.fromCType(ctype);
|
||||
} else {
|
||||
// otherwise, fill param data
|
||||
mCurrentParam.mVarType.fromCType(ctype);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
19
Assets/CodeGen/BMapBindings/ExtractBMapFctDecl.py
Normal file
19
Assets/CodeGen/BMapBindings/ExtractBMapFctDecl.py
Normal file
@@ -0,0 +1,19 @@
|
||||
import os, re
|
||||
|
||||
self_path: str = os.path.dirname(__file__)
|
||||
src_file: str = os.path.join(self_path, '../../BMap/BMExports.hpp')
|
||||
dst_file: str = os.path.join(self_path, 'dest/BMExports.hpp')
|
||||
|
||||
with open(src_file, 'r', encoding='utf-8') as fsrc:
|
||||
# read full text
|
||||
fulltext: str = fsrc.read()
|
||||
# do findall and write into file
|
||||
with open(dst_file, 'w', encoding='utf-8') as fdst:
|
||||
# We should not only match BMAP_EXPORT,
|
||||
# because it may match the defination of BMAP_EXPORT.
|
||||
# So we add a bool at head because all BMap functions return bool.
|
||||
for item in re.findall('^BMAP_EXPORT[ \\t]+bool[ \\t]+[^;]+;', fulltext, re.MULTILINE):
|
||||
fdst.write(item)
|
||||
fdst.write('\n')
|
||||
|
||||
print('DONE')
|
||||
42
Assets/CodeGen/BMapBindings/IndentHelper.java
Normal file
42
Assets/CodeGen/BMapBindings/IndentHelper.java
Normal file
@@ -0,0 +1,42 @@
|
||||
import java.io.OutputStreamWriter;
|
||||
|
||||
public class IndentHelper {
|
||||
public IndentHelper(OutputStreamWriter writer) {
|
||||
mIndent = 0;
|
||||
mWriter = writer;
|
||||
}
|
||||
|
||||
private int mIndent;
|
||||
private OutputStreamWriter mWriter;
|
||||
|
||||
public void inc() {
|
||||
++mIndent;
|
||||
}
|
||||
|
||||
public void dec() {
|
||||
--mIndent;
|
||||
}
|
||||
|
||||
private void indent() throws Exception {
|
||||
for (int i = 0; i < mIndent; ++i) {
|
||||
mWriter.write(" ");
|
||||
}
|
||||
}
|
||||
|
||||
private void lineBreak() throws Exception {
|
||||
mWriter.write(System.lineSeparator());
|
||||
}
|
||||
|
||||
public void puts(String data) throws Exception {
|
||||
indent();
|
||||
mWriter.write(data);
|
||||
lineBreak();
|
||||
}
|
||||
|
||||
public void printf(String fmt, Object... args) throws Exception {
|
||||
indent();
|
||||
mWriter.write(String.format(fmt, args));
|
||||
lineBreak();
|
||||
}
|
||||
|
||||
}
|
||||
60
Assets/CodeGen/BMapBindings/JsonWriter.java
Normal file
60
Assets/CodeGen/BMapBindings/JsonWriter.java
Normal file
@@ -0,0 +1,60 @@
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.util.Vector;
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
|
||||
public class JsonWriter {
|
||||
|
||||
private static JsonObject writeVariableType(VariableType vt) {
|
||||
JsonObject data = new JsonObject();
|
||||
|
||||
JsonArray hierarchy = new JsonArray();
|
||||
for (String item : vt.getBaseTypeHierarchy()) {
|
||||
hierarchy.add(item);
|
||||
}
|
||||
data.add("hierarchy", hierarchy);
|
||||
data.addProperty("pointer_level", vt.getPointerLevel());
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
private static JsonObject writeExpFctParamDecl(ExpFctParamDecl paramdecl) {
|
||||
JsonObject data = new JsonObject();
|
||||
data.addProperty("name", paramdecl.mVarName);
|
||||
data.addProperty("is_input", paramdecl.mIsInput);
|
||||
data.addProperty("desc", paramdecl.mVarDesc);
|
||||
data.add("type", writeVariableType(paramdecl.mVarType));
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
private static JsonObject writeExpFctDecl(ExpFctDecl fctdecl) {
|
||||
JsonObject data = new JsonObject();
|
||||
data.addProperty("name", fctdecl.mFctName);
|
||||
data.add("return", writeVariableType(fctdecl.mFctRetType));
|
||||
|
||||
JsonArray paramlist = new JsonArray();
|
||||
for (ExpFctParamDecl paramdecl : fctdecl.mFctParams) {
|
||||
paramlist.add(writeExpFctParamDecl(paramdecl));
|
||||
}
|
||||
data.add("params", paramlist);
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
public static void writeJson(Vector<ExpFctDecl> data) throws Exception {
|
||||
OutputStreamWriter writer = CommonHelper.openWriter("dest/BMExports.json");
|
||||
//Gson gson_instance = new GsonBuilder().setPrettyPrinting().disableHtmlEscaping().create();
|
||||
Gson gson_instance = new GsonBuilder().disableHtmlEscaping().create();
|
||||
|
||||
JsonArray fcts = new JsonArray();
|
||||
for (ExpFctDecl fctdecl : data) {
|
||||
fcts.add(writeExpFctDecl(fctdecl));
|
||||
}
|
||||
|
||||
writer.write(gson_instance.toJson(fcts));
|
||||
writer.close();
|
||||
}
|
||||
}
|
||||
34
Assets/CodeGen/BMapBindings/MainRunner.java
Normal file
34
Assets/CodeGen/BMapBindings/MainRunner.java
Normal file
@@ -0,0 +1,34 @@
|
||||
import java.io.FileInputStream;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Vector;
|
||||
|
||||
import org.antlr.v4.runtime.*;
|
||||
import org.antlr.v4.runtime.tree.*;
|
||||
|
||||
public class MainRunner {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
// get interface structure
|
||||
FileInputStream fs = new FileInputStream("dest/BMExports.hpp");
|
||||
CharStream antlrfs = CharStreams.fromStream(fs, StandardCharsets.UTF_8);
|
||||
ExpFctsLexer lexer = new ExpFctsLexer(antlrfs);
|
||||
CommonTokenStream tokens = new CommonTokenStream(lexer);
|
||||
ExpFctsParser parser = new ExpFctsParser(tokens);
|
||||
|
||||
// parsing data
|
||||
ParseTree tree = parser.program();
|
||||
ParseTreeWalker walker = new ParseTreeWalker();
|
||||
ExpFctsWalker worker = new ExpFctsWalker();
|
||||
walker.walk(worker, tree);
|
||||
fs.close();
|
||||
|
||||
// get data and write them
|
||||
Vector<ExpFctDecl> result = worker.getResult();
|
||||
PythonWriter.writePythonCode(result);
|
||||
CSharpWriter.writeCSharpCode(result);
|
||||
JsonWriter.writeJson(result);
|
||||
|
||||
// print message.
|
||||
System.out.println("DONE!");
|
||||
}
|
||||
}
|
||||
96
Assets/CodeGen/BMapBindings/PythonWriter.java
Normal file
96
Assets/CodeGen/BMapBindings/PythonWriter.java
Normal file
@@ -0,0 +1,96 @@
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Vector;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class PythonWriter {
|
||||
|
||||
private static final Map<String, String> g_CppTypeMap = cppTypeMapCreator();
|
||||
|
||||
private static Map<String, String> cppTypeMapCreator() {
|
||||
Map<String, String> cache = new HashMap<String, String>();
|
||||
cache.put("CKSTRING", "CKSTRING");
|
||||
cache.put("CKDWORD", "CKDWORD");
|
||||
cache.put("CKWORD", "CKWORD");
|
||||
cache.put("CKINT", "CKINT");
|
||||
cache.put("bool", "bool");
|
||||
cache.put("CKFLOAT", "CKFLOAT");
|
||||
cache.put("CKBYTE", "CKBYTE");
|
||||
cache.put("CK_ID", "CKID");
|
||||
cache.put("NakedOutputCallback", "callback");
|
||||
cache.put("BMFile", "void");
|
||||
cache.put("BMMeshTransition", "void");
|
||||
cache.put("VxVector3", "VxVector3");
|
||||
cache.put("VxVector2", "VxVector2");
|
||||
cache.put("VxColor", "VxColor");
|
||||
cache.put("VxMatrix", "VxMatrix");
|
||||
cache.put("CK_TEXTURE_SAVEOPTIONS", "enum");
|
||||
cache.put("VX_PIXELFORMAT", "enum");
|
||||
cache.put("VXLIGHT_TYPE", "enum");
|
||||
cache.put("VXTEXTURE_BLENDMODE", "enum");
|
||||
cache.put("VXTEXTURE_FILTERMODE", "enum");
|
||||
cache.put("VXTEXTURE_ADDRESSMODE", "enum");
|
||||
cache.put("VXBLEND_MODE", "enum");
|
||||
cache.put("VXFILL_MODE", "enum");
|
||||
cache.put("VXSHADE_MODE", "enum");
|
||||
cache.put("VXCMPFUNC", "enum");
|
||||
cache.put("VXMESH_LITMODE", "enum");
|
||||
return Collections.unmodifiableMap(cache);
|
||||
}
|
||||
|
||||
private static String pythonTypeGetter(ExpFctParamDecl paramdecl) throws IllegalArgumentException {
|
||||
VariableType vt = paramdecl.mVarType;
|
||||
if (!paramdecl.mIsInput) {
|
||||
vt = vt.getPointerOfThis();
|
||||
}
|
||||
|
||||
// create string builder for build final type string
|
||||
StringBuilder sb = new StringBuilder();
|
||||
// add type prefix
|
||||
sb.append("bm_");
|
||||
// try getting cpp type from base type
|
||||
String cpp_type = g_CppTypeMap.get(vt.getBaseType());
|
||||
if (cpp_type == null) {
|
||||
throw new IllegalArgumentException("Unexpected type: " + vt.toCType());
|
||||
}
|
||||
// assign cpp type
|
||||
sb.append(cpp_type);
|
||||
// add pointer suffix
|
||||
if (vt.isPointer()) {
|
||||
sb.append("_");
|
||||
sb.append(String.join("", Collections.nCopies(vt.getPointerLevel(), "p")));
|
||||
}
|
||||
// return built type string.
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public static void writePythonCode(Vector<ExpFctDecl> data) throws Exception {
|
||||
OutputStreamWriter writer = CommonHelper.openWriter("dest/BMExports.py");
|
||||
IndentHelper helper = new IndentHelper(writer);
|
||||
|
||||
// write function decls
|
||||
for (ExpFctDecl fctdecl : data) {
|
||||
// write annotation
|
||||
// function name
|
||||
helper.printf("## %s", fctdecl.mFctName);
|
||||
// param
|
||||
for (ExpFctParamDecl paramdecl : fctdecl.mFctParams) {
|
||||
helper.printf("# @param %s[%s] Type: %s. %s%s", paramdecl.mVarName,
|
||||
CommonHelper.getDoxygenInOutStr(paramdecl.mIsInput), paramdecl.mVarType.toCType(),
|
||||
(paramdecl.mIsInput ? "" : "Use ctypes.byref(data) pass it. "), paramdecl.mVarDesc);
|
||||
}
|
||||
// return val
|
||||
helper.puts("# @return True if no error, otherwise False.");
|
||||
|
||||
// write real declaration
|
||||
// first, we need join all param
|
||||
helper.printf("%s = _create_bmap_func('%s', [%s])", fctdecl.mFctName, fctdecl.mFctName, fctdecl.mFctParams
|
||||
.stream().map(value -> pythonTypeGetter(value)).collect(Collectors.joining(", ")));
|
||||
}
|
||||
|
||||
writer.close();
|
||||
}
|
||||
|
||||
}
|
||||
17
Assets/CodeGen/BMapBindings/README.md
Normal file
17
Assets/CodeGen/BMapBindings/README.md
Normal file
@@ -0,0 +1,17 @@
|
||||
# BMap Bindings Generation
|
||||
|
||||
A helper program to generate BMap binding in Python and CSharp
|
||||
|
||||
This program is consisted by 2 parts, first is Python part which extract BMap interface function declarations from source file, thus following Antlr step can focus on syntax analyze.
|
||||
Next part is Antlr part. It analyse extracted function declarations and output corresponding Python binding and CSharp binding.
|
||||
|
||||
```
|
||||
python ExtractBMapFctDecl.py
|
||||
|
||||
antlr4 ExpFctsLexer.g4
|
||||
antlr4 ExpFctsParser.g4
|
||||
|
||||
javac *.java
|
||||
java MainRunner
|
||||
```
|
||||
|
||||
153
Assets/CodeGen/BMapBindings/VariableType.java
Normal file
153
Assets/CodeGen/BMapBindings/VariableType.java
Normal file
@@ -0,0 +1,153 @@
|
||||
import java.util.Collections;
|
||||
import java.util.Vector;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* The class represent the type of each parameters and function return value.
|
||||
*/
|
||||
public class VariableType {
|
||||
/**
|
||||
* The base type of this variable removing all ending stars (remove all pointer
|
||||
* levels) Each item in this a part of namespace and the last one must be the
|
||||
* type itself (without any namespace restriction). If no namespace restriction
|
||||
* for this type, this Vector will only have one item.
|
||||
* <p>
|
||||
* For end user, it is enough that knowing the last item is type itself.
|
||||
*/
|
||||
private Vector<String> mBaseType;
|
||||
/**
|
||||
* The pointer level of this type. It is equal to the count of trailing star of
|
||||
* this field in C style representation.
|
||||
*/
|
||||
private int mPointerLevel;
|
||||
|
||||
/**
|
||||
* Construct an empty varible type. This is commonly used constructor.
|
||||
*/
|
||||
public VariableType() {
|
||||
mBaseType = new Vector<String>();
|
||||
mPointerLevel = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* The constructor used for cloning self. This constructor is only can be used
|
||||
* by self.
|
||||
*
|
||||
* @param base_type The hierarchy of the variable type.
|
||||
* @param pointer_level The pointer level of new created variable type.
|
||||
*/
|
||||
private VariableType(Vector<String> base_type, int pointer_level) {
|
||||
mBaseType = (Vector<String>) base_type.clone();
|
||||
mPointerLevel = pointer_level;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set this variable type with a type string in C/C++ style. For example
|
||||
* "NSTest::NSTest2::MyType**".
|
||||
*
|
||||
* @param ctype The type string in C/C++ style.
|
||||
*/
|
||||
public void fromCType(String ctype) {
|
||||
if (ctype.isEmpty())
|
||||
throw new IllegalArgumentException("empty string can not be parsed.");
|
||||
|
||||
// get pointer part and name part
|
||||
int len = ctype.length();
|
||||
int star_pos = ctype.indexOf('*');
|
||||
String namepart;
|
||||
if (star_pos == -1) {
|
||||
// no star
|
||||
namepart = ctype;
|
||||
mPointerLevel = 0;
|
||||
} else {
|
||||
// has star
|
||||
if (star_pos == 0)
|
||||
throw new IllegalArgumentException("base type not found.");
|
||||
namepart = ctype.substring(0, star_pos);
|
||||
mPointerLevel = len - star_pos;
|
||||
}
|
||||
|
||||
// resolve name part
|
||||
mBaseType.clear();
|
||||
for (String item : namepart.split("::")) {
|
||||
mBaseType.add(item);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Build a type string represented by this variable type in C/C++ style.
|
||||
*
|
||||
* @return The type string in C/C++ style.
|
||||
*/
|
||||
public String toCType() {
|
||||
return mBaseType.stream().collect(Collectors.joining("::"))
|
||||
+ String.join("", Collections.nCopies(mPointerLevel, "*"));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the base type of this variable type without any namespace. It just simply
|
||||
* get the last entry in type hierarchy.
|
||||
*
|
||||
* @return The base type string without namespace prefix.
|
||||
*/
|
||||
public String getBaseType() {
|
||||
return mBaseType.lastElement();
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether this variable type is a pointer. This function just check
|
||||
* whether the pointer level of this variavle type is zero.
|
||||
*
|
||||
* @return True if it is pointer, otherwise false.
|
||||
*/
|
||||
public boolean isPointer() {
|
||||
return mPointerLevel != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the pointer level of this variable type. You can simply assume the
|
||||
* pointer level is equal to the count of trailing star.
|
||||
*
|
||||
* @return The pointer level integer. Zero means that this type is not a
|
||||
* pointer.
|
||||
*/
|
||||
public int getPointerLevel() {
|
||||
return mPointerLevel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the clone of the type hierarchy of this variable type.
|
||||
* <p>
|
||||
* It is rarely used. This only should be used when you need the namespace
|
||||
* hierarchy of this variable type.
|
||||
*
|
||||
* @return The clone of current variable type hierarchy.
|
||||
*/
|
||||
public Vector<String> getBaseTypeHierarchy() {
|
||||
return (Vector<String>) mBaseType.clone();
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether this type is a valid one. It actually check whether type
|
||||
* hierarchy include at least one entry.
|
||||
*
|
||||
* @return True if no problem of this type, otherwise false.
|
||||
*/
|
||||
public boolean isValid() {
|
||||
return mBaseType.size() != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a new created variable type which is the pointer of this variable
|
||||
* type.
|
||||
* <p>
|
||||
* In internal implementation, it just create a clone of current variable type
|
||||
* with the increase of pointer level by 1.
|
||||
*
|
||||
* @return The new created pointer type of this variable type.
|
||||
*/
|
||||
public VariableType getPointerOfThis() {
|
||||
return new VariableType(mBaseType, mPointerLevel + 1);
|
||||
}
|
||||
|
||||
}
|
||||
0
Assets/CodeGen/BMapBindings/dest/.gitkeep
Normal file
0
Assets/CodeGen/BMapBindings/dest/.gitkeep
Normal file
43
Assets/CodeGen/EnumsMigration/.gitignore
vendored
Normal file
43
Assets/CodeGen/EnumsMigration/.gitignore
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
# ===== Result =====
|
||||
dest/*
|
||||
!dest/*.gitkeep
|
||||
|
||||
# ===== ANTLR Output =====
|
||||
*.interp
|
||||
*.tokens
|
||||
|
||||
CKGeneralLexer*.java
|
||||
CKEnumsParser*.java
|
||||
CKDefinesParser*.java
|
||||
|
||||
# ===== Eclipse Java =====
|
||||
# Eclipse projects
|
||||
.classpath
|
||||
.project
|
||||
.settings/
|
||||
.metadata
|
||||
|
||||
# Compiled class file
|
||||
*.class
|
||||
|
||||
# Log file
|
||||
*.log
|
||||
|
||||
# BlueJ files
|
||||
*.ctxt
|
||||
|
||||
# Mobile Tools for Java (J2ME)
|
||||
.mtj.tmp/
|
||||
|
||||
# Package Files #
|
||||
*.jar
|
||||
*.war
|
||||
*.nar
|
||||
*.ear
|
||||
*.zip
|
||||
*.tar.gz
|
||||
*.rar
|
||||
|
||||
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
|
||||
hs_err_pid*
|
||||
replay_pid*
|
||||
6
Assets/CodeGen/EnumsMigration/CKDefinesParser.g4
Normal file
6
Assets/CodeGen/EnumsMigration/CKDefinesParser.g4
Normal file
@@ -0,0 +1,6 @@
|
||||
parser grammar CKDefinesParser;
|
||||
options { tokenVocab = CKGeneralLexer; }
|
||||
|
||||
prog: definePair+ ;
|
||||
|
||||
definePair: CKGENERAL_DEFINE CKGENERAL_ID (CKGENERAL_NUM | CKGENERAL_ID) ;
|
||||
14
Assets/CodeGen/EnumsMigration/CKEnumsParser.g4
Normal file
14
Assets/CodeGen/EnumsMigration/CKEnumsParser.g4
Normal file
@@ -0,0 +1,14 @@
|
||||
parser grammar CKEnumsParser;
|
||||
options { tokenVocab = CKGeneralLexer; }
|
||||
|
||||
prog: enumBody* ;
|
||||
|
||||
enumBody: CKGENERAL_TYPEDEF? CKGENERAL_ENUM CKGENERAL_ID CKGENERAL_LBRACKET
|
||||
entryPair+
|
||||
CKGENERAL_RBRACKET CKGENERAL_ID? CKGENERAL_SEMICOLON ;
|
||||
|
||||
entryPair: CKGENERAL_ID (CKGENERAL_EQUAL entryValue)? CKGENERAL_COMMA? ;
|
||||
|
||||
entryValue: CKGENERAL_NUM (CKGENERAL_LSHIFT CKGENERAL_NUM)? # entryDirectValue
|
||||
| CKGENERAL_ID (CKGENERAL_OR CKGENERAL_ID)* # entryRelativeValue
|
||||
;
|
||||
26
Assets/CodeGen/EnumsMigration/CKGeneralLexer.g4
Normal file
26
Assets/CodeGen/EnumsMigration/CKGeneralLexer.g4
Normal file
@@ -0,0 +1,26 @@
|
||||
lexer grammar CKGeneralLexer;
|
||||
|
||||
channels { COMMENTS, WHITESPACE }
|
||||
|
||||
// keywords
|
||||
CKGENERAL_TYPEDEF: 'typedef' ;
|
||||
CKGENERAL_DEFINE: '#define' ;
|
||||
CKGENERAL_ENUM: 'enum' ;
|
||||
// symbols
|
||||
CKGENERAL_LBRACKET: '{' ;
|
||||
CKGENERAL_RBRACKET: '}' ;
|
||||
CKGENERAL_EQUAL: '=';
|
||||
CKGENERAL_SEMICOLON: ';' ;
|
||||
CKGENERAL_LSHIFT: '<<' ;
|
||||
CKGENERAL_OR: '|' ;
|
||||
CKGENERAL_COMMA: ',' ;
|
||||
|
||||
// identifider and number
|
||||
CKGENERAL_ID: [_a-zA-Z][_a-zA-Z0-9]* ;
|
||||
CKGENERAL_NUM: (('0'[xX]) | '-')? [0-9a-fA-F]+ [uUlL]* ;
|
||||
|
||||
// comments
|
||||
CKGENERAL_LINE_COMMENT: '//' ~[\r\n]* -> channel(COMMENTS);
|
||||
CKGENERAL_BLOCK_COMMENT: '/*' .*? '*/' -> channel(COMMENTS);
|
||||
// whitespace
|
||||
CKGENERAL_WS: [ \t\r\n]+ -> channel(WHITESPACE);
|
||||
168
Assets/CodeGen/EnumsMigration/CSharpWriter.java
Normal file
168
Assets/CodeGen/EnumsMigration/CSharpWriter.java
Normal file
@@ -0,0 +1,168 @@
|
||||
import java.io.OutputStreamWriter;
|
||||
|
||||
/**
|
||||
* Write enum declarations and accessible value into CSharp format.
|
||||
*/
|
||||
public class CSharpWriter {
|
||||
|
||||
// =========== C# Enum Declaration Writer ===========
|
||||
|
||||
/**
|
||||
* Get corredponding C# underlying type of given enum.
|
||||
* <p>
|
||||
* This is C# specific function.
|
||||
*
|
||||
* @param canUnsigned The parameter stored in Enum_t that indicate whether this
|
||||
* enum can use unsigned int as its underlying type.
|
||||
* @return The string form of its underlying type.
|
||||
*/
|
||||
private static String getEnumUnderlyingType(boolean canUnsigned) {
|
||||
return canUnsigned ? "uint" : "int";
|
||||
}
|
||||
|
||||
/**
|
||||
* Internal real enum declaration writer.
|
||||
*
|
||||
* @param writer {@linkplain java.io.OutputStreamWriter} instance for writing.
|
||||
* @param prog {@linkplain EnumsHelper.EnumCollection_t} instance for writing.
|
||||
* @throws Exception
|
||||
*/
|
||||
private static void internalWriteEnums(OutputStreamWriter writer, EnumsHelper.EnumCollection_t prog)
|
||||
throws Exception {
|
||||
IndentHelper indent = new IndentHelper(writer, CommonHelper.LangType.CSharp);
|
||||
for (EnumsHelper.Enum_t enum_t : prog.mEnums) {
|
||||
// write enum comment
|
||||
indent.briefComment(enum_t.mEnumComment);
|
||||
|
||||
// write enum start
|
||||
// write flasg attribute if it is
|
||||
if (enum_t.mUseFlags) {
|
||||
indent.puts("[Flags]");
|
||||
}
|
||||
indent.printf("public enum %s : %s {", enum_t.mEnumName, getEnumUnderlyingType(enum_t.mCanUnsigned));
|
||||
indent.inc();
|
||||
|
||||
// write enum entries
|
||||
for (EnumsHelper.EnumEntry_t enumEntry_t : enum_t.mEntries) {
|
||||
// write entry self
|
||||
if (enumEntry_t.mEntryValue == null) {
|
||||
indent.printf("%s,", enumEntry_t.mEntryName);
|
||||
} else {
|
||||
indent.printf("%s = %s,", enumEntry_t.mEntryName, enumEntry_t.mEntryValue);
|
||||
}
|
||||
|
||||
// write entry comment after member
|
||||
indent.afterMemberComment(enumEntry_t.mEntryComment);
|
||||
}
|
||||
|
||||
// write enum tail
|
||||
indent.dec();
|
||||
indent.puts("}");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Write an enum declaration collection into given file.
|
||||
* <p>
|
||||
* Actually this is a wrapper of internal enum declaration collection writer.
|
||||
*
|
||||
* @param filename The name of written file.
|
||||
* @param prog {@linkplain EnumsHelper.EnumCollection_t} instance for
|
||||
* writing.
|
||||
* @throws Exception
|
||||
*/
|
||||
public static void writeEnums(String filename, EnumsHelper.EnumCollection_t prog) throws Exception {
|
||||
// open file and write
|
||||
OutputStreamWriter fs = CommonHelper.openOutputFile(filename);
|
||||
internalWriteEnums(fs, prog);
|
||||
fs.close();
|
||||
}
|
||||
|
||||
/**
|
||||
* Write a single enum declaration into given file.
|
||||
* <p>
|
||||
* Actually this is a wrapper of internal enum declaration collection writer.
|
||||
*
|
||||
* @param filename The name of written file.
|
||||
* @param _enum {@linkplain EnumsHelper.Enum_t} instance for writing.
|
||||
* @throws Exception
|
||||
*/
|
||||
public static void writeEnum(String filename, EnumsHelper.Enum_t _enum) throws Exception {
|
||||
// create collection from single enum
|
||||
EnumsHelper.EnumCollection_t col = new EnumsHelper.EnumCollection_t();
|
||||
col.mEnums.add(_enum);
|
||||
// open file and write
|
||||
OutputStreamWriter fs = CommonHelper.openOutputFile(filename);
|
||||
internalWriteEnums(fs, col);
|
||||
fs.close();
|
||||
}
|
||||
|
||||
// =========== C# Enum Accessible Value Writer ===========
|
||||
|
||||
/**
|
||||
* Internal real enum accessible value writer.
|
||||
*
|
||||
* @param writer {@linkplain java.io.OutputStreamWriter} instance for writing.
|
||||
* @param prog {@linkplain EnumsHelper.EnumCollection_t} instance for writing.
|
||||
* @throws Exception
|
||||
*/
|
||||
private static void internalWriteAccVals(OutputStreamWriter writer, EnumsHelper.EnumCollection_t prog)
|
||||
throws Exception {
|
||||
IndentHelper indent = new IndentHelper(writer, CommonHelper.LangType.CSharp);
|
||||
// write enum collections
|
||||
for (EnumsHelper.Enum_t enum_t : prog.mEnums) {
|
||||
// write enum desc header
|
||||
indent.printf(
|
||||
"public static readonly System.Collections.Generic.Dictionary<%s, string> %s = new System.Collections.Generic.Dictionary<%s, string>() {",
|
||||
enum_t.mEnumName, enum_t.mEnumName, enum_t.mEnumName);
|
||||
indent.inc();
|
||||
|
||||
// write enum desc entries
|
||||
for (EnumsHelper.EnumEntry_t enumEntry_t : enum_t.mEntries) {
|
||||
indent.printf("{ %s.%s, \"%s\" },", enum_t.mEnumName, enumEntry_t.mEntryName, enumEntry_t.mEntryName);
|
||||
}
|
||||
|
||||
// write enum tail
|
||||
indent.dec();
|
||||
indent.puts("};");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Write an enum accessible value collection into given file.
|
||||
* <p>
|
||||
* Actually this is a wrapper of internal enum accessible value collection
|
||||
* writer.
|
||||
*
|
||||
* @param filename The name of written file.
|
||||
* @param prog {@linkplain EnumsHelper.EnumCollection_t} instance for
|
||||
* writing.
|
||||
* @throws Exception
|
||||
*/
|
||||
public static void writeAccVals(String filename, EnumsHelper.EnumCollection_t prog) throws Exception {
|
||||
// open file and write
|
||||
OutputStreamWriter fs = CommonHelper.openOutputFile(filename);
|
||||
internalWriteAccVals(fs, prog);
|
||||
fs.close();
|
||||
}
|
||||
|
||||
/**
|
||||
* Write a single enum accessible value into given file.
|
||||
* <p>
|
||||
* Actually this is a wrapper of internal enum accessible value collection
|
||||
* writer.
|
||||
*
|
||||
* @param filename The name of written file.
|
||||
* @param _enum {@linkplain EnumsHelper.Enum_t} instance for writing.
|
||||
* @throws Exception
|
||||
*/
|
||||
public static void writeAccVal(String filename, EnumsHelper.Enum_t _enum) throws Exception {
|
||||
// create a collection with single enum.
|
||||
EnumsHelper.EnumCollection_t col = new EnumsHelper.EnumCollection_t();
|
||||
col.mEnums.add(_enum);
|
||||
// open file and write
|
||||
OutputStreamWriter fs = CommonHelper.openOutputFile(filename);
|
||||
internalWriteAccVals(fs, col);
|
||||
fs.close();
|
||||
}
|
||||
}
|
||||
120
Assets/CodeGen/EnumsMigration/ClassidWalker.java
Normal file
120
Assets/CodeGen/EnumsMigration/ClassidWalker.java
Normal file
@@ -0,0 +1,120 @@
|
||||
|
||||
import java.util.Stack;
|
||||
|
||||
import org.antlr.v4.runtime.*;
|
||||
import org.antlr.v4.runtime.tree.*;
|
||||
|
||||
/**
|
||||
* The specialized walker for collecting CK_CLASSID and its inherit
|
||||
* relationship.
|
||||
*/
|
||||
public class ClassidWalker extends CKDefinesParserBaseListener {
|
||||
|
||||
public ClassidWalker(BufferedTokenStream tokenStream) {
|
||||
mTokenStream = tokenStream;
|
||||
mResult = null;
|
||||
|
||||
mLevelStack = null;
|
||||
mCurrentEnum = null;
|
||||
mCurrentEntry = null;
|
||||
}
|
||||
|
||||
public EnumsHelper.Enum_t getEnum() {
|
||||
return mResult;
|
||||
}
|
||||
|
||||
private int getClassidLevel(Token defineHead) {
|
||||
Token ws = CommonHelper.getPreChannelToken(mTokenStream, defineHead, CKGeneralLexer.WHITESPACE);
|
||||
if (ws == null)
|
||||
return 0;
|
||||
|
||||
// reverse finding how many tab used.
|
||||
int counter = 0;
|
||||
char[] wstxt = ws.getText().toCharArray();
|
||||
for (int i = wstxt.length - 1; i >= 0; i--) {
|
||||
if (wstxt[i] == '\t') {
|
||||
counter++;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return counter;
|
||||
}
|
||||
|
||||
private void safePop() {
|
||||
if (mLevelStack.size() != 0)
|
||||
mLevelStack.pop();
|
||||
}
|
||||
|
||||
private void safePopTimes(int times) {
|
||||
for (int i = 0; i < times; i++) {
|
||||
if (mLevelStack.size() != 0)
|
||||
mLevelStack.pop();
|
||||
}
|
||||
}
|
||||
|
||||
private BufferedTokenStream mTokenStream;
|
||||
private EnumsHelper.Enum_t mResult;
|
||||
|
||||
private int mLevel;
|
||||
private Stack<EnumsHelper.EnumEntryWithHierarchy_t> mLevelStack;
|
||||
private EnumsHelper.Enum_t mCurrentEnum;
|
||||
private EnumsHelper.EnumEntryWithHierarchy_t mCurrentEntry;
|
||||
|
||||
@Override
|
||||
public void enterProg(CKDefinesParser.ProgContext ctx) {
|
||||
mLevel = 0;
|
||||
mLevelStack = new Stack<EnumsHelper.EnumEntryWithHierarchy_t>();
|
||||
mCurrentEnum = new EnumsHelper.Enum_t();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exitProg(CKDefinesParser.ProgContext ctx) {
|
||||
mLevel = 0;
|
||||
mLevelStack = null;
|
||||
|
||||
// classid is signed int and do not have flags feature.
|
||||
mCurrentEnum.mCanUnsigned = false;
|
||||
mCurrentEnum.mUseFlags = false;
|
||||
mResult = mCurrentEnum;
|
||||
mCurrentEnum = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enterDefinePair(CKDefinesParser.DefinePairContext ctx) {
|
||||
mCurrentEntry = new EnumsHelper.EnumEntryWithHierarchy_t();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exitDefinePair(CKDefinesParser.DefinePairContext ctx) {
|
||||
// fill entry info
|
||||
mCurrentEntry.mEntryName = ctx.CKGENERAL_ID(0).getText();
|
||||
mCurrentEntry.mEntryValue = ctx.CKGENERAL_NUM().getText();
|
||||
|
||||
// fill entry level info
|
||||
int this_level = getClassidLevel(ctx.getStart());
|
||||
if (this_level > mLevel) {
|
||||
// level up
|
||||
mLevel++;
|
||||
|
||||
mLevelStack.push(mCurrentEntry);
|
||||
mCurrentEntry.mHierarchy.addAll(mLevelStack);
|
||||
} else if (this_level == mLevel) {
|
||||
safePop();
|
||||
mLevelStack.push(mCurrentEntry);
|
||||
mCurrentEntry.mHierarchy.addAll(mLevelStack);
|
||||
} else if (this_level < mLevel) {
|
||||
// level down
|
||||
safePopTimes(mLevel - this_level + 1);
|
||||
mLevel = this_level;
|
||||
|
||||
mLevelStack.push(mCurrentEntry);
|
||||
mCurrentEntry.mHierarchy.addAll(mLevelStack);
|
||||
}
|
||||
|
||||
// move to list
|
||||
mCurrentEnum.mEntries.add(mCurrentEntry);
|
||||
mCurrentEntry = null;
|
||||
}
|
||||
|
||||
}
|
||||
51
Assets/CodeGen/EnumsMigration/CommentsFinder.java
Normal file
51
Assets/CodeGen/EnumsMigration/CommentsFinder.java
Normal file
@@ -0,0 +1,51 @@
|
||||
import java.util.List;
|
||||
|
||||
import org.antlr.v4.runtime.*;
|
||||
|
||||
public class CommentsFinder {
|
||||
|
||||
enum CommentsPosition {
|
||||
Unknown, Precomment, Postcomment
|
||||
}
|
||||
|
||||
public CommentsFinder(BufferedTokenStream tokenStream) {
|
||||
mTokenStream = tokenStream;
|
||||
mCommentsPos = CommentsPosition.Unknown;
|
||||
}
|
||||
|
||||
private BufferedTokenStream mTokenStream;
|
||||
private CommentsPosition mCommentsPos;
|
||||
|
||||
public String getComment(Token preToken, Token postToken) {
|
||||
switch (mCommentsPos) {
|
||||
case Unknown: {
|
||||
// if we don't know where is our token,
|
||||
// we should assume it is from precomment to postcomment
|
||||
// and check it.
|
||||
List<Token> precomment = CommonHelper.getPreChannelTokens(mTokenStream, preToken, CKGeneralLexer.COMMENTS);
|
||||
if (precomment != null) {
|
||||
mCommentsPos = CommentsPosition.Precomment;
|
||||
return CommonHelper.cutComments(precomment);
|
||||
}
|
||||
|
||||
List<Token> postcomment = CommonHelper.getPostChannelTokens(mTokenStream, postToken, CKGeneralLexer.COMMENTS);
|
||||
if (postcomment != null) {
|
||||
mCommentsPos = CommentsPosition.Postcomment;
|
||||
return CommonHelper.cutComments(postcomment);
|
||||
}
|
||||
|
||||
// really do not have comment, return empty and keep comment pos
|
||||
return null;
|
||||
}
|
||||
case Precomment: {
|
||||
return CommonHelper.cutComments(CommonHelper.getPreChannelTokens(mTokenStream, preToken, CKGeneralLexer.COMMENTS));
|
||||
}
|
||||
case Postcomment: {
|
||||
return CommonHelper.cutComments(CommonHelper.getPostChannelTokens(mTokenStream, postToken, CKGeneralLexer.COMMENTS));
|
||||
}
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
237
Assets/CodeGen/EnumsMigration/CommonHelper.java
Normal file
237
Assets/CodeGen/EnumsMigration/CommonHelper.java
Normal file
@@ -0,0 +1,237 @@
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.antlr.v4.runtime.*;
|
||||
|
||||
public class CommonHelper {
|
||||
|
||||
// =========== Token Finder & Comments Processing ===========
|
||||
|
||||
public static Token getPreChannelToken(BufferedTokenStream stream, Token token, int channel) {
|
||||
List<Token> tokens = stream.getHiddenTokensToLeft(token.getTokenIndex(), channel);
|
||||
if (tokens == null)
|
||||
return null;
|
||||
return tokens.get(0);
|
||||
}
|
||||
|
||||
public static Token getPostChannelToken(BufferedTokenStream stream, Token token, int channel) {
|
||||
List<Token> tokens = stream.getHiddenTokensToRight(token.getTokenIndex(), channel);
|
||||
if (tokens == null)
|
||||
return null;
|
||||
return tokens.get(0);
|
||||
}
|
||||
|
||||
public static List<Token> getPreChannelTokens(BufferedTokenStream stream, Token token, int channel) {
|
||||
return stream.getHiddenTokensToLeft(token.getTokenIndex(), channel);
|
||||
}
|
||||
|
||||
public static List<Token> getPostChannelTokens(BufferedTokenStream stream, Token token, int channel) {
|
||||
return stream.getHiddenTokensToRight(token.getTokenIndex(), channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Cut the head and tail of comment
|
||||
*
|
||||
* @param comment The comment need to be cut.
|
||||
* @return The cut comment.
|
||||
*/
|
||||
public static String cutComment(Token comment) {
|
||||
if (comment == null)
|
||||
return null;
|
||||
|
||||
switch (comment.getType()) {
|
||||
case CKGeneralLexer.CKGENERAL_LINE_COMMENT: {
|
||||
return removeStars(comment.getText().substring(2));
|
||||
}
|
||||
case CKGeneralLexer.CKGENERAL_BLOCK_COMMENT: {
|
||||
String cache = comment.getText();
|
||||
return removeStars(cache.substring(2, cache.length() - 4));
|
||||
}
|
||||
default:
|
||||
return comment.getText();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Cut multiple comments.
|
||||
* <p>
|
||||
* Each comment will be cut the head and tail first. And strip all whitespace.
|
||||
* Then join together.
|
||||
*
|
||||
* @param tokens Multiple comments.
|
||||
* @return The joined comment.
|
||||
*/
|
||||
public static String cutComments(List<Token> tokens) {
|
||||
if (tokens == null)
|
||||
return null;
|
||||
|
||||
return tokens.stream().map(value -> {
|
||||
String text = cutComment(value).strip();
|
||||
return text + " ";
|
||||
}).collect(Collectors.joining(""));
|
||||
}
|
||||
|
||||
// =========== Number Operations ===========
|
||||
|
||||
/**
|
||||
* Check whether Antlr captured CKGENERAL_NUM is a negative number.
|
||||
*
|
||||
* @param numstr The captured number.
|
||||
* @return true if it is negative number.
|
||||
*/
|
||||
public static boolean isNegativeNumber(String numstr) {
|
||||
return numstr.startsWith("-");
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether Altlr captured CKGENERAL_NUM is a hex number.
|
||||
*
|
||||
* @param numstr The captured number.
|
||||
* @return true if it is hex number.
|
||||
*/
|
||||
public static boolean isHexNumber(String numstr) {
|
||||
return numstr.startsWith("0x") || numstr.startsWith("0X");
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert accepted string into Python cupported format.
|
||||
*
|
||||
* It actually just remove trail "UL".
|
||||
*
|
||||
* @param numstr The captured number.
|
||||
* @return The Python style number string.
|
||||
*/
|
||||
public static String convertToPythonNumber(String numstr) {
|
||||
return numstr.replaceFirst("[ulUL]+$", "");
|
||||
}
|
||||
|
||||
// =========== Parts ===========
|
||||
|
||||
enum CKParts {
|
||||
CK2, VxMath
|
||||
}
|
||||
|
||||
enum LangType {
|
||||
Cpp, Python, CSharp
|
||||
}
|
||||
|
||||
public static String getCKPartsNamespace(CKParts parts) {
|
||||
switch (parts) {
|
||||
case CK2:
|
||||
return "CK2";
|
||||
case VxMath:
|
||||
return "VxMath";
|
||||
default:
|
||||
throw new IllegalArgumentException("Unexpected value: " + parts);
|
||||
}
|
||||
}
|
||||
|
||||
// =========== File Operations ===========
|
||||
|
||||
public static class InputFilePair {
|
||||
public CharStream mAntlrStream;
|
||||
public FileInputStream mUnderlyingStream;
|
||||
}
|
||||
|
||||
public static InputFilePair openInputFile(String filename) throws Exception {
|
||||
InputFilePair pair = new InputFilePair();
|
||||
pair.mUnderlyingStream = new FileInputStream(filename);
|
||||
pair.mAntlrStream = CharStreams.fromStream(pair.mUnderlyingStream, StandardCharsets.UTF_8);
|
||||
return pair;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get output file for writing.
|
||||
*
|
||||
* @param filename The name of file opening.
|
||||
* @return An OutputStreamWriter.
|
||||
* @throws Exception
|
||||
*/
|
||||
public static OutputStreamWriter openOutputFile(String filename) throws Exception {
|
||||
FileOutputStream fs = new FileOutputStream(filename);
|
||||
return new OutputStreamWriter(fs, StandardCharsets.UTF_8);
|
||||
}
|
||||
|
||||
// =========== String Process ===========
|
||||
|
||||
/**
|
||||
* Escape String
|
||||
*
|
||||
* Escape all characters which are invalid in string quote.
|
||||
*
|
||||
* @param strl The string need to be escaped.
|
||||
* @return The escaped string.
|
||||
* @see removeEol
|
||||
*/
|
||||
public static String escapeString(String strl) {
|
||||
return strl.replace("\\", "\\\\").replace("\t", "\\t").replace("\b", "\\b").replace("\n", "\\n")
|
||||
.replace("\r", "\\r").replace("\f", "\\f").replace("\"", "\\\"");
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove all EOL (End of Line) characters.
|
||||
*
|
||||
* @param strl The string need to be processed.
|
||||
* @return The string eliminated all EOL.
|
||||
* @see escapeString
|
||||
*/
|
||||
public static String removeEol(String strl) {
|
||||
return strl.replace("\n", "").replace("\r", "");
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove redundent star '*' (at least 5 continuous star chars)
|
||||
*
|
||||
* @param cmt The string provided.
|
||||
* @return The string processed.
|
||||
*/
|
||||
public static String removeStars(String cmt) {
|
||||
// only remove at least 5 continuous star chars.
|
||||
return cmt.replaceAll("\\*{5,}", "");
|
||||
}
|
||||
|
||||
/**
|
||||
* Get indent char by style
|
||||
*
|
||||
* @param use_tab Whether indent use Tab, not Space.
|
||||
* @return The indent chars
|
||||
*/
|
||||
public static String getIndentString(boolean use_tab) {
|
||||
if (use_tab)
|
||||
return "\t";
|
||||
else
|
||||
return " ";
|
||||
}
|
||||
|
||||
/**
|
||||
* Re-indent a block of string
|
||||
*
|
||||
* This function will first split block string by line. Then remove all indent
|
||||
* (strip Tab and Space). At last, re-indent and join each line
|
||||
*
|
||||
* @param block_str The string provided.
|
||||
* @param use_tab Use Tab, not Space as indent chars.
|
||||
* @param indent_level The level of indent, started by 0.
|
||||
* @return The re-indent string
|
||||
*/
|
||||
public static String reindentBlockString(String block_str, boolean use_tab, int indent_level) {
|
||||
// pre-create indent string
|
||||
String indentChars = getIndentString(use_tab);
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (int i = 0; i < indent_level; ++i) {
|
||||
sb.append(indentChars);
|
||||
}
|
||||
String indents = sb.toString();
|
||||
|
||||
// split line
|
||||
return block_str.lines().map((String line) -> {
|
||||
// strip space and tab, then re-indent it.
|
||||
return indents + line.trim();
|
||||
}).collect(Collectors.joining(System.lineSeparator())); // then join with new line breaker and return.
|
||||
}
|
||||
|
||||
}
|
||||
273
Assets/CodeGen/EnumsMigration/CppWriter.java
Normal file
273
Assets/CodeGen/EnumsMigration/CppWriter.java
Normal file
@@ -0,0 +1,273 @@
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* Write enum declarations and accessible value into C++ format.
|
||||
*/
|
||||
public class CppWriter {
|
||||
|
||||
// =========== C++ Enum Declaration Writer ===========
|
||||
|
||||
/**
|
||||
* Get corredponding C++ underlying type of given enum.
|
||||
* <p>
|
||||
* This is C++ specific function.
|
||||
*
|
||||
* @param canUnsigned The parameter stored in Enum_t that indicate whether this
|
||||
* enum can use unsigned int as its underlying type.
|
||||
* @return The string form of its underlying type.
|
||||
*/
|
||||
private static String getEnumUnderlyingType(boolean canUnsigned) {
|
||||
return canUnsigned ? "CKDWORD" : "CKINT";
|
||||
}
|
||||
|
||||
/**
|
||||
* Internal real enum declarations writer.
|
||||
*
|
||||
* @param writer {@linkplain java.io.OutputStreamWriter} instance for writing.
|
||||
* @param prog {@linkplain EnumsHelper.EnumCollection_t} instance for writing.
|
||||
* @throws Exception
|
||||
*/
|
||||
private static void internalWriteEnums(OutputStreamWriter writer, EnumsHelper.EnumCollection_t prog)
|
||||
throws Exception {
|
||||
IndentHelper indent = new IndentHelper(writer, CommonHelper.LangType.Cpp);
|
||||
for (EnumsHelper.Enum_t enum_t : prog.mEnums) {
|
||||
// write enum comment
|
||||
indent.briefComment(enum_t.mEnumComment);
|
||||
|
||||
// write enum start
|
||||
indent.printf("enum class %s : %s {", enum_t.mEnumName, getEnumUnderlyingType(enum_t.mCanUnsigned));
|
||||
indent.inc();
|
||||
|
||||
// write enum entries
|
||||
for (EnumsHelper.EnumEntry_t enumEntry_t : enum_t.mEntries) {
|
||||
// write entry self
|
||||
if (enumEntry_t.mEntryValue == null) {
|
||||
indent.printf("%s,", enumEntry_t.mEntryName);
|
||||
} else {
|
||||
indent.printf("%s = %s,", enumEntry_t.mEntryName, enumEntry_t.mEntryValue);
|
||||
}
|
||||
|
||||
// write entry comment after member
|
||||
indent.afterMemberComment(enumEntry_t.mEntryComment);
|
||||
}
|
||||
|
||||
// write enum tail
|
||||
indent.dec();
|
||||
indent.puts("};");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Write an enum collection into given file.
|
||||
* <p>
|
||||
* Actually this is a wrapper of internal enum collection writer.
|
||||
*
|
||||
* @param filename The name of written file.
|
||||
* @param prog {@linkplain EnumsHelper.EnumCollection_t} instance for
|
||||
* writing.
|
||||
* @throws Exception
|
||||
*/
|
||||
public static void writeEnums(String filename, EnumsHelper.EnumCollection_t prog) throws Exception {
|
||||
// open file and write
|
||||
OutputStreamWriter fs = CommonHelper.openOutputFile(filename);
|
||||
internalWriteEnums(fs, prog);
|
||||
fs.close();
|
||||
}
|
||||
|
||||
/**
|
||||
* Write a single enum into given file.
|
||||
* <p>
|
||||
* Actually this is a wrapper of internal enum collection writer.
|
||||
*
|
||||
* @param filename The name of written file.
|
||||
* @param _enum {@linkplain EnumsHelper.Enum_t} instance for writing.
|
||||
* @throws Exception
|
||||
*/
|
||||
public static void writeEnum(String filename, EnumsHelper.Enum_t _enum) throws Exception {
|
||||
// create an collection from single enum declaration
|
||||
// for suit the argument requirement of real writer.
|
||||
EnumsHelper.EnumCollection_t col = new EnumsHelper.EnumCollection_t();
|
||||
col.mEnums.add(_enum);
|
||||
// open file and write
|
||||
OutputStreamWriter fs = CommonHelper.openOutputFile(filename);
|
||||
internalWriteEnums(fs, col);
|
||||
fs.close();
|
||||
}
|
||||
|
||||
// =========== C++ Enum Accessible Value Writer ===========
|
||||
|
||||
/**
|
||||
* Internal real enum collection accessible value writer.
|
||||
*
|
||||
* @param writer {@linkplain java.io.OutputStreamWriter} instance for writing.
|
||||
* @param prog {@linkplain EnumsHelper.EnumCollection_t} instance for writing.
|
||||
* @param parts The part of these enum declarations. It will indicate the
|
||||
* namespace where find given enum collection.
|
||||
* @throws Exception
|
||||
*/
|
||||
private static void internalWriteAccVals(OutputStreamWriter writer, EnumsHelper.EnumCollection_t prog,
|
||||
CommonHelper.CKParts parts) throws Exception {
|
||||
IndentHelper indent = new IndentHelper(writer, CommonHelper.LangType.Cpp);
|
||||
|
||||
// write type defination (just to let user know what the type is)
|
||||
indent.puts("// struct GeneralReflection { const char8_t* mName; };");
|
||||
indent.puts("// template<typename _Ty, std::enable_if_t<std::is_enum_v<_Ty>, int> = 0>");
|
||||
indent.puts("// using GeneralReflectionArray = std::vector<std::pair<_Ty, GeneralReflection>>;");
|
||||
|
||||
indent.puts("");
|
||||
indent.puts("");
|
||||
indent.puts("");
|
||||
|
||||
// write declarations
|
||||
for (EnumsHelper.Enum_t enum_t : prog.mEnums) {
|
||||
indent.printf("extern const GeneralReflectionArray<LibCmo::%s::%s> %s;",
|
||||
CommonHelper.getCKPartsNamespace(parts), enum_t.mEnumName, enum_t.mEnumName);
|
||||
}
|
||||
|
||||
indent.puts("");
|
||||
indent.puts("");
|
||||
indent.puts("");
|
||||
|
||||
// write implements
|
||||
for (EnumsHelper.Enum_t enum_t : prog.mEnums) {
|
||||
// write enum desc header
|
||||
indent.printf("const GeneralReflectionArray<LibCmo::%s::%s> %s {", CommonHelper.getCKPartsNamespace(parts),
|
||||
enum_t.mEnumName, enum_t.mEnumName);
|
||||
indent.inc();
|
||||
|
||||
// write enum desc entries
|
||||
for (EnumsHelper.EnumEntry_t enumEntry_t : enum_t.mEntries) {
|
||||
indent.printf("{ LibCmo::%s::%s::%s, { u8\"%s\" } },", CommonHelper.getCKPartsNamespace(parts),
|
||||
enum_t.mEnumName, enumEntry_t.mEntryName, enumEntry_t.mEntryName);
|
||||
}
|
||||
|
||||
// write enum tail
|
||||
indent.dec();
|
||||
indent.puts("};");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Write an enum collection accessible value into given file.
|
||||
* <p>
|
||||
* Actually this is a wrapper of internal enum collection accessible value
|
||||
* writer.
|
||||
*
|
||||
* @param filename The name of written file.
|
||||
* @param prog {@linkplain EnumsHelper.EnumCollection_t} instance for
|
||||
* writing.
|
||||
* @param parts The part of these enum declarations.
|
||||
* @throws Exception
|
||||
*/
|
||||
public static void writeAccVals(String filename, EnumsHelper.EnumCollection_t prog, CommonHelper.CKParts parts)
|
||||
throws Exception {
|
||||
// open file and write
|
||||
OutputStreamWriter fs = CommonHelper.openOutputFile(filename);
|
||||
internalWriteAccVals(fs, prog, parts);
|
||||
fs.close();
|
||||
}
|
||||
|
||||
/**
|
||||
* Write a single enum accessible value into given file.
|
||||
* <p>
|
||||
* Actually this is a wrapper of internal enum collection accessible value
|
||||
* writer.
|
||||
*
|
||||
* @param filename The name of written file.
|
||||
* @param _enum {@linkplain EnumsHelper.Enum_t} instance for writing.
|
||||
* @param parts The part of these enum declarations.
|
||||
* @throws Exception
|
||||
*/
|
||||
public static void writeAccVal(String filename, EnumsHelper.Enum_t _enum, CommonHelper.CKParts parts)
|
||||
throws Exception {
|
||||
// create a enum collection to fulfill the requirement of internal writer.
|
||||
EnumsHelper.EnumCollection_t col = new EnumsHelper.EnumCollection_t();
|
||||
col.mEnums.add(_enum);
|
||||
// open file and write
|
||||
OutputStreamWriter fs = CommonHelper.openOutputFile(filename);
|
||||
internalWriteAccVals(fs, col, parts);
|
||||
fs.close();
|
||||
}
|
||||
|
||||
// =========== Specialized C++ Enum Accessible Value Writer ===========
|
||||
// Only accessible value part of CERROR and CK_CLASSID need to be specialized.
|
||||
// The enum self do not need special treat. Just write them normally.
|
||||
|
||||
/**
|
||||
* Specialized CKERROR accessible value writer.
|
||||
* <p>
|
||||
* The declaration of CKERROR do not need special treat. It is okey to use
|
||||
* common writer.
|
||||
*
|
||||
* @param filename The name of written file.
|
||||
* @param errors The {@linkplain EnumsHelper.Enum_t} instance storing CKERROR.
|
||||
* @throws Exception
|
||||
*/
|
||||
public static void writeCkErrorAccVal(String filename, EnumsHelper.Enum_t errors) throws Exception {
|
||||
OutputStreamWriter writer = CommonHelper.openOutputFile(filename);
|
||||
IndentHelper indent = new IndentHelper(writer, CommonHelper.LangType.Cpp);
|
||||
|
||||
// write type defination (just to let user know what the type is)
|
||||
indent.puts("// struct CkErrorReflection { const char8_t* mName; const char8_t* mDescription; };");
|
||||
indent.puts("// using CkErrorReflectionArray = std::vector<std::pair<LibCmo::CK2::CKERROR, CkErrorReflection>>;");
|
||||
|
||||
indent.puts("");
|
||||
indent.puts("");
|
||||
indent.puts("");
|
||||
|
||||
// write implementation
|
||||
indent.puts("const CkErrorReflectionArray CKERROR {");
|
||||
indent.inc();
|
||||
for (EnumsHelper.EnumEntry_t entry : errors.mEntries) {
|
||||
String comment = CommonHelper.escapeString(entry.mEntryComment);
|
||||
if (comment == null)
|
||||
comment = "";
|
||||
|
||||
indent.printf("{ LibCmo::CK2::CKERROR::%s, { u8\"%s\", u8\"%s\" } },", entry.mEntryName, entry.mEntryName,
|
||||
comment);
|
||||
}
|
||||
indent.dec();
|
||||
indent.puts("};");
|
||||
|
||||
writer.close();
|
||||
}
|
||||
|
||||
/**
|
||||
* Specialized CK_CLASSID accessible value writer.
|
||||
* <p>
|
||||
* The declaration of CK_CLASSID do not need special treat. It is okey to use
|
||||
* common writer.
|
||||
*
|
||||
* @param filename The name of written file.
|
||||
* @param classids The {@linkplain EnumsHelper.Enum_t} instance storing
|
||||
* CK_CLASSID.
|
||||
* @throws Exception
|
||||
*/
|
||||
public static void writeCkClassidAccVal(String filename, EnumsHelper.Enum_t classids) throws Exception {
|
||||
OutputStreamWriter writer = CommonHelper.openOutputFile(filename);
|
||||
IndentHelper indent = new IndentHelper(writer, CommonHelper.LangType.Cpp);
|
||||
|
||||
// write type defination (just to let user know what the type is)
|
||||
indent.puts("// struct CkClassidReflection { std::vector<const char8_t*> mHierarchy; };");
|
||||
indent.puts("// using CkClassidReflectionArray = std::vector<std::pair<LibCmo::CK2::CK_CLASSID, CkClassidReflection>>;");
|
||||
|
||||
indent.puts("");
|
||||
indent.puts("");
|
||||
indent.puts("");
|
||||
|
||||
indent.puts("const CkClassidReflectionArray CK_CLASSID {");
|
||||
indent.inc();
|
||||
for (EnumsHelper.EnumEntry_t entry : classids.mEntries) {
|
||||
EnumsHelper.EnumEntryWithHierarchy_t specialized = (EnumsHelper.EnumEntryWithHierarchy_t) entry;
|
||||
|
||||
String hierarchy = specialized.mHierarchy.stream().map(value -> value.mEntryName)
|
||||
.collect(Collectors.joining("\", u8\""));
|
||||
indent.printf("{ LibCmo::CK2::CK_CLASSID::%s, { { u8\"%s\" } } },", entry.mEntryName, hierarchy);
|
||||
}
|
||||
indent.dec();
|
||||
indent.puts("};");
|
||||
|
||||
writer.close();
|
||||
}
|
||||
}
|
||||
73
Assets/CodeGen/EnumsMigration/DefinesWalker.java
Normal file
73
Assets/CodeGen/EnumsMigration/DefinesWalker.java
Normal file
@@ -0,0 +1,73 @@
|
||||
|
||||
import org.antlr.v4.runtime.*;
|
||||
import org.antlr.v4.runtime.tree.*;
|
||||
|
||||
/**
|
||||
* The generic walker for collecting defines as a enum.
|
||||
*/
|
||||
public class DefinesWalker extends CKDefinesParserBaseListener {
|
||||
public DefinesWalker(BufferedTokenStream tokenStream) {
|
||||
mCommentsFinder = new CommentsFinder(tokenStream);
|
||||
mResult = null;
|
||||
|
||||
mCurrentEnum = null;
|
||||
mCurrentEntry = null;
|
||||
}
|
||||
|
||||
public EnumsHelper.Enum_t getEnum() {
|
||||
return mResult;
|
||||
}
|
||||
|
||||
private CommentsFinder mCommentsFinder;
|
||||
private EnumsHelper.Enum_t mResult;
|
||||
|
||||
private EnumsHelper.Enum_t mCurrentEnum;
|
||||
private EnumsHelper.EnumEntry_t mCurrentEntry;
|
||||
|
||||
@Override
|
||||
public void enterProg(CKDefinesParser.ProgContext ctx) {
|
||||
mCurrentEnum = new EnumsHelper.Enum_t();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exitProg(CKDefinesParser.ProgContext ctx) {
|
||||
mResult = mCurrentEnum;
|
||||
mCurrentEnum = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enterDefinePair(CKDefinesParser.DefinePairContext ctx) {
|
||||
mCurrentEntry = new EnumsHelper.EnumEntry_t();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exitDefinePair(CKDefinesParser.DefinePairContext ctx) {
|
||||
// set values
|
||||
mCurrentEntry.mEntryName = ctx.CKGENERAL_ID(0).getText();
|
||||
mCurrentEntry.mEntryComment = mCommentsFinder.getComment(ctx.getStart(), ctx.getStop());
|
||||
|
||||
if (ctx.CKGENERAL_NUM() == null) {
|
||||
// define with id
|
||||
mCurrentEntry.mEntryValue = ctx.CKGENERAL_ID(1).getText();
|
||||
|
||||
} else {
|
||||
// define with number
|
||||
String num = ctx.CKGENERAL_NUM().getText();
|
||||
mCurrentEntry.mEntryValue = num;
|
||||
|
||||
// check whether this enum can be unsigned
|
||||
if (CommonHelper.isNegativeNumber(num)) {
|
||||
mCurrentEnum.mCanUnsigned = false;
|
||||
}
|
||||
// if the number is in hex form, this enum MIGHT have flags feature
|
||||
if (CommonHelper.isHexNumber(num)) {
|
||||
mCurrentEnum.mUseFlags = true;
|
||||
}
|
||||
|
||||
}
|
||||
// add entry
|
||||
mCurrentEnum.mEntries.add(mCurrentEntry);
|
||||
mCurrentEntry = null;
|
||||
}
|
||||
|
||||
}
|
||||
62
Assets/CodeGen/EnumsMigration/EnumsHelper.java
Normal file
62
Assets/CodeGen/EnumsMigration/EnumsHelper.java
Normal file
@@ -0,0 +1,62 @@
|
||||
import java.util.Vector;
|
||||
|
||||
public class EnumsHelper {
|
||||
/**
|
||||
* The struct to describe the entry of an enum.
|
||||
*/
|
||||
public static class EnumEntry_t {
|
||||
public EnumEntry_t() {
|
||||
mEntryName = null;
|
||||
mEntryValue = null;
|
||||
mEntryComment = null;
|
||||
}
|
||||
|
||||
public String mEntryName; ///< The name of this entry. Can not be null.
|
||||
public String mEntryValue; ///< The value of this entry. null if this entry do not have explicit value.
|
||||
public String mEntryComment; ///< The comment of this entry. null if no comment.
|
||||
}
|
||||
|
||||
/**
|
||||
* The specialized EnumEntry type which can store extra hierarchy info.
|
||||
* Used in CK_CLASSID parsing.
|
||||
*/
|
||||
public static class EnumEntryWithHierarchy_t extends EnumEntry_t {
|
||||
public EnumEntryWithHierarchy_t() {
|
||||
super();
|
||||
mHierarchy = new Vector<EnumEntryWithHierarchy_t>();
|
||||
}
|
||||
|
||||
public Vector<EnumEntryWithHierarchy_t> mHierarchy; ///< The list to store this CK_CLASSID inheritance relationship.
|
||||
}
|
||||
|
||||
/**
|
||||
* The struct to describe an enum.
|
||||
*/
|
||||
public static class Enum_t {
|
||||
public Enum_t() {
|
||||
mEnumName = null;
|
||||
mEnumComment = null;
|
||||
mCanUnsigned = true;
|
||||
mUseFlags = false;
|
||||
mEntries = new Vector<EnumEntry_t>();
|
||||
}
|
||||
|
||||
public String mEnumName; ///< The name of this enum. Can not be null.
|
||||
public String mEnumComment; ///< The comment of this enum. null if no comment.
|
||||
public boolean mCanUnsigned; ///< true if this enum can use unsigned integer as its underlaying type.
|
||||
public boolean mUseFlags; ///< true if this enum will have flags feature (supporting OR, AND, operators).
|
||||
public Vector<EnumEntry_t> mEntries; ///< The list to store entries of this enum.
|
||||
}
|
||||
|
||||
/**
|
||||
* The struct to describe a collection of enums.
|
||||
*/
|
||||
public static class EnumCollection_t {
|
||||
public EnumCollection_t() {
|
||||
mEnums = new Vector<Enum_t>();
|
||||
}
|
||||
|
||||
public Vector<Enum_t> mEnums; ///< The list to store enums.
|
||||
}
|
||||
|
||||
}
|
||||
131
Assets/CodeGen/EnumsMigration/EnumsWalker.java
Normal file
131
Assets/CodeGen/EnumsMigration/EnumsWalker.java
Normal file
@@ -0,0 +1,131 @@
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.antlr.v4.runtime.*;
|
||||
import org.antlr.v4.runtime.tree.*;
|
||||
|
||||
/**
|
||||
* The generic walker for collecting multiple enums.
|
||||
*/
|
||||
public class EnumsWalker extends CKEnumsParserBaseListener {
|
||||
public EnumsWalker(BufferedTokenStream tokenStream) {
|
||||
mTokenStream = tokenStream;
|
||||
mCommentsFinder = new CommentsFinder(tokenStream);
|
||||
mResult = null;
|
||||
|
||||
mCurrentProg = null;
|
||||
mCurrentEnum = null;
|
||||
mCurrentEntry = null;
|
||||
}
|
||||
|
||||
public EnumsHelper.EnumCollection_t getEnums() {
|
||||
return mResult;
|
||||
}
|
||||
|
||||
private String getEnumComment(Token enumHead) {
|
||||
return CommonHelper
|
||||
.cutComments(CommonHelper.getPreChannelTokens(mTokenStream, enumHead, CKGeneralLexer.COMMENTS));
|
||||
}
|
||||
|
||||
private BufferedTokenStream mTokenStream;
|
||||
private CommentsFinder mCommentsFinder;
|
||||
private EnumsHelper.EnumCollection_t mResult;
|
||||
|
||||
private EnumsHelper.EnumCollection_t mCurrentProg;
|
||||
private EnumsHelper.Enum_t mCurrentEnum;
|
||||
private EnumsHelper.EnumEntry_t mCurrentEntry;
|
||||
|
||||
@Override
|
||||
public void enterProg(CKEnumsParser.ProgContext ctx) {
|
||||
mCurrentProg = new EnumsHelper.EnumCollection_t();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exitProg(CKEnumsParser.ProgContext ctx) {
|
||||
mResult = mCurrentProg;
|
||||
mCurrentProg = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enterEnumBody(CKEnumsParser.EnumBodyContext ctx) {
|
||||
mCurrentEnum = new EnumsHelper.Enum_t();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exitEnumBody(CKEnumsParser.EnumBodyContext ctx) {
|
||||
// get enum comment
|
||||
mCurrentEnum.mEnumComment = getEnumComment(ctx.getStart());
|
||||
// get the last name (for typedef case)
|
||||
List<TerminalNode> allNames = ctx.CKGENERAL_ID();
|
||||
mCurrentEnum.mEnumName = allNames.get(allNames.size() - 1).getText();
|
||||
|
||||
mCurrentProg.mEnums.add(mCurrentEnum);
|
||||
mCurrentEnum = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enterEntryPair(CKEnumsParser.EntryPairContext ctx) {
|
||||
mCurrentEntry = new EnumsHelper.EnumEntry_t();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exitEntryPair(CKEnumsParser.EntryPairContext ctx) {
|
||||
// get entry comment
|
||||
mCurrentEntry.mEntryComment = mCommentsFinder.getComment(ctx.getStart(), ctx.getStop());
|
||||
// get entry name
|
||||
mCurrentEntry.mEntryName = ctx.CKGENERAL_ID().getText();
|
||||
|
||||
mCurrentEnum.mEntries.add(mCurrentEntry);
|
||||
mCurrentEntry = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exitEntryDirectValue(CKEnumsParser.EntryDirectValueContext ctx) {
|
||||
// get all numbers
|
||||
List<TerminalNode> nums = ctx.CKGENERAL_NUM();
|
||||
|
||||
switch (nums.size()) {
|
||||
case 1: {
|
||||
// set value
|
||||
TerminalNode node = nums.get(0);
|
||||
mCurrentEntry.mEntryValue = node.getText();
|
||||
|
||||
// check whether this enum can be unsigned
|
||||
if (CommonHelper.isNegativeNumber(node.getText())) {
|
||||
mCurrentEnum.mCanUnsigned = false;
|
||||
}
|
||||
// if the number is in hex form, this enum MIGHT have flags feature
|
||||
if (CommonHelper.isHexNumber(node.getText())) {
|
||||
mCurrentEnum.mUseFlags = true;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case 2: {
|
||||
// set value
|
||||
TerminalNode num = nums.get(0), offset = nums.get(1);
|
||||
mCurrentEntry.mEntryValue = String.format("%s << %s", num.getText(), offset.getText());
|
||||
|
||||
// << operator appears. this enum must have flags feature
|
||||
mCurrentEnum.mUseFlags = true;
|
||||
|
||||
break;
|
||||
}
|
||||
default:
|
||||
throw new IllegalArgumentException("Unexpected value: " + nums.size());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exitEntryRelativeValue(CKEnumsParser.EntryRelativeValueContext ctx) {
|
||||
// get all identifiers and join them
|
||||
mCurrentEntry.mEntryValue = ctx.CKGENERAL_ID().stream().map(value -> value.getText())
|
||||
.collect(Collectors.joining(" | "));
|
||||
|
||||
// | operator appears. this enum must have flags feature
|
||||
mCurrentEnum.mUseFlags = true;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
116
Assets/CodeGen/EnumsMigration/IndentHelper.java
Normal file
116
Assets/CodeGen/EnumsMigration/IndentHelper.java
Normal file
@@ -0,0 +1,116 @@
|
||||
import java.io.OutputStreamWriter;
|
||||
|
||||
public class IndentHelper {
|
||||
public IndentHelper(OutputStreamWriter writer, CommonHelper.LangType lang_type) {
|
||||
mIndent = 0;
|
||||
mLangType = lang_type;
|
||||
mWriter = writer;
|
||||
|
||||
// set indent chars
|
||||
switch (mLangType) {
|
||||
case Cpp:
|
||||
case CSharp:
|
||||
mIndentChars = CommonHelper.getIndentString(true);
|
||||
break;
|
||||
case Python:
|
||||
mIndentChars = CommonHelper.getIndentString(false);
|
||||
break;
|
||||
default:
|
||||
mIndentChars = "";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private int mIndent;
|
||||
private CommonHelper.LangType mLangType;
|
||||
private String mIndentChars;
|
||||
private OutputStreamWriter mWriter;
|
||||
|
||||
private void rawIndent() throws Exception {
|
||||
for (int i = 0; i < mIndent; ++i) {
|
||||
mWriter.write(mIndentChars);
|
||||
}
|
||||
}
|
||||
|
||||
public void inc() {
|
||||
++mIndent;
|
||||
}
|
||||
|
||||
public void dec() {
|
||||
--mIndent;
|
||||
}
|
||||
|
||||
public void indent() throws Exception {
|
||||
mWriter.write(System.lineSeparator());
|
||||
rawIndent();
|
||||
}
|
||||
|
||||
public void puts(String data) throws Exception {
|
||||
indent();
|
||||
mWriter.write(data);
|
||||
}
|
||||
|
||||
public void printf(String fmt, Object... args) throws Exception {
|
||||
indent();
|
||||
mWriter.write(String.format(fmt, args));
|
||||
}
|
||||
|
||||
/**
|
||||
* Write standard Doxygen document comment.
|
||||
* <p>
|
||||
* Usually be called before writing content.
|
||||
*
|
||||
* @param comment
|
||||
* @throws Exception
|
||||
*/
|
||||
public void briefComment(String comment) throws Exception {
|
||||
if (comment == null)
|
||||
return;
|
||||
|
||||
switch (mLangType) {
|
||||
case Cpp:
|
||||
case CSharp:
|
||||
puts("/**");
|
||||
|
||||
mWriter.write(System.lineSeparator());
|
||||
mWriter.write(CommonHelper.reindentBlockString(comment, true, mIndent));
|
||||
|
||||
puts(" */");
|
||||
break;
|
||||
case Python:
|
||||
puts("\"\"\"!");
|
||||
|
||||
mWriter.write(System.lineSeparator());
|
||||
mWriter.write(CommonHelper.reindentBlockString(comment, false, mIndent));
|
||||
|
||||
puts("\"\"\"");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Write suffix style Doxygen document comment.
|
||||
* <p>
|
||||
* Usually be called after writing content.
|
||||
*
|
||||
* @param comment
|
||||
* @throws Exception
|
||||
*/
|
||||
public void afterMemberComment(String comment) throws Exception {
|
||||
if (comment == null)
|
||||
return;
|
||||
|
||||
mWriter.write(mIndentChars);
|
||||
switch (mLangType) {
|
||||
case Cpp:
|
||||
case CSharp:
|
||||
mWriter.write(String.format("/**< %s */", CommonHelper.removeEol(comment)));
|
||||
break;
|
||||
case Python:
|
||||
mWriter.write(String.format("##< %s", CommonHelper.removeEol(comment)));
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
184
Assets/CodeGen/EnumsMigration/MainRunner.java
Normal file
184
Assets/CodeGen/EnumsMigration/MainRunner.java
Normal file
@@ -0,0 +1,184 @@
|
||||
import org.antlr.v4.runtime.*;
|
||||
import org.antlr.v4.runtime.tree.*;
|
||||
|
||||
public class MainRunner {
|
||||
|
||||
/**
|
||||
* Extract an enums collection from given file.
|
||||
* <p>
|
||||
* This function is the most commonly used function for extracting enums.
|
||||
* <p>
|
||||
* This function is used for a file which only contain enum declarations. This
|
||||
* is not suit for extracting CKERROR and CK_CLASSID. For these declarations,
|
||||
* please use their specialized extractor as described following.
|
||||
*
|
||||
* @param infile The file for reading.
|
||||
* @return An {@linkplain EnumsHelper.EnumCollection_t} instance.
|
||||
* @throws Exception
|
||||
*/
|
||||
private static EnumsHelper.EnumCollection_t getEnumsCollection(String infile) throws Exception {
|
||||
CommonHelper.InputFilePair pair = CommonHelper.openInputFile(infile);
|
||||
CKGeneralLexer lexer = new CKGeneralLexer(pair.mAntlrStream);
|
||||
CommonTokenStream tokens = new CommonTokenStream(lexer);
|
||||
CKEnumsParser parser = new CKEnumsParser(tokens);
|
||||
|
||||
ParseTree tree = parser.prog();
|
||||
ParseTreeWalker walker = new ParseTreeWalker();
|
||||
EnumsWalker worker = new EnumsWalker(tokens);
|
||||
walker.walk(worker, tree);
|
||||
|
||||
pair.mUnderlyingStream.close();
|
||||
return worker.getEnums();
|
||||
}
|
||||
|
||||
/**
|
||||
* Extract a series of "#define" syntax as an enum.
|
||||
* <p>
|
||||
* This function will assume that given file only contain C++ "#define" syntax.
|
||||
* After reading it, it will re-organize it as an enum and return. This only is
|
||||
* used by CKERROR now. But it suit for more scenarios if there are something
|
||||
* like CKERROR in future.
|
||||
*
|
||||
* @param infile The file for reading.
|
||||
* @param assignedEnumName The desired name of organized enum instance.
|
||||
* Contemporary this field should always be "CKERROR"
|
||||
* because no one else is using it.
|
||||
* @return An {@linkplain EnumsHelper.Enum_t} instance.
|
||||
* @throws Exception
|
||||
*/
|
||||
private static EnumsHelper.Enum_t organiseDefines(String infile, String assignedEnumName) throws Exception {
|
||||
CommonHelper.InputFilePair pair = CommonHelper.openInputFile(infile);
|
||||
CKGeneralLexer lexer = new CKGeneralLexer(pair.mAntlrStream);
|
||||
CommonTokenStream tokens = new CommonTokenStream(lexer);
|
||||
CKDefinesParser parser = new CKDefinesParser(tokens);
|
||||
|
||||
ParseTree tree = parser.prog();
|
||||
ParseTreeWalker walker = new ParseTreeWalker();
|
||||
DefinesWalker worker = new DefinesWalker(tokens);
|
||||
walker.walk(worker, tree);
|
||||
|
||||
pair.mUnderlyingStream.close();
|
||||
|
||||
EnumsHelper.Enum_t result = worker.getEnum();
|
||||
result.mEnumName = assignedEnumName;
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extract a series of macro define as an enum, considering its indent to build
|
||||
* hierarchy.
|
||||
* <p>
|
||||
* This is specialized enum extractor of CK_CLASSID. The given file should use a
|
||||
* series "#define" syntax to describe enum, and use Tab as the indent before
|
||||
* each "#define" syntax to indicate its hierarchy.
|
||||
*
|
||||
* @param infile The file for reading.
|
||||
* @return An {@linkplain EnumsHelper.Enum_t} instance. Actually it is an
|
||||
* instance to {@linkplain EnumsHelper.Enum_t} whose entries is
|
||||
* {@linkplain EnumsHelper.EnumEntryWithHierarchy_t}, the child class of
|
||||
* {@linkplain EnumsHelper.EnumEntry_t} (the entry type of common
|
||||
* {@linkplain EnumsHelper.Enum_t}) with extra hierarchy infos.
|
||||
* @throws Exception
|
||||
*/
|
||||
private static EnumsHelper.Enum_t organiseClassid(String infile) throws Exception {
|
||||
CommonHelper.InputFilePair pair = CommonHelper.openInputFile(infile);
|
||||
CKGeneralLexer lexer = new CKGeneralLexer(pair.mAntlrStream);
|
||||
CommonTokenStream tokens = new CommonTokenStream(lexer);
|
||||
CKDefinesParser parser = new CKDefinesParser(tokens);
|
||||
|
||||
ParseTree tree = parser.prog();
|
||||
ParseTreeWalker walker = new ParseTreeWalker();
|
||||
ClassidWalker worker = new ClassidWalker(tokens);
|
||||
walker.walk(worker, tree);
|
||||
|
||||
pair.mUnderlyingStream.close();
|
||||
|
||||
EnumsHelper.Enum_t result = worker.getEnum();
|
||||
result.mEnumName = "CK_CLASSID";
|
||||
return result;
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
|
||||
// =========== CKERROR ===========
|
||||
EnumsHelper.Enum_t ckerror = organiseDefines("src/CKERROR.txt", "CKERROR");
|
||||
CppWriter.writeEnum("dest/CKERROR.hpp", ckerror);
|
||||
PythonWriter.writeEnum("dest/CKERROR.py", ckerror);
|
||||
CSharpWriter.writeEnum("dest/CKERROR.cs", ckerror);
|
||||
CppWriter.writeCkErrorAccVal("dest/CKERROR.AccVal.hpp", ckerror);
|
||||
PythonWriter.writeAccVal("dest/CKERROR.AccVal.py", ckerror);
|
||||
CSharpWriter.writeAccVal("dest/CKERROR.AccVal.cs", ckerror);
|
||||
|
||||
// =========== CK_CLASSID ===========
|
||||
EnumsHelper.Enum_t classid = organiseClassid("src/CK_CLASSID.txt");
|
||||
CppWriter.writeEnum("dest/CK_CLASSID.hpp", classid);
|
||||
PythonWriter.writeEnum("dest/CK_CLASSID.py", classid);
|
||||
CSharpWriter.writeEnum("dest/CK_CLASSID.cs", classid);
|
||||
CppWriter.writeCkClassidAccVal("dest/CK_CLASSID.AccVal.hpp", classid);
|
||||
PythonWriter.writeAccVal("dest/CK_CLASSID.AccVal.py", classid);
|
||||
|
||||
// =========== Define2 ===========
|
||||
// Define2 do not need annotation output.
|
||||
// Because they are CKStateChunk used value which are not exposed to outside.
|
||||
EnumsHelper.EnumCollection_t def2 = getEnumsCollection("src/Defines2.txt");
|
||||
CppWriter.writeEnums("dest/Defines2.hpp", def2);
|
||||
PythonWriter.writeEnums("dest/Defines2.py", def2);
|
||||
CSharpWriter.writeEnums("dest/Defines2.cs", def2);
|
||||
|
||||
// =========== Combined enums ===========
|
||||
EnumsHelper.EnumCollection_t ck2Enums = getEnumsCollection("src/CKEnums.txt"),
|
||||
vxEnums = getEnumsCollection("src/VxEnums.txt");
|
||||
|
||||
CppWriter.writeEnums("dest/CKEnums.hpp", ck2Enums);
|
||||
PythonWriter.writeEnums("dest/CKEnums.py", ck2Enums);
|
||||
CSharpWriter.writeEnums("dest/CKEnums.cs", ck2Enums);
|
||||
CppWriter.writeAccVals("dest/CKEnums.AccVal.hpp", ck2Enums, CommonHelper.CKParts.CK2);
|
||||
PythonWriter.writeAccVals("dest/CKEnums.AccVal.py", ck2Enums);
|
||||
CSharpWriter.writeAccVals("dest/CKEnums.AccVal.cs", ck2Enums);
|
||||
|
||||
CppWriter.writeEnums("dest/VxEnums.hpp", vxEnums);
|
||||
PythonWriter.writeEnums("dest/VxEnums.py", vxEnums);
|
||||
CSharpWriter.writeEnums("dest/VxEnums.cs", vxEnums);
|
||||
CppWriter.writeAccVals("dest/VxEnums.AccVal.hpp", vxEnums, CommonHelper.CKParts.VxMath);
|
||||
PythonWriter.writeAccVals("dest/VxEnums.AccVal.py", vxEnums);
|
||||
CSharpWriter.writeAccVals("dest/VxEnums.AccVal.cs", vxEnums);
|
||||
|
||||
// =========== Single enums ===========
|
||||
EnumsHelper.Enum_t single;
|
||||
|
||||
single = organiseDefines("src/CK_STATECHUNK_CHUNKVERSION.txt", "CK_STATECHUNK_CHUNKVERSION");
|
||||
CppWriter.writeEnum("dest/CK_STATECHUNK_CHUNKVERSION.hpp", single);
|
||||
PythonWriter.writeEnum("dest/CK_STATECHUNK_CHUNKVERSION.py", single);
|
||||
CSharpWriter.writeEnum("dest/CK_STATECHUNK_CHUNKVERSION.cs", single);
|
||||
CppWriter.writeAccVal("dest/CK_STATECHUNK_CHUNKVERSION.AccVal.hpp", single, CommonHelper.CKParts.CK2);
|
||||
PythonWriter.writeAccVal("dest/CK_STATECHUNK_CHUNKVERSION.AccVal.py", single);
|
||||
CSharpWriter.writeAccVal("dest/CK_STATECHUNK_CHUNKVERSION.AccVal.cs", single);
|
||||
|
||||
single = organiseDefines("src/CK_STATECHUNK_DATAVERSION.txt", "CK_STATECHUNK_DATAVERSION");
|
||||
CppWriter.writeEnum("dest/CK_STATECHUNK_DATAVERSION.hpp", single);
|
||||
PythonWriter.writeEnum("dest/CK_STATECHUNK_DATAVERSION.py", single);
|
||||
CSharpWriter.writeEnum("dest/CK_STATECHUNK_DATAVERSION.cs", single);
|
||||
CppWriter.writeAccVal("dest/CK_STATECHUNK_DATAVERSION.AccVal.hpp", single, CommonHelper.CKParts.CK2);
|
||||
PythonWriter.writeAccVal("dest/CK_STATECHUNK_DATAVERSION.AccVal.py", single);
|
||||
CSharpWriter.writeAccVal("dest/CK_STATECHUNK_DATAVERSION.AccVal.cs", single);
|
||||
|
||||
single = organiseDefines("src/CK_BITMAPDATA_FLAGS.txt", "CK_BITMAPDATA_FLAGS");
|
||||
CppWriter.writeEnum("dest/CK_BITMAPDATA_FLAGS.hpp", single);
|
||||
PythonWriter.writeEnum("dest/CK_BITMAPDATA_FLAGS.py", single);
|
||||
CSharpWriter.writeEnum("dest/CK_BITMAPDATA_FLAGS.cs", single);
|
||||
CppWriter.writeAccVal("dest/CK_BITMAPDATA_FLAGS.AccVal.hpp", single, CommonHelper.CKParts.CK2);
|
||||
PythonWriter.writeAccVal("dest/CK_BITMAPDATA_FLAGS.AccVal.py", single);
|
||||
CSharpWriter.writeAccVal("dest/CK_BITMAPDATA_FLAGS.AccVal.cs", single);
|
||||
|
||||
single = organiseDefines("src/CK_CAMERA_PROJECTION.txt", "CK_CAMERA_PROJECTION");
|
||||
CppWriter.writeEnum("dest/CK_CAMERA_PROJECTION.hpp", single);
|
||||
PythonWriter.writeEnum("dest/CK_CAMERA_PROJECTION.py", single);
|
||||
CSharpWriter.writeEnum("dest/CK_CAMERA_PROJECTION.cs", single);
|
||||
CppWriter.writeAccVal("dest/CK_CAMERA_PROJECTION.AccVal.hpp", single, CommonHelper.CKParts.CK2);
|
||||
PythonWriter.writeAccVal("dest/CK_CAMERA_PROJECTION.AccVal.py", single);
|
||||
CSharpWriter.writeAccVal("dest/CK_CAMERA_PROJECTION.AccVal.cs", single);
|
||||
|
||||
// print message.
|
||||
System.out.println("DONE!");
|
||||
}
|
||||
}
|
||||
185
Assets/CodeGen/EnumsMigration/PythonWriter.java
Normal file
185
Assets/CodeGen/EnumsMigration/PythonWriter.java
Normal file
@@ -0,0 +1,185 @@
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* Write enum declarations and accessible value into Python format.
|
||||
*/
|
||||
public class PythonWriter {
|
||||
|
||||
// =========== Python Enum Declaration Writer ===========
|
||||
|
||||
/**
|
||||
* Internal real enum declaration writer.
|
||||
*
|
||||
* @param writer {@linkplain java.io.OutputStreamWriter} instance for writing.
|
||||
* @param prog {@linkplain EnumsHelper.EnumCollection_t} instance for writing.
|
||||
* @throws Exception
|
||||
*/
|
||||
private static void internalWriteEnums(OutputStreamWriter writer, EnumsHelper.EnumCollection_t prog)
|
||||
throws Exception {
|
||||
IndentHelper indent = new IndentHelper(writer, CommonHelper.LangType.Python);
|
||||
for (EnumsHelper.Enum_t enum_t : prog.mEnums) {
|
||||
// write enum start
|
||||
indent.printf("class %s(enum.IntEnum):", enum_t.mEnumName);
|
||||
indent.inc();
|
||||
|
||||
// write enum comment
|
||||
indent.briefComment(enum_t.mEnumComment);
|
||||
|
||||
// write enum entries
|
||||
for (EnumsHelper.EnumEntry_t enumEntry_t : enum_t.mEntries) {
|
||||
// write entry self
|
||||
if (enumEntry_t.mEntryValue == null) {
|
||||
indent.printf("%s = auto()", enumEntry_t.mEntryName);
|
||||
} else {
|
||||
indent.printf("%s = %s", enumEntry_t.mEntryName,
|
||||
CommonHelper.convertToPythonNumber(enumEntry_t.mEntryValue));
|
||||
}
|
||||
|
||||
// write entry comment after member
|
||||
indent.afterMemberComment(enumEntry_t.mEntryComment);
|
||||
}
|
||||
|
||||
// enum tail
|
||||
indent.dec();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Write an enum declaration collection into given file.
|
||||
* <p>
|
||||
* Actually this is a wrapper of internal enum declaration collection writer.
|
||||
*
|
||||
* @param filename The name of written file.
|
||||
* @param prog {@linkplain EnumsHelper.EnumCollection_t} instance for
|
||||
* writing.
|
||||
* @throws Exception
|
||||
*/
|
||||
public static void writeEnums(String filename, EnumsHelper.EnumCollection_t prog) throws Exception {
|
||||
// open file and write
|
||||
OutputStreamWriter fs = CommonHelper.openOutputFile(filename);
|
||||
internalWriteEnums(fs, prog);
|
||||
fs.close();
|
||||
}
|
||||
|
||||
/**
|
||||
* Write a single enum declaration into given file.
|
||||
* <p>
|
||||
* Actually this is a wrapper of internal enum declaration collection writer.
|
||||
*
|
||||
* @param filename The name of written file.
|
||||
* @param _enum {@linkplain EnumsHelper.Enum_t} instance for writing.
|
||||
* @throws Exception
|
||||
*/
|
||||
public static void writeEnum(String filename, EnumsHelper.Enum_t _enum) throws Exception {
|
||||
// create collection from single enum
|
||||
EnumsHelper.EnumCollection_t col = new EnumsHelper.EnumCollection_t();
|
||||
col.mEnums.add(_enum);
|
||||
// open file and write
|
||||
OutputStreamWriter fs = CommonHelper.openOutputFile(filename);
|
||||
internalWriteEnums(fs, col);
|
||||
fs.close();
|
||||
}
|
||||
|
||||
// =========== Python Enum Accessible Value Writer ===========
|
||||
|
||||
/**
|
||||
* Try generate human readable name from enum entry name.
|
||||
* <p>
|
||||
* This function is only served for Python code generation.
|
||||
* <p>
|
||||
* As you noticed, almost entries of CK enums are fully capital and splitted by
|
||||
* underline. This is really not good for human reading, especially those who
|
||||
* are not programmer. So this function will try give these programmer-oriented
|
||||
* entry name a human readable name as its display name. However, this extract
|
||||
* method is not perfect. It simply do some split and replacement so the
|
||||
* generated content may still not good for reader.
|
||||
*
|
||||
* @param entry_name The name of enum entry
|
||||
* @return A human readable entry name. No guaranteen that return value is must
|
||||
* human readable.
|
||||
*/
|
||||
private static String extractHumanReadableEntryName(String entry_name) {
|
||||
// remove first part (any content before underline '_')
|
||||
entry_name = entry_name.replaceFirst("^[a-zA-Z0-9]+_", "");
|
||||
|
||||
// lower all chars except first char
|
||||
if (entry_name.length() < 1)
|
||||
return entry_name;
|
||||
else
|
||||
return entry_name.substring(0, 1) + entry_name.substring(1).toLowerCase(Locale.ROOT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Internal real enum accessible value writer.
|
||||
*
|
||||
* @param writer {@linkplain java.io.OutputStreamWriter} instance for writing.
|
||||
* @param prog {@linkplain EnumsHelper.EnumCollection_t} instance for writing.
|
||||
* @throws Exception
|
||||
*/
|
||||
private static void internalWriteAccVals(OutputStreamWriter writer, EnumsHelper.EnumCollection_t prog)
|
||||
throws Exception {
|
||||
IndentHelper indent = new IndentHelper(writer, CommonHelper.LangType.Python);
|
||||
|
||||
// write implements
|
||||
for (EnumsHelper.Enum_t enum_t : prog.mEnums) {
|
||||
// write enum desc header
|
||||
indent.printf("g_Annotation_%s: dict[int, EnumAnnotation] = {", enum_t.mEnumName);
|
||||
indent.inc();
|
||||
|
||||
// write enum desc entries
|
||||
for (EnumsHelper.EnumEntry_t enumEntry_t : enum_t.mEntries) {
|
||||
String comment = "";
|
||||
if (enumEntry_t.mEntryComment != null) {
|
||||
comment = CommonHelper.escapeString(enumEntry_t.mEntryComment);
|
||||
}
|
||||
|
||||
indent.printf("%s.%s.value: EnumAnnotation(\"%s\", \"%s\"),", enum_t.mEnumName, enumEntry_t.mEntryName,
|
||||
extractHumanReadableEntryName(enumEntry_t.mEntryName), comment);
|
||||
}
|
||||
|
||||
// write enum tail
|
||||
indent.dec();
|
||||
indent.puts("}");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Write an enum accessible value collection into given file.
|
||||
* <p>
|
||||
* Actually this is a wrapper of internal enum accessible value collection
|
||||
* writer.
|
||||
*
|
||||
* @param filename The name of written file.
|
||||
* @param prog {@linkplain EnumsHelper.EnumCollection_t} instance for
|
||||
* writing.
|
||||
* @throws Exception
|
||||
*/
|
||||
public static void writeAccVals(String filename, EnumsHelper.EnumCollection_t prog) throws Exception {
|
||||
// open file and write
|
||||
OutputStreamWriter fs = CommonHelper.openOutputFile(filename);
|
||||
internalWriteAccVals(fs, prog);
|
||||
fs.close();
|
||||
}
|
||||
|
||||
/**
|
||||
* Write a single enum accessible value into given file.
|
||||
* <p>
|
||||
* Actually this is a wrapper of internal enum accessible value collection
|
||||
* writer.
|
||||
*
|
||||
* @param filename The name of written file.
|
||||
* @param _enum {@linkplain EnumsHelper.Enum_t} instance for writing.
|
||||
* @throws Exception
|
||||
*/
|
||||
public static void writeAccVal(String filename, EnumsHelper.Enum_t _enum) throws Exception {
|
||||
// create a collection with single enum.
|
||||
EnumsHelper.EnumCollection_t col = new EnumsHelper.EnumCollection_t();
|
||||
col.mEnums.add(_enum);
|
||||
// open file and write
|
||||
OutputStreamWriter fs = CommonHelper.openOutputFile(filename);
|
||||
internalWriteAccVals(fs, col);
|
||||
fs.close();
|
||||
}
|
||||
|
||||
}
|
||||
16
Assets/CodeGen/EnumsMigration/README.md
Normal file
16
Assets/CodeGen/EnumsMigration/README.md
Normal file
@@ -0,0 +1,16 @@
|
||||
# Enums Migration
|
||||
|
||||
A helper program to migrate existing Virtools enum declarations into other formats.
|
||||
|
||||
Original Virtools SDK have various enum declarations. All of them are defined as C format and their formation are not uniform. This sub-project will use laxer and parser to recognize these diverse declarations, extract them as a series of uniform Java data struct and output them as C++ code (as C++ enum class syntax for LibCmo using), Python code (for PyBMap using), and C# code (for BMapSharp using).
|
||||
|
||||
The steps processing existing enum declaration is called migration as this sub-project name told.
|
||||
|
||||
```
|
||||
antlr4 CKGeneralLexer.g4
|
||||
antlr4 CKEnumsParser.g4
|
||||
antlr4 CKDefinesParser.g4
|
||||
|
||||
javac *.java
|
||||
java MainRunner
|
||||
```
|
||||
0
Assets/CodeGen/EnumsMigration/dest/.gitkeep
Normal file
0
Assets/CodeGen/EnumsMigration/dest/.gitkeep
Normal file
264
Assets/CodeGen/EnumsMigration/src/CKEnums.txt
Normal file
264
Assets/CodeGen/EnumsMigration/src/CKEnums.txt
Normal file
@@ -0,0 +1,264 @@
|
||||
/*************************************************
|
||||
{filename:CK_FILE_WRITEMODE}
|
||||
Summary: Specify the way files are saved to disk (compression)
|
||||
|
||||
Remarks :
|
||||
+ File write mode controls the format of a Virtools file when saved. More specifically it
|
||||
controls whether compression is enabled and also if the Virtools Dev Interface specific data
|
||||
should be stored in the file (if CKFILE_FORVIEWER flag is set , no interface data is saved)
|
||||
|
||||
See also: CKContext::SetFileWriteMode,CKContext::GetFileWriteMode,CKContext::SetCompressionLevel,CKContext::SetGlobalImagesSaveOptions,CKContext::SetGlobalSoundsSaveOptions
|
||||
*************************************************/
|
||||
typedef enum CK_FILE_WRITEMODE
|
||||
{
|
||||
CKFILE_UNCOMPRESSED =0, // Save data uncompressed
|
||||
CKFILE_CHUNKCOMPRESSED_OLD =1, // Obsolete
|
||||
CKFILE_EXTERNALTEXTURES_OLD=2, // Obsolete : use CKContext::SetGlobalImagesSaveOptions instead.
|
||||
CKFILE_FORVIEWER =4, // Don't save Interface Data within the file, the level won't be editable anymore in the interface
|
||||
CKFILE_WHOLECOMPRESSED =8, // Compress the whole file
|
||||
} CK_FILE_WRITEMODE;
|
||||
|
||||
/*************************************************
|
||||
{filename:CK_LOAD_FLAGS}
|
||||
Summary: Load Options.
|
||||
|
||||
Remarks:
|
||||
+ This options apply when loading a Virtools file
|
||||
or a importing a 3D Model file.
|
||||
+ They defines whether object geometry,only animations
|
||||
or only behaviors should be loaded.
|
||||
+ One can specify (using the CK_LOAD_AS_DYNAMIC_OBJECT) if
|
||||
created CKObjects should be created as dynamic (See also Dynamic Objects)
|
||||
See also : CKContext::Load,CKContext::CKSave
|
||||
*************************************************/
|
||||
typedef enum CK_LOAD_FLAGS {
|
||||
CK_LOAD_ANIMATION =1<<0, // Load animations
|
||||
CK_LOAD_GEOMETRY =1<<1, // Load geometry.
|
||||
CK_LOAD_DEFAULT =CK_LOAD_GEOMETRY|CK_LOAD_ANIMATION, // Load animations & geometry
|
||||
CK_LOAD_ASCHARACTER =1<<2, // Load all the objects and create a character that contains them all .
|
||||
CK_LOAD_DODIALOG =1<<3, // Check object name unicity and warns the user with a dialog box when duplicate names are found.
|
||||
CK_LOAD_AS_DYNAMIC_OBJECT =1<<4, // Objects loaded from this file may be deleted at run-time or are temporary
|
||||
CK_LOAD_AUTOMATICMODE =1<<5, // Check object name unicity and automatically rename or replace according to the options specified in CKContext::SetAutomaticLoadMode
|
||||
CK_LOAD_CHECKDUPLICATES =1<<6, // Check object name unicity (The list of duplicates is stored in the CKFile class after a OpenFile call
|
||||
CK_LOAD_CHECKDEPENDENCIES =1<<7, // Check if every plugins needed are availables
|
||||
CK_LOAD_ONLYBEHAVIORS =1<<8, //
|
||||
} CK_LOAD_FLAGS;
|
||||
|
||||
// Options that will be used to create this object...
|
||||
enum CK_FO_OPTIONS {
|
||||
CK_FO_DEFAULT = 0, // Default behavior : a new object will be created with the name stored in CKFileObject
|
||||
CK_FO_RENAMEOBJECT, // Renaming : a new object will be created with the name stored in CKFileObject + a integer value XXX to ensure its uniqueness
|
||||
CK_FO_REPLACEOBJECT, // Do not create a new object, instead use an existing one which CK_ID is given by CreatedObject
|
||||
// to load the chunk on
|
||||
CK_FO_DONTLOADOBJECT, // Object chunk will not be read either because it is a reference
|
||||
// or because the loaded object already exist in the current level
|
||||
// and the user choose to keep the existing one.
|
||||
};
|
||||
|
||||
/*************************************************
|
||||
{filename:CK_LOADMODE}
|
||||
Summary: Specify the way an object just loaded should be handled when it already exists in the level.
|
||||
{secret}
|
||||
|
||||
See also:
|
||||
*************************************************/
|
||||
typedef enum CK_LOADMODE
|
||||
{
|
||||
CKLOAD_INVALID=-1,// Use the existing object instead of loading
|
||||
CKLOAD_OK=0, // Ignore ( Name unicity is broken )
|
||||
CKLOAD_REPLACE=1, // Replace the existing object (Not yet implemented)
|
||||
CKLOAD_RENAME=2, // Rename the loaded object
|
||||
CKLOAD_USECURRENT=3,// Use the existing object instead of loading
|
||||
} CK_LOADMODE;
|
||||
|
||||
/*************************************************
|
||||
{filename:CK_OBJECTCREATION_OPTIONS}
|
||||
Summary: Specify the way an object is created through CKCreateObject.
|
||||
|
||||
Remarks:
|
||||
+ These flag controls the way an object is created, the most important of these flags
|
||||
being CK_OBJECTCREATION_DYNAMIC which, if set in CKCreateObject, make the newly created object
|
||||
dynamic.
|
||||
See also: CKContext::CreateObject,Dynamic Objects
|
||||
*************************************************/
|
||||
enum CK_OBJECTCREATION_OPTIONS
|
||||
{
|
||||
CK_OBJECTCREATION_NONAMECHECK = 0, // Do not test for name unicity (may be overriden in special case)
|
||||
CK_OBJECTCREATION_REPLACE = 1, // Replace the current object by the object being loaded
|
||||
CK_OBJECTCREATION_RENAME = 2, // Rename the created object to ensure its uniqueness
|
||||
CK_OBJECTCREATION_USECURRENT = 3, // Do not create a new object, use the one with the same name instead
|
||||
CK_OBJECTCREATION_ASK = 4, // If a duplicate name if found, opens a dialog box to ask the useror use automatic load mode if any.
|
||||
CK_OBJECTCREATION_FLAGSMASK = 0x0000000F, // Mask for previous values
|
||||
CK_OBJECTCREATION_DYNAMIC = 0x00000010, // The object must be created dynamic
|
||||
CK_OBJECTCREATION_ACTIVATE = 0x00000020, // The object will be copied/created active
|
||||
CK_OBJECTCREATION_NONAMECOPY = 0x00000040 // The object will take control of the string given to it directly, without copying it
|
||||
};
|
||||
|
||||
/*************************************************
|
||||
{filename:CK_PLUGIN_TYPE}
|
||||
Summary: Type identifier for a Virtools plugin.
|
||||
Remarks:
|
||||
+ Each plugin must be given a type.
|
||||
+ This enumeration is used to identify a specific catagory
|
||||
of plugin when using the CKPluginManager.
|
||||
|
||||
See also: CKPluginManager,Creating New Plugins
|
||||
*************************************************/
|
||||
typedef enum CK_PLUGIN_TYPE {
|
||||
CKPLUGIN_BITMAP_READER = 0, // The plugin is bitmap (textures,sprites) loader
|
||||
CKPLUGIN_SOUND_READER = 1, // Sound Reader Plugin
|
||||
CKPLUGIN_MODEL_READER = 2, // 3D Model Reader
|
||||
CKPLUGIN_MANAGER_DLL = 3, // The plugin implements a Manager
|
||||
CKPLUGIN_BEHAVIOR_DLL = 4, // The plugin implements one or more behaviors
|
||||
CKPLUGIN_RENDERENGINE_DLL = 5, // Render Engine plugin
|
||||
CKPLUGIN_MOVIE_READER = 6, // Movie (AVI,Mpeg) reader
|
||||
CKPLUGIN_EXTENSION_DLL = 7, // Generic extension (definition of new parameter types or operations for ex.)
|
||||
} CK_PLUGIN_TYPE;
|
||||
|
||||
/***************************************************
|
||||
CHUNK_OPTIONS in Virtools header.
|
||||
*************************************************/
|
||||
enum CK_STATECHUNK_CHUNKOPTIONS {
|
||||
CHNK_OPTION_IDS = 0x01, // IDS are stored inside chunk
|
||||
CHNK_OPTION_MAN = 0x02, // Managers ints are store inside chunk
|
||||
CHNK_OPTION_CHN = 0x04, // Sub chunk are stored inside chunk
|
||||
CHNK_OPTION_FILE = 0x08, // Chunk was written with indices relative to a file....
|
||||
CHNK_OPTION_ALLOWDYN = 0x10, // Dynamic object can be written in the chunk
|
||||
CHNK_OPTION_LISTBIG = 0x20, // List are store in big Endian ?
|
||||
CHNK_DONTDELETE_PTR = 0x40, // Data buffer stored in m_Buffer is not owned by CKStateChunk , it must not be deleted...
|
||||
CHNK_DONTDELETE_PARSER = 0x80, // m_Parser Ptr is not owned by CKStateChunk , it must not be deleted...
|
||||
};
|
||||
|
||||
typedef enum CK_OBJECT_SHOWOPTION {
|
||||
CKHIDE =0,
|
||||
CKSHOW =1,
|
||||
CKHIERARCHICALHIDE =2
|
||||
} CK_OBJECT_SHOWOPTION;
|
||||
|
||||
/***************************************************
|
||||
{filename:CK_OBJECT_FLAGS}
|
||||
Summary: CKObject Flags
|
||||
|
||||
Remarks:
|
||||
+ Flags specifying special settings for basic objects.
|
||||
+ Some of this flags are shared with sub-classes such as CKParameterIn,CKParameterOut and CKBehaviorIO.
|
||||
+ You rarely need to modify directly this flags through CKObject::SetFlags or CKObject::ModifyObjectFlags instead
|
||||
you should always use the specific acces function (given between ()) which may need to perform additionnal operations.
|
||||
See also: CKObject,CKObject::GetObjectFlags,CKObject::ModifyObjectFlags
|
||||
*************************************************/
|
||||
typedef enum CK_OBJECT_FLAGS {
|
||||
CK_OBJECT_INTERFACEOBJ = 0x00000001, // Reserved for Inteface Use
|
||||
CK_OBJECT_PRIVATE = 0x00000002, // The object must not be displayed in interface (Lists,Level view,etc...),nor should it be saved. (CKObject::IsPrivate()
|
||||
CK_OBJECT_INTERFACEMARK = 0x00000004,
|
||||
CK_OBJECT_FREEID = 0x00000008, // ID of this object can be released safely and is free to be reused by future CKobjects.
|
||||
CK_OBJECT_TOBEDELETED = 0x00000010, // This object is being deleted
|
||||
CK_OBJECT_NOTTOBESAVED = 0x00000020, // This object must not be saved
|
||||
CK_OBJECT_VISIBLE = 0x00000040, // This object is visible (CKObject::Show)
|
||||
CK_OBJECT_NAMESHARED = 0x00000080, // This object has its name from another entity
|
||||
CK_OBJECT_DYNAMIC = 0x00000108, // This object may be created or deleted at run-time, it also contails CK_OBJECT_FREEID. (CKObject::IsDynamic,CKContext::CreateObject)
|
||||
CK_OBJECT_HIERACHICALHIDE = 0x00000200, // This object hides all its hierarchy (CKObject::Show)
|
||||
CK_OBJECT_UPTODATE = 0x00000400, // (Camera,etc..)
|
||||
CK_OBJECT_TEMPMARKER = 0x00000800,
|
||||
CK_OBJECT_ONLYFORFILEREFERENCE = 0x00001000,
|
||||
CK_OBJECT_NOTTOBEDELETED = 0x00002000, // This object must not be deleted in a clear all
|
||||
CK_OBJECT_APPDATA = 0x00004000, // This object has app data
|
||||
CK_OBJECT_SINGLEACTIVITY = 0x00008000, // this object has an information of single activity
|
||||
CK_OBJECT_LOADSKIPBEOBJECT = 0x00010000, // When loading this object the CKBeObject part should be skipped
|
||||
|
||||
CK_OBJECT_NOTTOBELISTEDANDSAVED = 0x00000023, // Combination of Private and Not To Be Saved
|
||||
|
||||
|
||||
// The following flags are specific to parameters (they are stored here for object's size purposes )
|
||||
CK_PARAMETEROUT_SETTINGS = 0x00400000,
|
||||
CK_PARAMETEROUT_PARAMOP = 0x00800000, // This parameter is the output of a CKParameterOperation (Automatically set by Engine)
|
||||
CK_PARAMETERIN_DISABLED = 0x01000000, // Parameter In or Out is disabled (CKBehavior::EnableInputParameter,CKBehavior::DisableInputParameter)
|
||||
CK_PARAMETERIN_THIS = 0x02000000, // Special parameter type : its value and type are always equal to its owner (CKParameter::SetAsMyselfParameter)
|
||||
CK_PARAMETERIN_SHARED = 0x04000000,
|
||||
CK_PARAMETEROUT_DELETEAFTERUSE = 0x08000000, // When adding parameters to CKMessage, they can be automatically deleted when message is released (CKMessage::AddParameter)
|
||||
CK_OBJECT_PARAMMASK = 0x0FC00000, // Mask for options specific to parameters
|
||||
|
||||
// The Following flags are specific for Behavior ios (CKBehaviorIO)
|
||||
CK_BEHAVIORIO_IN = 0x10000000, // This BehaviorIO is a behavior input (CKBehaviorIO::SetType}
|
||||
CK_BEHAVIORIO_OUT = 0x20000000, // This BehaviorIO is a behavior output (CKBehaviorIO::SetType)
|
||||
CK_BEHAVIORIO_ACTIVE = 0x40000000, // This BehaviorIO is a currently active (CKBehaviorIO::Activate}
|
||||
CK_OBJECT_IOTYPEMASK = 0x30000000,
|
||||
CK_OBJECT_IOMASK = 0xF0000000,
|
||||
|
||||
// The Following flags are specific for Behavior ios (CKBehaviorIO)
|
||||
CKBEHAVIORLINK_RESERVED = 0x10000000, // This BehaviorIO is a behavior input (CKBehaviorIO::SetType}
|
||||
CKBEHAVIORLINK_ACTIVATEDLASTFRAME = 0x20000000, // This link had been activated last frame
|
||||
CK_OBJECT_BEHAVIORLINKMASK = 0x30000000,
|
||||
} CK_OBJECT_FLAGS;
|
||||
|
||||
|
||||
/*************************************************
|
||||
{filename:CK_3DENTITY_FLAGS}
|
||||
Summary: 3dEntity Flags
|
||||
Remarks:
|
||||
+ Flags give user and engine more information about the 3dEntity.
|
||||
|
||||
See also: CK3dEntity::SetFlags,CK3dEntity::GetFlags,
|
||||
*************************************************/
|
||||
typedef enum CK_3DENTITY_FLAGS {
|
||||
CK_3DENTITY_DUMMY = 0x00000001, // Entity is a dummy used to represent a position
|
||||
CK_3DENTITY_FRAME = 0x00000002, // Entity is a frame used to represent an orientation
|
||||
CK_3DENTITY_RESERVED0 = 0x00000020, // Obsolete Flag
|
||||
CK_3DENTITY_TARGETLIGHT = 0x00000100, // Entity is a target of a light
|
||||
CK_3DENTITY_TARGETCAMERA = 0x00000200, // Entity is a target of a camera
|
||||
CK_3DENTITY_IGNOREANIMATION = 0x00000400, // Animation using this entity can't modify it
|
||||
CK_3DENTITY_HIERARCHICALOBSTACLE= 0x00000800, // Used by the Collision Manager
|
||||
CK_3DENTITY_UPDATELASTFRAME = 0x00001000, // Store the last world matrix for this Entity after each render
|
||||
CK_3DENTITY_CAMERAIGNOREASPECT = 0x00002000, // Ignore aspect ratio setting for cameras
|
||||
CK_3DENTITY_DISABLESKINPROCESS = 0x00004000, // Force skin processing to be disabled
|
||||
CK_3DENTITY_ENABLESKINOFFSET = 0x00008000, // If not set the skin stay attached to the bones the vertices are linked to, otherwise the skin can be freely rotated,translated or scaled according to its owner entity matrix.
|
||||
CK_3DENTITY_PLACEVALID = 0x00010000, // Used internally when saving
|
||||
CK_3DENTITY_PARENTVALID = 0x00020000, // Used internally when saving
|
||||
CK_3DENTITY_IKJOINTVALID = 0x00040000, // Special flag for Bodyparts : IK Joint data is valid
|
||||
CK_3DENTITY_PORTAL = 0x00080000, // The 3dEntity is a portal
|
||||
CK_3DENTITY_ZORDERVALID = 0x00100000, // The 3dEntity has a non-zero ZOrder
|
||||
CK_3DENTITY_CHARACTERDOPROCESS = 0x80000000, // Special flag for Characters : Automatic process of animation
|
||||
} CK_3DENTITY_FLAGS;
|
||||
|
||||
|
||||
/*************************************************
|
||||
{filename:CK_TEXTURE_SAVEOPTIONS}
|
||||
Summary: Specify the way textures or sprites will be saved
|
||||
|
||||
Remarks :
|
||||
+ Textures can be stored inside Virtools files or kept as references to external files.
|
||||
+ These options can be used for a specific texture (or sprite) or as a global setting.
|
||||
See also: CKBitmapData::SetSaveOptions,CKSprite::SetSaveOptions,CKContext::SetGlobalImagesSaveOptions
|
||||
*************************************************/
|
||||
typedef enum CK_TEXTURE_SAVEOPTIONS
|
||||
{
|
||||
CKTEXTURE_RAWDATA =0, // Save raw data inside file. The bitmap is saved in a raw 32 bit per pixel format.
|
||||
CKTEXTURE_EXTERNAL =1, // Store only the file name for the texture. The bitmap file must be present in the bitmap paths
|
||||
// when loading the composition.
|
||||
CKTEXTURE_IMAGEFORMAT =2, // Save using format specified. The bitmap data will be converted to the
|
||||
// specified format by the correspondant bitmap plugin and saved inside file.
|
||||
CKTEXTURE_USEGLOBAL =3, // Use Global settings, that is the settings given with CKContext::SetGlobalImagesSaveOptions. (Not valid when using CKContext::SetImagesSaveOptions).
|
||||
CKTEXTURE_INCLUDEORIGINALFILE =4, // Insert original image file inside CMO file. The bitmap file that
|
||||
// was used originally for the texture or sprite will be append to
|
||||
// the composition file and extracted when the file is loaded.
|
||||
} CK_TEXTURE_SAVEOPTIONS;
|
||||
|
||||
|
||||
/*************************************************
|
||||
{filename:CK_SOUND_SAVEOPTIONS}
|
||||
Summary: Specify the way sounds will be saved
|
||||
|
||||
Remarks :
|
||||
+ Sounds can kept as references to external files or the original sound file can
|
||||
be appended to the composition file.
|
||||
+ These options can be used for a specific sound or as a global setting.
|
||||
See also: CKSound::SetSaveOptions,CKContext::SetGlobalSoundSaveOptions
|
||||
*************************************************/
|
||||
typedef enum CK_SOUND_SAVEOPTIONS
|
||||
{
|
||||
CKSOUND_EXTERNAL =0, // Store only the file name for the sound. The sound file must be present
|
||||
// in one of the sound paths when the composition is loaded.
|
||||
CKSOUND_INCLUDEORIGINALFILE =1, // Insert original sound file inside the CMO file. The sound file that
|
||||
// was used originally will be append to the composition file and
|
||||
// extracted when the file is loaded.
|
||||
CKSOUND_USEGLOBAL =2, // Use Global settings. This flag is only valid for the CKSound::SetSaveOptions method.
|
||||
} CK_SOUND_SAVEOPTIONS;
|
||||
205
Assets/CodeGen/EnumsMigration/src/CKError.txt
Normal file
205
Assets/CodeGen/EnumsMigration/src/CKError.txt
Normal file
@@ -0,0 +1,205 @@
|
||||
// Operation successful
|
||||
|
||||
#define CKERR_OK 0
|
||||
|
||||
// One of the parameter passed to the function was invalid
|
||||
|
||||
#define CKERR_INVALIDPARAMETER -1
|
||||
|
||||
// One of the parameter passed to the function was invalid
|
||||
|
||||
#define CKERR_INVALIDPARAMETERTYPE -2
|
||||
|
||||
// The parameter size was invalid
|
||||
|
||||
#define CKERR_INVALIDSIZE -3
|
||||
|
||||
// The operation type didn't exist
|
||||
|
||||
#define CKERR_INVALIDOPERATION -4
|
||||
|
||||
// The function used to execute the operation is not yet implemented
|
||||
|
||||
#define CKERR_OPERATIONNOTIMPLEMENTED -5
|
||||
|
||||
// There was not enough memory to perform the action
|
||||
|
||||
#define CKERR_OUTOFMEMORY -6
|
||||
|
||||
// The function is not yet implemented
|
||||
|
||||
#define CKERR_NOTIMPLEMENTED -7
|
||||
|
||||
// There was an attempt to remove something not present
|
||||
|
||||
#define CKERR_NOTFOUND -11
|
||||
|
||||
// There is no level currently created
|
||||
|
||||
#define CKERR_NOLEVEL -13
|
||||
|
||||
//
|
||||
|
||||
#define CKERR_CANCREATERENDERCONTEXT -14
|
||||
|
||||
// The notification message was not used
|
||||
|
||||
#define CKERR_NOTIFICATIONNOTHANDLED -16
|
||||
|
||||
// Attempt to add an item that was already present
|
||||
|
||||
#define CKERR_ALREADYPRESENT -17
|
||||
|
||||
// the render context is not valid
|
||||
|
||||
#define CKERR_INVALIDRENDERCONTEXT -18
|
||||
|
||||
// the render context is not activated for rendering
|
||||
|
||||
#define CKERR_RENDERCONTEXTINACTIVE -19
|
||||
|
||||
// there was no plugins to load this kind of file
|
||||
|
||||
#define CKERR_NOLOADPLUGINS -20
|
||||
|
||||
// there was no plugins to save this kind of file
|
||||
|
||||
#define CKERR_NOSAVEPLUGINS -21
|
||||
|
||||
// attempt to load an invalid file
|
||||
|
||||
#define CKERR_INVALIDFILE -22
|
||||
|
||||
// attempt to load with an invalid plugin
|
||||
|
||||
#define CKERR_INVALIDPLUGIN -23
|
||||
|
||||
// attempt use an object that wasnt initialized
|
||||
|
||||
#define CKERR_NOTINITIALIZED -24
|
||||
|
||||
// attempt use a message type that wasn't registred
|
||||
|
||||
#define CKERR_INVALIDMESSAGE -25
|
||||
|
||||
// attempt use an invalid prototype
|
||||
|
||||
#define CKERR_INVALIDPROTOTYPE -28
|
||||
|
||||
// No dll file found in the parse directory
|
||||
|
||||
#define CKERR_NODLLFOUND -29
|
||||
|
||||
// this dll has already been registred
|
||||
|
||||
#define CKERR_ALREADYREGISTREDDLL -30
|
||||
|
||||
// this dll does not contain information to create the prototype
|
||||
|
||||
#define CKERR_INVALIDDLL -31
|
||||
|
||||
// Invalid Object (attempt to Get an object from an invalid ID)
|
||||
|
||||
#define CKERR_INVALIDOBJECT -34
|
||||
|
||||
// Invalid window was provided as console window
|
||||
|
||||
#define CKERR_INVALIDCONDSOLEWINDOW -35
|
||||
|
||||
// Invalid kinematic chain ( end and start effector may not be part of the same hierarchy )
|
||||
|
||||
#define CKERR_INVALIDKINEMATICCHAIN -36
|
||||
|
||||
|
||||
// Keyboard not attached or not working properly
|
||||
|
||||
#define CKERR_NOKEYBOARD -37
|
||||
|
||||
// Mouse not attached or not working properly
|
||||
|
||||
#define CKERR_NOMOUSE -38
|
||||
|
||||
// Joystick not attached or not working properly
|
||||
|
||||
#define CKERR_NOJOYSTICK -39
|
||||
|
||||
// Try to link imcompatible Parameters
|
||||
|
||||
#define CKERR_INCOMPATIBLEPARAMETERS -40
|
||||
|
||||
// There is no render engine dll
|
||||
|
||||
#define CKERR_NORENDERENGINE -44
|
||||
|
||||
// There is no current level (use CKSetCurrentLevel )
|
||||
|
||||
#define CKERR_NOCURRENTLEVEL -45
|
||||
|
||||
// Sound Management has been disabled
|
||||
|
||||
#define CKERR_SOUNDDISABLED -46
|
||||
|
||||
// DirectInput Management has been disabled
|
||||
|
||||
#define CKERR_DINPUTDISABLED -47
|
||||
|
||||
// Guid is already in use or invalid
|
||||
|
||||
#define CKERR_INVALIDGUID -48
|
||||
|
||||
// There was no more free space on disk when trying to save a file
|
||||
|
||||
#define CKERR_NOTENOUGHDISKPLACE -49
|
||||
|
||||
// Impossible to write to file (write-protection ?)
|
||||
|
||||
#define CKERR_CANTWRITETOFILE -50
|
||||
|
||||
// The behavior cannnot be added to this entity
|
||||
|
||||
#define CKERR_BEHAVIORADDDENIEDBYCB -51
|
||||
|
||||
// The behavior cannnot be added to this entity
|
||||
|
||||
#define CKERR_INCOMPATIBLECLASSID -52
|
||||
|
||||
// A manager was registered more than once
|
||||
|
||||
#define CKERR_MANAGERALREADYEXISTS -53
|
||||
|
||||
// CKprocess or TimeManager process while CK is paused will fail
|
||||
|
||||
#define CKERR_PAUSED -54
|
||||
|
||||
// Some plugins were missing whileloading a file
|
||||
|
||||
#define CKERR_PLUGINSMISSING -55
|
||||
|
||||
// Virtools version too old to load this file
|
||||
|
||||
#define CKERR_OBSOLETEVIRTOOLS -56
|
||||
|
||||
// CRC Error while loading file
|
||||
|
||||
#define CKERR_FILECRCERROR -57
|
||||
|
||||
// A Render context is already in Fullscreen Mode
|
||||
|
||||
#define CKERR_ALREADYFULLSCREEN -58
|
||||
|
||||
// Operation was cancelled by user
|
||||
|
||||
#define CKERR_CANCELLED -59
|
||||
|
||||
|
||||
// there were no animation key at the given index
|
||||
|
||||
#define CKERR_NOANIMATIONKEY -121
|
||||
|
||||
// attemp to acces an animation key with an invalid index
|
||||
|
||||
#define CKERR_INVALIDINDEX -122
|
||||
|
||||
// the animation is invalid (no entity associated or zero length)
|
||||
|
||||
#define CKERR_INVALIDANIMATION -123
|
||||
14
Assets/CodeGen/EnumsMigration/src/CK_BITMAPDATA_FLAGS.txt
Normal file
14
Assets/CodeGen/EnumsMigration/src/CK_BITMAPDATA_FLAGS.txt
Normal file
@@ -0,0 +1,14 @@
|
||||
|
||||
#define CKBITMAPDATA_INVALID 1
|
||||
|
||||
#define CKBITMAPDATA_TRANSPARENT 2
|
||||
|
||||
#define CKBITMAPDATA_FORCERESTORE 4
|
||||
|
||||
#define CKBITMAPDATA_CLAMPUPTODATE 8
|
||||
|
||||
#define CKBITMAPDATA_CUBEMAP 16
|
||||
|
||||
#define CKBITMAPDATA_FREEVIDEOMEMORY 32
|
||||
|
||||
#define CKBITMAPDATA_DYNAMIC 64
|
||||
@@ -0,0 +1,4 @@
|
||||
|
||||
#define CK_PERSPECTIVEPROJECTION 1
|
||||
|
||||
#define CK_ORTHOGRAPHICPROJECTION 2
|
||||
69
Assets/CodeGen/EnumsMigration/src/CK_CLASSID.txt
Normal file
69
Assets/CodeGen/EnumsMigration/src/CK_CLASSID.txt
Normal file
@@ -0,0 +1,69 @@
|
||||
#define CKCID_OBJECT 1
|
||||
#define CKCID_PARAMETERIN 2
|
||||
#define CKCID_PARAMETEROPERATION 4
|
||||
#define CKCID_STATE 5
|
||||
#define CKCID_BEHAVIORLINK 6
|
||||
#define CKCID_BEHAVIOR 8
|
||||
#define CKCID_BEHAVIORIO 9
|
||||
#define CKCID_RENDERCONTEXT 12
|
||||
#define CKCID_KINEMATICCHAIN 13
|
||||
#define CKCID_SCENEOBJECT 11
|
||||
#define CKCID_OBJECTANIMATION 15
|
||||
#define CKCID_ANIMATION 16
|
||||
#define CKCID_KEYEDANIMATION 18
|
||||
#define CKCID_BEOBJECT 19
|
||||
#define CKCID_DATAARRAY 52
|
||||
#define CKCID_SCENE 10
|
||||
#define CKCID_LEVEL 21
|
||||
#define CKCID_PLACE 22
|
||||
#define CKCID_GROUP 23
|
||||
#define CKCID_SOUND 24
|
||||
#define CKCID_WAVESOUND 25
|
||||
#define CKCID_MIDISOUND 26
|
||||
#define CKCID_MATERIAL 30
|
||||
#define CKCID_TEXTURE 31
|
||||
#define CKCID_MESH 32
|
||||
#define CKCID_PATCHMESH 53
|
||||
#define CKCID_RENDEROBJECT 47
|
||||
#define CKCID_2DENTITY 27
|
||||
#define CKCID_SPRITE 28
|
||||
#define CKCID_SPRITETEXT 29
|
||||
#define CKCID_3DENTITY 33
|
||||
#define CKCID_GRID 50
|
||||
#define CKCID_CURVEPOINT 36
|
||||
#define CKCID_SPRITE3D 37
|
||||
#define CKCID_CURVE 43
|
||||
#define CKCID_CAMERA 34
|
||||
#define CKCID_TARGETCAMERA 35
|
||||
#define CKCID_LIGHT 38
|
||||
#define CKCID_TARGETLIGHT 39
|
||||
#define CKCID_CHARACTER 40
|
||||
#define CKCID_3DOBJECT 41
|
||||
#define CKCID_BODYPART 42
|
||||
#define CKCID_PARAMETER 46
|
||||
#define CKCID_PARAMETERLOCAL 45
|
||||
#define CKCID_PARAMETEROUT 3
|
||||
#define CKCID_INTERFACEOBJECTMANAGER 48
|
||||
#define CKCID_CRITICALSECTION 49
|
||||
#define CKCID_LAYER 51
|
||||
#define CKCID_PROGRESSIVEMESH 54
|
||||
#define CKCID_SYNCHRO 20
|
||||
|
||||
#define CKCID_OBJECTARRAY 80
|
||||
#define CKCID_SCENEOBJECTDESC 81
|
||||
#define CKCID_ATTRIBUTEMANAGER 82
|
||||
#define CKCID_MESSAGEMANAGER 83
|
||||
#define CKCID_COLLISIONMANAGER 84
|
||||
#define CKCID_OBJECTMANAGER 85
|
||||
#define CKCID_FLOORMANAGER 86
|
||||
#define CKCID_RENDERMANAGER 87
|
||||
#define CKCID_BEHAVIORMANAGER 88
|
||||
#define CKCID_INPUTMANAGER 89
|
||||
#define CKCID_PARAMETERMANAGER 90
|
||||
#define CKCID_GRIDMANAGER 91
|
||||
#define CKCID_SOUNDMANAGER 92
|
||||
#define CKCID_TIMEMANAGER 93
|
||||
#define CKCID_CUIKBEHDATA -1
|
||||
|
||||
#define CKCID_MAXCLASSID 55
|
||||
#define CKCID_MAXMAXCLASSID 128
|
||||
@@ -0,0 +1,6 @@
|
||||
|
||||
#define CHUNK_VERSIONBASE 0
|
||||
#define CHUNK_VERSION1 4 // equal to file version : WriteObjectID => table
|
||||
#define CHUNK_VERSION2 5 // add Manager Data
|
||||
#define CHUNK_VERSION3 6 // New ConvertToBuffer / ReadFromBuffer (file system changed to reflect this )
|
||||
#define CHUNK_VERSION4 7 // New WriteObjectID when saving to a file
|
||||
@@ -0,0 +1,14 @@
|
||||
|
||||
#define CHUNKDATA_OLDVERSION 0 // Before any version was saved
|
||||
#define CHUNKDATA_BASEVERSION 1 // First version
|
||||
#define CHUNK_WAVESOUND_VERSION2 2 // Changes in wavesound format
|
||||
#define CHUNK_WAVESOUND_VERSION3 3 // Changes in wavesound format
|
||||
#define CHUNK_MATERIAL_VERSION_ZTEST 4 // Change in material save format
|
||||
#define CHUNK_MAJORCHANGE_VERSION 5 // Optimisations on many save functions
|
||||
#define CHUNK_MACCHANGE_VERSION 6 // Misc new Statechunk functions for macintosh (Big-Endian <-> Little Endian conversion )
|
||||
#define CHUNK_WAVESOUND_VERSION4 7 // Changes in wavesound format (Added sound length)
|
||||
#define CHUNK_SCENECHANGE_VERSION 8 // Changes in sceneObjectDesc format (Remove lasttimevalue)
|
||||
#define CHUNK_MESHCHANGE_VERSION 9 // Changes in Mesh save format (primitives)
|
||||
#define CHUNK_DEV_2_1 10 // Changes in wavesound reading of inside, outside angles
|
||||
|
||||
#define CHUNKDATA_CURRENTVERSION CHUNK_DEV_2_1
|
||||
722
Assets/CodeGen/EnumsMigration/src/Defines2.txt
Normal file
722
Assets/CodeGen/EnumsMigration/src/Defines2.txt
Normal file
@@ -0,0 +1,722 @@
|
||||
|
||||
//------------------------------------------------
|
||||
// Object
|
||||
typedef enum CK_STATESAVEFLAGS_OBJECT {
|
||||
CK_STATESAVE_NAME = 0x00000001, // Obsolete
|
||||
CK_STATESAVE_ID = 0x00000002, // Obsolete
|
||||
CK_STATESAVE_OBJECTHIDDEN = 0x00000004, // The object is hidden
|
||||
CK_STATESAVE_OBJECTHIERAHIDDEN = 0x00000018, // The object is hidden hierarchically
|
||||
CK_STATESAVE_OBJECTALL = 0x0000000F
|
||||
} CK_STATESAVEFLAGS_OBJECT;
|
||||
|
||||
|
||||
//------------------------------------------------
|
||||
// Be Object
|
||||
typedef enum CK_STATESAVEFLAGS_BEOBJECT
|
||||
{
|
||||
CK_STATESAVE_ATTRIBUTES = 0x00000010, // Obsolete
|
||||
CK_STATESAVE_NEWATTRIBUTES = 0x00000011, // Save Attributes
|
||||
CK_STATESAVE_GROUPS = 0x00000020, // Obsolete
|
||||
CK_STATESAVE_DATAS = 0x00000040, // Save Flags and (Waiting for message) status
|
||||
CK_STATESAVE_SOUNDS = 0x00000080, // Obsolete
|
||||
CK_STATESAVE_BEHAVIORS = 0x00000100, // Obsolete
|
||||
CK_STATESAVE_PARAMETERS = 0x00000200, // Obsolete
|
||||
CK_STATESAVE_SINGLEACTIVITY = 0x00000400, // SINGLE ACTIVITY
|
||||
CK_STATESAVE_SCRIPTS = 0x00000800, // Obsolete
|
||||
CK_STATESAVE_BEOBJECTONLY = 0x00000FF0, // Save only BeObject specific datas
|
||||
CK_STATESAVE_BEOBJECTALL = 0x00000FFF // Save All datas
|
||||
} CK_STATESAVEFLAGS_BEOBJECT;
|
||||
|
||||
|
||||
//------------------------------------------------
|
||||
// 3dEntity
|
||||
typedef enum CK_STATESAVEFLAGS_3DENTITY
|
||||
{
|
||||
CK_STATESAVE_3DENTITYSKINDATANORMALS = 0x00001000, // Save Skin normals
|
||||
CK_STATESAVE_ANIMATION = 0x00002000, // Obsolete
|
||||
CK_STATESAVE_MESHS = 0x00004000, // Save List of mesh
|
||||
CK_STATESAVE_PARENT = 0x00008000, // Save Parent
|
||||
CK_STATESAVE_3DENTITYFLAGS = 0x00010000, // Save Flags
|
||||
CK_STATESAVE_3DENTITYMATRIX = 0x00020000, // Save Position/orientation/Scale
|
||||
CK_STATESAVE_3DENTITYHIERARCHY = 0x00040000, // obsolete
|
||||
CK_STATESAVE_3DENTITYPLACE = 0x00080000, // Save Place in which the Entity is referenced
|
||||
CK_STATESAVE_3DENTITYNDATA = 0x00100000, // Reserved for future use
|
||||
CK_STATESAVE_3DENTITYSKINDATA = 0x00200000, // Save Skin data
|
||||
CK_STATESAVE_3DENTITYONLY = 0x003FF000, // Save only 3dEntity specific datas
|
||||
CK_STATESAVE_3DENTITYALL = 0x003FFFFF // Save All datas for sub-classes
|
||||
} CK_STATESAVEFLAGS_3DENTITY;
|
||||
|
||||
//------------------------------------------------
|
||||
// Light
|
||||
typedef enum CK_STATESAVEFLAGS_LIGHT
|
||||
{
|
||||
CK_STATESAVE_LIGHTDATA = 0x00400000, // Save Color,Type,Attenuation,Range and cone
|
||||
CK_STATESAVE_LIGHTDATA2 = 0x00800000, // Reserved for future use
|
||||
CK_STATESAVE_LIGHTRESERVED1 = 0x01000000, // Reserved for future use
|
||||
CK_STATESAVE_LIGHTRESERVED2 = 0x02000000, // Reserved for future use
|
||||
CK_STATESAVE_LIGHTRESERVED3 = 0x04000000, // Reserved for future use
|
||||
CK_STATESAVE_LIGHTRESERVED4 = 0x08000000, // Reserved for future use
|
||||
CK_STATESAVE_LIGHTONLY = 0x0FC00000, // Save only Light specific datas
|
||||
CK_STATESAVE_LIGHTALL = 0x0FFFFFFF, // Save All datas for sub-classes
|
||||
// Target Light
|
||||
CK_STATESAVE_TLIGHTTARGET = 0x80000000, // Save Light Target
|
||||
CK_STATESAVE_TLIGHTRESERVED0 = 0x10000000, // Reserved for future use
|
||||
CK_STATESAVE_TLIGHTRESERVED1 = 0x20000000, // Reserved for future use
|
||||
CK_STATESAVE_TLIGHTRESERVED2 = 0x40000000, // Reserved for future use
|
||||
CK_STATESAVE_TLIGHTONLY = 0xF0000000, // Save only Target Light specific datas
|
||||
CK_STATESAVE_TLIGHTALL = 0xFFFFFFFF // Save All datas for sub-classes
|
||||
} CK_STATESAVEFLAGS_LIGHT;
|
||||
|
||||
//--------------------------------------------------
|
||||
// Camera
|
||||
typedef enum CK_STATESAVEFLAGS_CAMERA
|
||||
{
|
||||
CK_STATESAVE_CAMERAFOV = 0x00400000, // Save Camera Field of View
|
||||
CK_STATESAVE_CAMERAPROJTYPE = 0x00800000, // Save Camera projection type
|
||||
CK_STATESAVE_CAMERAOTHOZOOM = 0x01000000, // Save Camera orhographic zoom
|
||||
CK_STATESAVE_CAMERAASPECT = 0x02000000, // Save Camera aspect ration
|
||||
CK_STATESAVE_CAMERAPLANES = 0x04000000, // Save Camera near and far clip planes
|
||||
CK_STATESAVE_CAMERARESERVED2 = 0x08000000, // Reserved for future use
|
||||
CK_STATESAVE_CAMERAONLY = 0x0FC00000, // Save only camera specific datas
|
||||
CK_STATESAVE_CAMERAALL = 0x0FFFFFFF, // Save All datas for sub-classes
|
||||
// Target Camera
|
||||
CK_STATESAVE_TCAMERATARGET = 0x10000000, // Save camera Target
|
||||
CK_STATESAVE_TCAMERARESERVED1 = 0x20000000, // Reserved for future use
|
||||
CK_STATESAVE_TCAMERARESERVED2 = 0x40000000, // Reserved for future use
|
||||
CK_STATESAVE_TCAMERAONLY = 0x70000000, // Save only Target camera specific datas
|
||||
CK_STATESAVE_TCAMERAALL = 0x7FFFFFFF // Save All datas for sub-classes
|
||||
} CK_STATESAVEFLAGS_CAMERA;
|
||||
|
||||
|
||||
//--------------------------------------------------
|
||||
// Sprite3D
|
||||
typedef enum CK_STATESAVEFLAGS_SPRITE3D
|
||||
{
|
||||
CK_STATESAVE_SPRITE3DDATA = 0x00400000, // Save offset,mapping,size and material
|
||||
CK_STATESAVE_SPRITE3DRESERVED0 = 0x00800000, // Reserved for future use
|
||||
CK_STATESAVE_SPRITE3DRESERVED1 = 0x01000000, // Reserved for future use
|
||||
CK_STATESAVE_SPRITE3DRESERVED2 = 0x02000000, // Reserved for future use
|
||||
CK_STATESAVE_SPRITE3DRESERVED3 = 0x04000000, // Reserved for future use
|
||||
CK_STATESAVE_SPRITE3DRESERVED4 = 0x08000000, // Reserved for future use
|
||||
CK_STATESAVE_SPRITE3DONLY = 0x0FC00000, // Save only Sprite3D specific datas
|
||||
CK_STATESAVE_SPRITE3DALL = 0x0FFFFFFF // Save All datas for sub-classes
|
||||
} CK_STATESAVEFLAGS_SPRITE3D;
|
||||
|
||||
//--------------------------------------------------
|
||||
// Object 3D
|
||||
typedef enum CK_STATESAVEFLAGS_3DOBJECT
|
||||
{
|
||||
CK_STATESAVE_3DOBJECTATTRIBUTES = 0x00400000, // Obsolete
|
||||
CK_STATESAVE_3DOBJECTRESERVED = 0x00800000, // Reserved for future use
|
||||
CK_STATESAVE_3DOBJECTRONLY = 0x00C00000, // Save only 3dObject specific datas
|
||||
CK_STATESAVE_3DOBJECTALL = 0x03FFFFFF // Save All datas for sub-classes
|
||||
} CK_STATESAVEFLAGS_3DOBJECT;
|
||||
|
||||
//--------------------------------------------------
|
||||
// BodyPart
|
||||
typedef enum CK_STATESAVEFLAGS_BODYPART
|
||||
{
|
||||
CK_STATESAVE_BODYPARTROTJOINT = 0x01000000, // Save rotation joint data
|
||||
CK_STATESAVE_BODYPARTPOSJOINT = 0x02000000, // Save position joint data
|
||||
CK_STATESAVE_BODYPARTCHARACTER = 0x04000000, // Save character owning this bodypart
|
||||
CK_STATESAVE_BODYPARTRESERVED1 = 0x08000000, // Reserved for future use
|
||||
CK_STATESAVE_BODYPARTRESERVED2 = 0x10000000, // Reserved for future use
|
||||
CK_STATESAVE_BODYPARTRESERVED3 = 0x20000000, // Reserved for future use
|
||||
CK_STATESAVE_BODYPARTRESERVED4 = 0x40000000, // Reserved for future use
|
||||
CK_STATESAVE_BODYPARTONLY = 0x7F000000, // Save only bodypart specific datas
|
||||
CK_STATESAVE_BODYPARTALL = 0x7FFFFFFF // Save All datas for sub-classes
|
||||
} CK_STATESAVEFLAGS_BODYPART;
|
||||
|
||||
//--------------------------------------------------
|
||||
// Character
|
||||
typedef enum CK_STATESAVEFLAGS_CHARACTER
|
||||
{
|
||||
CK_STATESAVE_CHARACTERBODYPARTS = 0x00400000, // Obsolete
|
||||
CK_STATESAVE_CHARACTERKINECHAINS = 0x00800000, // Obsolete
|
||||
CK_STATESAVE_CHARACTERANIMATIONS = 0x01000000, // Obsolete
|
||||
CK_STATESAVE_CHARACTERROOT = 0x02000000, // Obsolete
|
||||
CK_STATESAVE_CHARACTERSAVEANIMS = 0x04000000, // Save current and next active animations
|
||||
CK_STATESAVE_CHARACTERSAVECHAINS = 0x08000000, // Obsolete
|
||||
CK_STATESAVE_CHARACTERSAVEPARTS = 0x10000000, // Save sub bodyparts and sub-bodyparts data (saved with flag :CK_STATESAVE_BODYPARTALL)
|
||||
CK_STATESAVE_CHARACTERFLOORREF = 0x20000000, // Save Character floor reference object
|
||||
CK_STATESAVE_CHARACTERRESERVED2 = 0x40000000, // Reserved for future use
|
||||
CK_STATESAVE_CHARACTERRESERVED3 = 0x80000000, // Reserved for future use
|
||||
CK_STATESAVE_CHARACTERONLY = 0xFFC00000, // Save only character specific datas
|
||||
CK_STATESAVE_CHARACTERALL = 0xFFFFFFFF // Save All datas for sub-classes
|
||||
} CK_STATESAVEFLAGS_CHARACTER;
|
||||
|
||||
//--------------------------------------------------
|
||||
// CURVE
|
||||
// && Curve Point
|
||||
typedef enum CK_STATESAVEFLAGS_CURVE
|
||||
{
|
||||
CK_STATESAVE_CURVEFITCOEFF = 0x00400000, // Save fitting coef
|
||||
CK_STATESAVE_CURVECONTROLPOINT = 0x00800000, // Save list of control points
|
||||
CK_STATESAVE_CURVESTEPS = 0x01000000, // Save number of step setting
|
||||
CK_STATESAVE_CURVEOPEN = 0x02000000, // Save Open/Close flag
|
||||
CK_STATESAVE_CURVERESERVED1 = 0x04000000, // Reserved for future use
|
||||
CK_STATESAVE_CURVERESERVED2 = 0x08000000, // Reserved for future use
|
||||
// Control points
|
||||
CK_STATESAVE_CURVEPOINTDEFAULTDATA = 0x10000000, // Save Control point setting and position
|
||||
CK_STATESAVE_CURVEPOINTTCB = 0x20000000, // Save Control point tcb settings
|
||||
CK_STATESAVE_CURVEPOINTTANGENTS = 0x40000000, // Save Control point tangents
|
||||
CK_STATESAVE_CURVEPOINTCURVEPOS = 0x80000000, // Save Control point position in curve
|
||||
CK_STATESAVE_CURVESAVEPOINTS = 0xFF000000, // Save control points data
|
||||
|
||||
CK_STATESAVE_CURVEONLY = 0xFFC00000, // Save only curve specific data
|
||||
CK_STATESAVE_CURVEALL = 0xFFFFFFFF // Save All datas for sub-classes
|
||||
} CK_STATESAVEFLAGS_CURVE;
|
||||
|
||||
//------------------------------------------------
|
||||
// 2dEntity
|
||||
typedef enum CK_STATESAVEFLAGS_2DENTITY
|
||||
{
|
||||
CK_STATESAVE_2DENTITYSRCSIZE = 0x00001000, // Save source size
|
||||
CK_STATESAVE_2DENTITYSIZE = 0x00002000, // Save size
|
||||
CK_STATESAVE_2DENTITYFLAGS = 0x00004000, // Save Flags
|
||||
CK_STATESAVE_2DENTITYPOS = 0x00008000, // Save position
|
||||
CK_STATESAVE_2DENTITYZORDER = 0x00100000, // Save Z order
|
||||
CK_STATESAVE_2DENTITYONLY = 0x0010F000, // Save only 2dEntity specific data
|
||||
CK_STATESAVE_2DENTITYMATERIAL = 0x00200000, // Save Material
|
||||
CK_STATESAVE_2DENTITYHIERARCHY = 0x00400000, // Save Material
|
||||
CK_STATESAVE_2DENTITYALL = 0x0070FFFF // Save All datas for sub-classes
|
||||
} CK_STATESAVEFLAGS_2DENTITY;
|
||||
|
||||
//------------------------------------------------
|
||||
// Sprite
|
||||
typedef enum CK_STATESAVEFLAGS_SPRITE
|
||||
{
|
||||
CK_STATESAVE_SPRITECURRENTIMAGE = 0x00010000, // Save current image
|
||||
CK_STATESAVE_SPRITETRANSPARENT = 0x00020000, // Save transparency settings
|
||||
CK_STATESAVE_SPRITEBITMAPS = 0x00040000, // Obsolete
|
||||
CK_STATESAVE_SPRITESHARED = 0x00080000, // Save shared sprite
|
||||
CK_STATESAVE_SPRITEDONOTUSE = 0x00100000, // Reseved by CK_STATESAVEFLAGS_2DENTITY
|
||||
CK_STATESAVE_SPRITEAVIFILENAME = 0x00200000, // Obsolete
|
||||
CK_STATESAVE_SPRITEFILENAMES = 0x00400000, // Obsolete
|
||||
CK_STATESAVE_SPRITECOMPRESSED = 0x00800000, // Obsolete
|
||||
CK_STATESAVE_SPRITEREADER = 0x10000000, // Reserved for future use
|
||||
CK_STATESAVE_SPRITEFORMAT = 0x20000000, // Reserved for future use
|
||||
CK_STATESAVE_SPRITEVIDEOFORMAT = 0x40000000, // Video Format
|
||||
CK_STATESAVE_SPRITESYSTEMCACHING = 0x80000000, // System Memory Caching
|
||||
CK_STATESAVE_SPRITERENDEROPTIONS = 0x80800000, // Render options if any...
|
||||
CK_STATESAVE_SPRITEONLY = 0xF0EF0000, // Save only sprite specific data
|
||||
CK_STATESAVE_SPRITEALL = 0x70FFFFFF // Save All datas for sub-classes
|
||||
} CK_STATESAVEFLAGS_SPRITE;
|
||||
|
||||
|
||||
//------------------------------------------------
|
||||
// Sprite Text
|
||||
typedef enum CK_STATESAVEFLAGS_SPRITETEXT
|
||||
{
|
||||
CK_STATESAVE_SPRITETEXT = 0x01000000, // Save text
|
||||
CK_STATESAVE_SPRITEFONT = 0x02000000, // Save font settings
|
||||
CK_STATESAVE_SPRITETEXTCOLOR = 0x04000000, // Save text color
|
||||
CK_STATESAVE_SPRITETEXTRESERVED = 0x08000000, // Reserved for future use
|
||||
CK_STATESAVE_SPRITETEXTDOTNOTUSE = 0x10000000, // Reserved by CK_STATESAVE_SPRITEREADER
|
||||
CK_STATESAVE_SPRITETEXTDONOTUSED2 = 0x20000000, // Reserved by CK_STATESAVE_SPRITEFORMAT
|
||||
CK_STATESAVE_SPRITETEXTONLY = 0x0F000000, // Save only SpriteText specific data
|
||||
CK_STATESAVE_SPRITETEXTALL = 0x3FFFFFFF // Save All datas for sub-classes
|
||||
} CK_STATESAVEFLAGS_SPRITETEXT;
|
||||
|
||||
//------------------------------------------------
|
||||
// Sound
|
||||
typedef enum CK_STATESAVEFLAGS_SOUND
|
||||
{
|
||||
CK_STATESAVE_SOUNDFILENAME = 0x00001000, // Reserved for future use
|
||||
CK_STATESAVE_SOUNDRESERVED1 = 0x00002000, // Reserved for future use
|
||||
CK_STATESAVE_SOUNDRESERVED2 = 0x00004000, // Reserved for future use
|
||||
CK_STATESAVE_SOUNDRESERVED3 = 0x00008000, // Reserved for future use
|
||||
CK_STATESAVE_SOUNDRESERVED4 = 0x00010000, // Reserved for future use
|
||||
CK_STATESAVE_SOUNDRESERVED5 = 0x00020000, // Reserved for future use
|
||||
CK_STATESAVE_SOUNDRESERVED6 = 0x00040000, // Reserved for future use
|
||||
CK_STATESAVE_SOUNDRESERVED7 = 0x00080000, // Reserved for future use
|
||||
CK_STATESAVE_SOUNDONLY = 0x000FF000, // Save only Sound specific data
|
||||
CK_STATESAVE_SOUNDALL = 0x000FFFFF // Save All datas for sub-classes
|
||||
} CK_STATESAVEFLAGS_SOUND;
|
||||
|
||||
//------------------------------------------------
|
||||
// Wave Sound
|
||||
typedef enum CK_STATESAVEFLAGS_WAVSOUND
|
||||
{
|
||||
CK_STATESAVE_WAVSOUNDFILE = 0x00100000, // Save sound filename
|
||||
CK_STATESAVE_WAVSOUNDDATA = 0x00200000, // Obsolete
|
||||
CK_STATESAVE_WAVSOUNDDATA2 = 0x00400000, // Save sound properties (3D/2D,pitch,gain,streaming,loop,etc..)
|
||||
CK_STATESAVE_WAVSOUNDDURATION = 0x00800000, // Sound Length (in case it cannot be calculated latter)
|
||||
CK_STATESAVE_WAVSOUNDRESERVED4 = 0x01000000, // Reserved for future use
|
||||
CK_STATESAVE_WAVSOUNDRESERVED5 = 0x02000000, // Reserved for future use
|
||||
CK_STATESAVE_WAVSOUNDRESERVED6 = 0x04000000, // Reserved for future use
|
||||
CK_STATESAVE_WAVSOUNDRESERVED7 = 0x08000000, // Reserved for future use
|
||||
CK_STATESAVE_WAVSOUNDONLY = 0x0FF00000, // Save All datas for sub-classes
|
||||
CK_STATESAVE_WAVSOUNDALL = 0x0FFFFFFF // Save All datas for sub-classes
|
||||
} CK_STATESAVEFLAGS_WAVSOUND;
|
||||
|
||||
|
||||
//------------------------------------------------
|
||||
// Wave Sound
|
||||
typedef enum CK_STATESAVEFLAGS_MIDISOUND
|
||||
{
|
||||
CK_STATESAVE_MIDISOUNDFILE = 0x00100000, // Save sound filename
|
||||
CK_STATESAVE_MIDISOUNDDATA = 0x00200000, // Save midi data
|
||||
CK_STATESAVE_MIDISOUNDRESERVED2 = 0x00400000, // Reserved for future use
|
||||
CK_STATESAVE_MIDISOUNDRESERVED3 = 0x00800000, // Reserved for future use
|
||||
CK_STATESAVE_MIDISOUNDRESERVED4 = 0x01000000, // Reserved for future use
|
||||
CK_STATESAVE_MIDISOUNDRESERVED5 = 0x02000000, // Reserved for future use
|
||||
CK_STATESAVE_MIDISOUNDRESERVED6 = 0x04000000, // Reserved for future use
|
||||
CK_STATESAVE_MIDISOUNDRESERVED7 = 0x08000000, // Reserved for future use
|
||||
CK_STATESAVE_MIDISOUNDONLY = 0x0FF00000,
|
||||
CK_STATESAVE_MIDISOUNDALL = 0x0FFFFFFF // Save All datas for sub-classes
|
||||
} CK_STATESAVEFLAGS_MIDISOUND;
|
||||
|
||||
|
||||
//------------------------------------------------
|
||||
// Place
|
||||
typedef enum CK_STATESAVEFLAGS_PLACE
|
||||
{
|
||||
CK_STATESAVE_PLACEPORTALS = 0x00001000, // Save level using the place
|
||||
CK_STATESAVE_PLACECAMERA = 0x00002000, // Save attached camera
|
||||
CK_STATESAVE_PLACEREFERENCES = 0x00004000, // Save list of objects in the place
|
||||
CK_STATESAVE_PLACELEVEL = 0x00008000, // Save level using the place
|
||||
CK_STATESAVE_PLACEALL = 0x0000FFFF // Save All datas for sub-classes
|
||||
} CK_STATESAVEFLAGS_PLACE;
|
||||
|
||||
//------------------------------------------------
|
||||
// Level
|
||||
// CKSaveObjectState will not save any data
|
||||
typedef enum CK_STATESAVEFLAGS_LEVEL
|
||||
{
|
||||
CK_STATESAVE_LEVELRESERVED0 = 0x00001000, // Reserved for future use
|
||||
CK_STATESAVE_LEVELINACTIVEMAN = 0x00002000, // Reserved for future use
|
||||
CK_STATESAVE_LEVELDUPLICATEMAN = 0x00004000, // Reserved for future use
|
||||
CK_STATESAVE_LEVELDEFAULTDATA = 0x20000000, // Save Places,Scenes and Objects
|
||||
CK_STATESAVE_LEVELSCENE = 0x80000000, // Default and active scene
|
||||
CK_STATESAVE_LEVELALL = 0xFFFFFFFF // Save All datas for sub-classes
|
||||
} CK_STATESAVEFLAGS_LEVEL;
|
||||
|
||||
|
||||
|
||||
|
||||
//------------------------------------------------
|
||||
// GROUP
|
||||
typedef enum CK_STATESAVEFLAGS_GROUP
|
||||
{
|
||||
CK_STATESAVE_GROUPDATA = 0x00001000, // Save list of objects in the group
|
||||
CK_STATESAVE_GROUPRESERVED1 = 0x00002000, // Reserved for future use
|
||||
CK_STATESAVE_GROUPRESERVED2 = 0x00004000, // Reserved for future use
|
||||
CK_STATESAVE_GROUPRESERVED3 = 0x00008000, // Reserved for future use
|
||||
CK_STATESAVE_GROUPRESERVED4 = 0x00010000, // Reserved for future use
|
||||
CK_STATESAVE_GROUPRESERVED5 = 0x00020000, // Reserved for future use
|
||||
CK_STATESAVE_GROUPRESERVED6 = 0x00040000, // Reserved for future use
|
||||
CK_STATESAVE_GROUPRESERVED7 = 0x00080000, // Reserved for future use
|
||||
CK_STATESAVE_GROUPALL = 0x000FFFFF // Save All datas for sub-classes
|
||||
} CK_STATESAVEFLAGS_GROUP;
|
||||
|
||||
|
||||
//------------------------------------------------
|
||||
// MESH
|
||||
// CKSaveOjectSave will save all data and does not take flags into account
|
||||
typedef enum CK_STATESAVEFLAGS_MESH
|
||||
{
|
||||
CK_STATESAVE_MESHRESERVED0 = 0x00001000, // Reserved for future use
|
||||
CK_STATESAVE_MESHFLAGS = 0x00002000, // Save flags
|
||||
CK_STATESAVE_MESHCHANNELS = 0x00004000, // Save Channels
|
||||
CK_STATESAVE_MESHFACECHANMASK = 0x00008000, // Save face channel Mask
|
||||
CK_STATESAVE_MESHFACES = 0x00010000, // Save face data
|
||||
CK_STATESAVE_MESHVERTICES = 0x00020000, // Save geometry
|
||||
CK_STATESAVE_MESHLINES = 0x00040000, // Save line data
|
||||
CK_STATESAVE_MESHWEIGHTS = 0x00080000, // Save Vertex Weight info
|
||||
CK_STATESAVE_MESHMATERIALS = 0x00100000, // Reserved for future use
|
||||
CK_STATESAVE_MESHRESERVED1 = 0x00200000, // Reserved for future use
|
||||
CK_STATESAVE_MESHRESERVED2 = 0x00400000, // Reserved for future use
|
||||
CK_STATESAVE_PROGRESSIVEMESH = 0x00800000, // Save All datas for sub-classes
|
||||
CK_STATESAVE_MESHONLY = 0x00FFF000, // Save All datas for sub-classes
|
||||
CK_STATESAVE_MESHALL = 0x00FFFFFF // Save All datas for sub-classes
|
||||
} CK_STATESAVEFLAGS_MESH;
|
||||
|
||||
|
||||
//------------------------------------------------
|
||||
// PATCH MESH
|
||||
// CKSaveOjectSave will save all data and does not take flags into account
|
||||
typedef enum CK_STATESAVEFLAGS_PATCHMESH
|
||||
{
|
||||
CK_STATESAVE_PATCHMESHDATA = 0x00800000, // Obsolete
|
||||
CK_STATESAVE_PATCHMESHDATA2 = 0x01000000, // Obsolete
|
||||
CK_STATESAVE_PATCHMESHSMOOTH = 0x02000000, // Obsolete
|
||||
CK_STATESAVE_PATCHMESHMATERIALS = 0x04000000, // Obsolete
|
||||
CK_STATESAVE_PATCHMESHDATA3 = 0x08000000, // Save Patch Data
|
||||
CK_STATESAVE_PATCHMESHONLY = 0x0FF00000, // Save All datas for sub-classes
|
||||
CK_STATESAVE_PATCHMESHALL = 0x0FFFFFFF // Save All datas for sub-classes
|
||||
} CK_STATESAVEFLAGS_PATCHMESH;
|
||||
|
||||
//-------------------------------------------------
|
||||
// Material
|
||||
typedef enum CK_STATESAVEFLAGS_MATERIAL
|
||||
{
|
||||
CK_STATESAVE_MATDATA = 0x00001000, // Save colors,blending modes,shade modes,fill modes etc...
|
||||
CK_STATESAVE_MATDATA2 = 0x00002000, // Additional texture objects...
|
||||
CK_STATESAVE_MATDATA3 = 0x00004000, // Effect Alone
|
||||
CK_STATESAVE_MATDATA4 = 0x00008000, // none
|
||||
CK_STATESAVE_MATDATA5 = 0x00010000, // Effect + parameter
|
||||
CK_STATESAVE_MATRESERVED5 = 0x00020000, // Reserved for future use
|
||||
CK_STATESAVE_MATRESERVED6 = 0x00040000, // Reserved for future use
|
||||
CK_STATESAVE_MATRESERVED7 = 0x00080000, // Reserved for future use
|
||||
CK_STATESAVE_MATERIALONLY = 0x000FF000, // Save All datas for sub-classes
|
||||
CK_STATESAVE_MATERIALALL = 0x0FFFFFFF // Save All datas for sub-classes
|
||||
} CK_STATESAVEFLAGS_MATERIAL;
|
||||
|
||||
//---------------------------------------------------
|
||||
// Texture
|
||||
// CKSaveOjectSave will save all relevant data and does not take flags into account
|
||||
typedef enum CK_STATESAVEFLAGS_TEXTURE
|
||||
{
|
||||
CK_STATESAVE_TEXAVIFILENAME = 0x00001000, // Save movie file name
|
||||
CK_STATESAVE_TEXCURRENTIMAGE = 0x00002000, // Save current slot
|
||||
CK_STATESAVE_TEXBITMAPS = 0x00004000, // Obsolete
|
||||
CK_STATESAVE_TEXTRANSPARENT = 0x00008000, // Save transparency data
|
||||
CK_STATESAVE_TEXFILENAMES = 0x00010000, // Save texture slot filenames
|
||||
CK_STATESAVE_TEXCOMPRESSED = 0x00020000, // Save raw texture data
|
||||
CK_STATESAVE_TEXVIDEOFORMAT = 0x00040000, // Save chosen video format
|
||||
CK_STATESAVE_TEXSAVEFORMAT = 0x00080000, // Save chosen save format
|
||||
CK_STATESAVE_TEXREADER = 0x00100000, // Save texture data using a specific BitmapReader
|
||||
CK_STATESAVE_PICKTHRESHOLD = 0x00200000, // Save pick threshold
|
||||
CK_STATESAVE_USERMIPMAP = 0x00400000, // User mipmap levels
|
||||
CK_STATESAVE_TEXSYSTEMCACHING = 0x00800000, // System Memory Caching
|
||||
CK_STATESAVE_OLDTEXONLY = 0x002FF000, // Kept for compatibility
|
||||
CK_STATESAVE_TEXONLY = 0x00FFF000, // Save Only Texture Data (Dot NOT MODIFY ! Texture loading/saving relies on this value)
|
||||
CK_STATESAVE_TEXALL = 0x002FFFFF // Save All datas for sub-classes
|
||||
} CK_STATESAVEFLAGS_TEXTURE;
|
||||
|
||||
|
||||
//---------------------------------------------------
|
||||
// 2d CURVE
|
||||
// && 2d Curve Point
|
||||
typedef enum CK_STATESAVEFLAGS_2DCURVE
|
||||
{
|
||||
CK_STATESAVE_2DCURVERESERVED0 = 0x00000010, // Reserved for future use
|
||||
CK_STATESAVE_2DCURVERESERVED4 = 0x00000020, // Reserved for future use
|
||||
CK_STATESAVE_2DCURVEFITCOEFF = 0x00000040, // Obsolete
|
||||
CK_STATESAVE_2DCURVECONTROLPOINT = 0x00000080, // Obsolete
|
||||
CK_STATESAVE_2DCURVENEWDATA = 0x00000100, // Save All relevant data
|
||||
CK_STATESAVE_2DCURVERESERVED2 = 0x00000200, // Obsolete
|
||||
CK_STATESAVE_2DCURVERESERVED3 = 0x00000400, // Obsolete
|
||||
CK_STATESAVE_2DCURVEPOINTTCB = 0x00000800, // Obsolete
|
||||
CK_STATESAVE_2DCURVEPOINTTANGENTS = 0x00001000, // Obsolete
|
||||
CK_STATESAVE_2DCURVEPOINT2DCURVEPOS = 0x00002000, // Obsolete
|
||||
CK_STATESAVE_2DCURVEPOINTDEFAULTDATA= 0x00004000, // Obsolete
|
||||
CK_STATESAVE_2DCURVEPOINTNEWDATA = 0x00008000, // Save All relevant data
|
||||
CK_STATESAVE_2DCURVEPOINTRESERVED1 = 0x00010000, // Reserved for future use
|
||||
CK_STATESAVE_2DCURVEPOINTRESERVED2 = 0x00020000, // Reserved for future use
|
||||
CK_STATESAVE_2DCURVESAVEPOINTS = 0x0003F800, // Obsolete
|
||||
CK_STATESAVE_2DCURVEALL = 0x0007FFFF // Save All datas for sub-classes
|
||||
} CK_STATESAVEFLAGS_2DCURVE;
|
||||
|
||||
//---------------------------------------------------
|
||||
// Kinematic Chain
|
||||
|
||||
typedef enum CK_STATESAVEFLAGS_KINEMATICCHAIN
|
||||
{
|
||||
CK_STATESAVE_KINEMATICCHAINDATA = 0x00000010, // Save chain data
|
||||
CK_STATESAVE_KINEMATICCHAINRESERVED1 = 0x00000020, // Reserved for future use
|
||||
CK_STATESAVE_KINEMATICCHAINRESERVED2 = 0x00000040, // Reserved for future use
|
||||
CK_STATESAVE_KINEMATICCHAINRESERVED3 = 0x00000080, // Reserved for future use
|
||||
CK_STATESAVE_KINEMATICCHAINALL = 0x000000FF // Save All datas for sub-classes
|
||||
} CK_STATESAVEFLAGS_KINEMATICCHAIN;
|
||||
|
||||
//---------------------------------------------------
|
||||
// Animation
|
||||
typedef enum CK_STATESAVEFLAGS_ANIMATION
|
||||
{
|
||||
CK_STATESAVE_ANIMATIONDATA = 0x00000010, // Save Flags & Framerate data
|
||||
CK_STATESAVE_ANIMATIONRESERVED1 = 0x00000020, // Reserved for future use
|
||||
CK_STATESAVE_ANIMATIONLENGTH = 0x00000040, // Save animation Length
|
||||
CK_STATESAVE_ANIMATIONBODYPARTS = 0x00000080, // Save root & list of bodypart
|
||||
CK_STATESAVE_ANIMATIONCHARACTER = 0x00000100, // Save character
|
||||
CK_STATESAVE_ANIMATIONCURRENTSTEP = 0x00000200, // Save current step
|
||||
CK_STATESAVE_ANIMATIONRESERVED5 = 0x00000400, // Reserved for future use
|
||||
CK_STATESAVE_ANIMATIONRESERVED6 = 0x00000800, // Reserved for future use
|
||||
CK_STATESAVE_ANIMATIONALL = 0x0FFFFFFF // Save All datas for sub-classes
|
||||
} CK_STATESAVEFLAGS_ANIMATION;
|
||||
|
||||
//---------------------------------------------------
|
||||
// Keyed Anim
|
||||
typedef enum CK_STATESAVEFLAGS_KEYEDANIMATION
|
||||
{
|
||||
CK_STATESAVE_KEYEDANIMANIMLIST = 0x00001000, // Save list of object animations
|
||||
CK_STATESAVE_KEYEDANIMLENGTH = 0x00002000, // Obsolete
|
||||
CK_STATESAVE_KEYEDANIMPOSKEYS = 0x00004000, // Obsolete
|
||||
CK_STATESAVE_KEYEDANIMROTKEYS = 0x00008000, // Obsolete
|
||||
CK_STATESAVE_KEYEDANIMMORPHKEYS = 0x00010000, // Obsolete
|
||||
CK_STATESAVE_KEYEDANIMSCLKEYS = 0x00020000, // Obsolete
|
||||
CK_STATESAVE_KEYEDANIMFLAGS = 0x00040000, // Obsolete
|
||||
CK_STATESAVE_KEYEDANIMENTITY = 0x00080000, // Obsolete
|
||||
CK_STATESAVE_KEYEDANIMMERGE = 0x00100000, // Save merged animations
|
||||
CK_STATESAVE_KEYEDANIMSUBANIMS = 0x00200000, // Save object animations data (using same flags than CKSaveObjectState)
|
||||
CK_STATESAVE_KEYEDANIMRESERVED0 = 0x00400000, // Reserved for future use
|
||||
CK_STATESAVE_KEYEDANIMRESERVED1 = 0x00800000, // Reserved for future use
|
||||
CK_STATESAVE_KEYEDANIMRESERVED2 = 0x01000000, // Reserved for future use
|
||||
CK_STATESAVE_KEYEDANIMRESERVED3 = 0x02000000 // Reserved for future use
|
||||
} CK_STATESAVEFLAGS_KEYEDANIMATION;
|
||||
|
||||
|
||||
//---------------------------------------------------
|
||||
// Object Animation
|
||||
// CKSaveOjectSave will save all relevant data and does not take flags into account
|
||||
typedef enum CK_STATESAVEFLAGS_OBJECTANIMATION
|
||||
{
|
||||
CK_STATESAVE_OBJANIMNEWDATA = 0x00001000, // Save all relevant data
|
||||
CK_STATESAVE_OBJANIMLENGTH = 0x00002000, // Not used
|
||||
CK_STATESAVE_OBJANIMPOSKEYS = 0x00004000, // Not used
|
||||
CK_STATESAVE_OBJANIMROTKEYS = 0x00008000, // Not used
|
||||
CK_STATESAVE_OBJANIMMORPHKEYS = 0x00010000, // Not used
|
||||
CK_STATESAVE_OBJANIMSCLKEYS = 0x00020000, // Not used
|
||||
CK_STATESAVE_OBJANIMFLAGS = 0x00040000, // Not used
|
||||
CK_STATESAVE_OBJANIMENTITY = 0x00080000, // Not used
|
||||
CK_STATESAVE_OBJANIMMERGE = 0x00100000, // Not used
|
||||
CK_STATESAVE_OBJANIMMORPHKEYS2 = 0x00200000, // Not used
|
||||
CK_STATESAVE_OBJANIMNEWSAVE1 = 0x00400000, // Not used
|
||||
CK_STATESAVE_OBJANIMMORPHNORMALS = 0x00800000, // Not used (Virtools 1.1)
|
||||
CK_STATESAVE_OBJANIMMORPHCOMP = 0x01000000, // Not used (Virtools 1.1)
|
||||
CK_STATESAVE_OBJANIMSHARED = 0x02000000, // Save Data for a shared animation
|
||||
CK_STATESAVE_OBJANIMCONTROLLERS = 0x04000000, // (Virtools 1.5) Save All Controller information
|
||||
CK_STATESAVE_OBJANIMONLY = 0x07FFF000,
|
||||
CK_STATESAVE_OBJANIMALL = 0x07FFFFFF,
|
||||
CK_STATESAVE_KEYEDANIMONLY = 0x03FFF000, // Save All datas for sub-classes
|
||||
CK_STATESAVE_KEYEDANIMALL = 0x03FFFFFF // Save All datas for sub-classes
|
||||
} CK_STATESAVEFLAGS_OBJECTANIMATION;
|
||||
|
||||
|
||||
//---------------------------------------------------
|
||||
// IK Animation
|
||||
typedef enum CK_STATESAVEFLAGS_IKANIMATION
|
||||
{
|
||||
CK_STATESAVE_IKANIMATIONDATA = 0x00001000, // Save IK data
|
||||
CK_STATESAVE_IKANIMATIONRESERVED2 = 0x00002000, // Reserved for future use
|
||||
CK_STATESAVE_IKANIMATIONRESERVED3 = 0x00004000, // Reserved for future use
|
||||
CK_STATESAVE_IKANIMATIONRESERVED4 = 0x00008000, // Reserved for future use
|
||||
CK_STATESAVE_IKANIMATIONRESERVED5 = 0x00010000, // Reserved for future use
|
||||
CK_STATESAVE_IKANIMATIONRESERVED6 = 0x00020000, // Reserved for future use
|
||||
CK_STATESAVE_IKANIMATIONRESERVED7 = 0x00040000, // Reserved for future use
|
||||
CK_STATESAVE_IKANIMATIONRESERVED8 = 0x00100000, // Reserved for future use
|
||||
CK_STATESAVE_IKANIMATIONRESERVED9 = 0x00200000, // Reserved for future use
|
||||
CK_STATESAVE_IKANIMATIONALL = 0x003FFFFF // Save All datas for sub-classes
|
||||
} CK_STATESAVEFLAGS_IKANIMATION;
|
||||
|
||||
//---------------------------------------------------
|
||||
// BehaviorLink
|
||||
typedef enum CK_STATESAVEFLAGS_BEHAV_LINK
|
||||
{
|
||||
CK_STATESAVE_BEHAV_LINK_CURDELAY = 0x00000004, // Obsolete
|
||||
CK_STATESAVE_BEHAV_LINK_IOS = 0x00000008, // Obsolete
|
||||
CK_STATESAVE_BEHAV_LINK_DELAY = 0x00000010, // Obsolete
|
||||
CK_STATESAVE_BEHAV_LINK_NEWDATA = 0x00000020, // Save all relevant data (In,Out,Activation delay)
|
||||
CK_STATESAVE_BEHAV_LINKRESERVED5 = 0x00000040, // Reserved for future use
|
||||
CK_STATESAVE_BEHAV_LINKRESERVED6 = 0x00000080, // Reserved for future use
|
||||
CK_STATESAVE_BEHAV_LINKONLY = 0x000000F0, //
|
||||
CK_STATESAVE_BEHAV_LINKALL = 0x000000FF // Save All datas for sub-classes
|
||||
} CK_STATESAVEFLAGS_BEHAV_LINK;
|
||||
|
||||
//---------------------------------------------------
|
||||
// BehaviorIO
|
||||
typedef enum CK_STATESAVEFLAGS_BEHAV_IO
|
||||
{
|
||||
CK_STATESAVE_BEHAV_IOFLAGS = 0x00000008, // Save IO flags
|
||||
CK_STATESAVE_BEHAV_IORESERVED3 = 0x00000010, // Reserved for future use
|
||||
CK_STATESAVE_BEHAV_IORESERVED4 = 0x00000020, // Reserved for future use
|
||||
CK_STATESAVE_BEHAV_IORESERVED5 = 0x00000040, // Reserved for future use
|
||||
CK_STATESAVE_BEHAV_IORESERVED6 = 0x00000080, // Reserved for future use
|
||||
CK_STATESAVE_BEHAVIOONLY = 0x000000F0, //
|
||||
CK_STATESAVE_BEHAVIOALL = 0x000000FF // Save All datas for sub-classes
|
||||
} CK_STATESAVEFLAGS_BEHAV_IO;
|
||||
|
||||
//---------------------------------------------------
|
||||
// BehaviorPrototype
|
||||
typedef enum CK_STATESAVEFLAGS_PROTOTYPE
|
||||
{
|
||||
CK_STATESAVE_PROTORESERVED0 = 0x00000010, // Reserved for future use
|
||||
CK_STATESAVE_PROTORESERVED1 = 0x00000020, // Reserved for future use
|
||||
CK_STATESAVE_PROTOFLAGS = 0x00000040, // Save Flags
|
||||
CK_STATESAVE_PROTOSUBPROTOS = 0x00000080, // Save sub prototypes
|
||||
CK_STATESAVE_PROTOLINKS = 0x00000100, // Save links
|
||||
CK_STATESAVE_PROTOBEHAVFLAG = 0x00000200, // Save behavior flags
|
||||
CK_STATESAVE_PROTOGUID = 0x00000400, // Save GUID
|
||||
CK_STATESAVE_PROTOINPUTS = 0x00000800, // Save inputs
|
||||
CK_STATESAVE_PROTOOUTPUTS = 0x00001000, // Save outputs
|
||||
CK_STATESAVE_PROTOINPARAMS = 0x00002000, // Save input parameters
|
||||
CK_STATESAVE_PROTOOUTPARAMS = 0x00004000, // Save output parameters
|
||||
CK_STATESAVE_PROTOLOCALPARAMS = 0x00008000, // Save local parameters
|
||||
CK_STATESAVE_PROTOOPERATIONS = 0x00010000, // Save parameter operations
|
||||
CK_STATESAVE_PROTOPARAMETERLINKS = 0x00020000, // Save parameter links
|
||||
CK_STATESAVE_PROTOAPPLYTO = 0x00040000, // Save ClassID of object to which it applies
|
||||
CK_STATESAVE_PROTORESERVED14 = 0x00080000, // Reserved for future use
|
||||
CK_STATESAVE_PROTOALL = 0x000FFFFF // Save All datas for sub-classes
|
||||
} CK_STATESAVEFLAGS_PROTOTYPE;
|
||||
|
||||
|
||||
//---------------------------------------------------
|
||||
// Behavior
|
||||
typedef enum CK_STATESAVEFLAGS_BEHAVIOR
|
||||
{
|
||||
CK_STATESAVE_BEHAVIORRESERVED0 = 0x00000010, // Reserved for internal use
|
||||
CK_STATESAVE_BEHAVIORNEWDATA = 0x00000020, // not used
|
||||
CK_STATESAVE_BEHAVIORFLAGS = 0x00000040, // not used
|
||||
CK_STATESAVE_BEHAVIORCOMPATIBLECID = 0x00000080, // not used
|
||||
CK_STATESAVE_BEHAVIORSUBBEHAV = 0x00000100, // Save Sub-Behaviors
|
||||
CK_STATESAVE_BEHAVIORINPARAMS = 0x00000200, // not used
|
||||
CK_STATESAVE_BEHAVIOROUTPARAMS = 0x00000400, // not used
|
||||
CK_STATESAVE_BEHAVIORINPUTS = 0x00000800, // not used
|
||||
CK_STATESAVE_BEHAVIOROUTPUTS = 0x00001000, // not used
|
||||
CK_STATESAVE_BEHAVIORINFO = 0x00002000, // not used
|
||||
CK_STATESAVE_BEHAVIOROPERATIONS = 0x00004000, // not used
|
||||
CK_STATESAVE_BEHAVIORTYPE = 0x00008000, // not used
|
||||
CK_STATESAVE_BEHAVIOROWNER = 0x00010000, // not used
|
||||
CK_STATESAVE_BEHAVIORLOCALPARAMS = 0x00020000, // Save local parameters
|
||||
CK_STATESAVE_BEHAVIORPROTOGUID = 0x00040000, // not used
|
||||
CK_STATESAVE_BEHAVIORSUBLINKS = 0x00080000, // not used
|
||||
CK_STATESAVE_BEHAVIORACTIVESUBLINKS= 0x00100000, // not used
|
||||
CK_STATESAVE_BEHAVIORSINGLEACTIVITY= 0x00200000, // SINGLE ACTIVITY
|
||||
CK_STATESAVE_BEHAVIORSCRIPTDATA = 0x00400000, // not used
|
||||
CK_STATESAVE_BEHAVIORPRIORITY = 0x00800000, // not used
|
||||
CK_STATESAVE_BEHAVIORTARGET = 0x01000000, // not used
|
||||
CK_STATESAVE_BEHAVIORONLY = 0x01FFFFF0,
|
||||
CK_STATESAVE_BEHAVIORALL = 0x01FFFFFF // Save All datas for sub-classes
|
||||
} CK_STATESAVEFLAGS_BEHAVIOR;
|
||||
|
||||
|
||||
|
||||
|
||||
//---------------------------------------------------
|
||||
// SCENE
|
||||
// CKSaveOjectSave will save all relevant data and does not take flags into account
|
||||
typedef enum CK_STATESAVEFLAGS_SCENE
|
||||
{
|
||||
CK_STATESAVE_SCENERESERVED0 = 0x00001000, // Reserved for future use
|
||||
CK_STATESAVE_SCENERESERVED8 = 0x00002000, // Reserved for future use
|
||||
CK_STATESAVE_SCENEFLAGS = 0x00004000,
|
||||
CK_STATESAVE_SCENELEVEL = 0x00008000,
|
||||
CK_STATESAVE_SCENEOBJECTS = 0x00010000,
|
||||
CK_STATESAVE_SCENENEWDATA = 0x00020000, // every object description and initial conditions
|
||||
CK_STATESAVE_SCENELAUNCHED = 0x00040000, // Scene was already launched once
|
||||
CK_STATESAVE_SCENERENDERSETTINGS = 0x00080000, // Background Color, Fog Color etc..
|
||||
CK_STATESAVE_SCENERESERVED1 = 0x00100000, // Reserved for future use
|
||||
CK_STATESAVE_SCENERESERVED2 = 0x00200000, // Reserved for future use
|
||||
CK_STATESAVE_SCENERESERVED3 = 0x00400000, // Reserved for future use
|
||||
CK_STATESAVE_SCENERESERVED4 = 0x00800000, // Reserved for future use
|
||||
CK_STATESAVE_SCENERESERVED5 = 0x01000000, // Reserved for future use
|
||||
CK_STATESAVE_SCENERESERVED12 = 0x02000000, // Reserved for future use
|
||||
CK_STATESAVE_SCENERESERVED13 = 0x04000000, // Reserved for future use
|
||||
CK_STATESAVE_SCENERESERVED14 = 0x08000000, // Reserved for future use
|
||||
CK_STATESAVE_SCENEALL = 0x0FFFFFFF // Save All datas for sub-classes
|
||||
} CK_STATESAVEFLAGS_SCENE;
|
||||
|
||||
|
||||
//---------------------------------------------------
|
||||
// ParameterIn
|
||||
typedef enum CK_STATESAVEFLAGS_PARAMETERIN
|
||||
{
|
||||
CK_STATESAVE_PARAMETERIN_RESERVED4 = 0x00000010, // Reserved for future use
|
||||
CK_STATESAVE_PARAMETERIN_RESERVED0 = 0x00000020, // Reserved for future use
|
||||
CK_STATESAVE_PARAMETERIN_RESERVED1 = 0x00000040, // Reserved for future use
|
||||
CK_STATESAVE_PARAMETERIN_OWNER = 0x00000080, // Obsolete
|
||||
CK_STATESAVE_PARAMETERIN_INSHARED = 0x00000100, // Obsolete
|
||||
CK_STATESAVE_PARAMETERIN_OUTSOURCE = 0x00000200, // Obsolete
|
||||
CK_STATESAVE_PARAMETERIN_DEFAULTDATA = 0x00000400, // Obsolete
|
||||
CK_STATESAVE_PARAMETERIN_DATASHARED = 0x00000800, // Save reference to shared inparameter
|
||||
CK_STATESAVE_PARAMETERIN_DATASOURCE = 0x00001000, // Save reference to source outparameter
|
||||
CK_STATESAVE_PARAMETERIN_DISABLED = 0x00002000, // The parameter was disabled
|
||||
CK_STATESAVE_PARAMETERIN_ALL = 0x0000FFFF // Save All datas for sub-classes
|
||||
} CK_STATESAVEFLAGS_PARAMETERIN;
|
||||
|
||||
//---------------------------------------------------
|
||||
// ParameterLocal et ParameterOut
|
||||
typedef enum CK_STATESAVEFLAGS_PARAMETEROUT
|
||||
{
|
||||
CK_STATESAVE_PARAMETEROUT_RESERVED0 = 0x00000010, // Reserved for future use
|
||||
CK_STATESAVE_PARAMETEROUT_DESTINATIONS = 0x00000020, // Save destinations
|
||||
CK_STATESAVE_PARAMETEROUT_VAL = 0x00000040, // Save value
|
||||
CK_STATESAVE_PARAMETEROUT_OWNER = 0x00000080, // Save Owner
|
||||
CK_STATESAVE_PARAMETEROUT_MYSELF = 0x00000200, //
|
||||
CK_STATESAVE_PARAMETEROUT_ISSETTING = 0x00000400, // Reserved for future use
|
||||
CK_STATESAVE_PARAMETEROUT_ALL = 0x0000FFFF // Save All datas for sub-classes
|
||||
} CK_STATESAVEFLAGS_PARAMETEROUT;
|
||||
|
||||
|
||||
//---------------------------------------------------
|
||||
// Parameter Operation
|
||||
|
||||
typedef enum CK_STATESAVEFLAGS_OPERATION
|
||||
{
|
||||
CK_STATESAVE_OPERATIONRESERVED0 = 0x00000010, // Reserved for future use
|
||||
CK_STATESAVE_OPERATIONRESERVED1 = 0x00000020, // Reserved for future use
|
||||
CK_STATESAVE_OPERATIONINPUTS = 0x00000040,
|
||||
CK_STATESAVE_OPERATIONOUTPUT = 0x00000080,
|
||||
CK_STATESAVE_OPERATIONOP = 0x00000100,
|
||||
CK_STATESAVE_OPERATIONDEFAULTDATA = 0x00000200,
|
||||
CK_STATESAVE_OPERATIONNEWDATA = 0x00000400,
|
||||
CK_STATESAVE_OPERATIONALL = 0x000007FF // Save All datas for sub-classes
|
||||
} CK_STATESAVEFLAGS_OPERATION;
|
||||
|
||||
|
||||
//---------------------------------------------------
|
||||
// Synchro Object
|
||||
// CKSaveOjectSave will save all relevant data and does not take flags into account
|
||||
typedef enum CK_STATESAVEFLAGS_SYNCHRO
|
||||
{
|
||||
CK_STATESAVE_SYNCHRODATA = 0x00000010, // Save data
|
||||
CK_STATESAVE_SYNCHRORESERVED0 = 0x00000040, // Reserved for future use
|
||||
CK_STATESAVE_SYNCHRORESERVED1 = 0x00000080, // Reserved for future use
|
||||
CK_STATESAVE_SYNCHRORESERVED2 = 0x00000100, // Reserved for future use
|
||||
CK_STATESAVE_SYNCHRORESERVED3 = 0x00000200, // Reserved for future use
|
||||
CK_STATESAVE_SYNCHRONALL = 0x000003FF // Save All datas for sub-classes
|
||||
} CK_STATESAVEFLAGS_SYNCHRO;
|
||||
|
||||
//------------------------------------------------
|
||||
// Grid
|
||||
typedef enum CK_STATESAVEFLAGS_GRID
|
||||
{
|
||||
CK_STATESAVE_GRIDDATA = 0x00400000, // Save Grid Data
|
||||
CK_STATESAVE_GRIDRESERVED0 = 0x00800000, // Reserved for future use
|
||||
CK_STATESAVE_GRIDRESERVED1 = 0x01000000, // Reserved for future use
|
||||
CK_STATESAVE_GRIDRESERVED2 = 0x02000000, // Reserved for future use
|
||||
CK_STATESAVE_GRIDRESERVED3 = 0x04000000, // Reserved for future use
|
||||
CK_STATESAVE_GRIDRESERVED4 = 0x08000000, // Reserved for future use
|
||||
CK_STATESAVE_GRIDONLY = 0x0FC00000, //
|
||||
CK_STATESAVE_GRIDALL = 0x0FFFFFFF // Save All datas for sub-classes
|
||||
} CK_STATESAVEFLAGS_GRID;
|
||||
|
||||
|
||||
//------------------------------------------------
|
||||
// Layer (For Grids)
|
||||
typedef enum CK_STATESAVEFLAGS_LAYER
|
||||
{
|
||||
CK_STATESAVE_LAYERDATA = 0x00000010, // Save Layer Data
|
||||
CK_STATESAVE_LAYERRESERVED0 = 0x00800020, // Reserved for future use
|
||||
CK_STATESAVE_LAYERRESERVED1 = 0x00000040, // Reserved for future use
|
||||
CK_STATESAVE_LAYERRESERVED2 = 0x00000080, // Reserved for future use
|
||||
CK_STATESAVE_LAYERRESERVED3 = 0x00000100, // Reserved for future use
|
||||
CK_STATESAVE_LAYERRESERVED4 = 0x00000200, // Reserved for future use
|
||||
CK_STATESAVE_LAYERONLY = 0x000003F0, //
|
||||
CK_STATESAVE_LAYERALL = 0x000003FF // Save All datas for sub-classes
|
||||
} CK_STATESAVEFLAGS_LAYER;
|
||||
|
||||
//------------------------------------------------
|
||||
// DataArray
|
||||
// CKSaveOjectSave will save all relevant data and does not take flags into account
|
||||
typedef enum CK_STATESAVEFLAGS_DATAARRAY
|
||||
{
|
||||
CK_STATESAVE_DATAARRAYFORMAT = 0x00001000, // Save format
|
||||
CK_STATESAVE_DATAARRAYDATA = 0x00002000, // Save array data
|
||||
CK_STATESAVE_DATAARRAYMEMBERS = 0x00004000, // Save members
|
||||
CK_STATESAVE_DATAARRAYALL = 0x0000FFFF // Save All datas for sub-classes
|
||||
} CK_STATESAVEFLAGS_DATAARRAY;
|
||||
|
||||
|
||||
//------------------------------------------------
|
||||
// SceneObjectDesc
|
||||
typedef enum CK_STATESAVEFLAGS_SCENEOBJECTDESC {
|
||||
|
||||
CK_STATESAVE_SCENEOBJECTDESC = 0x00000010,
|
||||
CK_STATESAVE_SCENEOBJECTRES1 = 0x00000020, // Reserved for future use
|
||||
CK_STATESAVE_SCENEOBJECTRES2 = 0x00000040, // Reserved for future use
|
||||
CK_STATESAVE_SCENEOBJECTRES3 = 0x00000080, // Reserved for future use
|
||||
CK_STATESAVE_SCENEOBJECTDESCALL = 0x000000FF // Save All datas for sub-classes
|
||||
|
||||
} CK_STATESAVEFLAGS_SCENEOBJECTDESC;
|
||||
375
Assets/CodeGen/EnumsMigration/src/VxEnums.txt
Normal file
375
Assets/CodeGen/EnumsMigration/src/VxEnums.txt
Normal file
@@ -0,0 +1,375 @@
|
||||
|
||||
/*****************************************************************
|
||||
{filename:VX_PIXELFORMAT}
|
||||
Name: VX_PIXELFORMAT
|
||||
|
||||
Summary: Pixel format types.
|
||||
See Also: VxImageDesc2PixelFormat,VxPixelFormat2ImageDesc
|
||||
******************************************************************/
|
||||
typedef enum VX_PIXELFORMAT {
|
||||
UNKNOWN_PF = 0, // Unknown pixel format
|
||||
_32_ARGB8888 = 1, // 32-bit ARGB pixel format with alpha
|
||||
_32_RGB888 = 2, // 32-bit RGB pixel format without alpha
|
||||
_24_RGB888 = 3, // 24-bit RGB pixel format
|
||||
_16_RGB565 = 4, // 16-bit RGB pixel format
|
||||
_16_RGB555 = 5, // 16-bit RGB pixel format (5 bits per color)
|
||||
_16_ARGB1555 = 6, // 16-bit ARGB pixel format (5 bits per color + 1 bit for alpha)
|
||||
_16_ARGB4444 = 7, // 16-bit ARGB pixel format (4 bits per color)
|
||||
_8_RGB332 = 8, // 8-bit RGB pixel format
|
||||
_8_ARGB2222 = 9, // 8-bit ARGB pixel format
|
||||
_32_ABGR8888 = 10, // 32-bit ABGR pixel format
|
||||
_32_RGBA8888 = 11, // 32-bit RGBA pixel format
|
||||
_32_BGRA8888 = 12, // 32-bit BGRA pixel format
|
||||
_32_BGR888 = 13, // 32-bit BGR pixel format
|
||||
_24_BGR888 = 14, // 24-bit BGR pixel format
|
||||
_16_BGR565 = 15, // 16-bit BGR pixel format
|
||||
_16_BGR555 = 16, // 16-bit BGR pixel format (5 bits per color)
|
||||
_16_ABGR1555 = 17, // 16-bit ABGR pixel format (5 bits per color + 1 bit for alpha)
|
||||
_16_ABGR4444 = 18, // 16-bit ABGR pixel format (4 bits per color)
|
||||
_DXT1 = 19, // S3/DirectX Texture Compression 1
|
||||
_DXT2 = 20, // S3/DirectX Texture Compression 2
|
||||
_DXT3 = 21, // S3/DirectX Texture Compression 3
|
||||
_DXT4 = 22, // S3/DirectX Texture Compression 4
|
||||
_DXT5 = 23, // S3/DirectX Texture Compression 5
|
||||
_16_V8U8 = 24, // 16-bit Bump Map format format (8 bits per color)
|
||||
_32_V16U16 = 25, // 32-bit Bump Map format format (16 bits per color)
|
||||
_16_L6V5U5 = 26, // 16-bit Bump Map format format with luminance
|
||||
_32_X8L8V8U8 = 27, // 32-bit Bump Map format format with luminance
|
||||
_8_ABGR8888_CLUT = 28, // 8 bits indexed CLUT (ABGR)
|
||||
_8_ARGB8888_CLUT = 29, // 8 bits indexed CLUT (ARGB)
|
||||
_4_ABGR8888_CLUT = 30, // 4 bits indexed CLUT (ABGR)
|
||||
_4_ARGB8888_CLUT = 31 // 4 bits indexed CLUT (ARGB)
|
||||
} VX_PIXELFORMAT;
|
||||
|
||||
|
||||
/******************************************************************
|
||||
{filename:VXLIGHT_TYPE}
|
||||
Summary: Light type.
|
||||
|
||||
Remarks:
|
||||
+ Used by CKLight::SetType to specify the type of a light.
|
||||
See also: CKLight::SetType,CKLight::GetType
|
||||
******************************************************************/
|
||||
typedef enum VXLIGHT_TYPE
|
||||
{
|
||||
VX_LIGHTPOINT = 1UL, // The Light is a point of light
|
||||
VX_LIGHTSPOT = 2UL, // The light is a spotlight
|
||||
VX_LIGHTDIREC = 3UL, // The light is directional light : Lights comes from an infinite point so only direction of light can be given
|
||||
VX_LIGHTPARA = 4UL // Obsolete, do not use
|
||||
} VXLIGHT_TYPE;
|
||||
|
||||
|
||||
|
||||
/*****************************************************************
|
||||
{filename:VXTEXTURE_BLENDMODE}
|
||||
Summary: Blend Mode Flags
|
||||
|
||||
Remarks:
|
||||
+ The VXTEXTURE_BLENDMODE is used by CKMaterial::SetTextureBlendMode() to specify how
|
||||
texture is applied on primitives.
|
||||
+ Also used as value for CKRST_TSS_TEXTUREMAPBLEND texture stage state.
|
||||
See Also: Using Materials,CKMaterial,CKTexture,CKMaterial::SetTextureBlendMode,CKRST_TSS_TEXTUREMAPBLEND.
|
||||
******************************************************************/
|
||||
typedef enum VXTEXTURE_BLENDMODE
|
||||
{
|
||||
VXTEXTUREBLEND_DECAL = 1UL, // Texture replace any material information
|
||||
VXTEXTUREBLEND_MODULATE = 2UL, // Texture and material are combine. Alpha information of the texture replace material alpha component.
|
||||
VXTEXTUREBLEND_DECALALPHA = 3UL, // Alpha information in the texture specify how material and texture are combined. Alpha information of the texture replace material alpha component.
|
||||
VXTEXTUREBLEND_MODULATEALPHA = 4UL, // Alpha information in the texture specify how material and texture are combined
|
||||
VXTEXTUREBLEND_DECALMASK = 5UL,
|
||||
VXTEXTUREBLEND_MODULATEMASK = 6UL,
|
||||
VXTEXTUREBLEND_COPY = 7UL, // Equivalent to DECAL
|
||||
VXTEXTUREBLEND_ADD = 8UL,
|
||||
VXTEXTUREBLEND_DOTPRODUCT3 = 9UL, // Perform a Dot Product 3 between texture (normal map)
|
||||
// and a referential vector given in VXRENDERSTATE_TEXTUREFACTOR.
|
||||
VXTEXTUREBLEND_MAX = 10UL,
|
||||
VXTEXTUREBLEND_MASK = 0xFUL
|
||||
} VXTEXTURE_BLENDMODE;
|
||||
|
||||
|
||||
/******************************************************************
|
||||
{filename:VXTEXTURE_FILTERMODE}
|
||||
Summary: Filter Mode Options
|
||||
|
||||
Remarks:
|
||||
+ The VXTEXTURE_FILTERMODE is used by CKMaterial::SetTextureMagMode and CKMaterial::SetTextureMinMode to specify how
|
||||
texture is filtered when magnified.
|
||||
+ Also used as value for CKRST_TSS_MAGFILTER and CKRST_TSS_MINFILTER texture stage state.
|
||||
See Also: Using Materials,CKMaterial,CKTexture,CKMaterial::SetTextureMagMode,CKMaterial::SetTextureMinMode,,CKRenderContext::SetTextureStageState
|
||||
******************************************************************/
|
||||
typedef enum VXTEXTURE_FILTERMODE
|
||||
{
|
||||
VXTEXTUREFILTER_NEAREST = 1UL, // No Filter
|
||||
VXTEXTUREFILTER_LINEAR = 2UL, // Bilinear Interpolation
|
||||
VXTEXTUREFILTER_MIPNEAREST = 3UL, // Mip mapping
|
||||
VXTEXTUREFILTER_MIPLINEAR = 4UL, // Mip Mapping with Bilinear interpolation
|
||||
VXTEXTUREFILTER_LINEARMIPNEAREST = 5UL, // Mip Mapping with Bilinear interpolation between mipmap levels.
|
||||
VXTEXTUREFILTER_LINEARMIPLINEAR = 6UL, // Trilinear Filtering
|
||||
VXTEXTUREFILTER_ANISOTROPIC = 7UL, // Anisotropic filtering
|
||||
VXTEXTUREFILTER_MASK = 0xFUL
|
||||
} VXTEXTURE_FILTERMODE;
|
||||
|
||||
/******************************************************************
|
||||
{filename:VXBLEND_MODE}
|
||||
Summary: Blending Mode options
|
||||
|
||||
Remarks:
|
||||
+ The VXBLEND_MODE is used by CKMaterial::SetSourceBlend() and SetDestBlend() to specify the blend
|
||||
factors that are used when blending is enabled. (Rs,Gs,Bs,As) are color components of the source pixel (being drawn) and
|
||||
(Rd,Gd,Bd,Ad) are color components of the destination pixel (current pixel on screen).
|
||||
When blending is enabled the final pixel will be equal to :
|
||||
|
||||
SrcBlendFactor * SrcPixel + DstBlendFactor * CurrentPixelOnScreen
|
||||
|
||||
+ Also used as value for VXRENDERSTATE_SRCBLEND and VXRENDERSTATE_DESTBLEND render state.
|
||||
|
||||
See Also: CKMaterial,CKTexture,CKMaterial::SetSourceBlend,CKMaterial::SetDestBlend,CKRenderContext::SetState,CKSprite::SetBlending,VXRENDERSTATE_SRCBLEND,VXRENDERSTATE_DESTBLEND
|
||||
******************************************************************/
|
||||
typedef enum VXBLEND_MODE
|
||||
{
|
||||
VXBLEND_ZERO = 1UL, //Blend factor is (0, 0, 0, 0).
|
||||
VXBLEND_ONE = 2UL, //Blend factor is (1, 1, 1, 1).
|
||||
VXBLEND_SRCCOLOR = 3UL, //Blend factor is (Rs, Gs, Bs, As).
|
||||
VXBLEND_INVSRCCOLOR = 4UL, //Blend factor is (1-Rs, 1-Gs, 1-Bs, 1-As).
|
||||
VXBLEND_SRCALPHA = 5UL, //Blend factor is (As, As, As, As).
|
||||
VXBLEND_INVSRCALPHA = 6UL, //Blend factor is (1-As, 1-As, 1-As, 1-As).
|
||||
VXBLEND_DESTALPHA = 7UL, //Blend factor is (Ad, Ad, Ad, Ad).
|
||||
VXBLEND_INVDESTALPHA = 8UL, //Blend factor is (1-Ad, 1-Ad, 1-Ad, 1-Ad).
|
||||
VXBLEND_DESTCOLOR = 9UL, //Blend factor is (Rd, Gd, Bd, Ad).
|
||||
VXBLEND_INVDESTCOLOR = 10UL, //Blend factor is (1-Rd, 1-Gd, 1-Bd, 1-Ad).
|
||||
VXBLEND_SRCALPHASAT = 11UL, //Blend factor is (f, f, f, 1); f = min(As, 1-Ad).
|
||||
VXBLEND_BOTHSRCALPHA = 12UL, //Source blend factor is (As, As, As, As) and destination blend factor is (1-As, 1-As, 1-As, 1-As)
|
||||
VXBLEND_BOTHINVSRCALPHA = 13UL, //Source blend factor is (1-As, 1-As, 1-As, 1-As) and destination blend factor is (As, As, As, As)
|
||||
VXBLEND_MASK = 0xFUL //Source blend factor is (1-As, 1-As, 1-As, 1-As) and destination blend factor is (As, As, As, As)
|
||||
} VXBLEND_MODE;
|
||||
|
||||
|
||||
/******************************************************************
|
||||
{filename:VXTEXTURE_ADDRESSMODE}
|
||||
Summary: Texture addressing modes.
|
||||
|
||||
Remarks:
|
||||
+ The VXTEXTURE_ADDRESSMODE is used by CKMaterial::SetTextureAddresMode to specify texture coordinate are
|
||||
taken into account when they are outside the range [0.0 , 1.0].
|
||||
+ Also used as value for CKRST_TSS_ADDRESS texture stage state.
|
||||
See Also: CKMaterial,CKTexture,CKRST_TSS_ADDRESS,CKRenderContext::SetTextureStageState
|
||||
******************************************************************/
|
||||
typedef enum VXTEXTURE_ADDRESSMODE
|
||||
{
|
||||
VXTEXTURE_ADDRESSWRAP = 1UL, // Default mesh wrap mode is used (see CKMesh::SetWrapMode)
|
||||
VXTEXTURE_ADDRESSMIRROR = 2UL, // Texture coordinates outside the range [0..1] are flipped evenly.
|
||||
VXTEXTURE_ADDRESSCLAMP = 3UL, // Texture coordinates greater than 1.0 are set to 1.0, and values less than 0.0 are set to 0.0.
|
||||
VXTEXTURE_ADDRESSBORDER = 4UL, // When texture coordinates are greater than 1.0 or less than 0.0 texture is set to a color defined in CKMaterial::SetTextureBorderColor.
|
||||
VXTEXTURE_ADDRESSMIRRORONCE = 5UL, //
|
||||
VXTEXTURE_ADDRESSMASK = 0x7UL // mask for all values
|
||||
} VXTEXTURE_ADDRESSMODE;
|
||||
|
||||
|
||||
/******************************************************************
|
||||
{filename:VXFILL_MODE}
|
||||
Summary: Fill Mode Options
|
||||
|
||||
Remarks:
|
||||
+ The VXFILL_MODE is used by CKMaterial::SetFillMode to specify how faces are drawn.
|
||||
+ Also used as value for VXRENDERSTATE_FILLMODE render state.
|
||||
See Also: CKMaterial::SetFillMode,VXRENDERSTATE_FILLMODE
|
||||
******************************************************************/
|
||||
typedef enum VXFILL_MODE
|
||||
{
|
||||
VXFILL_POINT = 1UL, // Vertices rendering
|
||||
VXFILL_WIREFRAME = 2UL, // Edges rendering
|
||||
VXFILL_SOLID = 3UL, // Face rendering
|
||||
VXFILL_MASK = 3UL
|
||||
}VXFILL_MODE;
|
||||
|
||||
|
||||
/******************************************************************
|
||||
{filename:VXSHADE_MODE}
|
||||
Summary: Shade Mode Options
|
||||
|
||||
Remarks:
|
||||
+ The VXSHADE_MODE is used by CKMaterial::SetShadeMode to specify how color
|
||||
interpolation is perform on faces when they are drawn.
|
||||
+ Also used as value for VXRENDERSTATE_SHADEMODE render state.
|
||||
See Also: CKMaterial::SetShadeMode,VXRENDERSTATE_SHADEMODE
|
||||
******************************************************************/
|
||||
typedef enum VXSHADE_MODE
|
||||
{
|
||||
VXSHADE_FLAT = 1UL, // Flat Shading
|
||||
VXSHADE_GOURAUD = 2UL, // Gouraud Shading
|
||||
VXSHADE_PHONG = 3UL, // Phong Shading (Not yet supported by most implementation)
|
||||
VXSHADE_MASK = 3UL
|
||||
} VXSHADE_MODE;
|
||||
|
||||
|
||||
/******************************************************************
|
||||
{filename:VXCMPFUNC}
|
||||
Summary: Comparison Function
|
||||
|
||||
Remarks:
|
||||
+ Used by CKRenderContext::SetState with VXRENDERSTATE_ZFUNC, VXRENDERSTATE_ALPHAFUNC or VXRENDERSTATE_STENCILFUNC
|
||||
to specify the type of Z or Alpha comparison function.
|
||||
+ The comparison function is used to compare the stencil,alpha or z reference value to a stencil,z or alpha entry.
|
||||
See also: CKRenderContext::SetState,VXRENDERSTATETYPE,VXRENDERSTATE_ZFUNC,VXRENDERSTATE_ALPHAFUNC,
|
||||
******************************************************************/
|
||||
typedef enum VXCMPFUNC
|
||||
{
|
||||
VXCMP_NEVER = 1UL, // Always fail the test.
|
||||
VXCMP_LESS = 2UL, // Accept if value if less than current value.
|
||||
VXCMP_EQUAL = 3UL, // Accept if value if equal than current value.
|
||||
VXCMP_LESSEQUAL = 4UL, // Accept if value if less or equal than current value.
|
||||
VXCMP_GREATER = 5UL, // Accept if value if greater than current value.
|
||||
VXCMP_NOTEQUAL = 6UL, // Accept if value if different than current value.
|
||||
VXCMP_GREATEREQUAL = 7UL, // Accept if value if greater or equal current value.
|
||||
VXCMP_ALWAYS = 8UL, // Always accept the test.
|
||||
VXCMP_MASK = 0xFUL // Mask for all possible values.
|
||||
} VXCMPFUNC;
|
||||
|
||||
/******************************************************************
|
||||
{filename:VX_EFFECT}
|
||||
Summary: Material special effects
|
||||
|
||||
Remarks:
|
||||
+ Effects provide additionnal functionnalities to take advantage of graphic features such as bump mapping,cube maps etc...
|
||||
+ When an effect is enabled on a material (CKMaterial::SetEffect) it may override the default settings of mesh channels or material blend options
|
||||
+ New effects can be created by providing a callback function (see CKRenderManager::AddEffect)
|
||||
+ This enumeration provides the list of hardcoded existing effects.
|
||||
+ Most of this effect are heavily hardware and device (DX8,DX7,etc..) dependant
|
||||
See also: CKMaterial::SetEffect,CKMaterial::GetEffect,CKRenderManager::AddEffect
|
||||
******************************************************************/
|
||||
typedef enum VX_EFFECT
|
||||
{
|
||||
VXEFFECT_NONE = 0UL, // No Effect
|
||||
VXEFFECT_TEXGEN = 1UL, // Texture coordinate generation using current viewpoint as referential
|
||||
VXEFFECT_TEXGENREF = 2UL, // texture generation generation with an optionnal referential
|
||||
VXEFFECT_BUMPENV = 3UL, // Environment Bump Mapping
|
||||
VXEFFECT_DP3 = 4UL, // Dot Product 3 bump mapping
|
||||
VXEFFECT_2TEXTURES = 5UL, // Blend 2 Textures
|
||||
VXEFFECT_3TEXTURES = 6UL, // Blend 3 Textures
|
||||
VXEFFECT_MASK = 0xFUL // Mask for all possible values.
|
||||
} VX_EFFECT;
|
||||
|
||||
|
||||
/*****************************************************************
|
||||
{filename:VX_MOVEABLE_FLAGS}
|
||||
Summary: 3dEntity additionnal flags Options
|
||||
|
||||
Remarks:
|
||||
+ The VX_MOVEABLE_FLAGS is used by CK3dEntity::SetMoveableFlags to specify different hints to the render engine about the entity.
|
||||
+ The (Engine) flags are set by the render engine and should not be modified by user. They can be checked with the CK3dEntity::GetMoveableFlags method.
|
||||
+ The (User) flags are to be set by the user or can be set by a specific method of CK3dEntity.
|
||||
|
||||
See Also: CK3dEntity::SetMoveableFlags
|
||||
******************************************************************/
|
||||
typedef enum VX_MOVEABLE_FLAGS {
|
||||
VX_MOVEABLE_PICKABLE =0x00000001, // (User)If not set this entity cannot be returned by CKRenderContext::Pick() or CKRenderContext::RectPict() functions.
|
||||
VX_MOVEABLE_VISIBLE =0x00000002, // (Engine) See CKObject::Show,CK3dEntity::IsVisible
|
||||
VX_MOVEABLE_UPTODATE =0x00000004, // (Engine) Used to Notify change in the data of the entity.
|
||||
VX_MOVEABLE_RENDERCHANNELS =0x00000008, // (User) If not set, additional material channels on the mesh used by this entity won't be rendered (CK3dEntity::SetRenderChannels)
|
||||
VX_MOVEABLE_USERBOX =0x00000010, // (Engine) When CK3dEntity::SetBoundingBox is called with a user box, this flag is set.
|
||||
VX_MOVEABLE_EXTENTSUPTODATE =0x00000020, // (Engine) Indicate that object 2D extents are up to date
|
||||
VX_MOVEABLE_BOXVALID =0x00004000, // (Engine) If not set the moveable has no mesh associated so its bounding box is irrelevant (a point).
|
||||
VX_MOVEABLE_RENDERLAST =0x00010000, // (User) If set the moveable will be rendered with the transparent objects (i.e in last) (CK3dEntity::SetRenderAsTransparent)
|
||||
VX_MOVEABLE_HASMOVED =0x00020000, // (Engine) Set when its position or orientation has changed. (Reset every frame when rendering starts)
|
||||
VX_MOVEABLE_WORLDALIGNED =0x00040000, // (User) Hint for render engine : this object is aligned with world position and orientation.
|
||||
VX_MOVEABLE_NOZBUFFERWRITE =0x00080000, // (User) Set by the user to warn Render Engine that this object must not write information to Z buffer
|
||||
VX_MOVEABLE_RENDERFIRST =0x00100000, // (User) If set the moveable will be rendered within the firsts objects
|
||||
VX_MOVEABLE_NOZBUFFERTEST =0x00200000, // (User) Set by the user to warn Render Engine that this object must not test against Z buffer (This override settings of all materials used by this Entity)
|
||||
VX_MOVEABLE_INVERSEWORLDMATVALID =0x00400000, // (Engine) Inverse world matrix is not up to date and should be recomputed
|
||||
VX_MOVEABLE_DONTUPDATEFROMPARENT =0x00800000, // (User) This object will not be updated by parent (neither World nor Local matrix wil be updated) . This flags can be used by physic engine for example in which hierarchy is not relevant for physicalised objects
|
||||
VX_MOVEABLE_INDIRECTMATRIX =0x01000000, // (User/Engine) Set by the engine at load time : The object matrix is in left hand referential, culling needs to be inverted
|
||||
VX_MOVEABLE_ZBUFONLY =0x02000000, // (User) The object will only be rendered in depth buffer
|
||||
VX_MOVEABLE_STENCILONLY =0x04000000, // (User) The object will only be rendered in stencil buffer
|
||||
VX_MOVEABLE_HIERARCHICALHIDE =0x10000000, // (Engine) If Object has this flags and is hidden its children won't be rendered
|
||||
VX_MOVEABLE_CHARACTERRENDERED =0x20000000, // (Engine) Set if a character was rendered last frame...
|
||||
VX_MOVEABLE_RESERVED2 =0x40000000, // (Engine)
|
||||
} VX_MOVEABLE_FLAGS;
|
||||
|
||||
|
||||
/*****************************************************************
|
||||
{filename:VXMESH_FLAGS}
|
||||
Summary:Mesh Flags Options
|
||||
|
||||
Remarks:
|
||||
+ The VXMESH_FLAGS is used by CKMesh::SetFlags to specify different hints to the render engine about the mesh.
|
||||
+ Most of this flags can be set or asked using the appropriate method of CKMesh (given between () in the members documentation).
|
||||
See Also: CKMesh,CKMesh::SetFlags
|
||||
******************************************************************/
|
||||
typedef enum VXMESH_FLAGS
|
||||
{
|
||||
VXMESH_BOUNDINGUPTODATE = 0x00000001, // If set the bounding box is up to date (internal).
|
||||
VXMESH_VISIBLE = 0x00000002, // If not set the mesh will not be rendered (CKMesh::Show)
|
||||
VXMESH_OPTIMIZED = 0x00000004, // Set by the render engine if the mesh is optimized for rendering. Unset it to force to recreate optimized structures (when changing materials or face organization ) (CKMesh::VertexMove)
|
||||
VXMESH_RENDERCHANNELS = 0x00000008, // If not set Additional material channels won't be rendered.
|
||||
VXMESH_HASTRANSPARENCY = 0x00000010, // If set indicates that one or more of the faces of this mesh use a transparent material (internal)
|
||||
VXMESH_PRELITMODE = 0x00000080, // If set, no lightning should occur for this mesh, vertex color should be used instead (CKMesh::SetLitMode)
|
||||
VXMESH_WRAPU = 0x00000100, // Texture coordinates wrapping among u texture coordinates. (CKMesh::SetWrapMode)
|
||||
VXMESH_WRAPV = 0x00000200, // Texture coordinates wrapping among v texture coordinates. (CKMesh::SetWrapMode)
|
||||
VXMESH_FORCETRANSPARENCY = 0x00001000, // Forces this mesh to be considered as transparent even if no material is tranparent. (CKMesh::SetTransparent)
|
||||
VXMESH_TRANSPARENCYUPTODATE = 0x00002000, // If set, the flags VXMESH_HASTRANSPARENCY is up to date. (internal)
|
||||
VXMESH_UV_CHANGED = 0x00004000, // Must be set if texture coordinates changed to enable the render engine to reconstruct potential display lists or vertex buffers. (CKMesh::UVChanged)
|
||||
VXMESH_NORMAL_CHANGED = 0x00008000, // Must be set if normal coordinates changed to enable the render engine to reconstruct potential display lists or vertex buffers. (CKMesh::NormalChanged)
|
||||
VXMESH_COLOR_CHANGED = 0x00010000, // Must be set if colors changed to enable the render engine to reconstruct potential display lists or vertex buffers. (CKMesh::ColorChanged)
|
||||
VXMESH_POS_CHANGED = 0x00020000, // Must be set if vertex position changed to enable the render engine to reconstruct potential display lists or vertex buffers. (CKMesh::VertexMove)
|
||||
VXMESH_HINTDYNAMIC = 0x00040000, // Hint for render engine : Mesh geometry is updated frequently
|
||||
VXMESH_GENNORMALS = 0x00080000, // Hint : Normals were generated by BuildNormals : Do not save (internal)
|
||||
VXMESH_PROCEDURALUV = 0x00100000, // Hint : UVs are generated : Do not save (internal)
|
||||
VXMESH_PROCEDURALPOS = 0x00200000, // Hint : Vertices postions are generated : Do not save (internal)
|
||||
VXMESH_STRIPIFY = 0x00400000, // If set the mesh will be stripified.
|
||||
VXMESH_MONOMATERIAL = 0x00800000, // Set by the render engine if the mesh use only one material.
|
||||
VXMESH_PM_BUILDNORM = 0x01000000, // Build normals when performing progressive meshing : Do not save (internal)
|
||||
VXMESH_BWEIGHTS_CHANGED = 0x02000000, // Must be set if vertex blend weights have changed to enable the render engine to reconstruct potential display lists or vertex buffers. (CKMesh::VertexMove)
|
||||
VXMESH_ALLFLAGS = 0x007FF39F
|
||||
} VXMESH_FLAGS;
|
||||
|
||||
|
||||
/******************************************************************
|
||||
{filename:VXMESH_LITMODE}
|
||||
Summary: Mesh lighting options
|
||||
|
||||
Remarks:
|
||||
+ The VXMESH_LITMODE is used by CKMesh::SetLitMode to specify how lighting is done.
|
||||
See Also: CKMaterial,CKMesh
|
||||
******************************************************************/
|
||||
typedef enum VXMESH_LITMODE
|
||||
{
|
||||
VX_PRELITMESH = 0, // Lighting use color information store with vertices
|
||||
VX_LITMESH = 1, // Lighting is done by renderer using normals and face material information.
|
||||
} VXMESH_LITMODE;
|
||||
|
||||
/*****************************************************************
|
||||
{filename:VXCHANNEL_FLAGS}
|
||||
Summary:Mesh additionnal material channel options
|
||||
|
||||
Remarks:
|
||||
+ The VXCHANNEL_FLAGS is used by CKMesh::SetChannelFlags to give the behavior of
|
||||
an additional material channel.
|
||||
See Also: CKMesh,CKMesh::AddChannel,CKMesh::IsChannelLit,CKMesh::IsChannelActive
|
||||
******************************************************************/
|
||||
typedef enum VXCHANNEL_FLAGS {
|
||||
VXCHANNEL_ACTIVE = 0x00000001, // This channel is active
|
||||
VXCHANNEL_SAMEUV = 0x00800000, // This channel should use the texture coordinates of the base mesh.
|
||||
VXCHANNEL_NOTLIT = 0x01000000, // Additionnal Material Channel should not be lit (some channels may not be rendered in one pass with this option)
|
||||
VXCHANNEL_MONO = 0x02000000, // Set at runtime by render engine to indicate whether this channel was rendered using multiple pass or not.(Dot Not Modify)
|
||||
VXCHANNEL_RESERVED1 = 0x04000000, // Reserved for internal use
|
||||
VXCHANNEL_LAST = 0x08000000, // Set at runtime by render engine to indicate this channel isthe last to be rendered. Dot Not Modify
|
||||
} VXCHANNEL_FLAGS;
|
||||
|
||||
/****************************************************************
|
||||
{filename:VXTEXTURE_WRAPMODE}
|
||||
Summary: Wrapping Flags
|
||||
|
||||
Remarks:
|
||||
+ The VXTEXTURE_WRAPMODE is used by CKMesh::SetWrapMode() to specify how
|
||||
texture coordinates are interpolated.
|
||||
See Also: Using Materials,CKMaterial,CKMesh::SetWrapMode.
|
||||
****************************************************************/
|
||||
typedef enum VXTEXTURE_WRAPMODE
|
||||
{
|
||||
VXTEXTUREWRAP_NONE = 0x00000000, // Flat texture addressing
|
||||
VXTEXTUREWRAP_U = 0x00000001, // Vertical cylinder mapping
|
||||
VXTEXTUREWRAP_V = 0x00000002, // Horizontal cylinder mapping
|
||||
VXTEXTUREWRAP_UV = 0x00000003, // Spherical mapping
|
||||
} VXTEXTURE_WRAPMODE;
|
||||
|
||||
|
||||
3
Assets/CodeGen/VectorGen/.gitignore
vendored
Normal file
3
Assets/CodeGen/VectorGen/.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
# Result
|
||||
VxTypes.hpp
|
||||
VxTypes.cpp
|
||||
3
Assets/CodeGen/VectorGen/README.md
Normal file
3
Assets/CodeGen/VectorGen/README.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# Vector Generator
|
||||
|
||||
Vector types (LibCmo::VxMath::VxVector3 and etc) and Vector-like types (LibCmo::VxMath::VxColor and etc) nearly have similar declaration except slight differences (basically is the count of factors). Manually writing these declarations is boring and easy to cause potential invisible bugs. So we use a Python script to generate these declarations batchly to prevent any defects indroduced above.
|
||||
178
Assets/CodeGen/VectorGen/VxTypes.cpp.jinja
Normal file
178
Assets/CodeGen/VectorGen/VxTypes.cpp.jinja
Normal file
@@ -0,0 +1,178 @@
|
||||
{% import 'VxTypes.shared.jinja' as shared %}
|
||||
{#
|
||||
For friend operator overload, we do not need add CLASSNAME:: prefix for it.
|
||||
Because they are not a part of that class.
|
||||
#}
|
||||
|
||||
#pragma region {{ sname }}
|
||||
|
||||
{# Ctor type 1 - Default ctor -#}
|
||||
{{ sname }}::{{ sname }}() : {{- shared.initialize_list_builder(svars, False) -}} {} {% if not is_vector %}// SET YOUR CUSTOM INIT{% endif %}
|
||||
{#- Ctor type 2 - User specified ctor #}
|
||||
{{ sname }}::{{ sname }}({{- shared.argument_list_builder(svars) -}}) : {{- shared.initialize_list_builder(svars, True) -}} {}
|
||||
|
||||
{#- Offset operator #}
|
||||
CKFLOAT& {{ sname }}::operator[](size_t i) {
|
||||
switch (i) {
|
||||
{%- for item in svars %}
|
||||
case {{ loop.index0 }}: return {{ item }};
|
||||
{%- endfor %}
|
||||
default: throw LogicException("Invalid index for {{ sname }}::operator[].");
|
||||
}
|
||||
}
|
||||
const CKFLOAT& {{ sname }}::operator[](size_t i) const {
|
||||
switch (i) {
|
||||
{%- for item in svars %}
|
||||
case {{ loop.index0 }}: return {{ item }};
|
||||
{%- endfor %}
|
||||
default: throw LogicException("Invalid index for {{ sname }}::operator[].");
|
||||
}
|
||||
}
|
||||
|
||||
{#- Equal operator #}
|
||||
bool {{ sname }}::operator==(const {{ sname }}& rhs) const {
|
||||
return (
|
||||
{%- for item in svars -%}
|
||||
{{ item }} == rhs.{{ item }} {%- if not loop.last %} && {% endif %}
|
||||
{%- endfor -%}
|
||||
);
|
||||
}
|
||||
|
||||
{#- Spaceship operator #}
|
||||
auto {{ sname }}::operator<=>(const {{ sname }}& rhs) const {
|
||||
{%- for item in svars[:-1] %}
|
||||
if (auto cmp = {{ item }} <=> rhs.{{ item }}; cmp != 0) return cmp;
|
||||
{%- endfor %}
|
||||
return {{ svars[-1] }} <=> rhs.{{ svars[-1] }};
|
||||
}
|
||||
|
||||
|
||||
{#- BEGIN VECTOR SPECIFIC #}
|
||||
{%- if is_vector %}
|
||||
|
||||
{#- Add, minus operators #}
|
||||
{#- Unary operators #}
|
||||
{{ sname }} {{ sname }}::operator+() const {
|
||||
return *this;
|
||||
}
|
||||
{{ sname }} {{ sname }}::operator-() const {
|
||||
return {{ sname }}(
|
||||
{%- for item in svars -%}
|
||||
-{{ item }} {%- if not loop.last %}, {% endif %}
|
||||
{%- endfor -%}
|
||||
);
|
||||
}
|
||||
{#- Additive operators #}
|
||||
{{ sname }}& {{ sname }}::operator+=(const {{ sname }}& rhs) {
|
||||
{%- for item in svars %}
|
||||
{{ item }} += rhs.{{ item }};
|
||||
{%- endfor %}
|
||||
return *this;
|
||||
}
|
||||
{{ sname }} operator+(const {{ sname }}& lhs, const {{ sname }}& rhs) {
|
||||
return {{ sname }}(
|
||||
{%- for item in svars -%}
|
||||
lhs.{{ item }} + rhs.{{ item }} {%- if not loop.last %}, {% endif %}
|
||||
{%- endfor -%}
|
||||
);
|
||||
}
|
||||
{{ sname }}& {{ sname }}::operator-=(const {{ sname }}& rhs) {
|
||||
{%- for item in svars %}
|
||||
{{ item }} -= rhs.{{ item }};
|
||||
{%- endfor %}
|
||||
return *this;
|
||||
}
|
||||
{{ sname }} operator-(const {{ sname }}& lhs, const {{ sname }}& rhs) {
|
||||
return {{ sname }}(
|
||||
{%- for item in svars -%}
|
||||
lhs.{{ item }} - rhs.{{ item }} {%- if not loop.last %}, {% endif %}
|
||||
{%- endfor -%}
|
||||
);
|
||||
}
|
||||
|
||||
{#- Mul operator #}
|
||||
{{ sname }}& {{ sname }}::operator*=(CKFLOAT rhs) {
|
||||
{%- for item in svars %}
|
||||
{{ item }} *= rhs;
|
||||
{%- endfor %}
|
||||
return *this;
|
||||
}
|
||||
{{ sname }} operator*(const {{ sname }}& lhs, CKFLOAT rhs) {
|
||||
return {{ sname }}(
|
||||
{%- for item in svars -%}
|
||||
lhs.{{ item }} * rhs {%- if not loop.last %}, {% endif %}
|
||||
{%- endfor -%}
|
||||
);
|
||||
}
|
||||
{{ sname }} operator*(CKFLOAT lhs, const {{ sname }}& rhs) {
|
||||
return {{ sname }}(
|
||||
{%- for item in svars -%}
|
||||
lhs * rhs.{{ item }} {%- if not loop.last %}, {% endif %}
|
||||
{%- endfor -%}
|
||||
);
|
||||
}
|
||||
CKFLOAT operator*(const {{ sname }}& lhs, const {{ sname }}& rhs) {
|
||||
return (
|
||||
{%- for item in svars -%}
|
||||
lhs.{{ item }} * rhs.{{ item }} {%- if not loop.last %} + {% endif %}
|
||||
{%- endfor -%}
|
||||
);
|
||||
}
|
||||
|
||||
{#- Div operator #}
|
||||
{{ sname }}& {{ sname }}::operator/=(CKFLOAT rhs) {
|
||||
if (rhs == 0.0f) return *this;
|
||||
{%- for item in svars %}
|
||||
{{ item }} /= rhs;
|
||||
{%- endfor %}
|
||||
return *this;
|
||||
}
|
||||
{{ sname }} operator/(const {{ sname }}& lhs, CKFLOAT rhs) {
|
||||
if (rhs == 0.0f) return {{ sname }}();
|
||||
else return {{ sname }}(
|
||||
{%- for item in svars -%}
|
||||
lhs.{{ item }} / rhs {%- if not loop.last %}, {% endif %}
|
||||
{%- endfor -%}
|
||||
);
|
||||
}
|
||||
|
||||
{#- Length functions #}
|
||||
CKFLOAT {{ sname }}::SquaredLength() const {
|
||||
return (
|
||||
{%- for item in svars -%}
|
||||
{{ item }} * {{ item }} {%- if not loop.last %} + {% endif %}
|
||||
{%- endfor -%}
|
||||
);
|
||||
}
|
||||
CKFLOAT {{ sname }}::Length() const {
|
||||
return std::sqrt(SquaredLength());
|
||||
}
|
||||
|
||||
{#- Normalize functions #}
|
||||
void {{ sname }}::Normalized() {
|
||||
CKFLOAT len = Length();
|
||||
if (len == 0.0f) return;
|
||||
{%- for item in svars %}
|
||||
{{ item }} /= len;
|
||||
{%- endfor %}
|
||||
}
|
||||
{{ sname }} {{ sname }}::Normalize() const {
|
||||
CKFLOAT len = Length();
|
||||
if (len == 0.0f) return {{ sname }}();
|
||||
else return {{ sname }}(
|
||||
{%- for item in svars -%}
|
||||
{{ item }} / len {%- if not loop.last %}, {% endif %}
|
||||
{%- endfor -%}
|
||||
);
|
||||
}
|
||||
|
||||
{%- endif %}
|
||||
{#- END VECTOR SPECIFIC #}
|
||||
|
||||
|
||||
{#- User custom region #}
|
||||
|
||||
/* ===== BEGIN USER CUSTOM ===== */
|
||||
/* ===== END USER CUSTOM ===== */
|
||||
|
||||
#pragma endregion
|
||||
65
Assets/CodeGen/VectorGen/VxTypes.hpp.jinja
Normal file
65
Assets/CodeGen/VectorGen/VxTypes.hpp.jinja
Normal file
@@ -0,0 +1,65 @@
|
||||
{% import 'VxTypes.shared.jinja' as shared %}
|
||||
|
||||
struct {{ sname }} {
|
||||
{#- Variable declaration #}
|
||||
CKFLOAT {{ ", ".join(svars) }};
|
||||
|
||||
{#- Ctor type 1 - Default ctor #}
|
||||
{{ sname }}();
|
||||
{#- Ctor type 2 - User specified ctor #}
|
||||
{{ sname }}({{- shared.argument_list_builder(svars) -}});
|
||||
|
||||
{#- Default copy ctor, move ctor, copy assigner, move assigner #}
|
||||
YYCC_DEF_CLS_COPY_MOVE({{ sname }});
|
||||
|
||||
{#- Offset operator #}
|
||||
CKFLOAT& operator[](size_t i);
|
||||
const CKFLOAT& operator[](size_t i) const;
|
||||
|
||||
{#- Equal operator #}
|
||||
bool operator==(const {{ sname }}& rhs) const;
|
||||
|
||||
{#- Spaceship operator #}
|
||||
auto operator<=>(const {{ sname }}& rhs) const;
|
||||
|
||||
|
||||
{#- BEGIN VECTOR SPECIFIC #}
|
||||
{%- if is_vector %}
|
||||
|
||||
{#- Add, minus operators #}
|
||||
{#- Unary operators #}
|
||||
{{ sname }} operator+() const;
|
||||
{{ sname }} operator-() const;
|
||||
{#- Additive operators #}
|
||||
{{ sname }}& operator+=(const {{ sname }}& rhs);
|
||||
friend {{ sname }} operator+(const {{ sname }}& lhs, const {{ sname }}& rhs);
|
||||
{{ sname }}& operator-=(const {{ sname }}& rhs);
|
||||
friend {{ sname }} operator-(const {{ sname }}& lhs, const {{ sname }}& rhs);
|
||||
|
||||
{#- Mul operator #}
|
||||
{{ sname }}& operator*=(CKFLOAT rhs);
|
||||
friend {{ sname }} operator*(const {{ sname }}& lhs, CKFLOAT rhs);
|
||||
friend {{ sname }} operator*(CKFLOAT lhs, const {{ sname }}& rhs);
|
||||
friend CKFLOAT operator*(const {{ sname }}& lhs, const {{ sname }}& rhs);
|
||||
|
||||
{#- Div operator #}
|
||||
{{ sname }}& operator/=(CKFLOAT rhs);
|
||||
friend {{ sname }} operator/(const {{ sname }}& lhs, CKFLOAT rhs);
|
||||
|
||||
{#- Length functions #}
|
||||
CKFLOAT SquaredLength() const;
|
||||
CKFLOAT Length() const;
|
||||
|
||||
{#- Normalize functions #}
|
||||
void Normalized();
|
||||
{{ sname }} Normalize() const;
|
||||
|
||||
{%- endif %}
|
||||
{#- END VECTOR SPECIFIC #}
|
||||
|
||||
|
||||
{#- User custom region #}
|
||||
|
||||
/* ===== BEGIN USER CUSTOM ===== */
|
||||
/* ===== END USER CUSTOM ===== */
|
||||
};
|
||||
21
Assets/CodeGen/VectorGen/VxTypes.shared.jinja
Normal file
21
Assets/CodeGen/VectorGen/VxTypes.shared.jinja
Normal file
@@ -0,0 +1,21 @@
|
||||
{#
|
||||
The macro to generate C++ ctor argument list
|
||||
It produce like this: `CKFLOAT _x, CKFLOAT _y, CKFLOAT _z, CKFLOAT _w`
|
||||
#}
|
||||
{% macro argument_list_builder(svars) %}
|
||||
{%- for item in svars -%}
|
||||
CKFLOAT _{{- item -}}{%- if not loop.last %}, {% endif -%}
|
||||
{%- endfor -%}
|
||||
{% endmacro %}
|
||||
|
||||
{#
|
||||
The macro to generate C++ ctor initialize list
|
||||
It produce like this: `x(0.0f), y(0.0f), z(0.0f), w(0.0f)`
|
||||
or this: `x(_x), y(_y), z(_z), w(_w)`
|
||||
according to user request.
|
||||
#}
|
||||
{% macro initialize_list_builder(svars, is_user) %}
|
||||
{%- for item in svars -%}
|
||||
{{- item -}}({%- if is_user -%}_{{- item -}}{%- else -%}0.0f{%- endif -%}){%- if not loop.last %}, {% endif -%}
|
||||
{%- endfor -%}
|
||||
{% endmacro %}
|
||||
63
Assets/CodeGen/VectorGen/VxVectorGen.py
Normal file
63
Assets/CodeGen/VectorGen/VxVectorGen.py
Normal file
@@ -0,0 +1,63 @@
|
||||
import os
|
||||
import io
|
||||
import typing
|
||||
import jinja2
|
||||
|
||||
g_HppTemplateFile: str = 'VxTypes.hpp.jinja'
|
||||
g_CppTemplateFile: str = 'VxTypes.cpp.jinja'
|
||||
|
||||
g_ResultHppFile: str = 'VxTypes.hpp'
|
||||
g_ResultCppFile: str = 'VxTypes.cpp'
|
||||
|
||||
def get_root_directory() -> str:
|
||||
return os.path.dirname(__file__)
|
||||
|
||||
class TemplateRender:
|
||||
m_Loader: jinja2.BaseLoader
|
||||
m_Environment: jinja2.Environment
|
||||
|
||||
m_HppTemplate: jinja2.Template
|
||||
m_CppTemplate: jinja2.Template
|
||||
|
||||
m_OutputHpp: io.TextIOWrapper
|
||||
m_OutputCpp: io.TextIOWrapper
|
||||
|
||||
def __init__(self, output_hpp_path: str, output_cpp_path: str) -> None:
|
||||
self.m_Loader = jinja2.FileSystemLoader(get_root_directory())
|
||||
self.m_Environment = jinja2.Environment(loader=self.m_Loader)
|
||||
|
||||
self.m_HppTemplate = self.m_Environment.get_template(g_HppTemplateFile)
|
||||
self.m_CppTemplate = self.m_Environment.get_template(g_CppTemplateFile)
|
||||
|
||||
self.m_OutputHpp = open(os.path.join(get_root_directory(), output_hpp_path), 'w', encoding='utf-8')
|
||||
self.m_OutputCpp = open(os.path.join(get_root_directory(), output_cpp_path), 'w', encoding='utf-8')
|
||||
|
||||
def __enter__(self):
|
||||
return self
|
||||
|
||||
def __exit__(self, exc_type, exc_value, traceback):
|
||||
self.m_OutputHpp.close()
|
||||
self.m_OutputCpp.close()
|
||||
|
||||
def __render(self, sname: str, is_vector: bool, svars: tuple[str]) -> None:
|
||||
template_argument: dict[str, typing.Any] = {
|
||||
'sname': sname,
|
||||
'is_vector': is_vector,
|
||||
'svars': svars
|
||||
}
|
||||
self.m_OutputHpp.write(self.m_HppTemplate.render(**template_argument))
|
||||
self.m_OutputCpp.write(self.m_CppTemplate.render(**template_argument))
|
||||
|
||||
def render_vector(self, sname: str, svars: tuple[str]) -> None:
|
||||
self.__render(sname, True, svars)
|
||||
|
||||
def render_others(self, sname: str, svars: tuple[str]) -> None:
|
||||
self.__render(sname, False, svars)
|
||||
|
||||
if __name__ == '__main__':
|
||||
with TemplateRender(g_ResultHppFile, g_ResultCppFile) as render:
|
||||
render.render_vector('VxVector2', ('x', 'y', ))
|
||||
render.render_vector('VxVector3', ('x', 'y', 'z', ))
|
||||
render.render_vector('VxVector4', ('x', 'y', 'z', 'w', ))
|
||||
render.render_others('VxQuaternion', ('x', 'y', 'z', 'w', ))
|
||||
render.render_others('VxColor', ('r', 'g', 'b', 'a', ))
|
||||
4
Assets/Debuggers/.gitignore
vendored
Normal file
4
Assets/Debuggers/.gitignore
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
# Ignore test used 3d Object
|
||||
*.bin
|
||||
*.obj
|
||||
*.mtl
|
||||
92
Assets/Debuggers/MeshConv.py
Normal file
92
Assets/Debuggers/MeshConv.py
Normal file
@@ -0,0 +1,92 @@
|
||||
import argparse, io, math, struct
|
||||
|
||||
# setup parser
|
||||
parser = argparse.ArgumentParser(description='The Mesh Converter.')
|
||||
parser.add_argument('-p', '--in-vpos', required=True, type=str, action='store', dest='in_vpos', metavar='vpos.bin')
|
||||
parser.add_argument('-n', '--in-vbml', required=True, type=str, action='store', dest='in_vnml', metavar='vnml.bin')
|
||||
parser.add_argument('-u', '--in-vuv', required=True, type=str, action='store', dest='in_vuv', metavar='vuv.bin')
|
||||
parser.add_argument('-i', '--in-findices', required=True, type=str, action='store', dest='in_findices', metavar='findices.bin')
|
||||
parser.add_argument('-o', '--out-obj', required=True, type=str, action='store', dest='out_obj', metavar='mesh.obj')
|
||||
parser.add_argument('-m', '--out-mtl', required=True, type=str, action='store', dest='out_mtl', metavar='mesh.mtl')
|
||||
|
||||
Vector = tuple[float]
|
||||
Indices = tuple[int]
|
||||
|
||||
def GetFileLength(fs: io.BufferedReader) -> int:
|
||||
pos = fs.tell()
|
||||
fs.seek(0, io.SEEK_END)
|
||||
fsize = fs.tell()
|
||||
fs.seek(pos, io.SEEK_SET)
|
||||
return fsize
|
||||
|
||||
def EvaluateCount(filename: str, unit_size: int) -> int:
|
||||
with open(filename, 'rb') as fs:
|
||||
filesize = GetFileLength(fs)
|
||||
count, modrem = divmod(filesize, unit_size)
|
||||
if modrem != 0:
|
||||
raise Exception("invalid file length")
|
||||
return count
|
||||
|
||||
def AssertFileSize(fs: io.BufferedReader, expected_size: int):
|
||||
if expected_size != GetFileLength(fs):
|
||||
raise Exception("invalid file length")
|
||||
|
||||
def ReadFloats(filename: str, count: int) -> tuple[float]:
|
||||
with open(filename, 'rb') as fs:
|
||||
# construct class
|
||||
cstruct = struct.Struct(f'<{count}f')
|
||||
# assert file size
|
||||
AssertFileSize(fs, cstruct.size)
|
||||
# read
|
||||
return cstruct.unpack(fs.read(cstruct.size))
|
||||
|
||||
def ReadShorts(filename: str, count: int) -> tuple[float]:
|
||||
with open(filename, 'rb') as fs:
|
||||
# construct class
|
||||
cstruct = struct.Struct(f'<{count}H')
|
||||
# assert file size
|
||||
AssertFileSize(fs, cstruct.size)
|
||||
# read
|
||||
return cstruct.unpack(fs.read(cstruct.size))
|
||||
|
||||
def RecoupleTuple(fulllist: tuple, couple_count: int) -> tuple[tuple]:
|
||||
count, modrem = divmod(len(fulllist), couple_count)
|
||||
if modrem != 0:
|
||||
raise Exception("invalid tuple length")
|
||||
|
||||
return tuple(map(lambda x: tuple(fulllist[x * couple_count:x * couple_count + couple_count]), range(count)))
|
||||
|
||||
def GenerateObj(filename: str, vpos: tuple[Vector], vnml: tuple[Vector], vuv: tuple[Vector], findices: tuple[Indices]):
|
||||
with open(filename, 'w', encoding='utf-8') as fs:
|
||||
for v in vpos:
|
||||
fs.write('v {0} {1} {2}\n'.format(v[0], v[1], v[2]))
|
||||
for v in vnml:
|
||||
fs.write('vn {0} {1} {2}\n'.format(v[0], v[1], v[2]))
|
||||
for v in vuv:
|
||||
fs.write('vt {0} {1}\n'.format(v[0], v[1]))
|
||||
for f in findices:
|
||||
fs.write('f {0}/{0}/{0} {1}/{1}/{1} {2}/{2}/{2}\n'.format(f[0] + 1, f[1] + 1, f[2] + 1))
|
||||
fs.write('g obj\n')
|
||||
|
||||
if __name__ == '__main__':
|
||||
# parse arg
|
||||
args = parser.parse_args()
|
||||
|
||||
#input("Prepare VertexPositions please.")
|
||||
vertexcount = EvaluateCount(args.in_vpos, 3 * 4) # 3 float(4 bytes)
|
||||
print(f'Vertex Count Evaluated: {vertexcount}')
|
||||
vpos = RecoupleTuple(ReadFloats(args.in_vpos, 3 * vertexcount), 3)
|
||||
|
||||
#input("Prepare VertexNormals please.")
|
||||
vnml = RecoupleTuple(ReadFloats(args.in_vnml, 3 * vertexcount), 3)
|
||||
|
||||
#input("Prepare VertexUVs please.")
|
||||
vuv = RecoupleTuple(ReadFloats(args.in_vuv, 2 * vertexcount), 2)
|
||||
|
||||
#input("Prepare FaceIndices please.")
|
||||
facecount = EvaluateCount(args.in_findices, 3 * 2) # 3 WORD(2 bytes)
|
||||
print(f'Face Count Evaluated: {facecount}')
|
||||
findices = RecoupleTuple(ReadShorts(args.in_findices, 3 * facecount), 3)
|
||||
|
||||
GenerateObj(args.out_obj, vpos, vnml, vuv, findices)
|
||||
print('Done')
|
||||
20
Assets/Debuggers/README.md
Normal file
20
Assets/Debuggers/README.md
Normal file
@@ -0,0 +1,20 @@
|
||||
# Tools
|
||||
|
||||
The developer need to know the loaded data whether is correct when testing LibCmo. So we create this folder and you can use Unvirt and the tools located in this folder to test the correction of loaded data.
|
||||
|
||||
Unvirt can show the data of each CKObject, such as Texture, Mesh and etc. For example, Unvirt can provide vertex's position, normal, UV, even the face's indices data for CKMesh. You can use tools to broswer memory to get them, but you couldn't evaluate them how they shape a mesh. This is the reason why this folder existed and in this README I will tell you how to debug the loaded data.
|
||||
|
||||
I suggest you to use HxD to broswer memory, but if you have other softwares, use it freely.
|
||||
|
||||
## CKTexture
|
||||
|
||||
* Install [PixelViewer](https://github.com/carina-studio/PixelViewer) first.
|
||||
* Change profile to `BGRA_8888` (actually is little-endian RGBA8888, but I think the developer of PixelViewer get confused).
|
||||
* The image resolution can be gotten from Uvirt. Set it in PixelViewer.
|
||||
* The image address also can be gotten from Unvirt. Save the memory image data to local file and open it by PixelViewer.
|
||||
|
||||
## CKMesh
|
||||
|
||||
* Have a executable Python.
|
||||
* Save VertexPosition, VertexNormal, VertexUV, FaceIndices data into file according to the given memory address by Unvirt.
|
||||
* Call `MeshConv.py`, set the argument properly, then you will get a converted Wavefront OBJ file.
|
||||
16
Assets/Docs/CKStateChunk/CKStateChunk.css
Normal file
16
Assets/Docs/CKStateChunk/CKStateChunk.css
Normal file
@@ -0,0 +1,16 @@
|
||||
body {
|
||||
font-family: 'Times New Roman', Times, serif;
|
||||
}
|
||||
|
||||
td {
|
||||
min-width: 15em;
|
||||
text-align: left;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
code {
|
||||
font-family: 'Courier New', Courier, monospace;
|
||||
}
|
||||
pre {
|
||||
font-family: 'Courier New', Courier, monospace;
|
||||
}
|
||||
279
Assets/Docs/CKStateChunk/CKStateChunk.html
Normal file
279
Assets/Docs/CKStateChunk/CKStateChunk.html
Normal file
@@ -0,0 +1,279 @@
|
||||
<!DOCTYPE html>
|
||||
<link rel="stylesheet" type="text/css" href="CKStateChunk.css" />
|
||||
<script src="CKStateChunk.js"></script>
|
||||
|
||||
<body>
|
||||
<h1>CKStateChunk Data Structure</h1>
|
||||
<p>
|
||||
NOTE:<br />
|
||||
"Fill Zero" mean that this field still is existed but you should fill zero for it.<br />
|
||||
"Skip" mean that this field is entirely not existed. You should not consider it anymore.
|
||||
</p>
|
||||
|
||||
<h2>Buffer Format</h2>
|
||||
<p>
|
||||
This section will introduce the buffer format of CKStateChunk.<br />
|
||||
Buffer format is the real format of CKStateChunk stored in file.<br />
|
||||
<code>CKStateChunk::ConvertFromBuffer</code> and <code>CKStateChunk::ConvertToBuffer</code> can convert between CKStateChunk and its buffer format.
|
||||
</p>
|
||||
<p>According to the value of CK_STATECHUNK_CHUNKVERSION, we split it into 3 different format.</p>
|
||||
<ul>
|
||||
<li>value < CHUNK_VERSION2: Very Old Format</li>
|
||||
<li>value = CHUNK_VERSION2: Old Format</li>
|
||||
<li>value > CHUNK_VERSION2: New Format</li>
|
||||
</ul>
|
||||
<p>
|
||||
The unit of m_DataDwSize is CKDWORD(uint32), not char(uint8).<br />
|
||||
The core data of CKStateChunk is aligned with 4 byte boundary. so this is the reason why the unit of
|
||||
m_DataDwSize is CKDWORD.<br />
|
||||
Every reading and writing of m_pData should notice this unit issue.
|
||||
</p>
|
||||
<h3>Very Old Format</h3>
|
||||
<table>
|
||||
<tr>
|
||||
<td id="buf-fmt-vold-DataVersion">
|
||||
<code>uint16 m_DataVersion</code>
|
||||
<p>The type of m_DataVersion is CK_STATECHUNK_DATAVERSION.</p>
|
||||
</td>
|
||||
<td id="buf-fmt-vold-ChunkVersion">
|
||||
<code>uint16 m_ChunkVersion</code>
|
||||
<p>The type of m_ChunkVersion is CK_STATECHUNK_CHUNKVERSION.</p>
|
||||
</td>
|
||||
<td id="buf-fmt-vold-ClassId">
|
||||
<code>uint32 m_ClassId</code>
|
||||
<p>The type of m_ClassId is CK_CLASSID.</p>
|
||||
</td>
|
||||
<td id="buf-fmt-vold-DataDwSize">
|
||||
<code>uint32 m_DataDwSize</code>
|
||||
<p>The size of CKStateChunk core data.</p>
|
||||
</td>
|
||||
<td id="buf-fmt-vold-ObjectListSize">
|
||||
<code>uint32 m_ObjectListSize</code>
|
||||
<p>The size of object list.</p>
|
||||
</td>
|
||||
<td id="buf-fmt-vold-ChunkListSize">
|
||||
<code>uint32 m_ChunkListSize</code>
|
||||
<p>The size of chunk list</p>
|
||||
</td>
|
||||
<td id="buf-fmt-vold-pData">
|
||||
<code>uint32[] m_pData</code>
|
||||
<p>The core data. Its length is indicated by m_DataDwSize.</p>
|
||||
</td>
|
||||
<td id="buf-fmt-vold-ObjectList">
|
||||
<code>uint32[] m_ObjectList</code>
|
||||
<p>The object list. Its length is indicated by m_ObjectListSize.</p>
|
||||
</td>
|
||||
<td id="buf-fmt-vold-ChunkList">
|
||||
<code>uint32[] m_ChunkList</code>
|
||||
<p>The chunk list. Its length is indicated by m_ChunkListSize.</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<h3>Old Format</h3>
|
||||
<table>
|
||||
<tr>
|
||||
<td class="ph" target="buf-fmt-vold-DataVersion"></td>
|
||||
<td class="ph" target="buf-fmt-vold-ChunkVersion"></td>
|
||||
<td class="ph" target="buf-fmt-vold-ClassId"></td>
|
||||
<td class="ph" target="buf-fmt-vold-DataDwSize"></td>
|
||||
<td class="ph" target="buf-fmt-vold-ObjectListSize"></td>
|
||||
<td class="ph" target="buf-fmt-vold-ChunkListSize"></td>
|
||||
<td>
|
||||
<code>uint32 m_ManagerListSize</code>
|
||||
<p>The size of manager list</p>
|
||||
</td>
|
||||
<td class="ph" target="buf-fmt-vold-pData"></td>
|
||||
<td class="ph" target="buf-fmt-vold-ObjectList"></td>
|
||||
<td class="ph" target="buf-fmt-vold-ChunkList"></td>
|
||||
<td>
|
||||
<code>uint32[] m_ManagerList</code>
|
||||
<p>The manager list. Its length is indicated by m_ManagerListSize.</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<h3>New Format</h3>
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<code>uint8 m_DataVersion</code>
|
||||
<p>The type of m_DataVersion is CK_STATECHUNK_DATAVERSION.</p>
|
||||
</td>
|
||||
<td>
|
||||
<code>uint8 m_ClassId</code>
|
||||
<p>The type of m_ClassId is CK_CLASSID.</p>
|
||||
</td>
|
||||
<td>
|
||||
<code>uint8 m_ChunkVersion</code>
|
||||
<p>The type of m_ChunkVersion is CK_STATECHUNK_CHUNKVERSION.</p>
|
||||
</td>
|
||||
<td>
|
||||
<code>uint8 m_Options</code>
|
||||
<p>The type of m_Options is CK_STATECHUNK_CHUNKOPTIONS.</p>
|
||||
</td>
|
||||
<td>
|
||||
<code>uint32 m_DataDwSize</code>
|
||||
<p>The size of CKStateChunk core data.</p>
|
||||
</td>
|
||||
<td>
|
||||
<code>uint32[] m_pData</code>
|
||||
<p>The core data. Its length is indicated by m_DataDwSize.</p>
|
||||
</td>
|
||||
<td>
|
||||
<table>
|
||||
<tr>
|
||||
<td><code>uint32 m_ObjectListSize</code></td>
|
||||
<td><code>uint32[] m_ObjectList</code></td>
|
||||
</tr>
|
||||
</table>
|
||||
<p>Enabled when m_Options has CHNK_OPTION_IDS. Skip if not have.</p>
|
||||
</td>
|
||||
<td>
|
||||
<table>
|
||||
<tr>
|
||||
<td><code>uint32 m_ChunkListSize</code></td>
|
||||
<td><code>uint32[] m_ChunkList</code></td>
|
||||
</tr>
|
||||
</table>
|
||||
<p>Enabled when m_Options has CHNK_OPTION_CHN. Skip if not have.</p>
|
||||
</td>
|
||||
<td>
|
||||
<table>
|
||||
<tr>
|
||||
<td><code>uint32 m_ManagerListSize</code></td>
|
||||
<td><code>uint32[] m_ManagerList</code></td>
|
||||
</tr>
|
||||
</table>
|
||||
<p>Enabled when m_Options has CHNK_OPTION_MAN. Skip if not have.</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<h2>Core Data Format</h2>
|
||||
<p>
|
||||
This section introduce the format of CKStateChunk core data, the format of <code>m_pData</code>.<br />
|
||||
The core data is filled by various Identifiers following various data.<br />
|
||||
It is related to the function of CKStateChunk.
|
||||
</p>
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<table id="core-data-fmt-item">
|
||||
<tr>
|
||||
<td><code>uint32 m_Identifier</code></td>
|
||||
<td><code>uint32 m_NextIdentifier</code></td>
|
||||
<td><code>uint32[] m_Payload</code></td>
|
||||
</tr>
|
||||
</table>
|
||||
<p>
|
||||
A single identifier area.<br />
|
||||
m_Identifier is the unique magic word of this identifier area for CKStateChunk locating this area.<br />
|
||||
m_NextIdentifier is a relative pointer. It point to the m_Identifier in next identifier area and is relative to the start of core data.<br />
|
||||
Thus, the size of each identifier area can be simply computed by the absolute diff to adjacent m_NextIdentifier (<code>*m_pData[pos] - pos</code>)<br />
|
||||
m_Payload is the data of this identifier area and can be read or written by various CKStateChunk read write functions.<br />
|
||||
The minimum block size of m_Payload is uint32. It mean that all data must be aligned to uint32 boundary when saving.
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<table class="ph" target="core-data-fmt-item"></table>
|
||||
</td>
|
||||
<td>
|
||||
<code>...</code>
|
||||
<p>More identifier area as much as you like.</p>
|
||||
</td>
|
||||
<td>
|
||||
<table class="ph" target="core-data-fmt-item"></table>
|
||||
<p>The last m_NextIdentifier should set to zero to indicate the end of the series of identifier area.</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<h2>SubChunk Format</h2>
|
||||
<p>According to the value of CK_STATECHUNK_CHUNKVERSION, we split it into 3 different format.</p>
|
||||
<ul>
|
||||
<li>value < CHUNK_VERSION1: Very Old Format</li>
|
||||
<li>value = CHUNK_VERSION1: Old Format</li>
|
||||
<li>value > CHUNK_VERSION1: New Format</li>
|
||||
</ul>
|
||||
<h3>Very Old Format</h3>
|
||||
<table>
|
||||
<tr>
|
||||
<td id="subchk-fmt-vold-SubChunkSize">
|
||||
<code>uint32 m_SubChunkSize</code>
|
||||
<p>The sum of all following variables' size.</p>
|
||||
</td>
|
||||
<td id="subchk-fmt-vold-ClassId">
|
||||
<code>uint32 m_ClassId</code>
|
||||
<p>The CK_CLASSID of sub chunk.</p>
|
||||
</td>
|
||||
<td id="subchk-fmt-vold-DataDwSize">
|
||||
<code>uint32 m_DataDwSize</code>
|
||||
<p>The size of core data in sub chunk.</p>
|
||||
</td>
|
||||
<td>
|
||||
<code><i>uint32 Blank</i></code>
|
||||
<p>A blank. I don't know why</p>
|
||||
</td>
|
||||
<td id="subchk-fmt-vold-pData">
|
||||
<code>uint32[] m_pData</code>
|
||||
<p>The core data. Its length is indicated by m_DataDwSize.</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<h3>Old Format</h3>
|
||||
<table>
|
||||
<tr>
|
||||
<td class="ph" target="subchk-fmt-vold-SubChunkSize"></td>
|
||||
<td class="ph" target="subchk-fmt-vold-ClassId"></td>
|
||||
<td id="subchk-fmt-old-DataVersion">
|
||||
<code>uint16 m_DataVersion</code>
|
||||
<p>The CK_STATECHUNK_DATAVERSION of sub chunk.</p>
|
||||
</td>
|
||||
<td id="subchk-fmt-old-ChunkVersion">
|
||||
<code>uint16 m_ChunkVersion</code>
|
||||
<p>The CK_STATECHUNK_CHUNKVERSION of sub chunk.</p>
|
||||
</td>
|
||||
<td class="ph" target="subchk-fmt-vold-DataDwSize"></td>
|
||||
<td id="subchk-fmt-old-ObjectListSize">
|
||||
<code>uint32 m_ObjectListSize</code>
|
||||
<p>The size of sub chunk object list.</p>
|
||||
</td>
|
||||
<td id="subchk-fmt-old-ChunkListSize">
|
||||
<code>uint32 m_ChunkListSize</code>
|
||||
<p>The size of sub chunk chunk list</p>
|
||||
</td>
|
||||
<td class="ph" target="subchk-fmt-vold-pData"></td>
|
||||
<td id="subchk-fmt-old-ObjectList">
|
||||
<code>uint32[] m_ObjectList</code>
|
||||
<p>The object list. Its length is indicated by m_ObjectListSize.</p>
|
||||
</td>
|
||||
<td id="subchk-fmt-old-ChunkList">
|
||||
<code>uint32[] m_ChunkList</code>
|
||||
<p>The chunk list. Its length is indicated by m_ChunkListSize.</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<h3>New Format</h3>
|
||||
<table>
|
||||
<tr>
|
||||
<td class="ph" target="subchk-fmt-vold-SubChunkSize"></td>
|
||||
<td class="ph" target="subchk-fmt-vold-ClassId"></td>
|
||||
<td class="ph" target="subchk-fmt-old-DataVersion"></td>
|
||||
<td class="ph" target="subchk-fmt-old-ChunkVersion"></td>
|
||||
<td class="ph" target="subchk-fmt-vold-DataDwSize"></td>
|
||||
<td class="ph" target="subchk-fmt-old-ObjectListSize"></td>
|
||||
<td class="ph" target="subchk-fmt-old-ChunkListSize"></td>
|
||||
<td>
|
||||
<code>uint32 m_ManagerListSize</code>
|
||||
<p>The size of sub chunk manager list</p>
|
||||
</td>
|
||||
<td class="ph" target="subchk-fmt-vold-pData"></td>
|
||||
<td class="ph" target="subchk-fmt-old-ObjectList"></td>
|
||||
<td class="ph" target="subchk-fmt-old-ChunkList"></td>
|
||||
<td>
|
||||
<code>uint32[] m_ManagerList</code>
|
||||
<p>The manager list. Its length is indicated by m_ManagerListSize.</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</body>
|
||||
39
Assets/Docs/CKStateChunk/CKStateChunk.js
Normal file
39
Assets/Docs/CKStateChunk/CKStateChunk.js
Normal file
@@ -0,0 +1,39 @@
|
||||
|
||||
function FixTableStyle() {
|
||||
let tables = document.querySelectorAll("table");
|
||||
for (let index = 0; index < tables.length; index++) {
|
||||
let singletable = tables[index];
|
||||
singletable.setAttribute("border", "1");
|
||||
singletable.setAttribute("cellspacing", "1");
|
||||
singletable.setAttribute("cellpadding", "10");
|
||||
}
|
||||
}
|
||||
|
||||
function TableCopyer() {
|
||||
let phs = document.querySelectorAll(".ph");
|
||||
for (let index = 0; index < phs.length; index++) {
|
||||
let ph = phs[index];
|
||||
let phparent = ph.parentNode;
|
||||
|
||||
let phtarget = ph.getAttribute("target");
|
||||
if (phtarget === null) {
|
||||
phparent.removeChild(ph);
|
||||
continue;
|
||||
}
|
||||
|
||||
let target = document.querySelector("#" + phtarget);
|
||||
if (target === null) {
|
||||
phparent.removeChild(ph);
|
||||
continue;
|
||||
}
|
||||
|
||||
let clonetarget = target.cloneNode(true);
|
||||
clonetarget.removeAttribute("id");
|
||||
phparent.replaceChild(clonetarget, ph);
|
||||
}
|
||||
}
|
||||
|
||||
window.onload=function() {
|
||||
FixTableStyle();
|
||||
TableCopyer();
|
||||
};
|
||||
12
Assets/Docs/IDAExportAddrConv.py
Normal file
12
Assets/Docs/IDAExportAddrConv.py
Normal file
@@ -0,0 +1,12 @@
|
||||
def Conv(strl: str):
|
||||
if len(strl) & 3 != 0:
|
||||
print('Invalid length!')
|
||||
return
|
||||
|
||||
idaBytes = tuple(strl[i:i+2] for i in range(0, len(strl), 2))
|
||||
for i in range(0, len(idaBytes), 4):
|
||||
print(idaBytes[i+3] + idaBytes[i+2] + idaBytes[i+1] + idaBytes[i])
|
||||
|
||||
while True:
|
||||
Conv(input("data> "))
|
||||
|
||||
402
Assets/Docs/Recorder.txt
Normal file
402
Assets/Docs/Recorder.txt
Normal file
@@ -0,0 +1,402 @@
|
||||
CKFile in VT21: 0xC8, 200, count50; in VT25: 0xE0, 224, count 56
|
||||
lost 24 byte, 6 fields or 2 lists
|
||||
|
||||
|
||||
|
||||
Important CK Class size
|
||||
CKObject no change. 0x14(20)
|
||||
CKSceneObject no change 0x1C(28), share Load/Save with CKObject
|
||||
|
||||
CKBehavior no change 0x6C(108)
|
||||
CKBeObject 0x50(80) count 20
|
||||
|
||||
CKGroup 0x68(104) count 26
|
||||
CKMaterial 0xF0(240) count 90
|
||||
CKTexture 0x94(148) count 52
|
||||
CKMesh 0x104(260) count 65
|
||||
|
||||
CKRenderObject 0x58(88) count 22, share Load/Save with CKBeObject
|
||||
CK3dEntity 0x1A8(424) count 106
|
||||
CK3dObject 0x1A8(424) count 106 same as CK3dEntity
|
||||
|
||||
|
||||
|
||||
m_FileName
|
||||
in VT21 +34, 136
|
||||
in VT25 +31, 124
|
||||
|
||||
m_MappedFile
|
||||
in VT21 +37, 148
|
||||
in VT25 +34, 136
|
||||
|
||||
m_Context
|
||||
in VT21 +35, 140
|
||||
in VT25 +32, 128
|
||||
|
||||
VxMemoryMappedFile and CKFileInfo seems no change
|
||||
CKFileObject still no change
|
||||
CKFilePluginDependencies still no change
|
||||
CKFileManagerData no change (12)
|
||||
|
||||
CKStateChunk is 0x28u black box
|
||||
CKBufferParser also is 0x10u black box
|
||||
|
||||
typedef char* CKSTRING;
|
||||
typedef char CKCHAR;
|
||||
typedef int CKBOOL;
|
||||
typedef unsigned char CKBYTE;
|
||||
typedef unsigned int CKDWORD;
|
||||
typedef unsigned short CKWORD;
|
||||
typedef int CKERROR;
|
||||
typedef void* CKSOUNDHANDLE;
|
||||
typedef int CKParameterType;
|
||||
typedef int CKOperationType;
|
||||
typedef int CKMessageType;
|
||||
typedef int CKAttributeType;
|
||||
typedef int CKAttributeCategory;
|
||||
|
||||
|
||||
struct CKGUID {
|
||||
DWORD d1,d2;
|
||||
};
|
||||
|
||||
struct XBaseString {
|
||||
// the string
|
||||
char* m_Buffer;
|
||||
// the length of the string
|
||||
WORD m_Length;
|
||||
// the allocated size
|
||||
WORD m_Allocated;
|
||||
};
|
||||
|
||||
struct XArray {
|
||||
// elements start {secret}
|
||||
DWORD* m_Begin;
|
||||
// elements end {secret}
|
||||
DWORD* m_End;
|
||||
// reserved end {secret}
|
||||
DWORD* m_AllocatedEnd;
|
||||
};
|
||||
struct XIntArray {
|
||||
int* m_Begin;
|
||||
int* m_End;
|
||||
int* m_AllocatedEnd;
|
||||
};
|
||||
struct XClassArray {
|
||||
DWORD* m_Begin;
|
||||
DWORD* m_End;
|
||||
DWORD* m_AllocatedEnd;
|
||||
};
|
||||
struct XSArray {
|
||||
DWORD* m_Begin;
|
||||
DWORD* m_End;
|
||||
};
|
||||
struct XBitArray {
|
||||
DWORD m_Data_Flags;
|
||||
DWORD m_Size;
|
||||
};
|
||||
|
||||
struct CKAttributeVal {
|
||||
CKAttributeType AttribType;
|
||||
CK_ID Parameter;
|
||||
};
|
||||
|
||||
struct VxImageDescEx {
|
||||
int Size; // Size of the structure
|
||||
DWORD Flags; // Reserved for special formats (such as compressed ) 0 otherwise
|
||||
|
||||
int Width; // Width in pixel of the image
|
||||
int Height; // Height in pixel of the image
|
||||
union {
|
||||
int BytesPerLine; // Pitch (width in bytes) of the image
|
||||
int TotalImageSize; // For compressed image (DXT1...) the total size of the image
|
||||
};
|
||||
int BitsPerPixel; // Number of bits per pixel
|
||||
union {
|
||||
DWORD RedMask; // Mask for Red component
|
||||
DWORD BumpDuMask; // Mask for Bump Du component
|
||||
};
|
||||
union {
|
||||
DWORD GreenMask; // Mask for Green component
|
||||
DWORD BumpDvMask; // Mask for Bump Dv component
|
||||
};
|
||||
union {
|
||||
DWORD BlueMask; // Mask for Blue component
|
||||
DWORD BumpLumMask; // Mask for Luminance component
|
||||
|
||||
};
|
||||
DWORD AlphaMask; // Mask for Alpha component
|
||||
|
||||
short BytesPerColorEntry; // ColorMap Stride
|
||||
short ColorMapEntries; // If other than 0 image is palletized
|
||||
|
||||
BYTE* ColorMap; // Palette colors
|
||||
BYTE* Image; // Image
|
||||
};
|
||||
|
||||
// <T, K> = <int, CK_ID>
|
||||
struct XHashTable_int_int_::Entry
|
||||
{
|
||||
int key;
|
||||
int data;
|
||||
struct XHashTable_int_int_::Entry *next;
|
||||
} *XHashTable_int_int_::pEntry;
|
||||
struct XHashTable_int_int_ {
|
||||
struct XHashTable_int_int_::XSArray_pEntry_ {
|
||||
XHashTable_int_int_::pEntry* m_Begin;
|
||||
XHashTable_int_int_::pEntry* m_End;
|
||||
}m_Table;
|
||||
struct XHashTable_int_int_::XClassArray_pEntry_ {
|
||||
XHashTable_int_int_::Entry* m_Begin;
|
||||
XHashTable_int_int_::Entry* m_End;
|
||||
XHashTable_int_int_::Entry* m_AllocatedEnd;
|
||||
}m_Pool;
|
||||
};
|
||||
struct XHashTable_int_int_::Iterator {
|
||||
XHashTable_int_int_::pEntry m_Node;
|
||||
XHashTable_int_int_* m_Table;
|
||||
};
|
||||
typedef XHashTable_int_int_ XFileObjectsTable;
|
||||
typedef XHashTable_int_int_ XAttributeList;
|
||||
|
||||
|
||||
struct CKObject {
|
||||
DWORD* vtable;
|
||||
CK_ID m_ID;
|
||||
CKSTRING m_Name;
|
||||
CKDWORD m_ObjectFlags;
|
||||
CKContext *m_Context;
|
||||
};
|
||||
|
||||
struct CKSceneObject : CKObject {
|
||||
XBitArray m_Scenes;
|
||||
};
|
||||
struct CKBeObject : CKSceneObject {
|
||||
XBitArray m_Groups;
|
||||
XArray* m_ScriptArray;
|
||||
XArray* m_LastFrameMessages;
|
||||
DWORD m_Waiting; // expanded from unsigned short
|
||||
DWORD m_Priority; // expanded from signed short
|
||||
float m_LastExecutionTime;
|
||||
XAttributeList* m_Attributes;
|
||||
CKDWORD* m_unknow15;
|
||||
CKDWORD m_unknow16;
|
||||
CKDWORD m_AttributeCount;
|
||||
CKDWORD m_unknow18;
|
||||
CKDWORD m_unknow19;
|
||||
};
|
||||
|
||||
struct BehaviorBlockData{};
|
||||
struct BehaviorGraphData{};
|
||||
struct CKBehavior : CKSceneObject {
|
||||
CK_ID m_Owner;
|
||||
CK_ID m_BehParent;
|
||||
XSObjectPointerArray m_InputArray;
|
||||
XSObjectPointerArray m_OutputArray;
|
||||
XSObjectPointerArray m_InParameter;
|
||||
XSObjectPointerArray m_OutParameter;
|
||||
XSObjectPointerArray m_LocalParameter;
|
||||
CK_CLASSID m_CompatibleClassID;
|
||||
int m_Priority;
|
||||
CKDWORD m_Flags;
|
||||
CKStateChunk * m_InterfaceChunk;
|
||||
BehaviorGraphData* m_GraphData;
|
||||
BehaviorBlockData* m_BlockData;
|
||||
float m_LastExecutionTime;
|
||||
CK_ID m_InputTargetParam;
|
||||
};
|
||||
|
||||
struct CKFileInfo
|
||||
{
|
||||
DWORD ProductVersion; // Virtools Version (Dev/Creation). (CK_VIRTOOLS_VERSION)
|
||||
DWORD ProductBuild; // Virtools Build Number.
|
||||
DWORD FileWriteMode; // Options used to save this file. (CK_FILE_WRITEMODE)
|
||||
DWORD FileVersion; // Version of file format when file was saved.
|
||||
DWORD CKVersion; // Version of CK when file was saved.
|
||||
DWORD FileSize; // Size of file in bytes.
|
||||
DWORD ObjectCount; // Number of objects stored in the file.
|
||||
DWORD ManagerCount; // Number of managers which saved data in the file.
|
||||
DWORD MaxIDSaved; // Maximum Object identifier saved
|
||||
DWORD Crc; // Crc of data
|
||||
DWORD Hdr1PackSize; // Reserved
|
||||
DWORD Hdr1UnPackSize; // Reserved
|
||||
DWORD DataPackSize; // Reserved
|
||||
DWORD DataUnPackSize; // Reserved
|
||||
};
|
||||
|
||||
struct CKFileObject {
|
||||
CK_ID Object; // ID of the object being load/saved (as it will be/was saved in the file)
|
||||
CK_ID CreatedObject; // ID of the object being created
|
||||
CK_CLASSID ObjectCid; // Class Identifier of the object
|
||||
CKObject* ObjPtr; // A pointer to the object itself (as CreatedObject when loading)
|
||||
CKSTRING Name; // Name of the Object
|
||||
CKStateChunk* Data; // A CKStateChunk that contains object information
|
||||
int PostPackSize; // When compressed chunk by chunk : size of Data after compression
|
||||
int PrePackSize; // When compressed chunk by chunk : size of Data before compression
|
||||
CK_FO_OPTIONS Options; // When loading an object it may be renamed , use to replace another object
|
||||
int FileIndex; // Position of the object data inside uncompressed file buffer
|
||||
CKDWORD SaveFlags; // Flags used when this object was saved.
|
||||
};
|
||||
|
||||
struct CKFileManagerData {
|
||||
CKStateChunk *data;
|
||||
CKGUID Manager;
|
||||
}
|
||||
|
||||
struct CKFilePluginDependencies{
|
||||
int m_PluginCategory;
|
||||
XArray/*<CKGUID>*/ m_Guids;
|
||||
XBitArray ValidGuids;
|
||||
};
|
||||
|
||||
struct VxMemoryMappedFile {
|
||||
void* m_hFile;
|
||||
void* m_hFileMapping; // Handle of memory mapped file
|
||||
void* m_pMemoryMappedFileBase;
|
||||
DWORD m_cbFile;
|
||||
DWORD m_errCode;
|
||||
};
|
||||
|
||||
struct CKStateChunkParser {
|
||||
DWORD m_CurrentPos;
|
||||
DWORD m_DataSize;
|
||||
DWORD m_PrevIdentifierPos;
|
||||
};
|
||||
struct IntListStruct {
|
||||
DWORD m_Count;
|
||||
DWORD m_Allocated;
|
||||
DWORD* m_pData;
|
||||
};
|
||||
struct CKStateChunkProp {
|
||||
WORD m_DataVersion;
|
||||
WORD m_ChunkVersion;
|
||||
};
|
||||
struct CKStateChunk {
|
||||
CK_CLASSID m_ClassId;
|
||||
|
||||
DWORD m_DataDwordSize;
|
||||
DWORD* m_pData;
|
||||
|
||||
CKStateChunkProp m_ChunkProps;
|
||||
|
||||
CKStateChunkParser* m_Parser;
|
||||
|
||||
IntListStruct* m_ObjectIdList;
|
||||
IntListStruct* m_SubChunkList;
|
||||
IntListStruct* m_ManagerIntList;
|
||||
|
||||
CKFile* m_BindFile;
|
||||
DWORD m_unknow;
|
||||
};
|
||||
struct ChunkIteratorData { // 0x40 count 16
|
||||
DWORD m_ChunkVersion;
|
||||
DWORD* m_pData;
|
||||
DWORD m_DataDwordSize;
|
||||
DWORD unknow_3;
|
||||
DWORD* m_ObjList_pData;
|
||||
DWORD m_ObjList_Count;
|
||||
DWORD* m_ChkList_pData;
|
||||
DWORD m_ChkList_Count;
|
||||
|
||||
DWORD unknow_8;
|
||||
DWORD unknow_9;
|
||||
DWORD unknow_10;
|
||||
DWORD unknow_11;
|
||||
DWORD unknow_12;
|
||||
DWORD unknow_13;
|
||||
|
||||
CKDependenciesContext* m_DepCtx;
|
||||
CKContext* m_Ctx;
|
||||
};
|
||||
|
||||
|
||||
|
||||
struct CKBufferParser {
|
||||
char* m_MemBegin;
|
||||
DWORD m_MemPos;
|
||||
CKBOOL m_NeedManualFree;
|
||||
DWORD m_MemSize;
|
||||
};
|
||||
|
||||
struct XArray_CKFileObject_ {
|
||||
CKFileObject* m_Begin;
|
||||
CKFileObject* m_End;
|
||||
CKFileObject* m_AllocatedEnd;
|
||||
};
|
||||
struct XArray_CKFileManagerData_ {
|
||||
CKFileManagerData* m_Begin;
|
||||
CKFileManagerData* m_End;
|
||||
CKFileManagerData* m_AllocatedEnd;
|
||||
};
|
||||
struct XClassArray_CKFilePluginDependencies_ {
|
||||
CKFilePluginDependencies* m_Begin;
|
||||
CKFilePluginDependencies* m_End;
|
||||
CKFilePluginDependencies* m_AllocatedEnd;
|
||||
};
|
||||
struct XClassArray_XIntArray_ {
|
||||
XIntArray* m_Begin;
|
||||
XIntArray* m_End;
|
||||
XIntArray* m_AllocatedEnd;
|
||||
};
|
||||
struct XClassArray_XString_ {
|
||||
XString* m_Begin;
|
||||
XString* m_End;
|
||||
XString* m_AllocatedEnd;
|
||||
};
|
||||
|
||||
struct CKFile {
|
||||
// 0
|
||||
int m_SaveIDMax; // Maximum CK_ID found when saving or loading objects {secret}
|
||||
XArray_CKFileObject_ m_FileObjects; // List of objects being saved / loaded {secret}
|
||||
XArray_CKFileManagerData_ m_ManagersData; // Manager Data loaded {secret}
|
||||
XClassArray_CKFilePluginDependencies_ m_PluginsDep; // Plugins dependencies for this file {secret}
|
||||
XClassArray_XIntArray_ m_IndexByClassId; // List of index in the m_FileObjects table sorted by ClassID {secret}
|
||||
XClassArray_XString_ m_IncludedFiles; // List of files that should be inserted in the CMO file. {secret}
|
||||
// 16
|
||||
CKFileInfo m_FileInfo; // Headers summary {secret}
|
||||
// 16 + 14 = 30
|
||||
// guess
|
||||
DWORD unknow_fields;
|
||||
XBitArray m_AlreadySavedMask; // BitArray of IDs already saved {secret}
|
||||
// 30 + 3 = 33
|
||||
CKDWORD m_Flags; // Flags used to save file {secret} CK_LOAD_FLAGS
|
||||
CKSTRING m_FileName; // Current file name {secret}
|
||||
CKContext* m_Context; // CKContext on which file is loaded/Saved {secret}
|
||||
CKBufferParser* m_Parser;
|
||||
VxMemoryMappedFile* m_MappedFile;
|
||||
// 33 + 5 = 38
|
||||
// guess
|
||||
XFileObjectsTable m_ObjectsHashTable;
|
||||
// 38 + 5 = 43
|
||||
//[guess]
|
||||
CKBOOL m_SceneSaved;
|
||||
CKBOOL m_ReadFileDataDone;
|
||||
// 43 + 2 = 45
|
||||
XBitArray m_AlreadyReferencedMask; // BitArray of IDs already referenced {secret}
|
||||
XObjectPointerArray m_ReferencedObjects;
|
||||
// 45 + 2 + 3 = 50
|
||||
};
|
||||
|
||||
VxTimeProfiler m_Chrono;
|
||||
|
||||
XFileObjectsTable m_ObjectsHashTable;
|
||||
//#ifdef USECHUNKTABLE
|
||||
XClassArray/*<CKFileChunk>*/ m_FileChunks; // Instead of allocating chunk per chunk a whole memory buffer is allocated to store all chunks and their readers
|
||||
CKFileChunk* m_ObjectChunks;
|
||||
CKFileChunk* m_ManagersChunks;
|
||||
VxMemoryPool m_ChunkBuffers; // Store all decompressed file buffer in memory so that all chunks directly points to it...
|
||||
// can only work for recent files ( > 2.0)
|
||||
BYTE* m_CurrentChunkBufferPtr;
|
||||
//#endif
|
||||
|
||||
CKBOOL m_ReadFileDataDone;
|
||||
CKBOOL m_SceneSaved;
|
||||
//-----------
|
||||
XIntArray m_DuplicateNameFounds; // A List of file object index for which a existing object with the same name has been
|
||||
// found, this list is build if the load option contains CK_LOAD_AUTOMATICMODE or CK_LOAD_DODIALOG
|
||||
|
||||
//-----
|
||||
XBitArray m_AlreadySavedMask; // BitArray of IDs already saved {secret}
|
||||
XBitArray m_AlreadyReferencedMask; // BitArray of IDs already referenced {secret}
|
||||
XObjectPointerArray m_ReferencedObjects;
|
||||
};
|
||||
Reference in New Issue
Block a user