Giter Site home page Giter Site logo

xtreme3d / xtreme3d Goto Github PK

View Code? Open in Web Editor NEW
38.0 5.0 8.0 175.33 MB

3D engine for GameMaker Studio 2

Home Page: https://xtreme3d.ru

License: Other

Pascal 68.70% Batchfile 0.01% Shell 0.01% HTML 17.28% CSS 0.03% Python 7.37% GLSL 0.10% D 2.17% Lua 0.43% Game Maker Language 3.80% Yacc 0.11%
gamemaker gamemaker-studio-2

xtreme3d's Introduction

Xtreme3D v3

Xtreme3D is a cross-language 3D graphics engine based on GLScene. It has a rich feature set, including custom shaders, wide variety of asset formats support, built-in effects, physics, collision and ray casting.

Xtreme3D originally was created for Game Maker. It makes possible to create full-featured 3D games with modern graphics and reasonable framerate in a tool that was intended mainly for 2D games and provides limited built-in 3D capabilities. Original Xtreme3D was a closed-source project, and it was abandoned by the author. Xtreme3D 2.0.2.0 (2006) was the last official release. So we in Russian Xtreme3D community made an attempt to rewrite the engine, maintaining the API as close to original as possible. This work began in 2009 and was completed in 2016. This project is not connected in any way with the original Xtreme3D developer, all code was written from scratch.

The engine is written in Delphi and based on a modified version of GLScene 1.0.0.0714. The code should be compiled with Delphi 7 (other Delphi versions are not tested).

Unfortunately, Xtreme3D SDK is not compatible with Game Maker Studio 2 version 2022.800.0.161 and higher because Xtreme3D.dll is currently 32-bit only.

You can use Xtreme3D with almost any programming language. We already provide Python, D and LuaJIT bindings which are automatically generated from engine's source code.

Visit Xtreme3D site at https://xtreme3d.ru.

Screenshots

Screenshot3 Screenshot1 Screenshot4 Screenshot4 Screenshot4 Screenshot4

Features

  • Extremely lightweight. It's just a DLL of 2 MB in size (plus three optional DLLs - ode.dll, freetype.dll, OpenFBX.dll)
  • Can be used with any language that supports DLLs and stdcall convension
  • Scene graph with object hierarchy/pivoting
  • Built-in primitives (such as box, sphere, cylinder, teapot, etc.)
  • Materials and textures. Materials can be loaded from script files
  • GLSL shaders
  • Built-in easy to use shaders, including cel shader, bump/parallax shader, phong shader, multimaterial shader, etc.
  • Multitexturing. Materials can have up to 8 texture slots accessible from shaders. Fixed-pipeline multipass multitexturing is also supported
  • Popular image formats support for textures (BMP, JPG, PNG, TGA, DDS)
  • Various 3D model formats support (3DS, OBJ, LWO, B3D, MD2, MD3, MD5, SMD, FBX and many other)
  • Procedural mesh construction from vertex/normal/texcoord/index lists - you are free to design your own model format
  • Model animation, per-vertex and skeletal
  • Lightmapping and dynamic lighting
  • Terrain with automatic LOD and real-time editing
  • Dynamic water rendering
  • Dynamic soft shadows
  • Static and dynamic cubemaps
  • Particle system for fire-like and lighting-like effects
  • Lensflare effect
  • 2D shapes, including rectangle, circle, line, and custom 2D mesh
  • 2D sprites and text with TTF and Unicode support
  • 3D text and billboards
  • Skyboxes
  • Procedural skydome with sun, stars and animated day/night cycle
  • Procedural trees
  • Lines and curves rendering (Cubic, Bezier, NURBS)
  • Curves can be used to control object movement
  • Discrete LOD system
  • Offscreen rendering via p-buffers or FBOs
  • Collision detection between bounding spheres, oriented bounding boxes and meshes
  • Raycasting
  • Built-in game-oriented collision systems (DCE, FPSManager)
  • Integrated rigid body physics using ODE engine
  • Kraft physics engine integration
  • Ragdolls
  • Octree and quadtree to speed-up rendering and collision tests
  • Loading resources from GLScene PAK archives
  • Keyboard and mouse input
  • Window creation and management
  • ...plus a lot more!

Documentation

Xtreme3D is fully documented in Russian, the help file is here. Machine-translated English version is also available (thanks to Bill Collins for making it).

Asset Creation

For static geometry with lightmaps (such as levels), we recommend using B3D (Blitz3D) format. You can use B3D exporter for Blender to create models in this format - find it in tools/blender-b3d-exporter.

For animated geometry, we recommend either SMD (Half-Life) or MD5 (Doom 3) formats. You can use MD5 exporter for Blender to create models in this format - find it in tools/blender-md5-exporter.

License

Xtreme3D 3.x and corresponding GLScene fork are both distributed under Mozilla Public License 1.1. This license allows you to create commercial closed-source applications with the engine.

ODE is distributed under BSD-style license.

FreeType is distributed under FreeType License (FTL).

OpenFBX is distributed under MIT license.

xtreme3d's People

Contributors

gecko0307 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

xtreme3d's Issues

Tools for CCD

Here is a possible way for dealing with map collisions without using DCE. This architecture allows multiple bounding spheres to collide with a map. And all movement/collision solving control is in the hands of a programmer - the engine only computes new states without applying them to objects.

Collision queries are speeded up with octrees. Xtreme3D has octree support for Freeforms. For collision solving, it should be possible to query full contact information of sphere/octree collisions. This information can be stored in special SphereSweep object that encapsulates regular object:

  • SphereSweepCreate(object, radius)
  • SphereSweepSetRadius(sphsweep, radius)
  • SphereSweepSetVelocity(sphsweep, vel)
  • SphereSweepSetDirection(sphsweep, x, y, z)
  • SphereSweepGetVelocity(sphsweep)
  • SphereSweepGetDirection(sphsweep, index)

Now the programmer creates a SphereSweep for his object and manipulates it instead of directly moving the object. Total velocity and median direction should be computed for all impacts on the object (user input, gravity, external forces, etc), and passed to SphereSweep. How these are computed is up to the programmer, he can use forces, accelerations, or impulses for that.

Then, when current velocity is known, continious collision detection with the Freeform can be performed. This is done in FreeformSphereSweepIntersect, which can be easily rewritten to work with SphereSweep:

  • FreeformSphereSweepIntersect(freeform, sphsweep)

Then intersection info can be obtained with

  • SphereSweepGetCollisionPosition(sphsweep, index)
  • SphereSweepGetCollisionNormal(sphsweep, index)
  • SphereSweepGetCollisionDistance(sphsweep)

Distance is a distance between sphere's position and intersection point. If it is smaller than sphere's radius, sphere is currently intersecting a triangle, and the penetration depth should be computed (radius - distance) to solve the collision (translate the sphere along normal * depth). Otherwise, sphere is going to collide in next step, so its velocity should be adjusted to prevent possible collision. New velocity is computed given current velocity vector (sphere's direction), intersection distance and timestep: direction * distance / dt. This computations can be done in special function:

  • SphereSweepSolveCollision(sphsweep, dt)

This function would compute a new object position and velocity. They, however, should be applied manually, to allow customizations:

  • SphereSweepGetCorrectedPosition(sphsweep, index)
  • SphereSweepGetCorrectedVelocity(sphsweep, index)

It probably should also be possible to apply position and velocity automatically, given a timestep:

  • SphereSweepUpdateObject(sphsweep, dt)

There should also be a function to determine current intersection (when distance < radius), future intersection (when distance > radius), and no intersection at all - it should return 1, 2 and 0 accordingly:

  • SphereSweepCollisionStatus(sphsweep)

Better multitexturing API

  • MaterialLoadTextureEx(material, filename, index)
  • MaterialSetTextureEx(material, material2, index)
  • MaterialGenTextureEx(material, index, width, height)
  • MaterialEnableTextureEx(material, index, mode)
  • MaterialHasTextureEx(material, index)

Squall integration

  • SquallFree()
  • SquallSoundPlay(snd, loop)
  • SquallSoundDelete(snd)
  • SquallSoundDeleteAll()
  • SquallChannelPause(chan, pause)
  • SquallChannelSetPosition(chan, x, y, z)
  • SquallChannelSetVelocity(chan, x, y, z)
  • SquallChannelSetPositionFromObject(chan, obj)
  • SquallChannelSetVolume(chan, volume)
  • SquallChannelSetFrequency(chan, freq)
  • SquallChannelSetMinMaxDistance(chan, mind, maxd)
  • SquallChannelSetConeParameters(chan, orientation, inangle, outangle, outvolume)
  • SquallChannelIsPlaying(chan)
  • SquallChannelSetSeekPosition(chan, pos)
  • SquallChannelGetSeekPosition(chan)
  • SquallSetListenerPosition(x, y, z)
  • SquallSetListenerPositionFromObject(obj)
  • SquallSetListenerTransformationFromObject(obj)
  • SquallSetListenerVelocity(x, y, z)

Sprite improvements

Suggested here.

  • SpriteCreateEx(material, width, height, left, top, right, bottom, parent)
  • HUDSpriteCreateEx(material, width, height, left, top, right, bottom, parent)
  • SpriteSetBounds(sprite, left, top, right, bottom)
  • SpriteSetUVBounds(sprite, left, top, right, bottom)
  • SpriteSetOrigin(sprite, x, y)
  • MaterialGetTextureWidth(material)
  • MaterialGetTextureHeight(material)

BumpShader

Changing texture coordinate slot which is used to pass tangent vectors broke built-in BumpShader.

Color construction functions

  • MakeColorRGB(r, g, b) - where r, g, b are in range 0..255
  • MakeColorRGBFloat(r, g, b) - where r, g, b are in range 0..1

Override materials

Override materials are useful to render a bunch of objects with some given material/shader. For example, this is necessary to implement deferred rendering, VSM, god rays and so on. This is how they can be implemented with existing GLScene architecture.

Viewers/FBOs can optionally store an override material and pass it to objects. This can be done efficiently via rci - in TRenderContextInfo should be a new field, overrideMaterial. TGLScene.RenderScene should get corresponding material from TGLSceneBuffer (and we can set it to buffer when rendering FBO). In TGLCustomSceneObject (base type for all objects with material) there should be a possibility to bind this material from rci.

Functions to implement:

  • FBOSetOverrideMaterial(fbo, matlib, matname)
  • ViewerSetOverrideMaterial(viewer, matlib, matname)

If empty string is passed, override material will be turned off.

Use ObjectHash to store objects in Lua

LuaSetObjectHash should be used to set global hash that luaGetObject uses to lookup objects. This way any objects can be easily acessed from Lua with the same function Object.

TrisRendered

TrisRendered function lacks implementation.
This can be done by summing triangles of all visible Freeforms and Actors.

Get lightmap index of a facegroup

There should be a function to get lightmap index of a facegroup:

FreeformMeshFaceGroupGetLightmapIndex(freeform, mesh, facegroup)

Tools for implementing VSM

While VSM itself can be implemented with shaders, FBO and an override material, there's still a problem with shadow matrix (eye space to light space). This matrix is already computed in TGLShadowMap. This class can be extended to support setting custom FBO to render the shadow map, and then its shadow matrix can be passed to VSM shader.

Necessary functions:

  • ShadowMapSetFBO(sm, fbo)

Copying texture from one library to another

There should be a function to copy a texture from one material to another if these materials belong to different libraries. Something like this:

MaterialSetTextureExFromLibrary(material1, matlib, material2, index)

FBO color/depth formats

Instead of FBOUseFloatColorBuffer, make function FBOSetColorTextureFormat with following possible constants (compatible with MaterialSetTextureFormat):

  • tfRGBA (default)
  • tfRGBA16
  • tfRGBAFloat16
  • tfRGBAFloat32

Also FBOSetDepthTextureFormat:

  • dfDepth16
  • dfDepth24
  • dfDepth32
  • dfDepthFloat32
  • dfDepth24Stencil8 (default)
  • dfDepthFloat32Stencil8

Modifying buffer format should cause lazy reinitialization of the buffer (on next frame render).

Expose Xtreme3D functions to Lua scripts

  • Engine
  • Viewer
  • Dummycube
  • Camera
  • Light
  • Font & Text
  • Sprite
  • HUDShape
  • Primitives
  • Actor
  • Freeform
  • Terrain
  • Object
  • Polygon
  • Material
  • Shaders
  • ThorFX
  • FireFX
  • Lensflare
  • Skydome
  • Water
  • Blur
  • Skybox
  • Lines
  • Tree
  • Trail
  • Shadowplane
  • Shadowvolume
  • Mirror
  • Navigator
  • Movement
  • DCE
  • FPS
  • Partition
  • Proxy
  • Grid
  • ClipPlane
  • MemoryViewer
  • FBO
  • ShadowMap
  • ODE
  • ObjectHash
  • Text
  • Input
  • Window
  • Squall

HUDShape improvements

  • HUDShapeSetSize(shape, w, h)
  • HUDShapeScale(shape, u, v)
  • HUDShapeSetOrigin(shape, x, y)
  • HUDShapeRotate(shape, angle)
  • HUDShapeLineCreate(x1, y1, x2, y2, parent)
  • HUDShapeLineSetPoints(shape, x1, y1, x2, y2)
  • HUDShapeLineSetWidth(shape, w)

Arguments in extended Sprite creation functions

Due to GM's limit on DLL function arguments (not more than 4 if string argument is used), material argument should be excluded from HUDSpriteCreateEx and SpriteCreateEx. Material can be assigned to sprites with ObjectSetMaterial.

Getting geometry data from Freeform

  • FreeformMeshGetVertex(ff, mesh, v, index)
  • FreeformMeshGetNormal(ff, mesh, n, index)
  • FreeformMeshGetTexCoord(ff, mesh, t, index)
  • FreeformMeshGetSecondTexCoord(ff, mesh, t, index)
  • FreeformMeshGetTangent(ff, mesh, t, index)
  • FreeformMeshGetBinormal(ff, mesh, b, index)
  • FreeformMeshFaceGroupGetIndex(ff, mesh, fg, index)

Fast Freeform loading

Don't generate tangents and octree when loading Freeform, because not every model needs them (and TBN actually can be generated in shader). This should be done explicitly when needed with FreeformGenTangents and FreeformBuildOctree.

New Window/Display functions

  • WindowCenter(window)
  • WindowResize(window, x, y, w, h)
  • WindowGetPosition(window, index)
  • WindowGetSize(window, index)
  • WindowSetIcon(window, filename)
  • WindowIsShowing(window)
  • DisplayGetSize(index)

Arguments in ViewerResize

top and left in ViewerResize(viewer, top, left, w, h) shoul be swapped in order for compatibility with Xtreme3D v2.

MaterialCullFrontFaces conflicts with ShadowMap

Adding support for face clipping in materials caused incorrect shadows (severe acne on front faces), because ShadowMap should render only backfaces, and this is now being overrided by material.

TTFont and Windows encoding

There's a problem with using non-ASCII text with TTFont in Game Maker. GM's internal editor encodes scripts using Windows code pages, but TTFont supports only UTF-8. Converting strings is possible, but not convenient and ineffective. The solution is to directly support Windows code pages in TTFont (probably with simple character index mappings using TSimpleDictionary). We should start with windows-1251 to support Cyrillic text.

There should be a function TTFontSetEncoding(ttf, te) where te can be teUTF8 or te1251.

Animated trees

Tree should be convertible to Actor with skeleton and animation.

TreeBuildActor(tree, parent)

Get material name from library

There should be a function to get a material name by its index from a library:

MaterialGetNameFromLibrary(matlib, ind)

Modifying geometry data for Freeform

  • FreeformMeshSetVertex(ff, mesh, v, x, y, z)
  • FreeformMeshSetNormal(ff, mesh, n, x, y, z)
  • FreeformMeshSetTexCoord(ff, mesh, t, u, v)
  • FreeformMeshSetSecondTexCoord(ff, mesh, t, u, v)
  • FreeformMeshSetTangent(ff, mesh, t, x, y, z)
  • FreeformMeshSetBinormal(ff, mesh, b, x, y, z)
  • FreeformMeshFaceGroupSetIndex(ff, mesh, fg, index, i)

Frustum test

ObjectInFrustrum and ObjectIsCulled functions are not implemented.

FBORenderObjectEx

There should be a function FBORenderObjectEx(fbo, object, clear) to turn off buffer clearing and thus allow multipass rendering.

Ideas for 3.1

This is a list of possible features for Xtreme3D 3.1:

  • Manually constructing Freeforms, as suggested by gadmaker
  • FreeformMeshGenTangents, FreeformMeshVerticesCount
  • Transformations for meshes (FreeformMeshTranslate, FreeformMeshRotate, FreeformMeshScale)
  • Saving Freeforms (FreeformSave) - supported formats for saving are GLSM, OBJ, STL, NMF
  • Material's second texture support in GLSL shader (GLSLShaderSetParameterSecondTexture). It should also support automatic texture fetch from current material that the shader is applied to
  • New GLSL based Phong shader with texture support
  • Automatic tangent space generation for Bump shader to work with meshes without precomputed tangent data, such as Actors and built-in primitives (BumpShaderUseAutoTangentSpace)
  • Shadow map support for Bump shader (BumpShaderSetShadowMap)
  • ODE ragdolls
  • Object movement paths (using GLMovement)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.