Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames

Engine.GenericExternalCamera


00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
class GenericExternalCamera extends Actor 
    HideCategories(Advanced, Collision, Events, Force, Karma, LightColor, Lighting, Movement, Object, Sound)
    placeable
    native;

enum EOptimizeOption
{
    OPTIMIZE_None,
    OPTIMIZE_Radius,
    OPTIMIZE_Zone,
    OPTIMIZE_VisibleZones
};

var() ScriptedTexture CameraTexture    "ScriptedTexture that this class renders into.  The ScriptedTexture can be combined with other materials for special effects.";
var() int             ResolutionX      "The X Resolution of the desired rendered texture.  Lower resolutions are faster but more pixelated.";
var() int             ResolutionY      "The Y Resolution of the desired rendered texture.  Lower resolutions are faster but more pixelated.";
var() int             OptimizedRadius  "Used only if OptimizeFor is set to OPTIMIZE_Radius";
var() int             UpdateRate       "How many times per second to update the texture";
var() int             FOV              "The desired field of view for the rendered viewport";
var() EOptimizeOption OptimizeFor      "How to optimize this camera.  Note: OPTIMIZE_VisibleZones does nothing currently";
var bool bTimerHasElapsed;

function PostBeginPlay()
{
   Super.PostBeginPlay();
   Initialize();
}

function PostLoadGame()
{
	super.PostLoadGame();
	Initialize();
}

function Initialize()
{
    CameraTexture.Client = Self;
    CameraTexture.bNotifyClientBeforeRendering = true;
    CameraTexture.SetSize(ResolutionX, ResolutionY);
    // Make sure it updates at least once so we don't see garbage...
    CameraTexture.Revision++;
    SetTimer(1.0 / UpdateRate,true);
    
}

simulated event Destroyed()
{
    if (CameraTexture != None)
    {
        // prevent GC failure due to hanging actor refs
        CameraTexture.Client = None;
    }

	Super.Destroyed();
}

event PreScriptedTextureRendered(ScriptedTexture Tex)
{
    if ( bTimerHasElapsed )
    {
        Tex.Revision++;
        bTimerHasElapsed = false;
    }    
}

event RenderTexture(ScriptedTexture inTexture)
{
    inTexture.DrawPortal(0, 0, ResolutionX, ResolutionY, Level.GetLocalPlayerController(), GetViewLocation(), GetViewRotation(), FOV,,true);
}

simulated function Rotator GetViewRotation()
{
    return Rotation;
}

simulated function Vector GetViewLocation()
{
    return Location;
}

simulated function Timer()
{
    switch(OptimizeFor)
    {
        case OPTIMIZE_Radius:
            if ( VSize( Level.GetLocalPlayerController().Pawn.Location - Location ) > OptimizedRadius )     
                return;
            break;
        case OPTIMIZE_Zone:
            if ( Level.GetLocalPlayerController().Pawn.Region.Zone != Region.Zone )
                return;
            break;
    }

    bTimerHasElapsed=true;
}

defaultproperties
{
    ResolutionX=256
    ResolutionY=256
    UpdateRate=60
    FOV=90
    OptimizedRadius=1024
    bDirectional=true
    bHidden=true
    RemoteRole=ROLE_None
    Texture=Texture'Engine_res.subactionfov'
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: ne 5.9.2004 16:01:22.000 - Creation time: st 23.5.2018 00:10:43.557 - Created with UnCodeX