<commit_before>#include "allocore/graphics/al_Asset.hpp"


#include "allocore/graphics/al_Graphics.hpp"

#define USE_ASSIMP3 1

#ifdef USE_ASSIMP3

#include "assimp/Importer.hpp"
#include "assimp/scene.h"
#include "assimp/postprocess.h"
#include "assimp/cimport.h"
#include "assimp/types.h"
#include "assimp/matrix4x4.h"

#else

#include "assimp/assimp.h"
#include "assimp/aiTypes.h"
#include "assimp/aiPostProcess.h"
#include "assimp/aiScene.h"
#include "assimp/aiMaterial.h"

#endif

/*
#include "assimp/types.h"
#include "assimp/postprocess.h"
#include "assimp/scene.h"
#include "assimp/material.h"
*/

#include <stdio.h>
#include <map>

using namespace al;

Vec4f vec4FromAIColor4D(aiColor4D& v) {
	return Vec4f(v.r, v.g, v.b, v.a);
}

Vec3f vec3FromAIVector3D(aiVector3D& v) {
	return Vec3f(v.x, v.y, v.z);
}

Vec2f vec2FromAIVector3D(aiVector3D& v) {
	return Vec2f(v.x, v.y);
}


void initLogStream() {
	static bool initializedLog = false;
	static struct aiLogStream logStream;
	if (!initializedLog) {
		initializedLog = true;
		// get a handle to the predefined STDOUT log stream and attach
		// it to the logging system. It will be active for all further
		// calls to aiImportFile(Ex) and aiApplyPostProcessing.
		logStream = aiGetPredefinedLogStream(aiDefaultLogStream_STDOUT,NULL);
		aiAttachLogStream(&logStream);
	}
}

int countNodes(const aiNode * n) {
	int count = 1;
	for (unsigned int i=0; i<n->mNumChildren; i++) {
		count += countNodes(n->mChildren[i]);
	}
	return count;
}






class Scene::Node::Impl {
public:
	Impl(const aiNode * node) : node(node) {}
	
	const aiNode * node;
};


class Scene::Impl /*: public SceneNode::Impl*/ {
public:
	Impl(const aiScene * scene) : /* SceneNode::Impl(scene->mRootNode),*/ scene(scene) {
		nodes.resize(countNodes(scene->mRootNode));
		addNode(scene->mRootNode, 0);
	}
	
	~Impl() {
		aiReleaseImport(scene);
	}
	
	int addNode(const aiNode * n, int idx) {
		nodes[idx].mImpl = new Scene::Node::Impl(n);
		nodeMap[n] = idx;
		for (unsigned int i=0; i<n->mNumChildren; i++) {
			idx = addNode(n->mChildren[i], idx+1);
		}
		return idx;
	}
	
	const aiScene * scene;
	
	std::map<const aiNode *, int> nodeMap;
	std::vector<Node> nodes;
};


Scene::Material :: Material() 
:	shading_model(0), 
	two_sided(0), 
	wireframe(0), 
	blend_func(0), 
	shininess(0.25), 
	shininess_strength(1), 
	opacity(1), 
	reflectivity(0), 
	refracti(0), 
	bump_scaling(1),
	diffuse(0.6),
	ambient(0),
	specular(1.),
	emissive(0.),
	transparent(0.),
	reflective(0.)
	{}


Scene::Node :: Node() : mImpl(0) {}
Scene::Node :: ~Node() { if (mImpl) delete mImpl; }

std::string Scene::Node :: name() const {
	return std::string(mImpl->node->mName.data);
}

void Scene::verbose(bool b) {
	aiEnableVerboseLogging(b);
}


Scene * Scene :: import(const std::string& path, ImportPreset preset) {
	initLogStream();
	int flags;
	switch (preset) {
		case FAST:
			flags = aiProcessPreset_TargetRealtime_Fast;<commit_msg>fix annoying compiler warning<commit_after>#include "allocore/graphics/al_Asset.hpp"


#include "allocore/graphics/al_Graphics.hpp"

#define USE_ASSIMP3 1

#ifdef USE_ASSIMP3

#include "assimp/Importer.hpp"
#include "assimp/scene.h"
#include "assimp/postprocess.h"
#include "assimp/cimport.h"
#include "assimp/types.h"
#include "assimp/matrix4x4.h"

#else

#include "assimp/assimp.h"
#include "assimp/aiTypes.h"
#include "assimp/aiPostProcess.h"
#include "assimp/aiScene.h"
#include "assimp/aiMaterial.h"

#endif

/*
#include "assimp/types.h"
#include "assimp/postprocess.h"
#include "assimp/scene.h"
#include "assimp/material.h"
*/

#include <stdio.h>
#include <map>

using namespace al;

Vec4f vec4FromAIColor4D(aiColor4D& v) {
	return Vec4f(v.r, v.g, v.b, v.a);
}

Vec3f vec3FromAIVector3D(aiVector3D& v) {
	return Vec3f(v.x, v.y, v.z);
}

Vec2f vec2FromAIVector3D(aiVector3D& v) {
	return Vec2f(v.x, v.y);
}


void initLogStream() {
	static bool initializedLog = false;
	static struct aiLogStream logStream;
	if (!initializedLog) {
		initializedLog = true;
		// get a handle to the predefined STDOUT log stream and attach
		// it to the logging system. It will be active for all further
		// calls to aiImportFile(Ex) and aiApplyPostProcessing.
		logStream = aiGetPredefinedLogStream(aiDefaultLogStream_STDOUT,NULL);
		aiAttachLogStream(&logStream);
	}
}

int countNodes(const aiNode * n) {
	int count = 1;
	for (unsigned int i=0; i<n->mNumChildren; i++) {
		count += countNodes(n->mChildren[i]);
	}
	return count;
}






class Scene::Node::Impl {
public:
	Impl(const aiNode * node) : node(node) {}
	
	const aiNode * node;
};


class Scene::Impl /*: public SceneNode::Impl*/ {
public:
	Impl(const aiScene * scene) : /* SceneNode::Impl(scene->mRootNode),*/ scene(scene) {
		nodes.resize(countNodes(scene->mRootNode));
		addNode(scene->mRootNode, 0);
	}
	
	~Impl() {
		aiReleaseImport(scene);
	}
	
	int addNode(const aiNode * n, int idx) {
		nodes[idx].mImpl = new Scene::Node::Impl(n);
		nodeMap[n] = idx;
		for (unsigned int i=0; i<n->mNumChildren; i++) {
			idx = addNode(n->mChildren[i], idx+1);
		}
		return idx;
	}
	
	const aiScene * scene;
	
	std::map<const aiNode *, int> nodeMap;
	std::vector<Node> nodes;
};


Scene::Material :: Material() 
:	shading_model(0), 
	two_sided(0), 
	wireframe(0), 
	blend_func(0), 
	shininess(0.25), 
	shininess_strength(1), 
	opacity(1), 
	reflectivity(0), 
	refracti(0), 
	bump_scaling(1),
	diffuse(0.6),
	ambient(0),
	specular(1.),
	emissive(0.),
	transparent(0.),
	reflective(0.)
	{}


Scene::Node :: Node() : mImpl(0) {}
Scene::Node :: ~Node() { if (mImpl) delete mImpl; }

std::string Scene::Node :: name() const {
	return std::string(mImpl->node->mName.data);
}

void Scene::verbose(bool b) {
	aiEnableVerboseLogging(b);
}


Scene * Scene :: import(const std::string& path, ImportPreset preset) {
	initLogStream();
	int flags=0;
	switch (preset) {
		case FAST:
			flags = aiProcessPreset_TargetRealtime_Fast;
{'fraction_non_alphanumeric': 0.15993894165535957, 'fraction_numerical': 0.015434192672998642, 'mean_word_length': 4.637667304015296, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3084256', 'n_tokens_mistral': 2440, 'n_tokens_neox': 2310, 'n_words': 482}