Thread: Model Displaying Support With Animation Support

Results 1 to 6 of 6
  1. #1 Model Displaying Support With Animation Support 
    Registered Member
    Mr.Client's Avatar
    Join Date
    Jun 2010
    Posts
    2,094
    Thanks given
    100
    Thanks received
    317
    Rep Power
    251
    Notice:
    This is a snippet, i cbf to help out with little things if you throw this into eclipse in your client, rename a few things & read the code you'll understand this fairly easy.

    What This is/does:
    It basically supports Displaying a model with or without animations assigned to it on any aspect you decide, such as the game screen. This works in the same manner the client uses to display character models on the equipment screen, but can be modified for other uses.

    Reason i made this:
    Was originally to make Character orb with character face + animated from outside an interface aspect, and make it fully interactive.

    What i've been doing it with so far?
    Character orb with full interaction + working on Character selection screen before login.

    Code:
    	public Model getMediaModel(int j, int k, int modelType, int modelID, boolean displayAnimation) {
    		Model model;
    		/*
    		 ** still have to refractor the veriables for values when not using animations through packet 200 so i left it the same for now until i get around.
    		 */
    			model = displayAnimation ? RSInterface.getModel(modelType, modelID) : RSInterface.getModel(modelType, modelID);
    		if (model == null)
    			return null;
    		if (k == -1 && j == -1 && model.color == null)
    			return model;
    		Model model_1 = new Model(true, FrameReader.isFrameDead(k) & FrameReader.isFrameDead(j), false, model);
    		if (k != -1 || j != -1)
    			model_1.method469();
    		if (k != -1)
    			model_1.method470(k);
    		if (j != -1)
    			model_1.method470(j);
    		model_1.method479(64, 768, -50, -10, -50, true, true);
    		return model_1;
    	}
    	
    	public void GameSceenModel(int width, int height, int rotationA, int rotationB, int modelZoom, int animationID, int animID, int modelType, int modelID, boolean displayAnimation) {
    		int k3 = Rasterizer.centerX; Rasterizer.centerX = width / 2;
    		int j4 = Rasterizer.centerY; Rasterizer.centerY = height / 2;
    		int i5 = Rasterizer.anIntArray1470[rotationA] * modelZoom >> 16;
    		int l5 = Rasterizer.anIntArray1471[rotationA] * modelZoom >> 16;
    			Model model;
    		if (!displayAnimation) {
    			model = getMediaModel(-1, -1, modelType, modelID, displayAnimation);
    		} else {
    			Animation animation = Animation.getAnim(animationID);
    			model = getMediaModel(animation.anIntArray354[animation.frameCount], animation.frames[animation.frameCount], modelType, modelID, displayAnimation);
    		}
    		if (model != null)
    		model.method482(rotationB, 0, rotationA, 0, i5, l5, 0);
    		Rasterizer.centerX = k3;
    		Rasterizer.centerY = j4;
    	}
    YOU CANT JUST PASTE THIS INTO YOUR CLIENT AND IT WILL WORK, YOU MUST DO SOME MODIFICATION, BUT ANYONE WITH BASIC KNOWLEDGE AND ABILITY TO READ WILL BE ABLE TO MAKE USE

    ENJOY!
    Reply With Quote  
     

  2. Thankful user:


  3. #2  
    Registered Member
    jordan641's Avatar
    Join Date
    Apr 2010
    Posts
    1,809
    Thanks given
    70
    Thanks received
    128
    Rep Power
    189
    Looks nice, good job. Don't really have any use for this though
    Reply With Quote  
     

  4. #3  
    Registered Member Market Banned Market Banned


    Join Date
    Feb 2010
    Age
    25
    Posts
    3,068
    Thanks given
    913
    Thanks received
    349
    Rep Power
    385
    thanks works nice!
    Reply With Quote  
     

  5. #4  
    Registered Member
    Mr.Client's Avatar
    Join Date
    Jun 2010
    Posts
    2,094
    Thanks given
    100
    Thanks received
    317
    Rep Power
    251
    Quote Originally Posted by Massive' View Post
    thanks works nice!
    np, enjoy.
    Reply With Quote  
     

  6. #5  
    q.q


    Join Date
    Dec 2010
    Posts
    6,535
    Thanks given
    1,072
    Thanks received
    3,534
    Rep Power
    4752
    Code:
    //drawing animated models
    					int oldXMID = Rasterizer.centerX;
    					int oldYMID = Rasterizer.centerY;
    					Rasterizer.centerX = childX + rsiChild.width/2;
    					Rasterizer.centerY = childY + rsiChild.height/ 2;
    					int sine = Rasterizer.SINE[rsiChild.modelRotationX] * rsiChild.modelZoom >> 16;
    					int cosine = Rasterizer.COSINE[rsiChild.modelRotationX] * rsiChild.modelZoom >> 16;
    					boolean isEnabled = interfaceSettingConfigs(rsiChild);
    					int animationId;
    					if(isEnabled)
    						animationId = rsiChild.enabledAnimation;
    					else
    						animationId = rsiChild.disabledAnimation;
    					Model model;
    					if(animationId == -1) {
    						model = rsiChild.getAnimatedModel(-1, -1, isEnabled);
    					} else {
    						Sequence sequence = Sequence.cache[animationId];
    						model = rsiChild.getAnimatedModel(sequence.interfaceFrames[rsiChild.animationFrame], sequence.frameIds[rsiChild.animationFrame], isEnabled);
    					}
    					if(model != null) {
    						model.renderSingle(rsiChild.modelRotationY, 0, rsiChild.modelRotationX, 0, sine, cosine);
    					}
    					Rasterizer.centerX = oldXMID;
    					Rasterizer.centerY = oldYMID;
    Code:
    	public Model getAnimatedModel(int interfaceFrame, int frameID, boolean isEnabled) {
    		Model model;
    		if (isEnabled)
    			model = getModel(enabledMediaType, enabledMediaID);
    		else
    			model = getModel(disabledMediaType, disabledMediaID);
    		if (model == null)
    			return null;
    		if (frameID == -1 && interfaceFrame == -1 && model.triangleColourOrTexture == null)
    			return model;
    		Model animated = new Model(true, Animation.isNullFrame(frameID)
    				& Animation.isNullFrame(interfaceFrame), false, model);
    		if (frameID != -1 || interfaceFrame != -1)
    			animated.createBones();
    		if (frameID != -1)
    			animated.applyTransform(frameID);
    		if (interfaceFrame != -1)
    			animated.applyTransform(interfaceFrame);
    		animated.light(64, 768, -50, -10, -50, true);
    		return animated;
    	}
    is what my ones are refactored as

    might want to also include the model types

    1 = regular model
    2 = npc head model
    3 = our players head model
    4 = item inventory model
    Reply With Quote  
     

  7. #6  
    Registered Member
    Mr.Client's Avatar
    Join Date
    Jun 2010
    Posts
    2,094
    Thanks given
    100
    Thanks received
    317
    Rep Power
    251
    Quote Originally Posted by Harlan View Post
    Code:
    //drawing animated models
    					int oldXMID = Rasterizer.centerX;
    					int oldYMID = Rasterizer.centerY;
    					Rasterizer.centerX = childX + rsiChild.width/2;
    					Rasterizer.centerY = childY + rsiChild.height/ 2;
    					int sine = Rasterizer.SINE[rsiChild.modelRotationX] * rsiChild.modelZoom >> 16;
    					int cosine = Rasterizer.COSINE[rsiChild.modelRotationX] * rsiChild.modelZoom >> 16;
    					boolean isEnabled = interfaceSettingConfigs(rsiChild);
    					int animationId;
    					if(isEnabled)
    						animationId = rsiChild.enabledAnimation;
    					else
    						animationId = rsiChild.disabledAnimation;
    					Model model;
    					if(animationId == -1) {
    						model = rsiChild.getAnimatedModel(-1, -1, isEnabled);
    					} else {
    						Sequence sequence = Sequence.cache[animationId];
    						model = rsiChild.getAnimatedModel(sequence.interfaceFrames[rsiChild.animationFrame], sequence.frameIds[rsiChild.animationFrame], isEnabled);
    					}
    					if(model != null) {
    						model.renderSingle(rsiChild.modelRotationY, 0, rsiChild.modelRotationX, 0, sine, cosine);
    					}
    					Rasterizer.centerX = oldXMID;
    					Rasterizer.centerY = oldYMID;
    Code:
    	public Model getAnimatedModel(int interfaceFrame, int frameID, boolean isEnabled) {
    		Model model;
    		if (isEnabled)
    			model = getModel(enabledMediaType, enabledMediaID);
    		else
    			model = getModel(disabledMediaType, disabledMediaID);
    		if (model == null)
    			return null;
    		if (frameID == -1 && interfaceFrame == -1 && model.triangleColourOrTexture == null)
    			return model;
    		Model animated = new Model(true, Animation.isNullFrame(frameID)
    				& Animation.isNullFrame(interfaceFrame), false, model);
    		if (frameID != -1 || interfaceFrame != -1)
    			animated.createBones();
    		if (frameID != -1)
    			animated.applyTransform(frameID);
    		if (interfaceFrame != -1)
    			animated.applyTransform(interfaceFrame);
    		animated.light(64, 768, -50, -10, -50, true);
    		return animated;
    	}
    is what my ones are refactored as

    might want to also include the model types

    1 = regular model
    2 = npc head model
    3 = our players head model
    4 = item inventory model
    The model type is set in get model method if you read it, its pretty clear
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. Support or Dont Support??
    By B B F in forum Suggestions
    Replies: 7
    Last Post: 11-02-2011, 10:31 AM
  2. [SUPPORT] Runeful Signatures! [SUPPORT]
    By dragon kk in forum Showcase
    Replies: 3
    Last Post: 10-18-2009, 06:28 PM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •