/*
Copyright (C) 2003, 2010 - Wolfire Games
+Copyright (C) 2010-2016 - Lugaru contributors (see AUTHORS file)
This file is part of Lugaru.
#include "Game.h"
#include "Terrain.h"
#include "Objects.h"
+#include "Utils/Folders.h"
+
extern XYZ viewer;
extern float viewdistance;
extern float fadestart;
extern float blurness;
extern float targetblurness;
extern Objects objects;
-extern TGAImageRec texture;
extern bool visibleloading;
extern bool skyboxtexture;
extern int tutoriallevel;
void Terrain::UpdateTransparencyother(int whichx, int whichy)
{
- static XYZ vertex;
static int i, j, a, b, c, d, patch_size, stepsize;
patch_size = size / subdivision;
static float patch_size;
float temptexdetail = texdetail;
- //LoadTGA( fileName );
- // Fixing filename so that it works with its own os
- char * FixedFN = ConvertFileName(fileName);
+ ImageRec texture;
- unsigned char fileNamep[256];
- CopyCStringToPascal(FixedFN, fileNamep);
//Load Image
- upload_image( fileNamep , 0);
+ if (!load_image(Folders::getResourcePath(fileName).c_str(), texture)) {
+ return false;
+ }
//Is it valid?
if (texture.bpp > 24) {
patch_elements = (patch_size) * (patch_size) * 54;
CalculateNormals();
- return 1;
+ return true;
}
void Terrain::CalculateNormals()
float Terrain::getHeight(float pointx, float pointz)
{
static int tilex, tiley;
- static XYZ startpoint, endpoint, intersect, triangle[3], average;
+ static XYZ startpoint, endpoint, intersect, triangle[3];
pointx /= scale;
pointz /= scale;