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

Using EnableMatrix with a Y Axis inverted Matrix doesn't seem to work anymore. #6125

Open
MagentaIris opened this issue Dec 18, 2024 · 0 comments

Comments

@MagentaIris
Copy link

MagentaIris commented Dec 18, 2024

Image

64-Bit. If you need more code and context please brick my face for more.

Using an Inverted matrix scale on the Y Axis for View Model Flipping doesn't seem to work anymore?

I'm trying it alongside using render.CullMode(1) to flip a viewmodel (Yes, the viewmodel is a Clientside Model.)

Before rendering it via DrawModel() (Yes it is NoDrawn first)

Here's my creation method:

GAME_VIEWMODEL1 = ClientsideModel( Model(CVM_DefaultModel), RENDERGROUP_OPAQUE )
GAME_VIEWMODEL1:SetPos( POS )
GAME_VIEWMODEL1:SetAngles( ANG )
GAME_VIEWMODEL1:SetNoDraw(true)

Here's my matrix's:

INV_MATRIX = Matrix()
INV_MATRIX:Scale( Vector(1,-1,1) )

NORM_MATRIX = Matrix()
NORM_MATRIX:Scale( Vector(1,1,1) )

Here's my rendering function (VM in this context is GAME_VIEWMODEL1):

if FLIP then
	render.CullMode(1)
	if not VM.FLIP_MODE then
		VM.FLIP_MODE = true
		VM:EnableMatrix("RenderMultiply",INV_MATRIX)
	end
else
	render.CullMode(0)
	if VM.FLIP_MODE then
		VM.FLIP_MODE = false
		VM:EnableMatrix("RenderMultiply",NORM_MATRIX)
	end
end
		
local WEP = OWN:GetActiveWeapon()
			
if WEP and not WEP.WEP_Scoping then		
	VM:DrawModel()			
end
			
render.CullMode(0)

This is where my rendering function is being called from:

function SWEP:PostDrawViewModel( vm, wep, pl )
		
	if CVM_DrawViewModels then
			
		DO_DRAW_DRAWS = true
			
		CVM_DrawViewModels()
		
		DO_DRAW_DRAWS = false
			
	end

end

This does not invert the models scale on the Y axis, it does change the cullmode correctly though.

Trying this on a normal ClientsideModel created using lua_run_cl seems to work fine, But I'm drawing my stuff here inside of PostDrawViewModel() in an active SWEP.

Any ideas why this is being a problem? I've tried disabling a lot of different parts of the code but it never seems to work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant