@@ -46,14 +46,14 @@ import assimp.format.ProgressHandler
4646import glm_.BYTES
4747import glm_.i
4848import glm_.size
49- import assimp.AiPostProcessSteps as Pps
5049import java.io.File
5150import java.net.URI
5251import java.net.URL
5352import java.nio.ByteBuffer
5453import java.nio.file.Path
5554import java.nio.file.Paths
5655import kotlin.reflect.KMutableProperty0
56+ import assimp.AiPostProcessStep as Pps
5757
5858/* * CPP-API: The Importer class forms an C++ interface to the functionality of the Open Asset Import Library.
5959 *
@@ -79,11 +79,6 @@ class Importer
7979 */
8080constructor () {
8181
82- companion object {
83- /* * The upper limit for hints. */
84- val MaxLenHint = 200
85- }
86-
8782 // Just because we don't want you to know how we're hacking around.
8883 internal val impl = ImporterPimpl () // allocate the pimpl first
8984
@@ -115,7 +110,7 @@ constructor() {
115110 val st = imp.extensionList
116111 var baked = " "
117112 st.forEach {
118- if (ASSIMP .BUILD . DEBUG && isExtensionSupported(it))
113+ if (ASSIMP .DEBUG && isExtensionSupported(it))
119114 logger.warn { " The file extension $it is already in use" }
120115 baked + = " $it "
121116 }
@@ -191,8 +186,9 @@ constructor() {
191186
192187 var ioHandler: IOSystem
193188 get() = impl.ioSystem
194-
195- set(value) { if (value != null ) impl.ioSystem = value}
189+ set(value) {
190+ if (value != null ) impl.ioSystem = value
191+ }
196192
197193 /* * Checks whether a default progress handler is active
198194 * A default handler is active as long the application doesn't supply its own custom progress handler via
@@ -224,10 +220,13 @@ constructor() {
224220 /* * Get the currently set progress handler */
225221 val progressHandler get() = impl.progressHandler
226222
227- fun readFile (url : URL , flags : Int = 0) = readFile(url.toURI(), flags)
228- fun readFile (uri : URI , flags : Int = 0) = readFile(Paths .get(uri), flags)
229- fun readFile (path : Path , flags : Int = 0) = readFile(path.toAbsolutePath().toString(), flags)
230- fun readFile (file : String , flags : Int = 0) = readFile(file, ioHandler, flags)
223+ @JvmOverloads
224+ fun readFile (url : URL , flags : AiPostProcessStepsFlags = 0) = readFile(url.toURI(), flags)
225+ @JvmOverloads
226+ fun readFile (uri : URI , flags : AiPostProcessStepsFlags = 0) = readFile(Paths .get(uri), flags)
227+ @JvmOverloads
228+ fun readFile (path : Path , flags : AiPostProcessStepsFlags = 0) = readFile(path.toAbsolutePath().toString(), flags)
229+ fun readFile (file : String , flags : AiPostProcessStepsFlags = 0) = readFile(file, ioHandler, flags)
231230
232231 /* * Reads the given file and returns its contents if successful.
233232 *
@@ -246,7 +245,8 @@ constructor() {
246245 *
247246 * @note Assimp is able to determine the file format of a file automatically.
248247 */
249- fun readFile (file : String , ioSystem : IOSystem = this.ioHandler, flags : Int = 0): AiScene ? {
248+ @JvmOverloads
249+ fun readFile (file : String , ioSystem : IOSystem = this.ioHandler, flags : AiPostProcessStepsFlags = 0): AiScene ? {
250250
251251 writeLogOpening(file)
252252
@@ -270,7 +270,7 @@ constructor() {
270270// }
271271
272272 // Find an worker class which can handle the file
273- val imp = impl.importer.find { it.canRead(file, ioHandler,false ) }
273+ val imp = impl.importer.find { it.canRead(file, ioHandler, false ) }
274274
275275 if (imp == null ) {
276276 // not so bad yet ... try format auto detection.
@@ -317,7 +317,7 @@ constructor() {
317317 // If successful, apply all active post processing steps to the imported data
318318 if (impl.scene != null ) {
319319
320- if (! ASSIMP .BUILD . NO .VALIDATEDS_PROCESS )
320+ if (! ASSIMP .NO .VALIDATEDS_PROCESS )
321321 // The ValidateDS process is an exception. It is executed first, even before ScenePreprocessor is called.
322322 if (flags has Pps .ValidateDataStructure ) {
323323 ValidateDSProcess .executeOnScene(this )
@@ -405,7 +405,7 @@ constructor() {
405405 // In debug builds: run basic flag validation
406406 assert (_validateFlags (flags))
407407 logger.info(" Entering post processing pipeline" )
408- if (! ASSIMP .BUILD . NO .VALIDATEDS_PROCESS )
408+ if (! ASSIMP .NO .VALIDATEDS_PROCESS )
409409 /* The ValidateDS process plays an exceptional role. It isn't contained in the global list of post-processing
410410 steps, so we need to call it manually. */
411411 if (flags has Pps .ValidateDataStructure ) {
@@ -417,17 +417,17 @@ constructor() {
417417 if (impl.scene == null ) return null
418418 }
419419 var flags = flags
420- if (ASSIMP .BUILD . DEBUG ) {
420+ if (ASSIMP .DEBUG ) {
421421 if (impl.extraVerbose) {
422- if (ASSIMP .BUILD . NO .VALIDATEDS_PROCESS )
422+ if (ASSIMP .NO .VALIDATEDS_PROCESS )
423423 logger.error { " Verbose Import is not available due to build settings" }
424424 flags = flags or Pps .ValidateDataStructure
425425 }
426426 } else if (impl.extraVerbose)
427427 logger.warn(" Not a debug build, ignoring extra verbose setting" )
428428
429429// std::unique_ptr<Profiler> profiler (GetPropertyInteger(AI_CONFIG_GLOB_MEASURE_TIME, 0)?new Profiler():NULL); TODO
430- for (a in 0 until impl.postProcessingSteps.size ) {
430+ for (a in impl.postProcessingSteps.indices ) {
431431 val process = impl.postProcessingSteps[a]
432432 impl.progressHandler.updatePostProcess(a, impl.postProcessingSteps.size)
433433 if (process.isActive(flags)) {
@@ -440,8 +440,8 @@ constructor() {
440440// }
441441 }
442442 if (impl.scene == null ) break
443- if (ASSIMP .BUILD . DEBUG ) {
444- if (ASSIMP .BUILD . NO .VALIDATEDS_PROCESS ) continue
443+ if (ASSIMP .DEBUG ) {
444+ if (ASSIMP .NO .VALIDATEDS_PROCESS ) continue
445445 // If the extra verbose mode is active, execute the ValidateDataStructureStep again - after each step
446446 if (impl.extraVerbose) {
447447 logger.debug { " Verbose Import: revalidating data structures" }
@@ -468,15 +468,15 @@ constructor() {
468468 if (null == rootProcess) return impl.scene
469469 // In debug builds: run basic flag validation
470470 logger.info { " Entering customized post processing pipeline" }
471- if (! ASSIMP .BUILD . NO .VALIDATEDS_PROCESS ) {
471+ if (! ASSIMP .NO .VALIDATEDS_PROCESS ) {
472472 // The ValidateDS process plays an exceptional role. It isn't contained in the global
473473 // list of post-processing steps, so we need to call it manually.
474474 if (requestValidation) {
475475 ValidateDSProcess .executeOnScene(this )
476476 if (impl.scene == null ) return null
477477 }
478478 }
479- if (ASSIMP .BUILD . DEBUG && impl.extraVerbose && ASSIMP . BUILD .NO .VALIDATEDS_PROCESS )
479+ if (ASSIMP .DEBUG && impl.extraVerbose && ASSIMP .NO .VALIDATEDS_PROCESS )
480480 logger.error { " Verbose Import is not available due to build settings" }
481481 else if (impl.extraVerbose)
482482 logger.warn { " Not a debug build, ignoring extra verbose setting" }
@@ -701,7 +701,7 @@ constructor() {
701701 val flags = compileFlags
702702 logger.debug {
703703 var message = " Assimp $versionMajor .$versionMinor .$versionRevision "
704- if (ASSIMP .BUILD . DEBUG ) message + = " debug"
704+ if (ASSIMP .DEBUG ) message + = " debug"
705705 }
706706 }
707707
@@ -724,5 +724,10 @@ constructor() {
724724 for (i in 0 until node.numChildren)
725725 addNodeWeight(scene, node.children[i])
726726 }
727+
728+ companion object {
729+ /* * The upper limit for hints. */
730+ val MaxLenHint = 200
731+ }
727732}
728733
0 commit comments