mirror of
https://github.com/libretro/ppsspp.git
synced 2024-12-02 06:06:24 +00:00
Merge pull request #1983 from KingDuckZ/master
Error/warning fix on Intel compiler.
This commit is contained in:
commit
bfe20e195b
4
.gitignore
vendored
4
.gitignore
vendored
@ -55,3 +55,7 @@ android/assets/lang
|
||||
android/assets/flash0
|
||||
ppge_atlas.zim.png
|
||||
local.properties
|
||||
|
||||
# For vim
|
||||
*.swp
|
||||
tags
|
||||
|
@ -129,9 +129,15 @@ if(NOT MSVC)
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2")
|
||||
add_definitions(-Wno-multichar)
|
||||
add_definitions(-fno-strict-aliasing)
|
||||
add_definitions(-ffast-math)
|
||||
if (CMAKE_C_COMPILER_ID STREQUAL "Intel")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -parallel -fopenmp")
|
||||
else()
|
||||
add_definitions(-ffast-math)
|
||||
endif()
|
||||
if(NOT APPLE)
|
||||
add_definitions(-Wno-psabi)
|
||||
if (NOT CMAKE_C_COMPILER_ID STREQUAL "Intel")
|
||||
add_definitions(-Wno-psabi)
|
||||
endif()
|
||||
add_definitions(-D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED -D__BSD_VISIBLE=1)
|
||||
add_definitions(-D_LARGEFILE64_SOURCE=1 -D_FILE_OFFSET_BITS=64)
|
||||
endif()
|
||||
@ -841,6 +847,7 @@ add_library(${CoreLibName} ${CoreLinkType}
|
||||
Core/HW/MemoryStick.h
|
||||
Core/HW/SasAudio.cpp
|
||||
Core/HW/SasAudio.h
|
||||
Core/HW/atrac3plus.cpp
|
||||
Core/Host.cpp
|
||||
Core/Host.h
|
||||
Core/Loaders.cpp
|
||||
|
@ -30,7 +30,7 @@ std::map<int,int> *platform_keymap = NULL;
|
||||
|
||||
// Default key mapping
|
||||
// Ugly, yet the cleanest way
|
||||
// I could find to create a
|
||||
// I could find to create a
|
||||
// static map.
|
||||
// Still nicer than what
|
||||
// I once did in C.
|
||||
@ -299,7 +299,7 @@ static std::string KeyMap::NamePspButtonFromKey(KeyMap::Key key)
|
||||
|
||||
static std::string KeyMap::NameKeyFromPspButton(int btn)
|
||||
{
|
||||
// We drive our iteration
|
||||
// We drive our iteration
|
||||
// with the list of key names.
|
||||
for (int i = 0; i < key_names_count; i++) {
|
||||
const struct KeyMap_IntStrPair *key_name = key_names + i;
|
||||
@ -319,6 +319,7 @@ static int KeyMap::SetKeyMapping(KeyMap::Key key, int btn)
|
||||
return KEYMAP_ERROR_KEY_ALREADY_USED;
|
||||
|
||||
g_Config.iMappingMap[key] = btn;
|
||||
return btn;
|
||||
}
|
||||
|
||||
static int KeyMap::RegisterPlatformDefaultKeyMap(std::map<int,int> *overriding_map)
|
||||
|
@ -100,8 +100,8 @@ struct AtracLoopInfo {
|
||||
};
|
||||
|
||||
struct Atrac {
|
||||
Atrac() : atracID(-1), data_buf(0), decodePos(0), decodeEnd(0), atracChannels(2), atracOutputChannels(2), loopNum(0),
|
||||
atracBitrate(64), atracBytesPerFrame(0), atracBufSize(0),
|
||||
Atrac() : atracID(-1), data_buf(0), decodePos(0), decodeEnd(0), atracChannels(2), atracOutputChannels(2), loopNum(0),
|
||||
atracBitrate(64), atracBytesPerFrame(0), atracBufSize(0),
|
||||
currentSample(0), endSample(-1), firstSampleoffset(0), loopinfoNum(0) {
|
||||
memset(&first, 0, sizeof(first));
|
||||
memset(&second, 0, sizeof(second));
|
||||
@ -116,7 +116,7 @@ struct Atrac {
|
||||
sampleQueue.empty();
|
||||
}
|
||||
|
||||
~Atrac() {
|
||||
~Atrac() {
|
||||
CleanStuff();
|
||||
}
|
||||
|
||||
@ -190,7 +190,7 @@ struct Atrac {
|
||||
if (first.fileoffset >= first.filesize || currentSample >= endSample)
|
||||
remainFrame = PSP_ATRAC_ALLDATA_IS_ON_MEMORY;
|
||||
else {
|
||||
// guess the remain frames.
|
||||
// guess the remain frames.
|
||||
remainFrame = ((int)first.size - (int)decodePos) / atracBytesPerFrame;
|
||||
if (remainFrame < 0)
|
||||
remainFrame = 0;
|
||||
@ -450,11 +450,11 @@ u32 sceAtracGetAtracID(int codecType)
|
||||
return atracID;
|
||||
}
|
||||
|
||||
// PSP allow games to add stream data to a temp buf, the buf size is given by "atracBufSize "here.
|
||||
// "first.offset" means how many bytes the temp buf has been written,
|
||||
// and "first.writableBytes" means how many bytes the temp buf is allowed to write
|
||||
// (We always have "first.offset + first.writableBytes = atracBufSize").
|
||||
// We only reset the temp buf when games call sceAtracGetStreamDataInfo,
|
||||
// PSP allow games to add stream data to a temp buf, the buf size is given by "atracBufSize "here.
|
||||
// "first.offset" means how many bytes the temp buf has been written,
|
||||
// and "first.writableBytes" means how many bytes the temp buf is allowed to write
|
||||
// (We always have "first.offset + first.writableBytes = atracBufSize").
|
||||
// We only reset the temp buf when games call sceAtracGetStreamDataInfo,
|
||||
// because that function would tell games how to add the left stream data.
|
||||
u32 sceAtracAddStreamData(int atracID, u32 bytesToAdd)
|
||||
{
|
||||
@ -516,11 +516,11 @@ u32 sceAtracDecodeData(int atracID, u32 outAddr, u32 numSamplesAddr, u32 finishF
|
||||
|
||||
if (got_frame) {
|
||||
// got a frame
|
||||
int decoded = av_samples_get_buffer_size(NULL, atrac->pFrame->channels,
|
||||
int decoded = av_samples_get_buffer_size(NULL, atrac->pFrame->channels,
|
||||
atrac->pFrame->nb_samples, (AVSampleFormat)atrac->pFrame->format, 1);
|
||||
u8* out = Memory::GetPointer(outAddr);
|
||||
numSamples = atrac->pFrame->nb_samples;
|
||||
avret = swr_convert(atrac->pSwrCtx, &out, atrac->pFrame->nb_samples,
|
||||
avret = swr_convert(atrac->pSwrCtx, &out, atrac->pFrame->nb_samples,
|
||||
(const u8**)atrac->pFrame->extended_data, atrac->pFrame->nb_samples);
|
||||
if (avret < 0) {
|
||||
ERROR_LOG(HLE, "swr_convert: Error while converting %d", avret);
|
||||
@ -545,7 +545,7 @@ u32 sceAtracDecodeData(int atracID, u32 outAddr, u32 numSamplesAddr, u32 finishF
|
||||
inbytes = std::min(inbytes, (int)atrac->atracBytesPerFrame);
|
||||
if (inbytes > 0) {
|
||||
Atrac3plus_Decoder::atrac3plus_decode(atrac->decoder_context, atrac->data_buf + atrac->decodePos, inbytes, &decodebytes, buf);
|
||||
INFO_LOG(HLE, "decodebytes: %i outbuf: %08x", decodebytes, buf);
|
||||
INFO_LOG(HLE, "decodebytes: %i outbuf: %08p", decodebytes, buf);
|
||||
atrac->sampleQueue.push(buf, decodebytes);
|
||||
}
|
||||
}
|
||||
@ -572,7 +572,7 @@ u32 sceAtracDecodeData(int atracID, u32 outAddr, u32 numSamplesAddr, u32 finishF
|
||||
} else if (numSamples > ATRAC_MAX_SAMPLES) {
|
||||
numSamples = ATRAC_MAX_SAMPLES;
|
||||
}
|
||||
|
||||
|
||||
if (numSamples == 0 && (atrac->loopNum != 0)) {
|
||||
numSamples = ATRAC_MAX_SAMPLES;
|
||||
}
|
||||
@ -583,14 +583,14 @@ u32 sceAtracDecodeData(int atracID, u32 outAddr, u32 numSamplesAddr, u32 finishF
|
||||
// update current sample and decodePos
|
||||
atrac->currentSample += numSamples;
|
||||
atrac->decodePos = atrac->getDecodePosBySample(atrac->currentSample);
|
||||
|
||||
|
||||
int finishFlag = 0;
|
||||
if (atrac->loopNum != 0 && (atrac->currentSample >= atrac->loopEndSample ||
|
||||
if (atrac->loopNum != 0 && (atrac->currentSample >= atrac->loopEndSample ||
|
||||
(numSamples == 0 && atrac->first.size >= atrac->first.filesize))) {
|
||||
atrac->currentSample = atrac->loopStartSample;
|
||||
if (atrac->loopNum > 0)
|
||||
atrac->loopNum --;
|
||||
} else if (atrac->currentSample >= atrac->endSample ||
|
||||
} else if (atrac->currentSample >= atrac->endSample ||
|
||||
(numSamples == 0 && atrac->first.size >= atrac->first.filesize))
|
||||
finishFlag = 1;
|
||||
|
||||
@ -646,11 +646,11 @@ u32 sceAtracGetBitrate(int atracID, u32 outBitrateAddr)
|
||||
if (!atrac) {
|
||||
return -1;
|
||||
} else {
|
||||
atrac->atracBitrate = ( atrac->atracBytesPerFrame * 352800 ) / 1000;
|
||||
if (atrac->codeType == PSP_MODE_AT_3_PLUS)
|
||||
atrac->atracBitrate = ((atrac->atracBitrate >> 11) + 8) & 0xFFFFFFF0;
|
||||
atrac->atracBitrate = ( atrac->atracBytesPerFrame * 352800 ) / 1000;
|
||||
if (atrac->codeType == PSP_MODE_AT_3_PLUS)
|
||||
atrac->atracBitrate = ((atrac->atracBitrate >> 11) + 8) & 0xFFFFFFF0;
|
||||
else
|
||||
atrac->atracBitrate = (atrac->atracBitrate + 511) >> 10;
|
||||
atrac->atracBitrate = (atrac->atracBitrate + 511) >> 10;
|
||||
if (Memory::IsValidAddress(outBitrateAddr))
|
||||
Memory::Write_U32(atrac->atracBitrate, outBitrateAddr);
|
||||
}
|
||||
@ -726,7 +726,7 @@ u32 sceAtracGetNextDecodePosition(int atracID, u32 outposAddr)
|
||||
if (atrac->currentSample >= atrac->endSample)
|
||||
return ATRAC_ERROR_ALL_DATA_DECODED;
|
||||
if (Memory::IsValidAddress(outposAddr))
|
||||
Memory::Write_U32(atrac->currentSample, outposAddr);
|
||||
Memory::Write_U32(atrac->currentSample, outposAddr);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -759,7 +759,7 @@ u32 sceAtracGetRemainFrame(int atracID, u32 remainAddr)
|
||||
Atrac *atrac = getAtrac(atracID);
|
||||
if (!atrac) {
|
||||
if (Memory::IsValidAddress(remainAddr))
|
||||
Memory::Write_U32(12, remainAddr);
|
||||
Memory::Write_U32(12, remainAddr);
|
||||
} else {
|
||||
if (Memory::IsValidAddress(remainAddr))
|
||||
Memory::Write_U32(atrac->getRemainFrames(), remainAddr);
|
||||
@ -800,7 +800,7 @@ u32 sceAtracGetSoundSample(int atracID, u32 outEndSampleAddr, u32 outLoopStartSa
|
||||
}
|
||||
|
||||
// Games call this function to get some info for add more stream data,
|
||||
// such as where the data read from, where the data add to,
|
||||
// such as where the data read from, where the data add to,
|
||||
// and how many bytes are allowed to add.
|
||||
u32 sceAtracGetStreamDataInfo(int atracID, u32 writeAddr, u32 writableBytesAddr, u32 readOffsetAddr)
|
||||
{
|
||||
@ -1048,10 +1048,10 @@ u32 sceAtracSetData(int atracID, u32 buffer, u32 bufferSize)
|
||||
ret = _AtracSetData(atracID, buffer, bufferSize);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
int sceAtracSetDataAndGetID(u32 buffer, u32 bufferSize)
|
||||
{
|
||||
{
|
||||
INFO_LOG(HLE, "sceAtracSetDataAndGetID(%08x, %08x)", buffer, bufferSize);
|
||||
int codecType = getCodecType(buffer);
|
||||
|
||||
@ -1165,10 +1165,10 @@ u32 sceAtracSetMOutData(int atracID, u32 buffer, u32 bufferSize)
|
||||
ret = _AtracSetData(atracID, buffer, bufferSize);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
int sceAtracSetMOutDataAndGetID(u32 buffer, u32 bufferSize)
|
||||
{
|
||||
{
|
||||
INFO_LOG(HLE, "sceAtracSetMOutDataAndGetID(%08x, %08x)", buffer, bufferSize);
|
||||
int codecType = getCodecType(buffer);
|
||||
|
||||
@ -1244,8 +1244,8 @@ bool initAT3Decoder(Atrac *atrac, u32 dataSize = 0xffb4a8)
|
||||
*(u32*)(at3Header + 0x04) = dataSize + sizeof(at3Header) - 8;
|
||||
*(u16*)(at3Header + 0x16) = atrac->atracChannels;
|
||||
*(u16*)(at3Header + 0x20) = atrac->atracBytesPerFrame;
|
||||
atrac->atracBitrate = ( atrac->atracBytesPerFrame * 352800 ) / 1000;
|
||||
atrac->atracBitrate = (atrac->atracBitrate + 511) >> 10;
|
||||
atrac->atracBitrate = ( atrac->atracBytesPerFrame * 352800 ) / 1000;
|
||||
atrac->atracBitrate = (atrac->atracBitrate + 511) >> 10;
|
||||
*(u32*)(at3Header + 0x1c) = atrac->atracBitrate * 1000 / 8;
|
||||
at3Header[0x29] = (u8)at3HeaderMap[i][2];
|
||||
at3Header[0x2c] = (u8)at3HeaderMap[i][3];
|
||||
@ -1285,7 +1285,7 @@ static const u16 at3plusHeaderMap[][3] = {
|
||||
{ 0x7428, 0x0, 0x0 },
|
||||
{ 0x0460, 0x2, 0x0 },
|
||||
{ 0x8B28, 0x0, 0x0 },
|
||||
|
||||
|
||||
{ 0x05D0, 0x2, 0x0 },
|
||||
{ 0xB928, 0x0, 0x0 },
|
||||
{ 0x0748, 0x2, 0x0 },
|
||||
@ -1304,8 +1304,8 @@ bool initAT3plusDecoder(Atrac *atrac, u32 dataSize = 0xffb4a8)
|
||||
*(u32*)(at3plusHeader + 0x04) = dataSize + sizeof(at3plusHeader) - 8;
|
||||
*(u16*)(at3plusHeader + 0x16) = atrac->atracChannels;
|
||||
*(u16*)(at3plusHeader + 0x20) = atrac->atracBytesPerFrame;
|
||||
atrac->atracBitrate = ( atrac->atracBytesPerFrame * 352800 ) / 1000;
|
||||
atrac->atracBitrate = ((atrac->atracBitrate >> 11) + 8) & 0xFFFFFFF0;
|
||||
atrac->atracBitrate = ( atrac->atracBytesPerFrame * 352800 ) / 1000;
|
||||
atrac->atracBitrate = ((atrac->atracBitrate >> 11) + 8) & 0xFFFFFFF0;
|
||||
*(u32*)(at3plusHeader + 0x1c) = atrac->atracBitrate * 1000 / 8;
|
||||
*(u16*)(at3plusHeader + 0x3e) = at3plusHeaderMap[i + 1][0];
|
||||
*(u32*)(at3plusHeader + sizeof(at3plusHeader) - 4) = dataSize;
|
||||
@ -1357,7 +1357,7 @@ int sceAtracLowLevelDecode(int atracID, u32 sourceAddr, u32 sourceBytesConsumedA
|
||||
Atrac *atrac = getAtrac(atracID);
|
||||
|
||||
#ifdef USE_FFMPEG
|
||||
if (Memory::IsValidAddress(sourceAddr) && Memory::IsValidAddress(sourceBytesConsumedAddr) &&
|
||||
if (Memory::IsValidAddress(sourceAddr) && Memory::IsValidAddress(sourceBytesConsumedAddr) &&
|
||||
Memory::IsValidAddress(samplesAddr) && Memory::IsValidAddress(sampleBytesAddr) && atrac && atrac->pCodecCtx) {
|
||||
u32 sourcebytes = atrac->first.writableBytes;
|
||||
if (sourcebytes > 0) {
|
||||
@ -1382,11 +1382,11 @@ int sceAtracLowLevelDecode(int atracID, u32 sourceAddr, u32 sourceBytesConsumedA
|
||||
|
||||
if (got_frame) {
|
||||
// got a frame
|
||||
int decoded = av_samples_get_buffer_size(NULL, atrac->pFrame->channels,
|
||||
int decoded = av_samples_get_buffer_size(NULL, atrac->pFrame->channels,
|
||||
atrac->pFrame->nb_samples, (AVSampleFormat)atrac->pFrame->format, 1);
|
||||
u8* out = Memory::GetPointer(samplesAddr);
|
||||
numSamples = atrac->pFrame->nb_samples;
|
||||
avret = swr_convert(atrac->pSwrCtx, &out, atrac->pFrame->nb_samples,
|
||||
avret = swr_convert(atrac->pSwrCtx, &out, atrac->pFrame->nb_samples,
|
||||
(const u8**)atrac->pFrame->extended_data, atrac->pFrame->nb_samples);
|
||||
if (avret < 0) {
|
||||
ERROR_LOG(HLE, "swr_convert: Error while converting %d", avret);
|
||||
@ -1413,7 +1413,7 @@ int sceAtracLowLevelDecode(int atracID, u32 sourceAddr, u32 sourceBytesConsumedA
|
||||
}
|
||||
#endif // USE_FFMPEG
|
||||
|
||||
if (Memory::IsValidAddress(sourceAddr) && Memory::IsValidAddress(sourceBytesConsumedAddr) &&
|
||||
if (Memory::IsValidAddress(sourceAddr) && Memory::IsValidAddress(sourceBytesConsumedAddr) &&
|
||||
Memory::IsValidAddress(samplesAddr) && Memory::IsValidAddress(sampleBytesAddr) && atrac && atrac->decoder_context) {
|
||||
u32 sourcebytes = atrac->first.writableBytes;
|
||||
static u8 buf[0x8000];
|
||||
@ -1456,7 +1456,7 @@ int sceAtracSetAA3HalfwayBufferAndGetID(u32 halfBuffer, u32 readSize, u32 halfBu
|
||||
if (readSize > halfBufferSize)
|
||||
return ATRAC_ERROR_INCORRECT_READ_SIZE;
|
||||
|
||||
if (readSize < 0 || halfBufferSize < 0)
|
||||
if (readSize < 0 || halfBufferSize < 0)
|
||||
return -1;
|
||||
|
||||
int codecType = getCodecType(halfBuffer);
|
||||
|
@ -309,7 +309,7 @@ void GenerateVertexShader(int prim, char *buffer) {
|
||||
"a_w1.x", "a_w1.y", "a_w1.z", "a_w1.w",
|
||||
"a_w2.x", "a_w2.y", "a_w2.z", "a_w2.w",
|
||||
};
|
||||
|
||||
|
||||
#if defined(USE_FOR_LOOP) && defined(USE_BONE_ARRAY)
|
||||
|
||||
// To loop through the weights, we unfortunately need to put them in a float array.
|
||||
@ -441,7 +441,7 @@ void GenerateVertexShader(int prim, char *buffer) {
|
||||
bool poweredDiffuse = comp == GE_LIGHTCOMP_BOTHWITHPOWDIFFUSE;
|
||||
|
||||
if (poweredDiffuse) {
|
||||
WRITE(p, " mediump float dot%i = pow(dot(toLight, worldnormal), u_matspecular.a);\n", i, i);
|
||||
WRITE(p, " mediump float dot%i = pow(dot(toLight, worldnormal), u_matspecular.a);\n", i);
|
||||
} else {
|
||||
WRITE(p, " mediump float dot%i = dot(toLight, worldnormal);\n", i);
|
||||
}
|
||||
@ -457,12 +457,12 @@ void GenerateVertexShader(int prim, char *buffer) {
|
||||
WRITE(p, " lightScale = clamp(1.0 / dot(u_lightatt%i, vec3(1.0, distance, distance*distance)), 0.0, 1.0);\n", i);
|
||||
break;
|
||||
case GE_LIGHTTYPE_SPOT:
|
||||
WRITE(p, " lowp float angle%i = dot(normalize(u_lightdir%i), toLight);\n", i, i, i);
|
||||
WRITE(p, " lowp float angle%i = dot(normalize(u_lightdir%i), toLight);\n", i, i);
|
||||
WRITE(p, " if (angle%i >= u_lightangle%i) {\n", i, i);
|
||||
WRITE(p, " lightScale = clamp(1.0 / dot(u_lightatt%i, vec3(1.0, distance, distance*distance)), 0.0, 1.0) * pow(angle%i, u_lightspotCoef%i);\n", i, i, i);
|
||||
WRITE(p, " } else {\n");
|
||||
WRITE(p, " lightScale = 0.0;\n");
|
||||
WRITE(p, " }\n");
|
||||
WRITE(p, " }\n");
|
||||
break;
|
||||
default:
|
||||
// ILLEGAL
|
||||
@ -471,8 +471,8 @@ void GenerateVertexShader(int prim, char *buffer) {
|
||||
|
||||
WRITE(p, " diffuse = (u_lightdiffuse%i * %s) * max(dot%i, 0.0);\n", i, diffuseStr, i);
|
||||
if (doSpecular) {
|
||||
WRITE(p, " halfVec = normalize(toLight + vec3(0.0, 0.0, 1.0));\n", i, i);
|
||||
WRITE(p, " dot%i = dot(halfVec, worldnormal);\n", i, i);
|
||||
WRITE(p, " halfVec = normalize(toLight + vec3(0.0, 0.0, 1.0));\n");
|
||||
WRITE(p, " dot%i = dot(halfVec, worldnormal);\n", i);
|
||||
WRITE(p, " if (dot%i > 0.0)\n", i);
|
||||
WRITE(p, " lightSum1 += u_lightspecular%i * %s * (pow(dot%i, u_matspecular.a) %s);\n", i, specularStr, i, timesLightScale);
|
||||
}
|
||||
|
@ -86,7 +86,7 @@ void GeDisassembleOp(u32 pc, u32 op, u32 prev, char *buffer) {
|
||||
if (data != 0)
|
||||
sprintf(buffer, "NOP: %06x", data);
|
||||
else
|
||||
sprintf(buffer, "NOP", data);
|
||||
sprintf(buffer, "NOP");
|
||||
break;
|
||||
|
||||
case GE_CMD_BASE:
|
||||
|
18
GPU/Math3D.h
18
GPU/Math3D.h
@ -71,15 +71,15 @@ public:
|
||||
{
|
||||
return Vec3(x*other.x, y*other.y, z*other.z);
|
||||
}
|
||||
Vec3 operator * (const float f) const
|
||||
Vec3 operator * (const float f) const
|
||||
{
|
||||
return Vec3(x*f,y*f,z*f);
|
||||
}
|
||||
void operator *= (const float f)
|
||||
void operator *= (const float f)
|
||||
{
|
||||
x*=f; y*=f; z*=f;
|
||||
}
|
||||
Vec3 operator / (const float f) const
|
||||
Vec3 operator / (const float f) const
|
||||
{
|
||||
float invf = (1.0f/f);
|
||||
return Vec3(x*invf,y*invf,z*invf);
|
||||
@ -88,16 +88,16 @@ public:
|
||||
{
|
||||
*this = *this / f;
|
||||
}
|
||||
Vec3 operator %(const Vec3 &v) const
|
||||
Vec3 operator %(const Vec3 &v) const
|
||||
{
|
||||
return Vec3(y*v.z-z*v.y, z*v.x-x*v.z, x*v.y-y*v.x);
|
||||
}
|
||||
|
||||
float Length2() const
|
||||
float Length2() const
|
||||
{
|
||||
return x*x + y*y + z*z;
|
||||
}
|
||||
float Length() const
|
||||
float Length() const
|
||||
{
|
||||
return sqrtf(Length2());
|
||||
}
|
||||
@ -105,7 +105,7 @@ public:
|
||||
{
|
||||
(*this) *= l / Length();
|
||||
}
|
||||
Vec3 WithLength(const float l) const
|
||||
Vec3 WithLength(const float l) const
|
||||
{
|
||||
return (*this) * l / Length();
|
||||
}
|
||||
@ -125,11 +125,11 @@ public:
|
||||
{
|
||||
return *((&x) + i);
|
||||
}
|
||||
const float operator [] (const int i) const
|
||||
float operator [] (const int i) const
|
||||
{
|
||||
return *((&x) + i);
|
||||
}
|
||||
Vec3 Lerp(const Vec3 &other, const float t) const
|
||||
Vec3 Lerp(const Vec3 &other, const float t) const
|
||||
{
|
||||
return (*this)*(1-t) + other*t;
|
||||
}
|
||||
|
2
native
2
native
@ -1 +1 @@
|
||||
Subproject commit dfe03d3d978063a6a56ce7a82e572b045fead14e
|
||||
Subproject commit ceefd214c4a7799b47fbd2c6ba322649d3462700
|
Loading…
Reference in New Issue
Block a user