因为数据表不是通过Laravel的migration建的,所以没有updated_at字段
使用Model对象save的时候就会报上面的错误,解决方法就是在Model里增加const UPDATED_AT = null;,如下代码所示:
因为数据表不是通过Laravel的migration建的,所以没有updated_at字段
使用Model对象save的时候就会报上面的错误,解决方法就是在Model里增加const UPDATED_AT = null;,如下代码所示:
基本Android sdk28版本编写
设置最大录像时长(单位:毫秒),需要在setOutFormat()之后prepare()之前调用。当录像时长达到这个时长,将触发MediaRecorder.OnInfoListener事件,事件的what参数为MEDIA_RECORDER_INFO_MAX_DURATION_REACHED,并且录像停止。停止动作是异步执行的,不能保证收到OnInfoListener时停止操作已完成。
设置最大录像文件大小(单位:字节),需要在setOutFormat()之后prepare()之前调用。当录像时长达到这个时长,将触发MediaRecorder.OnInfoListener事件,事件的what参数为MEDIA_RECORDER_INFO_MAX_FILESIZE_REACHED,并且录像停止。停止动作是异步执行的,不能保证收到OnInfoListener时停止操作已完成。
当setOutputFile或者setNextOutputFile所设置的输出文件达到最大文件尺寸时,使用此函数设置下一个输出文件。文件应该是可查找的(seekable)?当设置了next output file后,程序在调用mediarecorder.stop之前不要使用这个文件。程序应该在收到what参数为MEDIA_RECORDER_INFO_MAX_FILESIZE_APPROACHING的OnInfoListener事件之后,what参数为MEDIA_RECORDER_INFO_MAX_FILESIZE_REACHED的OnInfoListener之前调用setNextOutputFile函数。当收到what参数为MEDIA_RECORDER_INFO_NEXT_OUTPUT_FILE_STARTED的OnInfoListener事件后,此函数设置的文件才开始被录制。当之前设置的文件未被使用时,是不能设置新的输出文件的。当调用stop停止录像时,程序负责清理未使用的文件。
设置一个Surface用于预览正在录制的视频。需要在prepare函数前调用此函数。
如果使用了setCamera(camera),并且camera对象已经设置了surface,程序就不用再调用此函数设置surface了,如果使用了一个非null值的surface作为参数调用了此函数,camera的预览surface将被新设置的surface代替;如果根本没有调用此函数或者传入了一个为null的surface,media recorder不会改变camera的surface。
1.首先要设置setJavaScriptEnabled为true,使用webview支持js
2.使用js脚本的document.getElementById找到用户名和密码输入框,并模拟输入用户名和密码的内容,然后找到提交按钮并模拟click点击。注意:js必须写成一个函数(示例代码中的jsLogin函数)运行。
SensorEvent使用的系统坐标系
加速度计。
无标定加速度计。
环境温度。values[0]代表环境的摄氏温度。
设备私有传感器定义范围基础值。
游戏旋转向量
TYPE_GEOMAGNETIC_ROTATION_VECTOR = 20;
重力。
陀螺仪。对应值表示设备沿x, y, z三轴旋转的速度(弧度/秒),逆时针旋转时值为正
values[0]: Angular speed around the x-axis
values[1]: Angular speed around the y-axis
values[2]: Angular speed around the z-axis
TYPE_GYROSCOPE_UNCALIBRATED = 16;
TYPE_HEART_BEAT = 31;
TYPE_HEART_RATE = 21;
环境亮度。
线性加速度。表示沿设备各个轴的线性加速度值,已去除重力的影响。单位m/s^2,坐标系和加速度计的相同。
加速度计、重力和线性加速度计需要满足下面的公式
加速度=重力+线性加速度
TYPE_LOW_LATENCY_OFFBODY_DETECT = 34;
TYPE_MAGNETIC_FIELD = 2;
TYPE_MAGNETIC_FIELD_UNCALIBRATED = 14;
TYPE_MOTION_DETECT = 30;
横滚角-roll、俯仰角-pitch、偏航角-yaw
返回值的单位为度
TYPE_POSE_6DOF = 28;
TYPE_PRESSURE = 6;
values[0]表示大气压,单位hPa(百帕)
TYPE_PROXIMITY = 8;
TYPE_RELATIVE_HUMIDITY = 12;
TYPE_ROTATION_VECTOR = 11;
TYPE_SIGNIFICANT_MOTION = 17;
TYPE_STATIONARY_DETECT = 29;
TYPE_STEP_COUNTER = 19;
TYPE_STEP_DETECTOR = 18;
https://developer.android.google.cn/reference/android/hardware/SensorEvent
使用Android Studio在三星Galaxy Tab S7(Android 11)上调试应用时出现如下错误
Installation failed with messag failed to commit install session 1992275399 with command cmd package install-commit 1992275399. Error: INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION: Failed parse during installPackageLI: Failed to read manifest from /data/app/vmdl1992275399.tmp/split_lib_slice_9_apk.apk: null.
It is possible that this issue is resolved by uninstalling an existing version of the apk if it is present, and then re-installing.
点击ok后,提示DELETE_FAILED_INTERNAL_ERROR.
解决办法:后来把应用的targetSdkVersion由32改为28就可以安装了。
Renderer – 渲染器
Triangle – 三角形(需要度娘了解一下为什么3D模型是用很多三角形拼接成的)
Shader – 着色器
mesh – 网格?
Matrix – 矩阵
vertex – (三角形或锥形的)角顶
Texture – 纹理
OCTREE – 八叉树,用于3D空间分割,3D空间冲突检测
cube – 立方体
Virtualizer可以协助将对象存储到磁盘中,以节省内存使用。要使用此对象应确保app可以访问存储系统,并且有足够的空间。
coordinates
– the coordinates [x1,y1,z1,x2,y2,z2,…]uvs
– the texture coordinates [u1,v1,u2,v2,…]indices
– the indices indexing the tuples/triples in the coordinate arraystextureId
– the texture id. If not known, just use TextureManager.TEXTURE_NOTFOUNDcoordinates
– the coordinates [x1,y1,z1,x2,y2,z2,…]normals
– the vertex normals [nx1,ny1,nz1,nx2,ny2,nz2,…]uvs
– the texture coordinates [u1,v1,u2,v2,…]indices
– the indices indexing the tuples/triples in the coordinate arraystextureId
– the texture id. If not known, just use TextureManager.TEXTURE_NOTFOUNDobj
– the Object3D to construct this Object3D fromobj
– the Object3D to construct this Object3D fromreuseMesh
– if true, the new object will use the same meshvirtualizer
– the virtualizerobj
– Object whatever you like…offset
– the offsetfirst
– the first object to mergesecond
– the second object to mergeobjs
– the objectsnext
– the next IDdynamic
– if the mesh dynamic?dynamic
– if the mesh dynamic?staticUV
– does it use static uv-coordinateswithObj
– the object to share data withforce
– should we?anim
– the animation sequenceAnimation
, getMesh()
index
– the “time-index” into the sub-sequence of the animationseq
– the number of the sub.sequence (sub-sequence start at 1, 0 stands for the animation as a whole)index
– the “time-index” into the animationmode
– The desired mode (COLLISION_CHECK_NONE, COLLISION_CHECK_OTHERS, COLLISION_CHECK_SELF or combinations)COLLISION_CHECK_NONE
, COLLISION_CHECK_OTHERS
, COLLISION_CHECK_SELF
optimized
– should the collision detection be optimized or notCOLLISION_DETECTION_OPTIMIZED
, COLLISION_DETECTION_NOT_OPTIMIZED
mode
– visible or notOBJ_VISIBLE
, OBJ_INVISIBLE
build()
World.buildAllObjects()
build()
obj
– the Object3D to removeobj
– the object that should become a parent of this.resetNextID()
, World.addObject(com.threed.jpct.Object3D)
mode
– the shading modeSHADING_GOURAUD
, SHADING_FAKED_FLAT
mode
– the lighting modeLIGHTING_ALL_ENABLED
, LIGHTING_NO_LIGHTS
LIGHTING_ALL_ENABLED
, LIGHTING_NO_LIGHTS
lightCount
– a value between 0 and 8mode
– the specular modeSPECULAR_ENABLED
, SPECULAR_DISABLED
SPECULAR_ENABLED
, SPECULAR_DISABLED
trans
– the tranparency level. 0 is the highest possible transparency, a value below 0 will disable tranparency for this objectshader
– the shadermode
– the modeTRANSPARENCY_MODE_DEFAULT
, TRANSPARENCY_MODE_ADD
TRANSPARENCY_MODE_DEFAULT
, TRANSPARENCY_MODE_ADD
alphaWrites
– do alpha writes or notcol
– the colorred
– the red component (0..255)green
– the green component (0..255)blue
– the blue component (0..255)cloneObject()
, decoupleMesh()
cloneObject()
, clearObject()
ENVMAP_ENABLED
, ENVMAP_DISABLED
mode
– the environment mapping modeENVMAP_ENABLED
, ENVMAP_DISABLED
useFixedPoint
– use it?w
– 旋转角度,弧度值,逆时针为正,顺时针为负。一周的弧度数为2πr/r=2π,360°角=2π弧度,因此,1弧度约为57.3°,即57°17’44.806”w
– 旋转角度,弧度值,逆时针为正,顺时针为负。一周的弧度数为2πr/r=2π,360°角=2π弧度,因此,1弧度约为57.3°,即57°17’44.806”w
– 旋转角度,弧度值,逆时针为正,顺时针为负。一周的弧度数为2πr/r=2π,360°角=2π弧度,因此,1弧度约为57.3°,即57°17’44.806”axis
– a direction-vector pointing into the axis direction with the object’s rotation pivot as position vectorangle
– the angle of the rotationtrans
– the translation vectorx
– the number of units the object should be translated parallel to the x axisy
– the number of units the object should be translated parallel to the y axisz
– the number of units the object should be translated parallel to the z axiscamera
– the Camera the Object3D should be aligned withobject
– the object this object should be aligned withdir
– the directionup
– the up-vectordisableLazyTransformations()
enableLazyTransformations()
scale
– the new scalesetScale(float)
absScale
– the new (absolute) scalescale(float)
trns
– the SimpleVector to fill and returntoFill
– the vector to filltoFill
– the vector to filltoFill
– the vector to filltranslate(float,float,float)
, setOrigin(com.threed.jpct.SimpleVector)
mat
– the new rotation matrixrotateX(float)
, rotateY(float)
, rotateZ(float)
mat
– the matrix
mesh
– the new mesh of the objectgetMesh()
, calcBoundingBox()
Animation
, Mesh.cloneMesh(boolean)
, setMesh(com.threed.jpct.Mesh)
strip()
minx
– the lowest x-value of the AABBmaxx
– the highest x-value of the AABBminy
– the lowest y-value of the AABBmaxy
– the highest y-value of the AABBminz
– the lowest z-value of the AABBmaxz
– the highest z-value of the AABBbuild()
, calcBoundingBox()
hook
– the hook into the rendering pipelineIRenderHook
dirVec
– the direction vector (a unit vector)step
– the length of the casted ray (a collision will only be detected of it takes place within this range)setCenter(com.threed.jpct.SimpleVector)
, setCollisionMode(int)
, getID()
, NO_OBJECT
translation
– the translation the object should performradius
– the radius of the sphere (a collision will only be detected of it takes place within this radius)setCenter(com.threed.jpct.SimpleVector)
, setCollisionMode(int)
translation
– the translation the object should performellipsoid
– the radius of the epplisoid in x,y and z directionrecursionDepth
– the max. recursion depth of the collision detection. A higher value will improve the accuracy of the collision detection but reduce performance. Reasonable values lie between 1 and 5.setCenter(com.threed.jpct.SimpleVector)
, setCollisionMode(int)
mode
– int the modeELLIPSOID_ALIGNED
, ELLIPSOID_TRANSFORMED
ELLIPSOID_ALIGNED
, ELLIPSOID_TRANSFORMED
resetCollisionStatus()
wasTargetOfLastCollision()
org
– a SimpleVector containing the position vectordr
– a SimpleVector containing the direction vectorCOLLISION_NONE
org
– a SimpleVector containing the position vectordr
– a SimpleVector containing the direction vectorignoreIfLarger
– only polygons within this range will be taken into accountCOLLISION_NONE
center
– the centerbuild()
pivot
– the rotation pivot
setCenter(com.threed.jpct.SimpleVector)
, setRotationPivot(com.threed.jpct.SimpleVector)
, build()
ocTree
– the octree that subdivides this object
origin
– the origintranslate(float, float, float)
inv
– invert the culling?build()
calcTextureWrapSpherical()
calcTextureWrap()
, Primitives
texname
– 通过TextureManager.addTexture()方法添加的纹理名称tInf
– the TextureInfoTextureInfo
source
– the source of the texturing informationorg
– the position vector of the raydr
– the direction vector of the rayisNormalized
– indicates, that dr is already normalized. So the method can spare another normalization.RAY_MISSES_BOX
org
– the position vector of the raydr
– the direction vector of the rayRAY_MISSES_BOX
org
– the position vector of the ellipsoid (the ellipsoid’s center)ellipsoid
– the radius of the ellipsoid in x,y and z-direction as a SimpleVector
org
– the position vector of the sphere (the sphere’s center)radius
– the radius of the spherevert1
– the first vertexvert2
– the second vertexvert3
– the third vertexvert1
– the first vertexu
– the u component of the texture position at the first vertexv
– the v component of the texture position at the first vertexvert2
– the second vertexu2
– the u component of the texture position at the second vertexv2
– the v component of the texture position at the second vertexvert3
– the third vertexu3
– the u component of the texture position at the third vertexv3
– the v component of the texture position at the third vertexinvert()
vert1
– the first vertexu
– the u component of the texture position at the first vertexv
– the v component of the texture position at the first vertexvert2
– the second vertexu2
– the u component of the texture position at the second vertexv2
– the v component of the texture position at the second vertexvert3
– the third vertexu3
– the u component of the texture position at the third vertexv3
– the v component of the texture position at the third vertextextureID
– the ID of the texture as returned by TextureManager.getTextureID()TextureManager.getTextureID(java.lang.String)
, invert()
vert1
– the first vertexu
– the u component of the texture position at the first vertexv
– the v component of the texture position at the first vertexvert2
– the second vertexu2
– the u component of the texture position at the second vertexv2
– the v component of the texture position at the second vertexvert3
– the third vertexu3
– the u component of the texture position at the third vertexv3
– the v component of the texture position at the third vertextextureID
– the ID of the texture as returned by TextureManager.getTextureID()TextureManager.getTextureID(java.lang.String)
, invert()
vert1
– the first vertexvert2
– the second vertexvert3
– the third vertextInf
– the TextureInfoTextureManager.getTextureID(java.lang.String)
, TextureInfo
, invert()
将obj和mtl文件放在Android项目中的src/main/assets目录下,在java代码中使用如下代码加载3D模型文件
需要在Android 1.5以上运行,如果需要使用OpenGL ES 2.0,需要在Android 2.2或以上。
下载jPCT-AE库,将jpct_ae.jar添加到项目中。
jPCT-AE不是线程安全,尽量不要跨线程操作jPCT-AE的对象。
GLSurfaceView的Render方法是在Android的主UI线程中运行的吗?
答:onDrawFrame是用于进行实际渲染的方法,运行在Render子线程中。
用于初始化创建或者更新World和FrameBuffer等对象。
实际的渲染过程所在的方法。
可以进行实际的绘制操作,也可以进行绘制帧率的计算或者控制(比如控制帧率为30fps以节省设备电量)。
通常,一些图像库的坐标系是这样的,
向右为x轴正向,向上为y轴正向,指向屏幕外为z轴正向,
但是jPCT的坐标系不太一样,jPCT和上述坐标系比较的话,围绕x轴旋转了180度,如下:
向右为x轴正向,向下为y轴正向,指向屏幕内为z轴正向。
如果你同时使用了其他不同坐标系的代码,需要对坐标进行一些转换。
https://www.jpct.net/wiki/index.php?title=Reducing_memory_usage