Nuclide
Software Development Kit for id Technology (BETA)
Loading...
Searching...
No Matches
precacheAPI_t Struct Reference

About this class

Precaching library.

Public Member Functions

float Model (string pathToModel)
 Precaches a given model file and additional helper files.
 
float Sound (string soundDef)
 Precaches a given sound def or sample.
 
musictrack_t Music (string musicTrack)
 Precaches a given music track.
 
float Particle (string particleEffect)
 Precaches a given particle effect.
 
float Entity (string className)
 Precaches a given entity class.
 
string SpriteFrame (string spritePath, float frameNum, float timeIntoFrame)
 Precaches a given sprite frame to a material.
 
string Material (string materialName)
 Precaches a given material.
 

Member Function Documentation

◆ Entity()

float precacheAPI_t::Entity ( string className)

Precaches a given entity class.

Ensuring models, sounds and other assets referenced within are loaded ahead of time.

Parameters
classNameto precache
Returns
Success.

◆ Material()

string precacheAPI_t::Material ( string materialName)

Precaches a given material.

On a server, this function will ensure that a model is added to the connection resource list. On a client-side progs, you usually want to call this function within HUD_ReloadVideoResources or ClientGame_RendererRestart.

Note
The engine may choose to create a material for you, for example when you tell it the path to an image of format listed in the r_imageextensions console variable. The engine may also create a fallback image. This behaviour is implementation specific.
Parameters
particleEffectto precache
Returns
cached material string handle

◆ Model()

float precacheAPI_t::Model ( string pathToModel)

Precaches a given model file and additional helper files.

precache.Model("models/weapons/v_pistol.vvm");

Parameters
pathToModelto precache
Returns
modelindex value.

◆ Music()

musictrack_t precacheAPI_t::Music ( string musicTrack)

Precaches a given music track.

precache.Music("music/e1m1.ogg"); precache.Music("music/track02.ogg");

Parameters
musicTrackto precache
Returns
music track handle.

◆ Particle()

float precacheAPI_t::Particle ( string particleEffect)

Precaches a given particle effect.

The following loads r_part impactSpark from particles/weapon_laser.cfg.

`precache.Particle("weapon_laser.impactSpark");

Parameters
particleEffectto precache
Returns
particle effect num.

◆ Sound()

float precacheAPI_t::Sound ( string soundDef)

Precaches a given sound def or sample.

precache.Sound("Foo.Bar"); precache.Sound("foo/bar.wav");

Parameters
soundDefto precache
Returns
sound def id.

◆ SpriteFrame()

string precacheAPI_t::SpriteFrame ( string spritePath,
float frameNum,
float timeIntoFrame )

Precaches a given sprite frame to a material.

An image from a .spr type sprite file.

Parameters
spritePathis the path to a sprite, e.g. "sprites/rain.spr"
frameNumspecifies the framegroup/sequence of which we pick from
timeIntoFramespecifies the time into the sequence we'll pretend to be at
Returns
name of a material containing the desired sprite frame

The documentation for this struct was generated from the following file: