Browse Source

Android support

Panagiotis Christopoulos Charitos 12 years ago
parent
commit
0b5127b62f

+ 24 - 0
AndroidManifest.xml

@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<manifest
+	xmlns:android="http://schemas.android.com/apk/res/android"
+	package="org.godlike.ankibench">
+	<application
+		android:label="AnKi Bench"
+		android:hasCode="false">
+		<activity 
+			android:name="android.app.NativeActivity"
+			android:label="AnKi Bench"
+			android:configChanges="orientation|keyboardHidden">
+			<meta-data 
+				android:name="android.app.lib_name"
+				android:value="ankibench" />
+			<intent-filter>
+				<action android:name="android.intent.action.MAIN" />
+				<category android:name="android.intent.category.LAUNCHER" />
+			</intent-filter>
+		</activity>
+	</application>
+	<uses-feature android:glEsVersion="0x00030000"/>
+	<uses-sdk android:minSdkVersion="18"/>
+</manifest>

+ 2 - 0
bench/CMakeLists.txt

@@ -0,0 +1,2 @@
+ADD_LIBRARY(ankibench SHARED Main.cpp)
+TARGET_LINK_LIBRARIES(ankibench anki) 

+ 136 - 0
bench/Main.cpp

@@ -0,0 +1,136 @@
+#include <stdio.h>
+#include <iostream>
+#include <fstream>
+
+#include "anki/input/Input.h"
+#include "anki/Math.h"
+#include "anki/renderer/Renderer.h"
+#include "anki/core/App.h"
+#include "anki/resource/Mesh.h"
+#include "anki/resource/Material.h"
+#include "anki/resource/SkelAnim.h"
+#include "anki/physics/Character.h"
+#include "anki/renderer/Renderer.h"
+#include "anki/renderer/MainRenderer.h"
+#include "anki/physics/Character.h"
+#include "anki/physics/RigidBody.h"
+#include "anki/script/ScriptManager.h"
+#include "anki/core/StdinListener.h"
+#include "anki/resource/Model.h"
+#include "anki/core/Logger.h"
+#include "anki/Util.h"
+#include "anki/resource/Skin.h"
+#include "anki/event/EventManager.h"
+#include "anki/event/MainRendererPpsHdrEvent.h"
+#include "anki/resource/ShaderProgramPrePreprocessor.h"
+#include "anki/resource/Material.h"
+#include "anki/core/ThreadPool.h"
+#include "anki/core/NativeWindow.h"
+#include "anki/Scene.h"
+#include <android_native_app_glue.h>
+#include <android/log.h>
+
+using namespace anki;
+
+//==============================================================================
+void initSubsystems(android_app* app)
+{
+	U glmajor = 3, glminor = 0;
+
+	// App
+	AppSingleton::get().init(app);
+
+	// Util
+	File::setAndroidAssetManager(app->activity->assetManager);
+
+	// Window
+	NativeWindowInitializer nwinit;
+	nwinit.width = 1280;
+	nwinit.height = 720;
+	nwinit.majorVersion = glmajor;
+	nwinit.minorVersion = glminor;
+	nwinit.depthBits = 0;
+	nwinit.stencilBits = 0;
+	nwinit.fullscreenDesktopRez = true;
+	nwinit.debugContext = false;
+	NativeWindowSingleton::get().create(nwinit);
+
+	// GL stuff
+	GlStateCommonSingleton::get().init(glmajor, glminor, nwinit.debugContext);
+
+	// Input
+	InputSingleton::get().init(&NativeWindowSingleton::get());
+	InputSingleton::get().lockCursor(true);
+	InputSingleton::get().hideCursor(true);
+	InputSingleton::get().moveCursor(Vec2(0.0));
+
+	// Main renderer
+	RendererInitializer initializer;
+	initializer.ms.ez.enabled = false;
+	initializer.ms.ez.maxObjectsToDraw = 100;
+	initializer.dbg.enabled = false;
+	initializer.is.sm.bilinearEnabled = true;
+	initializer.is.groundLightEnabled = true;
+	initializer.is.sm.enabled = true;
+	initializer.is.sm.pcfEnabled = false;
+	initializer.is.sm.resolution = 512;
+	initializer.pps.enabled = true;
+	initializer.pps.hdr.enabled = true;
+	initializer.pps.hdr.renderingQuality = 0.5;
+	initializer.pps.hdr.blurringDist = 1.0;
+	initializer.pps.hdr.blurringIterationsCount = 1;
+	initializer.pps.hdr.exposure = 8.0;
+	initializer.pps.ssao.blurringIterationsNum = 1;
+	initializer.pps.ssao.enabled = true;
+	initializer.pps.ssao.mainPassRenderingQuality = 0.35;
+	initializer.pps.ssao.blurringRenderingQuality = 0.35;
+	initializer.pps.bl.enabled = true;
+	initializer.pps.bl.blurringIterationsNum = 2;
+	initializer.pps.bl.sideBlurFactor = 1.0;
+	initializer.pps.lf.enabled = true;
+	initializer.pps.sharpen = true;
+	initializer.renderingQuality = 1.0;
+	initializer.width = NativeWindowSingleton::get().getWidth();
+	initializer.height = NativeWindowSingleton::get().getHeight();
+	initializer.lodDistance = 20.0;
+	initializer.samples = 16;
+
+#if ANKI_GL == ANKI_GL_ES
+	initializer.samples = 1;
+	initializer.pps.enabled = false;
+	initializer.is.maxPointLights = 64;
+	initializer.is.maxPointLightsPerTile = 4;
+	initializer.is.maxSpotLightsPerTile = 4;
+	initializer.is.maxSpotTexLightsPerTile = 4;
+#endif
+
+	MainRendererSingleton::get().init(initializer);
+
+	// Stdin listener
+	StdinListenerSingleton::get().start();
+
+	// Parallel jobs
+	ThreadPoolSingleton::get().init(getCpuCoresCount());
+}
+
+//==============================================================================
+void android_main(struct android_app* app)
+{
+	app_dummy();
+
+	try
+	{
+		initSubsystems(app);
+
+		AppSingleton::get().mainLoop();
+
+		ANKI_LOGI("Exiting...");
+		abort();
+	}
+	catch(std::exception& e)
+	{
+		ANKI_LOGE("Aborting: %s", e.what());
+	}
+
+	ANKI_LOGI("Bye!!");
+}

+ 0 - 51
blender/common.py

@@ -1,51 +0,0 @@
-import Blender
-import string
-import os.path
-from Blender import Mathutils
-from Blender.Mathutils import *
-
-
-#===================================================================================================
-# vars                                                                                             =
-#===================================================================================================
-NULL = 0
-false = 0
-true = 1
-
-
-#===================================================================================================
-# Messages                                                                                         =
-#===================================================================================================
-"""
-Print a generic error. Used by ERROR, WARNING and INFO only
-"""
-def GenericError( msg0, msg1 ):
-	import sys
-	line = sys._getframe(2).f_lineno
-	fname = sys._getframe(2).f_code.co_filename
-	func_name = sys._getframe(2).f_code.co_name
-
-	print( "-->%s (%s:%i %s): %s" % (msg0, fname, line, func_name, msg1) )
-
-
-""" Prints an error """
-def ERROR( msg ):
-	GenericError( "ERROR", msg )
-
-
-""" Prints a warning """    
-def WARNING( msg ):
-	GenericError( "WARNING", msg )
-
-
-""" Prints some info """
-def INFO( msg ):
-	GenericError( "INFO", msg )
-	
-	
-#===================================================================================================
-# WriteFile                                                                                        =
-#===================================================================================================
-def WriteFile( filename, txt ):
-	file = open( filename, "w" )
-	file.write( txt )

+ 0 - 46
blender/main.py

@@ -1,46 +0,0 @@
-print( "\n\n\n\n\n\n\n---- STARTING EXPORTER ----" )
-
-import sys
-import Blender
-
-import mesh
-reload(sys.modules["mesh"])
-
-import skeleton
-reload(sys.modules["skeleton"])
-
-from material import *
-reload(sys.modules["material"])
-
-import skelanim
-reload(sys.modules["skelanim"])
-
-
-objs = Blender.Object.GetSelected()
-
-if len(objs) < 1:
-	raise RuntimeError("Not selected objs")
-
-for obj in objs:
-	mi = mesh.Initializer()
-	mi.blMesh = mesh.getBlMeshFromBlObj(obj)
-	mi.blSkeleton = skeleton.getBlSkeletonFromBlObj(obj)
-	mi.saveDir = "/home/godlike/src/anki/models/imp/"
-	#mtl = GetMaterial( mi.mesh )
-	mi.flipYZ = True
-	mesh.export(mi)
-	
-	"""si = skeleton.Initializer()
-	si.skeleton = skeleton.getBlSkeletonFromBlObj(obj)
-	si.saveDir = "/home/godlike/src/anki/models/imp/"
-	si.flipYZ = 1
-	skeleton.export(si)
-	
-	ai = skelanim.Initializer()
-	ai.obj = obj
-	ai.saveDir = "/home/godlike/src/anki/models/imp/"
-	ai.flipYZ = 1
-	skelanim.export(ai)"""
-
-
-print("---- ENDING EXPORTER ----")

+ 0 - 140
blender/material.py

@@ -1,140 +0,0 @@
-import sys
-from common import *
-reload( sys.modules["common"] )
-
-
-
-#===================================================================================================
-# GetMaterial                                                                                      =
-#===================================================================================================
-def GetMaterial( mesh ):
-	#check if mesh is the correct class
-	if( mesh.__class__.__name__ != "Blender Mesh" ):
-		ERROR( "The given func param is not a \"Blender Mesh\" class but a \"" + mesh.__class__.__name__ + "\"" )
-		return 0
-	
-	# check
-	mats = mesh.materials
-	if( len(mats) < 1 or len(mats) > 1 ):
-		ERROR( "Mesh \"" + mesh.getName() + "\" has non or too many materials" )
-		return 0
-	
-	mat = mats[0]
-	return mat
-
-
-#===================================================================================================
-# ScriptMaterial                                                                                   =
-#===================================================================================================
-def ScriptMaterial( mtl, rpath, b_cmnts ):
-	#check if mesh is the correct class
-	if( mtl.__class__.__name__ != "Blender Material" ):
-		ERROR( "The given func param is not a \"Blender Material\" class but a \"" + mtl.__class__.__name__ + "\"" )
-		return "error"
-	
-	ftxt = ""
-	
-	# write the colors
-	col = mtl.getRGBCol()
-	ftxt += "DIFFUSE_COL {" + str(col[0]) + " " + str(col[1]) + " " + str(col[2]) + " 1.0}\n"
-	
-	ftxt += "SPECULAR_COL {" + str(col[0]) + " " + str(col[1]) + " " + str(col[2]) + " 1.0}\n"
-	
-	# shininess
-	# we borow the shininess factor from the specular hardness
-	sh = mtl.getHardness()
-	if sh > 128:
-		WARNING( "Mat \"" + mtl.getName() + ": Choose spec hardness from 0 to 128" )
-		sh = 128
-	ftxt += "SHININESS " + str(sh) + "\n"
-	
-	#from now on only user defined vars
-	ftxt += "USER_DEFINED_VARS\n{\n"
-	
-	
-	#** TEXTURES **
-	texs = mtl.getTextures()
-	has_diff = 0
-	has_norm = 0
-	has_spec = 0
-	
-	for tex in texs:
-		if tex != None:
-			tex = tex.tex 
-			
-			# get the script identifier
-			if tex.name == "diffuse_map":
-				has_diff = 1
-			elif tex.name == "normal_map":
-				has_norm = 1
-			elif tex.name == "specular_map":
-				has_spec = 1
-			else:
-				WARNING( "Mat \"" + mtl.getName() + "\": Tex name \"" + tex.name + "\" cannot be processed" )
-				continue
-			
-			img = tex.getImage()
-			# check if someone forgot to actually put an image
-			if img == None:
-				WARNING( "Mat \"" + mtl.getName() + "\": There is no image set for \"" + tex.name + "\" texture" )
-				continue
-				
-			ftxt += "\t"
-			
-			# compute the fname
-			fname = img.getFilename()
-			if fname.find( rpath ) == -1: # the img is not in the engine's path
-				WARNING( "Mat \"" + mtl.getName() + "\": Img \"" + fname + "\" is not in the engine's dir" )		
-				continue
-				
-			relative = fname.replace( rpath, "" )
-			
-			ftxt += "TEXTURE " + tex.name + " \"" + relative + "\"\n"
-		#endif
-	#endfor
-	ftxt += "}\n"
-	
-	# shader
-	# choose a shader from one of the standards
-	shader_str = "ms_mp_"
-	if has_diff:
-		shader_str += "d"
-	else:
-		shader_str += "*"
-	if has_norm:
-		shader_str += "n"
-	else:
-		shader_str += "*"
-	if has_spec:
-		shader_str += "s"
-	else:
-		shader_str += "*"
-
-	shader_str += "*****"
-		
-		
-	shader_str = "shaders/" + shader_str + ".shdr"
-	
-	ftxt += "SHADER \"" + shader_str + "\"\n"
-	
-	
-	# end
-	return ftxt
-	
-	
-	
-#===================================================================================================
-# ExportMaterial                                                                                   =
-#===================================================================================================
-def ExportMaterial( path, rpath, mtl, b_cmnts ):
-	#check if mesh is the correct class
-	if( mtl.__class__.__name__ != "Blender Material" ):
-		ERROR( "The given func param is not a \"Blender Material\" class but a \"" + mtl.__class__.__name__ + "\"" )
-		return false
-	
-	INFO( "Trying to export material \"" + mtl.getName() + "\"" )
-	
-	filename = path + mtl.getName() + ".mtl"
-	WriteFile( filename, ScriptMaterial( mtl, rpath, b_cmnts ) )
-	
-	INFO( "Material exported!! \"" + filename + "\"" )

+ 0 - 348
blender/mesh.py

@@ -1,348 +0,0 @@
-import sys
-import os
-from struct import pack
-from copy import deepcopy
-from Blender import Mathutils
-from Blender.Mathutils import *
-
-
-#=======================================================================================================================
-# Initializer                                                                                                          =
-#=======================================================================================================================
-class Initializer:
-	def __init__(self):
-		self.blMesh = None  # Blender Mesh
-		self.blSkeleton = None # Blender Armature
-		self.saveDir = "" # the name of the saved file
-		self.flipYZ = False #convert from bl to right handed coord system
-	
-
-#=======================================================================================================================
-# Vert                                                                                                                 =
-#=======================================================================================================================
-class Vert:
-	def __init__(self):
-		self.x = 0.0
-		self.y = 0.0
-		self.z = 0.0
-		self.s = 0.0
-		self.t = 0.0
-		self.bonesNum = 0
-		self.boneIds = [-1, -1, -1, -1]
-		self.weights = [-1.0, -1.0, -1.0, -1.0]
-		self.nextId = -1 # shows the next vertId. Is != -1 if the vert is problematic
-
-
-#=======================================================================================================================
-# Tri                                                                                                                  =
-#=======================================================================================================================
-class Tri:
-	def __init__(self):
-		self.vertIds = [-1, -1, -1]
-
-
-#=======================================================================================================================
-# getBlMeshFromBlObj                                                                                                   =
-#=======================================================================================================================
-def getBlMeshFromBlObj(obj):
-	if(obj.__class__.__name__ != "Blender Object"):
-		raise RuntimeError("The given func param is not a \"Blender Object\" class but a \"" + obj.__class__.__name__ + "\"")
-	
-	if obj.getType() != "Mesh": 
-		raise RuntimeError("The obj \"" + obj.getName() + "\" must link to a mesh and not to a(n) " + obj.getType())
-
-	mesh = obj.getData(0, 1) 
-	return mesh
-
-
-#=======================================================================================================================
-# updateAnkiVertsWithBoneWeights                                                                                       =
-#=======================================================================================================================
-def updateAnkiVertsWithBoneWeights(mesh, skeleton, ankiVerts):
-	boneNames = skeleton.bones.keys()
-	boneNames.sort()
-	
-	# init text
-	ftxt = ""
-	
-	# link the vert groups to the bone ids
-	vgroup2boneId = {}   # we give the vgroup name and we get the bone's id in the skeleton
-	vgroupNames = mesh.getVertGroupNames()
-	
-	for vgroupName in vgroupNames:
-		boneId = -1
-		for boneName in boneNames:
-			if boneName == vgroupName:
-				boneId = boneNames.index(boneName)
-				break
-		
-		if boneId == -1:
-			print("Vert group \"" + vgroupName + "\" cant link to a bone")
-		
-		vgroup2boneId[vgroupName] = boneId
-
-
-	# for every non problematic vert do some shit
-	for i in range(len(mesh.verts)):
-		vert = mesh.verts[i]
-		influences = mesh.getVertexInfluences(vert.index)
-		
-		influencesNum = 0
-		sumw = 0.0
-		# calc the influences num and the total weight (NOTE:we may have a vert group that doesnt connect to a bone)
-		for influence in influences:
-			vgroup = influence[0]
-			weight = influence[1]
-			
-			if vgroup2boneId[vgroup] != -1:
-				influencesNum = influencesNum + 1
-				sumw = sumw + weight
-		
-		# a check
-		if influencesNum > 4:
-			raise RuntimeError("Cannot have more than 4 bones per vert")
-	
-		# write influences num
-		ankiVerts[i].bonesNum = influencesNum
-		
-		for j in range(len(influences)):
-			influence = influences[j]
-			vgroup = influence[0]
-			weight = influence[1]
-			
-			if vgroup2boneId[vgroup] != -1:	
-				# write bone id
-				ankiVerts[i].boneIds[j] = vgroup2boneId[vgroup]
-				# write weight for that bone
-				ankiVerts[i].weights[j] = weight/sumw
-	# end for all non problematic verts
-	
-	
-	# for every canonical ankiVert fill the problematics
-	for i in range(len(mesh.verts)):
-		ankiVert = ankiVerts[i]
-		
-		cid = i # current id
-		nid = ankiVert.nextId # next id
-		
-		if nid == -1:
-			continue
-		
-		while nid != -1:
-			# copy vert weight data
-			ankiVerts[nid].bonesNum = ankiVerts[cid].bonesNum
-			ankiVerts[nid].boneIds = deepcopy(ankiVerts[cid].boneIds)
-			ankiVerts[nid].weights = deepcopy(ankiVerts[cid].weights)
-			
-			cid = nid
-			nid = ankiVerts[nid].nextId
-				
-		
-	
-
-#=======================================================================================================================
-# getAnkiMeshScript                                                                                                    =
-#=======================================================================================================================
-def	getAnkiMeshScript(mesh, skeleton, meshName, flipYZ):
-	# check verts number
-	vertsNum = len(mesh.verts)
-	if vertsNum < 3:
-		raise RuntimeError("The mesh named \"" + mesh.name + "\" has insufficient vert num")
-	
-	# declare some vars
-	ankiVerts = {}
-	ankiTris = [Tri() for tri in range(len(mesh.faces))]
-	hasUvs = 0
-
-
-	# if it has UVs	
-	if mesh.faceUV:
-		hasUvs = 1
-		
-		# for all faces
-		for i in range(len(mesh.faces)):
-			face = mesh.faces[i]
-			if len(face.verts) != 3:
-				raise RuntimeError("Only triangles are accepted")
-			
-			ankiTris[i] = Tri() # create new tri
-			
-			# for verts in the face
-			for j in [0, 1, 2]:
-				vertId = face.verts[j].index
-			
-				# vert does not exist
-				if not ankiVerts.has_key(vertId):
-					ankiVerts[vertId] = Vert()
-					ankiVerts[vertId].x = mesh.verts[vertId].co.x
-					ankiVerts[vertId].y = mesh.verts[vertId].co.y
-					ankiVerts[vertId].z = mesh.verts[vertId].co.z
-					ankiVerts[vertId].s = face.uv[j].x
-					ankiVerts[vertId].t = face.uv[j].y
-					ankiVerts[vertId].nextId = -1
-				
-					ankiTris[i].vertIds[j] = vertId
-				else:
-					prevId = -1
-					while 1:
-						# if in end of the list, create new vert and link list
-						if vertId == -1:
-							ankiVerts[vertsNum] = deepcopy(ankiVerts[prevId])
-							ankiVerts[vertsNum].s = face.uv[j].x
-							ankiVerts[vertsNum].t = face.uv[j].y
-							ankiVerts[vertsNum].nextId = -1
-	
-							ankiVerts[prevId].nextId = vertsNum
-						
-							ankiTris[i].vertIds[j] = vertsNum
-						
-							vertsNum = vertsNum + 1
-							break
-						# a vert with the same UVs exists
-						elif ankiVerts[vertId].s == face.uv[j].x and ankiVerts[vertId].t == face.uv[j].y:
-							ankiTris[i].vertIds[j] = vertId
-							break;
-						# move to next node
-						else:
-							prevId = vertId
-							vertId = ankiVerts[vertId].nextId
-	# no UVs
-	else:
-		hasUvs = 0
-		
-		# set the verts
-		for i in range(len(mesh.verts)):
-			vert = mesh.verts[i]
-			
-			ankiVerts[i] = Vert()
-			ankiVerts[i].x = vert.co.x
-			ankiVerts[i].y = vert.co.y
-			ankiVerts[i].z = vert.co.z
-		
-		# set the faces
-		for i in range(len(mesh.faces)):
-			face = mesh.faces[i]
-			
-			if len(face.verts) != 3:
-				raise RuntimeError("Only triangles are accepted")
-		
-			for j in [0, 1, 2]:
-				ankiTris[i].vertIds[j] = face.verts[j].index
-		
-		
-	# write to ftxt
-	
-	# write mtl name
-	"""ftxt = "mesh\n{\n"
-	ftxt += "\tmaterial \"" + mtlName + "\"\n"
-	
-	# write verts
-	ftxt += "\tvertsNum " + str(len(ankiVerts)) + "\n\tverts\n\t{\n"
-	for i in range(len(ankiVerts)):
-		ankiVert = ankiVerts[i]
-		if flipYZ == 0:
-			ftxt += "\t\tvert {" + str(ankiVert.x) + " " + str(ankiVert.y) + " " + str(ankiVert.z) + "}\n"
-		else:
-			ftxt += "\t\tvert {" + str(ankiVert.x) + " " + str(ankiVert.z) + " " + str(-ankiVert.y) + "}\n"
-		
-	# write the tris
-	ftxt += str(len(ankiTris)) + "\n"
-	for ankiTri in ankiTris:
-		ftxt += str(ankiTri.vertIds[0]) + " " + str(ankiTri.vertIds[1]) + " " + str(ankiTri.vertIds[2]) + "\n"
-		
-	# write the UVs
-	if hasUvs:
-		ftxt += str(len(ankiVerts)) + "\n"
-		for i in range(len(ankiVerts)):
-			ftxt += str(ankiVerts[i].s) + " " + str(ankiVerts[i].t) + "\n"
-	else:
-		ftxt += "0\n"
-	
-	# write the vert weights
-	if skeleton != None:
-		updateAnkiVertsWithBoneWeights(mesh, skeleton, ankiVerts)
-		
-		ftxt += str(len(ankiVerts)) + "\n"
-		
-		for i in range(len(ankiVerts)):
-			ankiVert = ankiVerts[i]
-			ftxt += str(ankiVert.bonesNum) + "\n"
-			for j in range(ankiVert.bonesNum):
-				ftxt += str(ankiVert.boneIds[j]) + " " + str(ankiVert.weights[j]) + "\n"
-	else:
-		ftxt += "0\n"
-
-	return ftxt"""
-	
-	# Magic
-	buff = pack("8s", "ANKIMESH")
-	
-	# Mesh name
-	str_ = meshName
-	buff += pack("I" + str(len(str_)) + "s", len(str_), str_)
-	
-	# Verts num
-	buff += pack("I", len(ankiVerts))
-	
-	# Verts
-	for i in range(len(ankiVerts)):
-		ankiVert = ankiVerts[i]
-		if not flipYZ:
-			buff += pack("fff", ankiVert.x, ankiVert.y, ankiVert.z)
-		else:
-			buff += pack("fff", ankiVert.x, ankiVert.z, -ankiVert.y)
-	
-	# Tris num
-	buff += pack("I", len(ankiTris))
-	
-	# Tris
-	for ankiTri in ankiTris:
-		buff += pack("III", int(ankiTri.vertIds[0]), int(ankiTri.vertIds[1]), int(ankiTri.vertIds[2]))
-		
-	# Tex coords
-	if hasUvs:
-		buff += pack("I", len(ankiVerts))
-		for i in range(len(ankiVerts)):
-			buff += pack("ff", ankiVerts[i].s, ankiVerts[i].t)
-	else:
-		buff += pack("I", 0)
-		
-	# Bone weights
-	if skeleton != None:
-		updateAnkiVertsWithBoneWeights(mesh, skeleton, ankiVerts)
-		
-		buff += pack("I", len(ankiVerts))
-		
-		for i in range(len(ankiVerts)):
-			ankiVert = ankiVerts[i]
-			buff += pack("I", ankiVert.bonesNum)
-			for j in range(ankiVert.bonesNum):
-				buff += pack("If", ankiVert.boneIds[j], ankiVert.weights[j])
-	else:
-		buff += pack("I", 0)
-	
-	return buff
-			
-		
-#=======================================================================================================================
-# export                                                                                                               =
-#=======================================================================================================================
-def export(meshInit):
-	mesh = meshInit.blMesh
-	skeleton = meshInit.blSkeleton
-	
-	#check if mesh is the correct class
-	if mesh.__class__.__name__ != "Blender Mesh":
-		raise RuntimeError("The given func param is not a \"Blender Mesh\" class but a \"" + mesh.__class__.__name__ + "\"")
-	
-	if skeleton != None:
-		#check if skeleton is the correct class
-		if(skeleton.__class__.__name__ != "Armature"):
-			raise RuntimeError("The given func param is not a \"Armature\" class but a \"" + skeleton.__class__.__name__ + "\"")
-	
-	print("Trying to export mesh \"" + mesh.name + "\"")
-	filename = os.path.abspath(meshInit.saveDir + "/" + mesh.name + ".mesh")
-	file = open(filename, "wb")
-	file.write(getAnkiMeshScript(mesh, skeleton, mesh.name + ".mesh", meshInit.flipYZ))
-	print("Mesh exported!! \"" + filename + "\"")	
-	

+ 0 - 218
blender/skelanim.py

@@ -1,218 +0,0 @@
-import sys
-import os
-from copy import deepcopy
-from Blender import Mathutils
-from Blender.Mathutils import *
-import Blender
-
-
-#=======================================================================================================================
-# Initializer                                                                                                          =
-#=======================================================================================================================
-class Initializer:
-	def __init__(self):
-		self.obj = None
-		self.saveDir = "" # the name of the saved file
-		self.flipYZ = 0 # convert from bl to right handed coord system. NOT USED
-
-
-#=======================================================================================================================
-# multMatrix                                                                                                           =
-#=======================================================================================================================
-def multMatrix(m, b):
-	c = Matrix()
-	c[0][0] = m[0][0]*b[0][0] + m[0][1]*b[1][0] + m[0][2]*b[2][0] + m[0][3]*b[3][0]
-	c[0][1] = m[0][0]*b[0][1] + m[0][1]*b[1][1] + m[0][2]*b[2][1] + m[0][3]*b[3][1]
-	c[0][2] = m[0][0]*b[0][2] + m[0][1]*b[1][2] + m[0][2]*b[2][2] + m[0][3]*b[3][2]
-	c[0][3] = m[0][0]*b[0][3] + m[0][1]*b[1][3] + m[0][2]*b[2][3] + m[0][3]*b[3][3]
-	c[1][0] = m[1][0]*b[0][0] + m[1][1]*b[1][0] + m[1][2]*b[2][0] + m[1][3]*b[3][0]
-	c[1][1] = m[1][0]*b[0][1] + m[1][1]*b[1][1] + m[1][2]*b[2][1] + m[1][3]*b[3][1]
-	c[1][2] = m[1][0]*b[0][2] + m[1][1]*b[1][2] + m[1][2]*b[2][2] + m[1][3]*b[3][2]
-	c[1][3] = m[1][0]*b[0][3] + m[1][1]*b[1][3] + m[1][2]*b[2][3] + m[1][3]*b[3][3]
-	c[2][0] = m[2][0]*b[0][0] + m[2][1]*b[1][0] + m[2][2]*b[2][0] + m[2][3]*b[3][0]
-	c[2][1] = m[2][0]*b[0][1] + m[2][1]*b[1][1] + m[2][2]*b[2][1] + m[2][3]*b[3][1]
-	c[2][2] = m[2][0]*b[0][2] + m[2][1]*b[1][2] + m[2][2]*b[2][2] + m[2][3]*b[3][2]
-	c[2][3] = m[2][0]*b[0][3] + m[2][1]*b[1][3] + m[2][2]*b[2][3] + m[2][3]*b[3][3]
-	c[3][0] = m[3][0]*b[0][0] + m[3][1]*b[1][0] + m[3][2]*b[2][0] + m[3][3]*b[3][0]
-	c[3][1] = m[3][0]*b[0][1] + m[3][1]*b[1][1] + m[3][2]*b[2][1] + m[3][3]*b[3][1]
-	c[3][2] = m[3][0]*b[0][2] + m[3][1]*b[1][2] + m[3][2]*b[2][2] + m[3][3]*b[3][2]
-	c[3][3] = m[3][0]*b[0][3] + m[3][1]*b[1][3] + m[3][2]*b[2][3] + m[3][3]*b[3][3]
-	return c
-
-
-#=======================================================================================================================
-# A few classes                                                                                                        =
-#=======================================================================================================================
-class BonePose:
-	def __init__(self):
-		self.rotation = Quaternion(1.0, 0.0, 0.0, 0.0)
-		self.translation = Vector(0.0, 0.0, 0.0)
-
-
-class BoneAnim:
-	def __init__(self):
-		self.keyframes = [] # before the "write to file" phase this array is ether empty
-		                    # if the bone doesnt have animation or an array of poses
-	
-	
-class SkelAnim:
-	def __init__(self):
-		self.bones = []
-		self.keyframes = []
-
-
-#=======================================================================================================================
-# getAnkiScript                                                                                                        =
-#=======================================================================================================================
-def getAnkiScript(obj, flipYZ, action):
-	skeleton = obj.getData(0, 0) 	
-	
-	# init and populate the instances
-	skelAnim = SkelAnim()
-	skelAnim.keyframes = action.getFrameNumbers()
-	
-	boneNames = deepcopy(skeleton.bones.keys())
-	boneNames.sort()
-	
-	#skelAnim.bones = [BoneAnim() for anim in range(len(boneNames))]
-	
-	for i in range(0, len(boneNames)):
-		skelAnim.bones.append(BoneAnim())
-		for j in range(0, len(skelAnim.keyframes)):
-			skelAnim.bones[i].keyframes.append(BonePose())
-	
-	
-	# now populate with the correct data
-	# for all the kframes
-	for i in range(0, len(skelAnim.keyframes)):
-		kframe = skelAnim.keyframes[i]
-		Blender.Set("curframe", kframe)
-		Blender.Redraw()
-		pose = obj.getPose()
-		
-		# for all bones
-		for j in range(0, len(boneNames)):
-			boneName = boneNames[j]
-			poseBone = pose.bones[boneName]
-			bone = skeleton.bones[boneName]
-			
-			# rotation
-			rot = poseBone.quat.toMatrix()
-			rot.resize4x4()
-			# translation
-			tra = Matrix()
-			tra.identity()
-			for m in range(0, 3):
-				tra[m][3] = poseBone.loc[m]
-			# bone matris at armature space aka MA
-			MA = bone.matrix["ARMATURESPACE"].copy()
-			MAi = MA.copy()
-			MAi.invert()
-			
-			# calc the m4 = MA * tra * rot * MAi
-			rot.transpose()
-			tra.transpose()
-			MA.transpose()
-			MAi.transpose()
-			
-			m4 = multMatrix(rot, MAi)
-			m4 = multMatrix(tra, m4)
-			m4 = multMatrix(MA, m4)
-			
-			m4.transpose()
-			
-			# get the final quat and loc
-			quat = m4.rotationPart()
-			quat = quat.toQuat()
-			loc  = m4.translationPart()
-			
-			quat = poseBone.quat
-			loc = poseBone.loc
-			
-			for k in range(0, 4):
-				skelAnim.bones[j].keyframes[i].rotation[k] = quat[k]
-			
-			for k in range(0, 3):
-				skelAnim.bones[j].keyframes[i].translation[k] = loc[k]
-	
-	Blender.Set("curframe", 1)
-	Blender.Redraw()	
-	
-	
-	# now do the apropriate for the bones without translation or rotation
-	zeroVec = Vector(0.0, 0.0, 0.0)
-	identQuat = Quaternion(1.0, 0.0, 0.0, 0.0)
-	# for all the bones
-	for i in range(0, len(boneNames)):
-		noAnimNum = 0   # how many times we found that the bone has no anim
-		bone = skelAnim.bones[i]
-		# for all the keyframes
-		for j in range(0, len(skelAnim.keyframes)):
-			
-			if bone.keyframes[j].rotation == identQuat and bone.keyframes[j].translation == zeroVec:
-				noAnimNum = noAnimNum + 1
-			
-		if noAnimNum == len(skelAnim.keyframes):
-			print("Bone \"%s\" has no animation" % boneNames[i])
-			bone.keyframes = []
-	
-		
-	# write to ftxt
-	ftxt = ""
-	
-	# the keyframes
-	ftxt += str(len(skelAnim.keyframes)) + "\n"
-	
-	for kf in skelAnim.keyframes:
-		ftxt += str(kf - 1) + " "
-	ftxt += "\n"
-	
-	# the bones num
-	ftxt += str(len(boneNames)) + "\n"
-	
-	# for all bones
-	for i in range(0, len(boneNames)):
-		bone = skelAnim.bones[i]
-		
-		if len(bone.keyframes):
-			ftxt += "1\n"
-
-			# for all keyframes			
-			for j in range(0, len(skelAnim.keyframes)):				
-				# write rotation			
-				for k in range(0, 4):
-					ftxt += str(bone.keyframes[j].rotation[k]) + " "
-				ftxt += "\n"
-				
-				# write translation
-				for k in range(0, 3):
-					ftxt += str(bone.keyframes[j].translation[k]) + " "
-				ftxt += "\n"
-			
-		else:
-			ftxt += "0\n"
-	
-	return ftxt
-
-
-#=======================================================================================================================
-# export                                                                                                               =
-#=======================================================================================================================
-def export(init):
-	obj = init.obj
-	
-	if obj.getType() != "Armature":
-		raise RuntimeError("Select a skeleton and not a(n) " + obj.getType())
-
-	print("Trying to export skeleton animation")
-	
-	action = obj.getAction()
-	if action == 0:
-		raise RuntimeError("Empty action for obj " + obj.getName())
-	
-	filename = init.saveDir + action.name + "." + obj.getName() + ".anim"	
-	file = open(filename, "w")
-	file.write(getAnkiScript(obj, init.flipYZ, action))
-	
-	print("Skeleton animation exported!! \"" + filename + "\"")	
-	

+ 0 - 221
blender/skeleton.py

@@ -1,221 +0,0 @@
-import sys
-import os
-from struct import pack
-from copy import deepcopy
-from Blender import Mathutils
-from Blender.Mathutils import *
-import Blender
-
-
-#=======================================================================================================================
-# multMatrix                                                                                                           =
-#=======================================================================================================================
-def multMatrix(m, b):
-	c = Matrix()
-	c[0][0] = m[0][0]*b[0][0] + m[0][1]*b[1][0] + m[0][2]*b[2][0] + m[0][3]*b[3][0]
-	c[0][1] = m[0][0]*b[0][1] + m[0][1]*b[1][1] + m[0][2]*b[2][1] + m[0][3]*b[3][1]
-	c[0][2] = m[0][0]*b[0][2] + m[0][1]*b[1][2] + m[0][2]*b[2][2] + m[0][3]*b[3][2]
-	c[0][3] = m[0][0]*b[0][3] + m[0][1]*b[1][3] + m[0][2]*b[2][3] + m[0][3]*b[3][3]
-	c[1][0] = m[1][0]*b[0][0] + m[1][1]*b[1][0] + m[1][2]*b[2][0] + m[1][3]*b[3][0]
-	c[1][1] = m[1][0]*b[0][1] + m[1][1]*b[1][1] + m[1][2]*b[2][1] + m[1][3]*b[3][1]
-	c[1][2] = m[1][0]*b[0][2] + m[1][1]*b[1][2] + m[1][2]*b[2][2] + m[1][3]*b[3][2]
-	c[1][3] = m[1][0]*b[0][3] + m[1][1]*b[1][3] + m[1][2]*b[2][3] + m[1][3]*b[3][3]
-	c[2][0] = m[2][0]*b[0][0] + m[2][1]*b[1][0] + m[2][2]*b[2][0] + m[2][3]*b[3][0]
-	c[2][1] = m[2][0]*b[0][1] + m[2][1]*b[1][1] + m[2][2]*b[2][1] + m[2][3]*b[3][1]
-	c[2][2] = m[2][0]*b[0][2] + m[2][1]*b[1][2] + m[2][2]*b[2][2] + m[2][3]*b[3][2]
-	c[2][3] = m[2][0]*b[0][3] + m[2][1]*b[1][3] + m[2][2]*b[2][3] + m[2][3]*b[3][3]
-	c[3][0] = m[3][0]*b[0][0] + m[3][1]*b[1][0] + m[3][2]*b[2][0] + m[3][3]*b[3][0]
-	c[3][1] = m[3][0]*b[0][1] + m[3][1]*b[1][1] + m[3][2]*b[2][1] + m[3][3]*b[3][1]
-	c[3][2] = m[3][0]*b[0][2] + m[3][1]*b[1][2] + m[3][2]*b[2][2] + m[3][3]*b[3][2]
-	c[3][3] = m[3][0]*b[0][3] + m[3][1]*b[1][3] + m[3][2]*b[2][3] + m[3][3]*b[3][3]
-	return c
-
-
-#=======================================================================================================================
-# rotMat                                                                                                               =
-#=======================================================================================================================
-rotMat = Matrix()
-rotMat[0][0] = 1.0
-rotMat[0][1] = 0.0
-rotMat[0][2] = 0.0
-rotMat[0][3] = 0.0
-rotMat[1][0] = 0.0
-rotMat[1][1] = 0.0
-rotMat[1][2] = 1.0
-rotMat[1][3] = 0.0
-rotMat[2][0] = 0.0
-rotMat[2][1] = -1.0
-rotMat[2][2] = 0.0
-rotMat[2][3] = 0.0
-rotMat[3][0] = 0.0
-rotMat[3][1] = 0.0
-rotMat[3][2] = 0.0
-rotMat[3][3] = 1.0
-rotMat.transpose()
-
-
-#=======================================================================================================================
-# Initializer                                                                                                          =
-#=======================================================================================================================
-class Initializer:
-	def __init__(self):
-		self.blSkeleton = None # Blender Armature
-		self.saveDir = "" # the name of the saved file
-		self.flipYZ = 0 #convert from bl to right handed coord system
-	
-
-
-#======================================================================================================================
-# getBlSkeletonFromBlObj                                                                                               =
-#=======================================================================================================================
-def getBlSkeletonFromBlObj(obj):	
-	# check if obj is correct class
-	if(obj.__class__.__name__ != "Blender Object"):
-		raise RuntimeError("The given func param is not a \"Blender Object\" class but a \"" + obj.__class__.__name__ + "\"")
-	
-	# check modifiers
-	if len(obj.modifiers) < 1:
-		raise RuntimeError("Obj \"" + obj.getName() + "\" doesnt have modifiers so no armature found")
-	
-	# search for modifier of skeleton type
-	for mod in obj.modifiers:
-		if mod.type == Blender.Modifier.Types.ARMATURE:
-			aobj = mod[Blender.Modifier.Settings.OBJECT]
-			skeleton = Blender.Object.Get(aobj.name).getData(0, 1) # set skeleton
-			return skeleton
-	
-	raise RuntimeError("Obj \"" + obj.getName() + "\" has no modifier of type armature")
-		
-
-
-#=======================================================================================================================
-# getAnkiSkeletonScript                                                                                                =
-#=======================================================================================================================
-def getAnkiSkeletonScript(skeleton, flipYZ):	
-	"""ftxt = "" # file text
-	
-	# write the file
-	boneNames = skeleton.bones.keys()
-	boneNames.sort() # the bones are written in alpabetical order
-
-	ftxt += str(len(boneNames)) + "\n"
-
-	for boneName in boneNames:	
-		bone = skeleton.bones[boneName]
-		
-		# name
-		ftxt += "\"" + bone.name + "\"\n"
-		
-		# head
-		co = bone.head["ARMATURESPACE"]
-		if flipYZ:
-			ftxt += str(co.x) + " " + str(co.z) + " " + str(-co.y) + "\n"
-		else:
-			ftxt += str(co.x) + " " + str(co.y) + " " + str(co.z) + "\n"
-		
-		# tail
-		co = bone.tail["ARMATURESPACE"]
-		if flipYZ:
-			ftxt += str(co.x) + " " + str(co.z) + " " + str(-co.y) + "\n"
-		else:
-			ftxt += str(co.x) + " " + str(co.y) + " " + str(co.z) + "\n"
-		
-		# matrix
-		m4 = bone.matrix["ARMATURESPACE"].copy()
-		
-		if flipYZ:
-			m4 = multMatrix(m4, rotMat)
-		
-		for i_ in range(0, 4):
-			for j_ in range(0, 4):
-				ftxt += str(m4[j_][i_]) + " "
-		ftxt += "\n"
-		
-		# write the parent
-		if not bone.parent:
-			ftxt += "NULL\n"
-		else:
-			ftxt += str(boneNames.index(bone.parent.name)) + "\n"					
-
-			
-		# write the childs
-		ftxt += str(len(bone.children)) + "\n"
-		
-		for child in bone.children:
-			ftxt += str(boneNames.index(child.name)) + " "
-		
-		ftxt += "\n"	
-		
-	return ftxt"""
-
-	buff = pack("8s", "ANKISKEL")
-	
-	boneNames = skeleton.bones.keys()
-	boneNames.sort() # the bones are written in alpabetical order
-	
-	buff += pack("I", len(boneNames))
-	
-	for boneName in boneNames:	
-		bone = skeleton.bones[boneName]
-		
-		# name
-		str_ = bone.name
-		buff += pack("I" + str(len(str_)) + "s", len(str_), str_)
-		
-		# head
-		co = bone.head["ARMATURESPACE"]
-		if flipYZ:
-			buff += pack("fff", co.x, co.z, -co.y)
-		else:
-			buff += pack("fff", co.x, co.y, co.z)
-		
-		# tail
-		co = bone.tail["ARMATURESPACE"]
-		if flipYZ:
-			buff += pack("fff", co.x, co.z, -co.y)
-		else:
-			buff += pack("fff", co.x, co.y, co.z)
-	
-		# matrix
-		m4 = bone.matrix["ARMATURESPACE"].copy()
-		
-		if flipYZ:
-			m4 = multMatrix(m4, rotMat)
-			
-		for i_ in range(0, 4):
-			for j_ in range(0, 4):
-				buff += pack("f", m4[j_][i_])
-				
-		# write the parent
-		if not bone.parent:
-			buff += pack("I", 0xFFFFFFFF)
-		else:
-			buff += pack("I", boneNames.index(bone.parent.name))
-			
-		# write the childs
-		buff += pack("I", len(bone.children))
-		
-		for child in bone.children:
-			buff += pack("I", boneNames.index(child.name))
-			
-	# end!
-	return buff
-		
-	
-#=======================================================================================================================
-# export                                                                                                               =
-#=======================================================================================================================
-def export(skeletonInit):
-	skeleton = skeletonInit.skeleton
-	#check if mesh is the correct class
-	if(skeleton.__class__.__name__ != "Armature"):
-		raise RuntimeError("The given func param is not a \"Armature\" class but a \"" + skeleton.__class__.__name__ + "\"")
-	
-	print("Trying to export skeleton \"" + skeleton.name + "\"")
-	
-	filename = skeletonInit.saveDir + skeleton.name + ".skel"
-	file = open(filename, "wb")
-	file.write(getAnkiSkeletonScript(skeleton, skeletonInit.flipYZ))
-	
-	print("Skeleton exported!! \"" + filename + "\"")	
-	

+ 0 - 0
findbiglines → findbiglines.sh


+ 17 - 1
include/anki/core/App.h

@@ -1,8 +1,12 @@
 #ifndef ANKI_CORE_APP_H
 #define ANKI_CORE_APP_H
 
+#include "anki/Config.h"
 #include "anki/util/Singleton.h"
 #include "anki/util/StringList.h"
+#if ANKI_OS == ANKI_OS_ANDROID
+#	include <android_native_app_glue.h>
+#endif
 
 namespace anki {
 
@@ -46,6 +50,14 @@ public:
 	{
 		return cachePath;
 	}
+
+#if ANKI_OS == ANKI_OS_ANDROID
+	android_app& getAndroidApp()
+	{
+		ANKI_ASSERT(andApp);
+		return *andApp;
+	}
+#endif
 	/// @}
 
 	/// What it does:
@@ -65,7 +77,11 @@ private:
 	std::string cachePath;
 	F32 timerTick;
 
-	void initDirs(void* systemSpecificData);
+#if ANKI_OS == ANKI_OS_ANDROID
+	android_app* andApp = nullptr;
+#endif
+
+	void initDirs();
 };
 
 typedef Singleton<App> AppSingleton;

+ 0 - 3
include/anki/core/NativeWindow.h

@@ -37,9 +37,6 @@ struct NativeWindowInitializer
 	/// @}
 
 	std::string title = "Untitled window";
-
-	/// System specific data (nedeed in Android)
-	void* systemData = nullptr;
 };
 
 /// Native window with GL context

+ 0 - 1
include/anki/core/NativeWindowAndroid.h

@@ -14,7 +14,6 @@ struct NativeWindowImpl
 	EGLDisplay display = EGL_NO_DISPLAY;
 	EGLSurface surface = EGL_NO_SURFACE;
 	EGLContext context = EGL_NO_CONTEXT;
-	android_app* andApp = nullptr;
 
 	~NativeWindowImpl()
 	{

+ 8 - 4
src/core/App.cpp

@@ -40,19 +40,24 @@ namespace anki {
 //==============================================================================
 void App::init(void* systemSpecificData)
 {
+#if ANKI_OS == ANKI_OS_ANDROID
+	ANKI_ASSERT(systemSpecificData);
+	andApp = (android_app*)systemSpecificData;
+#endif
+
 	// Install signal handlers
 	/*signal(SIGSEGV, handler);
 	signal(SIGBUS, handler);
 	signal(SIGFPE, handler);*/
 
 	printAppInfo();
-	initDirs(systemSpecificData);
+	initDirs();
 
 	timerTick = 1.0 / 60.0; // in sec. 1.0 / period
 }
 
 //==============================================================================
-void App::initDirs(void* systemSpecificData)
+void App::initDirs()
 {
 #if ANKI_OS != ANKI_OS_ANDROID
 	// Settings path
@@ -74,8 +79,7 @@ void App::initDirs(void* systemSpecificData)
 	ANKI_LOGI("Creating cache dir: %s", cachePath.c_str());
 	createDirectory(cachePath.c_str());
 #else
-	ANKI_ASSERT(systemSpecificData);
-	ANativeActivity* activity = (ANativeActivity*)systemSpecificData;
+	ANativeActivity* activity = andApp->activity;
 
 	// Settings path
 	settingsPath = std::string(activity->internalDataPath);

+ 8 - 5
src/core/NativeWindowAndroid.cpp

@@ -1,4 +1,6 @@
 #include "anki/core/NativeWindowAndroid.h"
+#include "anki/core/App.h"
+#include "anki/core/Logger.h"
 #include "anki/util/Exception.h"
 #include "anki/util/Array.h"
 #include "anki/util/StdTypes.h"
@@ -18,8 +20,9 @@ void NativeWindowImpl::create(NativeWindowInitializer& init)
 	EGLint format;
 	EGLConfig config;
 
-	ANKI_ASSERT(init.systemData != nullptr);
-	andApp = (android_app*)init.systemData;
+	ANKI_LOGI("Creating native window");
+
+	android_app& andApp = AppSingleton::get().getAndroidApp();
 
 	// EGL init
 	//
@@ -79,12 +82,12 @@ void NativeWindowImpl::create(NativeWindowInitializer& init)
 
 	eglGetConfigAttrib(display, config, EGL_NATIVE_VISUAL_ID, &format);
 
-	ANKI_ASSERT(andApp->window);
-	ANativeWindow_setBuffersGeometry(andApp->window, 0, 0, format);
+	ANKI_ASSERT(andApp.window);
+	ANativeWindow_setBuffersGeometry(andApp.window, 0, 0, format);
 
 	// Surface
 	//
-	surface = eglCreateWindowSurface(display, config, andApp->window, NULL);
+	surface = eglCreateWindowSurface(display, config, andApp.window, NULL);
 	if(surface == EGL_NO_SURFACE)
 	{
 		throw ANKI_EXCEPTION("Cannot create surface");

+ 1 - 1
src/util/Assert.cpp

@@ -21,7 +21,7 @@ void akassert(bool expr, const char* exprTxt, const char* file, int line,
 			<< func << ") " << "Assertion failed: " << exprTxt << "\033[0m"
 			<< std::endl;
 #elif ANKI_OS == ANKI_OS_ANDROID
-		__android_log_print(ANDROID_LOG_ERROR, "AnKi" 
+		__android_log_print(ANDROID_LOG_ERROR, "AnKi",
 			"(%s:%d %s) Assertion failed: %s", file, line,
 			func, exprTxt);
 #else

+ 1 - 3
src/util/FilePosix.cpp

@@ -56,7 +56,6 @@ void removeDirectory(const char* dirname)
 
 	if(path == NULL) 
 	{
-		fprintf(stderr, "Out of memory error\n");
 		throw ANKI_EXCEPTION("Out of memory error");
 	}
 
@@ -66,8 +65,7 @@ void removeDirectory(const char* dirname)
 		throw ANKI_EXCEPTION("opendir() failed");
 	}
 
-	entry = readdir(dir);
-	while(entry != NULL) 
+	while((entry = readdir(dir)) != NULL) 
 	{
 		if(strcmp(entry->d_name, ".") && strcmp(entry->d_name, "..")) 
 		{