bread man forgot to push

This commit is contained in:
Anumania 2022-08-18 18:03:51 -07:00
parent 386680a66a
commit 4c0c7b5833
15 changed files with 248 additions and 4 deletions

View file

@ -0,0 +1,70 @@
// Script assets have changed for v2.3.0 see
// https://help.yoyogames.com/hc/en-us/articles/360005277377 for more information
function Model(filePath, texture, vformat = vertex_format_create_simple(true,true,true,false), _x = 0, _y = 0, _z = 0, _scale = 1,_xrot = 0, _yrot = 0, _zrot = 0,loopdist=0) constructor{
vertexBuffer = model_load(filePath,vformat);
//texture = s_mistake;
try{
vertex_freeze(vertexBuffer)
}
catch(e){
//log(e);
//log("this error is probably fine, its caused by trying to freeze an already frozen vertex buffer, but gamemaker has no way to check if a buffer is already frozen...");
}
//vertex
tex = sprite_get_texture(texture,0);
//log(self);
//log(vertexBuffer);
x = _x;
y = _y;
z = _z;
xrot = _xrot;
zrot = _zrot;
yrot = _yrot;
scale = _scale;
//bpy.context.scene.cursor.location
width = 0;
height = 0 ;
array_push(ARTICULATOR.models,self);
draw = function() {
//var camera = camera_get_active();
//var cammat = camera_get_view_mat(camera);
//camera_set_view_mat(camera,matrix_build_lookat(global.camerax-x,global.cameray-y,global.cameraz-z,global.camerax +cos(o_3dmanager.mousex/100),global.cameray +sin(o_3dmanager.mousex/100),global.cameraz+sin(o_3dmanager.mousey/100),0,0,1));
//shader_set(z_tile3d);
//if(shader_current() != z_translate) {
// shader_reset();
// shader_set(z_translate);
//}
//shader_set_uniform_f(shader_get_uniform(z_translate,"movement"),x,y,z);
//shader_set(z_differentnormal)
matrix_set(matrix_world,matrix_build(x,y,z,xrot,yrot,zrot,scale,scale,scale ))
vertex_submit(vertexBuffer,pr_trianglelist,tex);
//shader_reset();
//shader_reset();
//shader_reset();
//log(buffer_read(vertexBuffer,buffer_vbuffer));
//camera_set_view_mat(camera,cammat);
//matrix_set(matrix_world,)
}
destroy = function() {
throw "idiot";
}
}
global.cache = {
load: function(name,vformat){
if(ds_map_exists(theCache,name)){
return theCache[?name];
}
else{
var buff = buffer_load(name);
var vbuff = vertex_create_buffer_from_buffer(buff, vformat);
theCache[?name] = vbuff;
return theCache[?name];
}
},
clear: function(){
ds_map_clear(theCache);
},
theCache: ds_map_create(),
}

View file

@ -0,0 +1,12 @@
{
"isDnD": false,
"isCompatibility": false,
"parent": {
"name": "3d",
"path": "folders/Scripts/3d.yy",
},
"resourceVersion": "1.0",
"name": "Model",
"tags": [],
"resourceType": "GMScript",
}

View file

@ -0,0 +1,8 @@
// Script assets have changed for v2.3.0 see
// https://help.yoyogames.com/hc/en-us/articles/360005277377 for more information
function camera_reset(){
var camera = camera_get_active();
camera_set_view_mat(camera,global.vmat);
camera_set_proj_mat(camera,matrix_multiply(global.projmat,matrix_build(0,0,0,0,0,0,1,-1,1)));
camera_apply(camera);
}

View file

@ -0,0 +1,12 @@
{
"isDnD": false,
"isCompatibility": false,
"parent": {
"name": "3d",
"path": "folders/Scripts/3d.yy",
},
"resourceVersion": "1.0",
"name": "camera_reset",
"tags": [],
"resourceType": "GMScript",
}

View file

@ -0,0 +1,12 @@
/// Function: matrix_transpose()
function matrix_transpose(){
var _m0 = argument0;
var _m1 = argument0;
for (var _i = 0; _i < 3; _i++) {
for (var _j = 0; _j < 3; _j++) {
_m1[_j*4+_i] = _m0[_i*4+_j];
}
}
return _m1;
}

View file

@ -0,0 +1,12 @@
{
"isDnD": false,
"isCompatibility": false,
"parent": {
"name": "3d",
"path": "folders/Scripts/3d.yy",
},
"resourceVersion": "1.0",
"name": "matrux_transpose",
"tags": [],
"resourceType": "GMScript",
}

View file

@ -0,0 +1,23 @@
///model_load(filepath, vformat)
/// @func model_load(filepath, vformat)
/// @desc Loads a mobel in via buffer. Returns -1 if the file isn't found, otherwise returns a vertex buffer ID
/// @arg filepath
/// @arg vformat
/// @return -1 on fail or a vbuffer ID
function model_load(filepath,vformat){
if(!file_exists(filepath))
{
show_debug_message("File not Found: " + string(filepath));
return -1;
}
//var buff = buffer_load(filepath);
//var vbuff = vertex_create_buffer_from_buffer(buff, vformat);
var vbuff = global.cache.load(filepath,vformat);
//buffer_delete(buff);
return vbuff;
}

View file

@ -0,0 +1,12 @@
{
"isDnD": false,
"isCompatibility": false,
"parent": {
"name": "3d",
"path": "folders/Scripts/3d.yy",
},
"resourceVersion": "1.0",
"name": "model_load",
"tags": [],
"resourceType": "GMScript",
}

View file

@ -0,0 +1,7 @@
// Script assets have changed for v2.3.0 see
// https://help.yoyogames.com/hc/en-us/articles/360005277377 for more information
//like move models around or some shit lol
function model_transform(){
}

View file

@ -0,0 +1,12 @@
{
"isDnD": false,
"isCompatibility": false,
"parent": {
"name": "3d",
"path": "folders/Scripts/3d.yy",
},
"resourceVersion": "1.0",
"name": "model_transform",
"tags": [],
"resourceType": "GMScript",
}

View file

@ -0,0 +1,26 @@
///vertex_format_create_simple(hasNormal, hasColour, hasTexcoord, *hasTangentData)
///@func vertex_format_create_simple(hasNormal, hasColour, hasTexcoord)
///@desc Creates and returns a simple vertex format including Position3D as well as the others specified in the arguments. Useful when used with my Blender Export.
///@arg hasNormal
///@arg hasColour
///@arg hasTexcoord
///@return Vertex Format ID
function vertex_format_create_simple(hasNormal = true,hasColor = true,hasTexcoord = true, hasTangentData = false){
vertex_format_begin();
vertex_format_add_position_3d();
if(argument_count > 0 && argument[0]){
vertex_format_add_normal();
}
if(argument_count > 1 && argument[1]){
vertex_format_add_color();
}
if(argument_count > 2 && argument[2]){
vertex_format_add_texcoord();
}
if(argument_count > 3 && argument[3]){
vertex_format_add_custom(vertex_type_float3, vertex_usage_texcoord);
vertex_format_add_custom(vertex_type_float3, vertex_usage_texcoord);
}
return vertex_format_end();
}

View file

@ -0,0 +1,12 @@
{
"isDnD": false,
"isCompatibility": false,
"parent": {
"name": "3d",
"path": "folders/Scripts/3d.yy",
},
"resourceVersion": "1.0",
"name": "vertex_format_create_simple",
"tags": [],
"resourceType": "GMScript",
}