Skip to content

Commit 73b99a8

Browse files
lbjhlg
authored andcommitted
Added missing files from the o3d project
1 parent c4b4101 commit 73b99a8

3 files changed

Lines changed: 129 additions & 0 deletions

File tree

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package org.bimserver.serializers.json.data;
2+
3+
import java.io.IOException;
4+
import java.io.OutputStream;
5+
import java.util.ArrayList;
6+
import java.util.List;
7+
8+
import org.bimserver.utils.LittleEndianBinUtils;
9+
10+
public class BinaryIndexBuffer {
11+
12+
private final List<Integer> indices = new ArrayList<Integer>();
13+
14+
public void addIndex(int index) {
15+
indices.add(index);
16+
}
17+
18+
public int getNrIndices() {
19+
return indices.size();
20+
}
21+
22+
public List<Integer> getIndices() {
23+
return indices;
24+
}
25+
26+
public void serialize(OutputStream outputStream) throws IOException {
27+
outputStream.write(LittleEndianBinUtils.intToByteArray(indices.size()));
28+
for (Integer index : indices) {
29+
outputStream.write(LittleEndianBinUtils.intToByteArray(index));
30+
}
31+
}
32+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
package org.bimserver.serializers.json.data;
2+
3+
import java.io.IOException;
4+
import java.io.OutputStream;
5+
import java.util.ArrayList;
6+
import java.util.List;
7+
8+
import org.bimserver.utils.LittleEndianBinUtils;
9+
10+
public class BinaryVertexBuffer {
11+
12+
private final List<Float> vertices = new ArrayList<Float>();
13+
private final List<Float> normals = new ArrayList<Float>();
14+
15+
public void addVertex(float vertex) {
16+
getVertices().add(vertex);
17+
}
18+
19+
public int getNrVertices() {
20+
return getVertices().size();
21+
}
22+
23+
public void serialize(OutputStream outputStream) throws IOException {
24+
outputStream.write(LittleEndianBinUtils.intToByteArray(getVertices().size()/6));
25+
for (Float vertex : getVertices()) {
26+
outputStream.write(LittleEndianBinUtils.floatToByteArray(vertex));
27+
}
28+
}
29+
30+
public List<Float> getVertices() {
31+
return vertices;
32+
}
33+
34+
public void addNormal(float normal) {
35+
normals.add(normal);
36+
}
37+
38+
public List<Float> getNormals() {
39+
return normals;
40+
}
41+
}
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
package org.bimserver.serializers.json.data;
2+
3+
import org.bimserver.models.ifc2x3.IfcElement;
4+
5+
6+
public class SetGeometryResult {
7+
// private final String guid;
8+
private final int addedIndices;
9+
private final int addedVertices;
10+
private final BinaryIndexBuffer binaryIndexBuffer;
11+
private final BinaryVertexBuffer binaryVertexBuffer;
12+
private Class ifcClass = null;
13+
14+
15+
16+
17+
public SetGeometryResult(int addedIndices, int addedVertices, BinaryIndexBuffer binaryIndexBuffer, BinaryVertexBuffer binaryVertexBuffer) {
18+
// this.guid = guid;
19+
this.addedIndices = addedIndices;
20+
this.addedVertices = addedVertices;
21+
this.binaryIndexBuffer = binaryIndexBuffer;
22+
this.binaryVertexBuffer = binaryVertexBuffer;
23+
}
24+
25+
26+
27+
public int getAddedIndices() {
28+
return addedIndices;
29+
}
30+
31+
public int getAddedVertices() {
32+
return addedVertices;
33+
}
34+
35+
public BinaryIndexBuffer getBinaryIndexBuffer() {
36+
return binaryIndexBuffer;
37+
}
38+
39+
public BinaryVertexBuffer getBinaryVertexBuffer() {
40+
return binaryVertexBuffer;
41+
}
42+
43+
// public String getGuid() {
44+
// return guid;
45+
// }
46+
47+
public Class getIfcClass() {
48+
return ifcClass;
49+
}
50+
public void setIfcClass(Class ifcClass) {
51+
this.ifcClass = ifcClass;
52+
}
53+
54+
55+
56+
}

0 commit comments

Comments
 (0)