Exemple #1
0
        public T generateAsset <T, U>(AssetUri uri, U data)
            where T : IAsset <U>
            where U : IAssetData
        {
            if (!uri.isValid())
            {
                logger.warn("Invalid asset uri: {0}", uri);
                return(default(T));
            }

            AssetFactory2 factory;

            if (!_factories.TryGetValue(uri.type.id, out factory))
            {
                logger.warn("Unsupported asset type: {0}", uri.type);
                return(default(T));
            }

            var t = factory(uri, data);

            if (t is T)
            {
                return((T)t);
            }

            if (t != null)
            {
                logger.error("factory returned a type '{0} 'that wasn't of T", t.GetType());
            }

            return(default(T));
        }
Exemple #2
0
 public AbstractAsset(AssetUri uri)
 {
     this.uri = uri;
 }
Exemple #3
0
 public bool Equals(AssetUri uri)
 {
     return(this.normalisedName == uri.normalisedName);
 }
Exemple #4
0
        public static IMesh generateAsset(AssetType type, MeshData data)
        {
            var uri = new AssetUri(AssetType.MESH, "Temp", Guid.NewGuid().ToString());

            return(CoreRegistry.require <AssetManager>(AssetManager.Uri).generateAsset <IMesh, MeshData>(uri, data));
        }