cam.StartMaterialOverride

From GMod Wiki

Jump to: navigation, search


Function
Syntax cam.StartMaterialOverride( Material override )
Where is this used?
Description:
Sets the material to be used for rendering.
Returns: nil
Part of Library: cam
Realm: NewerClient.png
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=Cam.StartMaterialOverride]Cam.StartMaterialOverride [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]



Examples

DescriptionMakes all models green and transparent.
Used onNewerClient.png
Code
 
local mat = Material("models/debug/white")
function MakeMyPlayersGreenAndTransparent()
	cam.Start3D( EyePos(), EyeAngles() )
		for k, v in pairs( ents.GetAll() ) do
			if ValidEntity( v ) && util.IsValidModel( v:GetModel() or "" ) then
				render.SuppressEngineLighting( true )
				render.SetColorModulation( 0, 1, 0 )
				render.SetBlend( 0.5 )
				cam.StartMaterialOverride( mat )
 
				v:DrawModel()
 
				render.SuppressEngineLighting( false )
				render.SetColorModulation( 1, 1, 1 )
				render.SetBlend( 1 )
				cam.StartMaterialOverride( 0 )
			end
		end
	cam.End3D()
end
hook.Add( "RenderScreenspaceEffects", "GreenAndTrans", MakeMyPlayersGreenAndTransparent )
 
OutputN/A


Additional Notes

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox