void CE_CBeam::BeamInit( const char *pSpriteName, float width )
{
	SetColor( 255, 255, 255 );
	SetBrightness( 255 );
	SetNoise( 0 );
	SetFrame( 0 );
	SetScrollRate( 0 );
	SetModelName( MAKE_STRING( pSpriteName ) );
	SetRenderMode( kRenderTransTexture );
	SetTexture( engine->PrecacheModel( pSpriteName ) );
	SetWidth( width );
	SetEndWidth( width );
	SetFadeLength( 0 );			// No fade

	for (int i=0;i<MAX_BEAM_ENTS;i++)
	{
		Set_m_hAttachEntity(i,NULL);
		Set_m_nAttachIndex(i, 0);
	}

	m_nHaloIndex	= 0;
	m_fHaloScale	= BEAM_DEFAULT_HALO_SCALE;
	m_nBeamType		= 0;
	m_nBeamFlags    = 0;
}
EDFBFont::EDFBFont(EDFBGraphicsEngine *dfbEngine, const char *filename)
	: EFontEngine(), fScalable(false), fForceFontAliasing(false), fFilename(NULL), fEngine(NULL)
{
	if(dfbEngine == NULL) return;

	fEngine = dfbEngine;

	EAutolock <EDFBGraphicsEngine> autolock(fEngine);
	if(autolock.IsLocked() == false || fEngine->InitCheck() != E_OK) {fEngine = NULL; return;}

	DFBFontDescription fontdesc;
	fontdesc.flags = (DFBFontDescriptionFlags)(DFDESC_ATTRIBUTES | DFDESC_HEIGHT);
	fontdesc.attributes = DFFA_NONE;
	fontdesc.height = ETK_DIRECTFONT_DEFAULT_SIZE;

	if(fEngine->dfbDisplay->CreateFont(fEngine->dfbDisplay, filename, &fontdesc, &fDFBFont) != DFB_OK)
	{
		ETK_DEBUG("[FONT]: CreateFont(%s) failed.", filename);
		fEngine = NULL;
		return;
	}

	EPath aPath(filename);
	if(aPath.Path() != NULL) fFilename = EStrdup(aPath.Path());
	SetFamily(aPath.Leaf() ? aPath.Leaf() : "DFB-Default");
	SetStyle("Regular");

	int height = 0;
	fDFBFont->GetHeight(fDFBFont, &height);
	float sizes = (float)height;
	SetFixedSize(&sizes, 1);

	SetRenderMode(E_FONT_RENDER_DIRECTLY);
}
Exemple #3
0
void reViewport::OnShadingMenuClick(wxMouseEvent& event){
	int shadingMenuChoice = m_shadingMenuText->GetPopupMenuSelectionFromUser(m_shadingMenu);
	
	switch (shadingMenuChoice){
	case reVIEWPORT_MENU_WIREFRAME:
		SetRenderMode(rRenderMode::Wireframe);
		break;

	case reVIEWPORT_MENU_SHADED:
		SetRenderMode(rRenderMode::Shaded);
		break;

	case reVIEWPORT_MENU_WIREFRAME_ON_SHADED:
		SetRenderMode(rRenderMode::WireframeOnShaded);
		break;
	}
}
 void Polygon::ResetPolygonData()
 {
     //Set the render mode
     SetRenderMode(m_IsFilled ? GL_TRIANGLE_FAN : GL_LINE_LOOP);
     
     //And update the vertex buffer
     UpdateVertexBuffer();
 }
Exemple #5
0
void CFlexWnd::InitFlexWnd()
{
	if (!HasWnd())
		return;

	HWND hParent = GetParent(m_hWnd);
	CFlexWnd *pParent = GetFlexWnd(hParent);
	if (pParent && pParent->InRenderMode())
		SetRenderMode();
}
//-----------------------------------------------------------------------------
// Purpose: Spawn function 
//-----------------------------------------------------------------------------
void CTFBaseDMPowerup::Spawn( void )
{
	Precache();
	SetModel( STRING( GetModelName() ) );
	SetRenderMode( kRenderTransColor );

	BaseClass::Spawn();

	AddEffects( EF_ITEM_BLINK );
}
//-----  IncreaseRenderMode()  ------------------------------------------------
DirectXRenderMode DirectXMeshCollision::IncreaseRenderMode()
{
	DirectXRenderMode	oldMode   (GetRenderMode());
	int					renderMode(oldMode + 1);

	if (renderMode >= DXRM_SOLID)		renderMode = 0;

	SetRenderMode((DirectXRenderMode) renderMode);
	return oldMode;
}
void CFuncPortalOrientation::Spawn()
{
    BaseClass::Spawn();

    // Bind to our model, cause we need the extents for bounds checking
    SetModel( STRING( GetModelName() ) );
    SetRenderMode( kRenderNone );	// Don't draw
    SetSolid( SOLID_VPHYSICS );	// we may want slanted walls, so we'll use OBB
    AddSolidFlags( FSOLID_NOT_SOLID );
}
Exemple #9
0
void C_CFRagdoll::ClientThink()
{
	float flFadeTime = 3.0f;

	float dt = gpGlobals->curtime - m_flFadeStartTime - 3;
	if ( dt > 0 && dt < flFadeTime )
	{
		SetRenderMode(kRenderTransTexture);
		SetRenderColorA( (1.0f - dt / flFadeTime) * 255.0f );
	}
}
void CBeam::Spawn( void )
{
	SetMoveType( MOVETYPE_NONE );
	SetSolid( SOLID_NONE );							// Remove model & collisions
	SetRenderMode( kRenderTransTexture );

	// Opt out of all shadow routines
	AddEffects( EF_NOSHADOW | EF_NORECEIVESHADOW );

	Precache( );
}
void C_Prop_ASW_Fade::OnDataChanged(DataUpdateType_t updateType)
{
	BaseClass::OnDataChanged(updateType);

	if (updateType == DATA_UPDATE_CREATED)
	{
		SetNextClientThink(CLIENT_THINK_ALWAYS);
		if (GetRenderMode() == kRenderNormal)
		{
			SetRenderMode(kRenderTransTexture);
		}
		m_bFaded = false;
		m_nNormalOpacity = GetRenderAlpha();
	}
}
void CASW_Path_Utils_NPC::Spawn()
{
	CapabilitiesAdd( bits_CAP_MOVE_GROUND | bits_CAP_OPEN_DOORS );

	SetModel( SWARM_NEW_DRONE_MODEL );
	NPCInit();

	UTIL_SetSize(this, NAI_Hull::Mins(HULL_MEDIUMBIG), NAI_Hull::Maxs(HULL_MEDIUMBIG));
	SetSolid( SOLID_BBOX );
	AddSolidFlags( FSOLID_NOT_SOLID );
	AddSolidFlags( FSOLID_NOT_STANDABLE );
	SetMoveType( MOVETYPE_STEP );
	m_takedamage = DAMAGE_NO;
	SetRenderMode(kRenderNone);
	AddEffects(EF_NODRAW | EF_NOSHADOW);
}
Exemple #13
0
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void C_Gib::ClientThink( void )
{
	SetRenderMode( kRenderTransAlpha );
	m_nRenderFX		= kRenderFxFadeFast;

	if ( m_clrRender->a == 0 )
	{
#ifdef HL2_CLIENT_DLL
		s_AntlionGibManager.RemoveGib( this );
#endif
		Release();
		return;
	}

	SetNextClientThink( gpGlobals->curtime + 1.0f );
}
void CJaS_GeneratorSparks::Spawn()
{
    BaseClass::Spawn();

    // We need all this to prevent us from getting stuck in walls.
    SetModel( "models/aliens/Grubs/Grub.mdl" );
    SetRenderMode( kRenderNone );
    AddEffects( EF_NODRAW | EF_NOSHADOW );
    SetSolid( SOLID_NONE );

    m_bAllowEnemies = true;
    m_vecStartPos = GetAbsOrigin();
    SetHullType( HULL_TINY );

    m_takedamage = DAMAGE_NO;
}
 void Point::ResetPolygonData()
 {
     //Clear the vertices vector
     m_Vertices.clear();
     
     //Clear the colors vector
     m_Colors.clear();
 
     //Add the vertices
     AddVertex(vec2(0.0f, 0.0f));
     
     //Set the render mode
     SetRenderMode(GL_POINTS);
     
     //Update the vertex buffer
     UpdateVertexBuffer();
 }
Exemple #16
0
//-----------------------------------------------------------------------------
// Purpose: Sets up the entity's initial state
//-----------------------------------------------------------------------------
void GhostEntity::Spawn( void )
{
	Precache();
	if (GhostEngine::getEngine()->shouldDrawTrails()) {
		if (ghostData.trailLength > 0) {
			CreateTrail();
		}
	}
	RemoveEffects(EF_NODRAW);
	SetModel(MODEL);
	SetSolid( SOLID_NONE );
	SetRenderMode(kRenderTransColor);
	SetRenderColor(ghostData.ghostRed, ghostData.ghostGreen, ghostData.ghostBlue);
	SetRenderColorA(75);
	SetMoveType( MOVETYPE_NOCLIP );
	isActive = true;
}
Exemple #17
0
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void C_Gib::ClientThink( void )
{
	SetRenderMode( kRenderTransAlpha );
	m_nRenderFX		= kRenderFxFadeFast;

	if ( m_clrRender->a == 0 )
	{
#ifdef HL2_CLIENT_DLL
		//BG2 - Tjoppen - removing more npcs and weapons
		//s_AntlionGibManager.RemoveGib( this );
		//
#endif
		Release();
		return;
	}

	SetNextClientThink( gpGlobals->curtime + 1.0f );
}
void CFuncPortalDetector::Spawn()
{
	BaseClass::Spawn();

	if ( m_spawnflags & SF_START_INACTIVE )
	{
		m_bActive = false;
	}
	else
	{
		m_bActive = true;
	}

	// Bind to our model, cause we need the extents for bounds checking
	SetModel( STRING( GetModelName() ) );
	SetRenderMode( kRenderNone );	// Don't draw
	SetSolid( SOLID_VPHYSICS );		// we may want slanted walls, so we'll use OBB
	AddSolidFlags( FSOLID_NOT_SOLID );
}
//-----------------------------------------------------------------------------
void C_LowViolenceHostageDeathModel::ClientThink( void )
{
	if ( m_flFadeOutStart > gpGlobals->curtime )
	{
		 return;
	}

	int iAlpha = GetRenderColor().a;

	iAlpha = max( iAlpha - ( g_ragdoll_fadespeed.GetInt() * gpGlobals->frametime ), 0 );

	SetRenderMode( kRenderTransAlpha );
	SetRenderColorA( iAlpha );

	if ( iAlpha == 0 )
	{
		Release();
	}
}
Exemple #20
0
void CBubbling::Spawn( void )
{
	Precache();
	SetModel( GetModelName() );		// Set size

	SetSolidType( SOLID_NOT );							// Remove model & collisions
	SetRenderAmount( 0 );								// The engine won't draw this model if this is set to 0 and blending is on
	SetRenderMode( kRenderTransTexture );
	int speed = fabs( GetSpeed() );

	// HACKHACK!!! - Speed in rendercolor
	SetRenderColor( Vector( speed >> 8, speed & 255, ( GetSpeed() < 0 ) ? 1 : 0 ) );


	if( !GetSpawnFlags().Any( SF_BUBBLES_STARTOFF ) )
	{
		SetThink( &CBubbling::FizzThink );
		SetNextThink( gpGlobals->time + 2.0 );
		m_state = true;
	}
	else
		m_state = false;
}
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void C_PhysPropClientside::ClientThink( void )
{
	if ( m_fDeathTime < 0 )
	{
		SetNextClientThink( CLIENT_THINK_NEVER );
		return;
	}

	if ( m_fDeathTime <= gpGlobals->curtime )
	{
		Release(); // Die
		return;
	}

	// fade out 

	float alpha = (m_fDeathTime - gpGlobals->curtime)/FADEOUT_TIME;

	SetRenderMode( kRenderTransTexture );

	SetRenderColorA( alpha * 256 );

	SetNextClientThink( CLIENT_THINK_ALWAYS );
}
Exemple #22
0
bool ds::Render::Create( HWND Handle, const ds::String& BasicEffect )
{
	g_SwapChain.OutputWindow = Handle;

	RECT Rect;
	GetClientRect(  Handle, &Rect  );
	g_SwapChain.BufferDesc.Width = (  unsigned  ) Rect.right - (  unsigned  ) Rect.left;
	g_SwapChain.BufferDesc.Height = (  unsigned  ) Rect.bottom - (  unsigned  ) Rect.top;

	for( unsigned i = 0; i < 2; i++ )
	{
		if( SUCCEEDED( D3D10CreateDeviceAndSwapChain( 
			nullptr,
			( D3D10_DRIVER_TYPE )i, 
			nullptr,
			0,
			D3D10_SDK_VERSION,
			&g_SwapChain,
			&Swap,
			&Device
			 ) ) )
		{
			if( ( D3D10_DRIVER_TYPE )i == D3D10_DRIVER_TYPE_REFERENCE )
				dsPushMessage( ErrRenderCreateDevice );
			break;
		}
	}

	if( !Device )
	{
		dsPushErrorStatic( ErrRenderCreateDevice );
		return false;
	}

	IDXGIOutput* l_Info;
	unsigned l_ModesCount = 0;
	Swap->GetContainingOutput( &l_Info );
	l_Info->GetDisplayModeList( g_SwapChain.BufferDesc.Format,
		0, &l_ModesCount, nullptr );

	DXGI_MODE_DESC* l_Modes = new DXGI_MODE_DESC[l_ModesCount];
	l_Info->GetDisplayModeList( g_SwapChain.BufferDesc.Format,
		0, &l_ModesCount, l_Modes );	

	for( unsigned i = 0; i < l_ModesCount; i++ )
		VideoModes.push_back( VideoMode( ds::Size( l_Modes[i].Width, l_Modes[i].Height ), l_Modes[i].RefreshRate.Numerator / l_Modes[i].RefreshRate.Denominator ) );

	delete[] l_Modes;
	l_Info->Release( );

	ID3D10Texture2D* l_BackBuffer = nullptr;
	if( FAILED( Swap->GetBuffer( 0, __uuidof( ID3D10Texture2D ), ( LPVOID* )&l_BackBuffer ) ) )
		return false;

	if( FAILED( Device->CreateRenderTargetView( l_BackBuffer, nullptr, &RenderTargetView ) ) )
		return false;

	l_BackBuffer->Release( );

	CreateDepthBuffer( ds::Size( 
		g_SwapChain.BufferDesc.Width,
		g_SwapChain.BufferDesc.Height
		 ) );

	Device->OMSetRenderTargets( 1, &RenderTargetView, DepthBufferEnable ? DepthStencilView : nullptr );
	Device->RSSetViewports( 1, &g_ViewPort );

	SetRenderRect( v4<unsigned>( 0, 0, 
		g_SwapChain.BufferDesc.Width,
		g_SwapChain.BufferDesc.Height ) );

	if( !BasicEffect.empty( ) )
		Effect = new ds::BasicEffect( BasicEffect, "Render" );
	else
		Effect = nullptr;

	SetRenderMode( 1 );

	SetView( v2<unsigned>( 
		g_SwapChain.BufferDesc.Width, g_SwapChain.BufferDesc.Height ), 
		v2<unsigned>( g_ViewPort.TopLeftX, g_ViewPort.TopLeftY ),
		g_ViewPort.MinDepth, g_ViewPort.MaxDepth );
	
	ds::Clock::Reset( );

	return true;
}
EFontFT2::EFontFT2(const EEntry *entry, eint32 faceIndex)
	: EFontEngine(), fFilename(NULL), fFaceIndex(-1), nFaces(-1), fFace(NULL), fScalable(false), fForceFontAliasing(false)
{
	EPath aPath;
	if(entry == NULL || entry->Exists() == false || entry->GetPath(&aPath) != E_OK) return;
	EString filename = aPath.Path();
#ifdef _WIN32
	filename.ReplaceAll("/", "\\");
#endif

	SetRenderMode(E_FONT_RENDER_PIXMAP);

	EAutolock <ELocker> autolock(&etk_ft2_font_locker);
	if(!_etk_ft2_initialized_) return;

	FT_Error error = FT_New_Face(_etk_ft2_library_, filename.String(), faceIndex, &fFace);
	if(error || !fFace)
	{
		ETK_DEBUG("[FONT]: %s --- CAN NOT load face[%s:%d].", __PRETTY_FUNCTION__, aPath.Path(), faceIndex);
		return;
	}

	if(FT_Select_Charmap(fFace, FT_ENCODING_UNICODE))
	{
//		ETK_DEBUG("[FONT]: %s --- font[%s] don't support ENCODING_UNICODE.", __PRETTY_FUNCTION__, aPath.Path());

		if(FT_Select_Charmap(fFace, FT_ENCODING_NONE))
		{
//			ETK_WARNING("[FONT]: %s --- font[%s] don't support unicode at all.", __PRETTY_FUNCTION__, aPath.Path());
			FT_Done_Face(fFace);
			fFace = NULL;
			return;
		}
	}

	fFilename = EStrdup(filename.String());
	fFaceIndex = faceIndex;
	nFaces = fFace->num_faces;

	EString family = fFace->family_name;
	if(family.Length() <= 0)
	{
		family = aPath.Leaf();
		eint32 cFound;
		if((cFound = family.FindFirst('.')) >= 0) family.Remove(cFound, -1);
		if(family.Length() < 0) family = "Unknown";
	}
	SetFamily(family.String());

	EString style = fFace->style_name;
	if(style.Length() <= 0)
	{
		if((fFace->style_flags & FT_STYLE_FLAG_BOLD) && (fFace->style_flags & FT_STYLE_FLAG_ITALIC))
			style = "Bold Italic";
		else if(fFace->style_flags & FT_STYLE_FLAG_BOLD)
			style = "Bold";
		else if(fFace->style_flags & FT_STYLE_FLAG_ITALIC)
			style = "Italic";
		else
			style = "Regular";
	}
	SetStyle(style.String());

	if(FT_IS_SCALABLE(fFace)) fScalable = true;

	if(fFace->num_fixed_sizes > 0)
	{
		float *sizes = new float[(int)fFace->num_fixed_sizes];
		for(int i = 0; i < fFace->num_fixed_sizes; i++) sizes[i] = (float)(fFace->available_sizes[i].height);
		SetFixedSize(sizes, (eint32)fFace->num_fixed_sizes);
		delete[] sizes;
	}

	FT_Done_Face(fFace);
	fFace = NULL;
}
Exemple #24
0
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CEngineSprite::SetAdditive( bool additive )
{
	SetRenderMode( additive ? kRenderTransAdd : kRenderTransTexture ); 
}
void C_SDKRagdoll::ClientThink( void )
{
	SetNextClientThink( CLIENT_THINK_ALWAYS );

	if ( m_bFadingOut == true )
	{
		int iAlpha = GetRenderColor().a;
		int iFadeSpeed = 600.0f;

		iAlpha = max( iAlpha - ( iFadeSpeed * gpGlobals->frametime ), 0 );

		SetRenderMode( kRenderTransAlpha );
		SetRenderColorA( iAlpha );

		if ( iAlpha == 0 )
		{
			Release();
		}

		return;
	}

	for( int iClient = 1; iClient <= gpGlobals->maxClients; ++iClient )
	{
		C_SDKPlayer *pEnt = static_cast< C_SDKPlayer *> ( UTIL_PlayerByIndex( iClient ) );

		if(!pEnt || !pEnt->IsPlayer())
			continue;

		if ( m_hPlayer == NULL )
			continue;

		if ( pEnt->entindex() == m_hPlayer->entindex() )
			continue;
		
		if ( pEnt->GetHealth() <= 0 )
			continue;
#if defined ( SDK_USE_PRONE )
		if ( pEnt->m_Shared.IsProne() == false )
			continue;
#endif
		Vector vTargetOrigin = pEnt->GetAbsOrigin();
		Vector vMyOrigin =  GetAbsOrigin();

		Vector vDir = vTargetOrigin - vMyOrigin;

		if ( vDir.Length() > cl_ragdoll_pronecheck_distance.GetInt() ) 
			continue;

		SetNextClientThink( CLIENT_THINK_ALWAYS );
		m_bFadingOut = true;
		return;
	}

	//Tony; this is kind of silly, because.. whats the point of fading out?
	// if the player is looking at us, delay the fade
	if ( IsRagdollVisible() )
	{
		StartFadeOut( 5.0 );
		return;
	}

	if ( m_fDeathTime > gpGlobals->curtime )
		return;

	Release(); // Die
}
void ProgramGL::keyboardFunc(unsigned char key, int x, int y)
{
	switch (key)
	{
		// Posición X de la cámara
		case 'd':
		case 'D':
			right = true;
			break;
		case 'a':
		case 'A':
			left = true;
			break;

		// Posición Z de la cámara
		case 's':
		case 'S':
			backward = true;
			break;
		case 'w':
		case 'W':
			forward = true;
			break;

		// Reset camera
		case 'r':
		case 'R':
			autoNavigate = false;
			camera->isFirstAuto = true;
			angle = 60.0f;
			resizeFunc(camera->windowWidth, camera->windowHeight);
			camera->setPosition(camera->initPos);
			camera->setRotation(camera->initRot);
			UpdateViewWithCamera();
			break;

		// Toggle navigation
		case 'n':
		case 'N':
			autoNavigate = !autoNavigate;
			if (!autoNavigate) camera->isFirstAuto = true;
			break;

		// Camera speed
		case '+':
			camera->IncrementSpeed(1.0f);
			break;
		case '-':
			camera->IncrementSpeed(-1.0f);
			break;

		// Camera zoom
		case 'z':
		case 'Z':
			angle += 1.0f;
			resizeFunc(camera->windowWidth, camera->windowHeight);
			break;
		case 'x':
		case 'X':
			angle -= 1.0f;
			resizeFunc(camera->windowWidth, camera->windowHeight);
			break;

		// Switch render modes
		case 't':
		case 'T':
			SetRenderMode(Object3D::RenderType::Triangles);
			break;
		case 'y':
		case 'Y':
			SetRenderMode(Object3D::RenderType::Edges);
			break;
		case 'u':
		case 'U':
			SetRenderMode(Object3D::RenderType::Vertices);
			break;
	}
}
void CSDKPlayer::UpdateThirdCamera(const Vector& vecEye, const QAngle& angEye)
{
	if (!IsInThirdPerson())
		return;

	CWeaponSDKBase * pWeapon = NULL;
	if (GetActiveWeapon() != NULL){
		pWeapon = GetActiveSDKWeapon();
	}

	Assert(pWeapon);

#ifdef CLIENT_DLL

	if (m_vecThirdCamera.DistTo(vecEye) < da_cam_fade_distance.GetFloat()){

		m_flCurrentAlphaVal = Approach(da_cam_fade_alpha_val.GetFloat(), m_flCurrentAlphaVal, 500.0f * gpGlobals->frametime);

		if (GetRenderMode() != kRenderTransTexture){
			SetRenderMode(kRenderTransTexture);
		}

		SetRenderColorA(m_flCurrentAlphaVal);

		if (pWeapon){
			if (pWeapon->GetRenderMode() != kRenderTransTexture){
				pWeapon->SetRenderMode(kRenderTransTexture);
			}
			pWeapon->SetRenderColorA(m_flCurrentAlphaVal);
		}
	}else{

		m_flCurrentAlphaVal = Approach(255.0f, m_flCurrentAlphaVal, 500.0f * gpGlobals->frametime);

		if (GetRenderMode() != kRenderNormal){
			SetRenderMode(kRenderNormal);
		}

		SetRenderColorA(m_flCurrentAlphaVal);

		if (pWeapon){
			if (pWeapon->GetRenderMode() != kRenderNormal){
				pWeapon->SetRenderMode(kRenderNormal);
			}
			pWeapon->SetRenderColorA(m_flCurrentAlphaVal);
		}
	}

#endif

	m_vecThirdCamera = CalculateThirdPersonCameraPosition(vecEye, angEye);

	Vector vecShoot;
	AngleVectors(angEye, &vecShoot);

	// Trace to see where the camera is pointing
	trace_t tr;
	UTIL_TraceLine( m_vecThirdCamera, m_vecThirdCamera + vecShoot * 99999, MASK_VISIBLE|CONTENTS_DEBRIS|CONTENTS_HITBOX, this, COLLISION_GROUP_NONE, &tr );

	m_vecThirdTarget = tr.endpos;
}