2 Commits

Author SHA1 Message Date
7efa9c31f4 Remove unneeded libs+add obj.obj test model 2022-01-22 07:33:42 +04:00
02fd276728 Support apple silicon 2022-01-22 07:31:02 +04:00
9 changed files with 62 additions and 26 deletions

5
.gitignore vendored
View File

@ -11,8 +11,11 @@
# Output of the go coverage tool, specifically when used with LiteIDE
*.out
# Dependency directories (remove the comment below to include it)
# Custom
vendor/
.DS_Store
*.obj
!obj.obj
*.fbx
*.glb
!libassimp_darwin_arm64.dylib

View File

@ -1,12 +1,13 @@
package asig
/*
//Note: We don't link directly to libIrrXML and libzlib libraries in `./libs`, but they are required by assimp. Removing them will error on compilation.
#cgo CFLAGS: -I .
#cgo LDFLAGS: -L ./libs -l assimp_windows_amd64
#cgo LDFLAGS: -L libs
#cgo windows,amd64 LDFLAGS: -l assimp_windows_amd64
#cgo darwin,arm64 LDFLAGS: -l assimp_darwin_arm64
#include <wrap.cxx>
#include <stdlib.h> //Needed for C.free
#include "wrap.c"
#include <stdlib.h>
*/
import "C"
import (

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -2,26 +2,12 @@ package asig
/*
#cgo CFLAGS: -I .
#cgo LDFLAGS: -L ./libs -l assimp_windows_amd64 -l IrrXML_windows_amd64 -l zlib_windows_amd64
#cgo LDFLAGS: -L libs
#cgo windows,amd64 LDFLAGS: -l assimp_windows_amd64
#cgo darwin,arm64 LDFLAGS: -l assimp_darwin_arm64
#include <stdlib.h> //Needed for C.free
#include <assimp/scene.h>
//Functions
unsigned int aiGetMaterialTextureCount(const struct aiMaterial* pMat, enum aiTextureType type);
enum aiReturn aiGetMaterialTexture(
const struct aiMaterial* mat,
enum aiTextureType type,
unsigned int index,
struct aiString* path,
enum aiTextureMapping* mapping,
unsigned int* uvindex,
ai_real* blend,
enum aiTextureOp* op,
enum aiTextureMapMode* mapmode,
unsigned int* flags);
#include "wrap.c"
#include <stdlib.h>
*/
import "C"
import (

View File

@ -10,7 +10,7 @@ import (
func main() {
scene, release, err := asig.ImportFile("obj.fbx", asig.PostProcessTriangulate|asig.PostProcessJoinIdenticalVertices)
scene, release, err := asig.ImportFile("obj.obj", asig.PostProcessTriangulate|asig.PostProcessJoinIdenticalVertices)
if err != nil {
panic(err)
}

46
obj.obj Executable file
View File

@ -0,0 +1,46 @@
# Blender v2.92.0 OBJ File: ''
# www.blender.org
mtllib obj.mtl
o Cube
v 2.275618 1.000000 0.349413
v 3.520138 -1.000000 0.102233
v 2.275618 1.000000 0.752820
v 3.520138 -1.000000 1.000000
v 0.244520 1.000000 0.349413
v -1.000000 -1.000000 0.102233
v 0.244520 1.000000 0.752820
v -1.000000 -1.000000 1.000000
vt 0.806168 0.568832
vt 0.693832 0.681168
vt 0.693832 0.568832
vt 0.375000 1.000000
vt 0.375000 0.750000
vt 0.375000 0.000000
vt 0.625000 0.250000
vt 0.375000 0.250000
vt 0.375000 0.500000
vt 0.125000 0.750000
vt 0.125000 0.500000
vt 0.806168 0.681168
vt 0.625000 0.931168
vt 0.625000 0.068832
vn 0.0000 1.0000 0.0000
vn 0.0000 0.1227 0.9924
vn -0.8490 0.5283 0.0000
vn 0.0000 -1.0000 0.0000
vn 0.8490 0.5283 0.0000
vn 0.0000 0.1227 -0.9924
usemtl Material
s off
f 5/1/1 3/2/1 1/3/1
f 3/2/2 8/4/2 4/5/2
f 8/6/3 5/7/3 6/8/3
f 2/9/4 8/10/4 6/11/4
f 1/3/5 4/5/5 2/9/5
f 5/7/6 2/9/6 6/8/6
f 5/1/1 7/12/1 3/2/1
f 3/2/2 7/13/2 8/4/2
f 8/6/3 7/14/3 5/7/3
f 2/9/4 4/5/4 8/10/4
f 1/3/5 3/2/5 4/5/5
f 5/7/6 1/3/6 2/9/6