Skip to content

Instantly share code, notes, and snippets.

View sczerwinski's full-sized avatar
👨‍💻
Feeding my inner nerd

Sławomir Czerwiński sczerwinski

👨‍💻
Feeding my inner nerd
View GitHub Profile
@sczerwinski
sczerwinski / DirectFloatBuffer.kt
Created November 13, 2020 16:12
Creating direct FloatBuffer from List<Float>
import java.nio.ByteBuffer
import java.nio.ByteOrder
import java.nio.FloatBuffer
private const val FLOAT_BYTES = 4
fun List<Float>.toDirectFloatBuffer(): FloatBuffer =
ByteBuffer.allocateDirect(size * FLOAT_BYTES)
.apply { order(ByteOrder.nativeOrder()) }
.asFloatBuffer()
@sczerwinski
sczerwinski / sphere-normal-map.py
Last active January 5, 2025 00:41
Plugin for GIMP, generating spherical normal map.
"""
Copyright 2025 Slawomir Czerwinski
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software