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
/// Path functions and escalator functions | |
/// @func path_points(path, radius) | |
/// @desc Create two arrays with the points of the inner and outer casing around a path | |
function path_points(path, radius) { | |
// Make sure we use the smallest possible increase in t | |
var e = math_get_epsilon(); | |
var precision = 240; | |
var t = 0; |
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
/// | |
#macro POSITION_2D vertex_format_add_position | |
#macro POSITION_3D vertex_format_add_position_3d | |
#macro COLOR vertex_format_add_color | |
#macro UV vertex_format_add_texcoord | |
#macro NORMAL vertex_format_add_normal | |
/* | |
vertex_format_add_position_3d(); |
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
/// @description Load WAV file | |
function wav(path) constructor { | |
read_chunk_id_size = function(buffer) { | |
var _id = ""; | |
repeat(4) { _id += chr(buffer_read(buffer, buffer_u8)); } | |
var _size = buffer_read(buffer, buffer_u32); | |
return [_id, _size]; | |
} |
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
function update_spheres() { | |
// Copy initial state | |
ds_grid_copy(grd_calc_spheres, grd_spheres); | |
var y_max = no_spheres-1; | |
// Do point_distance_3d (squared) | |
ds_grid_add_region(grd_calc_spheres, 0, 0, 0, y_max, -x); // x[i] -= x | |
ds_grid_add_region(grd_calc_spheres, 1, 0, 1, y_max, -y); // y[i] -= y | |
ds_grid_add_region(grd_calc_spheres, 2, 0, 2, y_max, -z); // z[i] -= z |
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
function Q_rsqrt(number) { | |
gml_pragma("forceinline"); | |
#macro threehalfs 1.5 | |
static buf_var = buffer_create(4, buffer_fixed, 4); | |
var x2 = number * .5, _y = number; | |
buffer_poke(buf_var, 0, buffer_f32, _y); | |
var i = buffer_peek(buf_var, 0, buffer_s32); | |
buffer_poke(buf_var, 0, buffer_s32, 0x5f3759df - ( i >> 1 )); | |
_y = buffer_peek(buf_var, 0, buffer_f32); |
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 | |
# ExportHelper is a helper class, defines filename and | |
# invoke() function which calls the file selector. | |
from bpy_extras.io_utils import ExportHelper | |
from bpy.props import StringProperty, BoolProperty, IntProperty, EnumProperty, CollectionProperty | |
from bpy.types import Operator, PropertyGroup | |
def items_callback(self, context): |
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 | |
C = bpy.context | |
D = bpy.data | |
fname = 'C:/Users/Dev/Desktop/test.png' | |
# This'll be our object | |
obj = C.object | |
obj_cam = C.scene.camera |
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
### Paths to all kinds of model data in bpy ### | |
## Textures, UVs ## | |
C.object.material_slots[0].material.texture_slots[0].texture_coords # Type of coords | |
C.object.material_slots[0].material.texture_slots[0].uv_layer # UV layer if type uv | |
C.object.material_slots[0].material.texture_slots[0].texture # Ref to texture | |
## Shape keys (Morph targets) ## | |
C.object.data.shape_keys # Entry point | |
C.object.data.shape_keys.key_blocks[0].vertex_group # Affected vertex group |
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 | |
from struct import pack, calcsize | |
# First define what we want | |
attribs = [ | |
(bpy.types.MeshVertex,'co',0), | |
(bpy.types.MeshVertex,'co',1), | |
(bpy.types.MeshVertex,'normal',0) | |
] |