コード例 #1
0
ファイル: AnimationManager.go プロジェクト: Triangle345/GT
// OBJAnimation takes the folder to OBJ files and creates animation from
// them
func OBJAnimation(loc string) *FrameAnimation {
	//TODO need to cache all models
	files, err := ioutil.ReadDir(loc)
	if err != nil {
		Logging.Info(err)
		return nil
	}

	fa := newFrameAnimation()

	for _, file := range files {
		// Logging.Info("Parsing anim OBJ: ", file.Name())
		splitExt := strings.Split(file.Name(), ".")
		if splitExt[1] == "obj" {
			obj := loc + string(os.PathSeparator) + splitExt[0] + ".obj"
			mtl := loc + string(os.PathSeparator) + splitExt[0] + ".mtl"
			mesh, err := G3D.ParseOBJ(obj, mtl)

			if err != nil {
				Logging.Info(err)
				continue
			}

			fa.animationImages = append(fa.animationImages, mesh)

		}

	}

	return fa
}
コード例 #2
0
ファイル: ModelRenderer.go プロジェクト: Triangle345/GT
func (this *modelRenderer) SetModel(path string, mat string) {
	//TODO make aggregate models store them in memory
	mesh, err := G3D.ParseOBJ(path, mat)

	if err != nil {
		Logging.Info(err)
	}

	this.mesh = mesh

	// this.vertexData = vertexData

}