Optimize ground rendering using triangle strip #2

Closed
opened 2022-10-23 01:29:43 +02:00 by Benjamin_Loison · 1 comment
Owner

As #1 to optimize the memory used by the ground.

Otherwise get on my old VAIO:
radeon: Failed to allocate a buffer:
radeon:    size      : 1134551040 bytes
radeon:    alignment : 4096 bytes
radeon:    domains   : 2
radeon:    flags     : 0
radeon: Failed to allocate a buffer:
radeon:    size      : 1134551040 bytes
radeon:    alignment : 4096 bytes
radeon:    domains   : 2
radeon:    flags     : 0
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: BufferCreationError(OutOfMemory)', src/support/mod.rs:197:10
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

To solve this issue uses the old_vaio branch.

As #1 to optimize the memory used by the ground. <details> <summary>Otherwise get on my old VAIO:</summary> ``` radeon: Failed to allocate a buffer: radeon: size : 1134551040 bytes radeon: alignment : 4096 bytes radeon: domains : 2 radeon: flags : 0 radeon: Failed to allocate a buffer: radeon: size : 1134551040 bytes radeon: alignment : 4096 bytes radeon: domains : 2 radeon: flags : 0 thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: BufferCreationError(OutOfMemory)', src/support/mod.rs:197:10 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace ``` </details> To solve this issue uses the [`old_vaio`](http://gitea.lemnoslife.com:3006/Benjamin_Loison/LemnosLife_Rust/src/branch/old_vaio) branch.
Author
Owner

This Python script allows us to know the biggest drop between a tile extremity and another (without considering its diagonal).

Python script:
import os

path = 'Extensions/LemnosLife/Map/Altis/Ground/'

os.chdir(path)

biggestDrop = 0

def getFloat(s):
    return -100 if s == 'N' else float(s)

for _, _, files in os.walk('.'):
    for file in files:
        with open(file) as f:
            lines = f.read().splitlines()
        for line, lineBelow in zip(lines, lines[1:-1]):
            columns = line.split()
            columnsBelow = lineBelow.split()
            for column, columnBelow in zip(columns, columnsBelow):
                column = getFloat(column)
                columnBelow = getFloat(columnBelow)
                drop = abs(column - columnBelow)
                if drop > biggestDrop:
                    biggestDrop = drop
            for column, columnRight in zip(columns, columns[1:-1]):
                column = getFloat(column)
                columnRight = getFloat(columnRight)
                drop = abs(column - columnRight)
                if drop > biggestDrop:
                    biggestDrop = drop
    break

print(biggestDrop) # 16.17
This Python script allows us to know the biggest drop between a tile extremity and another (without considering its diagonal). <details> <summary>Python script:</summary> ```python import os path = 'Extensions/LemnosLife/Map/Altis/Ground/' os.chdir(path) biggestDrop = 0 def getFloat(s): return -100 if s == 'N' else float(s) for _, _, files in os.walk('.'): for file in files: with open(file) as f: lines = f.read().splitlines() for line, lineBelow in zip(lines, lines[1:-1]): columns = line.split() columnsBelow = lineBelow.split() for column, columnBelow in zip(columns, columnsBelow): column = getFloat(column) columnBelow = getFloat(columnBelow) drop = abs(column - columnBelow) if drop > biggestDrop: biggestDrop = drop for column, columnRight in zip(columns, columns[1:-1]): column = getFloat(column) columnRight = getFloat(columnRight) drop = abs(column - columnRight) if drop > biggestDrop: biggestDrop = drop break print(biggestDrop) # 16.17 ``` </details>
Benjamin_Loison added the enhancementepicmedium priority labels 2023-04-01 13:11:43 +02:00
Sign in to join this conversation.