|
|
@ -32,11 +32,11 @@ class LoardObj |
|
|
|
* @param string $objFile 传入obj文件 |
|
|
|
* @param bool $flipYZ 是否翻转Z轴Y轴 |
|
|
|
*/ |
|
|
|
public function __construct( string $objFile, bool $flipYZ = self::CLOSE ) |
|
|
|
public function __construct( string $objFile ) |
|
|
|
{ |
|
|
|
$this->objFile = $objFile; |
|
|
|
$this->readObj(); |
|
|
|
if( $flipYZ ) $this->flipYZ(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
@ -45,11 +45,24 @@ class LoardObj |
|
|
|
*/ |
|
|
|
public function toPly( string $path = null,string $format = self::TYPE_BINARY) |
|
|
|
{ |
|
|
|
$this->flipYZ(); |
|
|
|
$this->createPly(); |
|
|
|
if( $path == null) $path = getcwd()."/ply"; |
|
|
|
return $this->writePly( $path, $format ); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @param string $path ply模型 保存路径 |
|
|
|
* @param string $format ply模型 保存格式 |
|
|
|
*/ |
|
|
|
public function toGltf( string $path = null,string $format = self::TYPE_BINARY) |
|
|
|
{ |
|
|
|
// $this->createGltf();
|
|
|
|
// if( $path == null) $path = getcwd()."/gltf";
|
|
|
|
// return $this->writeGltf( $path, $format );
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -131,7 +144,7 @@ class LoardObj |
|
|
|
{ |
|
|
|
$this->objData['v'][$key] = []; |
|
|
|
$this->objData['v'][$key][] = $value[0]; |
|
|
|
$this->objData['v'][$key][] = $value[2]; |
|
|
|
$this->objData['v'][$key][] = -1 * ($value[2]); |
|
|
|
$this->objData['v'][$key][] = $value[1]; |
|
|
|
} |
|
|
|
|
|
|
|