I have tried all the method,even seen the filament code,but I don't know why the emissive property can't not work in Sceneform.
the document said
"The main use of emissive is to force an unlit surface to bloom if the HDR pipeline is configured with a bloom pass."
As far as I understand this sentence, Google already knew that Sceneform could not have emissive light
I try to use Filament matc.exe to build a matc file load on Sceneform modified by Thomass,the original mat file like this:
material {
name : "Emissive Material",
parameters : [
{
type : float4,
name : emissive
}
],
shadingModel : lit,
}
fragment {
void material(inout MaterialInputs material) {
prepareMaterial(material);
material.baseColor = materialParams.emissive; // work,but no bloom light around.
material.emissive = materialParams.emissive; // not work when only set it
material.emissive = vec4(0,1,0,1000000); // not work when only set it
}
}
and use Filament matc.exe to build that:
//cd to my filament /bin
matc -p all -o ../bloomMat/sceneform_bloom_t23.matc ../bloomMat/sceneform_bloom.mat
to build a sceneform_bloom_t23.matc file,then paste it to raw directory.
and use that like this:
ModelRenderable.builder()
.setSource(this,Uri.parse("https://.../my_glb_path.glb"))
.setIsFilamentGltf(true)
.build()
.thenAccept(
modelRenderable -> {
renderable = modelRenderable;
com.google.ar.sceneform.rendering.Material.builder()
.setSource(getApplicationContext(),R.raw.sceneform_bloom_t23)
.build()
.thenAccept(new Consumer() {
#OverRide
public void accept(Material material) {
material.setFloat4("emissive",1,0,0,1000000); // not work
renderable.setMaterial(material);
}
});
});
the modle have no bloom light.
I also try to use the sfa doucumentsaid ,use gltf_material.sfm and write sfa file like this:
{
materials: [
{
name: 'unlit_material',
parameters: [
{ baseColorFactor: [10,10,10,10], }, // work
{ emissiveFactor: 2147483647, }, // not work
{ emissive: 'andy', }, // work ,but not have emissive Light.
{ opacity: null, },
//{ reflectance: 0, },
],
source: 'build/sceneform_sdk/default_materials/gltf_material.sfm',
}
],
model: {
attributes: [ 'Position', 'TexCoord', 'Orientation', ],
collision: {},
file: 'sampledata/andy02/andy.obj',
name: 'andy',
recenter: 'root',
},
samplers: [
{
file: 'sampledata/andy02/andy.png',
name: 'andy',
pipeline_name: 'andy.png'
}
],
version: '0.54:2'
}
still not work.
I know the SceneView can have the emissive light,but the question is my company is still use Sceneform.
My expect effect:
image(the glowing green arrow, in picture center)
Finally ,my question is, how let the emissive property work on Sceneform?
This is the second time I post this question. In the previous version, I said something that was forbidden.
I hope this question can be answered,thanks a lot.
Related
I am working on an AR application using ARCore Sceneform. I was trying to add normal map to a face mesh texture. But there is no documentation or demo available on that.
Texture.builder()
.setSource(this, R.drawable.cartoon)
.setUsage(Texture.Usage.COLOR)
.build()
.thenAccept(texture -> faceMeshTexture = texture);
addOnUpdateListener:
for (AugmentedFace face: faceList) {
if (!faceNodeMap.containsKey(face)) {
AugmentedFaceNode faceNode = new AugmentedFaceNode(face);
faceNode.setParent(scene);
// faceNode.setFaceRegionsRenderable(faceRegionsRenderable);
faceNode.setFaceMeshTexture(faceMeshTexture);
faceNodeMap.put(face, faceNode);
}
}
Check out this article about using custom materials in ARCore.
I do not know your case, but you might need to create a custom material as described in the article and for that you need a dummy object.
Sceneform framework provides you with a default material definitions that allow developers to get plausibly looking materials. So, you can add a normal map for your canonical face mesh using JSONish code in .sfa or .mat file.
Look at this example at GitHub.
Here's code snippet:
{
materials: [
{
name: 'Planet_Mat',
parameters: [
{ baseColorFactor: [ 1, 1, 1, 1, ], },
{ baseColor: 'Planet_Mat_baseColor', },
{ normal: 'Planet_Mat_normal', },
{ metallicFactor: 1, },
{ metallicRoughness: 'Planet_Mat_occlusionRoughnessMetallic', },
{ emissiveFactor: [ 0, 0, 0, 1, ], },
],
source: 'build/sceneform_sdk/default_materials/gltf_material.sfm',
},
],
model: {
attributes: [
'Position',
'TexCoord',
'Orientation',
],
collision: {},
file: 'sampledata/models/Planet/Planet.gltf',
name: 'Planet',
recenter: true,
scale: 0.5,
},
samplers: [
{
file: 'sampledata/models/Planet/Planet_Mat_baseColor.png',
name: 'Planet_Mat_baseColor',
pipeline_name: 'Planet_Mat_baseColor.png',
},
{
file: 'sampledata/models/Planet/Planet_Mat_normal.png',
name: 'Planet_Mat_normal',
params: {
usage_type: 'Normal',
},
pipeline_name: 'Planet_Mat_normal.png',
},
],
}
Using the Sheets API in Android, how would I be able to find all the sheets I have in a spreadsheet ? Don't see anything straightforward in the API docs, but maybe there is a clever WA to get those.
to illustrate, in the below example, I would like to get the 5 labels of the 5 worksheets:
[EDIT] Follow-up question (thanks Trevor), showing my (lack of) Java skills:
So this way I can get the title of the first Worksheet:
Spreadsheet responseSpreadSheet = this.mService.spreadsheets().get(sheetsID).execute();
String First_Sheet_Title = responseSpreadSheet.getSheets().get(0).getProperties().getTitle();
Out of curiosity, why doesn't this approach work ? It doesn't let me apply the 'getProperties' method on the single sheet I assume to get back from 'get(0). I'm sure it's some basic Java thing I'm missing:
List responseSheets = responseSpreadSheet.getSheets();
String First_Sheet_Title = responseSheets.get(0).getProperties().getTitle();
Also, is there an easy way to get all worksheet names in a single line ? Right now I plan to iterate over the list/array I get back from getSheets, is there a way to apply the 'getTitle' directly on it to get back the list of worksheet names ? (Hope that question is somewhat meaningful)
In the API docs it shows that when you GET a Spreadsheet the response body will contain an instance of a Spreadsheet.
The Spreadsheet contains an array sheets which are all of the Sheets in the Spreadsheet
{
"spreadsheetId": string,
"properties": {
object(SpreadsheetProperties)
},
"sheets": [
{
object(Sheet)
}
],
"namedRanges": [
{
object(NamedRange)
}
],
"spreadsheetUrl": string,
}
Each Sheet has a SheetProperties object:
{
"properties": {
object(SheetProperties)
},
"data": [
{
object(GridData)
}
],
"merges": [
{
object(GridRange)
}
],
"conditionalFormats": [
{
object(ConditionalFormatRule)
}
],
"filterViews": [
{
object(FilterView)
}
],
"protectedRanges": [
{
object(ProtectedRange)
}
],
"basicFilter": {
object(BasicFilter)
},
"charts": [
{
object(EmbeddedChart)
}
],
"bandedRanges": [
{
object(BandedRange)
}
],
}
The SheetProperties object contains a title field which is the label you're looking for:
{
"sheetId": number,
"title": string,
"index": number,
"sheetType": enum(SheetType),
"gridProperties": {
object(GridProperties)
},
"hidden": boolean,
"tabColor": {
object(Color)
},
"rightToLeft": boolean,
}
I have a Sencha Touch 2 project and everything works great in the web browser. No errors in the console, and everything looks good. Once I package it with Phonegap and run it on a mobile device, however, things don't work as well.
I am using ext.device.notification.show in two places in my application. At first, I was doing requires: 'Ext.device.*' and while it worked in web, the app wouldn't run on mobile and eclipse would give me the error message Uncaught TypeError: Cannot read property 'name' of undefined. I switched over to requires: Ext.device.Notification (exact spelling and capitalization) and now the app runs but when I click a button that should create a message box, I get the error Uncaught TypeError: Cannot call method 'confirm' of undefined. The problem is I have no method called confirm. In one case I have a method called confirmItem, but for the second button that should be invoking a message box I have no method remotely close to "confirm."
I'll post one of the controllers below (this one has the confirmItem method):
Ext.define('MyApp.controller.MainController',
{
extend: 'Ext.app.Controller',
requires: ['Ext.device.Notification'],
config:
{
refs:
{
mainView: 'mainview',
btnConfirm: 'mainview button[action=confirmItem]',
},
control:
{
'btnConfirm':
{
tap: 'confirmItem'
},
mainView:
{
onSignOffCommand: 'onSignOffCommand'
}
}
},
// Transitions
getSlideLeftTransition: function ()
{
return {
type: 'slide',
direction: 'left'
};
},
getSlideRightTransition: function ()
{
return {
type: 'slide',
direction: 'right'
};
},
onSignOffCommand: function ()
{
var me = this;
console.log('Signed out.');
loginView = this.getLoginView();
//MainView.setMasked(false);
Ext.Viewport.animateActiveItem(loginView, this.getSlideRightTransition());
},
confirmItem: function ()
{
Ext.device.Notification.show(
{
title: 'Confirm',
message: 'Would you like to Confirm?',
buttons: ['No', 'Yes'],
callback: function (button)
{
if (button == "Yes")
{
MyApp.app.getController('MainController')
.confirmPickup();
}
else
{
console.log('Nope.');
}
}
});
},
confirmPickup: function ()
{
var me = this;
var loginStore = Ext.getStore('LoginStore');
mainView = this.getMainView();
mainView.setMasked(
{
xtype: 'loadmask',
message: ' '
});
if (null != loginStore.getAt(0))
{
var user_id = loginStore.getAt(0).get('id');
var name = loginStore.getAt(0).get('name');
var winner = loginStore.getAt(0).get('winner');
}
if (winner === 1)
{
console.log('success');
}
else
{
console.log('fail');
}
}
});
I only assume this is a problem because whenever I push the button that should be calling confirmItem I get the error. Am I using Ext.device.Notification correctly, or Have I missed something needed to make it work in Phonegap?
I found the solution! Everything was fine from a Sencha Touch point of view in terms of using requires: Ext.device.Notification but some things were missing on the Phonegap side. Specifically, I needed to install the appropriate plugins.
Open a terminal and type: Phonegap local plugin list to see your currently installed plugins. I had none. I went ahead and installed:
org.apache.cordova.device
org.apache.cordova.dialogs
org.apache.cordova.vibration
by using the following reference: http://docs.phonegap.com/en/3.0.0/cordova_device_device.md.html and selecting options from the menu on the left.
Hello friends I am stuck at a point in sencha touch 2.0.I am creating a screen in my app in which i need to get the checkbox values(checked or unchecked). i am referring this example from sencha documentation,but i am unable to understand how to use Ext.ComponentQuery.query('what here comes?')[0].
EDIT
here's my code:-
Ext.define('MyApp.view.groupList',{
extend : 'Ext.navigation.View',
requires: ['Ext.field.Search', 'Ext.TitleBar'],
alias: "widget.groupList",
itemId: "gList",
initialize: function(){
this.callParent(arguments),
var checkBox = {
xtype: 'checkboxfield',
name : 'all',
// label: 'All',
value: 'all',
lableWidth: "0",
width: 1,
padding: '0 0 15 30',
checked: false
};
var sendBtn = {
itemId: 'sendBtn',
xtype: 'button',
text: 'Send',
ui: 'action',
handler: function() {
var check = Ext.ComponentQuery.query('navigationview')[0],
values = check.getValues();
Ext.Msg.alert(null,
"Selected All: " + ((values.all) ? "yes" : "no")
);
}
};
var topToolbar = {
xtype : "toolbar",
title : "Groups",
docked : "top",
items: [
checkBox,
{xtype: 'spacer'},
// searchBtn,
sendBtn
],
};
var list = {
xtype: "grlist",
store: Ext.getStore("grStore")
};
this.add([list,topToolbar]);
},
config: {
navigationBar: {
hidden: true,
},
}
});
I am getting the following error:-
TypeError: Result of expression 'check.getValues' [undefined] is not a function. at
file:///android_asset/www/app/view/group_list.js
So please make me understand how Ext.ComponentQuery works with some sample code or tutorial.
Thanx in advance.
Ext.ComponentQuery accepts 3 types of parameters:
xtype, eg: Ext.ComponentQuery.query('navigationview')
id, eg: Ext.ComponentQuery.query('my-nav-view-id')
attributes, eg: Ext.ComponentQuery.query('navigationview[name="my nav view"]')
No matter which type the param is of, Ext.ComponentQuery.query() always returns an array of matched components. In the example, they add [0] because it's assured that the result array contains only 1 item.
In your code, it seems that you tried to query a component of xtype navigationview, this kind of component does NOT have getValues methods (which is only available to Ext.form.Panel and derived classes). So if you want to retrieve the values, you have to use queries like this:
Ext.ComponentQuery.query('checkboxfield')[0]
Hope it helps.
Ext.ComponentQuery documentation is here...
It should not be used in this example.
This code would be more resilent and ridiculously faster as wouldn't use a global search method.
var sendBtn = {
itemId: 'sendBtn',
xtype: 'button',
text: 'Send',
ui: 'action',
scope: this,
handler: function() {
var check = this.down('#checkboxfield'),
values = check.getValue();
Ext.Msg.alert(null,
"Selected All: " + ((values.all) ? "yes" : "no")
);
}
};
Also I've corrected the code example, the method is getValue()
Note:
I know that this answer is so out of date it's not relevent, however the accepted method is encouraging the use of Ext.ComponentQuery where it's not needed which is simply awful code and has logical code presuming that ui will remain in the same set format.
Hello friends I am creating an app in sencha touch 2.0 in which i have added a search button to the toolbar.Now i want open a search field with transparent background like the below image.
While i run my project the logcat indicates me that error is in controller file.Below i am adding my controller class.
Ext.define('MyApp.controller.search',{
extend: 'Ext.app.Controller',
config: {
refs: {
groupList: "groupList"
},
control: {
groupList: {
searchField: "searchField"
}
}
},
searchField: function(){
// console.log("SearchField Tapped");
if ( ! this.searchView)
{
this.searchView = this.render({
xtype: 'searchView',
});
var cancelSearchBtn = this.searchView.query('#'+cancelSearchBtn)[0];
cancelSearchBtn.setHandler(function(){
this.searchView.hide();
}, this);
}
this.searchView.show({
type: 'slide',
direction: 'up',
duration: 500,
});
},
launch: function(){
alert('Hello search');
},
});
I am getting the following error in logcat:-
TypeError: Result of expression 'this.render' [undefined] is not a function. at
file:///android_asset/www/app/controller/SearchController.js:18
Help me to get rid of the problem.
Thanx in advance.
There is no render method inside the controller. You need to create an instance of that component and then add it to the container you want it visible in (normally called Main).