Author Topic: [Engine Change] Non-Model Rendering  (Read 1006 times)

I am requesting a feature to allow us to render basic 3D shapes without models.

Solution 1: Allow us to directly create objects being rendered on the client without data-blocks (hardest, would probably need a large modification).

A few examples (not including circle, polygon, etc):
Code: [Select]
%obj = new line3D() {
    position = "0 0 0";
    target = "353 213 74";
    size = 2;
    color = "1 1 0 1";
};
That would create a yellow line from 0 0 0 to 353 213 74 with thickness 2 torque units.

Code: [Select]
%obj = new rectangle3D() {
    position = "0 0 10";
    extent = "3 3 3";
    collision = "0 0 0";
    texture = (decalData here);
};
That would create a square at 0 0 0 with a size of 3 3 3, a collision box of 0 0 0 and having the texture (decalData here) rendered on it.

Solution 2: Same as Solution 1, but using datablocks for properties like extent, collision, texture, color, size, etc.

The Mission Editor has something that does this, but it requires an "Editor" object and is client-side only:
Code: (editorRender.cs) [Select]
//-----------------------------------------------------------------------------
// Torque Game Engine
// Copyright (C) GarageGames.com, Inc.
//-----------------------------------------------------------------------------

//------------------------------------------------------------------------------
// Console onEditorRender functions:
//------------------------------------------------------------------------------
// Functions:
//   - renderSphere([pos], [radius], <sphereLevel>);
//   - renderCircle([pos], [normal], [radius], <segments>);
//   - renderTriangle([pnt], [pnt], [pnt]);
//   - renderLine([start], [end], <thickness>);
//
// Variables:
//   - consoleFrameColor - line prims are rendered with this
//   - consoleFillColor
//   - consoleSphereLevel - level of polyhedron subdivision
//   - consoleCircleSegments
//   - consoleLineWidth
//------------------------------------------------------------------------------

function SpawnSphere::onEditorRender(%this, %editor, %selected, %expanded)
{
   if(%selected $= "true")
   {
      %editor.consoleFrameColor = "255 0 0";
      %editor.consoleFillColor = "0 0 0 0";
      %editor.renderSphere(%this.getWorldBoxCenter(), %this.radius, 1);
   }
}

The Mission Editor has something that does this, but it requires an "Editor" object and is client-side only:
We must have server side!:)

I tried making something using that 'editorRender' thing, but I can't really figure out how to implement the Editor rendering system in a outside-of-editor add-on.


I don't think there's much point bumping this - it won't be getting added.

I tried making something using that 'editorRender' thing, but I can't really figure out how to implement the Editor rendering system in a outside-of-editor add-on.

Yeah my point is this is a thread requesting an engine change, but you're just asking for scripting help. You may get more attention if you post that question in the right place.