Skip to content

TurboList Program

Ferdinand Calo edited this page Jun 16, 2020 · 15 revisions
# Feature Overview
Kind: TurboList Program
Extendable: true
JSON based: no
JSON config: no

As you may know from the Model Page, in FVTM we got TurboLists.
(TurboLists are a labeled compound holding an undefined amount of polygons)
Into those "TurboLists" you can include simple classes with code
which then gets executed when a Turbolist is rendered.
This way you can do "animations" and other nice things.

FVTM offers some pre-defined "Programs", take a look at DefaultPrograms!

The Class:

public static interface Program {
		
    public String getId();
		
    public void preRender(TurboList list, @Nullable Entity ent, VehicleData data, @Nullable Colorable color, @Nullable String part);
		
    public void postRender(TurboList list, @Nullable Entity ent, VehicleData data, @Nullable Colorable color, @Nullable String part);
		
 }

Upon rendering a TurboList before it does get rendered, the preRender method
in every attached Program is executed, afterwards after the turbolist rendered
the postRender method is executed.

This way you can for example, in the pre-render, activate some GL code for e.g.
glowing, alpha stuff or whatever, and after it rendered on post-render disable it.
You can also translate the polygons or rotate in pre-render and reset them in post.
There are various ways and various things you can do.

NOTE:

  • the Entity parameter can be null, e.g. if rendering as item, or on a display block
  • the VehicleData parameter can be null, if the model is not for vehicles or parts
  • the Colorable parameter holds RGB data, e.g. for containers,
    which have no vehicledata (usually vehicledata stores RGB for vehicles)
  • the String (part) parameter is the currently rendered part in the vehicledata,
    in case of part models, otherwise it is null

Some good or semi-good examples are in DefaultPrograms! (you can take a look at the class also)

Adding into the Model

Here some information for each model kind:

  • java FVTM/Java Models that use TurboLists
    groups.get("group_id").addProgram(PROGRAM_INSTANCE);
    groups.get("other_id").addProgram(new SomeProgram("argument", 2, false));
    group_instance.addProgram(PROGRAM_INSTANCE);
    //or multiple at once!
    somegroup.addPrograms(PROGRAM_INSTANCE, ANOTHER_INSTANCE, new YetOther(true));
    
    Check also the examples in DefaultPrograms!
Clone this wiki locally