karlis Posted June 16, 2011 Share Posted June 16, 2011 aBoneList = {} --right leg aBoneList[54] = 53; aBoneList[53] = 52; aBoneList[52] = 51; aBoneList[51] = 1; --left leg aBoneList[44] = 43; aBoneList[43] = 42; aBoneList[42] = 41; aBoneList[41] = 1; --spine aBoneList[1] = 2; aBoneList[2] = 3; aBoneList[3] = 4; --right arm aBoneList[26] = 25; aBoneList[25] = 24; aBoneList[24] = 23; aBoneList[23] = 22; aBoneList[21] = 22; --right arm aBoneList[36] = 35; aBoneList[35] = 34; aBoneList[34] = 33; aBoneList[33] = 32; aBoneList[31] = 32; --head aBoneList[4] = 6; aBoneList[6] = 7; aBoneList[7] = 4; --torso aBoneList[32] = 41; aBoneList[22] = 51; -- aBoneFarList = {} --right leg aBoneFarList [54] = 51; --left leg aBoneFarList [44] = 41; --spine aBoneFarList [1] = 4; --right arm aBoneFarList [26] = 22; --right arm aBoneFarList [36] = 32; --head aBoneFarList [6] = 7; --torso aBoneFarList [32] = 41; aBoneFarList [22] = 51; -- function drawPedBones (ped) local aList = {}; if isElement(ped) then local x,y,z = getCameraMatrix(); local px,py,pz = getElementPosition(ped); local fDistance = getDistanceBetweenPoints3D(x,y,z,px,py,pz); if fDistance < 50 then aList = aBoneList; elseif fDistance < 300 then aList = aBoneFarList; end for iFrom,iTo in pairs(aList) do local x1,y1,z1 = getPedBonePosition(ped,iFrom); local x2,y2,z2 = getPedBonePosition(ped,iTo); if not (x1 or x2) then return; end local screenX1, screenY1 = getScreenFromWorldPosition ( x1,y1,z1 ); local screenX2, screenY2 = getScreenFromWorldPosition ( x2,y2,z2 ); local playerTeam = getPlayerTeam" class="kw2">getPlayerTeam" class="kw2">getPlayerTeam" class="kw2">getPlayerTeam( ped ); local red,green,blue = 0,0,0; if playerTeam then red,green,blue = getTeamColor ( playerTeam ) end if screenX1 and screenX2 then dxDrawLine ( screenX1, screenY1, screenX2, screenY2, tocolor(red,green,blue,255) ); end end end end Uses less GFX speed - all DX funktions have the drawback that they are pushed through the pipe, which is the bottleneck of a GFX card. I dont really understand how, but your code add more 4~6 fps, thanx) he doesn't load all the bones if ped is far away. Link to comment
Phat Looser Posted June 16, 2011 Share Posted June 16, 2011 You even could count the frames per second and use that as the "low poly" distance. Link to comment
karlis Posted June 16, 2011 Share Posted June 16, 2011 btw i suggest you adding something like a dot to place where the bone is located, imo would look better. Link to comment
Dre-+- Posted October 17, 2011 Author Share Posted October 17, 2011 RESOURCE UPDATED: -Total remaking of engine -Added exports -Fixed some debug errors For see exports go to: Mta wiki page btw i suggest you adding something like a dot to place where the bone is located, imo would look better. Ye, i thik its will be looks better, but drawing alot of lines can take alot of perfomance. Link to comment
karlis Posted October 17, 2011 Share Posted October 17, 2011 drawing many dx images doesn't hurt performance that much, until they don't go houndreds. for instance my ivhud resource can use ~50-100dx functions per frame, maybe even more, and there's only few fps drop. Link to comment
Phat Looser Posted October 17, 2011 Share Posted October 17, 2011 It DOES hurt the performance. GFX cards are weird, and no matter what you do, there'll always be SOMEONE who has problems with it. Thats why I am trying shaders and such stuff on three different laptops before I release them. Quite the trouble. Best example is the dxLines, normally I can draw about 100 on Laptop1 without losing 1 fps, Laptop2 (which normally has the better specs) can only do 50 and drops from 100 to 60 FPS. Its all about how the hardware handles the problem... Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now