diff --git a/CHANGELOG.md b/CHANGELOG.md
index 071c213..9983b27 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,8 @@
# Change Log
+## [0.5.0] - 2020-01-14
+- Added `light` property to VGO_nodes extension.
+
## [0.4.0] - 2020-01-08
- Added `gameObject` property to VGO_nodes extension.
- Added `enabled` property to collider.
diff --git a/Documentation~/VGO/specification/0.3/schema/node.vgo.collider.schema.json b/Documentation~/VGO/specification/0.3/schema/node.vgo.collider.schema.json
new file mode 100644
index 0000000..f6b40bc
--- /dev/null
+++ b/Documentation~/VGO/specification/0.3/schema/node.vgo.collider.schema.json
@@ -0,0 +1,51 @@
+{
+ "title": "node.vgo.collider",
+ "description": "Node collider.",
+ "type": "object",
+ "properties": {
+ "type": {
+ "description": "Type of collider.",
+ "type": "string",
+ "enum": ["Box","Capsule","Sphere"]
+ },
+ "enabled": {
+ "description": "Whether collider is enabled.",
+ "type": "boolean"
+ },
+ "isTrigger": {
+ "description": "Is the collider a trigger?",
+ "type": "boolean"
+ },
+ "center": {
+ "description": "The center of the collider. [x, y, z]",
+ "type": "array",
+ "items": {
+ "type": "number"
+ }
+ },
+ "size": {
+ "description": "The total size of the box. [x, y, z]",
+ "type": "array",
+ "items": {
+ "type": "number"
+ }
+ },
+ "radius": {
+ "description": "The radius of the capsule or sphere, measured in the object's local space.",
+ "type": "number",
+ "minimum": 0
+ },
+ "height": {
+ "description": "The height of the capsule, measured in the object's local space.",
+ "type": "number",
+ "minimum": 0
+ },
+ "direction": {
+ "description": "The direction of the capsule. [0:x, 1:y, 2:z]",
+ "type": "integer"
+ },
+ "physicMaterial": {
+ "$ref": "node.vgo.physicMaterial.schema.json"
+ }
+ }
+}
\ No newline at end of file
diff --git a/Documentation~/VGO/specification/0.3/schema/node.vgo.colliders.schema.json b/Documentation~/VGO/specification/0.3/schema/node.vgo.colliders.schema.json
new file mode 100644
index 0000000..8e92d7c
--- /dev/null
+++ b/Documentation~/VGO/specification/0.3/schema/node.vgo.colliders.schema.json
@@ -0,0 +1,8 @@
+{
+ "title": "node.vgo.colliders",
+ "description": "Node colliders.",
+ "type": "array",
+ "items": {
+ "$ref": "node.vgo.collider.schema.json"
+ }
+}
\ No newline at end of file
diff --git a/Documentation~/VGO/specification/0.3/schema/node.vgo.gameobject.schema.json b/Documentation~/VGO/specification/0.3/schema/node.vgo.gameobject.schema.json
new file mode 100644
index 0000000..3547a3e
--- /dev/null
+++ b/Documentation~/VGO/specification/0.3/schema/node.vgo.gameobject.schema.json
@@ -0,0 +1,25 @@
+{
+ "title": "node.vgo.gameobject",
+ "description": "Node GameObject.",
+ "type": "object",
+ "properties": {
+ "isActive": {
+ "description": "Whether GameObject is active.",
+ "type": "boolean"
+ },
+ "isStatic": {
+ "description": "Whether GameObject is static.",
+ "type": "boolean"
+ },
+ "tag": {
+ "description": "Tag attached to GameObject.",
+ "type": "string"
+ }
+ "layer": {
+ "description": "Index of the layer where GameObject is located.",
+ "type": "integer",
+ "minimum": 0,
+ "maximum": 31
+ }
+ }
+}
\ No newline at end of file
diff --git a/Documentation~/VGO/specification/0.3/schema/node.vgo.light.schema.json b/Documentation~/VGO/specification/0.3/schema/node.vgo.light.schema.json
new file mode 100644
index 0000000..04b4a0c
--- /dev/null
+++ b/Documentation~/VGO/specification/0.3/schema/node.vgo.light.schema.json
@@ -0,0 +1,110 @@
+{
+ "title": "node.vgo.light",
+ "description": "Node light.",
+ "type": "object",
+ "properties": {
+ "enabled": {
+ "description": "Whether the light is enable.",
+ "type": "boolean",
+ },
+ "type": {
+ "description": "The type of the light.",
+ "type": "string",
+ "enum": ["Spot","Directional","Point","Rectangle","Disc"]
+ },
+ "shape": {
+ "description": "This property describes the shape of the spot light.",
+ "type": "string",
+ "enum": ["Cone","Pyramid","Box"]
+ },
+ "range": {
+ "description": "The range of the light.",
+ "type": "number",
+ "minimum": 0
+ },
+ "spotAngle": {
+ "description": "The angle of the light's spotlight cone in degrees.",
+ "type": "number",
+ "minimum": 0
+ },
+ "areaSize": {
+ "description": "The size of the area light. [x, y]",
+ "type": "array",
+ "items": {
+ "type": "number"
+ }
+ },
+ "areaRadius": {
+ "description": "The radius of the area light.",
+ "type": "number",
+ "minimum": 0
+ },
+ "color": {
+ "description": "The color of the light. [r, g, b, a]",
+ "type": "array",
+ "items": {
+ "type": "number"
+ }
+ },
+ "lightmapBakeType": {
+ "description": "This property describes what part of a light's contribution can be baked.",
+ "type": "string",
+ "enum": ["Realtime","Baked","Mixed"]
+ },
+ "intensity": {
+ "description": "The Intensity of a light is multiplied with the Light color.",
+ "type": "number",
+ "minimum": 0
+ },
+ "bounceIntensity": {
+ "description": "The multiplier that defines the strength of the bounce lighting.",
+ "type": "number",
+ "minimum": 0
+ },
+ "shadows": {
+ "description": "How this light casts shadows.",
+ "type": "string",
+ "enum": ["None","Hard","Soft"]
+ },
+ "shadowAngle": {
+ "description": "Controls the amount of artificial softening applied to the edges of shadows cast by directional lights.",
+ "type": "number",
+ "minimum": 0
+ },
+ "shadowStrength": {
+ "description": "Strength of light's shadows.",
+ "type": "number",
+ "minimum": 0
+ },
+ "shadowResolution": {
+ "description": "The resolution of the shadow map.",
+ "type": "string",
+ "enum": ["FromQualitySettings","Low","Medium","High","VeryHigh"]
+ },
+ "shadowBias": {
+ "description": "Shadow mapping constant bias.",
+ "type": "number",
+ "minimum": 0
+ },
+ "shadowNormalBias": {
+ "description": "Shadow mapping normal-based bias.",
+ "type": "number",
+ "minimum": 0
+ },
+ "shadowNearPlane": {
+ "description": "Near plane value to use for shadow frustums.",
+ "type": "number",
+ "minimum": 0
+ },
+ "renderMode": {
+ "description": "How to render the light.",
+ "type": "string",
+ "enum": ["Auto","ForcePixel","ForceVertex"]
+ },
+ "cullingMask": {
+ "description": "This is used to light certain objects in the Scene selectively.",
+ "type": "integer",
+ "minimum": -1
+ }
+ }
+}
\ No newline at end of file
diff --git a/Documentation~/VGO/specification/0.3/schema/node.vgo.physicMaterial.schema.json b/Documentation~/VGO/specification/0.3/schema/node.vgo.physicMaterial.schema.json
new file mode 100644
index 0000000..08c45d2
--- /dev/null
+++ b/Documentation~/VGO/specification/0.3/schema/node.vgo.physicMaterial.schema.json
@@ -0,0 +1,35 @@
+{
+ "title": "node.vgo.physicMaterial",
+ "description": "Physic material.",
+ "type": "object",
+ "properties": {
+ "dynamicFriction": {
+ "description": "The friction used when already moving.",
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1
+ },
+ "staticFriction": {
+ "description": "The friction coefficient used when an object is lying on a surface.",
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1
+ },
+ "bounciness": {
+ "description": "How bouncy is the surface?",
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1
+ },
+ "frictionCombine": {
+ "description": "Determines how the friction is combined.",
+ "type": "string",
+ "enum": ["Average","Multiply","Minimum","Maximum"]
+ },
+ "bounceCombine": {
+ "description": "Determines how the bounciness is combined.",
+ "type": "string",
+ "enum": ["Average","Multiply","Minimum","Maximum"]
+ }
+ }
+}
\ No newline at end of file
diff --git a/Documentation~/VGO/specification/0.3/schema/node.vgo.rigidbody.schema.json b/Documentation~/VGO/specification/0.3/schema/node.vgo.rigidbody.schema.json
new file mode 100644
index 0000000..972f501
--- /dev/null
+++ b/Documentation~/VGO/specification/0.3/schema/node.vgo.rigidbody.schema.json
@@ -0,0 +1,47 @@
+{
+ "title": "node.vgo.rigidbody",
+ "description": "Node rigidbody.",
+ "type": "object",
+ "properties": {
+ "mass": {
+ "description": "The mass of the body. [0.0000001, 1000000000]",
+ "type": "number",
+ "minimum": 0.0000001,
+ "maximum": 1000000000
+ },
+ "drag": {
+ "description": "The linear drag coefficient. [0, infinity]",
+ "type": "number",
+ "minimum": 0
+ },
+ "angularDrag": {
+ "description": "The angular drag coefficient. [0, infinity]",
+ "type": "number",
+ "minimum": 0
+ },
+ "useGravity": {
+ "description": "Controls whether gravity affects this rigidbody.",
+ "type": "boolean"
+ },
+ "isKinematic": {
+ "description": "Controls whether physics affects the rigidbody.",
+ "type": "boolean"
+ },
+ "interpolation": {
+ "description": "Interpolation allows you to smooth out the effect of running physics at a fixed frame rate.",
+ "type": "string",
+ "enum": ["None","Interpolate","Extrapolate"]
+ },
+ "collisionDetectionMode": {
+ "description": "The Rigidbody's collision detection mode.",
+ "type": "string",
+ "enum": ["Discrete","Continuous","ContinuousDynamic","ContinuousSpeculative"]
+ },
+ "constraints": {
+ "description": "The flags to constrain motion of rigidbodies. [2|4|8|16|32|64]",
+ "type": "integer",
+ "minimum": 0,
+ "maximum": 126
+ }
+ }
+}
\ No newline at end of file
diff --git a/Documentation~/VGO/specification/0.3/schema/nodes.extensions.vgo_nodes.schema.json b/Documentation~/VGO/specification/0.3/schema/nodes.extensions.vgo_nodes.schema.json
new file mode 100644
index 0000000..e38624f
--- /dev/null
+++ b/Documentation~/VGO/specification/0.3/schema/nodes.extensions.vgo_nodes.schema.json
@@ -0,0 +1,22 @@
+{
+ "title": "nodes.extensions.VGO_nodes",
+ "description": "Node extension for VGO.",
+ "type": "object",
+ "properties": {
+ "gameObject": {
+ "$ref": "node.vgo.gameobject.schema.json"
+ },
+ "colliders": {
+ "$ref": "node.vgo.colliders.schema.json"
+ },
+ "rigidbody": {
+ "$ref": "node.vgo.rigidbody.schema.json"
+ },
+ "light": {
+ "$ref": "node.vgo.light.schema.json"
+ },
+ "right": {
+ "$ref": "vgo.right.schema.json"
+ }
+ }
+}
\ No newline at end of file
diff --git a/Documentation~/VGO/specification/0.3/schema/vgo.meta.schema.json b/Documentation~/VGO/specification/0.3/schema/vgo.meta.schema.json
new file mode 100644
index 0000000..522f9f3
--- /dev/null
+++ b/Documentation~/VGO/specification/0.3/schema/vgo.meta.schema.json
@@ -0,0 +1,19 @@
+{
+ "title": "vgo.meta",
+ "description": "VGO meta information.",
+ "type": "object",
+ "properties": {
+ "generatorName": {
+ "description": "The VGO generator name.",
+ "type": "string"
+ },
+ "generatorVersion": {
+ "description": "The VGO generator version.",
+ "type": "string"
+ },
+ "specVersion": {
+ "description": "The VGO specification version.",
+ "type": "string"
+ }
+ }
+}
\ No newline at end of file
diff --git a/Documentation~/VGO/specification/0.3/schema/vgo.right.schema.json b/Documentation~/VGO/specification/0.3/schema/vgo.right.schema.json
new file mode 100644
index 0000000..47e1c63
--- /dev/null
+++ b/Documentation~/VGO/specification/0.3/schema/vgo.right.schema.json
@@ -0,0 +1,39 @@
+{
+ "title": "vgo.right",
+ "description": "Rights information.",
+ "type": "object",
+ "properties": {
+ "title": {
+ "description": "The name of the model.",
+ "type": "string"
+ },
+ "author": {
+ "description": "The name of the model creator.",
+ "type": "string"
+ },
+ "organization": {
+ "description": "Organization to which the creator belongs.",
+ "type": "string"
+ },
+ "createdDate": {
+ "description": "The date this model was created.",
+ "type": "string"
+ },
+ "updatedDate": {
+ "description": "The date this model was updated.",
+ "type": "string"
+ },
+ "version": {
+ "description": "The version of this model.",
+ "type": "string"
+ },
+ "distributionUrl": {
+ "description": "Distribution URL for this model.",
+ "type": "string"
+ },
+ "licenseUrl": {
+ "description": "URL that describes the license for this model.",
+ "type": "string"
+ }
+ }
+}
\ No newline at end of file
diff --git a/Documentation~/VGO/specification/0.3/schema/vgo.schema.json b/Documentation~/VGO/specification/0.3/schema/vgo.schema.json
new file mode 100644
index 0000000..b395fc8
--- /dev/null
+++ b/Documentation~/VGO/specification/0.3/schema/vgo.schema.json
@@ -0,0 +1,13 @@
+{
+ "title": "vgo",
+ "description": "glTF extension for VGO.",
+ "type": "object",
+ "properties": {
+ "meta": {
+ "$ref": "vgo.meta.schema.json"
+ },
+ "right": {
+ "$ref": "vgo.right.schema.json"
+ }
+ }
+}
\ No newline at end of file
diff --git a/README.ja.md b/README.ja.md
index a898f52..8bbc46a 100644
--- a/README.ja.md
+++ b/README.ja.md
@@ -4,8 +4,8 @@ VGO とは、Collider と Rigidbody の情報を格納可能な Unity 向け3D
## 特徴
- glTF (GLB) 2.0 の拡張フォーマットになります。
-- ノードに Collider, Rigidbody, 権利情報に関する拡張定義を追加しています。
-- Unity の GameObject の Transform, Rigidbody, Collider, PhysicMaterial, Mesh, Material, Texture を保存することができます。
+- ノードに Collider, Rigidbody, Light, 権利情報に関する拡張定義を追加しています。
+- Unity の GameObject の Transform, Rigidbody, Collider, PhysicMaterial, Mesh, Material, Texture, Light を保存することができます。
___
## glTFのJSONスキーマ
@@ -54,6 +54,7 @@ ___
|gameObject|ゲームオブジェクト情報|
|colliders|コライダー情報|
|rigidbody|剛体情報|
+|light|ライト情報|
|right|VGO権利情報|
### glTF.materials.[*].extensions
@@ -70,8 +71,8 @@ ___
|定義名|説明|型|固定値|
|:---|:---|:---:|:---:|
|generatorName|生成ツールの名前です。|string|UniVGO|
-|generatorVersion|生成ツールのバージョンです。|string|0.4.0|
-|specVersion|VGOの仕様バージョンです。|string|0.2|
+|generatorVersion|生成ツールのバージョンです。|string|0.5.0|
+|specVersion|VGOの仕様バージョンです。|string|0.3|
### vgo.right(権利情報)
@@ -95,12 +96,12 @@ ___
|tag|ゲームオブジェクトに付けられたタグ。|string||Untagged|
|layer|ゲームオブジェクトの位置するレイヤー。|int|[0, 31]|0|
-### node.vgo.collier(コライダー)
+### node.vgo.collider(コライダー)
|定義名|説明|型|設定値|Box|Capsule|Sphere|
|:---|:---|:---:|:---:|:---:|:---:|:---:|
-|type|コライダーの種類です。|string|Box / Capsule / Sphere|*|*|*|
|enabled|コライダーが有効かどうか。|bool|true / false|*|*|*|
+|type|コライダーの種類です。|string|Box / Capsule / Sphere|*|*|*|
|isTrigger|コライダーがトリガーかどうか。|bool|true / false|*|*|*|
|center|コライダーの中心座標です。(単位はm)|float[3]|[x, y, z]|*|*|*|
|size|コライダーのサイズです。(単位はm)|float[3]|[x, y, z]|*|-|-|
@@ -126,12 +127,40 @@ ___
|mass|物体の質量です。(単位はkg)|float|[0.0000001, 1000000000]|
|drag|力によって動く際にオブジェクトに影響する空気抵抗の大きさです。|float|[0.0, infinity]|
|angularDrag|トルクによって回転する際にオブジェクトに影響する空気抵抗の大きさです。|float|[0.0, infinity]|
-|useGravity|オブジェクトが重力の影響を受けるかどうか。|boolean|true / false|
-|isKinematic|物理が剛体に影響を与えるかどうかどうか。|boolean|true / false|
+|useGravity|オブジェクトが重力の影響を受けるかどうか。|bool|true / false|
+|isKinematic|物理が剛体に影響を与えるかどうかどうか。|bool|true / false|
|interpolation|補完のタイプです。|string|none / interpolate / extrapolate|
|collisionDetectionMode|衝突の検知のモードです。|string|Discrete / Continuous / ContinuousDynamic / ContinuousSpeculative|
|constraints|剛体の動きを制限するフラグです。|int|FreesePositionX(2) \| FreesePositionY(4) \| FreesePositionZ(8) \| FreeseRotationX(16) \| FreeseRotationY(32) \| FreeseRotationZ(64)|
+### node.vgo.light(ライト)
+
+|定義名|説明|型|設定値|既定値|Spot|Directional|Point|Rectangle|Disc|
+|:---|:---|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|
+|enabled|ライトが有効かどうか。|bool|true / false|true|*|*|*|*|*|
+|type|ライトのタイプ。|string|Spot / Directional / Point / Rectangle / Disc|Spot|*|*|*|*|*|
+|shape|スポットライトの形状。|string|Cone / Pyramid / Box|Cone|*|-|-|-|-|
+|range|光の範囲。|float|[0, infinity]||*|-|*|*|*|
+|spotAngle|ライトのスポットライトコーンの角度(度単位)。|float|[0, infinity]||*|-|-|-|-|
+|areaSize|エリアライトのサイズ。|float[2]|x, y||-|-|-|*|-|
+|areaRadius|エリアライトの半径。|float|[0, infinity]||-|-|-|-|*|
+|color|ライトの色。|float[4]|r, g, b, a||*|*|*|*|*|
+|lightmapBakeType|ライトマップのベイクタイプ。|string|Baked / Realtime / Mixed||*|*|*|*|*|
+|intensity|ライトの輝度。|float|[0, infinity]||*|*|*|*|*|
+|bounceIntensity|バウンス照明の輝度を定義する乗数。|float|[0, infinity]||*|*|*|*|*|
+|shadows|この光が影を落とす方法。|string|None / Hard / Soft|None|*|*|*|*|*|
+|shadowRadius|影の半径。|float|[0, infinity]||*|-|*|-|-|
+|shadowAngle|影の角度。|float|[0, infinity]||-|*|-|-|-|
+|shadowStrength|ライトの影の強さ。|float|[0, infinity]||-|*|*|-|-|
+|shadowResolution|シャドウマップの解像度。|string|FromQualitySettings / Low / Medium / High / VeryHigh|FromQualitySettings|-|*|*|-|-|
+|shadowBias|シャドウマッピング定数バイアス。|float|[0, infinity]||-|*|*|-|-|
+|shadowNormalBias|シャドウマッピング法線ベースのバイアス。|float|[0, infinity]||-|*|*|-|-|
+|shadowNearPlane|シャドウ ニア プレーン。|float|[0, infinity]||-|*|*|-|-|
+|renderMode|レンダー モード。|string|Auto / ForcePixel / ForceVertex|Auto|*|*|*|*|*|
+|cullingMask|カリング マスク。|int|[-1, infinity]|-1 (Everything)|*|*|*|*|*|
+
+Cookie, Flare, Halo は対象外です。
+
___
## glTFのJSONの構造例
@@ -157,16 +186,16 @@ JSON{
"VGO": {
"meta": {
"generatorName": "UniVGO",
- "generatorVersion": "0.4.0",
- "specVersion": "0.2"
+ "generatorVersion": "0.5.0",
+ "specVersion": "0.3"
},
"right": {
"title": "Test Stage",
"author": "Izayoi Jiichan",
"organization": "Izayoi",
"createdDate": "2020-01-01",
- "updatedDate": "2020-01-08",
- "version": "1.1",
+ "updatedDate": "2020-01-14",
+ "version": "1.2",
"distributionUrl": "https://github.com/izayoijiichan/VGO",
"licenseUrl": "https://github.com/izayoijiichan/VGO/blob/master/UniVgo/LICENSE.md"
}
@@ -196,8 +225,8 @@ JSON{
},
"colliders": [
{
- "type": "Capsule",
"enabled": false,
+ "type": "Capsule",
"isTrigger": false,
"center": [ 0, 0, 0 ],
"radius": 0.5,
@@ -222,13 +251,36 @@ JSON{
"collisionDetectionMode": "Discrete",
"constraints": 36
},
+ "light":{
+ "enabled":true,
+ "type":"Point",
+ "shape":"",
+ "range":1.0,
+ "spotAngle":0.0,
+ "areaSize":0.0,
+ "areaRadius":0.0,
+ "color":[ 0.122,0.404,0.637,1.0 ],
+ "lightmapBakeType":"Realtime",
+ "intensity":1.0,
+ "bounceIntensity":1.0,
+ "shadows":"Soft",
+ "shadowRadius":1.0,
+ "shadowAngle":0.0,
+ "shadowStrength":1.0,
+ "shadowResolution":"Low",
+ "shadowBias":0.004,
+ "shadowNormalBias":0.26,
+ "shadowNearPlane":0.1,
+ "renderMode":"Auto",
+ "cullingMask":-1
+ },
"right": {
"title": "Capsule1",
"author": "Izayoi Jiichan",
"organization": "",
"createdDate": "2020-01-01",
- "updatedDate": "2020-01-08",
- "version": "0.2",
+ "updatedDate": "2020-01-14",
+ "version": "0.3",
"distributionUrl": "",
"licenseUrl": ""
}
@@ -284,7 +336,7 @@ VGOファイルの中身を確認するためのツールです。
https://github.com/izayoijiichan/vgo.parameter.viewer
___
-最終更新日:2020年1月8日
+最終更新日:2020年1月14日
編集者:十六夜おじいちゃん
*Copyright (C) 2020 Izayoi Jiichan. All Rights Reserved.*
diff --git a/README.md b/README.md
index 5940842..49835cb 100644
--- a/README.md
+++ b/README.md
@@ -4,8 +4,8 @@ VGO is a 3D data format for Unity that can store Collider and Rigidbody informat
## Features
- glTF (GLB) 2.0 extended format.
-- Added extended definitions for Collider, Rigidbody and rights information to nodes.
-- Unity GameObject Transform, Rigidbody, Collider, PhysicMaterial, Mesh, Material, Texture can be saved.
+- Added extended definitions for Collider, Rigidbody, Light and rights information to nodes.
+- Unity GameObject Transform, Rigidbody, Collider, PhysicMaterial, Mesh, Material, Texture, Light can be saved.
___
## JSON schema of glTF
@@ -53,6 +53,7 @@ The following extended definitions are added:
|gameObject|GameObject information|
|colliders|Collider information|
|rigidbody|Rigid body information|
+|light|Light information|
|right|VGO rights information|
### glTF.materials.[*].extensions
@@ -69,8 +70,8 @@ ___
|definition name|description|type|fixed value|
|:---|:---|:---:|:---:|
|generatorName|The name of the generation tool.|string|UniVGO|
-|generatorVersion|The generation tool version.|string|0.4.0|
-|specVersion|VGO specification version.|string|0.2|
+|generatorVersion|The generation tool version.|string|0.5.0|
+|specVersion|VGO specification version.|string|0.3|
### vgo.right
@@ -94,10 +95,11 @@ ___
|tag|Tag attached to GameGbject.|string||Untagged|
|layer|The layer on which the GameObject is located.|int|[0, 31]|0|
-### node.vgo.collier
+### node.vgo.collider
|definition name|description|type|setting value|Box|Capsule|Sphere|
|:---|:---|:---:|:---:|:---:|:---:|:---:|
+|enabled|Whether the collider is enable.|bool|true / false|*|*|*|
|type|The type of collider.|string|Box / Capsule / Sphere|*|*|*|
|isTrigger|Whether the collider is a trigger.|bool|true / false|*|*|*|
|center|The center of the collider.(Unit is m)|float[3]|[x, y, z]|*|*|*|
@@ -124,12 +126,40 @@ ___
|mass|The mass of the object. (Unit is kg)|float|[0.0000001, 1000000000]|
|drag|The amount of air resistance that affects an object when it is moved by force.|float|[0.0, infinity]|
|angularDrag|The amount of air resistance that affects the object when rotating by torque.|float|[0.0, infinity]|
-|useGravity|Whether the object is affected by gravity.|boolean|true / false|
-|isKinematic|Whether physics affects the rigid body.|boolean|true / false|
+|useGravity|Whether the object is affected by gravity.|bool|true / false|
+|isKinematic|Whether physics affects the rigid body.|bool|true / false|
|interpolation|The type of completion.|string|None / Interpolate / Extrapolate|
|collisionDetectionMode|Collision detection mode.|string|Discrete / Continuous / ContinuousDynamic / ContinuousSpeculative|
|constraints|The flags that restricts the movement of the rigid body.|int|FreesePositionX(2) \| FreesePositionY(4) \| FreesePositionZ(8) \| FreeseRotationX(16) \| FreeseRotationY(32) \| FreeseRotationZ(64)|
+### node.vgo.light
+
+|definition name|description|type|setting value|default value|Spot|Directional|Point|Rectangle|Disc|
+|:---|:---|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|
+|enabled|Whether the light is enable.|bool|true / false|true|*|*|*|*|*|
+|type|The type of the light.|string|Spot / Directional / Point / Rectangle / Disc|Spot|*|*|*|*|*|
+|shape|This property describes the shape of the spot light.|string|Cone / Pyramid / Box|Cone|*|-|-|-|-|
+|range|The range of the light.|float|[0, infinity]||*|-|*|*|*|
+|spotAngle|The angle of the light's spotlight cone in degrees.|float|[0, infinity]||*|-|-|-|-|
+|areaSize|The size of the area light.|float[2]|x, y||-|-|-|*|-|
+|areaRadius|The radius of the area light|float|[0, infinity]||-|-|-|-|*|
+|color|The color of the light.|float[4]|r, g, b, a||*|*|*|*|*|
+|lightmapBakeType|This property describes what part of a light's contribution can be baked.|string|Baked / Realtime / Mixed||*|*|*|*|*|
+|intensity|The Intensity of a light is multiplied with the Light color.|float|[0, infinity]||*|*|*|*|*|
+|bounceIntensity|The multiplier that defines the strength of the bounce lighting.|float|[0, infinity]||*|*|*|*|*|
+|shadows|How this light casts shadows.|string|None / Hard / Soft|None|*|*|*|*|*|
+|shadowRadius|Controls the amount of artificial softening applied to the edges of shadows cast by the Point or Spot light.|float|[0, infinity]||*|-|*|-|-|
+|shadowAngle|Controls the amount of artificial softening applied to the edges of shadows cast by directional lights.|float|[0, infinity]||-|*|-|-|-|
+|shadowStrength|Strength of light's shadows.|float|[0, infinity]||-|*|*|-|-|
+|shadowResolution|The resolution of the shadow map.|string|FromQualitySettings / Low / Medium / High / VeryHigh|FromQualitySettings|-|*|*|-|-|
+|shadowBias|Shadow mapping constant bias.|float|[0, infinity]||-|*|*|-|-|
+|shadowNormalBias|Shadow mapping normal-based bias.|float|[0, infinity]||-|*|*|-|-|
+|shadowNearPlane|Near plane value to use for shadow frustums.|float|[0, infinity]||-|*|*|-|-|
+|renderMode|How to render the light.|string|Auto / ForcePixel / ForceVertex|Auto|*|*|*|*|*|
+|cullingMask|This is used to light certain objects in the Scene selectively.|int|[-1, infinity]|-1 (Everything)|*|*|*|*|*|
+
+Cookie, Flare, Halo are not supported.
+
___
## Example of glTF JSON structure
@@ -155,16 +185,16 @@ JSON{
"VGO": {
"meta": {
"generatorName": "UniVGO",
- "generatorVersion": "0.4.0",
- "specVersion": "0.2"
+ "generatorVersion": "0.5.0",
+ "specVersion": "0.3"
},
"right": {
"title": "Test Stage",
"author": "Izayoi Jiichan",
"organization": "Izayoi",
"createdDate": "2020-01-01",
- "updatedDate": "2020-01-08",
- "version": "1.1",
+ "updatedDate": "2020-01-14",
+ "version": "1.2",
"distributionUrl": "https://github.com/izayoijiichan/VGO",
"licenseUrl": "https://github.com/izayoijiichan/VGO/blob/master/UniVgo/LICENSE.md"
}
@@ -194,8 +224,8 @@ JSON{
},
"colliders": [
{
- "type": "Capsule",
"enabled": false,
+ "type": "Capsule",
"isTrigger": false,
"center": [ 0, 0, 0 ],
"radius": 0.5,
@@ -220,13 +250,36 @@ JSON{
"collisionDetectionMode": "Discrete",
"constraints": 36
},
+ "light":{
+ "enabled":true,
+ "type":"Point",
+ "shape":"",
+ "range":1.0,
+ "spotAngle":0.0,
+ "areaSize":0.0,
+ "areaRadius":0.0,
+ "color":[ 0.122,0.404,0.637,1.0 ],
+ "lightmapBakeType":"Realtime",
+ "intensity":1.0,
+ "bounceIntensity":1.0,
+ "shadows":"Soft",
+ "shadowRadius":1.0,
+ "shadowAngle":0.0,
+ "shadowStrength":1.0,
+ "shadowResolution":"Low",
+ "shadowBias":0.004,
+ "shadowNormalBias":0.26,
+ "shadowNearPlane":0.1,
+ "renderMode":"Auto",
+ "cullingMask":-1
+ },
"right": {
"title": "Capsule1",
"author": "Izayoi Jiichan",
"organization": "",
"createdDate": "2020-01-01",
- "updatedDate": "2020-01-08",
- "version": "0.2",
+ "updatedDate": "2020-01-14",
+ "version": "0.3",
"distributionUrl": "",
"licenseUrl": ""
}
@@ -282,7 +335,7 @@ It is distributed at the following URL.
https://github.com/izayoijiichan/vgo.parameter.viewer
___
-Last updated: 8 January, 2020
+Last updated: 14 January, 2020
Editor: Izayoi Jiichan
*Copyright (C) 2020 Izayoi Jiichan. All Rights Reserved.*
diff --git a/UniGLTFforUniVgo/Runtime/Schema/Extensions/glTFNode_VGO.cs b/UniGLTFforUniVgo/Runtime/Schema/Extensions/glTFNode_VGO.cs
index 0bee097..64de5ff 100644
--- a/UniGLTFforUniVgo/Runtime/Schema/Extensions/glTFNode_VGO.cs
+++ b/UniGLTFforUniVgo/Runtime/Schema/Extensions/glTFNode_VGO.cs
@@ -27,6 +27,10 @@ public class glTFNode_VGO
[JsonProperty("rigidbody")]
public glTFNode_VGO_Rigidbody rigidbody = null;
+ /// Light
+ [JsonProperty("light")]
+ public glTFNode_VGO_Light light = null;
+
/// Right
[JsonProperty("right")]
public glTF_VGO_Right right = null;
diff --git a/UniGLTFforUniVgo/Runtime/Schema/Extensions/glTFNode_VGO_Collider.cs b/UniGLTFforUniVgo/Runtime/Schema/Extensions/glTFNode_VGO_Collider.cs
index 147fcc2..c631983 100644
--- a/UniGLTFforUniVgo/Runtime/Schema/Extensions/glTFNode_VGO_Collider.cs
+++ b/UniGLTFforUniVgo/Runtime/Schema/Extensions/glTFNode_VGO_Collider.cs
@@ -27,15 +27,15 @@ public enum ColliderType
[JsonObject("node.vgo.collider")]
public class glTFNode_VGO_Collider
{
- /// Type
- [JsonProperty("type", Required = Required.Always)]
- public ColliderType type = default;
-
/// Enabled
[JsonProperty("enabled", DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate)]
[DefaultValue(true)]
public bool enabled = false;
+ /// Type
+ [JsonProperty("type", Required = Required.Always)]
+ public ColliderType type = default;
+
/// Is Trigger
[JsonProperty("isTrigger")]
public bool isTrigger = false;
diff --git a/UniGLTFforUniVgo/Runtime/Schema/Extensions/glTFNode_VGO_Light.cs b/UniGLTFforUniVgo/Runtime/Schema/Extensions/glTFNode_VGO_Light.cs
new file mode 100644
index 0000000..6293828
--- /dev/null
+++ b/UniGLTFforUniVgo/Runtime/Schema/Extensions/glTFNode_VGO_Light.cs
@@ -0,0 +1,146 @@
+// ----------------------------------------------------------------------
+// @Namespace : UniGLTFforUniVgo
+// @Class : glTFNode_VGO_Light
+// ----------------------------------------------------------------------
+namespace UniGLTFforUniVgo
+{
+ using Newtonsoft.Json;
+ using System;
+ using System.ComponentModel;
+ using UnityEngine;
+ using UnityEngine.Rendering;
+
+ ///
+ /// glTF Node VGO Light
+ ///
+ [Serializable]
+ public class glTFNode_VGO_Light
+ {
+ /// Enabled
+ [JsonProperty("enabled", DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate)]
+ [DefaultValue(true)]
+ public bool enabled = false;
+
+ ///
+ [JsonProperty("type", Required = Required.Always)]
+ public LightType type = LightType.Spot;
+
+ /// Shape
+ [JsonProperty("shape", DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate)]
+ [DefaultValue(LightShape.Cone)]
+ public LightShape shape = LightShape.Cone;
+
+ /// Range
+ [JsonProperty("range", DefaultValueHandling = DefaultValueHandling.Ignore)]
+ [DefaultValue(-1.0f)]
+ public float range = -1.0f;
+
+ /// Spot Angle
+ [JsonProperty("spotAngle", DefaultValueHandling = DefaultValueHandling.Ignore)]
+ [DefaultValue(-1.0f)]
+ public float spotAngle = -1.0f;
+
+ /// Area Size
+ [JsonProperty("areaSize")]
+ public float[] areaSize = null;
+
+ /// Area Radius
+ [JsonProperty("areaRadius", DefaultValueHandling = DefaultValueHandling.Ignore)]
+ [DefaultValue(-1.0f)]
+ public float areaRadius = -1.0f;
+
+ /// Color
+ [JsonProperty("color")]
+ public float[] color = null;
+
+ /// Lightmap Bake Type
+ [JsonProperty("lightmapBakeType", Required = Required.Always)]
+ public LightmapBakeType lightmapBakeType;
+
+ /// Intensity
+ [JsonProperty("intensity", DefaultValueHandling = DefaultValueHandling.Populate)]
+ [DefaultValue(0.0f)]
+ public float intensity = 0.0f;
+
+ /// Bounce Intensity
+ [JsonProperty("bounceIntensity", DefaultValueHandling = DefaultValueHandling.Populate)]
+ [DefaultValue(0.0f)]
+ public float bounceIntensity = 0.0f;
+
+ ///// Cast Shadows
+ //[JsonProperty("castShadows")]
+ //public bool castShadows = false;
+
+ /// Shadows
+ [JsonProperty("shadows", DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate)]
+ [DefaultValue(LightShadows.None)]
+ public LightShadows shadows = LightShadows.None;
+
+ // Baked Shadows
+
+ /// Shadow Radius
+ [JsonProperty("shadowRadius", DefaultValueHandling = DefaultValueHandling.Ignore)]
+ [DefaultValue(-1.0f)]
+ public float shadowRadius = -1.0f;
+
+ /// Shadow Angle
+ [JsonProperty("shadowAngle", DefaultValueHandling = DefaultValueHandling.Ignore)]
+ [DefaultValue(-1.0f)]
+ public float shadowAngle = -1.0f;
+
+ // Realtime Shadows
+
+ /// Shadow Strength
+ [JsonProperty("shadowStrength", DefaultValueHandling = DefaultValueHandling.Ignore)]
+ [DefaultValue(-1.0f)]
+ public float shadowStrength = -1.0f;
+
+ /// Shadow Resolution
+ [JsonProperty("shadowResolution", DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate)]
+ [DefaultValue(LightShadowResolution.FromQualitySettings)]
+ public LightShadowResolution shadowResolution = LightShadowResolution.FromQualitySettings;
+
+ /// Shadow Bias
+ [JsonProperty("shadowBias", DefaultValueHandling = DefaultValueHandling.Ignore)]
+ [DefaultValue(-1.0f)]
+ public float shadowBias = -1.0f;
+
+ /// Shadow Normal Bias
+ [JsonProperty("shadowNormalBias", DefaultValueHandling = DefaultValueHandling.Ignore)]
+ [DefaultValue(-1.0f)]
+ public float shadowNormalBias = -1.0f;
+
+ /// Shadow Near Plane
+ [JsonProperty("shadowNearPlane", DefaultValueHandling = DefaultValueHandling.Ignore)]
+ [DefaultValue(-1.0f)]
+ public float shadowNearPlane = -1.0f;
+
+ ///// Cookie
+ //[JsonProperty("cookie")]
+ //public Texture cookie = null;
+
+ ///// Cookie Size
+ //[JsonProperty("cookieSize", DefaultValueHandling = DefaultValueHandling.Ignore)]
+ //[DefaultValue(-1.0f)]
+ //public float cookieSize = -1.0f;
+
+ ///// Draw Halo
+ //[JsonProperty("drawHalo")]
+ //public bool drawHalo = false;
+
+ ///// Flare
+ //[JsonProperty("flare")]
+ //public Flare flare = null;
+
+ /// Render Mode
+ [JsonProperty("renderMode", DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate)]
+ [DefaultValue(LightRenderMode.Auto)]
+ public LightRenderMode renderMode = LightRenderMode.Auto;
+
+ /// Culling Mask
+ /// 0: None, -1: Everything
+ [JsonProperty("cullingMask", DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate)]
+ [DefaultValue(-1)]
+ public int cullingMask = -1;
+ }
+}
diff --git a/UniGLTFforUniVgo/Runtime/Schema/Extensions/glTFNode_VGO_Light.cs.meta b/UniGLTFforUniVgo/Runtime/Schema/Extensions/glTFNode_VGO_Light.cs.meta
new file mode 100644
index 0000000..332a0e2
--- /dev/null
+++ b/UniGLTFforUniVgo/Runtime/Schema/Extensions/glTFNode_VGO_Light.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: ab4d2b5ea1541374a894390be021fdc4
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/UniGLTFforUniVgo/Runtime/Serialization/VgoContractResolver.cs b/UniGLTFforUniVgo/Runtime/Serialization/VgoContractResolver.cs
index 4d171b3..87d0c7a 100644
--- a/UniGLTFforUniVgo/Runtime/Serialization/VgoContractResolver.cs
+++ b/UniGLTFforUniVgo/Runtime/Serialization/VgoContractResolver.cs
@@ -8,6 +8,7 @@ namespace UniGLTFforUniVgo
using Newtonsoft.Json.Serialization;
using System;
using UnityEngine;
+ using UnityEngine.Rendering;
///
/// VGO Contract Resolver
@@ -25,6 +26,12 @@ protected override JsonContract CreateContract(Type objectType)
if ((objectType == typeof(ColliderType)) ||
(objectType == typeof(CollisionDetectionMode)) ||
+ (objectType == typeof(LightmapBakeType)) ||
+ (objectType == typeof(LightRenderMode)) ||
+ (objectType == typeof(LightShadowResolution)) ||
+ (objectType == typeof(LightShadows)) ||
+ (objectType == typeof(LightShape)) ||
+ (objectType == typeof(LightType)) ||
(objectType == typeof(PhysicMaterialCombine)) ||
(objectType == typeof(RigidbodyInterpolation)))
{
diff --git a/UniVgo/README.ja.md b/UniVgo/README.ja.md
index 6cf2554..12199bc 100644
--- a/UniVgo/README.ja.md
+++ b/UniVgo/README.ja.md
@@ -27,7 +27,7 @@ ___
|パッケージ名|所有者|リポジトリー|仕様バージョン|プログラム バージョン|リリース日|
|:---:|:---:|:---:|:---:|:---:|:---:|
|newtonsoft-json-for-unity|jillejr|GitHub|12.0.2|12.0.201|2020年1月4日|
-|UniVGO|IzayoiJiichan|GitHub| VGO 0.2|0.4.0|2020年1月8日|
+|UniVGO|IzayoiJiichan|GitHub| VGO 0.3|0.5.0|2020年1月14日|
___
## インストール
@@ -79,7 +79,7 @@ AまたはBのいずれかを行ってください。
{
"dependencies": {
"com.unity.ugui": "1.0.0",
- "izayoi.univgo": "https://github.com/izayoijiichan/VGO.git#v0.4.0",
+ "izayoi.univgo": "https://github.com/izayoijiichan/VGO.git#v0.5.0",
"jillejr.newtonsoft.json-for-unity": "12.0.201",
"com.unity.modules.ai": "1.0.0",
...
@@ -100,7 +100,7 @@ https://github.com/izayoijiichan/VGO/releases
```
Packages
- izayoi.univgo@0.4.0-preview
+ izayoi.univgo@0.5.0-preview
DepthFirstScheduler
ShaderProperty
UniGLTFforUniVgo
@@ -126,8 +126,8 @@ VGO のメタ情報です。
|定義名|説明|型|固定値|
|:---|:---|:---:|:---:|
|Generator Name|生成ツールの名前です。|string|UniVGO|
-|Generator Version|生成ツールのバージョンです。|string|0.4.0|
-|Spec Version|VGOの仕様バージョンです。|string|0.2|
+|Generator Version|生成ツールのバージョンです。|string|0.5.0|
+|Spec Version|VGOの仕様バージョンです。|string|0.3|
- Root の GameObject に1つ付与しておく必要があります。
- ユーザーが設定可能な項目はありません。
@@ -166,6 +166,13 @@ Box, Capsule, Sphere タイプに対応しています。
詳細は Unity 公式のマニュアルをご覧ください。
+### Light
+
+ライトの設定です。
+1つの GameObject に対し1つまで付与することが可能です。
+
+詳細は Unity 公式のマニュアルをご覧ください。
+
___
## Shader
@@ -320,6 +327,11 @@ ___
GameObject の`tag`は、取り込みを行う際、予め UnityEditor にてタグの定義を追加しておく必要があります。
また、ランタイムロードを行う場合も同様です。
+### ライトについて
+
+Cookie, Flare, Halo は対象外です。
+また、ランタイムロードを行う場合、Realtime 設定のみ描画され、Baked は反映されません。
+
___
## VGO の仕様について
@@ -336,7 +348,7 @@ Unityを開発してくださっている Unity Technologies 様、
この場を借りて御礼申し上げます。
___
-最終更新日:2020年1月8日
+最終更新日:2020年1月14日
編集者:十六夜おじいちゃん
*Copyright (C) 2020 Izayoi Jiichan. All Rights Reserved.*
diff --git a/UniVgo/README.md b/UniVgo/README.md
index dd472c1..5b3966e 100644
--- a/UniVgo/README.md
+++ b/UniVgo/README.md
@@ -27,7 +27,7 @@ As of the start of 2020, we are developing and confirming in `Unity 2019.3` Wind
|package name|owner|Repository|specification version|program version|release date|
|:---:|:---:|:---:|:---:|:---:|:---:|
|newtonsoft-json-for-unity|jillejr|GitHub|12.0.2|12.0.201|4 Jan, 2020|
-|UniVGO|IzayoiJiichan|GitHub| VGO 0.2|0.4.0|8 Jan, 2020|
+|UniVGO|IzayoiJiichan|GitHub| VGO 0.3|0.5.0|14 Jan, 2020|
___
## Install
@@ -76,7 +76,7 @@ Write the following in `/Packages/package.json`
{
"dependencies": {
"com.unity.ugui": "1.0.0",
- "izayoi.univgo": "https://github.com/izayoijiichan/VGO.git#v0.4.0",
+ "izayoi.univgo": "https://github.com/izayoijiichan/VGO.git#v0.5.0",
"jillejr.newtonsoft.json-for-unity": "12.0.201",
"com.unity.modules.ai": "1.0.0",
...
@@ -97,7 +97,7 @@ Unzip the file and place it in the `Packages` folder.
```
Packages
- izayoi.univgo@0.4.0-preview
+ izayoi.univgo@0.5.0-preview
DepthFirstScheduler
ShaderProperty
UniGLTFforUniVgo
@@ -123,8 +123,8 @@ Meta information of VGO.
|definition name|description|type|fixed value|
|:---|:---|:---:|:---:|
|Generator Name|The name of the generation tool.|string|UniVGO|
-|Generator Version|The generation tool version.|string|0.4.0|
-|Spec Version|VGO specification version.|string|0.2|
+|Generator Version|The generation tool version.|string|0.5.0|
+|Spec Version|VGO specification version.|string|0.3|
- It is necessary to give one to Root GameObject.
- There are no user configurable items.
@@ -158,7 +158,14 @@ See the official Unity manual for details.
### Rigidbody
-This is a setting for controlling an object by physical characteristics.。
+This is a setting for controlling an object by physical characteristics.
+It is possible to add up to one for each GameObject.
+
+See the official Unity manual for details.
+
+### Light
+
+This is a setting for light.
It is possible to add up to one for each GameObject.
See the official Unity manual for details.
@@ -304,21 +311,26 @@ When the package is installed in the project, the script is automatically compil
|DepthFirstScheduler|Depth first scheduler|*|*|
|ShaderProperty.Runtime|Shader property information|*|*|
|UniGLTFforUniVgo|UniGLTF for UniVGO|*|*|
-|UniUnlit|Unlit shader unitlity|-|-|
-|UniUnlit.Editor|Unlit shader unitlity|-|*|
+|UniUnlit|Unlit shader utility|-|-|
+|UniUnlit.Editor|Unlit shader utility|-|*|
|UniVgo|VGO main program|*|*|
|UniVgo.Editor|VGO import / export|-|*|
- For each of UniVgo, and UniVgo.Editor, * is attached to the dependent DLL.
- DepthFirstScheduler, ShaderProperty, UniUnlit is a program packed in UniVRM (© vrm-c).
- When using UniVRM and UniVGO together, it is necessary to delete the duplicate files (DepthFirstScheduler, ShaderProperty, UniUnlit) that were packed when UniVgo was obtained.
- Also, if the error is displayed by UniVgo, please move UniVgo, UniGLTFforUniVgo to the` Assets` folder.
+ Also, if the error is displayed by UniVgo, please move UniVgo, UniGLTFforUniVgo to the `Assets` folder.
### About GameObject tags
When importing GameObject `tag`, it is necessary to add tag definitions in UnityEditor in advance.
The same applies when performing runtime loading.
+### About light
+
+Cookie, Flare, Halo are not supported.
+In addition, when performing runtime loading, only the Realtime setting is drawn, and Baked is not reflected.
+
___
## About VGO specifications
@@ -335,7 +347,7 @@ Unity Technologies, who is developing Unity, and other related people.
I would like to take this opportunity to thank you.
___
-Last updated: 8 January, 2020
+Last updated: 14 January, 2020
Editor: Izayoi Jiichan
*Copyright (C) 2020 Izayoi Jiichan. All Rights Reserved.*
diff --git a/UniVgo/Runtime/Converters/ArrayConverter.cs b/UniVgo/Runtime/Converters/ArrayConverter.cs
new file mode 100644
index 0000000..3274352
--- /dev/null
+++ b/UniVgo/Runtime/Converters/ArrayConverter.cs
@@ -0,0 +1,104 @@
+// ----------------------------------------------------------------------
+// @Namespace : UniVgo
+// @Class : ArrayConverter
+// ----------------------------------------------------------------------
+namespace UniVgo
+{
+ using UniGLTFforUniVgo;
+ using UnityEngine;
+
+ ///
+ /// Array Converter
+ ///
+ public static class ArrayConverter
+ {
+ ///
+ /// Convert float[3] or float[4] to Color.
+ ///
+ ///
+ ///
+ ///
+ public static Color ToColor(float[] values, bool gamma = false)
+ {
+ if (values == null)
+ {
+ return default;
+ }
+
+ Color color;
+
+ if (values.Length == 3)
+ {
+ color = new Color(values[0], values[1], values[2]);
+ }
+ else if (values.Length == 4)
+ {
+ color = new Color(values[0], values[1], values[2], values[3]);
+
+ }
+ else
+ {
+ color = default;
+ }
+
+ if (gamma)
+ {
+ return color.gamma;
+ }
+ else
+ {
+ return color;
+ }
+ }
+
+ ///
+ /// Convert float[2] to Vector2.
+ ///
+ ///
+ ///
+ public static Vector2 ToVector2(float[] values)
+ {
+ if (values == null)
+ {
+ return default;
+ }
+
+ if (values.Length == 2)
+ {
+ return new Vector2(values[0], values[1]);
+ }
+
+ return default;
+ }
+
+ ///
+ /// Convert float[3] to Vector3.
+ ///
+ ///
+ ///
+ ///
+ public static Vector3 ToVector3(float[] values, bool reverseZ = false)
+ {
+ if (values == null)
+ {
+ return default;
+ }
+
+ if (values.Length == 3)
+ {
+ Vector3 vecter3 = new Vector3(values[0], values[1], values[2]);
+
+ if (reverseZ)
+ {
+ return vecter3.ReverseZ();
+ }
+ else
+ {
+ return vecter3;
+ }
+ }
+
+ return default;
+ }
+ }
+}
\ No newline at end of file
diff --git a/UniVgo/Runtime/Converters/ArrayConverter.cs.meta b/UniVgo/Runtime/Converters/ArrayConverter.cs.meta
new file mode 100644
index 0000000..b2c2ec7
--- /dev/null
+++ b/UniVgo/Runtime/Converters/ArrayConverter.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 4b27b661cbe8f724ca0a13ae6d0c2f7c
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/UniVgo/Runtime/Converters/VgoColliderConverter.cs b/UniVgo/Runtime/Converters/VgoColliderConverter.cs
index e30743e..225a84c 100644
--- a/UniVgo/Runtime/Converters/VgoColliderConverter.cs
+++ b/UniVgo/Runtime/Converters/VgoColliderConverter.cs
@@ -104,8 +104,8 @@ public static void SetComponentValue(Collider collider, glTFNode_VGO_Collider vg
{
boxCollider.enabled = vgoCollider.enabled;
boxCollider.isTrigger = vgoCollider.isTrigger;
- boxCollider.center = ConvertToVector3(vgoCollider.center, reverseZ: true);
- boxCollider.size = ConvertToVector3(vgoCollider.size);
+ boxCollider.center = ArrayConverter.ToVector3(vgoCollider.center, reverseZ: true);
+ boxCollider.size = ArrayConverter.ToVector3(vgoCollider.size);
boxCollider.sharedMaterial = VgoPhysicMaterialConverter.ToPhysicMaterial(vgoCollider.physicMaterial);
}
}
@@ -117,7 +117,7 @@ public static void SetComponentValue(Collider collider, glTFNode_VGO_Collider vg
{
capsuleCollider.enabled = vgoCollider.enabled;
capsuleCollider.isTrigger = vgoCollider.isTrigger;
- capsuleCollider.center = ConvertToVector3(vgoCollider.center, reverseZ: true);
+ capsuleCollider.center = ArrayConverter.ToVector3(vgoCollider.center, reverseZ: true);
capsuleCollider.radius = vgoCollider.radius;
capsuleCollider.height = vgoCollider.height;
capsuleCollider.direction = vgoCollider.direction;
@@ -132,41 +132,11 @@ public static void SetComponentValue(Collider collider, glTFNode_VGO_Collider vg
{
sphereCollider.enabled = vgoCollider.enabled;
sphereCollider.isTrigger = vgoCollider.isTrigger;
- sphereCollider.center = ConvertToVector3(vgoCollider.center, reverseZ: true);
+ sphereCollider.center = ArrayConverter.ToVector3(vgoCollider.center, reverseZ: true);
sphereCollider.radius = vgoCollider.radius;
sphereCollider.sharedMaterial = VgoPhysicMaterialConverter.ToPhysicMaterial(vgoCollider.physicMaterial);
}
}
}
-
- ///
- /// Convert float[3] to Vector3.
- ///
- ///
- ///
- ///
- private static Vector3 ConvertToVector3(float[] values, bool reverseZ = false)
- {
- if (values == null)
- {
- return default;
- }
-
- if (values.Length == 3)
- {
- Vector3 vecter3 = new Vector3(values[0], values[1], values[2]);
-
- if (reverseZ)
- {
- return vecter3.ReverseZ();
- }
- else
- {
- return vecter3;
- }
- }
-
- return default;
- }
}
}
\ No newline at end of file
diff --git a/UniVgo/Runtime/Converters/VgoLightConverter.cs b/UniVgo/Runtime/Converters/VgoLightConverter.cs
new file mode 100644
index 0000000..f3a29aa
--- /dev/null
+++ b/UniVgo/Runtime/Converters/VgoLightConverter.cs
@@ -0,0 +1,227 @@
+// ----------------------------------------------------------------------
+// @Namespace : UniVgo
+// @Class : VgoLightConverter
+// ----------------------------------------------------------------------
+namespace UniVgo
+{
+ using UniGLTFforUniVgo;
+ using UnityEngine;
+
+ ///
+ /// VGO Light Converter
+ ///
+ public class VgoLightConverter
+ {
+ ///
+ /// Create glTFNode_VGO_Light from Light.
+ ///
+ ///
+ ///
+ public static glTFNode_VGO_Light CreateFrom(Light light)
+ {
+ if (light == null)
+ {
+ return null;
+ }
+
+ var vgoLight = new glTFNode_VGO_Light()
+ {
+ enabled = light.enabled,
+ type = light.type,
+ color = light.color.linear.ToArray(),
+ intensity = light.intensity,
+ bounceIntensity = light.bounceIntensity,
+ renderMode = light.renderMode,
+ cullingMask = light.cullingMask,
+ };
+
+ // Lightmap Bake Type
+#if UNITY_EDITOR
+ vgoLight.lightmapBakeType = light.lightmapBakeType;
+#else
+ switch (vgoLight.type)
+ {
+ case LightType.Spot:
+ case LightType.Directional:
+ case LightType.Point:
+ vgoLight.lightmapBakeType = LightmapBakeType.Realtime;
+ break;
+ case LightType.Rectangle:
+ case LightType.Disc:
+ vgoLight.lightmapBakeType = LightmapBakeType.Baked;
+ break;
+ default:
+ break;
+ }
+#endif
+ switch (light.type)
+ {
+ case LightType.Spot:
+ vgoLight.shape = light.shape;
+ vgoLight.range = light.range;
+ vgoLight.spotAngle = light.spotAngle;
+ break;
+ case LightType.Point:
+ vgoLight.range = light.range;
+ break;
+#if UNITY_EDITOR
+ case LightType.Rectangle:
+ vgoLight.areaSize = new float[2] { light.areaSize.x, light.areaSize.y };
+ break;
+ case LightType.Disc:
+ vgoLight.areaRadius = light.areaSize.x;
+ break;
+#endif
+ default:
+ break;
+ }
+
+ vgoLight.shadows = light.shadows;
+
+#if UNITY_EDITOR
+ // Baked Shadows
+ if ((light.lightmapBakeType == LightmapBakeType.Baked) ||
+ (light.lightmapBakeType == LightmapBakeType.Mixed))
+ {
+ if (light.shadows == LightShadows.Soft)
+ {
+ switch (light.type)
+ {
+ case LightType.Spot:
+ case LightType.Point:
+ vgoLight.shadowRadius = light.shadowRadius;
+ break;
+ case LightType.Directional:
+ vgoLight.shadowAngle = light.shadowAngle;
+ break;
+ default:
+ break;
+ }
+ }
+ }
+#endif
+
+ // Realtime Shadows
+#if UNITY_EDITOR
+ if ((light.lightmapBakeType == LightmapBakeType.Realtime) ||
+ (light.lightmapBakeType == LightmapBakeType.Mixed))
+#endif
+ {
+ if ((light.type == LightType.Directional) ||
+ (light.type == LightType.Point))
+ {
+ vgoLight.shadowStrength = light.shadowStrength;
+ vgoLight.shadowResolution = light.shadowResolution;
+ vgoLight.shadowBias = light.shadowBias;
+ vgoLight.shadowNormalBias = light.shadowNormalBias;
+ vgoLight.shadowNearPlane = light.shadowNearPlane;
+ }
+ }
+
+ return vgoLight;
+ }
+
+ ///
+ /// Set Light parameter.
+ ///
+ ///
+ ///
+ public static void SetComponentValue(Light light, glTFNode_VGO_Light vgoLight)
+ {
+ if (light == null)
+ {
+ return;
+ }
+
+ if (vgoLight == null)
+ {
+ return;
+ }
+
+ switch (vgoLight.type)
+ {
+ case LightType.Spot:
+ case LightType.Directional:
+ case LightType.Point:
+ case LightType.Rectangle:
+ case LightType.Disc:
+ break;
+ default:
+ return;
+ }
+
+ light.enabled = vgoLight.enabled;
+ light.type = vgoLight.type;
+ light.color = ArrayConverter.ToColor(vgoLight.color, gamma: true);
+ light.intensity = vgoLight.intensity;
+ light.bounceIntensity = vgoLight.bounceIntensity;
+ light.renderMode = vgoLight.renderMode;
+ light.cullingMask = vgoLight.cullingMask;
+
+#if UNITY_EDITOR
+ light.lightmapBakeType = vgoLight.lightmapBakeType;
+#endif
+
+ switch (vgoLight.type)
+ {
+ case LightType.Spot:
+ light.shape = vgoLight.shape;
+ light.range = vgoLight.range;
+ light.spotAngle = vgoLight.spotAngle;
+ break;
+ case LightType.Point:
+ light.range = vgoLight.range;
+ break;
+#if UNITY_EDITOR
+ case LightType.Rectangle:
+ light.areaSize = ArrayConverter.ToVector2(vgoLight.areaSize);
+ break;
+ case LightType.Disc:
+ light.areaSize = new Vector2(vgoLight.areaRadius, 1.0f);
+ break;
+#endif
+ default:
+ break;
+ }
+
+ light.shadows = vgoLight.shadows;
+
+#if UNITY_EDITOR
+ // Baked Shadows
+ if ((vgoLight.lightmapBakeType == LightmapBakeType.Baked) ||
+ (vgoLight.lightmapBakeType == LightmapBakeType.Mixed))
+ {
+ if (vgoLight.shadows == LightShadows.Soft)
+ {
+ switch (vgoLight.type)
+ {
+ case LightType.Spot:
+ case LightType.Point:
+ light.shadowRadius = vgoLight.shadowRadius;
+ break;
+ case LightType.Directional:
+ light.shadowAngle = vgoLight.shadowAngle;
+ break;
+ default:
+ break;
+ }
+ }
+ }
+#endif
+ // Realtime Shadows
+ if ((vgoLight.lightmapBakeType == LightmapBakeType.Realtime) ||
+ (vgoLight.lightmapBakeType == LightmapBakeType.Mixed))
+ {
+ if ((vgoLight.type == LightType.Directional) ||
+ (vgoLight.type == LightType.Point))
+ {
+ light.shadowStrength = vgoLight.shadowStrength;
+ light.shadowResolution = vgoLight.shadowResolution;
+ light.shadowBias = vgoLight.shadowBias;
+ light.shadowNormalBias = vgoLight.shadowNormalBias;
+ light.shadowNearPlane = vgoLight.shadowNearPlane;
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/UniVgo/Runtime/Converters/VgoLightConverter.cs.meta b/UniVgo/Runtime/Converters/VgoLightConverter.cs.meta
new file mode 100644
index 0000000..b86f2cf
--- /dev/null
+++ b/UniVgo/Runtime/Converters/VgoLightConverter.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 9557d4e13246d694cadd00fe92666c9b
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/UniVgo/Runtime/IO/VgoExporter.cs b/UniVgo/Runtime/IO/VgoExporter.cs
index d8fe760..398452a 100644
--- a/UniVgo/Runtime/IO/VgoExporter.cs
+++ b/UniVgo/Runtime/IO/VgoExporter.cs
@@ -152,6 +152,14 @@ protected virtual void SetGltfNodeExtensions(glTFNode gltfNode, GameObject srcNo
existsData = true;
}
+ // vgo.light
+ if (srcNode.TryGetComponentEx(out Light light))
+ {
+ nodeVgo.light = VgoLightConverter.CreateFrom(light);
+
+ existsData = true;
+ }
+
// vgo.right
if (srcNode.TryGetComponentEx(out VgoRight vgoRight))
{
diff --git a/UniVgo/Runtime/IO/VgoImporter.cs b/UniVgo/Runtime/IO/VgoImporter.cs
index 39ff9c9..584d09b 100644
--- a/UniVgo/Runtime/IO/VgoImporter.cs
+++ b/UniVgo/Runtime/IO/VgoImporter.cs
@@ -92,6 +92,12 @@ protected virtual void SetupChildComponent(GameObject go, glTFNode gltfNode)
go.AddComponent(nodeVGO.rigidbody);
}
+ // Light
+ if (nodeVGO.light != null)
+ {
+ go.AddComponent(nodeVGO.light);
+ }
+
// VgoRight
if (nodeVGO.right != null)
{
diff --git a/UniVgo/Runtime/Utils/GameObjectExtension.cs b/UniVgo/Runtime/Utils/GameObjectExtension.cs
index 8ef8687..9f81699 100644
--- a/UniVgo/Runtime/Utils/GameObjectExtension.cs
+++ b/UniVgo/Runtime/Utils/GameObjectExtension.cs
@@ -140,6 +140,37 @@ public static Rigidbody AddComponent(this GameObject go, glTFNode_VGO_Rigidbo
return rigidbody;
}
+ ///
+ /// Adds a Light component to the game object.
+ ///
+ /// The type of the component to add.
+ ///
+ ///
+ /// Returns Light component.
+ /// Light is sealed class.
+ public static Light AddComponent(this GameObject go, glTFNode_VGO_Light vgoLight)
+ //where T : Light
+ {
+ if (typeof(T) != typeof(Light))
+ {
+ return null;
+ }
+
+ Light light = go.GetComponent();
+
+ if (light == null)
+ {
+ light = go.AddComponent();
+ }
+
+ if (vgoLight != null)
+ {
+ VgoLightConverter.SetComponentValue(light, vgoLight);
+ }
+
+ return light;
+ }
+
#endregion
#region TryGetComponent
diff --git a/UniVgo/Runtime/Vgo.cs b/UniVgo/Runtime/Vgo.cs
index 2eca13f..025d68f 100644
--- a/UniVgo/Runtime/Vgo.cs
+++ b/UniVgo/Runtime/Vgo.cs
@@ -13,6 +13,6 @@ public class Vgo
public const string Generator = "UniVGO";
/// Specification Version
- public const string SpecVersion = "0.2";
+ public const string SpecVersion = "0.3";
}
}
\ No newline at end of file
diff --git a/UniVgo/Runtime/VgoVersion.cs b/UniVgo/Runtime/VgoVersion.cs
index eed52b1..312c614 100644
--- a/UniVgo/Runtime/VgoVersion.cs
+++ b/UniVgo/Runtime/VgoVersion.cs
@@ -13,12 +13,12 @@ public class VgoVersion
public const int MAJOR = 0;
/// Minor
- public const int MINOR = 4;
+ public const int MINOR = 5;
/// Patch
public const int PATCH = 0;
/// Version
- public const string VERSION = "0.4.0";
+ public const string VERSION = "0.5.0";
}
}
diff --git a/package.json b/package.json
index 90f1629..35c8738 100644
--- a/package.json
+++ b/package.json
@@ -2,7 +2,7 @@
"name": "izayoi.univgo",
"displayName": "UniVGO",
"description": "UniVGO is a package that can handle VGO files in Unity.",
- "version": "0.4.0-preview",
+ "version": "0.5.0-preview",
"type": "tool",
"category": "",
"keywords": [