id); $obj->registerId = $id; if($obj->material == null) { if( !array_key_exists('__default',$this->materials ) ) { $this->materials['__default'] = new materials\Matte(); } $obj->material = '__default'; } $this->objects[$id] = $obj; } /** * @param object $material 接收一个材质类对象,为其颁发一个注册信息,并将其存到Scene */ public function registerMaterial(&$material) { $id = $material->type.'_'.sprintf("%014d",$material->id); $material->registerId = $id; $this->materials[$id] = $material; } /** * @param object $texture 接收一个纹理类对象,为其颁发一个注册信息,并将其存到Scene */ public function registerTexture(&$texture) { $id = $texture->type.'_'.sprintf("%014d",$texture->id); $texture->registerId = $id; $this->textures[$id] = $texture; } /** * @param object $volume 接收一个体积类对象,为其颁发一个注册信息,并将其存到Scene */ public function registerVolume(&$volume) { $id = $volume->type.'_'.sprintf("%014d",$volume->id); $volume->registerId = $id; $this->volumes[$id] = $volume; } /** * @param object $light 接收一个灯光类对象,为其颁发一个注册信息,并将其存到Scene */ public function registerLight(&$light) { $id = $light->type.'_'.sprintf("%014d",$light->id); $light->registerId = $id; $this->lights[$id] = $light; } /** * @param object $camera 接收一个相机类对象,为其颁发一个注册信息,并将其存到Scene */ public function registerCamera(&$camera) { $this->cameras = []; foreach( get_object_vars($camera) as $key => $value ) { if($value != null) { $key = implode(".", array_map('strtolower', StringHelper::camelStrToArray($key))); $this->cameras[$key] = $value; } } } /** * @param object $camera 接收一个World类对象,为其颁发一个注册信息,并将其存到Scene */ public function registerWorld(&$world) { foreach( get_object_vars($world) as $key => $value ) { if($value != null) { $key = implode(".", array_map('strtolower', StringHelper::camelStrToArray($key))); $this->world[$key] = $value; } } } } ?>