public static Model3D CreateModel(eModelType i_ModelType, Game i_Game, List <Vector3> i_Coords, List <Vector2> i_TextureMap, string i_TexturePath, params short[] i_IndexArr) { Model3D model3D = new Model3D(i_Game); model3D.VertexFilling = createVertexPositionTexture(i_Game, i_Coords, i_TextureMap, i_TexturePath); createModel(model3D, i_ModelType, i_IndexArr); return(model3D); }
public static Model3D CreateModel(eModelType i_ModelType, Game i_Game, List <Vector3> i_Coords, List <Color> i_Colors, params short[] i_IndexArr) { Model3D model3D = new Model3D(i_Game); model3D.VertexFilling = createVertexPositionColor(i_Game, i_Coords, i_Colors); createModel(model3D, i_ModelType, i_IndexArr); return(model3D); }
public void parseXml(XmlElement elem) { m_resType = ExportUtil.getXmlAttrStr(elem.Attributes["restype"]); m_inPath = ExportUtil.getXmlAttrStr(elem.Attributes["inpath"]); m_outPath = ExportUtil.getXmlAttrStr(elem.Attributes["outpath"]); m_modelType = (eModelType)ExportUtil.getXmlAttrInt(elem.Attributes["part"]); string ignoreExtStr = ExportUtil.getXmlAttrStr(elem.Attributes["ignoreext"]); m_ignoreExtList = new List<string>(ignoreExtStr.Split(new[] { ',' })); m_controllerPath = ExportUtil.getXmlAttrStr(elem.Attributes["controllerpath"]); addMesh(); }
public void parseXml(XmlElement elem) { m_resType = ExportUtil.getXmlAttrStr(elem.Attributes["restype"]); m_inPath = ExportUtil.getXmlAttrStr(elem.Attributes["inpath"]); m_outPath = ExportUtil.getXmlAttrStr(elem.Attributes["outpath"]); m_modelType = (eModelType)ExportUtil.getXmlAttrInt(elem.Attributes["part"]); string ignoreExtStr = ExportUtil.getXmlAttrStr(elem.Attributes["ignoreext"]); m_ignoreExtList = new List <string>(ignoreExtStr.Split(new[] { ',' })); m_controllerPath = ExportUtil.getXmlAttrStr(elem.Attributes["controllerpath"]); addMesh(); }
private static void createModel(Model3D i_Model3D, eModelType i_ModelType, params short[] i_IndexArr) { int numOfVertices = i_Model3D.VertexFilling.NumOfVertices; if (i_IndexArr != null) { if (i_IndexArr.Length > 0) { numOfVertices = i_IndexArr.Length; } } addIndexBufferToModelIfNeeded(i_Model3D, i_IndexArr); i_Model3D.VerticesPassingType = createVertexPassingType( i_ModelType, numOfVertices); }
private static IVerticesPassingType createVertexPassingType(eModelType i_ModelType, int i_NumOfVertices) { IVerticesPassingType verticesPassing = null; switch (i_ModelType) { case eModelType.TriangleListAndColorWithIndex: case eModelType.TriangleListAndTextureWithIndex: case eModelType.TriangleListAndTexture: case eModelType.TriangleListAndColor: verticesPassing = new TriangleListPassing(i_NumOfVertices); break; case eModelType.TriangleStripAndTexture: case eModelType.TriangleStripAndColor: verticesPassing = new TriangleStripPassing(i_NumOfVertices); break; } return(verticesPassing); }
public void parseXml(XmlElement elem) { m_id = (eModelType)ExportUtil.getXmlAttrInt(elem.Attributes["id"]); m_subPath = ExportUtil.getXmlAttrStr(elem.Attributes["subpath"]); m_outFileName = ExportUtil.getXmlAttrStr(elem.Attributes["outfilename"]); }
public IEnumerator LoadingModel( AsBaseEntity _entity, int _idx) { m_ModelLoadingState = eModelLoadingState.Started; _entity.isKeepDummyObj = false; if( null != m_Entity.ModelObject) { Destroy( m_Entity.ModelObject); if( null != m_PartsRoot) m_PartsRoot.Clear(); } if( Entity.ContainProperty( eComponentProperty.SHOP_OPENING) == true) { if( Entity.AnimEnableViaShop == false) m_ModelType = eModelType.Shop; else m_ModelType = eModelType.Normal; } if( eEntityType.USER == _entity.EntityType) { if( null != AssetbundleManager.Instance && true == AssetbundleManager.Instance.useAssetbundle) { Debug.Log( "InitialUserCharacter( 1): " + AssetbundleManager.Instance); yield return StartCoroutine( InitialUserCharacter_Assetbundle()); } else { Debug.Log( "InitialUserCharacter( 2): " + AssetbundleManager.Instance); InitialUserCharacter(); } #if AUTOMOVE_EFFECT if( Entity.isNeedAutoMoveEffect) AsEffectManager.Instance.PlayEffect( "FX/Effect/COMMON/Fx_Common_AutoMove", Entity.transform, false, 0f, 1.0f); if( Entity.isNeedAutoMoveEffect && null != AsSoundManager.Instance) AsSoundManager.Instance.PlaySound( "Sound/PC/Common/Se_Common_AutoMove", Entity.transform.position, false); #endif } else if( eEntityType.NPC == _entity.EntityType) { m_dicDummy.Clear(); string modelingPath = null; string[] strSplit = null; bool dataFound = true; if( Entity.ContainProperty( eComponentProperty.NPC_ID) == true) { int id = Entity.GetProperty<int>( eComponentProperty.NPC_ID); Tbl_Npc_Record npcrecord = AsTableManager.Instance.GetTbl_Npc_Record( id); modelingPath = npcrecord.ModelingPath; strSplit = npcrecord.ModelingPath.Split( '/'); } else if( Entity.ContainProperty( eComponentProperty.PET_ID) == true) { int id = Entity.GetProperty<int>( eComponentProperty.PET_ID); Tbl_Pet_Record petRecord = AsTableManager.Instance.GetPetRecord( id); modelingPath = petRecord.Model; strSplit = petRecord.Model.Split( '/'); } else { Debug.LogError( "AsModel::InitialNpcCharacter: no data table record. CHECK NPC ID"); dataFound = false; } if( dataFound == true) { if( null != AssetbundleManager.Instance && true == AssetbundleManager.Instance.useAssetbundle) { string strNameLower = strSplit[strSplit.Length-1].ToLower(); string strAssetbundlePath = AssetbundleManager.Instance.GetAssetbundleDownloadPath( strNameLower); int nVersion = AssetbundleManager.Instance.GetCachedVersion( strNameLower); WWW www = WWW.LoadFromCacheOrDownload( strAssetbundlePath, nVersion); yield return www; AssetBundle bundle = www.assetBundle; AssetBundleRequest request = bundle.LoadAsync( strNameLower, typeof( GameObject)); yield return request; GameObject obj = request.asset as GameObject; if( null == obj) { Debug.LogError( "AsModel::InitialNpcCharacter: There is no [" + modelingPath + "] modeling resource."); obj = GameObject.CreatePrimitive( PrimitiveType.Sphere); } GameObject model = Instantiate( obj) as GameObject; bundle.Unload( false); yield return StartCoroutine( CreateMaterial( model, strNameLower)); Entity.SetModelObject( model); InitMonsterDummy( Entity.ModelObject.transform); Entity.ModelObject.name = "Model"; Entity.ModelObject.transform.parent = transform; // Entity.ModelObject.transform.localPosition = Vector3.zero; Entity.ModelObject.transform.localRotation = Quaternion.identity; } else { GameObject obj = ResourceLoad.LoadGameObject( modelingPath); if( null == obj) { Debug.LogError( "AsModel::InitialNpcCharacter: There is no [" + modelingPath + "] modeling resource."); obj = GameObject.CreatePrimitive( PrimitiveType.Sphere); } GameObject model = Instantiate( obj) as GameObject; Entity.SetModelObject( model); InitMonsterDummy( Entity.ModelObject.transform); Entity.ModelObject.name = "Model"; Entity.ModelObject.transform.parent = transform; // Entity.ModelObject.transform.localPosition = Vector3.zero; Entity.ModelObject.transform.localRotation = Quaternion.identity; } } else { Debug.LogError( "AsModel::InitialNpcCharacter: no data table record. CHECK NPC ID"); } } _entity.SetDummyTransform( m_dicDummy); Entity.ModelObject.transform.localPosition = Vector3.zero; m_Entity.ModelObject.transform.localScale = Vector3.one; if( _entity.isSegregate == false) _CreateNamePanel( _entity); if( eFsmType.COLLECTION != _entity.FsmType ) MakeShadow(); _CreatePvpPointEffect( _entity); m_ModelLoadingState = eModelLoadingState.Finished; InitHide(); m_Entity.HandleMessage( new Msg_ModelLoaded()); if( m_Entity.FsmType == eFsmType.PLAYER) Debug.Log( "AsModel::OnModelChange: Msg_ModelLoaded is send. [" + m_Entity.FsmType + "] model type = " + m_ModelType); DeleteDummyObj(); }
public IEnumerator LoadingModel_Dummy( AsBaseEntity _entity, int _idx) { m_ModelLoadingState = eModelLoadingState.Started; _entity.isKeepDummyObj = true; yield return null; if( Entity.ContainProperty( eComponentProperty.SHOP_OPENING) == true) { if( Entity.AnimEnableViaShop == false) m_ModelType = eModelType.Shop; else { m_ModelType = eModelType.Normal; if( null != m_Entity.ModelObject) { Destroy( m_Entity.ModelObject); if( null != m_PartsRoot) m_PartsRoot.Clear(); } } } else { if( null != m_Entity.ModelObject) { Destroy( m_Entity.ModelObject); if( null != m_PartsRoot) m_PartsRoot.Clear(); } } if( eEntityType.USER == _entity.EntityType) { #if AUTOMOVE_EFFECT if( Entity.isNeedAutoMoveEffect) AsEffectManager.Instance.PlayEffect( "FX/Effect/COMMON/Fx_Common_AutoMove", Entity.transform, false, 0f, 1.0f); if( Entity.isNeedAutoMoveEffect && null != AsSoundManager.Instance) AsSoundManager.Instance.PlaySound( "Sound/PC/Common/Se_Common_AutoMove", Entity.transform.position, false); #endif } // _entity.SetDummyTransform( m_dicDummy); m_Entity.SetModelObject( m_DummyObj); m_Entity.ModelObject.name = "Model"; if( _entity.isSegregate == false) _CreateNamePanel( _entity); if( eFsmType.COLLECTION != _entity.FsmType ) MakeShadow(); _CreatePvpPointEffect( _entity); m_ModelLoadingState = eModelLoadingState.Finished; InitHide(); m_Entity.HandleMessage( new Msg_ModelLoaded_Dummy()); if( m_Entity.FsmType == eFsmType.PLAYER) Debug.Log( "AsModel::OnModelChange: Msg_ModelLoaded is send. [" + m_Entity.FsmType + "] model type = " + m_ModelType); // DeleteDummyObj(); }