diff --git a/doc/fixdocs.nim b/doc/fixdocs.nim
index 68d6216..4a4945f 100644
--- a/doc/fixdocs.nim
+++ b/doc/fixdocs.nim
@@ -55,16 +55,18 @@ for f in os.commandLineParams():
var types: seq[string]
var lines = readFile(f).split("\n")
var menu_line = 0
+ var last_menu_line = 0
var types_line = ""
for i,line in lines:
# if "reference reference-toplevel" in line and line.endswith ">Types":
if line.startswith " title=\"TYPES = ":
types_line = line
+ menu_line = i - 1
elif types_line != "":
types_line &= line
if "" in types_line:
types = types_line.split({'"','='})[3].split({'|',' '}).filterIt it != ""
- menu_line = i - 1
+ last_menu_line = i
break
if types.len == 0:
continue
@@ -76,15 +78,18 @@ for f in os.commandLineParams():
assert menu_line != 0
- lines.delete menu_line
- lines.delete menu_line
+ # types_id is usually "TYPES" but for some reason it's "TYPES_2" sometimes,
+ # so we'll extract the id from the href before we delete it
+ let types_id = lines[menu_line].rsplit("#",1)[1].split("\"")[0]
+ for i in menu_line .. last_menu_line:
+ lines.delete menu_line
for tname in types:
var parts = types_menu[tname].split('"')
parts[5] = parts[5].strip_privates
lines.insert(parts.join("\""), menu_line)
- var body_line = lines.find "
"
+ var body_line = lines.find &"
"
while lines[body_line] != "
":
lines.delete body_line
lines.delete body_line
diff --git a/doc/modules.rst b/doc/modules.rst
index 07ebb73..3206b41 100644
--- a/doc/modules.rst
+++ b/doc/modules.rst
@@ -28,12 +28,23 @@ Objects
Graphics modules
----------------
+Anything that touches the graphics API (MeshData should be moved here)
+
* `Render
`_
* `Material `_
* `Texture `_
* `Framebuffer `_
* `Ubo `_
+GPU formats
+-----------
+
+Modules that handle mesh and texture formats and optimize them for the GPU while
+being completely agnostic to the graphics API.
+
+* `Texture decode `_
+* `Texture optimize `_
+
Effect system
-------------
@@ -60,6 +71,7 @@ Libraries
---------
* `ArrRef <_._/libs/arr_ref/arr_ref.html>`_
+* `SliceMem <_._/libs/arr_ref/slice_mem.html>`_
* `Loadable <_._/libs/loadable/loadable.html>`_
* `DdxKtx <_._/libs/ddx_ktx/ddx_ktx.html>`_
* `Float16 <_._/libs/float16/float16.html>`_
diff --git a/nim.cfg b/nim.cfg
new file mode 100644
index 0000000..52a85e9
--- /dev/null
+++ b/nim.cfg
@@ -0,0 +1,2 @@
+path:"./libs/packages"
+threads:on
diff --git a/src/gpu_formats/texture_optimize.nim b/src/gpu_formats/texture_optimize.nim
index 27a1c13..f6e0263 100644
--- a/src/gpu_formats/texture_optimize.nim
+++ b/src/gpu_formats/texture_optimize.nim
@@ -1,3 +1,45 @@
+# The contents of this file are subject to the Common Public Attribution License
+# Version 1.0 (the “License”); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+# https://myou.dev/licenses/LICENSE-CPAL. The License is based on the Mozilla
+# Public License Version 1.1 but Sections 14 and 15 have been added to cover use
+# of software over a computer network and provide for limited attribution for
+# the Original Developer. In addition, Exhibit A has been modified to be
+# consistent with Exhibit B.
+#
+# Software distributed under the License is distributed on an “AS IS” basis,
+# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
+# the specific language governing rights and limitations under the License.
+#
+# The Original Code is Myou Engine.
+#
+# the Original Developer is the Initial Developer.
+#
+# The Initial Developer of the Original Code is the Myou Engine developers.
+# All portions of the code written by the Myou Engine developers are Copyright
+# (c) 2024. All Rights Reserved.
+#
+# Alternatively, the contents of this file may be used under the terms of the
+# GNU Affero General Public License version 3 (the [AGPL-3] License), in which
+# case the provisions of [AGPL-3] License are applicable instead of those above.
+#
+# If you wish to allow use of your version of this file only under the terms of
+# the [AGPL-3] License and not to allow others to use your version of this file
+# under the CPAL, indicate your decision by deleting the provisions above and
+# replace them with the notice and other provisions required by the [AGPL-3]
+# License. If you do not delete the provisions above, a recipient may use your
+# version of this file under either the CPAL or the [AGPL-3] License.
+
+
+
+## This module takes textures decoded from JPEG, PNG, etc. and encodes them in
+## compressed GPU formats like BCn and ASTC. In order to use it:
+##
+## * Configure `Engine.CacheSettings`
+## * Add one or both of these defines: `myouUseBC7Encoder`, `myouUseAstcEncoder`
+##
+## The resulting cache can be used in builds without encoders.
+
import ../types
import ./texture_decode
@@ -22,6 +64,10 @@ when defined(myouUseAstcEncoder):
import astc
when defined(myouUseBC7Encoder) or defined(myouUseAstcEncoder):
import zstd/compress
+
+when defined(nimdoc):
+ type TYPES* = CacheSettings | EncodingSpeed | RgbBcFmt | BlockSize
+
when defined(android) or defined(ios) or defined(emscripten):
template has_bptc_support: bool = gl.GLAD_GL_EXT_texture_compression_bptc
else: