public ResourceModel( string name, string source ) : base(name) { this.type = ResourceType.MODEL; this.model = new Model( name ); this.model.resource = this; this.IsValid = true; var linesList = source.Split( '\n' ); var parser = new TextParser(); var data = parser.ParseText( source ); foreach( var pair in data ) { switch( pair.Key ) { case "mesh": { this.model.mesh = ( Mesh ) Resource.Get( pair.Value ); } break; case "material": { this.model.material = ( Material ) Resource.Get( pair.Value ); } break; } } }
public ResourceMaterial( string name, string source ) : base(name) { this.type = ResourceType.MATERIAL; this.material = new Material( name ); this.material.resource = this; this.IsValid = true; var linesList = source.Split( '\n' ); var parser = new TextParser(); var data = parser.ParseText( source ); foreach( var pair in data ) { switch( pair.Key ) { case "shader": { this.material.shader = ( ShaderProgram ) Resource.Get( pair.Value ); } break; default: //textures { Console.WriteLine( "pair.Value = {0}", pair.Value ); Texture texture = ( Texture ) Resource.Get( pair.Value ); Console.WriteLine( texture == null ? "null" : "not null" ); texture.resource.Inc(); this.material.AddTexture( pair.Key, texture ); //this.texturesList.Add( pair.Key, texture ); //this.material.shader.AddUniform( new ShaderProgramUniformTexture( pair.Key, texture ) ); } break; } } }
public ResourceMaterial(string name, string source) : base(name) { this.type = ResourceType.MATERIAL; this.material = new Material(name); this.material.resource = this; this.IsValid = true; var linesList = source.Split('\n'); var parser = new TextParser(); var data = parser.ParseText(source); foreach (var pair in data) { switch (pair.Key) { case "shader": { this.material.shader = ( ShaderProgram )Resource.Get(pair.Value); } break; default: //textures { Console.WriteLine("pair.Value = {0}", pair.Value); Texture texture = ( Texture )Resource.Get(pair.Value); Console.WriteLine(texture == null ? "null" : "not null"); texture.resource.Inc(); this.material.AddTexture(pair.Key, texture); //this.texturesList.Add( pair.Key, texture ); //this.material.shader.AddUniform( new ShaderProgramUniformTexture( pair.Key, texture ) ); } break; } } }