/// <summary> /// 相机锁定输入交互控制器构造函数 /// </summary> /// <param name="ref_camera">相机</param> /// <param name="ref_sceneManager">场景管理器</param> /// <param name="ref_viewport">视口</param> /// <param name="ref_dynamicModelManager">动态目标管理器,该参数对象的生命周期要与本对象保持一致</param> /// <param name="ref_globeControl">地球窗体</param> public DynamicCameraLockHandler(EarthView.World.Spatial3D.GlobeCamera ref_camera, EarthView.World.Graphic.SceneManager ref_sceneManager, EarthView.World.Graphic.Viewport ref_viewport, EarthView.IndustryEngine.DynamicModelLibrary.DynamicModelObjectManager ref_dynamicModelManager, EarthView.World.Spatial3D.Controls.GlobeControl ref_globeControl) : base(CreatedWhenConstruct.CWC_NotToCreate) { NameValuePairList list = new NameValuePairList(); BasePtr valueref_camera = new BasePtr(ref_camera); list.Add("ref_camera", valueref_camera.PtrVal); BasePtr valueref_sceneManager = new BasePtr(ref_sceneManager); list.Add("ref_sceneManager", valueref_sceneManager.PtrVal); BasePtr valueref_viewport = new BasePtr(ref_viewport); list.Add("ref_viewport", valueref_viewport.PtrVal); BasePtr valueref_dynamicModelManager = new BasePtr(ref_dynamicModelManager); list.Add("ref_dynamicModelManager", valueref_dynamicModelManager.PtrVal); BasePtr valueref_globeControl = new BasePtr(ref_globeControl); list.Add("ref_globeControl", valueref_globeControl.PtrVal); Create("CDynamicCameraLockHandlerProxy", list); if (!"EarthView.IndustryEngine.DynamicModelLibrary.DynamicCameraLockHandler".Equals(((Object)this).GetType().ToString())) { this.SetCustomExtend(true); } RegisterCallBack(); this.needDispose = true; GlobalTraceInfoMap.Put(this); }
//update->query #region updateQuery public int UpdateQuery(string desgId, string designation, string description) { string updateQuery = "UPDATE designationT SET deignation ='" + designation + "',description ='" + description + "' WHERE desgId='" + desgId + "'"; NameValuePairList nameValuePairObject = new NameValuePairList(); nameValuePairObject.Add(new NameValuePair("@designation", designation)); nameValuePairObject.Add(new NameValuePair("@description", description)); int status = obj.updateQ(updateQuery, nameValuePairObject); return(status); }
///<summary> ///构造函数 ///</summary> ///<param name="driverText">驱动错误文本</param> ///<param name="databaseText">数据库错误文本</param> ///<returns></returns> public SqlError(string driverText, string databaseText) : base(CreatedWhenConstruct.CWC_NotToCreate) { NameValuePairList list = new NameValuePairList(); BasePtr valuedriverText = new BasePtr(driverText); list.Add("driverText", valuedriverText.PtrVal); BasePtr valuedatabaseText = new BasePtr(databaseText); list.Add("databaseText", valuedatabaseText.PtrVal); Create("CSqlError", list); RegisterCallBack(); this.needDispose = true; GlobalTraceInfoMap.Put(this); }
public int DepartmentUpdate(string depName, string description, string empLead, string parentDept, string deptId) { string updateQuery = "UPDATE department SET depName='" + depName + "',description='" + description + "',dLeadEmp='" + empLead + "',parentDept='" + parentDept + "' WHERE deptId='" + deptId + "'"; NameValuePairList nameValuePairObject = new NameValuePairList(); nameValuePairObject.Add(new NameValuePair("@depName", depName)); nameValuePairObject.Add(new NameValuePair("@description", description)); nameValuePairObject.Add(new NameValuePair("@dLeadEmp", empLead)); nameValuePairObject.Add(new NameValuePair("@parentDept", parentDept)); int status = obj.InsertUpdateOrDelete(updateQuery, nameValuePairObject); return(status); }
/// <summary> /// 构造函数 /// </summary> /// <param name="ctrl">关联的控件</param> /// <param name="type">事件类型</param> /// <returns>返回专题图类型</returns> public ControlEvent(EarthView.World.Spatial.Atlas.Ispatialcontrol ref_ctrl, ushort type) : base(CreatedWhenConstruct.CWC_NotToCreate) { NameValuePairList list = new NameValuePairList(); BasePtr valueref_ctrl = new BasePtr(ref_ctrl); list.Add("ref_ctrl", valueref_ctrl.PtrVal); BasePtr valuetype = new BasePtr(type); list.Add("type", valuetype.PtrVal); Create("CControlEvent", list); RegisterCallBack(); this.needDispose = true; GlobalTraceInfoMap.Put(this); }
//for_fetch_corporate_bsc_info public int basic_info(string Name, string Phone, string Email) { string InsertQuery = "Insert into employee(Name,Phone,Email) Values(@Name,@Phone,@Email)"; NameValuePairList nameValuePairObject = new NameValuePairList(); nameValuePairObject.Add(new NameValuePair("@Name", Name)); nameValuePairObject.Add(new NameValuePair("@Phone", Phone)); nameValuePairObject.Add(new NameValuePair("@Email", Email)); int Status = obj.InsertUpdateOrDelete(InsertQuery, nameValuePairObject); return(Status); }
/// <summary> /// 构造函数 /// </summary> /// <param name="maxLatticeCounts"></param> /// <returns></returns> public LatticeFontCache(byte[] filePath, ulong maxLatticeCounts) : base(CreatedWhenConstruct.CWC_NotToCreate) { NameValuePairList list = new NameValuePairList(); BasePtr valuefilePath = new BasePtr(filePath); list.Add("filePath", valuefilePath.PtrVal); BasePtr valuemaxLatticeCounts = new BasePtr(maxLatticeCounts); list.Add("maxLatticeCounts", valuemaxLatticeCounts.PtrVal); Create("CLatticeFontCache", list); RegisterCallBack(); this.needDispose = true; GlobalTraceInfoMap.Put(this); }
//login-session public int LoginInfoInsert(string username, string hrFname, string hrLname, string password) { string InsertQuery = "Insert into loginInfo(sessionId,guid,sessionTime) Values(@sessionId,@guid,@sessionTime)"; GUID buffer = new GUID(); NameValuePairList nameValuePairObject = new NameValuePairList(); nameValuePairObject.Add(new NameValuePair("@sessionId", buffer.hashFunc(username))); nameValuePairObject.Add(new NameValuePair("@guid", username)); nameValuePairObject.Add(new NameValuePair("@sessionTime", hrFname)); int status = obj.InsertUpdateOrDelete(InsertQuery, nameValuePairObject); return(status); }
///<summary> ///构造函数 ///</summary> ///<param name="cursorName">游标名</param> ///<param name="name">索引名</param> ///<returns></returns> public SqlIndex(string cursorName, string name) : base(CreatedWhenConstruct.CWC_NotToCreate) { NameValuePairList list = new NameValuePairList(); BasePtr valuecursorName = new BasePtr(cursorName); list.Add("cursorName", valuecursorName.PtrVal); BasePtr valuename = new BasePtr(name); list.Add("name", valuename.PtrVal); Create("CSqlIndex", list); RegisterCallBack(); this.needDispose = true; GlobalTraceInfoMap.Put(this); }
public RichTextRenderMeasure(string str, EarthView.World.Spatial.Display.Isymbol symbol) : base(CreatedWhenConstruct.CWC_NotToCreate) { NameValuePairList list = new NameValuePairList(); BasePtr valuestr = new BasePtr(str); list.Add("str", valuestr.PtrVal); BasePtr valuesymbol = new BasePtr(symbol); list.Add("symbol", valuesymbol.PtrVal); Create("CRichTextRenderMeasure", list); RegisterCallBack(); this.needDispose = true; GlobalTraceInfoMap.Put(this); }
/// <summary> /// 构造函数 /// </summary> /// <param name="type">事件类别</param> /// <param name="ref_sender">发送对象</param> /// <returns></returns> /// <memo></memo> public ModelDBEvent(ushort type, EarthView.World.Core.EventObject ref_sender) : base(CreatedWhenConstruct.CWC_NotToCreate) { NameValuePairList list = new NameValuePairList(); BasePtr valuetype = new BasePtr(type); list.Add("type", valuetype.PtrVal); BasePtr valueref_sender = new BasePtr(ref_sender); list.Add("ref_sender", valueref_sender.PtrVal); Create("CModelDBEvent", list); RegisterCallBack(); this.needDispose = true; GlobalTraceInfoMap.Put(this); }
/// <summary> /// 构造函数 /// </summary> ///<param "textureName">纹理名称</param> ///<param "textureName">角度大小</param> public Sun(string textureName, ref EarthView.World.Spatial.Math.Degree sunTextureAngularSize) : base(CreatedWhenConstruct.CWC_NotToCreate) { NameValuePairList list = new NameValuePairList(); BasePtr valuetextureName = new BasePtr(textureName); list.Add("textureName", valuetextureName.PtrVal); BasePtr valuesunTextureAngularSize = new BasePtr(sunTextureAngularSize); list.Add("sunTextureAngularSize", valuesunTextureAngularSize.PtrVal); Create("CSun", list); RegisterCallBack(); this.needDispose = true; GlobalTraceInfoMap.Put(this); }
public ClampLineExtension(EarthView.World.Graphic.SceneManager sceneMgr, string group) : base(CreatedWhenConstruct.CWC_NotToCreate) { NameValuePairList list = new NameValuePairList(); BasePtr valuesceneMgr = new BasePtr(sceneMgr); list.Add("sceneMgr", valuesceneMgr.PtrVal); BasePtr valuegroup = new BasePtr(group); list.Add("group", valuegroup.PtrVal); Create("CClampLineExtension", list); RegisterCallBack(); this.needDispose = true; GlobalTraceInfoMap.Put(this); }
//designation_insert/update #region InsertQuery public int DesignationUpdate(string designation, string description) { string InsertQuery = "Insert into designationT(desgId,designation,description) Values(@desgId,@designation,@description)"; GUID buffer = new GUID(); NameValuePairList nameValuePairObject = new NameValuePairList(); nameValuePairObject.Add(new NameValuePair("@desgId", buffer.hashFunc(designation))); nameValuePairObject.Add(new NameValuePair("@designation", designation)); nameValuePairObject.Add(new NameValuePair("@description", description)); int status = obj.InsertUpdateOrDelete(InsertQuery, nameValuePairObject); return(status); }
/// <summary> /// 构造函数 /// </summary> /// <param name="center">球体中心点</param> /// <param name="radius">球体半径</param> /// <returns></returns> public Sphere(EarthView.World.Spatial.Math.Vector3 center, double radius) : base(CreatedWhenConstruct.CWC_NotToCreate) { NameValuePairList list = new NameValuePairList(); BasePtr valuecenter = new BasePtr(center); list.Add("center", valuecenter.PtrVal); BasePtr valueradius = new BasePtr(radius); list.Add("radius", valueradius.PtrVal); Create("CSphere", list); RegisterCallBack(); this.needDispose = true; GlobalTraceInfoMap.Put(this); }
/// <summary> /// 构造函数 /// </summary> /// <param name="name">名称</param> /// <param name="ref_pGlobeCtrl">三维控件</param> public MultiTexturePoint3d(string name, EarthView.World.Spatial3D.Controls.GlobeControl ref_pGlobeCtrl) : base(CreatedWhenConstruct.CWC_NotToCreate) { NameValuePairList list = new NameValuePairList(); BasePtr valuename = new BasePtr(name); list.Add("name", valuename.PtrVal); BasePtr valueref_pGlobeCtrl = new BasePtr(ref_pGlobeCtrl); list.Add("ref_pGlobeCtrl", valueref_pGlobeCtrl.PtrVal); Create("CMultiTexturePoint3d", list); RegisterCallBack(); this.needDispose = true; GlobalTraceInfoMap.Put(this); }
/// <summary> /// 构造函数 /// </summary> /// <param name="ctrl">关联的图层</param> /// <param name="type">事件类型</param> /// <returns></returns> public LayerEditingEvent(EarthView.World.Spatial.Atlas.Ilayer ref_layer, ushort eventtype) : base(CreatedWhenConstruct.CWC_NotToCreate) { NameValuePairList list = new NameValuePairList(); BasePtr valueref_layer = new BasePtr(ref_layer); list.Add("ref_layer", valueref_layer.PtrVal); BasePtr valueeventtype = new BasePtr(eventtype); list.Add("eventtype", valueeventtype.PtrVal); Create("CLayerEditingEvent", list); RegisterCallBack(); this.needDispose = true; GlobalTraceInfoMap.Put(this); }
/// <summary> /// 构造函数 /// </summary> /// <param name="dataset">关联的数据集</param> /// <param name="type">事件类型</param> /// <returns></returns> public DatasetEditEvent(EarthView.World.Spatial.GeoDataset.Idataset ref_dataset, ushort eventtype) : base(CreatedWhenConstruct.CWC_NotToCreate) { NameValuePairList list = new NameValuePairList(); BasePtr valueref_dataset = new BasePtr(ref_dataset); list.Add("ref_dataset", valueref_dataset.PtrVal); BasePtr valueeventtype = new BasePtr(eventtype); list.Add("eventtype", valueeventtype.PtrVal); Create("CDatasetEditEvent", list); RegisterCallBack(); this.needDispose = true; GlobalTraceInfoMap.Put(this); }
/// <summary> /// 构造函数 /// </summary> /// <param name="box">包围盒</param> /// <param name="maxDepth">最大深度</param> /// <returns></returns> public BaseOctreeManager(EarthView.World.Spatial.Math.AxisAlignedBox box, uint maxDepth) : base(CreatedWhenConstruct.CWC_NotToCreate) { NameValuePairList list = new NameValuePairList(); BasePtr valuebox = new BasePtr(box); list.Add("box", valuebox.PtrVal); BasePtr valuemaxDepth = new BasePtr(maxDepth); list.Add("maxDepth", valuemaxDepth.PtrVal); Create("CBaseOctreeManager", list); RegisterCallBack(); this.needDispose = true; GlobalTraceInfoMap.Put(this); }
public SphereGeometryFactory(double dfSemiMajor, double dfInvFlattening) : base(CreatedWhenConstruct.CWC_NotToCreate) { NameValuePairList list = new NameValuePairList(); BasePtr valuedfSemiMajor = new BasePtr(dfSemiMajor); list.Add("dfSemiMajor", valuedfSemiMajor.PtrVal); BasePtr valuedfInvFlattening = new BasePtr(dfInvFlattening); list.Add("dfInvFlattening", valuedfInvFlattening.PtrVal); Create("CSphereGeometryFactory", list); RegisterCallBack(); this.needDispose = true; GlobalTraceInfoMap.Put(this); }
/// <summary> /// 构造函数 /// </summary> /// <param name="name">名称</param> /// <param name="ref_sceneManager">地理场景管理器</param> public RadarWave(string name, EarthView.World.Spatial3D.GeoSceneManager ref_sceneManager) : base(CreatedWhenConstruct.CWC_NotToCreate) { NameValuePairList list = new NameValuePairList(); BasePtr valuename = new BasePtr(name); list.Add("name", valuename.PtrVal); BasePtr valueref_sceneManager = new BasePtr(ref_sceneManager); list.Add("ref_sceneManager", valueref_sceneManager.PtrVal); Create("CRadarWave", list); RegisterCallBack(); this.needDispose = true; GlobalTraceInfoMap.Put(this); }
public HeightRange(float minHeight, float maxHeight) : base(CreatedWhenConstruct.CWC_NotToCreate) { NameValuePairList list = new NameValuePairList(); BasePtr valueminHeight = new BasePtr(minHeight); list.Add("minHeight", valueminHeight.PtrVal); BasePtr valuemaxHeight = new BasePtr(maxHeight); list.Add("maxHeight", valuemaxHeight.PtrVal); Create("CHeightRange", list); RegisterCallBack(); this.needDispose = true; GlobalTraceInfoMap.Put(this); }
public Logger(string name, string pattern) : base(CreatedWhenConstruct.CWC_NotToCreate) { NameValuePairList list = new NameValuePairList(); BasePtr valuename = new BasePtr(name); list.Add("name", valuename.PtrVal); BasePtr valuepattern = new BasePtr(pattern); list.Add("pattern", valuepattern.PtrVal); Create("CLogger", list); RegisterCallBack(); this.needDispose = true; GlobalTraceInfoMap.Put(this); }
/// <summary> /// 参数构造函数 /// </summary> /// <param name="envelope">包围盒对象</param> /// <param name="rotation">旋转角度</param> /// <returns></returns> public RotatedEnvelope(EarthView.World.Spatial.Geometry.Ienvelope envelope, double rotation) : base(CreatedWhenConstruct.CWC_NotToCreate) { NameValuePairList list = new NameValuePairList(); BasePtr valueenvelope = new BasePtr(envelope); list.Add("envelope", valueenvelope.PtrVal); BasePtr valuerotation = new BasePtr(rotation); list.Add("rotation", valuerotation.PtrVal); Create("CRotatedEnvelope", list); RegisterCallBack(); this.needDispose = true; GlobalTraceInfoMap.Put(this); }
/// <summary> /// 构造函数 /// </summary> public GroundFog(string domeMaterialName, string domeEntityName) : base(CreatedWhenConstruct.CWC_NotToCreate) { NameValuePairList list = new NameValuePairList(); BasePtr valuedomeMaterialName = new BasePtr(domeMaterialName); list.Add("domeMaterialName", valuedomeMaterialName.PtrVal); BasePtr valuedomeEntityName = new BasePtr(domeEntityName); list.Add("domeEntityName", valuedomeEntityName.PtrVal); Create("CGroundFog", list); RegisterCallBack(); this.needDispose = true; GlobalTraceInfoMap.Put(this); }
///<summary> ///构造函数 ///</summary> ///<param name="driverText">驱动错误文本</param> ///<param name="databaseText">数据库错误文本</param> ///<param name="type">错误类型</param> ///<returns></returns> public SqlError(string driverText, string databaseText, EarthView.World.Core.Database.SqlError.EVERRORTYPE type) : base(CreatedWhenConstruct.CWC_NotToCreate) { NameValuePairList list = new NameValuePairList(); BasePtr valuedriverText = new BasePtr(driverText); list.Add("driverText", valuedriverText.PtrVal); BasePtr valuedatabaseText = new BasePtr(databaseText); list.Add("databaseText", valuedatabaseText.PtrVal); BasePtr valuetype = new BasePtr(type); list.Add("type", valuetype.PtrVal); Create("CSqlError", list); RegisterCallBack(); this.needDispose = true; GlobalTraceInfoMap.Put(this); }
/// <summary> /// 构造函数 /// </summary> /// <param name="code">用户自定义特效分类编码</param> /// <param name="name">名称</param> /// <returns></returns> public EffectUserTypeTree(string code, string name) : base(CreatedWhenConstruct.CWC_NotToCreate) { NameValuePairList list = new NameValuePairList(); BasePtr valuecode = new BasePtr(code); list.Add("code", valuecode.PtrVal); BasePtr valuename = new BasePtr(name); list.Add("name", valuename.PtrVal); Create("CEffectUserTypeTree", list); RegisterCallBack(); this.needDispose = true; GlobalTraceInfoMap.Put(this); }
public PageSize(double w, double h) : base(CreatedWhenConstruct.CWC_NotToCreate) { NameValuePairList list = new NameValuePairList(); BasePtr valuew = new BasePtr(w); list.Add("w", valuew.PtrVal); BasePtr valueh = new BasePtr(h); list.Add("h", valueh.PtrVal); Create("CPageSize", list); RegisterCallBack(); this.needDispose = true; GlobalTraceInfoMap.Put(this); }
/// <summary> /// 构造函数 /// </summary> ///<param "moonTextureName">材质名称</param> ///<param "angularSize">角度</param> ///<returns></returns> public Moon(string moonTextureName, EarthView.World.Spatial.Math.Degree angularSize) : base(CreatedWhenConstruct.CWC_NotToCreate) { NameValuePairList list = new NameValuePairList(); BasePtr valuemoonTextureName = new BasePtr(moonTextureName); list.Add("moonTextureName", valuemoonTextureName.PtrVal); BasePtr valueangularSize = new BasePtr(angularSize); list.Add("angularSize", valueangularSize.PtrVal); Create("CMoon", list); RegisterCallBack(); this.needDispose = true; GlobalTraceInfoMap.Put(this); }
//department_insert/update public int DepartmentInsert(string depName, string description, string empLead, string parentdept) { string InsertQuery = "Insert into department(deptId,depName,description,dLeadEmp,parentDept) Values(@deptId,@depName,@description,@dLeadEmp,@parentDept)"; GUID buffer = new GUID(); NameValuePairList nameValuePairObject = new NameValuePairList(); nameValuePairObject.Add(new NameValuePair("@deptId", buffer.hashFunc(depName))); nameValuePairObject.Add(new NameValuePair("@depName", depName)); nameValuePairObject.Add(new NameValuePair("@description", description)); nameValuePairObject.Add(new NameValuePair("@dLeadEmp", empLead)); nameValuePairObject.Add(new NameValuePair("@parentDept", parentdept)); int status = obj.InsertUpdateOrDelete(InsertQuery, nameValuePairObject); return(status); }
protected void _translateUnifiedGpuProgram( ScriptCompiler compiler, ObjectAbstractNode obj ) { var customParameters = new NameValuePairList(); AbstractNode parameters = null; foreach ( var i in obj.Children ) { if ( i is PropertyAbstractNode ) { var prop = (PropertyAbstractNode)i; if ( prop.Name == "delegate" ) { var value = string.Empty; if ( prop.Values.Count != 0 && prop.Values[ 0 ] is AtomAbstractNode ) { value = ( (AtomAbstractNode)prop.Values[ 0 ] ).Value; } ScriptCompilerEvent evt = new ProcessResourceNameScriptCompilerEvent( ProcessResourceNameScriptCompilerEvent.ResourceType.GpuProgram, value ); compiler._fireEvent( ref evt ); customParameters[ "delegate" ] = ( (ProcessResourceNameScriptCompilerEvent)evt ).Name; } else { var name = prop.Name; var value = string.Empty; var first = true; foreach ( var it in prop.Values ) { if ( it is AtomAbstractNode ) { if ( !first ) { value += " "; } else { first = false; } value += ( (AtomAbstractNode)it ).Value; } } customParameters.Add( name, value ); } } else if ( i is ObjectAbstractNode ) { if ( ( (ObjectAbstractNode)i ).Id == (uint)Keywords.ID_DEFAULT_PARAMS ) { parameters = i; } else { processNode( compiler, i ); } } } // Allocate the program Object progObj; HighLevelGpuProgram prog = null; ScriptCompilerEvent evnt = new CreateHighLevelGpuProgramScriptCompilerEvent( obj.File, obj.Name, compiler.ResourceGroup, string.Empty, "unified", _translateIDToGpuProgramType( obj.Id ) ); var processed = compiler._fireEvent( ref evnt, out progObj ); if ( !processed ) { prog = (HighLevelGpuProgram) ( HighLevelGpuProgramManager.Instance.CreateProgram( obj.Name, compiler.ResourceGroup, "unified", _translateIDToGpuProgramType( obj.Id ) ) ); } else { prog = (HighLevelGpuProgram)progObj; } // Check that allocation worked if ( prog == null ) { compiler.AddError( CompileErrorCode.ObjectAllocationError, obj.File, obj.Line, "gpu program \"" + obj.Name + "\" could not be created" ); return; } obj.Context = prog; prog.IsMorphAnimationIncluded = false; prog.PoseAnimationCount = 0; prog.IsSkeletalAnimationIncluded = false; prog.IsVertexTextureFetchRequired = false; prog.Origin = obj.File; // Set the custom parameters prog.SetParameters( customParameters ); // Set up default parameters if ( prog.IsSupported && parameters != null ) { var ptr = prog.DefaultParameters; GpuProgramTranslator.TranslateProgramParameters( compiler, ptr, (ObjectAbstractNode)parameters ); } }
public void LoadWorldGeometry() { this.bspGeometry = new BspGeometry(); if ( !optionList.ContainsKey( "Map" ) ) { throw new AxiomException( "Unable to load world geometry. \"Map\" filename option is not set." ); } if ( Path.GetExtension( ( (string)optionList[ "Map" ] ).ToLower() ) != ".bsp" ) { throw new AxiomException( "Unable to load world geometry. Invalid extension of map filename option (must be .bsp)." ); } if ( !optionList.ContainsKey( "SetYAxisUp" ) ) { optionList[ "SetYAxisUp" ] = false; } if ( !optionList.ContainsKey( "Scale" ) ) { optionList[ "Scale" ] = 1f; } if ( !optionList.ContainsKey( "Move" ) ) { optionList[ "Move" ] = Vector3.Zero; optionList[ "MoveX" ] = 0; optionList[ "MoveY" ] = 0; optionList[ "MoveZ" ] = 0; } if ( !optionList.ContainsKey( "UseLightmaps" ) ) { optionList[ "UseLightmaps" ] = true; } if ( !optionList.ContainsKey( "AmbientEnabled" ) ) { optionList[ "AmbientEnabled" ] = false; } if ( !optionList.ContainsKey( "AmbientRatio" ) ) { optionList[ "AmbientRatio" ] = 1f; } InitTextureLighting(); if ( this.spotlightFrustum == null ) { this.spotlightFrustum = new SpotlightFrustum(); } var paramList = new NameValuePairList(); foreach ( DictionaryEntry option in optionList ) { paramList.Add( option.Key.ToString(), option.Value.ToString() ); } // Load using resource manager this.level = (BspLevel) BspResourceManager.Instance.Load( (string)optionList[ "Map" ], ResourceGroupManager.Instance.WorldResourceGroupName, false, null, paramList ); // Init static render operation this.renderOp.vertexData = this.level.VertexData; // index data is per-frame this.renderOp.indexData = new IndexData(); this.renderOp.indexData.indexStart = 0; this.renderOp.indexData.indexCount = 0; // Create enough index space to render whole level this.renderOp.indexData.indexBuffer = HardwareBufferManager.Instance.CreateIndexBuffer( IndexType.Size32, this.level.NumIndexes, BufferUsage.Dynamic, false ); this.renderOp.operationType = OperationType.TriangleList; this.renderOp.useIndices = true; }
protected void _translateGpuProgram( ScriptCompiler compiler, ObjectAbstractNode obj ) { var customParameters = new NameValuePairList(); string syntax = string.Empty, source = string.Empty; AbstractNode parameters = null; foreach ( var i in obj.Children ) { if ( i is PropertyAbstractNode ) { var prop = (PropertyAbstractNode)i; if ( prop.Id == (uint)Keywords.ID_SOURCE ) { if ( prop.Values.Count != 0 ) { if ( prop.Values[ 0 ] is AtomAbstractNode ) { source = ( (AtomAbstractNode)prop.Values[ 0 ] ).Value; } else { compiler.AddError( CompileErrorCode.InvalidParameters, prop.File, prop.Line, "source file expected" ); } } else { compiler.AddError( CompileErrorCode.StringExpected, prop.File, prop.Line, "source file expected" ); } } else if ( prop.Id == (uint)Keywords.ID_SYNTAX ) { if ( prop.Values.Count != 0 ) { if ( prop.Values[ 0 ] is AtomAbstractNode ) { syntax = ( (AtomAbstractNode)prop.Values[ 0 ] ).Value; } else { compiler.AddError( CompileErrorCode.InvalidParameters, prop.File, prop.Line, "syntax string expected" ); } } else { compiler.AddError( CompileErrorCode.StringExpected, prop.File, prop.Line, "syntax string expected" ); } } else { string name = prop.Name, value = string.Empty; var first = true; foreach ( var it in prop.Values ) { if ( it is AtomAbstractNode ) { if ( !first ) { value += " "; } else { first = false; } value += ( (AtomAbstractNode)it ).Value; } } customParameters.Add( name, value ); } } else if ( i is ObjectAbstractNode ) { if ( ( (ObjectAbstractNode)i ).Id == (uint)Keywords.ID_DEFAULT_PARAMS ) { parameters = i; } else { processNode( compiler, i ); } } } if ( !GpuProgramManager.Instance.IsSyntaxSupported( syntax ) ) { compiler.AddError( CompileErrorCode.UnsupportedByRenderSystem, obj.File, obj.Line ); //Register the unsupported program so that materials that use it know that //it exists but is unsupported var unsupportedProg = GpuProgramManager.Instance.Create( obj.Name, compiler.ResourceGroup, _translateIDToGpuProgramType( obj.Id ), syntax ); return; } // Allocate the program object progObj; GpuProgram prog = null; ScriptCompilerEvent evt = new CreateGpuProgramScriptCompilerEvent( obj.File, obj.Name, compiler.ResourceGroup, source, syntax, _translateIDToGpuProgramType( obj.Id ) ); var processed = compiler._fireEvent( ref evt, out progObj ); if ( !processed ) { prog = (GpuProgram) GpuProgramManager.Instance.CreateProgram( obj.Name, compiler.ResourceGroup, source, _translateIDToGpuProgramType( obj.Id ), syntax ); } else { prog = (GpuProgram)progObj; } // Check that allocation worked if ( prog == null ) { compiler.AddError( CompileErrorCode.ObjectAllocationError, obj.File, obj.Line, "gpu program \"" + obj.Name + "\" could not be created" ); return; } obj.Context = prog; prog.IsMorphAnimationIncluded = false; prog.PoseAnimationCount = 0; prog.IsSkeletalAnimationIncluded = false; prog.IsVertexTextureFetchRequired = false; prog.Origin = obj.File; // Set the custom parameters prog.SetParameters( customParameters ); // Set up default parameters if ( prog.IsSupported && parameters != null ) { var ptr = prog.DefaultParameters; GpuProgramTranslator.TranslateProgramParameters( compiler, ptr, (ObjectAbstractNode)parameters ); } }