Code review changes

This commit is contained in:
vincent 2013-04-10 08:28:26 +02:00
parent 4f41aab89a
commit bb380e841e
9 changed files with 58 additions and 70 deletions

View file

@ -6,7 +6,6 @@
// Copyright (c) 2013 High Fidelity, Inc. All rights reserved.
//
#include "InterfaceConfig.h"
#include "FieldOfView.h"
#include "Stars.h"

View file

@ -137,7 +137,7 @@ namespace starfield {
// ww + ww aa = dd
// ww = dd / (1 + aa)
float diag = 2.0f * std::sin(halfPersp);
float near2 = std::cos(halfPersp);
float nearClip = std::cos(halfPersp);
float hw = 0.5f * sqrt(diag * diag / (1.0f + aspect * aspect));
float hh = hw * aspect;
@ -165,11 +165,11 @@ namespace starfield {
#if STARFIELD_DEBUG_LOD
mat4 matrix_debug = glm::translate(
glm::frustum(-hw,hw, -hh,hh, near2,10.0f),
glm::frustum(-hw, hw, -hh, hh, nearClip, 10.0f),
vec3(0.0f, 0.0f, -4.0f)) * glm::affineInverse(matrix);
#endif
matrix = glm::frustum(-hw,hw, -hh,hh, near2,10.0f)
matrix = glm::frustum(-hw,hw, -hh,hh, nearClip,10.0f)
* glm::affineInverse(matrix);
this->_itrOutIndex = (unsigned*) _arrBatchOffs;
@ -374,11 +374,11 @@ namespace starfield {
float halfSlice = 0.5f * slice;
float daz = halfSlice * cos(abs(altitude) - halfSlice);
float dal = halfSlice;
float near2 = cos(_valHalfPersp + sqrt(daz*daz+dal*dal));
float nearClip = cos(_valHalfPersp + sqrt(daz * daz + dal * dal));
// fprintf(stderr, "Stars.cpp: checking tile #%d, w = %f, near = %f\n", i, w, near2);
// fprintf(stderr, "Stars.cpp: checking tile #%d, w = %f, near = %f\n", i, w, nearClip);
return w > near2;
return w > nearClip;
}
void updateVertexCount(Tile* t, BrightnessLevel minBright) {

View file

@ -1,5 +1,5 @@
//
// starfield/renderer/Tiling.h
// starfield/renderer/
// interface
//
// Created by Tobias Schwinger on 3/22/13.
@ -15,16 +15,12 @@
#ifdef _WIN32
#include "../Config.h"
#define lrint(x) (floor(x+(x>0) ? 0.5 : -0.5))
inline float remainder(float x,float y) { return std::fmod(x,y); }
inline int round(float x) { return (floor(x + 0.5)); }
double log2( double n )
{
// log(n)/log(2) is log2.
return log( n ) / log( 2 );
}
#define lrint(x) (floor(x + (x > 0) ? 0.5 : -0.5))
inline float remainder(float x, float y) { return std::fmod(x, y); }
inline int round(float x) { return (floor(x + 0.5)); }
double log2( double n ) { return log( n ) / log( 2 ); }
#else
#include "../starfield/Config.h"
#include "starfield/Config.h"
#endif
namespace starfield {

View file

@ -12,17 +12,15 @@ set(HIFI_SHARED_LIBRARY HifiShared)
set(EXTERNAL_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/external)
if (WIN32)
# include headers for external libraries and InterfaceConfig.
include_directories(
${EXTERNAL_ROOT_DIR}
)
# include headers for external libraries and InterfaceConfig.
include_directories(${EXTERNAL_ROOT_DIR})
endif (WIN32)
if (NOT WIN32)
find_package(CURL REQUIRED)
include_directories(${CURL_INCLUDE_DIRS})
# link target to common, external libraries
target_link_libraries(HifiShared ${CURL_LIBRARY})
if (NOT WIN32)
find_package(CURL REQUIRED)
include_directories(${CURL_INCLUDE_DIRS})
# link target to common, external libraries
target_link_libraries(HifiShared ${CURL_LIBRARY})
endif (NOT WIN32)
# link required libraries on UNIX

View file

@ -309,15 +309,15 @@ void AgentList::stopSilentAgentRemovalThread() {
}
#ifdef _WIN32
void usleep(int waitTime){
__int64 time1 = 0, time2 = 0, sysFreq = 0;
void usleep(int waitTime) {
__int64 time1 = 0, time2 = 0, sysFreq = 0;
QueryPerformanceCounter((LARGE_INTEGER *)&time1);
QueryPerformanceFrequency((LARGE_INTEGER *)&sysFreq);
do{
QueryPerformanceCounter((LARGE_INTEGER *)&time2);
}while( (time2-time1) <waitTime);
}
QueryPerformanceCounter((LARGE_INTEGER *)&time1);
QueryPerformanceFrequency((LARGE_INTEGER *)&sysFreq);
do {
QueryPerformanceCounter((LARGE_INTEGER *)&time2);
} while( (time2 - time1) < waitTime);
}
#endif
void *checkInWithDomainServer(void *args) {

View file

@ -11,7 +11,6 @@
#include "PerfStat.h"
#include <cstdio>
#include <string>
#include <map>

View file

@ -1,17 +1,14 @@
#ifdef _WIN32
#include <windows.h>
#define _timeval_
#include "Systime.h"
int gettimeofday( timeval* p_tv, timezone* p_tz )
{
int tt = timeGetTime();
p_tv->tv_sec = tt / 1000;
p_tv->tv_usec = tt % 1000 *1000;
return 0;
}
int gettimeofday( timeval* p_tv, timezone* p_tz )
{
int tt = timeGetTime();
p_tv->tv_sec = tt / 1000;
p_tv->tv_usec = tt % 1000 * 1000;
return 0;
}
#endif

View file

@ -89,7 +89,7 @@ int getLocalAddress() {
char szHostName[255];
gethostname(szHostName, 255);
struct hostent *host_entry;
host_entry=gethostbyname(szHostName);
host_entry = gethostbyname(szHostName);
char * szLocalIP;
szLocalIP = inet_ntoa (*(struct in_addr *)*host_entry->h_addr_list);
localAddress = inet_addr(szLocalIP);
@ -140,34 +140,34 @@ UDPSocket::~UDPSocket() {
bool UDPSocket::init() {
#ifdef _WIN32
WORD wVersionRequested;
WSADATA wsaData;
int err;
WORD wVersionRequested;
WSADATA wsaData;
int err;
wVersionRequested = MAKEWORD( 2, 2 );
wVersionRequested = MAKEWORD( 2, 2 );
err = WSAStartup( wVersionRequested, &wsaData );
if ( err != 0 ) {
/* Tell the user that we could not find a usable */
/* WinSock DLL. */
return false;
}
err = WSAStartup( wVersionRequested, &wsaData );
if ( err != 0 ) {
/* Tell the user that we could not find a usable */
/* WinSock DLL. */
return false;
}
/* Confirm that the WinSock DLL supports 2.2.*/
/* Note that if the DLL supports versions later */
/* than 2.2 in addition to 2.2, it will still return */
/* 2.2 in wVersion since that is the version we */
/* requested. */
/* Confirm that the WinSock DLL supports 2.2.*/
/* Note that if the DLL supports versions later */
/* than 2.2 in addition to 2.2, it will still return */
/* 2.2 in wVersion since that is the version we */
/* requested. */
if ( LOBYTE( wsaData.wVersion ) != 2 ||
HIBYTE( wsaData.wVersion ) != 2 ) {
/* Tell the user that we could not find a usable */
/* WinSock DLL. */
WSACleanup( );
return false;
}
if ( LOBYTE( wsaData.wVersion ) != 2 ||
HIBYTE( wsaData.wVersion ) != 2 ) {
/* Tell the user that we could not find a usable */
/* WinSock DLL. */
WSACleanup();
return false;
}
#endif
return true;
return true;
}
// Receive data on this socket with retrieving address of sender

View file

@ -18,7 +18,6 @@
size_t const UrlReader::max_read_ahead = CURL_MAX_WRITE_SIZE;
#else
size_t const UrlReader::max_read_ahead = 0;
#endif
char const* const UrlReader::success = "UrlReader: Success!";