MCPcopy Create free account
hub / github.com/StrongPC123/Far-Cry-1-Source-Full / UpdateHeatSources

Method UpdateHeatSources

CryAnimation/CryModelState.cpp:1131–1201  ·  view source on GitHub ↗

///////////////////////////////////////////////////////////////////// updates all heat sources (read from CGF, kept in the Model) in the given object The global ones can later be extracted via GetBoundLight() member of ICryCharInstance interface

Source from the content-addressed store, hash-verified

1129// updates all heat sources (read from CGF, kept in the Model) in the given object
1130// The global ones can later be extracted via GetBoundLight() member of ICryCharInstance interface
1131void CryModelState::UpdateHeatSources (CCObject * pObj, const SRendParams & RendParams)
1132{
1133 SelfValidate();
1134 unsigned numBindings = m_pMesh->numBoneLights();
1135
1136 // construct the DLights for the first time this function is called
1137 if (m_arrHeatSources.size() != numBindings)
1138 {
1139 m_arrHeatSources.reinit(numBindings);
1140 for (unsigned nBinding = 0; nBinding < numBindings; ++nBinding)
1141 {
1142 CBoneLightBindInfo& rBinding = m_pMesh->getBoneLight(nBinding);
1143 CryBone& rBone = getBone(rBinding.getBone());
1144 CDLight& rDLight = m_arrHeatSources[nBinding];
1145 rBinding.initDLight (rDLight);
1146 }
1147 }
1148
1149 // the self-heat intensity of the character.
1150 // if it's 0, there's no point in adding the heat sources to the renderer
1151 float fHeatIntensity = 1.0f;
1152 if (pObj->m_ShaderParams)
1153 fHeatIntensity = SShaderParam::GetFloat("heatintensity", pObj->m_ShaderParams, -1);
1154
1155 bool bHeatVisionMode = g_GetIRenderer()->EF_GetHeatVision();
1156
1157
1158 // the model matrix in the world space
1159 Matrix44 matModel = GetModelMatrix (pObj);
1160
1161 // update DLight positions and add them to the renerer
1162 if (!bHeatVisionMode || fHeatIntensity > 0)
1163 for (unsigned nBinding = 0; nBinding < numBindings; ++nBinding)
1164 {
1165 CBoneLightBindInfo& rBinding = m_pMesh->getBoneLight(nBinding);
1166
1167 if (bHeatVisionMode)
1168 {
1169 if (!rBinding.isHeatSource())
1170 continue;
1171 }
1172 else
1173 {
1174 if (!rBinding.isLightSource())
1175 continue;
1176 }
1177
1178 CryBone& rBone = getBone(rBinding.getBone());
1179 CDLight& rDLight = m_arrHeatSources[nBinding];
1180
1181 // unwrap (change #if 0 to #if 1) the following code and pass matModel to the updateDLight
1182 // instead of the rBone global matrix, in order to have the light position
1183 // returned in World coordinates
1184 rDLight.m_fDirectFactor = 0;
1185
1186 Matrix44 matBone = rBone.GetGlobalMatrix() * matModel;
1187
1188 if (g_GetCVars()->ca_Debug()) {

Callers 1

RenderMethod · 0.80

Calls 15

g_GetIRendererFunction · 0.85
GetModelMatrixFunction · 0.85
g_GetCVarsFunction · 0.85
debugDrawBBoxFunction · 0.85
numBoneLightsMethod · 0.80
EF_GetHeatVisionMethod · 0.80
EF_ADDDlightMethod · 0.80
CryAABBClass · 0.70
sizeMethod · 0.45
reinitMethod · 0.45
getBoneMethod · 0.45
initDLightMethod · 0.45

Tested by

no test coverage detected