Browse Source

删除了多余废弃的异常类文件同,材质、贴图类、模型父类文件增加get,

master
yuanjiajia 3 years ago
parent
commit
f4c416d81a
  1. 4
      examples/print.php
  2. 10
      src/core/RenderException .php
  3. 7
      src/core/SceneException.php
  4. 51
      src/scene/materials/Disney.php
  5. 5
      src/scene/materials/MaterialsBase.php
  6. 14
      src/scene/materials/Metal.php
  7. 9
      src/scene/materials/Mix.php
  8. 8
      src/scene/objects/Objects.php
  9. 6
      src/scene/texture/TextureBase.php
  10. 5
      src/scene/volumes/VolumesBase.php

4
examples/print.php

@ -90,13 +90,13 @@ $obj = new objects\Objects( null,[ 'ply' => 'mesh-10086.ply','appliedtransformat
$cloudsMap = new texture\map\Clouds(); //创建一个 Clouds类的贴图对象 $cloudsMap = new texture\map\Clouds(); //创建一个 Clouds类的贴图对象
//$scene->registerTexture($cloudsMap); //将这个对象注册到 Scene
$scene->registerTexture($cloudsMap); //将这个对象注册到 Scene
$imageMap = new texture\map\ImageMap(); //创建一个 ImageMap类的贴图对象 $imageMap = new texture\map\ImageMap(); //创建一个 ImageMap类的贴图对象
$scene->registerTexture($imageMap); //将这个对象注册到 Scene $scene->registerTexture($imageMap); //将这个对象注册到 Scene
$blend = new texture\map\Blend(); //创建一个 Blend类的贴图对象 $blend = new texture\map\Blend(); //创建一个 Blend类的贴图对象
$scene->registerTexture($blend); //将这个对象注册到 Scene
//$scene->registerTexture($blend); //将这个对象注册到 Scene
$disney = new materials\Disney(); //创建一个 Disney 材质对象 $disney = new materials\Disney(); //创建一个 Disney 材质对象

10
src/core/RenderException .php

@ -1,10 +0,0 @@
<?php
namespace Blobt\Luxcore\core;
class RenderException extends \Exception
{
}
?>

7
src/core/SceneException.php

@ -1,7 +0,0 @@
<?php
namespace Blobt\Luxcore\core;
class SceneException extends \Exception{}
?>

51
src/scene/materials/Disney.php

@ -113,8 +113,7 @@ class Disney extends MaterialsBase
if( $color->cards != null ) $this->basecolor = $color->cards; if( $color->cards != null ) $this->basecolor = $color->cards;
else else
{ {
$className = array_reverse(explode('\\', get_class($color)))[0];
throw new core\SceneException("You use an unregistered {$className} object for the current property");
throw new \Exception("You use an unregistered ".$color->getClassName()." object for the current property");
} }
} }
else $this->basecolor = $color; else $this->basecolor = $color;
@ -127,8 +126,7 @@ class Disney extends MaterialsBase
if( $color->cards != null ) $this->subsurface = $color->cards; if( $color->cards != null ) $this->subsurface = $color->cards;
else else
{ {
$className = array_reverse(explode('\\', get_class($color)))[0];
throw new core\SceneException("You use an unregistered {$className} object for the current property");
throw new \Exception("You use an unregistered ".$color->getClassName()." object for the current property");
} }
} }
else $this->subsurface = $color; else $this->subsurface = $color;
@ -141,8 +139,7 @@ class Disney extends MaterialsBase
if( $color->cards != null ) $this->metallic = $color->cards; if( $color->cards != null ) $this->metallic = $color->cards;
else else
{ {
$className = array_reverse(explode('\\', get_class($color)))[0];
throw new core\SceneException("You use an unregistered {$className} object for the current property");
throw new \Exception("You use an unregistered ".$color->getClassName()." object for the current property");
} }
} }
else $this->metallic = $color; else $this->metallic = $color;
@ -155,8 +152,7 @@ class Disney extends MaterialsBase
if( $color->cards != null ) $this->specular = $color->cards; if( $color->cards != null ) $this->specular = $color->cards;
else else
{ {
$className = array_reverse(explode('\\', get_class($color)))[0];
throw new core\SceneException("You use an unregistered {$className} object for the current property");
throw new \Exception("You use an unregistered ".$color->getClassName()." object for the current property");
} }
} }
else $this->specular = $color; else $this->specular = $color;
@ -169,8 +165,7 @@ class Disney extends MaterialsBase
if( $color->cards != null ) $this->speculartint = $color->cards; if( $color->cards != null ) $this->speculartint = $color->cards;
else else
{ {
$className = array_reverse(explode('\\', get_class($color)))[0];
throw new core\SceneException("You use an unregistered {$className} object for the current property");
throw new \Exception("You use an unregistered ".$color->getClassName()." object for the current property");
} }
} }
else $this->speculartint = $color; else $this->speculartint = $color;
@ -183,8 +178,7 @@ class Disney extends MaterialsBase
if( $color->cards != null ) $this->roughness = $color->cards; if( $color->cards != null ) $this->roughness = $color->cards;
else else
{ {
$className = array_reverse(explode('\\', get_class($color)))[0];
throw new core\SceneException("You use an unregistered {$className} object for the current property");
throw new \Exception("You use an unregistered ".$color->getClassName()." object for the current property");
} }
} }
else $this->roughness = $color; else $this->roughness = $color;
@ -197,8 +191,7 @@ class Disney extends MaterialsBase
if( $color->cards != null ) $this->anisotropic = $color->cards; if( $color->cards != null ) $this->anisotropic = $color->cards;
else else
{ {
$className = array_reverse(explode('\\', get_class($color)))[0];
throw new core\SceneException("You use an unregistered {$className} object for the current property");
throw new \Exception("You use an unregistered ".$color->getClassName()." object for the current property");
} }
} }
else $this->anisotropic = $color; else $this->anisotropic = $color;
@ -211,8 +204,7 @@ class Disney extends MaterialsBase
if( $color->cards != null ) $this->sheen = $color->cards; if( $color->cards != null ) $this->sheen = $color->cards;
else else
{ {
$className = array_reverse(explode('\\', get_class($color)))[0];
throw new core\SceneException("You use an unregistered {$className} object for the current property");
throw new \Exception("You use an unregistered ".$color->getClassName()." object for the current property");
} }
} }
else $this->sheen = $color; else $this->sheen = $color;
@ -225,8 +217,7 @@ class Disney extends MaterialsBase
if( $color->cards != null ) $this->sheentint = $color->cards; if( $color->cards != null ) $this->sheentint = $color->cards;
else else
{ {
$className = array_reverse(explode('\\', get_class($color)))[0];
throw new core\SceneException("You use an unregistered {$className} object for the current property");
throw new \Exception("You use an unregistered ".$color->getClassName()." object for the current property");
} }
} }
else $this->sheentint = $color; else $this->sheentint = $color;
@ -239,8 +230,7 @@ class Disney extends MaterialsBase
if( $color->cards != null ) $this->clearcoat = $color->cards; if( $color->cards != null ) $this->clearcoat = $color->cards;
else else
{ {
$className = array_reverse(explode('\\', get_class($color)))[0];
throw new core\SceneException("You use an unregistered {$className} object for the current property");
throw new \Exception("You use an unregistered ".$color->getClassName()." object for the current property");
} }
} }
else $this->clearcoat = $color; else $this->clearcoat = $color;
@ -253,8 +243,7 @@ class Disney extends MaterialsBase
if( $color->cards != null ) $this->clearcoatgloss = $color->cards; if( $color->cards != null ) $this->clearcoatgloss = $color->cards;
else else
{ {
$className = array_reverse(explode('\\', get_class($color)))[0];
throw new core\SceneException("You use an unregistered {$className} object for the current property");
throw new \Exception("You use an unregistered ".$color->getClassName()." object for the current property");
} }
} }
else $this->clearcoatgloss = $color; else $this->clearcoatgloss = $color;
@ -267,8 +256,7 @@ class Disney extends MaterialsBase
if( $color->cards != null ) $this->transparencyFront = $color->cards; if( $color->cards != null ) $this->transparencyFront = $color->cards;
else else
{ {
$className = array_reverse(explode('\\', get_class($color)))[0];
throw new core\SceneException("You use an unregistered {$className} object for the current property");
throw new \Exception("You use an unregistered ".$color->getClassName()." object for the current property");
} }
} }
else $this->transparencyFront = $color; else $this->transparencyFront = $color;
@ -281,8 +269,7 @@ class Disney extends MaterialsBase
if( $color->cards != null ) $this->transparencyBack = $color->cards; if( $color->cards != null ) $this->transparencyBack = $color->cards;
else else
{ {
$className = array_reverse(explode('\\', get_class($color)))[0];
throw new core\SceneException("You use an unregistered {$className} object for the current property");
throw new \Exception("You use an unregistered ".$color->getClassName()." object for the current property");
} }
} }
else $this->transparencyBack = $color; else $this->transparencyBack = $color;
@ -295,8 +282,7 @@ class Disney extends MaterialsBase
if( $color->cards != null ) $this->filmamount = $color->cards; if( $color->cards != null ) $this->filmamount = $color->cards;
else else
{ {
$className = array_reverse(explode('\\', get_class($color)))[0];
throw new core\SceneException("You use an unregistered {$className} object for the current property");
throw new \Exception("You use an unregistered ".$color->getClassName()." object for the current property");
} }
} }
else $this->filmamount = $color; else $this->filmamount = $color;
@ -308,8 +294,7 @@ class Disney extends MaterialsBase
if( $color->cards != null ) $this->filmthickness = $color->cards; if( $color->cards != null ) $this->filmthickness = $color->cards;
else else
{ {
$className = array_reverse(explode('\\', get_class($color)))[0];
throw new core\SceneException("You use an unregistered {$className} object for the current property");
throw new \Exception("You use an unregistered ".$color->getClassName()." object for the current property");
} }
} }
else $this->filmthickness = $color; else $this->filmthickness = $color;
@ -322,8 +307,7 @@ class Disney extends MaterialsBase
if( $color->cards != null ) $this->filmior = $color->cards; if( $color->cards != null ) $this->filmior = $color->cards;
else else
{ {
$className = array_reverse(explode('\\', get_class($color)))[0];
throw new core\SceneException("You use an unregistered {$className} object for the current property");
throw new \Exception("You use an unregistered ".$color->getClassName()." object for the current property");
} }
} }
else $this->filmior = $color; else $this->filmior = $color;
@ -336,8 +320,7 @@ class Disney extends MaterialsBase
if( $color->cards != null ) $this->bumptex = $color->cards; if( $color->cards != null ) $this->bumptex = $color->cards;
else else
{ {
$className = array_reverse(explode('\\', get_class($color)))[0];
throw new core\SceneException("You use an unregistered {$className} object for the current property");
throw new \Exception("You use an unregistered ".$color->getClassName()." object for the current property");
} }
} }
else $this->bumptex = $color; else $this->bumptex = $color;

5
src/scene/materials/MaterialsBase.php

@ -101,6 +101,11 @@ class MaterialsBase extends BaseCfg
$this->volumeExterior = $color; $this->volumeExterior = $color;
} }
public function getClassName()
{
return array_reverse(explode('\\', get_class($this)))[0];
}
} }
?> ?>

14
src/scene/materials/Metal.php

@ -60,7 +60,7 @@ class Metal extends MaterialsBase
else else
{ {
$className = array_reverse(explode('\\', get_class($color)))[0]; $className = array_reverse(explode('\\', get_class($color)))[0];
throw new core\SceneException("You use an unregistered {$className} object for the current property");
throw new \Exception("You use an unregistered {$className} object for the current property");
} }
} }
else $this->kr = $color; else $this->kr = $color;
@ -75,7 +75,7 @@ class Metal extends MaterialsBase
else else
{ {
$className = array_reverse(explode('\\', get_class($color)))[0]; $className = array_reverse(explode('\\', get_class($color)))[0];
throw new core\SceneException("You use an unregistered {$className} object for the current property");
throw new \Exception("You use an unregistered {$className} object for the current property");
} }
} }
else $this->fresnel = $color; else $this->fresnel = $color;
@ -90,7 +90,7 @@ class Metal extends MaterialsBase
else else
{ {
$className = array_reverse(explode('\\', get_class($color)))[0]; $className = array_reverse(explode('\\', get_class($color)))[0];
throw new core\SceneException("You use an unregistered {$className} object for the current property");
throw new \Exception("You use an unregistered {$className} object for the current property");
} }
} }
else $this->uroughness = $color; else $this->uroughness = $color;
@ -104,7 +104,7 @@ class Metal extends MaterialsBase
else else
{ {
$className = array_reverse(explode('\\', get_class($color)))[0]; $className = array_reverse(explode('\\', get_class($color)))[0];
throw new core\SceneException("You use an unregistered {$className} object for the current property");
throw new \Exception("You use an unregistered {$className} object for the current property");
} }
} }
else $this->vroughness = $color; else $this->vroughness = $color;
@ -118,7 +118,7 @@ class Metal extends MaterialsBase
else else
{ {
$className = array_reverse(explode('\\', get_class($color)))[0]; $className = array_reverse(explode('\\', get_class($color)))[0];
throw new core\SceneException("You use an unregistered {$className} object for the current property");
throw new \Exception("You use an unregistered {$className} object for the current property");
} }
} }
else $this->transparencyFront = $color; else $this->transparencyFront = $color;
@ -132,7 +132,7 @@ class Metal extends MaterialsBase
else else
{ {
$className = array_reverse(explode('\\', get_class($color)))[0]; $className = array_reverse(explode('\\', get_class($color)))[0];
throw new core\SceneException("You use an unregistered {$className} object for the current property");
throw new \Exception("You use an unregistered {$className} object for the current property");
} }
} }
else $this->transparencyBack = $color; else $this->transparencyBack = $color;
@ -146,7 +146,7 @@ class Metal extends MaterialsBase
else else
{ {
$className = array_reverse(explode('\\', get_class($color)))[0]; $className = array_reverse(explode('\\', get_class($color)))[0];
throw new core\SceneException("You use an unregistered {$className} object for the current property");
throw new \Exception("You use an unregistered {$className} object for the current property");
} }
} }
else $this->bumptex = $color; else $this->bumptex = $color;

9
src/scene/materials/Mix.php

@ -42,8 +42,7 @@ class Mix extends MaterialsBase
if( $Material->cards != null ) $this->material1 = $Material->cards; if( $Material->cards != null ) $this->material1 = $Material->cards;
else else
{ {
$className = array_reverse(explode('\\', get_class($Material)))[0];
throw new core\SceneException("You use an unregistered {$className} object for the current property");
throw new \Exception("You use an unregistered ".$Material->getClassName()." object for the current property");
} }
} }
else $this->material1 = $Material; else $this->material1 = $Material;
@ -56,8 +55,7 @@ class Mix extends MaterialsBase
if( $Material->cards != null ) $this->material2 = $Material->cards; if( $Material->cards != null ) $this->material2 = $Material->cards;
else else
{ {
$className = array_reverse(explode('\\', get_class($Material)))[0];
throw new core\SceneException("You use an unregistered {$className} object for the current property");
throw new \Exception("You use an unregistered ".$Material->getClassName()." object for the current property");
} }
} }
else $this->material2 = $Material; else $this->material2 = $Material;
@ -70,8 +68,7 @@ class Mix extends MaterialsBase
if( $color->cards != null ) $this->amount = $color->cards; if( $color->cards != null ) $this->amount = $color->cards;
else else
{ {
$className = array_reverse(explode('\\', get_class($color)))[0];
throw new core\SceneException("You use an unregistered {$className} object for the current property");
throw new \Exception("You use an unregistered ".$color->getClassName()." object for the current property");
} }
} }
else $this->amount = $color; else $this->amount = $color;

8
src/scene/objects/Objects.php

@ -51,13 +51,17 @@ class Objects extends BaseCfg
if( $material->cards != null ) $this->material = $material->cards; if( $material->cards != null ) $this->material = $material->cards;
else else
{ {
$className = array_reverse(explode('\\', get_class($material)))[0];
throw new core\SceneException("You use an unregistered {$className} object for the current property");
throw new \Exception("You use an unregistered ".$material->getClassName()." object for the current property");
} }
} }
else $this->material = $material; else $this->material = $material;
} }
public function getClassName()
{
return array_reverse(explode('\\', get_class($this)))[0];
}
} }
?> ?>

6
src/scene/texture/TextureBase.php

@ -21,6 +21,12 @@ class TextureBase extends BaseCfg
* @var string 储存个由Scene类颁发的注册信息 * @var string 储存个由Scene类颁发的注册信息
*/ */
public $cards; public $cards;
public function getClassName()
{
return array_reverse(explode('\\', get_class($this)))[0];
}
} }
?> ?>

5
src/scene/volumes/VolumesBase.php

@ -15,6 +15,11 @@ class VolumesBase extends BaseCfg
Base::__construct($config); Base::__construct($config);
} }
public function getClassName()
{
return array_reverse(explode('\\', get_class($this)))[0];
}
} }
?> ?>
Loading…
Cancel
Save