public GLRenderer() { programs = new Dictionary <String, GLShaderProgram>(); shaders = new Dictionary <String, GLShader>(); billboard = new GLBillboard(); staticModel = new GLStaticModel(); riggedModel = new GLRiggedModel(); boneTransforms = new Matrix4[MAX_BONE_TRANSFORMS]; textures = new Dictionary <String, GLTexture>(); isSkinning = false; Reset(); }
private bool CreateRiggedModel(LOLModel model, Logger logger) { bool result = true; logger.Event("Creating rigged model."); // Open the skn file. SKNFile sknFile = new SKNFile(); if (result == true) { result = SKNReader.Read(model.skn, ref sknFile, logger); } // Open the skl file. SKLFile sklFile = new SKLFile(); if (result == true) { result = SKLReader.Read(model.skl, ref sklFile, logger); } // Open the anm files. Dictionary <String, ANMFile> anmFiles = new Dictionary <String, ANMFile>(); if (result == true) { foreach (var a in model.animations) { ANMFile anmFile = new ANMFile(); bool anmResult = ANMReader.Read(a.Value, ref anmFile, logger); if (anmResult == true) { anmFiles.Add(a.Key, anmFile); } } } // Create the model. riggedModel = new GLRiggedModel(); if (result == true) { result = riggedModel.Create(sknFile, sklFile, anmFiles, logger); } // Set up an initial animation. if (result == true) { if (anmFiles.Count > 0) { riggedModel.SetCurrentAnimation(anmFiles.First().Key); riggedModel.SetCurrentFrame(0, 0); } } // // Create Model Texture. // if (result == true) { // Texture stored in RAF file. result = CreateTexture(model.texture, TextureTarget.Texture2D, GLTexture.SupportedImageEncodings.DDS, logger); // Store it in our new model file. if (result == true) { String name = model.texture.FileName; int pos = name.LastIndexOf("/"); name = name.Substring(pos + 1); riggedModel.TextureName = name; } } if (result == false) { logger.Error("Failed to create rigged model."); } return(result); }