Jump to content


Photo

Load 3DS objects into Game Maker(I have tried!)


  • Please log in to reply
14 replies to this topic

#1 DemonnPrincess

DemonnPrincess

    GMC Member

  • New Member
  • 9 posts

Posted 27 June 2012 - 12:55 AM

I am using Game Maker 8.0 Pro.

I have been on Google and Youtube since 9 this morning(it is 5:46 now!) and I need HELP!

I CANNOT FOR THE LIFE OF ME FIGURE OUT HOW TO IMPORT 3DS OBJECTS INTO GAME MAKER! AND I have no idea how to convert them to .D3D and even if I did I STILL dunno how to put the map back on so it's not white so I don't wanna do that. I have seen several examples of importing 3ds files but everytime I try to manipulate the codes to load my objects they are either invisible or I get an error. For example, I just want to load a bed to sit on the room. I got it to load once, using this tutorial but all it did was load the bed red(took 5 minutes, which is fine) but then it moved with the camera and I couldn't get it to just be in one place.

Please, I need help. Not to sound rude, but I don't need people telling me to do it a different way or being rude about how I didn't "try hard enough." Just help me if you're gonna and don't if you're not. :3
  • 0

#2 The Legend

The Legend

    A Jesus Freak

  • GMC Member
  • 1052 posts
  • Version:GM:Studio

Posted 27 June 2012 - 01:50 AM

3DS, OK let me see if I have this straight. When you say 3DS, do you mean the gaming system? Or do you just mean models? You need to be more specific too. We need code if we are to help you.
  • 0

#3 DemonnPrincess

DemonnPrincess

    GMC Member

  • New Member
  • 9 posts

Posted 27 June 2012 - 01:56 AM

3DS, OK let me see if I have this straight. When you say 3DS, do you mean the gaming system? Or do you just mean models? You need to be more specific too. We need code if we are to help you.


Not to be rude(again) but it's obvious I'm talking about code since I also brought up .d3d 3D files. But I apologize. Yes, I am talking about 3ds files. The codes I am taking about aren't here because I have no idea how to write them. They are provided in the tutorial that I put a link too. I need help!

Edited by DemonnPrincess, 27 June 2012 - 02:14 AM.

  • 0

#4 Gamer3D

Gamer3D

    Human* me = this;

  • GMC Member
  • 1587 posts
  • Version:GM8.1

Posted 27 June 2012 - 02:46 AM

Not to be rude(again) but it's obvious I'm talking about code since I also brought up .d3d 3D files. But I apologize. Yes, I am talking about 3ds files. The codes I am taking about aren't here because I have no idea how to write them. They are provided in the tutorial that I put a link too. I need help!

3DS loaders are not difficult to write. Here's one that you can modify to fit your needs: (You might want to merge the models for objects in the file)
Spoiler

  • 0

#5 slayer 64

slayer 64

    GMC Member

  • GMC Member
  • 3273 posts
  • Version:GM8.1

Posted 27 June 2012 - 02:55 AM

here ya go bra
/*
    Arguments:
        0 fname
        1 ds_grid for materials, textures and models
        2 prelight?
        3 ambient
        4 light color
        5 light dx direction of light
        6 light dy
        7 light dz
        
    Description:
        fname:      Model filename.
        model grid: This is a ds_grid (Create it beforehand) that will be filled with the models and 
                    texture filenames (or, if I remember correctly, -1 to indicate that there are no polygons for that material).
        prelight:   This indicates whether the script should calculate lighting based on the following values.
        ambient:    The base color. Yes, I know GM doesn't have this by default, but it SHOULD.
        lit:        The color of a fully lit part.
        nx:         The x direction of the light.
        ny:         The y direction of the light.
        nz:         The z direction of the light.
*/

//  load_3ds(fname, model grid, prelight, ambient, lit, nx, ny, nz)
var file, file_pos, file_size,
    chunk_stack, chunk_end_stack, chunk_id, chunk_end,
    char_read, chunk_name, stacktop, count,
    f1, f2, f3, f4, fl,
    vertex_list, face_list, mapping_list, material_list,
    chunk_model, pos, pos2, chunk_grid, mat_name, mat_index;

//  Information for vertex/face/etc. lists.
var vertex_size, face_size, mapping_size, material_size;
material_size = 3;
vertex_size = 3 + 3;
face_size = 5;
mapping_size = 2;

fl = sqr(argument5) + sqr(argument6) + sqr(argument7);
if (fl > 0) {
    fl = 1 / sqrt(fl);
    argument5 *= fl;
    argument6 *= fl;
    argument7 *= fl;
}

//  Current version will ignore shading groups.
//  http://www.martinreddy.net/gfx/3d/3DS.spec
if !file_exists(argument0)
    exit;
//  Open a binary file for reading.
file = file_bin_open(argument0, 0);
file_pos = 0;
file_size = file_bin_size(file);
if (file_size < 6)
    exit;

chunk_stack = ds_stack_create();
chunk_end_stack = ds_stack_create();
vertex_list = ds_list_create();
face_list = ds_list_create();
mapping_list = ds_list_create();
material_list = ds_list_create();

//  Each column: Name (string), face list (grid, faces wide, 9 high-3 floats per vertex), d3d model (for mat0), (tex0),  ...
ds_grid_resize(argument1, 0, 4);

stacktop = 0;
while (stacktop < 4294967295)
{
//  Note: For a fast-loader in C++, remember that these are backwards.
    chunk_id = file_bin_read_byte(file) + file_bin_read_byte(file) * 256;
    chunk_end = file_pos + file_bin_read_byte(file) + file_bin_read_byte(file) * 256 + file_bin_read_byte(file) * 65536 + file_bin_read_byte(file) * 16777216;
    file_pos += 6;
    switch chunk_id
    {
        case 16384: //  Edit Object
            char_read = file_bin_read_byte(file);  //  Read object name
            file_pos += 1;
            chunk_name = '';
            while (char_read != 0) {    //  Null-terminated ASCII string.
                chunk_name += chr(char_read);
                char_read = file_bin_read_byte(file);
                file_pos += 1;
            }
            chunk_model = false;
        case 19789: //  Main
        case 15677: //  Edit3DS
        case 40992: //  Material color in subchunk
        case 41472: //  Texture chunk
            break;
        case 45055: //  Material chunk
            mat_index = ds_list_size(material_list);
            ds_list_add(material_list, '');
            ds_list_add(material_list, 0);
            ds_list_add(material_list, '');
            break;
        case 40960: //  Material name
            char_read = file_bin_read_byte(file);
            file_pos += 1;
            chunk_name = '';
            while (char_read != 0) {
                chunk_name += chr(char_read);
                char_read = file_bin_read_byte(file);
                file_pos += 1;
            }
            ds_list_replace(material_list, mat_index, chunk_name);
            break;
        case 17:    //  RGB1 chunk (Includes gamma)
//        case 18:    //  No gamma
            if (ds_stack_top(chunk_stack) = 40992)
                ds_list_replace(material_list, mat_index + 1, file_bin_read_byte(file) + file_bin_read_byte(file) * 256 + file_bin_read_byte(file) * 65536);
            file_bin_seek(file, chunk_end);
            file_pos = chunk_end;
            break;
        case 41728: //  Texture name
            char_read = file_bin_read_byte(file);
            file_pos += 1;
            chunk_name = '';
            while (char_read != 0) {
                chunk_name += chr(char_read);
                char_read = file_bin_read_byte(file);
                file_pos += 1;
            }
            ds_list_replace(material_list, mat_index + 2, chunk_name);
            break;
        case 16640: //  Trimesh. Note: This will need to do some things later.
            ds_list_clear(vertex_list);
            ds_list_clear(face_list);
            ds_list_clear(mapping_list);
            chunk_model = true;
            break;
        case 16656: //  Vertex list.
            count = file_bin_read_byte(file) + file_bin_read_byte(file) * 256;  //  Number of verteces
            for (n = 0; n < count * 3; n += 1)
            {
                f4 = file_bin_read_byte(file);
                f3 = file_bin_read_byte(file);
                f2 = file_bin_read_byte(file);
                f1 = file_bin_read_byte(file);
                if ((f1 = 0) && (f2 = 0) && (f3 = 0) && (f4 = 0))
                    fl = 0;
                else
                {
                    fl = power(2, (f1 * 2) mod 256 + floor(f2 / 128) - 127) * ((f4 * 0.00000011920928955078125 + f3 * 0.000030517578125 + (f2 mod 128) * 0.0078125) + 1);
                    if (f1 > 127)
                        fl = -fl;
                }
                ds_list_add(vertex_list, fl);
                if (n mod 3 = 2) {
                    ds_list_add(vertex_list, 0);
                    ds_list_add(vertex_list, 0);
                    ds_list_add(vertex_list, 0);
                }
            }
//  Normal
            file_pos += 2 + 12 * count;
            break;
        case 16672: //  Face list.
            count = file_bin_read_byte(file) + file_bin_read_byte(file) * 256;  //  Number of faces
            for (n = 0; n < count; n += 1) {
                ds_list_add(face_list, file_bin_read_byte(file) + file_bin_read_byte(file) * 256);
                ds_list_add(face_list, file_bin_read_byte(file) + file_bin_read_byte(file) * 256);
                ds_list_add(face_list, file_bin_read_byte(file) + file_bin_read_byte(file) * 256);
                ds_list_add(face_list, file_bin_read_byte(file) + file_bin_read_byte(file) * 256);  //  Flags
                ds_list_add(face_list, -1);  //  Material
//  Smoothing of normals:
                var p1, p2, p3, x1, y1, z1, x2, y2, z2, xn, yn, zn;
                p1 = ds_list_find_value(face_list, n * face_size);
                p2 = ds_list_find_value(face_list, n * face_size + 1);
                p3 = ds_list_find_value(face_list, n * face_size + 2);
                x1 = ds_list_find_value(vertex_list, p2 * vertex_size) - ds_list_find_value(vertex_list, p1 * vertex_size);
                y1 = ds_list_find_value(vertex_list, p2 * vertex_size + 1) - ds_list_find_value(vertex_list, p1 * vertex_size + 1);
                z1 = ds_list_find_value(vertex_list, p2 * vertex_size + 2) - ds_list_find_value(vertex_list, p1 * vertex_size + 2);
                x2 = ds_list_find_value(vertex_list, p1 * vertex_size) - ds_list_find_value(vertex_list, p3 * vertex_size);
                y2 = ds_list_find_value(vertex_list, p1 * vertex_size + 1) - ds_list_find_value(vertex_list, p3 * vertex_size + 1);
                z2 = ds_list_find_value(vertex_list, p1 * vertex_size + 2) - ds_list_find_value(vertex_list, p3 * vertex_size + 2);
                xn = -(y1 * z2 - z1 * y2);
                yn = -(z1 * x2 - x1 * z2);
                zn = -(x1 * y2 - y1 * x2);
                ds_list_replace(vertex_list, p1 * vertex_size + 3, ds_list_find_value(vertex_list, p1 * vertex_size + 3) + xn);
                ds_list_replace(vertex_list, p1 * vertex_size + 4, ds_list_find_value(vertex_list, p1 * vertex_size + 4) + yn);
                ds_list_replace(vertex_list, p1 * vertex_size + 5, ds_list_find_value(vertex_list, p1 * vertex_size + 5) + zn);
                ds_list_replace(vertex_list, p2 * vertex_size + 3, ds_list_find_value(vertex_list, p2 * vertex_size + 3) + xn);
                ds_list_replace(vertex_list, p2 * vertex_size + 4, ds_list_find_value(vertex_list, p2 * vertex_size + 4) + yn);
                ds_list_replace(vertex_list, p2 * vertex_size + 5, ds_list_find_value(vertex_list, p2 * vertex_size + 5) + zn);
                ds_list_replace(vertex_list, p3 * vertex_size + 3, ds_list_find_value(vertex_list, p3 * vertex_size + 3) + xn);
                ds_list_replace(vertex_list, p3 * vertex_size + 4, ds_list_find_value(vertex_list, p3 * vertex_size + 4) + yn);
                ds_list_replace(vertex_list, p3 * vertex_size + 5, ds_list_find_value(vertex_list, p3 * vertex_size + 5) + zn);
            }
            file_pos += 2 + count * 8;
            break;
        case 16704: //  Mapping coordinates
            count = file_bin_read_byte(file) + file_bin_read_byte(file) * 256;  //  Number of verteces
            for (n = 0; n < count * 2; n += 1) {
                f4 = file_bin_read_byte(file);
                f3 = file_bin_read_byte(file);
                f2 = file_bin_read_byte(file);
                f1 = file_bin_read_byte(file);
                if ((f1 = 0) && (f2 = 0) && (f3 = 0) && (f4 = 0))
                    fl = 0;
                else {
                    fl = power(2, (f1 * 2) mod 256 + floor(f2 / 128) - 127) * ((f4 * 0.00000011920928955078125 + f3 * 0.000030517578125 + (f2 mod 128) * 0.0078125) + 1);
                    if (f1 > 127)
                        fl = -fl;
                }
                ds_list_add(mapping_list, fl);
            }
            file_pos += 2 + 8 * count;
            break;
        case 16688: //  Face material lists.
            char_read = file_bin_read_byte(file);  //  Read material name
            mat_name = '';
            while (char_read != 0) {
                mat_name += chr(char_read);
                char_read = file_bin_read_byte(file);
                file_pos += 1;
            }
            mat_index = ds_list_find_index(material_list, mat_name) / material_size;
            count = file_bin_read_byte(file) + file_bin_read_byte(file) * 256;  //  Number of verteces
            for (n = 0; n < count; n += 1) {
                f1 = file_bin_read_byte(file) + file_bin_read_byte(file) * 256;
                ds_list_replace(face_list, f1 * 5 + 4, mat_index);
            }
            file_pos += 3 + count * 2;
            break;
        default:    //  Unhandled chunk. Skip to end.
            file_bin_seek(file, chunk_end);
            file_pos = chunk_end;
    }
    ds_stack_push(chunk_stack, chunk_id);
    ds_stack_push(chunk_end_stack, chunk_end);
//  If the end of the parent chunk was reached
    stacktop = ds_stack_top(chunk_end_stack);
    while (file_pos >= stacktop)
    {
        chunk_id = ds_stack_pop(chunk_stack);
        switch chunk_id
        {
            case 16384: //  Object.
                if chunk_model  //  It has a trimesh, so build the model.
                {
                    pos = ds_grid_width(argument1);
                    ds_grid_resize(argument1, pos + 1, 2 + ds_list_size(material_list) * 2 / 3);
                    ds_grid_set(argument1, pos, 0, chunk_name);
                    for (n = 0; n < ds_list_size(material_list) / material_size; n += 1)
                    {
//                        chunk_model = d3d_model_create();
                        ds_grid_set(argument1, pos, 2 + n * 2, -1);
                        ds_grid_set(argument1, pos, 3 + n * 2, ds_list_find_value(material_list, 2 + material_size * n));
//                        d3d_model_primitive_begin(chunk_model, pr_trianglelist);
                    }
//  Normalize normals
                    for (n = 3; n < ds_list_size(vertex_list); n += vertex_size) {
                        var l;
                        l = sqr(ds_list_find_value(vertex_list, n)) + sqr(ds_list_find_value(vertex_list, n + 1)) + sqr(ds_list_find_value(vertex_list, n + 2));
                        if (l > 0) {
                            l = 1 / sqrt(l);
                            ds_list_replace(vertex_list, n, ds_list_find_value(vertex_list, n) * l);
                            ds_list_replace(vertex_list, n + 1, ds_list_find_value(vertex_list, n + 1) * l);
                            ds_list_replace(vertex_list, n + 2, ds_list_find_value(vertex_list, n + 2) * l);
                        }
                    }

                    chunk_grid = ds_grid_create(ds_list_size(face_list) / face_size, 16);
                    ds_grid_set(argument1, pos, 1, chunk_grid);
                    for (n = 0; n < ds_list_size(face_list); n += face_size)
                    {
                        var dp, chunk_grid_index, mat_ind, mat_color, vert_color;
                        chunk_grid_index = n / face_size;
                        mat_ind = max(0, ds_list_find_value(face_list, n + 4));
                        mat_color = ds_list_find_value(material_list, 1 + material_size * mat_ind);
                        chunk_model = ds_grid_get(argument1, pos, 2 + mat_ind * 2);
                        if (chunk_model < 0) {
                            chunk_model = d3d_model_create();
                            ds_grid_set(argument1, pos, 2 + mat_ind * 2, chunk_model);
                            d3d_model_primitive_begin(chunk_model, pr_trianglelist);
                        }
                        ds_grid_set(chunk_grid, chunk_grid_index, 0, ds_list_find_value(face_list, n + 4));
//                        d3d_model_primitive_begin(chunk_model, pr_trianglelist);
                        pos2 = ds_list_find_value(face_list, n);
                        ds_grid_set(chunk_grid, chunk_grid_index, 1, ds_list_find_value(vertex_list, pos2 * vertex_size));
                        ds_grid_set(chunk_grid, chunk_grid_index, 2, ds_list_find_value(vertex_list, pos2 * vertex_size + 1));
                        ds_grid_set(chunk_grid, chunk_grid_index, 3, ds_list_find_value(vertex_list, pos2 * vertex_size + 2));
                        ds_grid_set(chunk_grid, chunk_grid_index, 4, ds_list_find_value(mapping_list, pos2 * 2));
                        ds_grid_set(chunk_grid, chunk_grid_index, 5, ds_list_find_value(mapping_list, pos2 * 2 + 1));
                        if argument2 {
                            dp = max(0, -(argument5 * ds_list_find_value(vertex_list, pos2 * vertex_size + 3) + argument6 * ds_list_find_value(vertex_list, pos2 * vertex_size + 4) + argument7 * ds_list_find_value(vertex_list, pos2 * vertex_size + 5)));
                            vert_color = merge_color(argument3, argument4, dp);
                            vert_color = floor((mat_color mod 256) * (vert_color mod 256) / 255) + floor((floor(mat_color / 256) mod 256) * (floor(vert_color / 256) mod 256) / 255) * 256 + floor((floor(mat_color / 65536) mod 256) * (floor(vert_color / 65536) mod 256) / 255) * 65536;
                            d3d_model_vertex_normal_texture_color(chunk_model, ds_list_find_value(vertex_list, pos2 * vertex_size), ds_list_find_value(vertex_list, pos2 * vertex_size + 1), ds_list_find_value(vertex_list, pos2 * vertex_size + 2), ds_list_find_value(vertex_list, pos2 * vertex_size + 3), ds_list_find_value(vertex_list, pos2 * vertex_size + 4), ds_list_find_value(vertex_list, pos2 * vertex_size + 5), ds_list_find_value(mapping_list, pos2 * 2), ds_list_find_value(mapping_list, pos2 * 2 + 1), vert_color, 1);
                        } else {
                            if (mat_color = c_white)
                                d3d_model_vertex_normal_texture(chunk_model, ds_list_find_value(vertex_list, pos2 * vertex_size), ds_list_find_value(vertex_list, pos2 * vertex_size + 1), ds_list_find_value(vertex_list, pos2 * vertex_size + 2), ds_list_find_value(vertex_list, pos2 * vertex_size + 3), ds_list_find_value(vertex_list, pos2 * vertex_size + 4), ds_list_find_value(vertex_list, pos2 * vertex_size + 5), ds_list_find_value(mapping_list, pos2 * 2), ds_list_find_value(mapping_list, pos2 * 2 + 1));
                            else
                                d3d_model_vertex_normal_texture_color(chunk_model, ds_list_find_value(vertex_list, pos2 * vertex_size), ds_list_find_value(vertex_list, pos2 * vertex_size + 1), ds_list_find_value(vertex_list, pos2 * vertex_size + 2), ds_list_find_value(vertex_list, pos2 * vertex_size + 3), ds_list_find_value(vertex_list, pos2 * vertex_size + 4), ds_list_find_value(vertex_list, pos2 * vertex_size + 5), ds_list_find_value(mapping_list, pos2 * 2), ds_list_find_value(mapping_list, pos2 * 2 + 1), mat_color, 1);
                        }
                        pos2 = ds_list_find_value(face_list, n + 1);
                        ds_grid_set(chunk_grid, chunk_grid_index, 6, ds_list_find_value(vertex_list, pos2 * vertex_size));
                        ds_grid_set(chunk_grid, chunk_grid_index, 7, ds_list_find_value(vertex_list, pos2 * vertex_size + 1));
                        ds_grid_set(chunk_grid, chunk_grid_index, 8, ds_list_find_value(vertex_list, pos2 * vertex_size + 2));
                        ds_grid_set(chunk_grid, chunk_grid_index, 9, ds_list_find_value(mapping_list, pos2 * 2));
                        ds_grid_set(chunk_grid, chunk_grid_index, 10, ds_list_find_value(mapping_list, pos2 * 2 + 1));
                        if argument2 {
                            dp = max(0, -(argument5 * ds_list_find_value(vertex_list, pos2 * vertex_size + 3) + argument6 * ds_list_find_value(vertex_list, pos2 * vertex_size + 4) + argument7 * ds_list_find_value(vertex_list, pos2 * vertex_size + 5)));
                            vert_color = merge_color(argument3, argument4, dp);
                            vert_color = floor((mat_color mod 256) * (vert_color mod 256) / 255) + floor((floor(mat_color / 256) mod 256) * (floor(vert_color / 256) mod 256) / 255) * 256 + floor((floor(mat_color / 65536) mod 256) * (floor(vert_color / 65536) mod 256) / 255) * 65536;
                            d3d_model_vertex_normal_texture_color(chunk_model, ds_list_find_value(vertex_list, pos2 * vertex_size), ds_list_find_value(vertex_list, pos2 * vertex_size + 1), ds_list_find_value(vertex_list, pos2 * vertex_size + 2), ds_list_find_value(vertex_list, pos2 * vertex_size + 3), ds_list_find_value(vertex_list, pos2 * vertex_size + 4), ds_list_find_value(vertex_list, pos2 * vertex_size + 5), ds_list_find_value(mapping_list, pos2 * 2), ds_list_find_value(mapping_list, pos2 * 2 + 1), vert_color, 1);
                        } else {
                            if (mat_color = c_white)
                                d3d_model_vertex_normal_texture(chunk_model, ds_list_find_value(vertex_list, pos2 * vertex_size), ds_list_find_value(vertex_list, pos2 * vertex_size + 1), ds_list_find_value(vertex_list, pos2 * vertex_size + 2), ds_list_find_value(vertex_list, pos2 * vertex_size + 3), ds_list_find_value(vertex_list, pos2 * vertex_size + 4), ds_list_find_value(vertex_list, pos2 * vertex_size + 5), ds_list_find_value(mapping_list, pos2 * 2), ds_list_find_value(mapping_list, pos2 * 2 + 1));
                            else
                                d3d_model_vertex_normal_texture_color(chunk_model, ds_list_find_value(vertex_list, pos2 * vertex_size), ds_list_find_value(vertex_list, pos2 * vertex_size + 1), ds_list_find_value(vertex_list, pos2 * vertex_size + 2), ds_list_find_value(vertex_list, pos2 * vertex_size + 3), ds_list_find_value(vertex_list, pos2 * vertex_size + 4), ds_list_find_value(vertex_list, pos2 * vertex_size + 5), ds_list_find_value(mapping_list, pos2 * 2), ds_list_find_value(mapping_list, pos2 * 2 + 1), mat_color, 1);
                        }
                        pos2 = ds_list_find_value(face_list, n + 2);
                        ds_grid_set(chunk_grid, chunk_grid_index, 11, ds_list_find_value(vertex_list, pos2 * vertex_size));
                        ds_grid_set(chunk_grid, chunk_grid_index, 12, ds_list_find_value(vertex_list, pos2 * vertex_size + 1));
                        ds_grid_set(chunk_grid, chunk_grid_index, 13, ds_list_find_value(vertex_list, pos2 * vertex_size + 2));
                        ds_grid_set(chunk_grid, chunk_grid_index, 14, ds_list_find_value(mapping_list, pos2 * 2));
                        ds_grid_set(chunk_grid, chunk_grid_index, 15, ds_list_find_value(mapping_list, pos2 * 2 + 1));
                        if argument2 {
                            dp = max(0, -(argument5 * ds_list_find_value(vertex_list, pos2 * vertex_size + 3) + argument6 * ds_list_find_value(vertex_list, pos2 * vertex_size + 4) + argument7 * ds_list_find_value(vertex_list, pos2 * vertex_size + 5)));
                            vert_color = merge_color(argument3, argument4, dp);
                            vert_color = floor((mat_color mod 256) * (vert_color mod 256) / 255) + floor((floor(mat_color / 256) mod 256) * (floor(vert_color / 256) mod 256) / 255) * 256 + floor((floor(mat_color / 65536) mod 256) * (floor(vert_color / 65536) mod 256) / 255) * 65536;
                            d3d_model_vertex_normal_texture_color(chunk_model, ds_list_find_value(vertex_list, pos2 * vertex_size), ds_list_find_value(vertex_list, pos2 * vertex_size + 1), ds_list_find_value(vertex_list, pos2 * vertex_size + 2), ds_list_find_value(vertex_list, pos2 * vertex_size + 3), ds_list_find_value(vertex_list, pos2 * vertex_size + 4), ds_list_find_value(vertex_list, pos2 * vertex_size + 5), ds_list_find_value(mapping_list, pos2 * 2), ds_list_find_value(mapping_list, pos2 * 2 + 1), vert_color, 1);
                        } else {
                            if (mat_color = c_white)
                                d3d_model_vertex_normal_texture(chunk_model, ds_list_find_value(vertex_list, pos2 * vertex_size), ds_list_find_value(vertex_list, pos2 * vertex_size + 1), ds_list_find_value(vertex_list, pos2 * vertex_size + 2), ds_list_find_value(vertex_list, pos2 * vertex_size + 3), ds_list_find_value(vertex_list, pos2 * vertex_size + 4), ds_list_find_value(vertex_list, pos2 * vertex_size + 5), ds_list_find_value(mapping_list, pos2 * 2), ds_list_find_value(mapping_list, pos2 * 2 + 1));
                            else
                                d3d_model_vertex_normal_texture_color(chunk_model, ds_list_find_value(vertex_list, pos2 * vertex_size), ds_list_find_value(vertex_list, pos2 * vertex_size + 1), ds_list_find_value(vertex_list, pos2 * vertex_size + 2), ds_list_find_value(vertex_list, pos2 * vertex_size + 3), ds_list_find_value(vertex_list, pos2 * vertex_size + 4), ds_list_find_value(vertex_list, pos2 * vertex_size + 5), ds_list_find_value(mapping_list, pos2 * 2), ds_list_find_value(mapping_list, pos2 * 2 + 1), mat_color, 1);
                        }


/*                        pos2 = ds_list_find_value(face_list, n);
                        d3d_model_vertex_texture(chunk_model, ds_list_find_value(vertex_list, pos2 * vertex_size), ds_list_find_value(vertex_list, pos2 * vertex_size + 1), ds_list_find_value(vertex_list, pos2 * vertex_size + 2), ds_list_find_value(mapping_list, pos2 * 2), ds_list_find_value(mapping_list, pos2 * 2 + 1));
                        pos2 = ds_list_find_value(face_list, n + 1);
                        d3d_model_vertex_texture(chunk_model, ds_list_find_value(vertex_list, pos2 * vertex_size), ds_list_find_value(vertex_list, pos2 * vertex_size + 1), ds_list_find_value(vertex_list, pos2 * vertex_size + 2), ds_list_find_value(mapping_list, pos2 * 2), ds_list_find_value(mapping_list, pos2 * 2 + 1));
                        pos2 = ds_list_find_value(face_list, n + 2);
                        d3d_model_vertex_texture(chunk_model, ds_list_find_value(vertex_list, pos2 * vertex_size), ds_list_find_value(vertex_list, pos2 * vertex_size + 1), ds_list_find_value(vertex_list, pos2 * vertex_size + 2), ds_list_find_value(mapping_list, pos2 * 2), ds_list_find_value(mapping_list, pos2 * 2 + 1));*/
                        //d3d_model_primitive_end(chunk_model);
                        if (n mod 10660 * face_size = 0) {
                            d3d_model_primitive_end(chunk_model);
                            d3d_model_primitive_begin(chunk_model, pr_trianglelist);
                        }
                    }
                    for (n = 0; n < ds_list_size(material_list) / material_size; n += 1)
                        d3d_model_primitive_end(ds_grid_get(argument1, pos, 2 + n * 2));
                }
                break;
        }
        ds_stack_pop(chunk_end_stack);
        if (ds_stack_size(chunk_end_stack) > 0)
            stacktop = ds_stack_top(chunk_end_stack);
        else
            stacktop = 4294967295;
    }
}
ds_stack_destroy(chunk_stack);
ds_stack_destroy(chunk_end_stack);
ds_list_destroy(vertex_list);
ds_list_destroy(face_list);
ds_list_destroy(mapping_list);
ds_list_destroy(material_list);

file_bin_close(file);

  • 0

#6 DemonnPrincess

DemonnPrincess

    GMC Member

  • New Member
  • 9 posts

Posted 27 June 2012 - 08:12 AM

Thank you. :3 I will use these codes to see what I can do. I'm still an amateur in my opinion so hopefully I can figure it out.
  • 0

#7 Nebuer

Nebuer

    GMC Member

  • GMC Member
  • 21 posts

Posted 27 June 2012 - 09:16 PM

or u can use blender (or equivalent free program) to convert to obj them use gmmodelfix to make a d3d
  • 0

#8 Gamer3D

Gamer3D

    Human* me = this;

  • GMC Member
  • 1587 posts
  • Version:GM8.1

Posted 28 June 2012 - 08:06 AM

here ya go bra
-SNIP-

Did you just copy-paste the code I had in spoiler tags?

If so, okay...
If not, it's good to know my code's become relatively popular for this. I may go back and tweak it to be faster.

EDIT: A closer look reveals that he added more thorough argument comments.

EDIT #2: In case I didn't make myself clear, I really do want to know whether that script is commonly used.

Edited by Gamer3D, 28 June 2012 - 10:41 AM.

  • 0

#9 ChaosMaker

ChaosMaker

    GMC Member

  • GMC Member
  • 288 posts
  • Version:GM:HTML5

Posted 28 June 2012 - 03:25 PM

Use my DLL, load any 3ds model much more faster than any thing

3DS Loader.dll





  • 0

#10 slayer 64

slayer 64

    GMC Member

  • GMC Member
  • 3273 posts
  • Version:GM8.1

Posted 29 June 2012 - 12:15 AM

i wouldn't use a dll. once the 3ds is converted to a game maker model you're done. yea, Gamer3d i did copy paste it from one of my projects. i didn't see you posted it.
  • 0

#11 Futhark

Futhark

  • GMC Member
  • 673 posts
  • Version:GM8.1

Posted 29 June 2012 - 12:26 AM

or u can use blender (or equivalent free program) to convert to obj them use gmmodelfix to make a d3d


@slayer 64: I see you put a negative rep to this post. Why is that?

Not being a meanie, just wondering why Nebuer's suggestion is not feasible (according to you). I've not used gmmodelfix, so don't know if it's a bad prog or not.
  • 0

#12 slayer 64

slayer 64

    GMC Member

  • GMC Member
  • 3273 posts
  • Version:GM8.1

Posted 29 June 2012 - 01:02 AM


or u can use blender (or equivalent free program) to convert to obj them use gmmodelfix to make a d3d

@slayer 64: I see you put a negative rep to this post. Why is that?
Not being a meanie, just wondering why Nebuer's suggestion is not feasible (according to you). I've not used gmmodelfix, so don't know if it's a bad prog or not.

how did you know it was me? i didn't see a reason to convert the 3ds to obj and then to d3d when there a script to go straight to d3d. i thought it was more work than what needed to be done.
  • 0

#13 Futhark

Futhark

  • GMC Member
  • 673 posts
  • Version:GM8.1

Posted 29 June 2012 - 01:32 AM



or u can use blender (or equivalent free program) to convert to obj them use gmmodelfix to make a d3d

@slayer 64: I see you put a negative rep to this post. Why is that?
Not being a meanie, just wondering why Nebuer's suggestion is not feasible (according to you). I've not used gmmodelfix, so don't know if it's a bad prog or not.

how did you know it was me?


If you click the reputation-number then you get a list of who has voted, and how.


i didn't see a reason to convert the 3ds to obj and then to d3d when there a script to go straight to d3d. i thought it was more work than what needed to be done.


Ahhh! Ok, that makes sense :thumbsup:

I have rarely had a good experience converting any 3D format from one format to another, so I can imagine the final output in this case might not be the same as what you started with and it's extra steps like you mention.
  • 0

#14 ChaosMaker

ChaosMaker

    GMC Member

  • GMC Member
  • 288 posts
  • Version:GM:HTML5

Posted 29 June 2012 - 01:53 PM

use "dlls" is the best way to load models like 3ds,obj,x,md2 for the game maker so quickly.

Edited by ChaosMaker, 04 July 2012 - 06:10 PM.

  • 0

#15 slayer 64

slayer 64

    GMC Member

  • GMC Member
  • 3273 posts
  • Version:GM8.1

Posted 02 July 2012 - 02:05 AM

use "dlls" is the best way to load models for the game maker so quickly.

d3d_model_load(model,fname) is pretty tit
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users