# let u, v vectors on the plane. b the origin on it. # let a a point off plane. and n a normal of the plane. import sys import bmesh import numpy as np def mapOnPlane(a, b0, b1, b2): u = np.array([b1[0]-b0[0], b1[1]-b0[1], b1[2]-b0[2]]) v …
bl_info = { "name": "Simple Liner", "category": "Add Curve", } import bmesh ########################################## # number of edges (vertices = edges + 1) n = 3 ########################################## def genVert(n): for i in range…
import bpy import math import bmesh # Supposing every object has a name which begins with one of # followings: c_, s_, h_ # c_ stands for cylinder, s_ sphere and h_ hemisphere respectively. # 2014 march 14 sphere is not yet implemented. # …
import bmesh import math ''' msh = bpy.data.meshes.new('hexHemisphereMesh') obj = bpy.data.objects.new('hexHemisphere', msh) bpy.context.scene.objects.link(obj) ''' ######################### nnn = 5 ######################### #w = 1.0/float…
#!BPY import bpy import math ############# n = 5 ############# m = bpy.data.meshes.new('hemisphereMesh0') o = bpy.data.objects.new('hemisphere0', m) bpy.context.scene.objects.link(o) def vert(): yield (0.0, 0.0, 1.0) for k in range(1, n+1)…
It seems that bmesh data are refreshed when the mode is changed from "edit" to "object", though I have not figured out the exact moment yet. The code is the same as ever. import bmesh import math msh = bpy.data.meshes.new('cylinderMesh') o…
>>> bm.loops.layers.uv <BMLayerCollection object at 0x7efeed558e90> >>> bm.loops.layers.uv.active <BMLayerItem object at 0x7efeed453a20> >>> uv_lay <BMLayerItem object at 0x7efeed453b40> >>> loop[uv_lay].uv Vector((0.20000000298023224, 35.79999923706055)) >>> loop[uv_lay] </bmlayeritem></bmlayeritem></bmlayercollection>
#!BPY import bpy import math ''' for x in bpy.context.scene.objects: bpy.context.scene.objects.unlink(x) for x in bpy.data.objects: bpy.data.objects.remove(x) for x in bpy.data.objects: x.select = True bpy.ops.object.delete() ''' #########…
import bpy import bmesh obj = bpy.context.active_object me = obj.data bm = bmesh.from_edit_mesh(me) uv_layer = bm.loops.layers.uv.verify() bm.faces.layers.tex.verify() # currently blender needs both layers. uv_lay = bm.loops.layers.uv.acti…
import bpy import bmesh def main(context): obj = context.active_object me = obj.data bm = bmesh.from_edit_mesh(me) uv_layer = bm.loops.layers.uv.verify() bm.faces.layers.tex.verify() # currently blender needs both layers. # adjust UVs for …
Vertices of the object seem to lie there: bpy.data.meshes['Icosphere'].uv_layers.data.vertices[0].co.xyz
#!BPY import bpy m = bpy.data.meshes.new('hemisphereMesh') o = bpy.data.objects.new('hemisphere', m) bpy.context.scene.objects.link(o) n = 30 #the number of latitudes def vert(): yield (0.0, 0.0, 1.0) for k in range(1, n+1): theta = float(…
#!BPY import bpy list (bpy.data.objects) for x in bpy.context.scene.objects: bpy.context.scene.objects.unlink(x) for x in bpy.data.objects: bpy.data.objects.remove(x) for x in bpy.data.objects: x.select = True bpy.ops.object.delete() list …
<COLLADA xmlns="http://www.collada.org/2005/11/COLLADASchema" version="1.4.1"> <asset> <contributor> <author>Blender User</author> <authoring_tool>Blender 2.69.0 r60991</authoring_tool> </contributor> <created>2014-01-14T21:08:56</created> <modified>2014-01-14T…</modified></asset></collada>
This is the drawing part. Beware of texture uniform. It looks a bit strange but otherwise causes some error. With "glUniform1i(loc_myTex, texID);" instead of "glUniform1i(loc_myTex, 0);", no texture is seen. void MyObject::draw() { // glBi…
Full screen mode for example, ANativeActivity_setWindowFlags(app->activity, AWINDOW_FLAG_FULLSCREEN, 0); where app is the ptr to struct android_app defined in android_native_app_glue.h.This function is the NDK version of android.view.Windo…
You have to adjust both project property and AndroidManifest.xml.
(1) put in AndroidManifest.xml(2)put android:settingsActivity="com.foo.FooSettings" in tab in foo.xml under @xml(3)write foo_settings.xml and string.xml then put them into @xml and @value respectively.(4)write Java codes using addPreferenc…
EGL is only supported after android-9, that is, OS 2.3.1 Gingerbread.
glEnable(GL_LIGHTING); glEnable(GL_LIGHT0); consumes 64Kbytes more than glDisable(GL_LIGHTING); glDisable(GL_LIGHT0); in top RSS. The difference looks very small. :)
The order of gl-functions in loadTex is critical. typedef struct TextureInfo_ { int width; int height; int pixelSize; int colorType; // int algnType; // 0=unsigned char, 1=uint32_t void* pPix; int id; const char* fileName; } TextureInfo; v…
You can find only 3 formats in android/native_window.h. enum { WINDOW_FORMAT_RGBA_8888 = 1, WINDOW_FORMAT_RGBX_8888 = 2, WINDOW_FORMAT_RGB_565 = 4, }; But actually, it has others. When you set up the attributes like this const EGLint attri…
Some parts of the code are borrowed from Independent JPEG Group and Android NDKでlibjpegをビルドして利用する(UsefullCode.net)Resulted texture will have dummy alpha components (0xff) for compatibility with PNG. static uint32_t make8888(int …
1)make sure no project is selected2)file->import->Existing Projects into Work Space3)select root directry4)check "Copy projects into workspace" (*IMPORTANT this may overwrite existing project)5)refresh 6)finish
void myLoadAsset(AAssetManager* mngr){ const char imageFilename[] = "myImage.png"; AAsset* asset = AAssetManager_open(mngr, imageFilename, AASSET_MODE_UNKNOWN); FILE* fp = (FILE*)AAsset_getBuffer(asset); // AAsset_seek(asset, 1000, SEEK_SE…
const void* AAsset_getBuffer(AAsset* asset);Dianne Hackborn says: I suggest not using getBuffer() for a compressed file. It really only make sense for a file that isn't compressed, where this can give you a direct pointer to the mmapped da…
getBuffer returns the pointer to the mmapped image of the asset. openFileDescriptor returns the file descriptor to the mmapped image of the asset. fdopen(file descriptor) returns the pointer to the WHOLE package(.apk).