Browse Source

材质、模模型类修了set函数;SceneException类,删除了__toString函数重载

master
yuanjiajia 3 years ago
parent
commit
232e3e6d35
  1. 6
      examples/print.php
  2. 21
      src/core/AutuHandle.php
  3. 26
      src/core/SceneException.php
  4. 102
      src/scene/materials/Disney.php
  5. 42
      src/scene/materials/Metal.php
  6. 18
      src/scene/materials/Mix.php
  7. 6
      src/scene/objects/Objects.php

6
examples/print.php

@ -5,7 +5,9 @@
namespace Blobt\Luxcore\scene;
include dirname(dirname(__FILE__)) . "/vendor/autoload.php";
include dirname(dirname(__FILE__)) . "/src/core/AutuHandle.php";
@ -88,7 +90,7 @@ $obj = new objects\Objects( null,[ 'ply' => 'mesh-10086.ply','appliedtransformat
$cloudsMap = new texture\map\Clouds(); //创建一个 Clouds类的贴图对象
$scene->registerTexture($cloudsMap); //将这个对象注册到 Scene
//$scene->registerTexture($cloudsMap); //将这个对象注册到 Scene
$imageMap = new texture\map\ImageMap(); //创建一个 ImageMap类的贴图对象
$scene->registerTexture($imageMap); //将这个对象注册到 Scene

21
src/core/AutuHandle.php

@ -1,21 +0,0 @@
<?php
namespace Blobt\Luxcore\core;
class AutuHandle
{
public function init()
{
set_exception_handler([$this,'exception']);
}
public function exception($e)
{
die($e);
}
}
(new AutuHandle)->init();
?>

26
src/core/SceneException.php

@ -2,30 +2,6 @@
namespace Blobt\Luxcore\core;
class SceneException extends \Exception
{
function __toString()
{
switch($this->code)
{
case 1:
$this->message = '警告! 你在位置:'.explode("\n",$this->message)[0]."\n".
'为当前通道赋值是一个未注册的 '.explode("\n",$this->message)[1].'对象,程序已经提前终止!!!';
return $this->message;
break;
case 2;
return $this->message = "举例,后面修改!\n";
break;
default:
return $this->message = "未知的错误类型!举例,后面修改!\n";
}
}
}
class SceneException extends \Exception{}
?>

102
src/scene/materials/Disney.php

@ -113,10 +113,8 @@ class Disney extends MaterialsBase
if( $color->cards != null ) $this->basecolor = $color->cards;
else
{
$message = debug_backtrace();
$message = $message[0]['file'].':'.$message[0]['line']."\n";
$message .= array_reverse(explode('\\', get_class($color)))[0];
throw new core\SceneException($message,1);
$className = array_reverse(explode('\\', get_class($color)))[0];
throw new core\SceneException("You use an unregistered {$className} object for the current property");
}
}
else $this->basecolor = $color;
@ -129,10 +127,8 @@ class Disney extends MaterialsBase
if( $color->cards != null ) $this->subsurface = $color->cards;
else
{
$message = debug_backtrace();
$message = $message[0]['file'].':'.$message[0]['line']."\n";
$message .= array_reverse(explode('\\', get_class($color)))[0];
throw new core\SceneException($message,1);
$className = array_reverse(explode('\\', get_class($color)))[0];
throw new core\SceneException("You use an unregistered {$className} object for the current property");
}
}
else $this->subsurface = $color;
@ -145,10 +141,8 @@ class Disney extends MaterialsBase
if( $color->cards != null ) $this->metallic = $color->cards;
else
{
$message = debug_backtrace();
$message = $message[0]['file'].':'.$message[0]['line']."\n";
$message .= array_reverse(explode('\\', get_class($color)))[0];
throw new core\SceneException($message,1);
$className = array_reverse(explode('\\', get_class($color)))[0];
throw new core\SceneException("You use an unregistered {$className} object for the current property");
}
}
else $this->metallic = $color;
@ -161,10 +155,8 @@ class Disney extends MaterialsBase
if( $color->cards != null ) $this->specular = $color->cards;
else
{
$message = debug_backtrace();
$message = $message[0]['file'].':'.$message[0]['line']."\n";
$message .= array_reverse(explode('\\', get_class($color)))[0];
throw new core\SceneException($message,1);
$className = array_reverse(explode('\\', get_class($color)))[0];
throw new core\SceneException("You use an unregistered {$className} object for the current property");
}
}
else $this->specular = $color;
@ -177,10 +169,8 @@ class Disney extends MaterialsBase
if( $color->cards != null ) $this->speculartint = $color->cards;
else
{
$message = debug_backtrace();
$message = $message[0]['file'].':'.$message[0]['line']."\n";
$message .= array_reverse(explode('\\', get_class($color)))[0];
throw new core\SceneException($message,1);
$className = array_reverse(explode('\\', get_class($color)))[0];
throw new core\SceneException("You use an unregistered {$className} object for the current property");
}
}
else $this->speculartint = $color;
@ -193,10 +183,8 @@ class Disney extends MaterialsBase
if( $color->cards != null ) $this->roughness = $color->cards;
else
{
$message = debug_backtrace();
$message = $message[0]['file'].':'.$message[0]['line']."\n";
$message .= array_reverse(explode('\\', get_class($color)))[0];
throw new core\SceneException($message,1);
$className = array_reverse(explode('\\', get_class($color)))[0];
throw new core\SceneException("You use an unregistered {$className} object for the current property");
}
}
else $this->roughness = $color;
@ -209,10 +197,8 @@ class Disney extends MaterialsBase
if( $color->cards != null ) $this->anisotropic = $color->cards;
else
{
$message = debug_backtrace();
$message = $message[0]['file'].':'.$message[0]['line']."\n";
$message .= array_reverse(explode('\\', get_class($color)))[0];
throw new core\SceneException($message,1);
$className = array_reverse(explode('\\', get_class($color)))[0];
throw new core\SceneException("You use an unregistered {$className} object for the current property");
}
}
else $this->anisotropic = $color;
@ -225,10 +211,8 @@ class Disney extends MaterialsBase
if( $color->cards != null ) $this->sheen = $color->cards;
else
{
$message = debug_backtrace();
$message = $message[0]['file'].':'.$message[0]['line']."\n";
$message .= array_reverse(explode('\\', get_class($color)))[0];
throw new core\SceneException($message,1);
$className = array_reverse(explode('\\', get_class($color)))[0];
throw new core\SceneException("You use an unregistered {$className} object for the current property");
}
}
else $this->sheen = $color;
@ -241,10 +225,8 @@ class Disney extends MaterialsBase
if( $color->cards != null ) $this->sheentint = $color->cards;
else
{
$message = debug_backtrace();
$message = $message[0]['file'].':'.$message[0]['line']."\n";
$message .= array_reverse(explode('\\', get_class($color)))[0];
throw new core\SceneException($message,1);
$className = array_reverse(explode('\\', get_class($color)))[0];
throw new core\SceneException("You use an unregistered {$className} object for the current property");
}
}
else $this->sheentint = $color;
@ -257,10 +239,8 @@ class Disney extends MaterialsBase
if( $color->cards != null ) $this->clearcoat = $color->cards;
else
{
$message = debug_backtrace();
$message = $message[0]['file'].':'.$message[0]['line']."\n";
$message .= array_reverse(explode('\\', get_class($color)))[0];
throw new core\SceneException($message,1);
$className = array_reverse(explode('\\', get_class($color)))[0];
throw new core\SceneException("You use an unregistered {$className} object for the current property");
}
}
else $this->clearcoat = $color;
@ -273,10 +253,8 @@ class Disney extends MaterialsBase
if( $color->cards != null ) $this->clearcoatgloss = $color->cards;
else
{
$message = debug_backtrace();
$message = $message[0]['file'].':'.$message[0]['line']."\n";
$message .= array_reverse(explode('\\', get_class($color)))[0];
throw new core\SceneException($message,1);
$className = array_reverse(explode('\\', get_class($color)))[0];
throw new core\SceneException("You use an unregistered {$className} object for the current property");
}
}
else $this->clearcoatgloss = $color;
@ -289,10 +267,8 @@ class Disney extends MaterialsBase
if( $color->cards != null ) $this->transparencyFront = $color->cards;
else
{
$message = debug_backtrace();
$message = $message[0]['file'].':'.$message[0]['line']."\n";
$message .= array_reverse(explode('\\', get_class($color)))[0];
throw new core\SceneException($message,1);
$className = array_reverse(explode('\\', get_class($color)))[0];
throw new core\SceneException("You use an unregistered {$className} object for the current property");
}
}
else $this->transparencyFront = $color;
@ -305,10 +281,8 @@ class Disney extends MaterialsBase
if( $color->cards != null ) $this->transparencyBack = $color->cards;
else
{
$message = debug_backtrace();
$message = $message[0]['file'].':'.$message[0]['line']."\n";
$message .= array_reverse(explode('\\', get_class($color)))[0];
throw new core\SceneException($message,1);
$className = array_reverse(explode('\\', get_class($color)))[0];
throw new core\SceneException("You use an unregistered {$className} object for the current property");
}
}
else $this->transparencyBack = $color;
@ -321,10 +295,8 @@ class Disney extends MaterialsBase
if( $color->cards != null ) $this->filmamount = $color->cards;
else
{
$message = debug_backtrace();
$message = $message[0]['file'].':'.$message[0]['line']."\n";
$message .= array_reverse(explode('\\', get_class($color)))[0];
throw new core\SceneException($message,1);
$className = array_reverse(explode('\\', get_class($color)))[0];
throw new core\SceneException("You use an unregistered {$className} object for the current property");
}
}
else $this->filmamount = $color;
@ -336,10 +308,8 @@ class Disney extends MaterialsBase
if( $color->cards != null ) $this->filmthickness = $color->cards;
else
{
$message = debug_backtrace();
$message = $message[0]['file'].':'.$message[0]['line']."\n";
$message .= array_reverse(explode('\\', get_class($color)))[0];
throw new core\SceneException($message,1);
$className = array_reverse(explode('\\', get_class($color)))[0];
throw new core\SceneException("You use an unregistered {$className} object for the current property");
}
}
else $this->filmthickness = $color;
@ -352,10 +322,8 @@ class Disney extends MaterialsBase
if( $color->cards != null ) $this->filmior = $color->cards;
else
{
$message = debug_backtrace();
$message = $message[0]['file'].':'.$message[0]['line']."\n";
$message .= array_reverse(explode('\\', get_class($color)))[0];
throw new core\SceneException($message,1);
$className = array_reverse(explode('\\', get_class($color)))[0];
throw new core\SceneException("You use an unregistered {$className} object for the current property");
}
}
else $this->filmior = $color;
@ -368,10 +336,8 @@ class Disney extends MaterialsBase
if( $color->cards != null ) $this->bumptex = $color->cards;
else
{
$message = debug_backtrace();
$message = $message[0]['file'].':'.$message[0]['line']."\n";
$message .= array_reverse(explode('\\', get_class($color)))[0];
throw new core\SceneException($message,1);
$className = array_reverse(explode('\\', get_class($color)))[0];
throw new core\SceneException("You use an unregistered {$className} object for the current property");
}
}
else $this->bumptex = $color;

42
src/scene/materials/Metal.php

@ -59,10 +59,8 @@ class Metal extends MaterialsBase
if( $color->cards != null ) $this->kr = $color->cards;
else
{
$message = debug_backtrace();
$message = $message[0]['file'].':'.$message[0]['line']."\n";
$message .= array_reverse(explode('\\', get_class($color)))[0];
throw new core\SceneException($message,1);
$className = array_reverse(explode('\\', get_class($color)))[0];
throw new core\SceneException("You use an unregistered {$className} object for the current property");
}
}
else $this->kr = $color;
@ -76,10 +74,8 @@ class Metal extends MaterialsBase
if( $color->cards != null ) $this->fresnel = $color->cards;
else
{
$message = debug_backtrace();
$message = $message[0]['file'].':'.$message[0]['line']."\n";
$message .= array_reverse(explode('\\', get_class($color)))[0];
throw new core\SceneException($message,1);
$className = array_reverse(explode('\\', get_class($color)))[0];
throw new core\SceneException("You use an unregistered {$className} object for the current property");
}
}
else $this->fresnel = $color;
@ -93,10 +89,8 @@ class Metal extends MaterialsBase
if( $color->cards != null ) $this->uroughness = $color->cards;
else
{
$message = debug_backtrace();
$message = $message[0]['file'].':'.$message[0]['line']."\n";
$message .= array_reverse(explode('\\', get_class($color)))[0];
throw new core\SceneException($message,1);
$className = array_reverse(explode('\\', get_class($color)))[0];
throw new core\SceneException("You use an unregistered {$className} object for the current property");
}
}
else $this->uroughness = $color;
@ -109,10 +103,8 @@ class Metal extends MaterialsBase
if( $color->cards != null ) $this->vroughness = $color->cards;
else
{
$message = debug_backtrace();
$message = $message[0]['file'].':'.$message[0]['line']."\n";
$message .= array_reverse(explode('\\', get_class($color)))[0];
throw new core\SceneException($message,1);
$className = array_reverse(explode('\\', get_class($color)))[0];
throw new core\SceneException("You use an unregistered {$className} object for the current property");
}
}
else $this->vroughness = $color;
@ -125,10 +117,8 @@ class Metal extends MaterialsBase
if( $color->cards != null ) $this->transparencyFront = $color->cards;
else
{
$message = debug_backtrace();
$message = $message[0]['file'].':'.$message[0]['line']."\n";
$message .= array_reverse(explode('\\', get_class($color)))[0];
throw new core\SceneException($message,1);
$className = array_reverse(explode('\\', get_class($color)))[0];
throw new core\SceneException("You use an unregistered {$className} object for the current property");
}
}
else $this->transparencyFront = $color;
@ -141,10 +131,8 @@ class Metal extends MaterialsBase
if( $color->cards != null ) $this->transparencyBack = $color->cards;
else
{
$message = debug_backtrace();
$message = $message[0]['file'].':'.$message[0]['line']."\n";
$message .= array_reverse(explode('\\', get_class($color)))[0];
throw new core\SceneException($message,1);
$className = array_reverse(explode('\\', get_class($color)))[0];
throw new core\SceneException("You use an unregistered {$className} object for the current property");
}
}
else $this->transparencyBack = $color;
@ -157,10 +145,8 @@ class Metal extends MaterialsBase
if( $color->cards != null ) $this->bumptex = $color->cards;
else
{
$message = debug_backtrace();
$message = $message[0]['file'].':'.$message[0]['line']."\n";
$message .= array_reverse(explode('\\', get_class($color)))[0];
throw new core\SceneException($message,1);
$className = array_reverse(explode('\\', get_class($color)))[0];
throw new core\SceneException("You use an unregistered {$className} object for the current property");
}
}
else $this->bumptex = $color;

18
src/scene/materials/Mix.php

@ -42,10 +42,8 @@ class Mix extends MaterialsBase
if( $Material->cards != null ) $this->material1 = $Material->cards;
else
{
$message = debug_backtrace();
$message = $message[0]['file'].':'.$message[0]['line']."\n";
$message .= array_reverse(explode('\\', get_class($Material)))[0];
throw new core\SceneException($message,1);
$className = array_reverse(explode('\\', get_class($Material)))[0];
throw new core\SceneException("You use an unregistered {$className} object for the current property");
}
}
else $this->material1 = $Material;
@ -58,10 +56,8 @@ class Mix extends MaterialsBase
if( $Material->cards != null ) $this->material2 = $Material->cards;
else
{
$message = debug_backtrace();
$message = $message[0]['file'].':'.$message[0]['line']."\n";
$message .= array_reverse(explode('\\', get_class($Material)))[0];
throw new core\SceneException($message,1);
$className = array_reverse(explode('\\', get_class($Material)))[0];
throw new core\SceneException("You use an unregistered {$className} object for the current property");
}
}
else $this->material2 = $Material;
@ -74,10 +70,8 @@ class Mix extends MaterialsBase
if( $color->cards != null ) $this->amount = $color->cards;
else
{
$message = debug_backtrace();
$message = $message[0]['file'].':'.$message[0]['line']."\n";
$message .= array_reverse(explode('\\', get_class($color)))[0];
throw new core\SceneException($message,1);
$className = array_reverse(explode('\\', get_class($color)))[0];
throw new core\SceneException("You use an unregistered {$className} object for the current property");
}
}
else $this->amount = $color;

6
src/scene/objects/Objects.php

@ -51,10 +51,8 @@ class Objects extends BaseCfg
if( $material->cards != null ) $this->material = $material->cards;
else
{
$message = debug_backtrace();
$message = $message[0]['file'].':'.$message[0]['line']."\n";
$message .= array_reverse(explode('\\', get_class($material)))[0];
throw new core\SceneException($message,1);
$className = array_reverse(explode('\\', get_class($material)))[0];
throw new core\SceneException("You use an unregistered {$className} object for the current property");
}
}
else $this->material = $material;

Loading…
Cancel
Save