mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 05:37:17 +02:00
Merge branch 'master' of https://github.com/highfidelity/hifi into punk
This commit is contained in:
commit
b4807becb6
14 changed files with 68 additions and 33 deletions
|
@ -22,6 +22,7 @@
|
||||||
#include <AddressManager.h>
|
#include <AddressManager.h>
|
||||||
#include "AndroidHelper.h"
|
#include "AndroidHelper.h"
|
||||||
#include <udt/PacketHeaders.h>
|
#include <udt/PacketHeaders.h>
|
||||||
|
#include <SettingHandle.h>
|
||||||
|
|
||||||
QAndroidJniObject __interfaceActivity;
|
QAndroidJniObject __interfaceActivity;
|
||||||
QAndroidJniObject __loginCompletedListener;
|
QAndroidJniObject __loginCompletedListener;
|
||||||
|
@ -172,7 +173,7 @@ JNIEXPORT void Java_io_highfidelity_hifiinterface_InterfaceActivity_nativeOnDest
|
||||||
|
|
||||||
JNIEXPORT void Java_io_highfidelity_hifiinterface_InterfaceActivity_nativeGotoUrl(JNIEnv* env, jobject obj, jstring url) {
|
JNIEXPORT void Java_io_highfidelity_hifiinterface_InterfaceActivity_nativeGotoUrl(JNIEnv* env, jobject obj, jstring url) {
|
||||||
QAndroidJniObject jniUrl("java/lang/String", "(Ljava/lang/String;)V", url);
|
QAndroidJniObject jniUrl("java/lang/String", "(Ljava/lang/String;)V", url);
|
||||||
DependencyManager::get<AddressManager>()->handleLookupString(jniUrl.toString());
|
DependencyManager::get<AddressManager>()->loadSettings(jniUrl.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT void Java_io_highfidelity_hifiinterface_InterfaceActivity_nativeOnPause(JNIEnv* env, jobject obj) {
|
JNIEXPORT void Java_io_highfidelity_hifiinterface_InterfaceActivity_nativeOnPause(JNIEnv* env, jobject obj) {
|
||||||
|
@ -210,6 +211,12 @@ JNIEXPORT jstring JNICALL Java_io_highfidelity_hifiinterface_HifiUtils_protocolV
|
||||||
return env->NewStringUTF(protocolVersionsSignatureBase64().toLatin1().data());
|
return env->NewStringUTF(protocolVersionsSignatureBase64().toLatin1().data());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
JNIEXPORT jstring JNICALL Java_io_highfidelity_hifiinterface_fragment_HomeFragment_nativeGetLastLocation(JNIEnv *env, jobject instance) {
|
||||||
|
Setting::Handle<QUrl> currentAddressHandle(QStringList() << "AddressManager" << "address", QString());
|
||||||
|
QUrl lastLocation = currentAddressHandle.get();
|
||||||
|
return env->NewStringUTF(lastLocation.toString().toLatin1().data());
|
||||||
|
}
|
||||||
|
|
||||||
JNIEXPORT void JNICALL
|
JNIEXPORT void JNICALL
|
||||||
Java_io_highfidelity_hifiinterface_fragment_LoginFragment_nativeLogin(JNIEnv *env, jobject instance,
|
Java_io_highfidelity_hifiinterface_fragment_LoginFragment_nativeLogin(JNIEnv *env, jobject instance,
|
||||||
jstring username_, jstring password_,
|
jstring username_, jstring password_,
|
||||||
|
|
|
@ -33,6 +33,8 @@ public class HomeFragment extends Fragment {
|
||||||
|
|
||||||
private OnHomeInteractionListener mListener;
|
private OnHomeInteractionListener mListener;
|
||||||
|
|
||||||
|
public native String nativeGetLastLocation();
|
||||||
|
|
||||||
public HomeFragment() {
|
public HomeFragment() {
|
||||||
// Required empty public constructor
|
// Required empty public constructor
|
||||||
}
|
}
|
||||||
|
@ -60,7 +62,7 @@ public class HomeFragment extends Fragment {
|
||||||
int numberOfColumns = 1;
|
int numberOfColumns = 1;
|
||||||
GridLayoutManager gridLayoutMgr = new GridLayoutManager(getContext(), numberOfColumns);
|
GridLayoutManager gridLayoutMgr = new GridLayoutManager(getContext(), numberOfColumns);
|
||||||
mDomainsView.setLayoutManager(gridLayoutMgr);
|
mDomainsView.setLayoutManager(gridLayoutMgr);
|
||||||
mDomainAdapter = new DomainAdapter(getContext(), HifiUtils.getInstance().protocolVersionSignature());
|
mDomainAdapter = new DomainAdapter(getContext(), HifiUtils.getInstance().protocolVersionSignature(), nativeGetLastLocation());
|
||||||
mDomainAdapter.setClickListener((view, position, domain) -> {
|
mDomainAdapter.setClickListener((view, position, domain) -> {
|
||||||
new Handler(getActivity().getMainLooper()).postDelayed(() -> mListener.onSelectedDomain(domain.url), 400); // a delay so the ripple effect can be seen
|
new Handler(getActivity().getMainLooper()).postDelayed(() -> mListener.onSelectedDomain(domain.url), 400); // a delay so the ripple effect can be seen
|
||||||
});
|
});
|
||||||
|
|
|
@ -12,13 +12,6 @@ import android.widget.TextView;
|
||||||
|
|
||||||
import com.squareup.picasso.Picasso;
|
import com.squareup.picasso.Picasso;
|
||||||
|
|
||||||
import org.json.JSONArray;
|
|
||||||
import org.json.JSONException;
|
|
||||||
import org.json.JSONObject;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import io.highfidelity.hifiinterface.R;
|
import io.highfidelity.hifiinterface.R;
|
||||||
|
@ -31,20 +24,23 @@ import io.highfidelity.hifiinterface.provider.UserStoryDomainProvider;
|
||||||
public class DomainAdapter extends RecyclerView.Adapter<DomainAdapter.ViewHolder> {
|
public class DomainAdapter extends RecyclerView.Adapter<DomainAdapter.ViewHolder> {
|
||||||
|
|
||||||
private static final String TAG = "HiFi Interface";
|
private static final String TAG = "HiFi Interface";
|
||||||
|
private static final String DEFAULT_THUMBNAIL_PLACE = "android.resource://io.highfidelity.hifiinterface/" + R.drawable.domain_placeholder;
|
||||||
private Context mContext;
|
private Context mContext;
|
||||||
private LayoutInflater mInflater;
|
private LayoutInflater mInflater;
|
||||||
private ItemClickListener mClickListener;
|
private ItemClickListener mClickListener;
|
||||||
private String mProtocol;
|
private String mProtocol;
|
||||||
|
private String mLastLocation;
|
||||||
private UserStoryDomainProvider domainProvider;
|
private UserStoryDomainProvider domainProvider;
|
||||||
private AdapterListener mAdapterListener;
|
private AdapterListener mAdapterListener;
|
||||||
|
|
||||||
// references to our domains
|
// references to our domains
|
||||||
private Domain[] mDomains = {};
|
private Domain[] mDomains = {};
|
||||||
|
|
||||||
public DomainAdapter(Context c, String protocol) {
|
public DomainAdapter(Context c, String protocol, String lastLocation) {
|
||||||
mContext = c;
|
mContext = c;
|
||||||
this.mInflater = LayoutInflater.from(mContext);
|
this.mInflater = LayoutInflater.from(mContext);
|
||||||
mProtocol = protocol;
|
mProtocol = protocol;
|
||||||
|
mLastLocation = lastLocation;
|
||||||
domainProvider = new UserStoryDomainProvider(mProtocol);
|
domainProvider = new UserStoryDomainProvider(mProtocol);
|
||||||
loadDomains("");
|
loadDomains("");
|
||||||
}
|
}
|
||||||
|
@ -57,6 +53,29 @@ public class DomainAdapter extends RecyclerView.Adapter<DomainAdapter.ViewHolder
|
||||||
domainProvider.retrieve(filterText, new DomainProvider.DomainCallback() {
|
domainProvider.retrieve(filterText, new DomainProvider.DomainCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void retrieveOk(List<Domain> domain) {
|
public void retrieveOk(List<Domain> domain) {
|
||||||
|
if (filterText.length() == 0) {
|
||||||
|
Domain lastVisitedDomain = new Domain(mContext.getString(R.string.your_last_location), mLastLocation, DEFAULT_THUMBNAIL_PLACE);
|
||||||
|
if (!mLastLocation.isEmpty() && mLastLocation.contains("://")) {
|
||||||
|
int startIndex = mLastLocation.indexOf("://");
|
||||||
|
int endIndex = mLastLocation.indexOf("/", startIndex + 3);
|
||||||
|
String toSearch = mLastLocation.substring(0, endIndex + 1).toLowerCase();
|
||||||
|
for (Domain d : domain) {
|
||||||
|
if (d.url.toLowerCase().startsWith(toSearch)) {
|
||||||
|
lastVisitedDomain.thumbnail = d.thumbnail;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
domain.add(0, lastVisitedDomain);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Domain d : domain) {
|
||||||
|
// we override the default picture added in the server by an android specific version
|
||||||
|
if (d.thumbnail != null &&
|
||||||
|
d.thumbnail.endsWith("assets/places/thumbnail-default-place-e5a3f33e773ab699495774990a562f9f7693dc48ef90d8be6985c645a0280f75.png")) {
|
||||||
|
d.thumbnail = DEFAULT_THUMBNAIL_PLACE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
mDomains = new Domain[domain.size()];
|
mDomains = new Domain[domain.size()];
|
||||||
mDomains = domain.toArray(mDomains);
|
mDomains = domain.toArray(mDomains);
|
||||||
notifyDataSetChanged();
|
notifyDataSetChanged();
|
||||||
|
|
BIN
android/app/src/main/res/drawable/domain_placeholder.png
Normal file
BIN
android/app/src/main/res/drawable/domain_placeholder.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.6 KiB |
|
@ -20,5 +20,6 @@
|
||||||
<string name="search_loading">Loading places…</string>
|
<string name="search_loading">Loading places…</string>
|
||||||
<string name="search_no_results">No places exist with that name</string>
|
<string name="search_no_results">No places exist with that name</string>
|
||||||
<string name="privacyPolicy">Privacy Policy</string>
|
<string name="privacyPolicy">Privacy Policy</string>
|
||||||
|
<string name="your_last_location">Your Last Location</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -3312,19 +3312,18 @@ void Application::handleSandboxStatus(QNetworkReply* reply) {
|
||||||
|
|
||||||
// If this is a first run we short-circuit the address passed in
|
// If this is a first run we short-circuit the address passed in
|
||||||
if (firstRun.get()) {
|
if (firstRun.get()) {
|
||||||
#if defined(Q_OS_ANDROID)
|
#if !defined(Q_OS_ANDROID)
|
||||||
qCDebug(interfaceapp) << "First run... going to" << qPrintable(addressLookupString.isEmpty() ? QString("default location") : addressLookupString);
|
|
||||||
DependencyManager::get<AddressManager>()->loadSettings(addressLookupString);
|
|
||||||
#else
|
|
||||||
DependencyManager::get<AddressManager>()->goToEntry();
|
DependencyManager::get<AddressManager>()->goToEntry();
|
||||||
sentTo = SENT_TO_ENTRY;
|
sentTo = SENT_TO_ENTRY;
|
||||||
#endif
|
#endif
|
||||||
firstRun.set(false);
|
firstRun.set(false);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
#if !defined(Q_OS_ANDROID)
|
||||||
qCDebug(interfaceapp) << "Not first run... going to" << qPrintable(addressLookupString.isEmpty() ? QString("previous location") : addressLookupString);
|
qCDebug(interfaceapp) << "Not first run... going to" << qPrintable(addressLookupString.isEmpty() ? QString("previous location") : addressLookupString);
|
||||||
DependencyManager::get<AddressManager>()->loadSettings(addressLookupString);
|
DependencyManager::get<AddressManager>()->loadSettings(addressLookupString);
|
||||||
sentTo = SENT_TO_PREVIOUS_LOCATION;
|
sentTo = SENT_TO_PREVIOUS_LOCATION;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
UserActivityLogger::getInstance().logAction("startup_sent_to", {
|
UserActivityLogger::getInstance().logAction("startup_sent_to", {
|
||||||
|
|
|
@ -586,7 +586,7 @@ void OpenGLDisplayPlugin::updateFrameData() {
|
||||||
|
|
||||||
std::function<void(gpu::Batch&, const gpu::TexturePointer&, bool mirror)> OpenGLDisplayPlugin::getHUDOperator() {
|
std::function<void(gpu::Batch&, const gpu::TexturePointer&, bool mirror)> OpenGLDisplayPlugin::getHUDOperator() {
|
||||||
return [this](gpu::Batch& batch, const gpu::TexturePointer& hudTexture, bool mirror) {
|
return [this](gpu::Batch& batch, const gpu::TexturePointer& hudTexture, bool mirror) {
|
||||||
if (_hudPipeline) {
|
if (_hudPipeline && hudTexture) {
|
||||||
batch.enableStereo(false);
|
batch.enableStereo(false);
|
||||||
batch.setPipeline(mirror ? _mirrorHUDPipeline : _hudPipeline);
|
batch.setPipeline(mirror ? _mirrorHUDPipeline : _hudPipeline);
|
||||||
batch.setResourceTexture(0, hudTexture);
|
batch.setResourceTexture(0, hudTexture);
|
||||||
|
|
|
@ -428,7 +428,7 @@ void HmdDisplayPlugin::HUDRenderer::updatePipeline() {
|
||||||
std::function<void(gpu::Batch&, const gpu::TexturePointer&, bool mirror)> HmdDisplayPlugin::HUDRenderer::render(HmdDisplayPlugin& plugin) {
|
std::function<void(gpu::Batch&, const gpu::TexturePointer&, bool mirror)> HmdDisplayPlugin::HUDRenderer::render(HmdDisplayPlugin& plugin) {
|
||||||
updatePipeline();
|
updatePipeline();
|
||||||
return [this](gpu::Batch& batch, const gpu::TexturePointer& hudTexture, bool mirror) {
|
return [this](gpu::Batch& batch, const gpu::TexturePointer& hudTexture, bool mirror) {
|
||||||
if (pipeline) {
|
if (pipeline && hudTexture) {
|
||||||
batch.setPipeline(pipeline);
|
batch.setPipeline(pipeline);
|
||||||
|
|
||||||
batch.setInputFormat(format);
|
batch.setInputFormat(format);
|
||||||
|
|
|
@ -339,7 +339,7 @@ void GLTextureTransferEngineDefault::populateActiveBufferQueue() {
|
||||||
// Can't find any pending transfers, so move on
|
// Can't find any pending transfers, so move on
|
||||||
if (textureTransferQueue.empty()) {
|
if (textureTransferQueue.empty()) {
|
||||||
if (vargltexture->hasPendingTransfers()) {
|
if (vargltexture->hasPendingTransfers()) {
|
||||||
qWarning(gpugllogging) << "Texture has no transfer jobs, but has pending transfers";
|
// qWarning(gpugllogging) << "Texture " << gltexture->_id << "(" << texture->source().c_str() << ") has no transfer jobs, but has pending transfers" ;
|
||||||
}
|
}
|
||||||
itr = _pendingTransfersMap.erase(itr);
|
itr = _pendingTransfersMap.erase(itr);
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -34,13 +34,16 @@ int OctreeQuery::getBroadcastData(unsigned char* destinationBuffer) {
|
||||||
memcpy(destinationBuffer, &_connectionID, sizeof(_connectionID));
|
memcpy(destinationBuffer, &_connectionID, sizeof(_connectionID));
|
||||||
destinationBuffer += sizeof(_connectionID);
|
destinationBuffer += sizeof(_connectionID);
|
||||||
|
|
||||||
// Number of frustums
|
{
|
||||||
uint8_t numFrustums = (uint8_t)_conicalViews.size();
|
QMutexLocker lock(&_conicalViewsLock);
|
||||||
memcpy(destinationBuffer, &numFrustums, sizeof(numFrustums));
|
// Number of frustums
|
||||||
destinationBuffer += sizeof(numFrustums);
|
uint8_t numFrustums = (uint8_t)_conicalViews.size();
|
||||||
|
memcpy(destinationBuffer, &numFrustums, sizeof(numFrustums));
|
||||||
|
destinationBuffer += sizeof(numFrustums);
|
||||||
|
|
||||||
for (const auto& view : _conicalViews) {
|
for (const auto& view : _conicalViews) {
|
||||||
destinationBuffer += view.serialize(destinationBuffer);
|
destinationBuffer += view.serialize(destinationBuffer);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// desired Max Octree PPS
|
// desired Max Octree PPS
|
||||||
|
@ -108,11 +111,14 @@ int OctreeQuery::parseData(ReceivedMessage& message) {
|
||||||
memcpy(&numFrustums, sourceBuffer, sizeof(numFrustums));
|
memcpy(&numFrustums, sourceBuffer, sizeof(numFrustums));
|
||||||
sourceBuffer += sizeof(numFrustums);
|
sourceBuffer += sizeof(numFrustums);
|
||||||
|
|
||||||
_conicalViews.clear();
|
{
|
||||||
for (int i = 0; i < numFrustums; ++i) {
|
QMutexLocker lock(&_conicalViewsLock);
|
||||||
ConicalViewFrustum view;
|
_conicalViews.clear();
|
||||||
sourceBuffer += view.deserialize(sourceBuffer);
|
for (int i = 0; i < numFrustums; ++i) {
|
||||||
_conicalViews.push_back(view);
|
ConicalViewFrustum view;
|
||||||
|
sourceBuffer += view.deserialize(sourceBuffer);
|
||||||
|
_conicalViews.push_back(view);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// desired Max Octree PPS
|
// desired Max Octree PPS
|
||||||
|
|
|
@ -33,9 +33,10 @@ public:
|
||||||
int getBroadcastData(unsigned char* destinationBuffer);
|
int getBroadcastData(unsigned char* destinationBuffer);
|
||||||
int parseData(ReceivedMessage& message) override;
|
int parseData(ReceivedMessage& message) override;
|
||||||
|
|
||||||
bool hasConicalViews() const { return !_conicalViews.empty(); }
|
bool hasConicalViews() const { QMutexLocker lock(&_conicalViewsLock); return !_conicalViews.empty(); }
|
||||||
void setConicalViews(ConicalViewFrustums views) { _conicalViews = views; }
|
void setConicalViews(ConicalViewFrustums views)
|
||||||
void clearConicalViews() { _conicalViews.clear(); }
|
{ QMutexLocker lock(&_conicalViewsLock); _conicalViews = views; }
|
||||||
|
void clearConicalViews() { QMutexLocker lock(&_conicalViewsLock); _conicalViews.clear(); }
|
||||||
|
|
||||||
// getters/setters for JSON filter
|
// getters/setters for JSON filter
|
||||||
QJsonObject getJSONParameters() { QReadLocker locker { &_jsonParametersLock }; return _jsonParameters; }
|
QJsonObject getJSONParameters() { QReadLocker locker { &_jsonParametersLock }; return _jsonParameters; }
|
||||||
|
@ -60,6 +61,7 @@ public slots:
|
||||||
void setBoundaryLevelAdjust(int boundaryLevelAdjust) { _boundaryLevelAdjust = boundaryLevelAdjust; }
|
void setBoundaryLevelAdjust(int boundaryLevelAdjust) { _boundaryLevelAdjust = boundaryLevelAdjust; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
mutable QMutex _conicalViewsLock;
|
||||||
ConicalViewFrustums _conicalViews;
|
ConicalViewFrustums _conicalViews;
|
||||||
|
|
||||||
// octree server sending items
|
// octree server sending items
|
||||||
|
|
|
@ -153,7 +153,7 @@ bool OctreeQueryNode::updateCurrentViewFrustum() {
|
||||||
bool currentViewFrustumChanged = false;
|
bool currentViewFrustumChanged = false;
|
||||||
|
|
||||||
{ // if there has been a change, then recalculate
|
{ // if there has been a change, then recalculate
|
||||||
QMutexLocker viewLocker(&_viewMutex);
|
QMutexLocker lock(&_conicalViewsLock);
|
||||||
|
|
||||||
if (_conicalViews.size() == _currentConicalViews.size()) {
|
if (_conicalViews.size() == _currentConicalViews.size()) {
|
||||||
for (size_t i = 0; i < _conicalViews.size(); ++i) {
|
for (size_t i = 0; i < _conicalViews.size(); ++i) {
|
||||||
|
|
|
@ -95,7 +95,6 @@ private:
|
||||||
int _duplicatePacketCount { 0 };
|
int _duplicatePacketCount { 0 };
|
||||||
quint64 _firstSuppressedPacket { usecTimestampNow() };
|
quint64 _firstSuppressedPacket { usecTimestampNow() };
|
||||||
|
|
||||||
mutable QMutex _viewMutex { QMutex::Recursive };
|
|
||||||
ConicalViewFrustums _currentConicalViews;
|
ConicalViewFrustums _currentConicalViews;
|
||||||
bool _viewFrustumChanging { false };
|
bool _viewFrustumChanging { false };
|
||||||
bool _viewFrustumJustStoppedChanging { true };
|
bool _viewFrustumJustStoppedChanging { true };
|
||||||
|
|
Loading…
Reference in a new issue