Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Micro-optimization for drawing base entities #2158

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ include( "shared.lua" )
Name: Draw
Desc: Draw it!
-----------------------------------------------------------]]
local Entity = FindMetaTable( "Entity" )

function ENT:Draw()
self:DrawModel()
Entity.DrawModel( self )
end

--[[---------------------------------------------------------
Expand Down
4 changes: 3 additions & 1 deletion garrysmod/gamemodes/base/entities/entities/base_anim.lua
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,11 @@ end

if ( CLIENT ) then

local Entity = FindMetaTable( "Entity" )

function ENT:Draw( flags )

self:DrawModel( flags )
Entity.DrawModel( self, flags )

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't it easier to do ENT.Draw = Entity.DrawModel?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, you're right. Thanks.


end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@ else
Name: Draw
Desc: Draw it!
-----------------------------------------------------------]]
local Entity = FindMetaTable( "Entity" )

function ENT:Draw()
self:DrawModel()
Entity.DrawModel( self )
end

--[[---------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,11 @@ end
Name: DrawWorldModel
Desc: Draws the world model (not the viewmodel)
-----------------------------------------------------------]]
local Entity = FindMetaTable( "Entity" )

function SWEP:DrawWorldModel()

self:DrawModel()
Entity.DrawModel( self )

end

Expand All @@ -153,7 +155,7 @@ end
-----------------------------------------------------------]]
function SWEP:DrawWorldModelTranslucent()

self:DrawModel()
Entity.DrawModel( self )

end

Expand Down