public void Bake_VertexWeights(apOptTransform rootTransform, apOptTransform targetTransform,
                                       apOptMesh targetMesh, List <apModifiedVertexWeight> modVertWeights)
        {
            _rootTransform   = rootTransform;
            _targetTransform = targetTransform;
            _targetMesh      = targetMesh;

            if (_targetMesh == null)
            {
                Debug.LogError("Vert Rig인데 Target Mesh가 Null");
                Debug.LogError("Target Transform [" + _targetTransform.transform.name + "]");
            }

            _nVertWeights = modVertWeights.Count;
            _vertWeights  = new apOptModifiedVertexWeight[_nVertWeights];
            for (int i = 0; i < _nVertWeights; i++)
            {
                apOptModifiedVertexWeight optModVertWeight = new apOptModifiedVertexWeight();
                apModifiedVertexWeight    srcModVertWeight = modVertWeights[i];
                optModVertWeight.Bake(srcModVertWeight);

                _vertWeights[i] = optModVertWeight;
            }

            _meshColor = Color.gray;
            _isVisible = true;
        }
示例#2
0
        //개선된 버전 19.5.23
        public void Link(apOptModifiedMesh_Physics modMeshPhysics,
                         apOptModifiedMeshSet modMeshSet,
                         apOptTransform optTransform,
                         apOptRenderVertex vertex)
        {
            //>>19.5.23 : 삭제 (불필요)
            //_modifiedMesh = modifiedMesh;
            //_mesh = mesh;
            _vertex       = vertex;
            _optTransform = optTransform;

            if (_linkedVertices == null)
            {
                _linkedVertices = new List <LinkedVertex>();
            }


            apOptMesh mesh = modMeshSet._targetMesh;

            //이미 Bake 되었으므로 바로 Link하면 된다.
            for (int i = 0; i < _linkedVertices.Count; i++)
            {
                LinkedVertex               linkedVert = _linkedVertices[i];
                apOptRenderVertex          renderVert = mesh.RenderVertices[linkedVert._vertIndex];
                apOptModifiedPhysicsVertex linkVert   = modMeshSet.SubModMesh_Physics._vertWeights[linkedVert._vertIndex];
                linkedVert.Link(renderVert, linkVert);
            }

            DampPhysicVertex();
        }
示例#3
0
 public void LinkMesh(apOptMesh optMesh)
 {
     if (!_linkedMeshes.Contains(optMesh))
     {
         _linkedMeshes.Add(optMesh);
     }
 }
        public void Bake_VertexRigs(apOptTransform rootTransform, apOptTransform targetTransform,
                                    apOptMesh targetMesh, List <apModifiedVertexRig> modVertRigs)
        {
            //_targetType = apModifiedMesh.TARGET_TYPE.VertexWithMeshTransform;

            _rootTransform   = rootTransform;
            _targetTransform = targetTransform;
            _targetMesh      = targetMesh;

            if (_targetMesh == null)
            {
                Debug.LogError("Vert Rig인데 Target Mesh가 Null");
                Debug.LogError("Target Transform [" + _targetTransform.transform.name + "]");
            }

            _nVertRigs = modVertRigs.Count;
            _vertRigs  = new apOptModifiedVertexRig[_nVertRigs];
            for (int i = 0; i < _nVertRigs; i++)
            {
                apOptModifiedVertexRig optModVertRig = new apOptModifiedVertexRig();
                apModifiedVertexRig    srcModVertRig = modVertRigs[i];
                optModVertRig.Bake(srcModVertRig, _targetMesh, _portrait);

                _vertRigs[i] = optModVertRig;
            }

            _meshColor = Color.gray;
            _isVisible = true;
        }
示例#5
0
            /// <summary>
            /// 기본 텍스쳐(_MainTex) 변경 요청. 기본값인 경우 요청을 초기화한다.
            /// </summary>
            /// <param name="texture"></param>
            public void RequestImage(Texture2D texture)
            {
                if (texture == _texture)
                {
                    //원래대로 돌아왔다.
                    _isRequested_Texture = false;
                }
                else
                {
                    _isRequested_Texture = true;
                }
                _material.SetTexture(_shaderID_MainTex, texture);

                apOptMesh curMesh = null;

                for (int i = 0; i < _linkedMeshes.Count; i++)
                {
                    curMesh = _linkedMeshes[i];
                    if (curMesh == null)
                    {
                        continue;
                    }

                    //각 메시의 Instanced Material도 Batch Material과 동일한 값을 가지도록 한다.
                    curMesh.SyncMaterialPropertyByBatch_Texture(texture);
                }
            }
        // Init - 값 넣기 (값복사)
        //--------------------------------------------
        //연동을 해주자 (apModifiedMesh에서 Init/Link 계열 함수)
        public void Bake_VertexMorph(apOptTransform rootTransform, apOptTransform targetTransform,
                                     apOptMesh targetMesh, List <apModifiedVertex> modVerts, Color meshColor, bool isVisible)
        {
            //_targetType = apModifiedMesh.TARGET_TYPE.VertexWithMeshTransform;

            _rootTransform   = rootTransform;
            _targetTransform = targetTransform;
            _targetMesh      = targetMesh;

            if (_targetMesh == null)
            {
                Debug.LogError("Vert Morph인데 Target Mesh가 Null");
                Debug.LogError("Target Transform [" + _targetTransform.transform.name + "]");
            }

            _nVerts   = modVerts.Count;
            _vertices = new apOptModifiedVertex[_nVerts];
            for (int i = 0; i < _nVerts; i++)
            {
                apOptModifiedVertex optModVert = new apOptModifiedVertex();
                apModifiedVertex    srcModVert = modVerts[i];
                optModVert.Bake(srcModVert, _targetMesh);

                _vertices[i] = optModVert;
            }

            _meshColor = meshColor;
            _isVisible = isVisible;
        }
示例#7
0
        //public void RefreshMaskedMesh()
        //{
        //	if(!_isMaskParent)
        //	{
        //		return;
        //	}

        //	for (int i = 0; i < 4; i++)
        //	{
        //		if (_subMeshes[i] == null || _subMeshes[i]._optMesh == null)
        //		{
        //			continue;
        //		}

        //		for (int iVert = 0; iVert < _subMeshes[i]._nVert; iVert++)
        //		{
        //			_vertPosList_ForMask[iVert + _subMeshes[i]._vertIndexOffset] =
        //				_transform.InverseTransformPoint(
        //						_subMeshes[i]._optMesh._transform.TransformPoint(
        //							_subMeshes[i]._optMesh._vertPositions_Updated[iVert]
        //						)
        //				);
        //		}
        //		if(i != 0)
        //		{
        //			_material.SetColor("_Color" + (i), _subMeshes[i].MeshColor);
        //			if (_subMeshes[i]._isVisible)
        //			{
        //				_material.SetColor("_BlendOpt" + (i), ShaderTypeColor[(int)_subMeshes[i]._optMesh._shaderType]);
        //			}
        //			else
        //			{
        //				_material.SetColor("_BlendOpt" + (i), ShaderTypeColor[0]);
        //			}
        //		}

        //	}

        //	_mesh.vertices = _vertPosList_ForMask;
        //}

        public void RefreshClippedMesh()
        {
            if (!_isMaskChild)
            {
                return;
            }
            apOptMesh targetMesh  = null;
            int       iVertOffset = 0;

            for (int i = 0; i < 2; i++)
            {
                if (i == 0)
                {
                    targetMesh  = _parentOptMesh;
                    iVertOffset = 0;
                }
                else
                {
                    targetMesh  = this;
                    iVertOffset = _nVertParent;
                }
                int nVert = targetMesh._nVert;
                for (int iVert = 0; iVert < nVert; iVert++)
                {
                    _vertPosList_ClippedMerge[iVert + iVertOffset] =
                        _transform.InverseTransformPoint(
                            targetMesh._transform.TransformPoint(
                                targetMesh._vertPositions_Updated[iVert]));
                }
            }

            _material.SetColor("_Color", MeshColor);
            _material.SetColor("_MaskColor", _parentOptMesh.MeshColor);
            _mesh.vertices = _vertPosList_ClippedMerge;
        }
示例#8
0
        //public void Init(int vertUniqueID, int vertIndex, apOptMesh mesh, Vector2 deltaPos)
        //{
        //	_vertUniqueID = vertUniqueID;
        //	_vertIndex = vertIndex;
        //	_mesh = mesh;
        //	_deltaPos = deltaPos;
        //}

        public void Bake(apModifiedVertex srcModVert, apOptMesh mesh)
        {
            _vertUniqueID = srcModVert._vertexUniqueID;
            _vertIndex    = srcModVert._vertIndex;
            _mesh         = mesh;
            _deltaPos     = srcModVert._deltaPos;
        }
示例#9
0
        //TODO : 물리 관련 지연 변수 추가 필요


        // Init
        //----------------------------------------------
        public apOptRenderVertex(apOptTransform parentTransform, apOptMesh parentMesh,
                                 int vertUniqueID, int vertIndex, Vector2 vertPosLocal,
                                 Vector2 vertUV, float zDepth)
        {
            _parentTransform = parentTransform;
            _parentMesh      = parentMesh;
            _uniqueID        = vertUniqueID;
            _index           = vertIndex;
            _pos_Local       = vertPosLocal;
            _uv     = vertUV;
            _zDepth = zDepth;


            //_pos3_Local = new Vector3(_pos_Local.x, _pos_Local.y, 0);
            //_pos3_Local.x = _pos_Local.x;
            //_pos3_Local.y = _pos_Local.y;
            //_pos3_Local.z = 0;

            _vertPos3_LocalUpdated.x = _pos_Local.x;
            _vertPos3_LocalUpdated.y = _pos_Local.y;
            _vertPos3_LocalUpdated.z = 0;

            _isCalculated = false;

            //_pos_Rigging = Vector2.zero;
            //_weight_Rigging = 0.0f;
            _matrix_Rigging = apMatrix3x3.identity;

            _matrix_MeshOrthoCorrection = apMatrix3x3.identity;
            _isMeshOrthoCorrection      = false;
        }
        //TODO : 물리 관련 지연 변수 추가 필요


        // Init
        //----------------------------------------------
        public apOptRenderVertex(apOptTransform parentTransform, apOptMesh parentMesh,
                                 int vertUniqueID, int vertIndex, Vector2 vertPosLocal,
                                 Vector2 vertUV)
        {
            _parentTransform = parentTransform;
            _parentMesh      = parentMesh;
            _uniqueID        = vertUniqueID;
            _index           = vertIndex;
            _pos_Local       = vertPosLocal;
            _uv = vertUV;


            //_pos3_Local = new Vector3(_pos_Local.x, _pos_Local.y, 0);
            //_pos3_Local.x = _pos_Local.x;
            //_pos3_Local.y = _pos_Local.y;
            //_pos3_Local.z = 0;

            _vertPos3_LocalUpdated.x = _pos_Local.x;
            _vertPos3_LocalUpdated.y = _pos_Local.y;
            _vertPos3_LocalUpdated.z = 0;

            _isCalculated = false;

            _pos_Rigging    = Vector2.zero;
            _weight_Rigging = 0.0f;
        }
示例#11
0
            public CameraRenderData(apOptMesh parentMesh, Camera camera, bool isDualRT
#if UNITY_2019_1_OR_NEWER
                                    , bool isEyeTextureSize
#endif
                                    )
            {
                _parentMesh = parentMesh;

                _camera             = camera;
                _multiCamController = null;
                _transform          = _camera.transform;

                _renderTexture   = null;
                _renderTexture_L = null;
                _renderTexture_R = null;
                _commandBuffer   = null;

                //_debugName = _parentMesh.name + " / " + _camera.name;

                _isDualRT = isDualRT;
#if UNITY_2019_1_OR_NEWER
                _isEyeTextureSize = isEyeTextureSize;
#endif

                _targetTexture = _camera.targetTexture;
                //Debug.LogWarning(">> Create : " + _debugName + " ( IsDual : " + _isDualRT + ")");
            }
示例#12
0
            /// <summary>
            /// 기본 색상(_Color) 변경 요청. 기본값인 경우 요청을 초기화한다.
            /// </summary>
            /// <param name="color"></param>
            public void RequestColor(Color color)
            {
                bool isGray = Mathf.Abs(color.r - 0.5f) < 0.004f &&
                              Mathf.Abs(color.g - 0.5f) < 0.004f &&
                              Mathf.Abs(color.b - 0.5f) < 0.004f &&
                              Mathf.Abs(color.a - 1.0f) < 0.004f;

                if (isGray)
                {
                    _isRequested_Color = false;
                    color = new Color(0.5f, 0.5f, 0.5f, 1.0f);
                }
                else
                {
                    _isRequested_Color = true;
                }

                _material.SetColor(_shaderID_Color, color);

                apOptMesh curMesh = null;

                for (int i = 0; i < _linkedMeshes.Count; i++)
                {
                    curMesh = _linkedMeshes[i];
                    if (curMesh == null)
                    {
                        continue;
                    }

                    //각 메시의 Instanced Material도 Batch Material과 동일한 값을 가지도록 한다.
                    curMesh.SyncMaterialPropertyByBatch_Color(color);
                }
            }
示例#13
0
            public ClippedMatMeshSet(apOptMaterialInfo matInfo, apOptMesh clippedMesh, Material clippedMaterial)
            {
                _matInfo     = matInfo;
                _clippedMesh = clippedMesh;

                //Reset용으로 등록 당시의 재질을 저장해야한다.
                //여기서 _MaskTex, _MaskTex_L, _MaskTex_R, _MaskScreenSpaceOffset은 복구해서는 안된다.
                _material_Original = new Material(clippedMaterial);
            }
        // Editor Functions
        //------------------------------------------------
        public void Bake(apPortrait portrait,         //apMeshGroup srcMeshGroup,
                         apOptTransform parentTransform,
                         apOptRootUnit rootUnit,
                         string name,
                         int transformID, int meshGroupUniqueID, apMatrix defaultMatrix,
                         bool isMesh, int level, int depth,
                         bool isVisible_Default,
                         Color meshColor2X_Default,
                         float zScale
                         )
        {
            _portrait          = portrait;
            _rootUnit          = rootUnit;
            _transformID       = transformID;
            _name              = name;
            _meshGroupUniqueID = meshGroupUniqueID;

            _parentTransform = parentTransform;

            _defaultMatrix = new apMatrix(defaultMatrix);
            _transform     = transform;

            _level = level;
            _depth = depth;

            _isVisible_Default   = isVisible_Default;
            _meshColor2X_Default = meshColor2X_Default;

            if (parentTransform != null)
            {
                _depth -= parentTransform._depth;
            }

            //이부분 실험 중
            //1. Default Matrix를 Transform에 적용하고, Modifier 계산에서는 제외하는 경우
            //결과 : Bake시에는 "Preview"를 위해서 DefaultMatrix 위치로 이동을 시키지만, 실행시에는 원점으로 이동시킨다.
            //_transform.localPosition = _defaultMatrix.Pos3 - new Vector3(0.0f, 0.0f, (float)_depth);
            //_transform.localRotation = Quaternion.Euler(0.0f, 0.0f, _defaultMatrix._angleDeg);
            //_transform.localScale = _defaultMatrix._scale;

            //2. Default Matrix를 Modifier에 포함시키고 Transform은 원점인 경우 (Editor와 동일)
            _transform.localPosition = -new Vector3(0.0f, 0.0f, (float)_depth * zScale);
            _transform.localRotation = Quaternion.identity;
            _transform.localScale    = Vector3.one;

            if (isMesh)
            {
                _unitType = UNIT_TYPE.Mesh;
            }
            else
            {
                _unitType = UNIT_TYPE.Group;
            }

            _childTransforms = null;
            _childMesh       = null;
        }
        public void Bake_MeshTransform(apOptTransform rootTransform, apOptTransform targetTransform,
                                       apOptMesh targetMesh, apMatrix transformMatrix, Color meshColor, bool isVisible)
        {
            //_targetType = apModifiedMesh.TARGET_TYPE.MeshTransformOnly;

            _rootTransform   = rootTransform;
            _targetTransform = targetTransform;
            _targetMesh      = targetMesh;

            _transformMatrix = new apMatrix(transformMatrix);
            _meshColor       = meshColor;
            _isVisible       = isVisible;
        }
        public void Link(apOptModifiedMesh modifiedMesh, apOptTransform optTransform, apOptMesh mesh, apOptRenderVertex vertex)
        {
            _modifiedMesh = modifiedMesh;
            _mesh         = mesh;
            _vertex       = vertex;
            _optTransform = optTransform;

            if (_physicParam != null)
            {
                _physicParam.Link(modifiedMesh, this);
            }

            DampPhysicVertex();
        }
示例#17
0
            /// <summary>
            /// 임의의 프로퍼티의 Vector 속성을 변경한다. 호출 즉시 항상 Batched Material을 사용하게 된다.
            /// </summary>
            public void RequestCustomVector4(Vector4 vec4Value, string propertyName)
            {
                _isRequested_Custom = true;                //<<항상 Request 사용 상태
                _material.SetVector(propertyName, vec4Value);

                apOptMesh curMesh = null;

                for (int i = 0; i < _linkedMeshes.Count; i++)
                {
                    curMesh = _linkedMeshes[i];
                    if (curMesh == null)
                    {
                        continue;
                    }

                    //각 메시의 Instanced Material도 Batch Material과 동일한 값을 가지도록 한다.
                    curMesh.SyncMaterialPropertyByBatch_CustomVector4(vec4Value, propertyName);
                }
            }
示例#18
0
            /// <summary>
            /// 임의의 프로퍼티의 텍스쳐 속성을 변경한다. 호출 즉시 항상 Batched Material을 사용하게 된다.
            /// </summary>
            public void RequestCustomImage(Texture2D texture, string propertyName)
            {
                _isRequested_Custom = true;                //<<항상 Request 사용 상태
                _material.SetTexture(propertyName, texture);

                apOptMesh curMesh = null;

                for (int i = 0; i < _linkedMeshes.Count; i++)
                {
                    curMesh = _linkedMeshes[i];
                    if (curMesh == null)
                    {
                        continue;
                    }

                    //각 메시의 Instanced Material도 Batch Material과 동일한 값을 가지도록 한다.
                    curMesh.SyncMaterialPropertyByBatch_CustomTexture(texture, propertyName);
                }
            }
示例#19
0
        public MaterialUnit GetMaterialUnit(int materialID, apOptMesh optMesh)
        {
            MaterialUnit result = _matUnits.Find(delegate(MaterialUnit a)
            {
                return(a._uniqueID == materialID);
            });

            if (result != null)
            {
                if (result._material == null)
                {
                    result.MakeMaterial();
                }

                result.LinkMesh(optMesh);

                return(result);
            }
            return(null);
        }
        // Functions
        //------------------------------------------------
        /// <summary>
        /// OptMesh -> PreRender 이벤트 등록
        /// </summary>
        /// <param name="optMesh"></param>
        /// <param name="preRenderEvent"></param>
        public void AddPreRenderEvent(apOptMesh optMesh, FUNC_MESH_PRE_RENDERED preRenderEvent)
        {
            if (_meshPreRenderedEvents == null)
            {
                _meshPreRenderedEvents = new Dictionary <apOptMesh, FUNC_MESH_PRE_RENDERED>();
            }

            if (!_meshPreRenderedEvents.ContainsKey(optMesh))
            {
                _meshPreRenderedEvents.Add(optMesh, preRenderEvent);
            }
            else
            {
                _meshPreRenderedEvents[optMesh] = preRenderEvent;
            }

            //Debug.Log("PreRenderEvent Added [" + optMesh.name + " > " + name + "]");

            _nEvent = _meshPreRenderedEvents.Count;
        }
示例#21
0
        //추가 19.10.28 : ClippedMesh는 따로 등록을 한다.
        public void LinkClippedMesh(apOptMesh clippedMesh, Material clippedMaterial)
        {
            if (_clippedMatUnits == null)
            {
                _clippedMatUnits = new List <ClippedMatMeshSet>();
            }
            if (_clippedMesh2MatUnits == null)
            {
                _clippedMesh2MatUnits = new Dictionary <apOptMesh, ClippedMatMeshSet>();
            }

            if (_clippedMesh2MatUnits.ContainsKey(clippedMesh))
            {
                return;
            }

            ClippedMatMeshSet clippedMatMeshSet = new ClippedMatMeshSet(clippedMesh.MaterialInfo, clippedMesh, clippedMaterial);

            _clippedMesh2MatUnits.Add(clippedMesh, clippedMatMeshSet);
            _clippedMatUnits.Add(clippedMatMeshSet);
        }
示例#22
0
        public bool Bake(apModifiedVertexRig srcModVert, apOptMesh mesh, apPortrait portrait)
        {
            _vertexUniqueID = srcModVert._vertexUniqueID;
            _vertIndex      = srcModVert._vertIndex;
            _mesh           = mesh;

            _weightPairs = new OptWeightPair[srcModVert._weightPairs.Count];

            for (int i = 0; i < srcModVert._weightPairs.Count; i++)
            {
                apModifiedVertexRig.WeightPair srcWeightPair = srcModVert._weightPairs[i];
                OptWeightPair optWeightPair = new OptWeightPair(srcWeightPair);
                optWeightPair.Link(portrait);

                _weightPairs[i] = optWeightPair;
            }



            return(true);
        }
        /// <summary>
        /// OptMesh -> PreRender 이벤트 삭제
        /// </summary>
        /// <param name="optMesh"></param>
        public void RemovePreRenderEvent(apOptMesh optMesh)
        {
            if (_meshPreRenderedEvents == null)
            {
                return;
            }

            //Debug.LogWarning("RemovePreRenderEvent [" + optMesh.name + "]");
            if (_meshPreRenderedEvents.ContainsKey(optMesh))
            {
                _meshPreRenderedEvents.Remove(optMesh);
            }

            _nEvent = _meshPreRenderedEvents.Count;
            if (_nEvent == 0)
            {
                //Debug.LogError("[" + name + "] Event is 0");
                _isDestroyed = true;
                Destroy(this);
            }
        }
示例#24
0
            /// <summary>
            /// 기본 텍스쳐(_MainTex) 변경 요청. 기본값인 경우 요청을 초기화한다.
            /// </summary>
            /// <param name="texture"></param>
            public void RequestImage(Texture2D texture)
            {
                //원래의 Texture였는지 확인한다.
                //Material Info를 사용하는지에 따라서 다른 조건문에서 처리
                Texture2D defaultTexture = null;

                if (IsUseMaterialInfo)
                {
                    defaultTexture = MaterialInfo._mainTex;
                }
                else
                {
                    defaultTexture = _texture;
                }

                if (texture == defaultTexture)
                {
                    //원래대로 돌아왔다.
                    _isRequested_Texture = false;
                }
                else
                {
                    _isRequested_Texture = true;
                }
                _material.SetTexture(_shaderID_MainTex, texture);

                apOptMesh curMesh = null;

                for (int i = 0; i < _linkedMeshes.Count; i++)
                {
                    curMesh = _linkedMeshes[i];
                    if (curMesh == null)
                    {
                        continue;
                    }

                    //각 메시의 Instanced Material도 Batch Material과 동일한 값을 가지도록 한다.
                    curMesh.SyncMaterialPropertyByBatch_Texture(texture);
                }
            }
示例#25
0
        // Init
        //--------------------------------------------
        public apOptCalculatedResultParam(apCalculatedResultParam.CALCULATED_VALUE_TYPE calculatedValueType,
                                          apCalculatedResultParam.CALCULATED_SPACE calculatedSpace,
                                          apOptModifierUnitBase linkedModifier,
                                          apOptTransform targetOptTranform,
                                          apOptMesh targetOptMesh,
                                          apOptBone targetBone,                                              //<<추가
                                          apOptParamSetGroupVertWeight weightedVertData)
        {
            _calculatedValueType = calculatedValueType;
            _calculatedSpace     = calculatedSpace;

            //TODO 여기서부터 작업하자
            _linkedModifier     = linkedModifier;
            _targetOptTransform = targetOptTranform;
            _targetOptMesh      = targetOptMesh;
            _targetBone         = targetBone;    //<<추가



            _weightedVertexData = weightedVertData;

            //Vertex 데이터가 들어간 경우 Vert 리스트를 만들어주자
            if ((int)(_calculatedValueType & apCalculatedResultParam.CALCULATED_VALUE_TYPE.VertexPos) != 0)
            {
                int nPos = 0;
                if (_targetOptMesh.LocalVertPositions != null)
                {
                    nPos = _targetOptMesh.LocalVertPositions.Length;
                }

                _result_Positions = new List <Vector2>();
                _tmp_Positions    = new List <Vector2>();
                for (int i = 0; i < nPos; i++)
                {
                    _result_Positions.Add(Vector2.zero);
                    _tmp_Positions.Add(Vector2.zero);
                }
            }
        }
示例#26
0
            /// <summary>
            /// 임의의 프로퍼티의 투명도 속성을 변경한다. 호출 즉시 항상 Batched Material을 사용하게 된다.
            /// </summary>
            public void RequestCustomAlpha(float alpha, string propertyName)
            {
                _isRequested_Custom = true;                //<<항상 Request 사용 상태
                Color curColor = _material.GetColor(propertyName);

                curColor.a = alpha;
                _material.SetColor(propertyName, curColor);

                apOptMesh curMesh = null;

                for (int i = 0; i < _linkedMeshes.Count; i++)
                {
                    curMesh = _linkedMeshes[i];
                    if (curMesh == null)
                    {
                        continue;
                    }

                    //각 메시의 Instanced Material도 Batch Material과 동일한 값을 가지도록 한다.
                    curMesh.SyncMaterialPropertyByBatch_CustomColor(curColor, propertyName);
                }
            }
示例#27
0
        /// <summary>
        /// Linked Vertex의 객체를 Link한다.
        /// </summary>
        /// <param name="parentModMesh"></param>
        public void Link(apOptModifiedMesh parentModMesh, apOptModifiedVertexWeight parentModVertWeight)
        {
            _parentModMesh = parentModMesh;
            //_parentModVertWeight = parentModVertWeight;

            if (_linkedVertices == null)
            {
                _linkedVertices = new List <OptLinkedVertex>();
            }


            apOptMesh mesh = parentModMesh._targetMesh;

            //이미 Bake 되었으므로 바로 Link하면 된다.
            for (int i = 0; i < _linkedVertices.Count; i++)
            {
                OptLinkedVertex           linkedVert     = _linkedVertices[i];
                apOptRenderVertex         renderVert     = mesh.RenderVertices[linkedVert._vertIndex];
                apOptModifiedVertexWeight linkVertWeight = _parentModMesh._vertWeights[linkedVert._vertIndex];
                linkedVert.Link(renderVert, linkVertWeight);
            }
        }
示例#28
0
        // Init
        //-----------------------------------------------
        public apOptMeshRenderCamera(apOptMesh parentOptMesh)
        {
            _parentOptMesh = parentOptMesh;

            if (_cameraRenderDataList == null)
            {
                _cameraRenderDataList = new List <CameraRenderData>();
            }

            if (_cam2CamRenderData == null)
            {
                _cam2CamRenderData = new Dictionary <Camera, CameraRenderData>();
            }

            _cameraRenderDataList.Clear();
            _cam2CamRenderData.Clear();

            Clear();

            _refreshKey   = -1;
            _isMaskParent = parentOptMesh._isMaskParent;
        }
示例#29
0
            /// <summary>
            /// 변경 요청을 리셋한다.
            /// </summary>
            public void ResetRequestProperties()
            {
                _isRequested_Texture = false;
                _isRequested_Color   = false;
                _isRequested_Custom  = false;

                //원래 프로퍼티에서 복사를 하자.
                _material.CopyPropertiesFromMaterial(_material_Original);

                apOptMesh curMesh = null;

                for (int i = 0; i < _linkedMeshes.Count; i++)
                {
                    curMesh = _linkedMeshes[i];
                    if (curMesh == null)
                    {
                        continue;
                    }

                    //각 메시의 Instanced Material도 Batch Material과 동일한 값을 가지도록 한다.
                    curMesh.SyncMaterialPropertyByBatch_Reset(_material_Original);
                }
            }
        //Pre Render Event
        private void OnPreRender()
        {
            if (_nEvent == 0)
            {
                return;
            }

            apOptMesh optMesh = null;
            FUNC_MESH_PRE_RENDERED funcMeshPreRendered = null;

            foreach (KeyValuePair <apOptMesh, FUNC_MESH_PRE_RENDERED> pair in _meshPreRenderedEvents)
            {
                optMesh             = pair.Key;
                funcMeshPreRendered = pair.Value;

                if (optMesh == null || funcMeshPreRendered == null)
                {
                    //메시가 없다면 리스트를 다시 봐야 한다.
                    continue;
                }

                funcMeshPreRendered(_camera);
            }
        }