private void AddModelSurfaces()
{
// go through each entity that is either visible to the view, or to
// any light that intersects the view (for shadows)
foreach(ViewEntity viewEntity in _viewDefinition.ViewEntities)
{
if(idE.CvarSystem.GetBool("r_useEntityScissors") == true)
{
idConsole.Warning("TODO: entity scissor rect");
/*// calculate the screen area covered by the entity
idScreenRect scissorRect = R_CalcEntityScissorRectangle( vEntity );
// intersect with the portal crossing scissor rectangle
vEntity->scissorRect.Intersect( scissorRect );
if ( r_showEntityScissors.GetBool() ) {
R_ShowColoredScreenRect( vEntity->scissorRect, vEntity->entityDef->index );
}*/
}
float oldFloatTime = 0;
int oldTime = 0;
idE.Game.SelectTimeGroup(viewEntity.EntityDef.Parameters.TimeGroup);
if(viewEntity.EntityDef.Parameters.TimeGroup > 0)
{
oldFloatTime = _viewDefinition.FloatTime;
oldTime = _viewDefinition.RenderView.Time;
_viewDefinition.FloatTime = idE.Game.GetTimeGroupTime(viewEntity.EntityDef.Parameters.TimeGroup) * 0.001f;
_viewDefinition.RenderView.Time = idE.Game.GetTimeGroupTime(viewEntity.EntityDef.Parameters.TimeGroup);
}
if((_viewDefinition.IsXraySubview == true) && (viewEntity.EntityDef.Parameters.XrayIndex == 1))
{
if(viewEntity.EntityDef.Parameters.TimeGroup > 0)
{
_viewDefinition.FloatTime = oldFloatTime;
_viewDefinition.RenderView.Time = oldTime;
}
continue;
}
else if((_viewDefinition.IsXraySubview == false) && (viewEntity.EntityDef.Parameters.XrayIndex == 2))
{
if(viewEntity.EntityDef.Parameters.TimeGroup > 0)
{
_viewDefinition.FloatTime = oldFloatTime;
_viewDefinition.RenderView.Time = oldTime;
}
continue;
}
// add the ambient surface if it has a visible rectangle
if(viewEntity.ScissorRectangle.IsEmpty == false)
{
idRenderModel model = EntityDefinitionDynamicModel(viewEntity.EntityDef);
if((model == null) | (model.SurfaceCount <= 0))
{
if(viewEntity.EntityDef.Parameters.TimeGroup != 0)
{
this.ViewDefinition.FloatTime = oldFloatTime;
this.ViewDefinition.RenderView.Time = oldTime;
}
continue;
}
AddAmbientDrawSurfaces(viewEntity);
// TODO: tr.pc.c_visibleViewEntities++;
}
else
{
// TODO: tr.pc.c_shadowViewEntities++;
}
//
// for all the entity / light interactions on this entity, add them to the view
//
if(_viewDefinition.IsXraySubview == true)
{
if(viewEntity.EntityDef.Parameters.XrayIndex == 2)
{
idConsole.Warning("TODO: xrayindex == 2");
/*for ( inter = vEntity->entityDef->firstInteraction; inter != NULL && !inter->IsEmpty(); inter = next ) {
next = inter->entityNext;
if ( inter->lightDef->viewCount != tr.viewCount ) {
continue;
}
inter->AddActiveInteraction();
}*/
}
}
else
{
idConsole.Warning("TODO: interactions");
// all empty interactions are at the end of the list so once the
// first is encountered all the remaining interactions are empty
/*for ( inter = vEntity->entityDef->firstInteraction; inter != NULL && !inter->IsEmpty(); inter = next ) {
next = inter->entityNext;
// skip any lights that aren't currently visible
// this is run after any lights that are turned off have already
// been removed from the viewLights list, and had their viewCount cleared
if ( inter->lightDef->viewCount != tr.viewCount ) {
continue;
}
inter->AddActiveInteraction();
}*/
}
if(viewEntity.EntityDef.Parameters.TimeGroup > 0)
{
_viewDefinition.FloatTime = oldFloatTime;
_viewDefinition.RenderView.Time = oldTime;
}
}
}