Class PrimitiveModelCache
Cache for models generated using PrimitiveModelBuilder.
Inheritance
PrimitiveModelCache
  Implements
Inherited Members
Namespace: Evergine.Components.Primitives
Assembly: Evergine.Components.dll
Syntax
public class PrimitiveModelCache : SceneManager, IDependencyObject
  Fields
graphicsContext
The graphics context dependency used for model buffer generation.
Declaration
[BindService(true)]
protected GraphicsContext graphicsContext
  Field Value
| Type | Description | 
|---|---|
| GraphicsContext | 
Properties
LoadedModelsCount
Gets the number of different model instances loaded.
Declaration
public int LoadedModelsCount { get; }
  Property Value
| Type | Description | 
|---|---|
| int | 
Methods
LoadOrCreateModel(int, string, Action<PrimitiveModelBuilder>)
Loads a model from the cache. If the model does not exists a new one is created.
Declaration
public Model LoadOrCreateModel(int primitiveHashCode, string primitiveName, Action<PrimitiveModelBuilder> buildAction)
  Parameters
| Type | Name | Description | 
|---|---|---|
| int | primitiveHashCode | The hash code of the primitive to load.  | 
      
| string | primitiveName | A string representation of the primitive name.  | 
      
| Action<PrimitiveModelBuilder> | buildAction | The build action based on PrimitiveModelBuilder.  | 
      
Returns
| Type | Description | 
|---|---|
| Model | The model for the given primitive.  | 
      
ToString()
Declaration
public override string ToString()
  Returns
| Type | Description | 
|---|---|
| string | 
Overrides
UnloadModel(int)
Dereferences the model associated with the primitive hash code from the cache.
If no other reference exists, the model is disposed.
Declaration
public bool UnloadModel(int primitiveHashCode)
  Parameters
| Type | Name | Description | 
|---|---|---|
| int | primitiveHashCode | The hash code of the primitive to unload.  | 
      
Returns
| Type | Description | 
|---|---|
| bool | true if the model was found and unloaded from the cache.  |