Skip to content

Instantly share code, notes, and snippets.

View unvestigate's full-sized avatar

Sebastian Ahlman unvestigate

View GitHub Profile
@unvestigate
unvestigate / BlenderSyncLib.cpp
Created April 17, 2025 08:12
The main source code files for the BlenderSync addon
#include "BlenderSyncLibExport.h"
#include <enet/enet.h>
#include <stdio.h>
#include <stdint.h>
#include <string>
#include <fstream>
#include "../Basis/include/editor/BasisBlenderSync.h"
@unvestigate
unvestigate / nanovg_gfxapi.cpp
Created March 14, 2025 19:56
NanoVG renderer for the internal Basis RHI
#include "external/nanovg/nanovg_gfxapi.h"
#include "external/nanovg/nanovg.h"
#include <gfxapi/BasisRenderContext.h>
#include <gfxapi/BasisRenderDevice.h>
#include <gfxapi/BasisRenderTarget.h>
#include <gfxapi/BasisViewport.h>
#include <gfxapi/BasisBuffer.h>
#include <gfxapi/BasisBufferDescription.h>
#include <gfxapi/BasisTextureDescription.h>
const std = @import("std");
const basis = @import("basis");
const vhl = @import("vhl");
const means = @import("../means.zig");
const GameObjectComponent = basis.component_contexts.GameObjectComponent;
const Message = basis.messaging.Message;
const MessageParameters = basis.messaging.MessageParameters;
@unvestigate
unvestigate / CargoCraneComponent.zig
Last active August 15, 2024 10:31
Means - Cargo crane
// MIT License
//
// Copyright (c) 2018-2023 Madrigal Ltd.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
import bpy
FOLIAGE_DATA_VERTEX_COLOR_MAP = "FoliageData"
def get_wind_influence(obj, vert):
map_index = obj.data.vertex_colors.find(FOLIAGE_DATA_VERTEX_COLOR_MAP)
map = obj.data.vertex_colors[map_index]
for polygon in obj.data.polygons:
for i, index in enumerate(polygon.vertices):