Game Development Community

dev|Pro Game Development Curriculum

Support for 15 terrain textures

by Trenton Shaffer · 12/18/2005 (6:41 pm) · 36 comments

Here is a little resource to add support for 15 terrain textures. Please note that it is possible to add up to 256 textures, but for now we will settle with 15. Keep in mind that you should probably be running the engine in 1024x768 mode.

Lets get started:
· Open the 'EditorGui.gui' file for editing
· Locate the text 'GuiControl(EPainter)'
· Replace the entire EPainter Gui Control code block with the following:
new GuiControl(EPainter) {
         profile = "EditorScrollProfile";
         horizSizing = "left";
         vertSizing = "bottom";
         position = "294 0";
         extent = "346 735";
         minExtent = "8 8";
         visible = "1";
         helpTag = "0";

         new GuiBitmapCtrl(ETerrainMaterialBitmap0) {
            profile = "GuiDefaultProfile";
            horizSizing = "right";
            vertSizing = "bottom";
            position = "9 24";
            extent = "96 96";
            minExtent = "8 8";
            visible = "1";
            helpTag = "0";
            bitmap = "starter.fps/data/terrains/grassland/grass";
            wrap = "1";
         };
         new GuiTextCtrl(ETerrainMaterialText0) {
            profile = "GuiTextProfile";
            horizSizing = "right";
            vertSizing = "bottom";
            position = "10 5";
            extent = "28 18";
            minExtent = "8 8";
            visible = "1";
            helpTag = "0";
            text = "grass";
            maxLength = "255";
         };
         new GuiButtonCtrl(ETerrainMaterialChange0) {
            profile = "GuiButtonProfile";
            horizSizing = "right";
            vertSizing = "bottom";
            position = "9 125";
            extent = "96 22";
            minExtent = "8 8";
            visible = "1";
            command = "ETerrainEditor.changeMaterial(0);";
            helpTag = "0";
            text = "Change...";
            groupNum = "-1";
            buttonType = "PushButton";
         };
         new GuiBorderButtonCtrl(ETerrainMaterialPaint0) {
            profile = "GuiBorderButtonProfile";
            horizSizing = "right";
            vertSizing = "bottom";
            position = "4 6";
            extent = "106 118";
            minExtent = "8 8";
            visible = "1";
            command = "ETerrainEditor.setPaintMaterial(0);";
            helpTag = "0";
            text = "Button";
            groupNum = "-1";
            buttonType = "RadioButton";
         };
         new GuiBitmapCtrl(ETerrainMaterialBitmap1) {
            profile = "GuiDefaultProfile";
            horizSizing = "right";
            vertSizing = "bottom";
            position = "9 170";
            extent = "96 96";
            minExtent = "8 8";
            visible = "1";
            helpTag = "0";
            bitmap = "starter.fps/data/terrains/grassland/grass";
            wrap = "1";
         };
         new GuiTextCtrl(ETerrainMaterialText1) {
            profile = "GuiTextProfile";
            horizSizing = "right";
            vertSizing = "bottom";
            position = "10 151";
            extent = "28 18";
            minExtent = "8 8";
            visible = "1";
            helpTag = "0";
            text = "grass";
            maxLength = "255";
         };
         new GuiButtonCtrl(ETerrainMaterialChange1) {
            profile = "GuiButtonProfile";
            horizSizing = "right";
            vertSizing = "bottom";
            position = "9 271";
            extent = "96 22";
            minExtent = "8 8";
            visible = "1";
            command = "ETerrainEditor.changeMaterial(1);";
            helpTag = "0";
            text = "Change...";
            groupNum = "-1";
            buttonType = "PushButton";
         };
         new GuiBorderButtonCtrl(ETerrainMaterialPaint1) {
            profile = "GuiBorderButtonProfile";
            horizSizing = "right";
            vertSizing = "bottom";
            position = "4 152";
            extent = "106 118";
            minExtent = "8 8";
            visible = "1";
            command = "ETerrainEditor.setPaintMaterial(1);";
            helpTag = "0";
            text = "Button";
            groupNum = "-1";
            buttonType = "RadioButton";
         };
         new GuiBitmapCtrl(ETerrainMaterialBitmap2) {
            profile = "GuiDefaultProfile";
            horizSizing = "right";
            vertSizing = "bottom";
            position = "9 312";
            extent = "96 96";
            minExtent = "8 8";
            visible = "1";
            helpTag = "0";
            bitmap = "starter.fps/data/terrains/grassland/grass";
            wrap = "1";
         };
         new GuiTextCtrl(ETerrainMaterialText2) {
            profile = "GuiTextProfile";
            horizSizing = "right";
            vertSizing = "bottom";
            position = "10 293";
            extent = "28 18";
            minExtent = "8 8";
            visible = "1";
            helpTag = "0";
            text = "grass";
            maxLength = "255";
         };
         new GuiButtonCtrl(ETerrainMaterialChange2) {
            profile = "GuiButtonProfile";
            horizSizing = "right";
            vertSizing = "bottom";
            position = "9 413";
            extent = "96 22";
            minExtent = "8 8";
            visible = "1";
            command = "ETerrainEditor.changeMaterial(2);";
            helpTag = "0";
            text = "Change...";
            groupNum = "-1";
            buttonType = "PushButton";
         };
         new GuiBorderButtonCtrl(ETerrainMaterialPaint2) {
            profile = "GuiBorderButtonProfile";
            horizSizing = "right";
            vertSizing = "bottom";
            position = "4 294";
            extent = "106 118";
            minExtent = "8 8";
            visible = "1";
            command = "ETerrainEditor.setPaintMaterial(2);";
            helpTag = "0";
            text = "Button";
            groupNum = "-1";
            buttonType = "RadioButton";
         };
         new GuiBitmapCtrl(ETerrainMaterialBitmap3) {
            profile = "GuiDefaultProfile";
            horizSizing = "right";
            vertSizing = "bottom";
            position = "9 454";
            extent = "96 96";
            minExtent = "8 8";
            visible = "1";
            helpTag = "0";
            bitmap = "starter.fps/data/terrains/grassland/grass";
            wrap = "1";
         };
         new GuiTextCtrl(ETerrainMaterialText3) {
            profile = "GuiTextProfile";
            horizSizing = "right";
            vertSizing = "bottom";
            position = "10 435";
            extent = "28 18";
            minExtent = "8 8";
            visible = "1";
            helpTag = "0";
            text = "grass";
            maxLength = "255";
         };
         new GuiButtonCtrl(ETerrainMaterialChange3) {
            profile = "GuiButtonProfile";
            horizSizing = "right";
            vertSizing = "bottom";
            position = "9 555";
            extent = "96 22";
            minExtent = "8 8";
            visible = "1";
            command = "ETerrainEditor.changeMaterial(3);";
            helpTag = "0";
            text = "Change...";
            groupNum = "-1";
            buttonType = "PushButton";
         };
         new GuiBorderButtonCtrl(ETerrainMaterialPaint3) {
            profile = "GuiBorderButtonProfile";
            horizSizing = "right";
            vertSizing = "bottom";
            position = "4 436";
            extent = "106 118";
            minExtent = "8 8";
            visible = "1";
            command = "ETerrainEditor.setPaintMaterial(3);";
            helpTag = "0";
            text = "Button";
            groupNum = "-1";
            buttonType = "RadioButton";
         };
         new GuiBitmapCtrl(ETerrainMaterialBitmap4) {
            profile = "GuiDefaultProfile";
            horizSizing = "right";
            vertSizing = "bottom";
            position = "9 596";
            extent = "96 96";
            minExtent = "8 8";
            visible = "1";
            helpTag = "0";
            bitmap = "starter.fps/data/terrains/grassland/grass";
            wrap = "1";
         };
         new GuiTextCtrl(ETerrainMaterialText4) {
            profile = "GuiTextProfile";
            horizSizing = "right";
            vertSizing = "bottom";
            position = "10 577";
            extent = "28 18";
            minExtent = "8 8";
            visible = "1";
            helpTag = "0";
            text = "grass";
            maxLength = "255";
         };
         new GuiButtonCtrl(ETerrainMaterialChange4) {
            profile = "GuiButtonProfile";
            horizSizing = "right";
            vertSizing = "bottom";
            position = "9 697";
            extent = "96 22";
            minExtent = "8 8";
            visible = "1";
            command = "ETerrainEditor.changeMaterial(4);";
            helpTag = "0";
            text = "Change...";
            groupNum = "-1";
            buttonType = "PushButton";
         };
         new GuiBorderButtonCtrl(ETerrainMaterialPaint4) {
            profile = "GuiBorderButtonProfile";
            horizSizing = "right";
            vertSizing = "bottom";
            position = "4 578";
            extent = "106 118";
            minExtent = "8 8";
            visible = "1";
            command = "ETerrainEditor.setPaintMaterial(4);";
            helpTag = "0";
            text = "Button";
            groupNum = "-1";
            buttonType = "RadioButton";
         };
        
         new GuiBitmapCtrl(ETerrainMaterialBitmap5) {
            profile = "GuiDefaultProfile";
            horizSizing = "right";
            vertSizing = "bottom";
            position = "122 24";
            extent = "96 96";
            minExtent = "8 8";
            visible = "1";
            helpTag = "0";
            bitmap = "starter.fps/data/terrains/grassland/grass";
            wrap = "1";
         };
         new GuiTextCtrl(ETerrainMaterialText5) {
            profile = "GuiTextProfile";
            horizSizing = "right";
            vertSizing = "bottom";
            position = "123 5";
            extent = "28 18";
            minExtent = "8 8";
            visible = "1";
            helpTag = "0";
            text = "grass";
            maxLength = "255";
         };
         new GuiButtonCtrl(ETerrainMaterialChange5) {
            profile = "GuiButtonProfile";
            horizSizing = "right";
            vertSizing = "bottom";
            position = "122 125";
            extent = "96 22";
            minExtent = "8 8";
            visible = "1";
            command = "ETerrainEditor.changeMaterial(5);";
            helpTag = "0";
            text = "Change...";
            groupNum = "-1";
            buttonType = "PushButton";
         };
         new GuiBorderButtonCtrl(ETerrainMaterialPaint5) {
            profile = "GuiBorderButtonProfile";
            horizSizing = "right";
            vertSizing = "bottom";
            position = "117 6";
            extent = "106 118";
            minExtent = "8 8";
            visible = "1";
            command = "ETerrainEditor.setPaintMaterial(5);";
            helpTag = "0";
            text = "Button";
            groupNum = "-1";
            buttonType = "RadioButton";
         };
         new GuiBitmapCtrl(ETerrainMaterialBitmap6) {
            profile = "GuiDefaultProfile";
            horizSizing = "right";
            vertSizing = "bottom";
            position = "122 170";
            extent = "96 96";
            minExtent = "8 8";
            visible = "1";
            helpTag = "0";
            bitmap = "starter.fps/data/terrains/grassland/grass";
            wrap = "1";
         };
         new GuiTextCtrl(ETerrainMaterialText6) {
            profile = "GuiTextProfile";
            horizSizing = "right";
            vertSizing = "bottom";
            position = "123 151";
            extent = "28 18";
            minExtent = "8 8";
            visible = "1";
            helpTag = "0";
            text = "grass";
            maxLength = "255";
         };
         new GuiButtonCtrl(ETerrainMaterialChange6) {
            profile = "GuiButtonProfile";
            horizSizing = "right";
            vertSizing = "bottom";
            position = "122 271";
            extent = "96 22";
            minExtent = "8 8";
            visible = "1";
            command = "ETerrainEditor.changeMaterial(6);";
            helpTag = "0";
            text = "Change...";
            groupNum = "-1";
            buttonType = "PushButton";
         };
         new GuiBorderButtonCtrl(ETerrainMaterialPaint6) {
            profile = "GuiBorderButtonProfile";
            horizSizing = "right";
            vertSizing = "bottom";
            position = "117 152";
            extent = "106 118";
            minExtent = "8 8";
            visible = "1";
            command = "ETerrainEditor.setPaintMaterial(6);";
            helpTag = "0";
            text = "Button";
            groupNum = "-1";
            buttonType = "RadioButton";
         };
         new GuiBitmapCtrl(ETerrainMaterialBitmap7) {
            profile = "GuiDefaultProfile";
            horizSizing = "right";
            vertSizing = "bottom";
            position = "122 312";
            extent = "96 96";
            minExtent = "8 8";
            visible = "1";
            helpTag = "0";
            bitmap = "starter.fps/data/terrains/grassland/grass";
            wrap = "1";
         };
         new GuiTextCtrl(ETerrainMaterialText7) {
            profile = "GuiTextProfile";
            horizSizing = "right";
            vertSizing = "bottom";
            position = "123 293";
            extent = "28 18";
            minExtent = "8 8";
            visible = "1";
            helpTag = "0";
            text = "grass";
            maxLength = "255";
         };
         new GuiButtonCtrl(ETerrainMaterialChange7) {
            profile = "GuiButtonProfile";
            horizSizing = "right";
            vertSizing = "bottom";
            position = "122 413";
            extent = "96 22";
            minExtent = "8 8";
            visible = "1";
            command = "ETerrainEditor.changeMaterial(7);";
            helpTag = "0";
            text = "Change...";
            groupNum = "-1";
            buttonType = "PushButton";
         };
         new GuiBorderButtonCtrl(ETerrainMaterialPaint7) {
            profile = "GuiBorderButtonProfile";
            horizSizing = "right";
            vertSizing = "bottom";
            position = "117 294";
            extent = "106 118";
            minExtent = "8 8";
            visible = "1";
            command = "ETerrainEditor.setPaintMaterial(7);";
            helpTag = "0";
            text = "Button";
            groupNum = "-1";
            buttonType = "RadioButton";
         };
         new GuiBitmapCtrl(ETerrainMaterialBitmap8) {
            profile = "GuiDefaultProfile";
            horizSizing = "right";
            vertSizing = "bottom";
            position = "122 454";
            extent = "96 96";
            minExtent = "8 8";
            visible = "1";
            helpTag = "0";
            bitmap = "starter.fps/data/terrains/grassland/grass";
            wrap = "1";
         };
         new GuiTextCtrl(ETerrainMaterialText8) {
            profile = "GuiTextProfile";
            horizSizing = "right";
            vertSizing = "bottom";
            position = "123 435";
            extent = "28 18";
            minExtent = "8 8";
            visible = "1";
            helpTag = "0";
            text = "grass";
            maxLength = "255";
         };
         new GuiButtonCtrl(ETerrainMaterialChange8) {
            profile = "GuiButtonProfile";
            horizSizing = "right";
            vertSizing = "bottom";
            position = "122 555";
            extent = "96 22";
            minExtent = "8 8";
            visible = "1";
            command = "ETerrainEditor.changeMaterial(8);";
            helpTag = "0";
            text = "Change...";
            groupNum = "-1";
            buttonType = "PushButton";
         };
         new GuiBorderButtonCtrl(ETerrainMaterialPaint8) {
            profile = "GuiBorderButtonProfile";
            horizSizing = "right";
            vertSizing = "bottom";
            position = "117 436";
            extent = "106 118";
            minExtent = "8 8";
            visible = "1";
            command = "ETerrainEditor.setPaintMaterial(8);";
            helpTag = "0";
            text = "Button";
            groupNum = "-1";
            buttonType = "RadioButton";
         };
         new GuiBitmapCtrl(ETerrainMaterialBitmap9) {
            profile = "GuiDefaultProfile";
            horizSizing = "right";
            vertSizing = "bottom";
            position = "122 596";
            extent = "96 96";
            minExtent = "8 8";
            visible = "1";
            helpTag = "0";
            bitmap = "starter.fps/data/terrains/grassland/grass";
            wrap = "1";
         };
         new GuiTextCtrl(ETerrainMaterialText9) {
            profile = "GuiTextProfile";
            horizSizing = "right";
            vertSizing = "bottom";
            position = "123 577";
            extent = "28 18";
            minExtent = "8 8";
            visible = "1";
            helpTag = "0";
            text = "grass";
            maxLength = "255";
         };
         new GuiButtonCtrl(ETerrainMaterialChange9) {
            profile = "GuiButtonProfile";
            horizSizing = "right";
            vertSizing = "bottom";
            position = "122 697";
            extent = "96 22";
            minExtent = "8 8";
            visible = "1";
            command = "ETerrainEditor.changeMaterial(9);";
            helpTag = "0";
            text = "Change...";
            groupNum = "-1";
            buttonType = "PushButton";
         };
         new GuiBorderButtonCtrl(ETerrainMaterialPaint9) {
            profile = "GuiBorderButtonProfile";
            horizSizing = "right";
            vertSizing = "bottom";
            position = "117 578";
            extent = "106 118";
            minExtent = "8 8";
            visible = "1";
            command = "ETerrainEditor.setPaintMaterial(9);";
            helpTag = "0";
            text = "Button";
            groupNum = "-1";
            buttonType = "RadioButton";
         };
         
         new GuiBitmapCtrl(ETerrainMaterialBitmap10) {
            profile = "GuiDefaultProfile";
            horizSizing = "right";
            vertSizing = "bottom";
            position = "235 24";
            extent = "96 96";
            minExtent = "8 8";
            visible = "1";
            helpTag = "0";
            bitmap = "starter.fps/data/terrains/grassland/grass";
            wrap = "1";
         };
         new GuiTextCtrl(ETerrainMaterialText10) {
            profile = "GuiTextProfile";
            horizSizing = "right";
            vertSizing = "bottom";
            position = "236 5";
            extent = "28 18";
            minExtent = "8 8";
            visible = "1";
            helpTag = "0";
            text = "grass";
            maxLength = "255";
         };
         new GuiButtonCtrl(ETerrainMaterialChange10) {
            profile = "GuiButtonProfile";
            horizSizing = "right";
            vertSizing = "bottom";
            position = "235 125";
            extent = "96 22";
            minExtent = "8 8";
            visible = "1";
            command = "ETerrainEditor.changeMaterial(10);";
            helpTag = "0";
            text = "Change...";
            groupNum = "-1";
            buttonType = "PushButton";
         };
         new GuiBorderButtonCtrl(ETerrainMaterialPaint10) {
            profile = "GuiBorderButtonProfile";
            horizSizing = "right";
            vertSizing = "bottom";
            position = "230 6";
            extent = "106 118";
            minExtent = "8 8";
            visible = "1";
            command = "ETerrainEditor.setPaintMaterial(10);";
            helpTag = "0";
            text = "Button";
            groupNum = "-1";
            buttonType = "RadioButton";
         };
         new GuiBitmapCtrl(ETerrainMaterialBitmap11) {
            profile = "GuiDefaultProfile";
            horizSizing = "right";
            vertSizing = "bottom";
            position = "235 170";
            extent = "96 96";
            minExtent = "8 8";
            visible = "1";
            helpTag = "0";
            bitmap = "starter.fps/data/terrains/grassland/grass";
            wrap = "1";
         };
         new GuiTextCtrl(ETerrainMaterialText11) {
            profile = "GuiTextProfile";
            horizSizing = "right";
            vertSizing = "bottom";
            position = "236 151";
            extent = "28 18";
            minExtent = "8 8";
            visible = "1";
            helpTag = "0";
            text = "grass";
            maxLength = "255";
         };
         new GuiButtonCtrl(ETerrainMaterialChange11) {
            profile = "GuiButtonProfile";
            horizSizing = "right";
            vertSizing = "bottom";
            position = "235 271";
            extent = "96 22";
            minExtent = "8 8";
            visible = "1";
            command = "ETerrainEditor.changeMaterial(11);";
            helpTag = "0";
            text = "Change...";
            groupNum = "-1";
            buttonType = "PushButton";
         };
         new GuiBorderButtonCtrl(ETerrainMaterialPaint11) {
            profile = "GuiBorderButtonProfile";
            horizSizing = "right";
            vertSizing = "bottom";
            position = "230 152";
            extent = "106 118";
            minExtent = "8 8";
            visible = "1";
            command = "ETerrainEditor.setPaintMaterial(11);";
            helpTag = "0";
            text = "Button";
            groupNum = "-1";
            buttonType = "RadioButton";
         };
         new GuiBitmapCtrl(ETerrainMaterialBitmap12) {
            profile = "GuiDefaultProfile";
            horizSizing = "right";
            vertSizing = "bottom";
            position = "235 312";
            extent = "96 96";
            minExtent = "8 8";
            visible = "1";
            helpTag = "0";
            bitmap = "starter.fps/data/terrains/grassland/grass";
            wrap = "1";
         };
         new GuiTextCtrl(ETerrainMaterialText12) {
            profile = "GuiTextProfile";
            horizSizing = "right";
            vertSizing = "bottom";
            position = "236 293";
            extent = "28 18";
            minExtent = "8 8";
            visible = "1";
            helpTag = "0";
            text = "grass";
            maxLength = "255";
         };
         new GuiButtonCtrl(ETerrainMaterialChange12) {
            profile = "GuiButtonProfile";
            horizSizing = "right";
            vertSizing = "bottom";
            position = "235 413";
            extent = "96 22";
            minExtent = "8 8";
            visible = "1";
            command = "ETerrainEditor.changeMaterial(12);";
            helpTag = "0";
            text = "Change...";
            groupNum = "-1";
            buttonType = "PushButton";
         };
         new GuiBorderButtonCtrl(ETerrainMaterialPaint12) {
            profile = "GuiBorderButtonProfile";
            horizSizing = "right";
            vertSizing = "bottom";
            position = "230 294";
            extent = "106 118";
            minExtent = "8 8";
            visible = "1";
            command = "ETerrainEditor.setPaintMaterial(12);";
            helpTag = "0";
            text = "Button";
            groupNum = "-1";
            buttonType = "RadioButton";
         };
         new GuiBitmapCtrl(ETerrainMaterialBitmap13) {
            profile = "GuiDefaultProfile";
            horizSizing = "right";
            vertSizing = "bottom";
            position = "235 454";
            extent = "96 96";
            minExtent = "8 8";
            visible = "1";
            helpTag = "0";
            bitmap = "starter.fps/data/terrains/grassland/grass";
            wrap = "1";
         };
         new GuiTextCtrl(ETerrainMaterialText13) {
            profile = "GuiTextProfile";
            horizSizing = "right";
            vertSizing = "bottom";
            position = "236 435";
            extent = "28 18";
            minExtent = "8 8";
            visible = "1";
            helpTag = "0";
            text = "grass";
            maxLength = "255";
         };
         new GuiButtonCtrl(ETerrainMaterialChange13) {
            profile = "GuiButtonProfile";
            horizSizing = "right";
            vertSizing = "bottom";
            position = "235 555";
            extent = "96 22";
            minExtent = "8 8";
            visible = "1";
            command = "ETerrainEditor.changeMaterial(13);";
            helpTag = "0";
            text = "Change...";
            groupNum = "-1";
            buttonType = "PushButton";
         };
         new GuiBorderButtonCtrl(ETerrainMaterialPaint13) {
            profile = "GuiBorderButtonProfile";
            horizSizing = "right";
            vertSizing = "bottom";
            position = "230 436";
            extent = "106 118";
            minExtent = "8 8";
            visible = "1";
            command = "ETerrainEditor.setPaintMaterial(13);";
            helpTag = "0";
            text = "Button";
            groupNum = "-1";
            buttonType = "RadioButton";
         };
         new GuiBitmapCtrl(ETerrainMaterialBitmap14) {
            profile = "GuiDefaultProfile";
            horizSizing = "right";
            vertSizing = "bottom";
            position = "235 596";
            extent = "96 96";
            minExtent = "8 8";
            visible = "1";
            helpTag = "0";
            bitmap = "starter.fps/data/terrains/grassland/grass";
            wrap = "1";
         };
         new GuiTextCtrl(ETerrainMaterialText14) {
            profile = "GuiTextProfile";
            horizSizing = "right";
            vertSizing = "bottom";
            position = "236 577";
            extent = "28 18";
            minExtent = "8 8";
            visible = "1";
            helpTag = "0";
            text = "grass";
            maxLength = "255";
         };
         new GuiButtonCtrl(ETerrainMaterialChange14) {
            profile = "GuiButtonProfile";
            horizSizing = "right";
            vertSizing = "bottom";
            position = "235 697";
            extent = "96 22";
            minExtent = "8 8";
            visible = "1";
            command = "ETerrainEditor.changeMaterial(14);";
            helpTag = "0";
            text = "Change...";
            groupNum = "-1";
            buttonType = "PushButton";
         };
         new GuiBorderButtonCtrl(ETerrainMaterialPaint14) {
            profile = "GuiBorderButtonProfile";
            horizSizing = "right";
            vertSizing = "bottom";
            position = "230 578";
            extent = "106 118";
            minExtent = "8 8";
            visible = "1";
            command = "ETerrainEditor.setPaintMaterial(14);";
            helpTag = "0";
            text = "Button";
            groupNum = "-1";
            buttonType = "RadioButton";
         };
         
      };

· Save the EditorGui.gui file
· Open the 'EditorGui.cs' file for editing
· Locate this function:
function EPainterChangeMat(%file)

· Change the two "for" loops to iterate until 15, like so:
function EPainterChangeMat(%file)
{
   // make sure the material isn't already in the terrain.
   %file = filePath(%file) @ "/" @ fileBase(%file);
   [B]for(%i = 0; %i < 15; %i++)[/B]
      if(EPainter.mat[%i] $= %file)
         return;

   EPainter.mat[EPainter.matIndex] = %file;
   %mats = "";
   [B]for(%i = 0; %i < 15; %i++)[/B]
      %mats = %mats @ EPainter.mat[%i] @ "\n";
    ...
    ...
    ...

· Now locate the next function:
function EPainter::setup(%this)

· Change the "for" loop at the start of this function to iterate until 15, like so:
function EPainter::setup(%this)
{
   EditorMenuBar.onActionMenuItemSelect(0, "Paint Material");
   %mats = ETerrainEditor.getTerrainMaterials();
   %valid = true;
   for(%i = 0; %i < 15; %i++)
    ...
    ...
    ...

· Save the file

· Now open your Torque Source Code and open the file terrData.h
· Search for MaterialGroups until you find where it is being defined, by default it is set to 8.

· Change MaterialGroups to the number of textures you are wanting to use, in our case 15.
enum {
      BlockSize = 256,
      BlockShift = 8,
      LightmapSize = 512,
      LightmapShift = 9,
      ChunkSquareWidth = 64,
      ChunkSize = 4,
      ChunkDownShift = 2,
      ChunkShift = BlockShift - ChunkDownShift,
      BlockSquareWidth = 256,
      SquareMaxPoints = 1024,
      BlockMask = 255,
      GridMapSize = 0x15555,
      FlagMapWidth = 128, ///< Flags that map is for 2x2 squares.
      FlagMapMask = 127,
      MaxMipLevel = 6,
      NumBaseTextures = 16,
      MaterialGroups = 15,
      MaxEmptyRunPairs = 100
   };

That's all there is to it, recompile the Torque Engine and your ready to go.

Here are a couple of screenshots:
www.omnivirtual.com/screenshot1.jpg
www.omnivirtual.com/screenshot2.jpg
Page «Previous 1 2
#1
12/18/2005 (10:44 pm)
Do you get any performance hit when using so much, or does it pretty much stay the same?
#2
12/19/2005 (2:01 pm)
I'm very new to Torque. How can I make the mods to add arrow buttons to scroll through more than 15 textures ? Ie like at the bottom of the EditorGui? If that mod was in place, I think this would be a pretty complete texture mod.

Or will it automatically add a scroller when more textures are added?
#3
12/20/2005 (2:02 pm)
@ burning
Using more textures = chance of using more colour templates, etc.
Thus eating a bit more of card memory -so it would performance hit Id say....

Looking forward to using this code though ;o)
#4
12/22/2005 (6:31 pm)
@christian and burning

You probably won't see a performance difference. If your card supports this many texture levels than the overhead is minimal since it's done on hardware.

As for the texture memory, keep your texture's below 512x512 and you probably won't have any problems. If you see hicups when you spin 360 degees, chances are you've overrun the memory on your card and you are swaping texture across the bus from system memory.

To fix that, try lowering your Anit Aliasing, it's a card memory hog. Or just reduce your texture sizes.
#5
12/24/2005 (10:46 pm)
Always crash in the 1.4 codebase! Anyone successfully implement this for TGE 1.4?
#6
12/27/2005 (2:49 am)
Trenton, is it 1.3 or lower you made this work in ?

I tried it for my 1.3 with Synapses Light pack and it crashes hard. Seems theres some hard coded 8 number issues in that one pack. Could be the same with 1.4.
#7
12/28/2005 (6:00 pm)
Sorry about that guys, this is 1.3.5 from the TorqueLighting Kit

I'll do a 1.4 version here shortly.
#8
01/02/2006 (5:58 am)
@Trenton!

I try this on my 1.3.5 SGLP and it totally crashes on me each time I try to run it.

Been re typing it, looking at logs and all that...

Heres a snip from my log. Wonders if that grapcard is making the problem ?
Activating the OpenGL display device...
Activating the OpenGL display device...
Setting screen mode to 1024x768x32 (w)...
Creating a new window...
Acquiring a new device context...
Pixel format set:
32 color bits, 24 depth bits, 8 stencil bits
Creating a new rendering context...
Making the new rendering context current...
OpenGL driver information:
Vendor: ATI Technologies Inc.
Renderer: RADEON X800 XT x86/SSE2
Version: 2.0.5525 WinXP Release
OpenGL Init: Enabled Extensions
ARB_multitexture (Max Texture Units: 8)
EXT_compiled_vertex_array
EXT_texture_env_combine
EXT_packed_pixels
EXT_fog_coord
ARB_texture_compression
EXT_texture_compression_s3tc
(ARB|EXT)_texture_env_add
EXT_texture_filter_anisotropic (Max anisotropy: 16.000000)
WGL_EXT_swap_control
OpenGL Init: Disabled Extensions
EXT_paletted_texture
NV_vertex_array_range
3DFX_texture_compression_FXT1
#9
01/22/2006 (12:43 pm)
We tried it at ATOMIX Productions and it totally crashed the system.
#10
01/23/2006 (9:47 pm)
It crashes for me also under the RTS kit.. But I have a question. Do you create a new terrain from scratch?
#11
02/11/2006 (2:27 pm)
Yes this crashes in the RTS Kit and TGE 1.4 (also TGE 1.4 with lighting kit). I only have this working on TGE 1.35 Lighting Kit. With that being said, I am working on adding 15 texture support to the Synapse Torque v1.4 Lighting Kit distribution. I will post it up once it is fully functional.
#12
02/11/2006 (3:27 pm)
I just go this working with Torque Lighting Kit v1.4. I will post the update sometime this weekend.
#13
02/18/2006 (4:49 pm)
Trenton,

Did you get a chance to update this yet? It doesn't look like it but not sure. I'm looking forward to using it, but have to wait for the TLK-1.4 version :-)

Thanks!
#14
02/24/2006 (5:49 pm)
This resource works with v1.3 TLK and v1.3.5 TLK with full 15 texture support.

I can only get 13 textures to work in 1.4 TLK and am trying to pinpoint the issue.

NOTE: If you are able to run the Torque Executable after recompilation, but Torque crashes when you try to open a mission, you can try opening an unmodified "Stronghold" mission and it will usually work. If not, try a completely new mission with 1 texture and that should work without crashing. You can then add additional textures from within the editor.

For those of you who only have 6 textures and can't get 15 to work, you can always add two extra to get 8. textures. 8 textures works without issue with v1.3 - v1.4 TGE and v.1.3TLK - v1.4TLK.
#15
03/27/2006 (1:12 pm)
This crashes my Torque too. 1.3 with TLK.

I'd really like this to work, 6 terrain textures just isn't enough.
#16
08/20/2006 (1:01 pm)
I would like to do this. Can you tell me what folder this file is in? I did a search and found more that 1 file that fits this description and I don't want to edit the wrong one.

Thanks!

Gordon
#17
10/21/2006 (6:27 am)
Works with TSE for me with 15 textures.
#18
11/17/2006 (2:30 pm)
is there a way to make this work with 1.5?

it looked like it worked but then i couldnt add more than 7 textures to the list even thought there are more fields

and when i load a mission the engine crashes:-(
#19
01/26/2007 (2:39 pm)
I can only get 13 working textures in TGE 1.5, I can select 15 textures but the last 2 dont come out right.
Any ideas anyone

Thank you
Stacy
#20
02/27/2007 (2:44 pm)
This changes work in TGE 1.5, but only up to 13 textures.
So, here is the changes for the source code, this includes the "fix" allowing you to load "old" terrains, ie terrains made with 8 (6) textures-engine:
In file engine/terrain/terrData.h, change the line 146
MaterialGroups = 8,
to this:
MaterialGroups = 13,
More down in the same file, the line 329
FILE_VERSION = 3,
change to this:
FILE_VERSION = 4,
save. Open engine/terrain/terrData.cc, near the line 1723, remove bold line:
// read the MaterialList Info
[b]   S32 k, maxMaterials = TerrainBlock::MaterialGroups;[/b]
    for(k=0; k < maxMaterials;)
and make the block to look like this:
// read the MaterialList Info
[b]   S32 k, maxMaterials;
   if (version != TerrainFile::FILE_VERSION) {
      maxMaterials = 8;
   } else {
      maxMaterials = TerrainBlock::MaterialGroups;
   }[/b]
    for(k=0; k < maxMaterials;)
With this changes you are able to load terrains make without support of more than 8 textures.
Note: The terrain files saved from now can be loaded only by Torque modified the save way, so it's not backward-compatible!
Page «Previous 1 2