Skip to content

Commit

Permalink
Merge pull request #3 from Chingiz/master
Browse files Browse the repository at this point in the history
fixing error, adapting dart2
  • Loading branch information
hemanthrajv authored Jul 30, 2018
2 parents f955490 + 862f750 commit f2c92e9
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions lib/flutter_3d_obj.dart
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ class _ObjectPainter extends CustomPainter {
_viewPortY = (size.height / 2).toDouble();
}

Map<String, List<List<int>>> _parseObjString(String objString) {
Map _parseObjString(String objString) {
List vertices = <Vector3>[];
List faces = <List<int>>[];
List<int> face = [];
Expand All @@ -175,9 +175,10 @@ class _ObjectPainter extends CustomPainter {

Vector3 vertex;

lines.forEach((String line) {
line = line.replaceAll(new RegExp(r"\s+$"), "");
List<String> chars = line.split(" ");
lines.forEach((dynamic line) {
String lline = line;
lline = lline.replaceAll(new RegExp(r"\s+$"), "");
List<String> chars = lline.split(" ");

// vertex
if (chars[0] == "v") {
Expand Down Expand Up @@ -296,8 +297,9 @@ class _ObjectPainter extends CustomPainter {
path.lineTo(secondVertexX, secondVertexY);
}
var z = 0.0;
face.forEach((int x) {
z += verticesToDraw[x - 1].z;
face.forEach((dynamic x) {
int xx = x;
z += verticesToDraw[xx - 1].z;
});

path.close();
Expand All @@ -322,12 +324,13 @@ class _ObjectPainter extends CustomPainter {
verticesToDraw[i] = _calcDefaultVertex(verticesToDraw[i]);
}

final List avgOfZ = <Map>[];
final List<Map> avgOfZ = List();
for (int i = 0; i < faces.length; i++) {
List face = faces[i];
double z = 0.0;
face.forEach((int x) {
z += verticesToDraw[x - 1].z;
face.forEach((dynamic x) {
int xx = x;
z += verticesToDraw[xx - 1].z;
});
Map data = <String, dynamic>{
"index": i,
Expand Down

0 comments on commit f2c92e9

Please sign in to comment.