.Net 3d modelviewer
-------------------------
By: Allstar
The idea:
So, I was kinda' bored and wanted to continue my "WoW Creature Creator" application, but it seems I deleted the source code and I don't want to re-begin programming. So creating this control takes me (or you) one step closer to a good wow application.
Anyway, that's not important. I just created this control so that you guys can "easily" use a modelviewer for your .net applications.
NOTE: My control has only been tested with C#.net 3.5
The possibilities:
So, what can you do with it?
Well, pretty much the same you can do with WoWhead's 3d modelviewer.
- Support for one model:
Code for one model:
Explanation:Code:modelviewer1.SetModel("39107", (int)Modelviewer.modeltype.Weapon);
With .setmodel you can display a single model on the modelviewer. It requires 2 parameters. The first parameter is a string, it represents the DISPLAY-ID of the model. The second parameter is an integer and It's the modeltype. In this example I used enums to make it easier to code, though you can use simple integers as well.
The enums are as following:
Code:Weapon = 1, Armor = 2, NPC = 8, EquipedArmor = 16
- Support for multiple models that can be equiped (such as armor and weapons):
Code for equipable models:
Explanation:Code:modelviewer1.SetModelForEquip("draenei", "female", equiplist_string);
With .SetModelForEquip you start the render of multiple equipable items.
This function requires 3 parameters.
- The first parameter is a string and represents the race you want to show. This is a simple string without caps, and no spaces.
- The second parameter is also a string and represents the gender of the displayed character (either "male" or "female").
- The third parameter is a bit more tricky. This is the list of items the character will be wearing:
It's easier then it looks. The first entry of the array is a string containing the slot-id. Again you can either use the enums or a number (don't forget to convert to string!) as you can see in the example.Code:string[] equiplist = { Convert.ToString((int)Modelviewer.slot.Head), "15322", Convert.ToString((int)Modelviewer.slot.Offhand), "48339", "5", "13116", "7", "13117", "4", "13115" }; string equiplist_string = String.Join(",", equiplist);
The enums:
The second entry is the DISPLAY-ID of the model you want the character to wear.Code:Ammo = 0, Head = 1, Neck = 2, Shoulder = 3, Shirt = 4, Chest = 5, Belt = 6, Legs = 7, Feet = 8, Wrist = 9, Gloves = 10, Finger1 = 11, Finger2 = 12, Trinket1 = 13, Trinket2 = 14, Back = 15, MainHand = 16, Offhand = 17, Ranged = 18, Tabard = 19
So basically an itemlist should look like: (slot, displayid, slot, displayid, ...)
The last line in the example above just puts everything in that is in the array in one string where all items are separated by a ",".
Well, that's kinda' everything for now. Please note that it's still unfinished and that features will be added.
Anyways, I hope you guys can use this.
~Allstar
Download link:
Code:http://www.michieldemey.be/modelviewerdotnet_example.zip