Exemple #1
0
OglContext::OglContext(ms_uint32 width, ms_uint32 height)
  : valid(false)
{
  if (!window && !initWindow()) return;
  if (!sharingContext && !initSharingContext()) return;

  if (!(this->width = getTextureSize(GL_TEXTURE_WIDTH, width))) return;
  if (!(this->height = getTextureSize(GL_TEXTURE_HEIGHT, height))) return;

  if (!createPBuffer(this->width, this->height)) return;
  if (!makeCurrent()) return;
  valid = true;
}
bool CUIMediator::InitMediator()
{
	setDelayedLoad(0);

	if( m_ChatBoxMgr.Init() == false )
		return false;

	//if( m_NameBox.Init( "3DData\\Control\\Res\\NameBox.tga" ) == false )
	//	return false;

	if( m_DigitEffect.Init() == false )
		return false;

	if( m_PersonalStoreManager.Init() == false )
		return false;
	
	/// For load..( temp )
	m_LogoTex = loadTexture ( "Logo.dds", "Logo.dds", 1, 0 );

	setDelayedLoad(1);

	if( m_LogoTex == NULL )
	{
#ifdef _DEBUG
			g_pCApp->ErrorBOX( "LogoTex load failed !!", "File open error" );
#endif
			//실패한 이유를 적어준다..
			return false;
	}	
	
	getTextureSize( m_LogoTex, m_iLogoWidth, m_iLogoHeight );

	return true;
}
Exemple #3
0
// ////////////////////////////////////////////////////////////////////////////
// Video Options
static bool startVideoOptionsMenu(void)
{
	// Generate the resolution string
	snprintf(resolution, WIDG_MAXSTR, "%d x %d",
	         war_GetWidth(), war_GetHeight());
	// Generate texture size string
	snprintf(textureSize, WIDG_MAXSTR, "%d", getTextureSize());

	addBackdrop();
	addTopForm();
	addBottomForm();

	// Add a note about changes taking effect on restart for certain options
	addTextHint(FRONTEND_TAKESEFFECT, FRONTEND_POS1X + 48, FRONTEND_POS1Y + 24, _("* Takes effect on game restart"));

	// Fullscreen/windowed
	addTextButton(FRONTEND_WINDOWMODE, FRONTEND_POS2X-35, FRONTEND_POS2Y, _("Graphics Mode*"), 0);

	if (war_getFullscreen())
	{
		addTextButton(FRONTEND_WINDOWMODE_R, FRONTEND_POS2M-55, FRONTEND_POS2Y, _("Fullscreen"), 0);
	}
	else
	{
		addTextButton(FRONTEND_WINDOWMODE_R, FRONTEND_POS2M-55, FRONTEND_POS2Y, _("Windowed"), 0);
	}

	// Resolution
	addTextButton(FRONTEND_RESOLUTION, FRONTEND_POS3X-35, FRONTEND_POS3Y, _("Resolution*"), WBUT_SECONDARY);
	addTextButton(FRONTEND_RESOLUTION_R, FRONTEND_POS3M-55, FRONTEND_POS3Y, resolution, WBUT_SECONDARY);
	widgSetString(psWScreen, FRONTEND_RESOLUTION_R, resolution);

	// Texture size
	addTextButton(FRONTEND_TEXTURESZ, FRONTEND_POS4X-35, FRONTEND_POS4Y, _("Texture size"), 0);
	addTextButton(FRONTEND_TEXTURESZ_R, FRONTEND_POS4M-55, FRONTEND_POS4Y, textureSize, 0);

	// Vsync
	addTextButton(FRONTEND_VSYNC, FRONTEND_POS5X-35, FRONTEND_POS5Y, _("Vertical sync*"), 0);

	if (war_GetVsync())
	{
		addTextButton(FRONTEND_VSYNC_R, FRONTEND_POS5M-55, FRONTEND_POS5Y, _("On"), 0);
	}
	else
	{
		addTextButton(FRONTEND_VSYNC_R, FRONTEND_POS5M-55, FRONTEND_POS5Y, _("Off"), 0);
	}

	// Add some text down the side of the form
	addSideText(FRONTEND_SIDETEXT, FRONTEND_SIDEX, FRONTEND_SIDEY, _("VIDEO OPTIONS"));

	// Quit/return
	addMultiBut(psWScreen, FRONTEND_BOTFORM, FRONTEND_QUIT, 10, 10, 30, 29, P_("menu", "Return"), IMAGE_RETURN, IMAGE_RETURN_HI, IMAGE_RETURN_HI);

	return true;
}
Exemple #4
0
/// load texture to memory.
/// Returns texture ID or -1 on failure.  On success returns texture width
//  and height in pixels
static int loadTexture(struct SaslGraphicsCallbacks *canvas,
        const char *buffer, int length, int *width, int *height)
{
    OglCanvas *c = (OglCanvas*)canvas;
    if (! c)
        return -1;

    GLuint texId = 0;
    if (c->genTexNameCallback)
        texId = c->genTexNameCallback();

    unsigned id = SOIL_load_OGL_texture_from_memory(
            (const unsigned char*)buffer, length, 
            0, texId, SOIL_FLAG_POWER_OF_TWO);
    if (! id) 
        return -1;
 
    texId = id;

    // because of SOIL issue
    setTexture(c, id);

#ifdef USE_GLES1

    if (width || height)
        getTextureSize(buffer, length, width, height);

#else

    if (width) {
        GLint w;
        glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_WIDTH, &w);
        *width = w;
    }
    if (height) {
        GLint h;
        glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_HEIGHT, &h);
        *height = h;
    }

#endif

    if (width && height)
        c->texturesSize += (*width) * (*height);

    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); 
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);

    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); 
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);

    c->textures++;

    return texId;
}
std::string MapcrafterConfigHelper::generateTemplateJavascript() const {
	std::string js = "";

	auto maps = config.getMaps();
	for (auto it = maps.begin(); it != maps.end(); ++it) {
		auto world = config.getWorld(it->getWorld());

		js += "\"" + it->getShortName() + "\" : {\n";
		js += "\tname: \"" + it->getLongName() + "\",\n";
		js += "\tworld: \"" + it->getWorld() + "\",\n";
		js += "\tworldName: \"" + world.getWorldName() + "\",\n";
		js += "\ttextureSize: " + util::str(it->getTextureSize()) + ",\n";
		js += "\ttileSize: " + util::str(32 * it->getTextureSize()) + ",\n";
		js += "\tmaxZoom: " + util::str(getMapZoomlevel(it->getShortName())) + ",\n";
		js += "\timageFormat: \"" + it->getImageFormatSuffix() + "\",\n";

		js += "\trotations: [";
		auto rotations = it->getRotations();
		for (auto it2 = rotations.begin(); it2 != rotations.end(); ++it2)
			js += util::str(*it2) + ",";
		js += "],\n";

		std::string tile_offsets = "[";
		auto offsets = world_tile_offsets.at(it->getWorld());
		for (auto it2 = offsets.begin(); it2 != offsets.end(); ++it2)
			tile_offsets += "[" + util::str(it2->getX()) + ", " + util::str(it2->getY()) + "], ";
		tile_offsets += "]";

		js += "\ttileOffsets: " + tile_offsets + ",\n";

		if (!world.getDefaultView().empty())
			js += "\tdefaultView: [" + world.getDefaultView() + "],\n";
		if (world.getDefaultZoom() != 0)
			js += "\tdefaultZoom: " + util::str(world.getDefaultZoom()) + ",\n";
		if (world.getDefaultRotation() != -1)
			js += "\tdefaultRotation: " + util::str(world.getDefaultRotation()) + ",\n";

		js += "},";
	}

	return js;
}
Exemple #6
0
 Impl(const uint64_t cacheId, const Cache& dataCache,
      const DataSource& dataSource, TexturePool& texturePool)
     : _textureState(texturePool)
     , _textureSize(getTextureSize(dataSource))
 {
     LBASSERT(_textureState.textureId);
     if (!load(cacheId, dataCache, dataSource, texturePool))
         LBTHROW(
             CacheLoadException(cacheId,
                                "Unable to construct texture cache object"));
 }
void LLViewerMediaImpl::scaleMouse(S32 *mouse_x, S32 *mouse_y)
{
#if 0
	S32 media_width, media_height;
	S32 texture_width, texture_height;
	getMediaSize( &media_width, &media_height );
	getTextureSize( &texture_width, &texture_height );
	S32 y_delta = texture_height - media_height;

	*mouse_y -= y_delta;
#endif
}
Exemple #8
0
    PerlinContent::PerlinContent() :
    TextureContent()
    ,mSeed(1221) //clock() & 65535)
	,mOctaves(4)
    ,mPosition(0,0)
	,mFrequency(1.0f / 20.0f)
    ,mPerlin( mOctaves, mSeed )
    {
        Vec2i noiseSize = getTextureSize();
        mNoiseSurface = Surface( noiseSize.x, noiseSize.y, false);
        mTexture = gl::TextureRef( new gl::Texture(noiseSize.x, noiseSize.y) );
    }
PicturePtr FFMPEGVideoFrameConverter::convert( const FFMPEGFrame& srcFrame,
                                               const TextureFormat format )
{
    auto picture = std::make_shared<FFMPEGPicture>( srcFrame.getWidth(),
                                                    srcFrame.getHeight(),
                                                    format );

    const auto avFormat = _toAVPixelFormat( format );

    _impl->swsContext = sws_getCachedContext( _impl->swsContext,
                                              srcFrame.getWidth(),
                                              srcFrame.getHeight(),
                                              srcFrame.getAVPixelFormat(),
                                              picture->getWidth(),
                                              picture->getHeight(),
                                              avFormat,
                                              SWS_FAST_BILINEAR,
                                              nullptr, nullptr, nullptr );
    if( !_impl->swsContext )
        return PicturePtr();

    uint8_t* dstData[3];
    int linesize[3];
    for( size_t i = 0; i < 3; ++i )
    {
        dstData[i] = picture->getData( i );
        // width of image plane in pixels * bytes per pixel
        linesize[i] = picture->getDataSize( i ) /
                      picture->getTextureSize( i ).height();
    }

    const auto outputHeight = sws_scale( _impl->swsContext,
                                         srcFrame.getAVFrame().data,
                                         srcFrame.getAVFrame().linesize,
                                         0, srcFrame.getHeight(),
                                         dstData, linesize );
    if( outputHeight != picture->getHeight( ))
        return PicturePtr();

    return picture;
}
Exemple #10
0
bool runVideoOptionsMenu(void)
{
	SDL_Rect **modes = SDL_ListModes(NULL, SDL_FULLSCREEN | SDL_HWSURFACE);
	UDWORD id = widgRunScreen(psWScreen);

	switch (id)
	{
		case FRONTEND_WINDOWMODE:
		case FRONTEND_WINDOWMODE_R:
			if (war_getFullscreen())
			{
				war_setFullscreen(false);
				widgSetString(psWScreen, FRONTEND_WINDOWMODE_R, _("Windowed"));
			}
			else
			{
				war_setFullscreen(true);
				widgSetString(psWScreen, FRONTEND_WINDOWMODE_R, _("Fullscreen"));
			}
			break;

		case FRONTEND_RESOLUTION:
		case FRONTEND_RESOLUTION_R:
		{
			int current, count, oldcurrent;

			// Get the current mode offset
			for (count = 0, current = 0; modes[count]; count++)
			{
				if (war_GetWidth() == modes[count]->w
				 && war_GetHeight() == modes[count]->h)
				{
					current = count;
				}
			}

			// Increment and clip if required
			// Hide resolutions lower than Warzone can support
			oldcurrent = current;
			do
			{
				if (!mouseReleased(MOUSE_RMB))
				{
					if (--current < 0)
						current = count - 1;
				}
				else
				{
					if (++current == count)
						current = 0;
				}	
			} while ((modes[current]->w < 640 || modes[current]->h < 480)
				&& current != oldcurrent);

			// Set the new width and height (takes effect on restart)
			war_SetWidth(modes[current]->w);
			war_SetHeight(modes[current]->h);

			// Generate the textual representation of the new width and height
			snprintf(resolution, WIDG_MAXSTR, "%d x %d", modes[current]->w,
			         modes[current]->h);

			// Update the widget
			widgSetString(psWScreen, FRONTEND_RESOLUTION_R, resolution);

			break;
		}

		case FRONTEND_TRAP:
		case FRONTEND_TRAP_R:
			if (war_GetTrapCursor())
			{
				war_SetTrapCursor(false);
				widgSetString(psWScreen, FRONTEND_TRAP_R, _("Off"));
			}
			else
			{
				war_SetTrapCursor(true);
				widgSetString(psWScreen, FRONTEND_TRAP_R, _("On"));
			}
			break;

		case FRONTEND_TEXTURESZ:
		case FRONTEND_TEXTURESZ_R:
		{
			int newTexSize = getTextureSize() * 2;

			// Clip such that 128 <= size <= 2048
			if (newTexSize > 2048)
			{
				newTexSize = 128;
			}

			// Set the new size
			setTextureSize(newTexSize);

			// Generate the string representation of the new size
			snprintf(textureSize, WIDG_MAXSTR, "%d", newTexSize);

			// Update the widget
			widgSetString(psWScreen, FRONTEND_TEXTURESZ_R, textureSize);

			break;
		}

		case FRONTEND_VSYNC:
		case FRONTEND_VSYNC_R:
		{
			if (war_GetVsync())
			{
				war_SetVsync(false);
				widgSetString(psWScreen, FRONTEND_VSYNC_R, _("Off"));
			}
			else
			{
				war_SetVsync(true);
				widgSetString(psWScreen, FRONTEND_VSYNC_R, _("On"));
			}
			break;
		}

		case FRONTEND_QUIT:
			changeTitleMode(OPTIONS);
			break;

		default:
			break;
	}

	if (CancelPressed())
	{
		changeTitleMode(OPTIONS);
	}

	widgDisplayScreen(psWScreen);

	return true;
}
Exemple #11
0
/// Set up the texture coordinates for a tile
static Vector2f getTileTexCoords(Vector2f *uv, unsigned int tileNumber)
{
	/* unmask proper values from compressed data */
	const unsigned short texture = TileNumber_texture(tileNumber);
	const unsigned short tile = TileNumber_tile(tileNumber);

	/* Used to calculate texture coordinates */
	const float xMult = 1.0f / TILES_IN_PAGE_COLUMN;
	const float yMult = 1.0f / TILES_IN_PAGE_ROW;
	float texsize = (float)getTextureSize();

	// the decals are 128x128 (at this time), we should not go above this value.  See note above
	if (texsize > MAX_TILE_TEXTURE_SIZE)
	{
		texsize = MAX_TILE_TEXTURE_SIZE;
	}
	const float centertile = 0.5f / texsize;	// compute center of tile
	const float shiftamount = (texsize - 1.0) / texsize;	// 1 pixel border
	// bump the texture coords, for 1 pixel border, so our range is [.5,(texsize - .5)]
	const float one = 1.0f / (TILES_IN_PAGE_COLUMN * texsize) + centertile * shiftamount;

	/*
	 * Points for flipping the texture around if the tile is flipped or rotated
	 * Store the source rect as four points
	 */
	Vector2f sP1 { one, one };
	Vector2f sP2 { xMult - one, one };
	Vector2f sP3 { xMult - one, yMult - one };
	Vector2f sP4 { one, yMult - one };

	if (texture & TILE_XFLIP)
	{
		std::swap(sP1, sP2);
		std::swap(sP3, sP4);
	}
	if (texture & TILE_YFLIP)
	{
		std::swap(sP1, sP4);
		std::swap(sP2, sP3);
	}

	Vector2f sPTemp;
	switch ((texture & TILE_ROTMASK) >> TILE_ROTSHIFT)
	{
	case 1:
		sPTemp = sP1;
		sP1 = sP4;
		sP4 = sP3;
		sP3 = sP2;
		sP2 = sPTemp;
		break;
	case 2:
		sPTemp = sP1;
		sP1 = sP3;
		sP3 = sPTemp;
		sPTemp = sP4;
		sP4 = sP2;
		sP2 = sPTemp;
		break;
	case 3:
		sPTemp = sP1;
		sP1 = sP2;
		sP2 = sP3;
		sP3 = sP4;
		sP4 = sPTemp;
		break;
	}
	const Vector2f offset { tileTexInfo[tile].uOffset, tileTexInfo[tile].vOffset };

	uv[0 + 0] = offset + sP1;
	uv[0 + 2] = offset + sP2;
	uv[1 + 2] = offset + sP3;
	uv[1 + 0] = offset + sP4;

	/// Calculate the average texture coordinates of 4 points
	return Vector2f { (uv[0].x + uv[1].x + uv[2].x + uv[3].x) / 4, (uv[0].y + uv[1].y + uv[2].y + uv[3].y) / 4 };
}
// ////////////////////////////////////////////////////////////////////////////
bool saveConfig(void)
{
	debug( LOG_WZ, "Writing prefs to registry\n" );

	if(!openWarzoneKey())
	{
		return false;
	}

	// //////////////////////////
	// voicevol, fxvol and cdvol
	setWarzoneKeyNumeric("voicevol", (int)(sound_GetUIVolume() * 100.0));
	setWarzoneKeyNumeric("fxvol", (int)(sound_GetEffectsVolume() * 100.0));
	setWarzoneKeyNumeric("cdvol", (int)(sound_GetMusicVolume() * 100.0));
	setWarzoneKeyNumeric("music_enabled", war_GetMusicEnabled());

	setWarzoneKeyNumeric("width", war_GetWidth());
	setWarzoneKeyNumeric("height", war_GetHeight());
	setWarzoneKeyNumeric("bpp", pie_GetVideoBufferDepth());
	setWarzoneKeyNumeric("fullscreen", war_getFullscreen());

	setWarzoneKeyString("language", getLanguage());

	// dont save out the cheat mode.
	if(getDifficultyLevel()==DL_KILLER || getDifficultyLevel()== DL_TOUGH)
	{
		setDifficultyLevel(DL_NORMAL);
	}
	setWarzoneKeyNumeric("debugmode", bAllowDebugMode);
	setWarzoneKeyNumeric("framerate", (SDWORD)getFramerateLimit());
	setWarzoneKeyNumeric("showFPS", (SDWORD)showFPS);
	setWarzoneKeyNumeric("scroll",(SDWORD)scroll_speed_accel);		// scroll
	setWarzoneKeyNumeric("difficulty", getDifficultyLevel());		// level
	setWarzoneKeyNumeric("visfog",(SDWORD)(!war_GetFog()));			// fogtype
	setWarzoneKeyNumeric("shake",(SDWORD)(getShakeStatus()));		// screenshake
	setWarzoneKeyNumeric("mouseflip",(SDWORD)(getInvertMouseStatus()));	// flipmouse
	setWarzoneKeyNumeric("RightClickOrders",(SDWORD)(getRightClickOrders()));
	setWarzoneKeyNumeric("MiddleClickRotate",(SDWORD)(getMiddleClickRotate()));
	setWarzoneKeyNumeric("shadows",(SDWORD)(getDrawShadows()));	// shadows
	setWarzoneKeyNumeric("sound", (SDWORD)war_getSoundEnabled());
	setWarzoneKeyNumeric("FMVmode",(SDWORD)(war_GetFMVmode()));		// sequences
	setWarzoneKeyNumeric("subtitles",(SDWORD)(seq_GetSubtitles()));		// subtitles
	setWarzoneKeyNumeric("radarObjectMode",(SDWORD)bEnemyAllyRadarColor);    // enemy/allies radar view
	setWarzoneKeyNumeric("radarTerrainMode",(SDWORD)radarDrawMode);
	setWarzoneKeyNumeric("trapCursor", war_GetTrapCursor());
	setWarzoneKeyNumeric("vsync", war_GetVsync());
	setWarzoneKeyNumeric("textureSize", getTextureSize());
	setWarzoneKeyNumeric("rotateRadar", rotateRadar);
	setWarzoneKeyNumeric("PauseOnFocusLoss", war_GetPauseOnFocusLoss());
	setWarzoneKeyNumeric("ColouredCursor", war_GetColouredCursor());
	setWarzoneKeyString("masterserver_name", NETgetMasterserverName());
	setWarzoneKeyNumeric("masterserver_port", NETgetMasterserverPort());
	setWarzoneKeyNumeric("gameserver_port", NETgetGameserverPort());

	if(!bMultiPlayer)
	{
		setWarzoneKeyNumeric("colour",(SDWORD)getPlayerColour(0));			// favourite colour.
	}
	else
	{
		debug( LOG_NEVER, "Writing multiplay prefs to registry\n" );
		if (NetPlay.isHost && ingame.localJoiningInProgress)
		{
			if (bMultiPlayer && NetPlay.bComms)
			{
				setWarzoneKeyString("gameName", game.name);			//  last hosted game
			}
			setWarzoneKeyString("mapName", game.map);				//  map name
			setWarzoneKeyNumeric("maxPlayers",game.maxPlayers);		// maxPlayers
			setWarzoneKeyNumeric("power", game.power);				// power
			setWarzoneKeyNumeric("base", game.base);				// size of base
			setWarzoneKeyNumeric("fog", game.fog);					// fog 'o war
			setWarzoneKeyNumeric("alliance", game.alliance);		// allow alliances
		}
		setWarzoneKeyString("playerName",(char*)sPlayer);		// player name
		setWarzoneKeyString("phrase0", ingame.phrases[0]);		// phrases
		setWarzoneKeyString("phrase1", ingame.phrases[1]);
		setWarzoneKeyString("phrase2", ingame.phrases[2]);
		setWarzoneKeyString("phrase3", ingame.phrases[3]);
		setWarzoneKeyString("phrase4", ingame.phrases[4]);
	}

	return closeWarzoneKey();
}
// ////////////////////////////////////////////////////////////////////////////
bool loadConfig(void)
{
	int val;
	char	sBuf[255];
	bool bad_resolution = false;

	if (!openWarzoneKey())
	{
		return false;
	}

	//  options screens.
	// //////////////////////////

	// //////////////////////////
	// voice vol
	if(getWarzoneKeyNumeric("voicevol", &val))
	{
		sound_SetUIVolume((float)val / 100.0);//was val
	}

	// //////////////////////////
	// fx vol
	if(getWarzoneKeyNumeric("fxvol", &val))
	{
		sound_SetEffectsVolume((float)val / 100.0);//was val
	}

	// //////////////////////////
	// cdvol
	if(getWarzoneKeyNumeric("cdvol", &val))
	{
		sound_SetMusicVolume((float)val / 100.0);
	}

	if (getWarzoneKeyNumeric("debugmode", &val))
	{
		bAllowDebugMode = val;
	}
	else
	{
#ifdef DEBUG
		bAllowDebugMode = true;
#else
		bAllowDebugMode = false;
#endif
		setWarzoneKeyNumeric("debugmode", bAllowDebugMode);
	}

	if (getWarzoneKeyNumeric("music_enabled", &val))
	{
		war_SetMusicEnabled(val);
	}

	if (getWarzoneKeyString("language", sBuf))
	{
		setLanguage(sBuf);
	}

	if (getWarzoneKeyNumeric("showFPS", &val))
	{
		showFPS = val;
	}
	else
	{
		showFPS = false;
		setWarzoneKeyNumeric("showFPS", false);
	}

	// //////////////////////////
	// scroll
	if(getWarzoneKeyNumeric("scroll", &val))
	{
		scroll_speed_accel = val;
	}
	else
	{
		scroll_speed_accel = DEFAULTSCROLL;
		setWarzoneKeyNumeric("scroll", DEFAULTSCROLL);
	}

	// //////////////////////////
	// screen shake
	if(getWarzoneKeyNumeric("shake", &val))
	{
		setShakeStatus(val);
	}
	else
	{
		setShakeStatus(false);
		setWarzoneKeyNumeric("shake", false);
	}

	// //////////////////////////
	// draw shadows
	if(getWarzoneKeyNumeric("shadows", &val))
	{
		setDrawShadows(val);
	}
	else
	{
		setDrawShadows(true);
		setWarzoneKeyNumeric("shadows", true);
	}

	// //////////////////////////
	// enable sound
	if(getWarzoneKeyNumeric("sound", &val))
	{
		war_setSoundEnabled( val );
	}
	else
	{
		war_setSoundEnabled( true );
		setWarzoneKeyNumeric( "sound", true );
	}

	// //////////////////////////
	// invert mouse
	if(getWarzoneKeyNumeric("mouseflip", &val))
	{
		setInvertMouseStatus(val);
	}
	else
	{
		setInvertMouseStatus(true);
		setWarzoneKeyNumeric("mouseflip", true);
	}

	// //////////////////////////
	// mouse buttons
	if (getWarzoneKeyNumeric("RightClickOrders", &val))
	{
		setRightClickOrders(val);
	}
	else
	{
		setRightClickOrders(false);
		setWarzoneKeyNumeric("RightClickOrders", false);
	}
	if (getWarzoneKeyNumeric("MiddleClickRotate", &val))
	{
		setMiddleClickRotate(val);
	}
	else
	{
		setMiddleClickRotate(false);
		setWarzoneKeyNumeric("MiddleClickRotate", false);
	}
	
	// //////////////////////////
	// rotate radar
	if(getWarzoneKeyNumeric("rotateRadar", &val))
	{
		rotateRadar = val;
	}
	else
	{
		rotateRadar = true;
		setWarzoneKeyNumeric("rotateRadar", rotateRadar);
	}

	if (getWarzoneKeyNumeric("PauseOnFocusLoss", &val))
	{
		war_SetPauseOnFocusLoss(val);
	}
	else
	{
		war_SetPauseOnFocusLoss(false);
		setWarzoneKeyNumeric("PauseOnFocusLoss", false);
	}

	if (getWarzoneKeyString("masterserver_name", sBuf))
	{
		NETsetMasterserverName(sBuf);
		if (strcasecmp(sBuf, "lobby.wz2100.net") != 0)
		{
			debug(LOG_ERROR, "We are not using lobby.wz2100.net, for the master server name, we are using %s instead?", sBuf);
		}
	}
	else
	{
		NETsetMasterserverName("lobby.wz2100.net");
		setWarzoneKeyString("masterserver_name", NETgetMasterserverName());
	}

	if (getWarzoneKeyString("fontname", sBuf) && strcmp(sBuf,"Lucida Grande"))
	{
		iV_font(sBuf, NULL, NULL);
	}
	else
	{
		iV_font("DejaVu Sans", NULL, NULL);
		setWarzoneKeyString("fontname", "DejaVu Sans");
	}

	if (getWarzoneKeyString("fontface", sBuf) && strcmp(sBuf,"Normal"))
	{
		iV_font(NULL, sBuf, NULL);
	}
	else
	{
		iV_font(NULL, "Book", NULL);
		setWarzoneKeyString("fontface", "Book");
	}

	if (getWarzoneKeyString("fontfacebold", sBuf))
	{
		iV_font(NULL, NULL, sBuf);
	}
	else
	{
		iV_font(NULL, NULL, "Bold");
		setWarzoneKeyString("fontfacebold", "Bold");
	}

	if (getWarzoneKeyNumeric("masterserver_port", &val))
	{
		NETsetMasterserverPort(val);
		if (val != MASTERSERVERPORT)
		{
			debug(LOG_ERROR, "We are not using port %d (which is the default Master server port), we are using %d?", MASTERSERVERPORT, val);
		}
	}
	else
	{
		NETsetMasterserverPort(MASTERSERVERPORT);
		setWarzoneKeyNumeric("masterserver_port", NETgetMasterserverPort());
	}

	if (getWarzoneKeyNumeric("gameserver_port", &val))
	{
		NETsetGameserverPort(val);
		if (val != GAMESERVERPORT)
		{
			debug(LOG_ERROR, "We are not using port %d (which is the default Game server port), we are using %d?", GAMESERVERPORT, val);
		}
	}
	else
	{
		NETsetGameserverPort(GAMESERVERPORT);
		setWarzoneKeyNumeric("gameserver_port", NETgetGameserverPort());
	}

	// //////////////////////////
	// sequences
	if (getWarzoneKeyNumeric("FMVmode", &val))
	{
		war_SetFMVmode((FMV_MODE)val);
	}
	else
	{
		war_SetFMVmode(FMV_FULLSCREEN);
	}

	// //////////////////////////
	// subtitles
	if(getWarzoneKeyNumeric("subtitles", &val))
	{
		seq_SetSubtitles(val);
	}
	else
	{
		seq_SetSubtitles(true);
	}

	// //////////////////////////
	// difficulty

	if(getWarzoneKeyNumeric("difficulty", &val))
	{
		setDifficultyLevel((DIFFICULTY_LEVEL)val);
	}
	else
	{
		setDifficultyLevel(DL_NORMAL);
		setWarzoneKeyNumeric("difficulty", DL_NORMAL);
	}

	// //////////////////////////
	// use vis fog
	if(getWarzoneKeyNumeric("visfog", &val))
	{
		if(val)
		{
			war_SetFog(false);
		}
		else
		{
			war_SetFog(true);
		}
	}
	else
	{
		war_SetFog(true);
		setWarzoneKeyNumeric("visfog", 0);
	}

	// //////////////////////////
	// favourite colour
	if(!bMultiPlayer)
	{
		if(getWarzoneKeyNumeric("colour", &val))
		{
			war_SetSPcolor(val);
		}
		else
		{
			war_SetSPcolor(0);	//default is green (0)
			setWarzoneKeyNumeric("colour", 0);
		}
	}


	// /////////////////////////
	//  multiplayer stuff.
	// /////////////////////////

	// game name
	if (getWarzoneKeyString("gameName", sBuf))
	{
		sstrcpy(game.name, sBuf);
	}
	else
	{
		setWarzoneKeyString("gameName", "My Game");
	}

	// player name
	// must _not_ be an empty string
	if (getWarzoneKeyString("playerName", sBuf)
	 && *sBuf != '\0')
	{
		sstrcpy(sPlayer, sBuf);
	}
	else
	{
		setWarzoneKeyString("playerName", _("Player"));
		sstrcpy(sPlayer, _("Player"));
	}

	// map name
	if(getWarzoneKeyString("mapName", sBuf))
	{
		/* FIXME: Get rid of storing the max-player count in the config
		 *        file. Instead we should parse the map *before*
		 *        showing the skirmish/multiplayer setup screen.
		 */
		if (getWarzoneKeyNumeric("maxPlayers", &val))
		{
			sstrcpy(game.map, sBuf);
			game.maxPlayers = val;
		}
		else
		{
			debug(LOG_WARNING, "Invalid or not found maxPlayers parameter for map %s", game.map);
			debug(LOG_WARNING, "Reseting map to default parameters.");
			// we don't have maxPlayers set, so fall back to defaults.
			game.maxPlayers = 4;	//4 is for the DEFAULTSKIRMISHMAP map (rush)
			sstrcpy(game.map, DEFAULTSKIRMISHMAP);
			setWarzoneKeyString("mapName", game.map);
			setWarzoneKeyNumeric("maxPlayers",game.maxPlayers);
		}
	}
	else
	{
		sstrcpy(game.map, DEFAULTSKIRMISHMAP);
		setWarzoneKeyString("mapName", game.map);
	}

	// power
	if(getWarzoneKeyNumeric("power", &val))
	{
		game.power = val;
	}
	else
	{
		game.power = LEV_MED;
		setWarzoneKeyNumeric("power", game.power);
	}

	// fog
	if(getWarzoneKeyNumeric("fog", &val))
	{
		game.fog= val;
	}
	else
	{
		game.fog= true;
		setWarzoneKeyNumeric("fog", game.fog);
	}

	//base
	if(getWarzoneKeyNumeric("base", &val))
	{
		game.base =(UBYTE)val;
	}
	else
	{
		game.base = CAMP_BASE;
		setWarzoneKeyNumeric("base", game.base);
	}

	//alliance
	if(getWarzoneKeyNumeric("alliance", &val))
	{
		game.alliance =(UBYTE)val;
	}
	else
	{
		game.alliance = NO_ALLIANCES;
		setWarzoneKeyNumeric("alliance", game.alliance);
	}

	// favourite phrases
	if(getWarzoneKeyString("phrase0", ingame.phrases[0]))
	{
		getWarzoneKeyString("phrase1", ingame.phrases[1]);
		getWarzoneKeyString("phrase2", ingame.phrases[2]);
		getWarzoneKeyString("phrase3", ingame.phrases[3]);
		getWarzoneKeyString("phrase4", ingame.phrases[4]);
	}
	else
	{
		memset(&ingame.phrases, 0, sizeof(ingame.phrases));
		setWarzoneKeyString("phrase0", ingame.phrases[0]);
		setWarzoneKeyString("phrase1", ingame.phrases[1]);
		setWarzoneKeyString("phrase2", ingame.phrases[2]);
		setWarzoneKeyString("phrase3", ingame.phrases[3]);
		setWarzoneKeyString("phrase4", ingame.phrases[4]);
	}

	// enemy/allies radar view
	if(getWarzoneKeyNumeric("radarObjectMode", &val))
	{
		bEnemyAllyRadarColor =(bool)val;
	} else {
		bEnemyAllyRadarColor = false;
		setWarzoneKeyNumeric("radarObjectMode", (SDWORD)bEnemyAllyRadarColor);
	}

	// mini-map terrain mode
	if(getWarzoneKeyNumeric("radarTerrainMode", &val))
	{
		radarDrawMode = (RADAR_DRAW_MODE)val;

		if(radarDrawMode >= NUM_RADAR_MODES)
		{
			ASSERT(!"wrong mini-map mode", "loadConfig: wrong mini-map mode: %d", radarDrawMode);
			radarDrawMode = RADAR_MODE_DEFAULT;
		}
	} else {
		radarDrawMode = RADAR_MODE_DEFAULT;
		setWarzoneKeyNumeric("radarTerrainMode", radarDrawMode);
	}

	// texture size
	if (getWarzoneKeyNumeric("textureSize", &val))
	{
		setTextureSize(val);
	} else {
		setWarzoneKeyNumeric("textureSize", getTextureSize());
	}

	// UPnP detection
	if (getWarzoneKeyNumeric("UPnP", &val))
	{
		NetPlay.isUPNP = val;
	}
	else
	{
		setWarzoneKeyNumeric("UPnP", 1);
		NetPlay.isUPNP = 1;
	}

	if (getWarzoneKeyNumeric("FSAA", &val))
	{
		war_setFSAA(val);
	}
	else
	{
		setWarzoneKeyNumeric("FSAA", war_getFSAA());
	}

	if( getWarzoneKeyNumeric("fullscreen", &val) ) {
		war_setFullscreen(val);
	} else {
		// If no setting is found go to fullscreen by default
		setWarzoneKeyNumeric("fullscreen", true);
		war_setFullscreen(true);
	}

	if (getWarzoneKeyNumeric("ColouredCursor", &val))
	{
		war_SetColouredCursor(val);
	}
	else
	{
#ifdef WZ_OS_MAC
		// Mac OS X doesn't support normal cursors
		war_SetColouredCursor(true);
		setWarzoneKeyNumeric("ColouredCursor", true);
#else
		war_SetColouredCursor(false);
		setWarzoneKeyNumeric("ColouredCursor", false);
#endif
	}

	if (getWarzoneKeyNumeric("trapCursor", &val))
	{
		war_SetTrapCursor(val);
	}
	else
	{
		war_SetTrapCursor(false);
	}

	if (getWarzoneKeyNumeric("vsync", &val))
	{
		war_SetVsync(val);
	}
	else
	{
		war_SetVsync(true);
	}

	// now load the desired res..
	// note that we only do this if we havent changed renderer..
	if (getWarzoneKeyNumeric("width", &val)
	 && val >= 640)
	{
		pie_SetVideoBufferWidth(val);
		war_SetWidth(val);
	}
	else
	{
		bad_resolution = true;
	}

	if (getWarzoneKeyNumeric("height", &val)
	 && val >= 400)
	{
		pie_SetVideoBufferHeight(val);
		war_SetHeight(val);
	}
	else
	{
		bad_resolution = true;
	}

	if (bad_resolution)
	{
		// If we have an invalid or incomplete resolution specified
		// fall back to the defaults.
		war_SetWidth(0);
		war_SetHeight(0);
	}

	if (getWarzoneKeyNumeric("bpp", &val))
	{
		pie_SetVideoBufferDepth(val);
	}

	if (getWarzoneKeyNumeric("framerate", &val))
	{
		setFramerateLimit(val);
	}

	return closeWarzoneKey();
}
 //-----------------------------------------------------------------------------
 Vector4 AutoParamDataSource::getPackedTextureSize(size_t index) const
 {
     Vector4 size = getTextureSize(index);
     return Vector4(size.x, size.y, 1 / size.x, 1 / size.y);
 }
 //-----------------------------------------------------------------------------
 Vector4 AutoParamDataSource::getInverseTextureSize(size_t index) const
 {
     Vector4 size = getTextureSize(index);
     return 1 / size;
 }
Exemple #16
0
bool runVideoOptionsMenu(void)
{
	//SDL_Rect **modes = SDL_ListModes(NULL, SDL_FULLSCREEN | SDL_HWSURFACE);
	HACK modes[] = {{1920, 1200}, {1920, 1080}, {1680, 1050}, {1600, 1200}, {1440, 900}, {1280, 1024}, {1280, 960}, {1280, 800}, {1280, 720}, {1024, 768}, {800, 600}, {720, 576}, {720, 480}, {640, 480}, {0, 0}};
	UDWORD id = widgRunScreen(psWScreen);
	int level;

	switch (id)
	{
		case FRONTEND_WINDOWMODE:
		case FRONTEND_WINDOWMODE_R:
			if (war_getFullscreen())
			{
				war_setFullscreen(false);
				widgSetString(psWScreen, FRONTEND_WINDOWMODE_R, _("Windowed"));
			}
			else
			{
				war_setFullscreen(true);
				widgSetString(psWScreen, FRONTEND_WINDOWMODE_R, _("Fullscreen"));
			}
			break;

		case FRONTEND_FSAA:
		case FRONTEND_FSAA_R:
			switch (level = war_getFSAA())
			{
				case FSAA_OFF:
					war_setFSAA((FSAA_LEVEL)(level + 1));
					widgSetString(psWScreen, FRONTEND_FSAA_R, "2X");
					break;
				case FSAA_2X:
					war_setFSAA((FSAA_LEVEL)(level + 1));
					widgSetString(psWScreen, FRONTEND_FSAA_R, "4X");
					break;

				case FSAA_4X:
					war_setFSAA((FSAA_LEVEL)(level + 1));
					widgSetString(psWScreen, FRONTEND_FSAA_R, "8X");
					break;

				case FSAA_8X:
					war_setFSAA((FSAA_LEVEL)(level + 1));
					widgSetString(psWScreen, FRONTEND_FSAA_R, _("Off"));
					break;

				default:
					// we can't check what the max level the card is capable of, without first creating that level, and testing.
					ASSERT(!"invalid FSAA level ?", "Invalid FSAA level: %u", (unsigned int)level);
					addTextButton(FRONTEND_FSAA_R, FRONTEND_POS5M-55, FRONTEND_POS6Y, _("Unsupported"), 0);
					break;
			}
			break;

		case FRONTEND_RESOLUTION:
		case FRONTEND_RESOLUTION_R:
		{
			int current, count, oldcurrent;

			// Get the current mode offset
			for (count = 0, current = 0; modes[count]; count++)
			{
				if (war_GetWidth() == modes[count]->w
				 && war_GetHeight() == modes[count]->h)
				{
					current = count;
				}
			}

			// Increment and clip if required
			// Hide resolutions lower than Warzone can support
			oldcurrent = current;
			do
			{
				if (!mouseReleased(MOUSE_RMB))
				{
					if (--current < 0)
						current = count - 1;
				}
				else
				{
					if (++current == count)
						current = 0;
				}	
			} while ((modes[current]->w < 640 || modes[current]->h < 480)
				&& current != oldcurrent);

			// Set the new width and height (takes effect on restart)
			war_SetWidth(modes[current]->w);
			war_SetHeight(modes[current]->h);

			// Generate the textual representation of the new width and height
			snprintf(resolution, WIDG_MAXSTR, "%d x %d", modes[current]->w,
			         modes[current]->h);

			// Update the widget
			widgSetString(psWScreen, FRONTEND_RESOLUTION_R, resolution);

			break;
		}

		case FRONTEND_TRAP:
		case FRONTEND_TRAP_R:
			if (war_GetTrapCursor())
			{
				war_SetTrapCursor(false);
				widgSetString(psWScreen, FRONTEND_TRAP_R, _("Off"));
			}
			else
			{
				war_SetTrapCursor(true);
				widgSetString(psWScreen, FRONTEND_TRAP_R, _("On"));
			}
			break;

		case FRONTEND_TEXTURESZ:
		case FRONTEND_TEXTURESZ_R:
		{
			int newTexSize = getTextureSize() * 2;

			// Clip such that 128 <= size <= 2048
			if (newTexSize > 2048)
			{
				newTexSize = 128;
			}

			// Set the new size
			setTextureSize(newTexSize);

			// Generate the string representation of the new size
			snprintf(textureSize, WIDG_MAXSTR, "%d", newTexSize);

			// Update the widget
			widgSetString(psWScreen, FRONTEND_TEXTURESZ_R, textureSize);

			break;
		}

		case FRONTEND_VSYNC:
		case FRONTEND_VSYNC_R:
		{
			if (war_GetVsync())
			{
				war_SetVsync(false);
				widgSetString(psWScreen, FRONTEND_VSYNC_R, _("Off"));
			}
			else
			{
				war_SetVsync(true);
				widgSetString(psWScreen, FRONTEND_VSYNC_R, _("On"));
			}
			break;
		}

		case FRONTEND_QUIT:
			changeTitleMode(OPTIONS);
			break;

		default:
			break;
	}

	if (CancelPressed())
	{
		changeTitleMode(OPTIONS);
	}

	widgDisplayScreen(psWScreen);

	return true;
}
Exemple #17
0
int FeImage::get_texture_height() const
{
	return getTextureSize().y;
}
Exemple #18
0
int FeImage::get_texture_width() const
{
	return getTextureSize().x;
}
Exemple #19
0
// ////////////////////////////////////////////////////////////////////////////
bool saveConfig()
{
	QSettings ini(PHYSFS_getWriteDir() + QString("/") + fileName, QSettings::IniFormat);
	if (ini.status() != QSettings::NoError)
	{
		debug(LOG_ERROR, "Could not open configuration file \"%s\"", fileName);
		return false;
	}
	debug(LOG_WZ, "Writing prefs to registry \"%s\"", ini.fileName().toUtf8().constData());

	// //////////////////////////
	// voicevol, fxvol and cdvol
	ini.setValue("voicevol", (int)(sound_GetUIVolume() * 100.0));
	ini.setValue("fxvol", (int)(sound_GetEffectsVolume() * 100.0));
	ini.setValue("cdvol", (int)(sound_GetMusicVolume() * 100.0));
	ini.setValue("music_enabled", war_GetMusicEnabled());
	ini.setValue("width", war_GetWidth());
	ini.setValue("height", war_GetHeight());
	ini.setValue("bpp", pie_GetVideoBufferDepth());
	ini.setValue("fullscreen", war_getFullscreen());
	ini.setValue("language", getLanguage());
	// dont save out the cheat mode.
	if (getDifficultyLevel() != DL_KILLER && getDifficultyLevel() != DL_TOUGH)
	{
		ini.setValue("difficulty", getDifficultyLevel());		// level
	}
	ini.setValue("showFPS", (SDWORD)showFPS);
	ini.setValue("scroll",(SDWORD)scroll_speed_accel);		// scroll
	ini.setValue("shake",(SDWORD)(getShakeStatus()));		// screenshake
	ini.setValue("mouseflip",(SDWORD)(getInvertMouseStatus()));	// flipmouse
	ini.setValue("nomousewarp", (SDWORD)getMouseWarp()); 		// mouse warp
	ini.setValue("RightClickOrders",(SDWORD)(getRightClickOrders()));
	ini.setValue("MiddleClickRotate",(SDWORD)(getMiddleClickRotate()));
	ini.setValue("showFPS", (SDWORD)showFPS);
	ini.setValue("shadows",(SDWORD)(getDrawShadows()));	// shadows
	ini.setValue("sound", (SDWORD)war_getSoundEnabled());
	ini.setValue("FMVmode",(SDWORD)(war_GetFMVmode()));		// sequences
	ini.setValue("scanlines", (SDWORD)war_getScanlineMode());
	ini.setValue("subtitles",(SDWORD)(seq_GetSubtitles()));		// subtitles
	ini.setValue("radarObjectMode",(SDWORD)bEnemyAllyRadarColor);    // enemy/allies radar view
	ini.setValue("radarTerrainMode",(SDWORD)radarDrawMode);
	ini.setValue("trapCursor", war_GetTrapCursor());
	ini.setValue("vsync", war_GetVsync());
	ini.setValue("textureSize", getTextureSize());
	ini.setValue("FSAA", war_getFSAA());
	ini.setValue("UPnP", (SDWORD)NetPlay.isUPNP);
	ini.setValue("rotateRadar", rotateRadar);
	ini.setValue("PauseOnFocusLoss", war_GetPauseOnFocusLoss());
	ini.setValue("masterserver_name", NETgetMasterserverName());
	ini.setValue("masterserver_port", NETgetMasterserverPort());
	ini.setValue("gameserver_port", NETgetGameserverPort());
	if (!bMultiPlayer)
	{
		ini.setValue("colour", getPlayerColour(0));			// favourite colour.
	}
	else
	{
		if (NetPlay.isHost && ingame.localJoiningInProgress)
		{
			if (bMultiPlayer && NetPlay.bComms)
			{
				ini.setValue("gameName", game.name);			//  last hosted game
			}
			ini.setValue("mapName", game.map);				//  map name
			ini.setValue("mapHash", game.hash.toString().c_str());          //  map hash
			ini.setValue("maxPlayers", game.maxPlayers);		// maxPlayers
			ini.setValue("power", game.power);				// power
			ini.setValue("base", game.base);				// size of base
			ini.setValue("alliance", game.alliance);		// allow alliances
			ini.setValue("scavengers", game.scavengers);
		}
		ini.setValue("playerName", (char*)sPlayer);		// player name
	}
	ini.setValue("colourMP", war_getMPcolour());
	ini.sync();
	return true;
}
Exemple #20
0
static void describeMirrorState(ExporterContext &,DescriptionMap & desc,State * state) {
	auto ms = dynamic_cast<MirrorState *>(state);
	desc.setString(Consts::ATTR_STATE_TYPE, Consts::STATE_TYPE_MIRROR_STATE);
	desc.setValue(Consts::ATTR_MIRROR_TEXTURE_SIZE, Util::GenericAttribute::createNumber<uint16_t>(ms->getTextureSize()));
}
Exemple #21
0
/// Set up the texture coordinates for a tile
static void getTileTexCoords(Vector2f *uv, unsigned int tileNumber)
{
	/* unmask proper values from compressed data */
	const unsigned short texture = TileNumber_texture(tileNumber);
	const unsigned short tile = TileNumber_tile(tileNumber);

	/* Used to calculate texture coordinates */
	const float xMult = 1.0f / TILES_IN_PAGE_COLUMN;
	const float yMult = 1.0f / TILES_IN_PAGE_ROW;
	float texsize = (float)getTextureSize();
	float centertile, shiftamount, one;
	Vector2f sP1, sP2, sP3, sP4, sPTemp;

	// the decals are 128x128 (at this time), we should not go above this value.  See note above
	if (texsize > MAX_TILE_TEXTURE_SIZE)
	{
		texsize = MAX_TILE_TEXTURE_SIZE;
	}
	centertile = 0.5f / texsize;			//compute center of tile
	shiftamount = (texsize -1.0) / texsize;	// 1 pixel border
	one = 1.0f / (TILES_IN_PAGE_COLUMN * texsize);

	// bump the texture coords, for 1 pixel border, so our range is [.5,(texsize - .5)]
	one += centertile * shiftamount;
	/*
	 * Points for flipping the texture around if the tile is flipped or rotated
	 * Store the source rect as four points
	 */
	sP1.x = one;
	sP1.y = one;
	sP2.x = xMult - one;
	sP2.y = one;
	sP3.x = xMult - one;
	sP3.y = yMult - one;
	sP4.x = one;
	sP4.y = yMult - one;

	if (texture & TILE_XFLIP)
	{
		sPTemp = sP1;
		sP1 = sP2;
		sP2 = sPTemp;

		sPTemp = sP3;
		sP3 = sP4;
		sP4 = sPTemp;
	}
	if (texture & TILE_YFLIP)
	{
		sPTemp = sP1;
		sP1 = sP4;
		sP4 = sPTemp;
		sPTemp = sP2;
		sP2 = sP3;
		sP3 = sPTemp;
	}

	switch ((texture & TILE_ROTMASK) >> TILE_ROTSHIFT)
	{
		case 1:
			sPTemp = sP1;
			sP1 = sP4;
			sP4 = sP3;
			sP3 = sP2;
			sP2 = sPTemp;
			break;
		case 2:
			sPTemp = sP1;
			sP1 = sP3;
			sP3 = sPTemp;
			sPTemp = sP4;
			sP4 = sP2;
			sP2 = sPTemp;
			break;
		case 3:
			sPTemp = sP1;
			sP1 = sP2;
			sP2 = sP3;
			sP3 = sP4;
			sP4 = sPTemp;
			break;
	}
	uv[0 + 0].x = tileTexInfo[tile].uOffset + sP1.x;
	uv[0 + 0].y = tileTexInfo[tile].vOffset + sP1.y;
	
	uv[0 + 2].x = tileTexInfo[tile].uOffset + sP2.x;
	uv[0 + 2].y = tileTexInfo[tile].vOffset + sP2.y;
	
	uv[1 + 2].x = tileTexInfo[tile].uOffset + sP3.x;
	uv[1 + 2].y = tileTexInfo[tile].vOffset + sP3.y;
	
	uv[1 + 0].x = tileTexInfo[tile].uOffset + sP4.x;
	uv[1 + 0].y = tileTexInfo[tile].vOffset + sP4.y;
}
Exemple #22
0
static void describeShadowState(ExporterContext & ctx,DescriptionMap & desc,State * state) {
	auto ss = dynamic_cast<ShadowState *>(state);
	desc.setString(Consts::ATTR_STATE_TYPE, Consts::STATE_TYPE_SHADOW_STATE);
	desc.setValue(Consts::ATTR_SHADOW_LIGHT_NODE, Util::GenericAttribute::createString(ctx.sceneManager.getNodeId(ss->getLight()).toString()));
	desc.setValue(Consts::ATTR_SHADOW_TEXTURE_SIZE, Util::GenericAttribute::createNumber<uint16_t>(ss->getTextureSize()));
}