Browse Source

scene类文件修改了注册相机的函数,Camera、MaterialsBase类纠正单词拼写错误,printScene增加注册一个透视相机,其他类有修改部分注释错误

master
yuanjiajia 3 years ago
parent
commit
a8b6e3eba8
  1. 6
      examples/printScene.php
  2. 14
      src/scene/Scene.php
  3. 2
      src/scene/camera/Perspective.php
  4. 2
      src/scene/materials/MaterialsBase.php
  5. 2
      src/scene/world/WorldDefault.php

6
examples/printScene.php

@ -71,12 +71,16 @@ $obj->setMaterial($colorGlass); //将玻璃材质赋值到模型的材质属
$scene->registerObjects($obj); //将模型添加到场景中
//添加一个世界对象
$default = new world\WorldDefault();
$default->setDefaultVolume($ClearVol);
$scene->registerWorld($default);
//添加一个相机
$camera = new camera\Perspective();
$scene->registerCamera($camera);
echo $scene;

14
src/scene/Scene.php

@ -116,13 +116,19 @@ class Scene extends BaseCfg
*/
public function registerCamera(&$camera)
{
$id = $camera->type.'_'.sprintf("%014d",$camera->id);
$camera->registerId = $id;
$this->cameras[$id] = $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 接收一个相机类对象,为其颁发一个注册信息,并将其存到Scene
* @param object $camera 接收一个World类对象,为其颁发一个注册信息,并将其存到Scene
*/
public function registerWorld(&$world)
{

2
src/scene/camera/Perspective.php

@ -3,7 +3,7 @@
namespace Blobt\Luxcore\scene\camera;
use Blobt\Luxcore\core\Base;
class Perspective extends Camerabase
class Perspective extends CameraBase
{
/**

2
src/scene/materials/MaterialsBase.php

@ -2,7 +2,7 @@
namespace Blobt\Luxcore\scene\materials;
use Blobt\Luxcore\scene\BaseCfg;
use Blobt\Luxcore\scene\ligths\Visibility;
use Blobt\Luxcore\scene\lights\Visibility;
use Blobt\Luxcore\scene\lights\Emission;

2
src/scene/world/WorldDefault.php

@ -6,7 +6,7 @@ class WorldDefault
{
/**
* @var object 一个体积对象
* @var object 一个体积对象(体积效果数组的某个键名)
*/
public $volumeDefault;

Loading…
Cancel
Save