Beispiel #1
0
		private void Dispose(bool disposing)
		{
			if(this.Disposed == true)
			{
				throw new ObjectDisposedException("idClipModel");
			}

			if(disposing == true)
			{
				// make sure the clip model is no longer linked
				Unlink();

				_traceModelCache = null;
				_disposed = true;
			}
		}
Beispiel #2
0
		private void Init()
		{
			if(this.Disposed == true)
			{
				throw new ObjectDisposedException("idClipModel");
			}

			_enabled = true;
			_contents = ContentFlags.Body;

			_renderModelHandle = -1;
			_traceModelCache = null;
			_touchCount = -1;
		}		
Beispiel #3
0
		private TraceModelCache GetTraceModelCache(idTraceModel model)
		{
			if(_traceModelCacheDict.ContainsKey(model) == true)
			{
				if(_traceModelCacheDict[model].IsAlive == true)
				{
					return (TraceModelCache) _traceModelCacheDict[model].Target;
				}

				_traceModelCacheDict.Remove(model);
			}

			TraceModelCache entry = new TraceModelCache();
			entry.TraceModel = model;
			entry.TraceModel.GetMassProperties(1.0f, out entry.Volume, out entry.CenterOfMass, out entry.InertiaTensor);

			WeakReference weakRef = new WeakReference(entry);
			_traceModelCacheDict.Add(model, weakRef);

			return entry;
		}
Beispiel #4
0
		public void LoadModel(idTraceModel traceModel)
		{
			if(this.Disposed == true)
			{
				throw new ObjectDisposedException("idClipModel");
			}

			_collisionModelHandle = 0;
			_renderModelHandle = -1;			
			_traceModelCache = GetTraceModelCache(traceModel);

			_bounds = traceModel.Bounds;
		}
Beispiel #5
0
		public idClipModel(idClipModel model)
		{
			_id = model.ID;
			_owner = model.Owner;
			
			_enabled = model.Enabled;
			_entity = model.Entity;

			_origin = model.Origin;
			_axis = model.Axis;
			_bounds = model.Bounds;
			_absBounds = model.AbsoluteBounds;

			_material = model.Material;
			_contents = model.Contents;
			_collisionModelHandle = model.CollisionModelHandle;
			_traceModelCache = null;

			if(model.TraceModelCache != null)
			{
				idConsole.Warning("TODO: LoadModel( *GetCachedTraceModel( model->traceModelIndex ) );");
			}

			_renderModelHandle = model.RenderModelHandle;
			_touchCount = -1;
		}