|GM version:||.x, .x|
With Drag3Drop you can create a 3D game with ease using only drag-and-drop icons.
Nearly all d3d_ functions are made into actions including models and transformations.
Contents:Drag3Drop.gex build 2
Enable/disable 3D mode
Enter or leave 3D mode. If you want to go 3D, perform this action.
Set the 3D projection. The camera will look from (xfrom,yfrom,zfrom) to (xto,yto,zto).
Modify the projection given above by changing the up vector to (xup,yup,zup) with a view angle of Angle degrees and an aspect ratio of Aspect and a maximum viewing distance of zfar.
Enter perspective projection
Create a perspective projection on the region (x,y) to (x+Width,y+Height) rotated by Angle degrees.
Enter orthographic projection
Create an orthographic projection on the region (x,y) to (x+Width,y+Height) rotated by Angle degrees.
Use this action together with to draw overlays.
Turn backface culling on or off (off by default). When it is turned on, only one side of a polygon is drawn, dramatically increasing the performance. As a result shapes and models are only visible on the outside and walls and floors are only visible from one side.
Turn the depth buffer on or off (on by default). When it is turned off, every new shape is drawn in front of the former no matter the actual distance from the camera.
It is recommended to turn off the depth buffer when drawing on an orthographic projection.
Turn fog on or off. When it is turned on, everything drawn up to a distance of Start is not affected, everything drawn beyond End will be completely filled with Color and everything drawn in between Start and End is partly coloured.
Turn lighting on or off. When it is turn on, lighting will be applied to everything you draw according to the specified lights.
Turn light Index on or off. A light can be specified as point source or directional source with the actions below.
Set point light
Set light Index as a point light at position (x,y,z) with the light reaching up to a distance of Range. The light's color is determined by .
Set directional light
Set light Index as an ambient light in the direction of (dx,dy, dz).
Use the direction (0,0,-1) for lighting from above. The light's color is determined by .
Translate over X/Y/Z
Move the current origin by Amount along the x, y or z axis. Use to move along all the axes at once.
Rotate over X/Y/Z
Rotate around the origin by Amount degrees along the x, y or z axis.
For example: use followed by to draw a shape rotated around its centre at the right position.
Move the current origin to (x,y,z).
Change the scaling of coordinates.
Reset all transformations.
Draw a wall from (x1,y1,z1) to (x2,y2,z2).
Draw a floor from (x1,y1,z1) to (x2,y2,z2).
Draw a block from (x1,y1,z1) to (x2,y2,z2).
Draw an ellipsoid - a stretched sphere - from (x1,y1,z1) to (x2,y2,z2).
Draw a vertical cone from (x1,y1,z1) to (x2,y2,z2).
Draw a vertical cylinder from (x1,y1,z1) to (x2,y2,z2).
Set texture from sprite
Set the image of a sprite as the texture from now on.
Set texture from background
Set a background as the texture from now on.
Set the texture manually.
For example: set the texture of a surface with surface_get_texture.
Set the drawing precision (24 by default) of rounded shapes, such as spheres and circles.
Turn closed drawing on or off (on by default). When it is turned on, cylinders and cones are drawn with a top and bottom, otherwise this is left open.
Create a model named Name. This name is stored globally, so you can use it anywhere.
Check if model Name exists and perform the next action if so.
Draw model Name at (x,y,z).
Delete model Name.
Load a 3D model from a file into Name. By default Game Maker models (.mod, .gmmod) and Wavefront models (.obj) are supported.
Save model Name to a file.
Start drawing inside model Name. All basic shapes are put inside the model from here on.
End drawing inside the model.
Create a model named str. If the model already exists, it will be cleared.
Check whether the model named str exists.
Destroy the model named str. Returns whether successful.
Load a 3D model from the file fname into str. By default Game Maker models (.mod, .gmmod) and Wavefront-models (.obj) are supported.
Save model str to the file fname.
Get the index of the model named str.
Bind model ind to the name str.
Remove the binding of the model named str. Unlike drag3drop_model_destroy this function only removes the mapped name, so be sure to remove the model yourself.
Often you would like to get the coordinates of a point in the world as projected on the screen. The functions listed below aid you in doing so. To initialise the transformations, use drag3drop_set_projection_ext, which is also called when setting the projection with and .
drag3drop_set_projection_ext(xfrom, yfrom, zfrom, xto, yto, zto, xup, yup, zup, angle, aspect, znear, zfar)
Update the internal projection variables and set the projection. The arguments are the same as d3d_set_projection_ext.
drag3drop_point_get_distance(x, y, z)
Returns the depth of a point along the camera's centre of view.
drag3drop_point_get_visible(x, y, z)
Returns whether a point is visible, i.e. between znear and zfar.
drag3drop_point_get_x(x, y, z)
Get the x coordinate of a point as projected on the screen.
drag3drop_point_get_y(x, y, z)
Get the y coordinate of a point as projected on the screen.
Would you like to improve upon this extension or reuse parts of the codes? Well, you can. The only requirements are that you accredit Paul (in case you use the Wavefront loader) and me and that the derivative work goes by a similar licence.
|2013-06-25||Extension submitted to the Dutch community|
|2013-10-20||Completed build 2 in Dutch and English.|
Coordinates of (basic) shapes are now specified within the actions instead of requiring a preceding action. As a result, the drawing colour is now used, textures (and repitition) can be specified with a drop-down menu or manually and precision has a default value. Also many positions can be made relative to the instance now, whereas relative previously meant the second set of coordinates was relative to the first. (A disadvantage is that the z variable is mandatory now.)