Merge branch 'android' of https://github.com/highfidelity/hifi into android-fixes

This commit is contained in:
Sam Gateau 2018-01-11 19:12:06 -08:00
commit 8294322993
6 changed files with 31 additions and 5 deletions

View file

@ -60,6 +60,7 @@ android {
copy { copy {
from new File(projectDir, "../../interface/compiledResources") from new File(projectDir, "../../interface/compiledResources")
into outputDir into outputDir
duplicatesStrategy DuplicatesStrategy.INCLUDE
eachFile { details -> eachFile { details ->
youngestLastModified = Math.max(youngestLastModified, details.lastModified) youngestLastModified = Math.max(youngestLastModified, details.lastModified)
assetList.add(details.path) assetList.add(details.path)
@ -70,6 +71,7 @@ android {
copy { copy {
from new File(projectDir, "../../scripts") from new File(projectDir, "../../scripts")
into new File(outputDir, "scripts") into new File(outputDir, "scripts")
duplicatesStrategy DuplicatesStrategy.INCLUDE
eachFile { details-> eachFile { details->
youngestLastModified = Math.max(youngestLastModified, details.lastModified) youngestLastModified = Math.max(youngestLastModified, details.lastModified)
assetList.add("scripts/" + details.path) assetList.add("scripts/" + details.path)

View file

@ -109,7 +109,8 @@ static const GLenum ELEMENT_TYPE_TO_GL[gpu::NUM_TYPES] = {
GL_UNSIGNED_SHORT, GL_UNSIGNED_SHORT,
GL_BYTE, GL_BYTE,
GL_UNSIGNED_BYTE, GL_UNSIGNED_BYTE,
GL_UNSIGNED_BYTE GL_UNSIGNED_BYTE,
GL_INT_2_10_10_10_REV,
}; };
bool checkGLError(const char* name = nullptr); bool checkGLError(const char* name = nullptr);

View file

@ -498,14 +498,16 @@ TexturePointer Texture::build(const ktx::KTXDescriptor& descriptor) {
GPUKTXPayload gpuktxKeyValue; GPUKTXPayload gpuktxKeyValue;
if (!GPUKTXPayload::findInKeyValues(descriptor.keyValues, gpuktxKeyValue)) { if (!GPUKTXPayload::findInKeyValues(descriptor.keyValues, gpuktxKeyValue)) {
qCWarning(gpulogging) << "Could not find GPUKTX key values."; #if defined(Q_OS_ANDROID)
// FIXME use sensible defaults based on the texture type and format // FIXME use sensible defaults based on the texture type and format
gpuktxKeyValue._usageType = TextureUsageType::RESOURCE; gpuktxKeyValue._usageType = TextureUsageType::RESOURCE;
gpuktxKeyValue._usage = Texture::Usage::Builder().withColor().withAlpha().build(); gpuktxKeyValue._usage = Texture::Usage::Builder().withColor().withAlpha().build();
#else
qCWarning(gpulogging) << "Could not find GPUKTX key values.";
return TexturePointer();
#endif
} }
auto texture = create(gpuktxKeyValue._usageType, auto texture = create(gpuktxKeyValue._usageType,
type, type,
texelFormat, texelFormat,

View file

@ -55,7 +55,7 @@ StoragePointer FileStorage::create(const QString& filename, size_t size, const u
if (!file.resize(size)) { if (!file.resize(size)) {
throw std::runtime_error("Unable to resize file"); throw std::runtime_error("Unable to resize file");
} }
{ if (data) {
auto mapped = file.map(0, size); auto mapped = file.map(0, size);
if (!mapped) { if (!mapped) {
throw std::runtime_error("Unable to map file"); throw std::runtime_error("Unable to map file");

View file

@ -1097,6 +1097,27 @@ bool OffscreenQmlSurface::eventFilter(QObject* originalDestination, QEvent* even
} }
break; break;
} }
#if defined(Q_OS_ANDROID)
case QEvent::TouchBegin:
case QEvent::TouchUpdate:
case QEvent::TouchEnd: {
QTouchEvent *originalEvent = static_cast<QTouchEvent *>(event);
QTouchEvent *fakeEvent = new QTouchEvent(*originalEvent);
auto newTouchPoints = fakeEvent->touchPoints();
for (size_t i = 0; i < newTouchPoints.size(); ++i) {
const auto &originalPoint = originalEvent->touchPoints()[i];
auto &newPoint = newTouchPoints[i];
newPoint.setPos(originalPoint.pos());
}
fakeEvent->setTouchPoints(newTouchPoints);
if (QCoreApplication::sendEvent(_quickWindow, fakeEvent)) {
qInfo() << __FUNCTION__ << "sent fake touch event:" << fakeEvent->type()
<< "_quickWindow handled it... accepted:" << fakeEvent->isAccepted();
return false; //event->isAccepted();
}
break;
}
#endif
default: default:
break; break;
} }