From 6f0fd66d56115ea7d9e5e5d07bec859ad309c878 Mon Sep 17 00:00:00 2001 From: yuanjiajia <1139393632@qq.com> Date: Thu, 3 Mar 2022 20:07:46 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E4=B8=80=E4=B8=AA=20Texture?= =?UTF-8?q?=E7=B1=BB=E7=9A=84=E7=B1=BB=E6=96=87=E4=BB=B6=EF=BC=8C=20Scene?= =?UTF-8?q?=E7=B1=BB=E7=9A=84add=E5=87=BD=E6=95=B0=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E4=B8=BAregister=E5=87=BD=E6=95=B0=EF=BC=8C=E6=9D=90=E8=B4=A8?= =?UTF-8?q?=E3=80=81=E6=A8=A1=E5=9E=8B=E3=80=81=E8=B4=B4=E5=9B=BE=E3=80=81?= =?UTF-8?q?=E7=81=AF=E5=85=89=E3=80=81=E7=9B=B8=E6=9C=BA=E3=80=81=E4=BD=93?= =?UTF-8?q?=E7=A7=AF=E6=9D=90=E8=B4=A8=E7=B1=BB=E7=9A=84set=E5=87=BD?= =?UTF-8?q?=E6=95=B0=E5=A2=9E=E5=8A=A0=20=E5=BC=82=E5=B8=B8=E6=8A=9B?= =?UTF-8?q?=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- examples/print.php | 48 ++--- src/scene/Scene.php | 77 ++------ src/scene/materials/Disney.php | 211 ++++++++++++++++++++-- src/scene/materials/MaterialsBase.php | 20 ++ src/scene/materials/Metal.php | 84 ++++++++- src/scene/materials/Mix.php | 38 +++- src/scene/objects/Objects.php | 33 +++- src/scene/texture/TextureBase.php | 5 + src/scene/texture/map/Blend.php | 72 ++++++++ src/scene/texture/map/Clouds.php | 7 +- src/scene/texture/map/ImageMap.php | 2 +- src/scene/texture/mapping/Triplanar.php | 2 +- src/scene/texture/transform/NormalMap.php | 2 +- 13 files changed, 477 insertions(+), 124 deletions(-) create mode 100644 src/scene/texture/map/Blend.php diff --git a/examples/print.php b/examples/print.php index 21a19ff..950783f 100644 --- a/examples/print.php +++ b/examples/print.php @@ -11,7 +11,7 @@ use Blobt\Luxcore\scene\texture; include dirname(dirname(__FILE__)) . "/vendor/autoload.php"; - +/* echo '>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>渲染配置参数>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>'; echo "\n\n\n\n"; @@ -70,7 +70,7 @@ echo $film; - +*/ @@ -86,36 +86,38 @@ $scene = new Scene();//创建一个场景, $obj = new objects\Objects( [ 'ply' => 'mesh-10086.ply','appliedtransformation' => '1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1' ] ); //创建一个的模型 -$baseColor = new texture\map\Clouds( new texture\mapping\Mapping() ); -$bump = new texture\map\ImageMap( new texture\mapping\Mapping() ); -$ior = new texture\map\ImageMap( new texture\mapping\Mapping() ); +$cloudsMap = new texture\map\Clouds( new texture\mapping\Mapping() ); //创建一个 Clouds类的贴图对象 +//$scene->registerTexture($cloudsMap); //将这个对象注册到 Scene -$baseColor = $scene->addTexture($baseColor); -$bump = $scene->addTexture($bump); -$ior = $scene->addTexture($ior); +$imageMap = new texture\map\ImageMap( new texture\mapping\Mapping() ); //创建一个 ImageMap类的贴图对象 +//$scene->registerTexture($imageMap); //将这个对象注册到 Scene -$disney = new materials\Disney(); //创建一个 Disney 材质 -$disney->setBaseColor($baseColor); -$disney->setBumptex($bump); -$disney->setFilmior($ior); -$disney = $scene->addMaterial($disney); //将材质存入材质数组,并获得其键名 +$blend = new texture\map\Blend( new texture\mapping\Mapping() ); //创建一个 Blend类的贴图对象 +$scene->registerTexture($blend); //将这个对象注册到 Scene -$metal = new materials\Metal(); //创建一个 Metal 材质 -$metal->setRefraction($baseColor); -$metal->setBumptex($bump); -$metal = $scene->addMaterial($metal); //将材质存入材质数组,并获得其键名 +$disney = new materials\Disney(); //创建一个 Disney 材质对象 +$disney->setBaseColor($cloudsMap); //为 basecolor 指定一个贴图对象,如果这个对象没有注册到Scenn,则 set函数抛出异常,以下同理 +$disney->setMetallic($blend); +$disney->setBumptex($imageMap); +$scene->registerMaterial($disney); //将这个对象注册到 Scene -$mix = new materials\Mix(); //创建 Mix 材质, + +$metal = new materials\Metal(); //创建一个 Disney 材质对象 +$metal->setRefraction($imageMap); +$metal->setBumptex($cloudsMap); +$scene->registerMaterial($metal); //将这个对象注册到 Scene + + +$mix = new materials\Mix(); //创建 Mix 材质对象 $mix->setMaterial1($disney); //为材质通道1 指定一个键名 $mix->setMaterial2($metal); //为材质通道2 指定一个键名 -$mix->setAmount($baseColor); //指定混合系数为 0.6 -$mix = $scene->addMaterial($mix); //将材质存入材质数组,并获得其键名 - +$mix->setAmount($blend ); //指定混合系数为 0.6 +$scene->registerMaterial($mix); //将这个对象注册到 Scene -$obj->setMaterial($mix) ; //为模型的材属性 指定一个键名 -$scene->addObjects($obj); //将模型添加到场景中 +$obj->setMaterial($mix) ; //为模型的指定一个混合材质 +$scene->registerObjects($obj); //将模型添加到场景中 /* diff --git a/src/scene/Scene.php b/src/scene/Scene.php index b29dca3..5496ec7 100644 --- a/src/scene/Scene.php +++ b/src/scene/Scene.php @@ -45,107 +45,54 @@ class Scene extends BaseCfg } - public function addObjects($obj) + public function registerObjects(&$obj) { $temp = null; $temp = sprintf("%014d",$obj->id); + $obj->cards = $temp; $this->objects[$temp] = $obj; } - public function addMaterial($material) + public function registerMaterial(&$material) { $temp = null; $temp = $material->type.'_'.sprintf("%014d",$material->id); + $material->cards = $temp; $this->materials[$temp] = $material; - return $temp; } - public function addTexture($texture) + public function registerTexture(&$texture) { $temp = null; $temp = $texture->type.'_'.sprintf("%014d",$texture->id); + $texture->cards = $temp; $this->textures[$temp] = $texture; - return $temp; } - public function addVolume($volume) + public function registerVolume(&$volume) { $temp = null; $temp = $volume->type.'_'.sprintf("%014d",$volume->id); + $volume->cards = $temp; $this->volumes[$temp] = $volume; - return $temp; } - public function addLight($light) + public function registerLight(&$light) { $temp = null; $temp = $light->type.'_'.sprintf("%014d",$light->id); + $light->cards = $temp; $this->lights[$temp] = $light; - return $temp; } - public function addCamera($camera) + public function registerCamera(&$camera) { $temp = null; $temp = $camera->type.'_'.sprintf("%014d",$camera->id); + $camera->cards = $temp; $this->cameras[$temp] = $camera; - return $temp; } - - - - - /* - public function addObject( object $object ) - { - $temp = null; - $attributeArr = get_object_vars($object); - - if( $object instanceof objects\Objects ) - { - $temp = sprintf("%014d",count($this->objects)+1); - $this->objects[$temp] = $object; - } - else if( $object instanceof materials\MaterialsBase ) - { - $temp = $object->type.'_'.sprintf("%014d",count($this->materials)+1); - $this->materials[$temp] = $object; - } - else if($object instanceof ligth\LightBase) - { - $temp = $object->type.'_'.sprintf("%014d",count($this->lights)+1); - $this->lights[$temp] = $object; - } - else if($object instanceof camera\Camera) - { - $temp = $object->type.'_'.sprintf("%014d",count($this->camera)+1); - $this->camera[$temp] = $object; - } - else if($object instanceof texture\TextureBase) - { - $temp = $object->type.'_'.sprintf("%014d",count($this->textures)+1); - $this->textures[$temp] = $object; - } - else if( $object instanceof volumes\VolumesBase ) - { - $temp = $object->type.'_'.sprintf("%014d",count($this->volumes)+1); - $this->volumes[$temp] = $object; - } - else; - - - foreach( $attributeArr as $key => $value) - { - if( $value instanceof texture\TextureBase || $value instanceof materials\MaterialsBase || $value instanceof volumes\VolumesBase ) - { - $object->$key = $this->addobject( $value ); - } - } - return $temp; - } - - */ } diff --git a/src/scene/materials/Disney.php b/src/scene/materials/Disney.php index 93dd962..7c49081 100644 --- a/src/scene/materials/Disney.php +++ b/src/scene/materials/Disney.php @@ -1,6 +1,8 @@ basecolor = $color; + if( is_object($color) ) + { + if( $color->cards != null ) $this->basecolor = $color->cards; + else + { + $backtrace = debug_backtrace(); + $backtrace = $backtrace[0]['file'].':'.$backtrace[0]['line']."\n"; + $this->printException($backtrace,$color); + } + } + else $this->basecolor = $color; } public function setSubsurface($color) { - $this->subsurface = $color; + if( is_object($color) ) + { + if( $color->cards != null ) $this->subsurface = $color->cards; + else + { + $backtrace = debug_backtrace(); + $backtrace = $backtrace[0]['file'].':'.$backtrace[0]['line']."\n"; + $this->printException($backtrace,$color); + } + } + else $this->subsurface = $color; } public function setMetallic($color) { - $this->metallic = $color; + if( is_object($color) ) + { + if( $color->cards != null ) $this->metallic = $color->cards; + else + { + $backtrace = debug_backtrace(); + $backtrace = $backtrace[0]['file'].':'.$backtrace[0]['line']."\n"; + $this->printException($backtrace,$color); + } + } + else $this->metallic = $color; } public function setSpecular($color) { - $this->specular = $color; + if( is_object($color) ) + { + if( $color->cards != null ) $this->specular = $color->cards; + else + { + $backtrace = debug_backtrace(); + $backtrace = $backtrace[0]['file'].':'.$backtrace[0]['line']."\n"; + $this->printException($backtrace,$color); + } + } + else $this->specular = $color; } public function setSpeculartint($color) - { - $this->speculartint = $color; + { + if( is_object($color) ) + { + if( $color->cards != null ) $this->speculartint = $color->cards; + else + { + $backtrace = debug_backtrace(); + $backtrace = $backtrace[0]['file'].':'.$backtrace[0]['line']."\n"; + $this->printException($backtrace,$color); + } + } + else $this->speculartint = $color; } public function setRoughness($color) { - $this->roughness = $color; + if( is_object($color) ) + { + if( $color->cards != null ) $this->roughness = $color->cards; + else + { + $backtrace = debug_backtrace(); + $backtrace = $backtrace[0]['file'].':'.$backtrace[0]['line']."\n"; + $this->printException($backtrace,$color); + } + } + else $this->roughness = $color; } public function setAnisotropic($color) { - $this->anisotropic = $color; + if( is_object($color) ) + { + if( $color->cards != null ) $this->anisotropic = $color->cards; + else + { + $backtrace = debug_backtrace(); + $backtrace = $backtrace[0]['file'].':'.$backtrace[0]['line']."\n"; + $this->printException($backtrace,$color); + } + } + else $this->anisotropic = $color; } public function setSheen($color) { - $this->sheen = $color; + if( is_object($color) ) + { + if( $color->cards != null ) $this->sheen = $color->cards; + else + { + $backtrace = debug_backtrace(); + $backtrace = $backtrace[0]['file'].':'.$backtrace[0]['line']."\n"; + $this->printException($backtrace,$color); + } + } + else $this->sheen = $color; } public function setSheentint($color) { - $this->sheentint = $color; + if( is_object($color) ) + { + if( $color->cards != null ) $this->sheentint = $color->cards; + else + { + $backtrace = debug_backtrace(); + $backtrace = $backtrace[0]['file'].':'.$backtrace[0]['line']."\n"; + $this->printException($backtrace,$color); + } + } + else $this->sheentint = $color; } public function setClearcoat($color) { - $this->clearcoat = $color; + if( is_object($color) ) + { + if( $color->cards != null ) $this->clearcoat = $color->cards; + else + { + $backtrace = debug_backtrace(); + $backtrace = $backtrace[0]['file'].':'.$backtrace[0]['line']."\n"; + $this->printException($backtrace,$color); + } + } + else $this->clearcoat = $color; } public function setClearcoatgloss($color) { - $this->clearcoatgloss = $color; + if( is_object($color) ) + { + if( $color->cards != null ) $this->clearcoatgloss = $color->cards; + else + { + $backtrace = debug_backtrace(); + $backtrace = $backtrace[0]['file'].':'.$backtrace[0]['line']."\n"; + $this->printException($backtrace,$color); + } + } + else $this->clearcoatgloss = $color; } public function setTransparencyFront($color) { - $this->transparencyFront = $color; + if( is_object($color) ) + { + if( $color->cards != null ) $this->transparencyFront = $color->cards; + else + { + $backtrace = debug_backtrace(); + $backtrace = $backtrace[0]['file'].':'.$backtrace[0]['line']."\n"; + $this->printException($backtrace,$color); + } + } + else $this->transparencyFront = $color; } public function setTransparencyBack($color) - { - $this->transparencyBack = $color; + { + if( is_object($color) ) + { + if( $color->cards != null ) $this->transparencyBack = $color->cards; + else + { + $backtrace = debug_backtrace(); + $backtrace = $backtrace[0]['file'].':'.$backtrace[0]['line']."\n"; + $this->printException($backtrace,$color); + } + } + else $this->transparencyBack = $color; } public function setFilmamount($color) { - $this->filmamount = $color; + if( is_object($color) ) + { + if( $color->cards != null ) $this->filmamount = $color->cards; + else + { + $backtrace = debug_backtrace(); + $backtrace = $backtrace[0]['file'].':'.$backtrace[0]['line']."\n"; + $this->printException($backtrace,$color); + } + } + else $this->filmamount = $color; } public function setFilmthickness($color) - { - $this->filmthickness = $color; + { if( is_object($color) ) + { + if( $color->cards != null ) $this->filmthickness = $color->cards; + else + { + $backtrace = debug_backtrace(); + $backtrace = $backtrace[0]['file'].':'.$backtrace[0]['line']."\n"; + $this->printException($backtrace,$color); + } + } + else $this->filmthickness = $color; } public function setFilmior($color) { - $this->filmior = $color; + if( is_object($color) ) + { + if( $color->cards != null ) $this->filmior = $color->cards; + else + { + $backtrace = debug_backtrace(); + $backtrace = $backtrace[0]['file'].':'.$backtrace[0]['line']."\n"; + $this->printException($backtrace,$color); + } + } + else $this->filmior = $color; } public function setBumptex($color) { - $this->bumptex = $color; + if( is_object($color) ) + { + if( $color->cards != null ) $this->bumptex = $color->cards; + else + { + $backtrace = debug_backtrace(); + $backtrace = $backtrace[0]['file'].':'.$backtrace[0]['line']."\n"; + $this->printException($backtrace,$color); + } + } + else $this->bumptex = $color; } } diff --git a/src/scene/materials/MaterialsBase.php b/src/scene/materials/MaterialsBase.php index 68648e1..c41a0e9 100644 --- a/src/scene/materials/MaterialsBase.php +++ b/src/scene/materials/MaterialsBase.php @@ -24,6 +24,11 @@ class MaterialsBase extends BaseCfg * @var integer 当前材质的ID号(取值:大于0的整数) */ public $id; + + /** + * @var bool 储存个由Scene类颁发的注册信息 + */ + public $cards; /** * @var float TODO:采样距离,具体作用尚未明确,(固定取值:0.001) @@ -96,6 +101,21 @@ class MaterialsBase extends BaseCfg $this->volumeExterior = $color; } + protected function printException($backtrace,$temp) + { + try + { + $className = get_class($temp); + $className = array_reverse(explode('\\', $className))[0]; + $backtrace .= "你为当前通道赋值是一个未注册的 {$className}对象,这会导致一个默认值的渲染结果!!!"; + throw new \Exception($backtrace,0); + } + catch( \Exception $err ) + { + echo '警告:在'.$err->getMessage()."\n\n"; + } + } + } ?> diff --git a/src/scene/materials/Metal.php b/src/scene/materials/Metal.php index 2aa8441..e8ef905 100644 --- a/src/scene/materials/Metal.php +++ b/src/scene/materials/Metal.php @@ -54,39 +54,109 @@ class Metal extends MaterialsBase public function setRefraction($color) { - $this->kr = $color; + if( is_object($color) ) + { + if( $color->cards != null ) $this->kr = $color->cards; + else + { + $backtrace = debug_backtrace(); + $backtrace = $backtrace[0]['file'].':'.$backtrace[0]['line']."\n"; + $this->printException($backtrace,$color); + } + } + else $this->kr = $color; } public function setFresnel($color) { - $this->fresnel = $color; + if( is_object($color) ) + { + if( $color->cards != null ) $this->fresnel = $color->cards; + else + { + $backtrace = debug_backtrace(); + $backtrace = $backtrace[0]['file'].':'.$backtrace[0]['line']."\n"; + $this->printException($backtrace,$color); + } + } + else $this->fresnel = $color; } public function setUroughness($color) { - $this->uroughness = $color; + if( is_object($color) ) + { + if( $color->cards != null ) $this->uroughness = $color->cards; + else + { + $backtrace = debug_backtrace(); + $backtrace = $backtrace[0]['file'].':'.$backtrace[0]['line']."\n"; + $this->printException($backtrace,$color); + } + } + else $this->uroughness = $color; } public function setVroughness($color) { - $this->vroughness = $color; + if( is_object($color) ) + { + if( $color->cards != null ) $this->vroughness = $color->cards; + else + { + $backtrace = debug_backtrace(); + $backtrace = $backtrace[0]['file'].':'.$backtrace[0]['line']."\n"; + $this->printException($backtrace,$color); + } + } + else $this->vroughness = $color; } public function setTransparencyFront($color) { - $this->transparencyFront = $color; + if( is_object($color) ) + { + if( $color->cards != null ) $this->transparencyFront = $color->cards; + else + { + $backtrace = debug_backtrace(); + $backtrace = $backtrace[0]['file'].':'.$backtrace[0]['line']."\n"; + $this->printException($backtrace,$color); + } + } + else $this->transparencyFront = $color; } public function setTransparencyBack($color) { - $this->transparencyBack = $color; + if( is_object($color) ) + { + if( $color->cards != null ) $this->transparencyBack = $color->cards; + else + { + $backtrace = debug_backtrace(); + $backtrace = $backtrace[0]['file'].':'.$backtrace[0]['line']."\n"; + $this->printException($backtrace,$color); + } + } + else $this->transparencyBack = $color; } public function setBumptex($color) { - $this->bumptex = $color; + if( is_object($color) ) + { + if( $color->cards != null ) $this->bumptex = $color->cards; + else + { + $backtrace = debug_backtrace(); + $backtrace = $backtrace[0]['file'].':'.$backtrace[0]['line']."\n"; + $this->printException($backtrace,$color); + } + } + else $this->bumptex = $color; } } diff --git a/src/scene/materials/Mix.php b/src/scene/materials/Mix.php index e03b157..1c8f2a7 100644 --- a/src/scene/materials/Mix.php +++ b/src/scene/materials/Mix.php @@ -37,17 +37,47 @@ class Mix extends MaterialsBase public function setMaterial1($Material) { - $this->material1 = $Material; + if( is_object( $Material ) ) + { + if( $Material->cards != null ) $this->material1 = $Material->cards; + else + { + $backtrace = debug_backtrace(); + $backtrace = $backtrace[0]['file'].':'.$backtrace[0]['line']."\n"; + $this->printException($backtrace,$Material); + } + } + else $this->material1 = $Material; } public function setMaterial2($Material) { - $this->material2 = $Material; + if( is_object( $Material ) ) + { + if( $Material->cards != null ) $this->material2 = $Material->cards; + else + { + $backtrace = debug_backtrace(); + $backtrace = $backtrace[0]['file'].':'.$backtrace[0]['line']."\n"; + $this->printException($backtrace,$Material); + } + } + else $this->material2 = $Material; } - public function setAmount($amount) + public function setAmount($color) { - $this->amount = $amount; + if( is_object($color) ) + { + if( $color->cards != null ) $this->amount = $color->cards; + else + { + $backtrace = debug_backtrace(); + $backtrace = $backtrace[0]['file'].':'.$backtrace[0]['line']."\n"; + $this->printException($backtrace,$color); + } + } + else $this->amount = $color; } } diff --git a/src/scene/objects/Objects.php b/src/scene/objects/Objects.php index 5eff180..28e7fd6 100644 --- a/src/scene/objects/Objects.php +++ b/src/scene/objects/Objects.php @@ -28,6 +28,11 @@ class Objects extends BaseCfg */ public $id; + /** + * @var string 储存个由Scene类颁发的注册信息 + */ + public $cards; + /** * @var string 一个山16个数据组成模型的变换参数,包抱位置坐标,旋转参数,缩放参数 */ @@ -40,10 +45,36 @@ class Objects extends BaseCfg } public function setMaterial($material) + { + if( is_object( $material ) ) + { + if( $material->cards != null ) $this->material = $material->cards; + else + { + $backtrace = debug_backtrace(); + $backtrace = $backtrace[0]['file'].':'.$backtrace[0]['line']."\n"; + $this->printException($backtrace,$material); + } + } + else $this->material = $material; + } + + private function printException($backtrace,$temp) { - $this->material = $material; + try + { + $className = get_class($temp); + $className = array_reverse(explode('\\', $className))[0]; + $backtrace .= "你为当前通道赋值是一个未注册的 {$className}对象,这会导致一个默认值的渲染结果!!!"; + throw new \Exception($backtrace,0); + } + catch( \Exception $err ) + { + echo '警告:在'.$err->getMessage()."\n\n"; + } } + } ?> diff --git a/src/scene/texture/TextureBase.php b/src/scene/texture/TextureBase.php index 668813e..81267fb 100644 --- a/src/scene/texture/TextureBase.php +++ b/src/scene/texture/TextureBase.php @@ -16,6 +16,11 @@ class TextureBase extends BaseCfg * @var integer 当前贴图的ID号(取值:大于0的整数) */ public $id; + + /** + * @var string 储存个由Scene类颁发的注册信息 + */ + public $cards; } ?> diff --git a/src/scene/texture/map/Blend.php b/src/scene/texture/map/Blend.php new file mode 100644 index 0000000..bce1091 --- /dev/null +++ b/src/scene/texture/map/Blend.php @@ -0,0 +1,72 @@ +mapping = $mapping; + $this->type = self::TYPE_BLENDER_BLEND; + $this->id = Scene::createID(); + Base::__construct($config); + } + +} + +?> diff --git a/src/scene/texture/map/Clouds.php b/src/scene/texture/map/Clouds.php index 4692c54..bbb0056 100644 --- a/src/scene/texture/map/Clouds.php +++ b/src/scene/texture/map/Clouds.php @@ -62,15 +62,20 @@ class Clouds extends TextureBase * @var float 对比度,(取值:大于等于0的小数) */ public $contrast = 1; + + /** + * @var object 铺贴参数,一个Mapping类对象 + */ + public $mapping; /** * @param $mapping 必须传入一个 Mapping类对象 */ public function __construct(Mapping $mapping,$config = []) { - $this->id = Scene::createID(); $this->mapping = $mapping; $this->type = self::TYPE_BLENDER_CLOUDS; + $this->id = Scene::createID(); Base::__construct($config); } diff --git a/src/scene/texture/map/ImageMap.php b/src/scene/texture/map/ImageMap.php index 376ed96..be4110f 100644 --- a/src/scene/texture/map/ImageMap.php +++ b/src/scene/texture/map/ImageMap.php @@ -48,9 +48,9 @@ class ImageMap extends TextureBase */ public function __construct(Mapping $mapping,$config = []) { - $this->id = Scene::createID(); $this->mapping = $mapping; $this->type = self::TYPE_IMAGEMAP; + $this->id = Scene::createID(); Base::__construct($config); } diff --git a/src/scene/texture/mapping/Triplanar.php b/src/scene/texture/mapping/Triplanar.php index bd79409..b408118 100644 --- a/src/scene/texture/mapping/Triplanar.php +++ b/src/scene/texture/mapping/Triplanar.php @@ -41,9 +41,9 @@ class Triplanar extends TextureBase */ public function __construct(Mapping $mapping,$config = []) { - $this->id = Scene::createID(); $this->mapping = $mapping; $this->type = self::TYPE_TRIPLANAR; + $this->id = Scene::createID(); Base::__construct($config); } diff --git a/src/scene/texture/transform/NormalMap.php b/src/scene/texture/transform/NormalMap.php index 2f63717..210c5c4 100644 --- a/src/scene/texture/transform/NormalMap.php +++ b/src/scene/texture/transform/NormalMap.php @@ -27,9 +27,9 @@ class ImageMap extends TextureBase */ public function __construct(Mapping $mapping,$config = []) { - $this->id = Scene::createID(); $this->mapping = $mapping; $this->type = self::TYPE_NORMALMAP; + $this->id = Scene::createID(); Base::__construct($config); }