Browse Source

新增了关于贴图、相机、灯光、体积材质的类文件,“scene.php”添加addobject()函数,解决模型、材质、贴图自对应问题

master
yuanjiajia 3 years ago
parent
commit
d722200a92
  1. 13
      src/scene/Scene.php

13
src/scene/Scene.php

@ -2,6 +2,7 @@
namespace Blobt\Luxcore\scene; namespace Blobt\Luxcore\scene;
use function PHPSTORM_META\type;
class Scene extends BaseCfg class Scene extends BaseCfg
{ {
@ -44,32 +45,32 @@ class Scene extends BaseCfg
if( $object instanceof objects\Objects ) if( $object instanceof objects\Objects )
{ {
$temp = 'obj_'.sprintf("%014d",count($this->objects)+1);
$temp = sprintf("%014d",count($this->objects)+1);
$this->objects[$temp] = $object; $this->objects[$temp] = $object;
} }
else if( $object instanceof materials\MaterialsBase ) else if( $object instanceof materials\MaterialsBase )
{ {
$temp = 'material_'.sprintf("%014d",count($this->materials)+1);
$temp = $object->type.'_'.sprintf("%014d",count($this->materials)+1);
$this->materials[$temp] = $object; $this->materials[$temp] = $object;
} }
else if($object instanceof ligth\LightBase) else if($object instanceof ligth\LightBase)
{ {
$temp = 'light_'.sprintf("%014d",count($this->lights)+1);
$temp = $object->type.'_'.sprintf("%014d",count($this->lights)+1);
$this->lights[$temp] = $object; $this->lights[$temp] = $object;
} }
else if($object instanceof camera\Camera) else if($object instanceof camera\Camera)
{ {
$temp = 'camera_'.sprintf("%014d",count($this->camera)+1);
$temp = $object->type.'_'.sprintf("%014d",count($this->camera)+1);
$this->camera[$temp] = $object; $this->camera[$temp] = $object;
} }
else if($object instanceof texture\TextureBase) else if($object instanceof texture\TextureBase)
{ {
$temp = 'texture_'.sprintf("%014d",count($this->textures)+1);
$temp = $object->type.'_'.sprintf("%014d",count($this->textures)+1);
$this->textures[$temp] = $object; $this->textures[$temp] = $object;
} }
else if( $object instanceof volumes\VolumesBase ) else if( $object instanceof volumes\VolumesBase )
{ {
$temp = 'volume_'.sprintf("%014d",count($this->volumes)+1);
$temp = $object->type.'_'.sprintf("%014d",count($this->volumes)+1);
$this->volumes[$temp] = $object; $this->volumes[$temp] = $object;
} }
else; else;

Loading…
Cancel
Save