Project

General

Profile

Download (3.35 KB) Statistics
| Branch: | Revision:

library / src / main / java / org / distorted / library / mesh / MeshJoined.java @ 7e53a35f

1
///////////////////////////////////////////////////////////////////////////////////////////////////
2
// Copyright 2020 Leszek Koltunski                                                               //
3
//                                                                                               //
4
// This file is part of Distorted.                                                               //
5
//                                                                                               //
6
// Distorted is free software: you can redistribute it and/or modify                             //
7
// it under the terms of the GNU General Public License as published by                          //
8
// the Free Software Foundation, either version 2 of the License, or                             //
9
// (at your option) any later version.                                                           //
10
//                                                                                               //
11
// Distorted is distributed in the hope that it will be useful,                                  //
12
// but WITHOUT ANY WARRANTY; without even the implied warranty of                                //
13
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                                 //
14
// GNU General Public License for more details.                                                  //
15
//                                                                                               //
16
// You should have received a copy of the GNU General Public License                             //
17
// along with Distorted.  If not, see <http://www.gnu.org/licenses/>.                            //
18
///////////////////////////////////////////////////////////////////////////////////////////////////
19

    
20
package org.distorted.library.mesh;
21

    
22
///////////////////////////////////////////////////////////////////////////////////////////////////
23

    
24
public class MeshJoined extends MeshBase
25
  {
26
///////////////////////////////////////////////////////////////////////////////////////////////////
27
/**
28
 * Join a list of (probably already changed by Matrix Effects) Meshes into one.
29
 * <p>
30
 * You need to try and keep the origin (0,0,0) in the center of gravity of the whole thing.
31
 */
32
  public MeshJoined(MeshBase[] meshes)
33
    {
34
    super(1,1,1);
35
    join(meshes);
36
    }
37

    
38
///////////////////////////////////////////////////////////////////////////////////////////////////
39
/**
40
 * Sets the lengths of the bounding box.
41
 * <p>
42
 * The 'bounding box' is an imaginary rectanguloid of size (bx,by,bz) inside of which this Mesh
43
 * fits tightly.
44
 * 'Normal' 3D meshes (e.g. Sphere) have this equal to 1,1,1. 'Normal' flat meshes (e.g. Quad) -
45
 * to 1,1,0. Here however we are joining several, probably already changed by MatrixEffects,
46
 * Meshes together. If the result fits into the standard 1,1,1 (recommended!) - we don't need to
47
 * call this function at all.
48
 *
49
 * @param bx x-length of the bounding box
50
 * @param by y-length of the bounding box
51
 * @param bz z-length of the bounding box
52
 */
53
   public void setBounding(float bx, float by, float bz)
54
     {
55
     super.setBounding(bx,by,bz);
56
     }
57

    
58
///////////////////////////////////////////////////////////////////////////////////////////////////
59
/**
60
 * Return how many basic Meshes is this Mesh joined from.
61
 */
62
   public int getNumComponents()
63
     {
64
     return numComponents();
65
     }
66
  }
(3-3/7)