diff --git a/libs/loadable/loadable.nim b/libs/loadable/loadable.nim index 4d3a4f7..83e3a66 100644 --- a/libs/loadable/loadable.nim +++ b/libs/loadable/loadable.nim @@ -48,7 +48,6 @@ import std/tables import std/times import std/os import arr_ref # for SliceMem -import sugar type LoadableResourceStatus* = enum NotStarted diff --git a/libs/oiio/oiio.nim b/libs/oiio/oiio.nim index 251d135..5e112bf 100644 --- a/libs/oiio/oiio.nim +++ b/libs/oiio/oiio.nim @@ -1,6 +1,4 @@ -import std/strformat - {.compile("oiio.cpp","-std=c++14").} {.passL: "-lOpenImageIO -lOpenImageIO_Util".} diff --git a/src/gpu_formats/texture_decode.nim b/src/gpu_formats/texture_decode.nim index 4588179..3ad6421 100644 --- a/src/gpu_formats/texture_decode.nim +++ b/src/gpu_formats/texture_decode.nim @@ -39,9 +39,10 @@ proc swap_lines(p: pointer, line_stride, line_count: int) {.gcsafe.} import std/strformat import vmath except Quat, quat import arr_ref -import float16 const myouConvertHdrToFloat16 {.booldefine.} = not defined(myouUseOpenImageIO) +when myouConvertHdrToFloat16: + import float16 when defined(myouUseOpenImageIO): import oiio @@ -104,9 +105,10 @@ template toOpenArrayByte(p: pointer, a,b: untyped): untyped = # template toOpenArray[T](p: pointer, a,b: untyped): untyped = # cast[ptr UncheckedArray[T]](p).toOpenArray(a,b) -proc f32_to_f16(source: ptr UncheckedArray[float32], dest: ptr UncheckedArray[Float16], len: int) = - for i in 0 ..< len: - dest[i] = source[i].tofloat16(clamp=true) +when myouConvertHdrToFloat16: + proc f32_to_f16(source: ptr UncheckedArray[float32], dest: ptr UncheckedArray[Float16], len: int) = + for i in 0 ..< len: + dest[i] = source[i].tofloat16(clamp=true) proc getDimensionsFormat*(p: pointer, len: int, min_channels=0): (int, int, TextureFormat) = when defined(myouUseOpenImageIO): diff --git a/src/gpu_formats/texture_optimize.nim b/src/gpu_formats/texture_optimize.nim index 917a6b0..0090df7 100644 --- a/src/gpu_formats/texture_optimize.nim +++ b/src/gpu_formats/texture_optimize.nim @@ -52,8 +52,6 @@ import std/monotimes import std/marshal import std/bitops import std/json -import std/uri -import std/os # TODO: don't import it here from ../platform/gl import nil @@ -80,11 +78,7 @@ template has_astc_support: bool = gl.GLAD_GL_OES_texture_compression_astc or const myouMinTextureChannels {.intdefine.} = 0 const myouEngineNumTextureThreads {.intdefine.} = 4 const myouBC7VerboseMode {.booldefine.} = false -const myouAllCacheFilesExist {.booldefine.} = false const myouLoadUncompressedTextures {.booldefine.} = false -when defined(myouAllCacheFilesExist): - import ../platform/platform - import std/strutils template u32(x: untyped): uint32 = cast[uint32](x) @@ -202,13 +196,13 @@ when defined(myouUseBC7Encoder): ) callback(tex, KtxInfoParts(info: info, parts: parts), data_refs) -template first(bs: BlockSize): uint8 = - bs.uint8 shr 4'u8 - -template second(bs: BlockSize): uint8 = - bs.uint8 and 0xf'u8 - when defined(myouUseAstcEncoder): + template first(bs: BlockSize): uint8 = + bs.uint8 shr 4'u8 + + template second(bs: BlockSize): uint8 = + bs.uint8 and 0xf'u8 + proc atsc_compress*(tex: Texture, pixels: SliceMem[byte], callback: CallbackCompressed, blk_size: BlockSize, speed: EncodingSpeed) = let profile = case tex.format.component_type: of UByte: diff --git a/src/graphics/render.nim b/src/graphics/render.nim index 8a66132..8e8e8d5 100644 --- a/src/graphics/render.nim +++ b/src/graphics/render.nim @@ -32,7 +32,6 @@ import ../types import ../platform/gl -import ../postprocessing/effect_shaders import arr_ref import vmath except Quat, quat @@ -65,7 +64,6 @@ import ../objects/gameobject import ../objects/mesh import ../platform/platform import ../shadows/shadow_common -import ../quat import ../scene import ../util import ./framebuffer diff --git a/src/loaders/blend.nim b/src/loaders/blend.nim index dd67ea7..3d8384e 100644 --- a/src/loaders/blend.nim +++ b/src/loaders/blend.nim @@ -284,7 +284,8 @@ proc idPropertiesToJsonTable(prop: FNode): Table[string, JsonNode] = of 1: # int result[name] = %val of 5: # array - let subtype = prop.subtype.i8[0] + # let subtype = prop.subtype.i8[0] + discard of 8: # float let f = cast[ptr float64](prop.data.val.i32[0].addr)[] result[name] = %f diff --git a/src/objects/light.nim b/src/objects/light.nim index e5a035c..f96386f 100644 --- a/src/objects/light.nim +++ b/src/objects/light.nim @@ -33,7 +33,6 @@ import ../types import vmath except Quat, quat import ../util -import ../graphics/material when defined(nimdoc): type TYPES* = LightType | Light diff --git a/src/platform/gl.nim b/src/platform/gl.nim index 3e48ab9..03a0fdc 100644 --- a/src/platform/gl.nim +++ b/src/platform/gl.nim @@ -23,7 +23,7 @@ proc get_program_info_log*(program: GLuint): string = when compileOption("threads"): let main_thread_id = getThreadID() -template handleError(x: untyped, t: string) = +template handleError(x: untyped, t: untyped) = when compileOption("threads"): assert main_thread_id == getThreadID() try: diff --git a/src/platform/glfw_wrap.nim b/src/platform/glfw_wrap.nim index 36dadb6..6abcbcc 100644 --- a/src/platform/glfw_wrap.nim +++ b/src/platform/glfw_wrap.nim @@ -50,7 +50,8 @@ when compileOption("threads"): from loadable import terminateLoadableWorkerThreads from ../gpu_formats/texture_optimize import terminateTextureWorkerThreads -func c_strstr(haystack, needle: cstring): cstring {.importc: "strstr", header: "".} +when not defined(release) and defined(myouForceAstc): + func c_strstr(haystack, needle: cstring): cstring {.importc: "strstr", header: "".} proc screen*(window: Window): Screen {.inline.} = cast[Screen](window.getWindowUserPointer) diff --git a/src/shadows/simple_shadow.nim b/src/shadows/simple_shadow.nim index cbd8927..aa87a90 100644 --- a/src/shadows/simple_shadow.nim +++ b/src/shadows/simple_shadow.nim @@ -41,7 +41,6 @@ import ../graphics/ubo import ../objects/mesh import ../objects/gameobject import ../quat -import ../scene import ../util import ./shadow_common