This article's documentation is for anything that uses the Source engine. Click here for more information.
This article's documentation is for Source 2. Click here for more information.

Func monitor: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
mNo edit summary
m (→‎Inputs: Substituted IO templates)
 
(68 intermediate revisions by 33 users not shown)
Line 1: Line 1:
== Entity Desciption==
{{Ent not in fgd}}
{{CD|CFuncMonitor|base=CFuncBrush|file1=Func_Monitor.cpp}}
{{this is a|brush entity|name=func_monitor|except=Left 4 Dead series|engine=Source|engine1=Source 2}} It displays a real-time scene captured from a [[point_camera]] somewhere else in the world.


A monitor that renders the view from a given [[point_camera]] entity.
In {{src|4}} for the entity to work, the surface(s) on which the camera view will be displayed must have a material with <code>[[$basetexture]] _rt_Camera</code>. Stock materials that work are <code>dev\dev_combinemonitor*</code> and <code>dev\dev_tvmonitor*</code>.
When a func_monitor is created, the surface in which the view from the [[point_camera]] will be displayed from must be assigned to a material that uses the special value "_rt_Camera" in its "$basetexture" property (such as the dev/dev_combinemonitor* and dev/dev_tvmonitor* textures). It is also a good idea to Justify to Fit in the Face Edit Sheet texture dialog for the combinemonitor surface so the camera view isn't cut off.


== Keys ==
[[File:City17 trainstation.jpg|250px|thumbnail|right|A broadcast from Dr. Breen.]]


{{bug|Cameras may fail to network properly in multiplayer. See below for a code fix. Fixed in {{tf2|2.bold}}.}}
{{note|Unless you set up multiple render textures in your mod's binaries, ''only one'' point_camera can be rendered at any one time. The first camera in the map will appear on all monitors. Multiple cameras at once are technically possible, as long as you ensure that only one func_monitor is in the [[PVS]] at any given time, although this will not work in splitscreen (but will work in online multiplayer).}}
{{codenote|To enable monitors in your non-HL2 mod, you must:
* Include the entity's client .cpp file (found in <code>\client\hl2\</code>).
* Include the entity's server .cpp and .h files (found in <code>\server\hl2\</code>).
* <code>#define USE_MONITORS</code> at the top of <code>\client\viewrender.cpp</code> and <code>\client\view.cpp</code>.
* Fix a multiplayer bug in <code>CPointCamera::CPointCamera()</code> by setting <code>m_bActive</code> to true.}}


'''Name targetname'''
==Keyvalues==
''<target_source>'' The name that other entities refer to this entity by.
{{KV Targetname}}
{{KV|Camera name|intn=target|targetname|The camera to render.}}


'''Parent parentname'''
==Inputs==
''<target_destination>'' The name of this entity's parent in the movement hierarchy. Entities with parents move with their parent.
{{I|SetCamera|Sets the camera to use for this monitor. Takes the name of a {{ent|point_camera}} entity in the map.|param=targetname}}
{{I|Toggle|Enables the entity if it is disabled, and disables if it is enabled.}}
{{I|Enable|Make the entity visible and solid.}}
{{I|Disable|Make the entity invisible and non-solid.}}


'''Origin (X Y Z)'''
== FGD Code ==
''origin <origin>'' The position of this entity's center in the world. Rotating entities typically rotate around their origin.
{{CodeBlock|<nowiki>@SolidClass base(func_brush) = func_monitor :
"A monitor that renders the view from a given point_camera entity."
[
target(target_destination) : "Camera name"
// Inputs
input Toggle(void) : "Toggle - If on, turn off, if off, turn on."
input Enable(void) : "Enable."
input Disable(void) : "Disable."
input SetCamera(string) : "Sets the camera to use for this monitor. Takes the name of a point_camera entity in the map."
]
</nowiki>}}


'''Render FX'''
==See also==
''renderfx <choices>''
* {{ent|info_camera_link}} - For rendering point_cameras on [[model]]s.
 
* {{ent|point_camera}}
'''Render Mode'''
* {{ent|env_speaker}}
''rendermode <choices>'' Used to set a non-standard rendering mode on this entity. See also 'FX Amount' and 'FX Color'.
[[Category:Camera]]
 
'''FX Amount (0 - 255)'''
'' renderamt <integer>'' The FX amount is used by the selected Render Mode.
 
'''FX Color (R G B)'''
'' rendercolor <color255>'' The FX color is used by the selected Render Mode.
 
'''Disable Receiving Shadows'''
'' disablereceiveshadows <choices>''
 
'''Global Entity Name'''
''globalname <string>'' Name by which this entity is linked to another entity in a different map. When the player transitions to a new map, entities in the new map with globalnames matching entities in the previous map will have the previous map's state copied over their state.
 
'''Input Filter'''
''InputFilter <choices>'' Used to specify which inputs this entity will accept.
 
'''Start Disabled'''
''StartDisabled <choices>''
 
'''Disable shadows'''
''disableshadows <choices>''
 
'''spawnflags'''
''spawnflags <flags>''
'''
Minimum Light Level'''
''_minlight <string>'' The minimum level of ambient light that hits this brush.
 
'''Solidity Solidity'''
''<choices>'' Used to control the solidity/collision of these brushes.
 
'''NPC class excluded from collisions'''
''excludednpc <string>'' If an NPC classname (i.e. npc_zombie) is specified here, NPCs of that type won't collide with these brushes.
 
'''Solid BSP'''
''solidbsp <choices>'' Set this if this brush is in heirarchy with a moving object of some kind, and the player can stand on this brush.
 
'''Camera name'''
''target <target_destination>'' The '''Name''' of the [[point_camera]] in which the viewpoint is rendered from.
 
 
 
== Inputs ==
 
'''Kill''' Removes this entity from the world.
 
'''KillHierarchy''' Removes this entity and all its children from the world.
 
'''AddOutput <string>''' Adds an entity I/O connection to this entity. Format: <output name> <targetname>:<inputname>:<parameter>:<delay>:<max times to fire (-1 == infinite)>. Very dangerous, use with care.
 
'''FireUser1''' Causes this entity's OnUser1 output to be fired.
 
'''FireUser2''' Causes this entity's OnUser2 output to be fired.
 
'''FireUser3''' Causes this entity's OnUser3 output to be fired.
 
'''FireUser4''' Causes this entity's OnUser4 output to be fired.
 
'''SetParent <string>''' Changes the entity's parent in the movement hierarchy.
 
'''SetParentAttachment <string>''' Change this entity to attach to a specific attachment point on its parent. Entities must be parented before being sent this input. The parameter passed in should be the name of the attachment.
 
'''ClearParent''' Removes this entity from the the movement hierarchy, leaving it free to move independently.
 
'''Enable''' Enable this entity.
 
'''Disable''' Disable this entity.
 
'''DisableShadow''' Turn shadow off.
 
'''EnableShadow''' Turn shadow on.
 
'''Toggle Toggle''' - If on, turn off, if off, turn on.
 
'''Enable''' Enable.
 
'''Disable''' Disable.
 
'''SetCamera <string>''' Sets the camera to use for this monitor. Takes the name of a point_camera entity in the map.
 
 
 
== Outputs ==
 
 
'''OnUser1''' Fired in response to FireUser1 input.
 
'''OnUser2''' Fired in response to FireUser2 input.
 
'''OnUser3''' Fired in response to FireUser3 input.
 
'''OnUser4''' Fired in response to FireUser4 input.
 
----
''See Also''
 
* [[info_camera_link]]
* [[List of entities]]

Latest revision as of 10:56, 21 April 2025

Icon-NotInFGD.png
This entity is not in the Counter-Strike: Source FGD by default.
See below for instructions on making it available.
C++ Class hierarchy
CFuncMonitor
CFuncBrush
CBaseEntity
C++ Func_Monitor.cpp

func_monitor is a brush entity available in all Source Source and Source 2 Source 2 games except Left 4 Dead seriesLeft 4 Dead series Left 4 Dead series. It displays a real-time scene captured from a point_camera somewhere else in the world.

In Source Source for the entity to work, the surface(s) on which the camera view will be displayed must have a material with $basetexture _rt_Camera. Stock materials that work are dev\dev_combinemonitor* and dev\dev_tvmonitor*.

A broadcast from Dr. Breen.
Icon-Bug.pngBug:Cameras may fail to network properly in multiplayer. See below for a code fix. Fixed in Team Fortress 2 Team Fortress 2.  [todo tested in ?]
Note.pngNote:Unless you set up multiple render textures in your mod's binaries, only one point_camera can be rendered at any one time. The first camera in the map will appear on all monitors. Multiple cameras at once are technically possible, as long as you ensure that only one func_monitor is in the PVS at any given time, although this will not work in splitscreen (but will work in online multiplayer).
Cpp.pngCode:To enable monitors in your non-HL2 mod, you must:
  • Include the entity's client .cpp file (found in \client\hl2\).
  • Include the entity's server .cpp and .h files (found in \server\hl2\).
  • #define USE_MONITORS at the top of \client\viewrender.cpp and \client\view.cpp.
  • Fix a multiplayer bug in CPointCamera::CPointCamera() by setting m_bActive to true.

Keyvalues

Name (targetname) <string>[ Edit ]
The name that other entities refer to this entity by, via Inputs/Outputs or other keyvalues (e.g. parentname or target).
Also displayed in Hammer's 2D views and Entity Report.
See also:  Generic Keyvalues, Inputs and Outputs available to all entities

Camera name (target) <targetname>
The camera to render.

Inputs

SetCamera <targetnameRedirectInput/string>
Sets the camera to use for this monitor. Takes the name of a point_camera entity in the map.
Toggle
Enables the entity if it is disabled, and disables if it is enabled.
Enable
Make the entity visible and solid.
Disable
Make the entity invisible and non-solid.

FGD Code

@SolidClass base(func_brush) = func_monitor : "A monitor that renders the view from a given point_camera entity." [ target(target_destination) : "Camera name" // Inputs input Toggle(void) : "Toggle - If on, turn off, if off, turn on." input Enable(void) : "Enable." input Disable(void) : "Disable." input SetCamera(string) : "Sets the camera to use for this monitor. Takes the name of a point_camera entity in the map." ]

See also