View Javadoc

1   /*
2    * To change this template, choose Tools | Templates
3    * and open the template in the editor.
4    */
5   
6   package cz.cuni.amis.pogamut.ut2004.t3dgenerator;
7   
8   import cz.cuni.amis.pogamut.unreal.t3dgenerator.datatypes.ECSGOperation;
9   import cz.cuni.amis.pogamut.unreal.t3dgenerator.datatypes.Vector3D;
10  import cz.cuni.amis.pogamut.ut2004.t3dgenerator.elements.AbstractActor;
11  import cz.cuni.amis.pogamut.ut2004.t3dgenerator.elements.map.BrushActor;
12  import cz.cuni.amis.pogamut.ut2004.t3dgenerator.elements.map.MapElement;
13  import cz.cuni.amis.pogamut.ut2004.t3dgenerator.elements.map.Surface;
14  import java.util.ArrayList;
15  import java.util.List;
16  import java.util.logging.Level;
17  
18  /**
19   * Helper utils  for creating T3D.
20   * @author Martin Cerny
21   */
22  public class T3dElementHelper {
23  
24      /**
25       * Wraps a list of actors into a map, so that it can be seamlessly imported into UDK editor.
26       * @param mapName
27       * @param actors
28       * @return 
29       */
30      public static MapElement wrapActorsIntoMap(String mapName,  List<? extends AbstractActor> actors){
31          return wrapActorsIntoMap(mapName, actors, null);
32      }
33  
34      /**
35       * 
36       * @param mapName
37       * @param actors
38       * @param killZ currently ignored, since there are some trouble with importing the WorldInfo object
39       * @return 
40       */ 
41      public static MapElement wrapActorsIntoMap(String mapName,  List<? extends AbstractActor> actors, Float killZ){
42          //for some reason, the improt works wrong if do not add something to be considered builder brush at the first place
43          BrushActor builderBrush = BrushActor.createCube(Vector3D.ZERO, 256, null, null);
44          List<AbstractActor> actorsWithBuilderBrush = new ArrayList<AbstractActor>(actors.size());
45          actorsWithBuilderBrush.add(builderBrush);
46          actorsWithBuilderBrush.addAll(actors);
47          return new MapElement(mapName, actorsWithBuilderBrush, new Surface());
48      }
49  }