This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
An efficient numpy implementation of GLSL packHalf2x16 and unpackHalf2x16. | |
Author: Elie Michel <elie.michel@exppad.com> | |
License: MIT - 2023 | |
""" | |
def packHalf2x16(x, y): | |
""" | |
Pack two floats into a single uint32, like GLSL's packHalf2x16 function | |
(but vectorized for numpy arrays). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import struct | |
import os | |
# Parameter | |
archive = "vivfox.mview" | |
def readCString(f): | |
"""This is the most naive implementation possible, don't use in prod""" | |
str = "" | |
c = f.read(1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import struct | |
def readCString(f): | |
"""This is the most naive implementation possible, don't use in prod""" | |
str = "" | |
c = f.read(1) | |
while c != '\0': | |
str += c | |
c = f.read(1) | |
return str |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "stb_image_write.h" | |
#include <webgpu/webgpu.hpp> | |
#include <filesystem> | |
#include <string> | |
bool saveTexture(const std::filesystem::path path, wgpu::Device device, wgpu::Texture texture, int mipLevel) { | |
using namespace wgpu; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Using https://github.com/eliemichel/WebGPU-Cpp | |
#include <webgpu/webgpu.hpp> | |
namespace raii { | |
class Buffer { | |
public: | |
// Whenever a RAII instance is created, we create an underlying resource | |
Buffer(wgpu::Device device, const wgpu::BufferDescriptor& bufferDesc) | |
: m_raw(device.createBuffer(bufferDesc)) | |
{} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "stb_image_write.h" | |
#include <webgpu/webgpu.hpp> | |
#include <filesystem>h | |
#include <string> | |
std::filesystem::path resolvePath(int frame) { | |
std::filesystem::path base = "render/frame" + std::to_string(frame) + ".png"; | |
create_directories(base.parent_path()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
(Built: Mon, Sep 24, 2018 4:38:25 PM) | |
Marmoset Viewer Code and Tools | |
Copyright (c) 2018 Marmoset LLC. | |
All rights reserved. | |
Redistribution and use of this software are permitted provided | |
that the software remains whole and unmodified and this copyright | |
notice remains attached. Use or inclusion of any portion of this |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import bpy | |
class IconPanel(bpy.types.Panel): | |
"""Creates a Panel width all possible icons""" | |
bl_label = "Icons" | |
bl_idname = "icons_panel" | |
bl_space_type = 'PROPERTIES' | |
bl_region_type = 'WINDOW' | |
bl_context = "object" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def local_import(module_name): | |
exec('\n'.join([l.body for l in bpy.data.texts[module_name].lines])) | |
for k, v in locals().items(): | |
globals()[k] = v | |
# Example | |
import bpy | |
import bmesh | |
import numpy as np | |
local_import('tiny_timer.py') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Credits 2020-2022 to Élie Michel <elie.michel@exppad.com> | |
# Released in Public Domain | |
# | |
# The Software is provided "as is", without warranty of any kind, express or | |
# implied, including but not limited to the warranties of merchantability, | |
# fitness for a particular purpose and non-infringement. In no event shall the | |
# authors or copyright holders be liable for any claim, damages or other | |
# liability, whether in an action of contract, tort or otherwise, arising | |
# from, out of or in connection with the software or the use or other dealings | |
# in the Software. |
NewerOlder