In the file particle.cpp, the line:
Code: Select all
rotmat.TransformVec(particle.vx,particle.vy,particle.vz);
Code: Select all
mat.TransformVec(particle.vx,particle.vy,particle.vz);
Code: Select all
rotmat.TransformVec(particle.vx,particle.vy,particle.vz);
Code: Select all
mat.TransformVec(particle.vx,particle.vy,particle.vz);
Code: Select all
#include "openb3d/openb3d.bi"
'#include "2d2.bi"
#include "fbgfx.bi"
const as integer screen_width = 800, screen_height = 600
'-------------------------------------------------------------------------------
sub object_key_control(obj as any ptr)
if multikey(FB.SC_UP) then TurnEntity(obj, 0, 0, 2)
if multikey(FB.SC_DOWN) then TurnEntity(obj, 0, 0,-2)
if multikey(FB.SC_LEFT) then TurnEntity(obj, 0, 2, 0)
if multikey(FB.SC_RIGHT) then TurnEntity(obj, 0,-2, 0)
if multikey(FB.SC_PAGEUP) then TurnEntity(obj, 2, 0, 0)
if multikey(FB.SC_PAGEDOWN) then TurnEntity(obj, -2, 0, 0)
end sub
'-------------------------------------------------------------------------------
#define RGBA_A(c) (cuint(c) shr 24)
#define RGBA_R(c) ((cuint(c) shr 16) and &hFF)
#define RGBA_G(c) ((cuint(c) shr 8) and &hFF)
#define RGBA_B(c) (cuint(c) and &hFF)
#define rnd_range(low, high) (rnd(1) * ((high) - (low)) + (low))
const as long FACE_FRONT = 0 'red
const as long FACE_BACK = 1 'orange
const as long FACE_LEFT = 2 'green
const as long FACE_RIGHT = 3 'blue
const as long FACE_TOP = 4 'white
const as long FACE_BOTTOM = 5 'yellow
const as ulong CL_RED = &hB80A31 'front
const as ulong CL_ORANGE = &hFF5700 'back
const as ulong CL_GREEN = &h009C46 'left
const as ulong CL_BLUE = &h0044AF 'right
const as ulong CL_WHITE = &hFFFFFF 'top / up
const as ulong CL_YELLOW = &hFFD600 'bottom / down
'-------------------------------------------------------------------------------
type cubie_type
dim as any ptr entity
dim as any ptr quad(0 to 5)
dim as ulong faceColor(0 to 5) '0 for no quad (F,B,L,F,U,D)
end type
dim as cubie_type cubie(-1 to +1, -1 to +1, -1 to +1) 'x,y,z
'set face color, 0 for no face
for x as integer = -1 to +1
for y as integer = -1 to +1
for z as integer =-1 to +1
with cubie(x, y, z)
if x = -1 then .faceColor(FACE_LEFT) = CL_GREEN
if x = +1 then .faceColor(FACE_RIGHT) = CL_BLUE
if y = -1 then .faceColor(FACE_BOTTOM) = CL_YELLOW
if y = +1 then .faceColor(FACE_TOP) = CL_WHITE
if z = -1 then .faceColor(FACE_FRONT) = CL_RED
if z = +1 then .faceColor(FACE_BACK) = CL_ORANGE
end with
next
next
next
'turn 6 quad faces to make a 6-color cube
'order: front, back, left, right, up, down
dim as single quadPitch(0 to 5) = {0, 180, 0, 0, -90, +90}
dim as single quadYaw(0 to 5) = {0, 0, -90, +90, 0, 0}
' Set video mode
screencontrol(FB.SET_GL_2D_MODE, FB.OGL_2D_MANUAL_SYNC)
screenres(screen_width, screen_height, 32, 1, FB.GFX_OPENGL) 'or GFX_MULTISAMPLE or GFX_ALPHA_PRIMITIVES)
Graphics3d(screen_width, screen_height, 32, 1, 1)
' Setup light and camera
var light1 = CreateLight(1)
var cam1 = CreateCamera()
CameraViewport(cam1, 0, 0, screen_width, screen_height)
PositionEntity(cam1, 0, 0, -5) 'move camera back
dim as string mystr = ""
'central pivot point (to rotate the entire cube)
var pivot = CreatePivot()
dim as integer count = 0
for x as integer = -1 to +1
for y as integer = -1 to +1
for z as integer =-1 to +1
with cubie(x, y, z)
'build a small cube from 6 quads with each side a different color
.entity = CreateCube(pivot) 'has parent pivot, is parent for quads
ScaleMesh(.entity, 0.48, 0.48, 0.48)
EntityColor(.entity, 40, 40, 40)
MoveEntity(.entity, x, y, z)
for i as integer = 0 to 5
dim as ulong c = .faceColor(i)
if c <> 0 then
.quad(i) = CreateQuad(.entity) 'child of cubie
EntityColor(.quad(i), RGBA_R(c), RGBA_G(c), RGBA_B(c))
PositionMesh(.quad(i), 0, 0, -1)
ScaleMesh(.quad(i), 0.42, 0.42, 0.50)
RotateMesh(.quad(i), quadPitch(i), quadYaw(i), 0)
'EntityParent(quad(i), pivot1)
end if
next
end with
count += 1
'if count = 3 then exit for,for,for
next
next
next
'EntityParent(cubie, pivot2)
'PositionMesh(cubie, 2, 1, 3)
'TurnEntity(pivot, 20, 30, 0)
'RotateEntity(cubie, 20, 30, 0)
'wireframe(1)
'Make freebasic print work on 3d screen (2d2.bi)
'dim as font2d f2d
'-------------------------------------------------------------------------------
randomize timer
dim as single dPitch, dYaw, dRoll
dim as double tUpdate = timer + 1
while not multikey(FB.SC_ESCAPE)
object_key_control(pivot) ' control cube1 with arrow keys
TurnEntity(pivot, dPitch, dYaw, dRoll)
UpdateWorld()
RenderWorld()
'f2d.print(10, 10, "Hello Cube! " & mystr)
flip
sleep 1
if timer > tUpdate then
tUpdate = timer + 3 'change somthing again in 3 second
dim as integer choice = int(rnd_range(0, 3))
if choice = 0 then dPitch = rnd_range(-1, +1)
if choice = 1 then dYaw = rnd_range(-1, +1)
if choice = 2 then dRoll = rnd_range(-1, +1)
end if
wend
sleep
end
Yes, but in my case I want to 'trigger' some other code when the action is completed.angros47 wrote:The purpose of ActTurnBy is to have an action that is performed gradually, during the main cycle (a small percentage of the action, depending on "rate", is performed each time UpdateWorld is called). This function is not much useful on its own, but if it's combined with other actions using AppendAction allows scripted animations. The command AppendAction allows to trigger further actions automatically when the specific action is completed
Code: Select all
[keywords]
#for geany under windows place in %USERPROFILE%\AppData\Roaming\geany\filedefs\filetypes.freebasic
#OpenB3D 1.26 for freebasic
user1=ambientlight ambientshader antialias clearworld graphics3d renderworld updateworld wireframe createtexture loadanimtexture loadtexture loadmaterial getbrushtexture backbuffertotex buffertotex textobuffer cameratotex depthbuffertotex texturefilter cleartexturefilters positiontexture rotatetexture scaletexture textureheight texturewidth texturename freetexture textureblend texturecoords setcubeface setcubemode createbrush loadbrush brushalpha brushblend brushcolor brushfx brushshininess brushtexture getentitybrush getsurfacebrush freebrush createshader createshadervgf loadshader loadshadervgf freeshader getshaderprogram setfloat setfloat2 setfloat3 setfloat4 setinteger setinteger2 setinteger3 setinteger4 usefloat usefloat2 usefloat3 usefloat4 useinteger useinteger2 useinteger3 useinteger4 useentity usematrix usesurface shadeentity shademesh shaderfunction shadermaterial shadertexture shadesurface createmesh loadanimmesh loadmesh copymesh repeatmesh createcone createcube createcylinder createsphere createquad paintmesh addmesh positionmesh rotatemesh scalemesh meshcsg meshcullradius countsurfaces createbone skinmesh fitmesh flipmesh updatenormals updatetexcoords meshesintersect meshdepth meshheight meshwidth getsurface createsurface addtriangle addvertex trianglevertex counttriangles countvertices paintsurface clearsurface findsurface vertexalpha vertexcolor vertexred vertexblue vertexgreen vertexnormal vertexnx vertexny vertexnz vertexcoords vertexx vertexy vertexz vertextexcoords vertexu vertexv vertexw createcamera cameraclscolor cameraclsmode camerafogcolor camerafogmode camerafogrange camerapick cameraproject projectedx projectedy projectedz cameraprojmatrix cameraprojmode camerarange cameraviewport camerazoom entityinview pickedentity pickedsurface pickedtriangle pickedx pickedy pickedz pickednx pickedny pickednz pickedtime createlight lightcolor lightconeangles lightrange createpivot createsprite createvoxelsprite loadsprite handlesprite rotatesprite scalesprite spriterendermode spriteviewmode voxelspritematerial createshadow freeshadow resetshadow createplane createterrain creategeosphere loadterrain loadgeosphere geosphereheight modifyterrain modifygeosphere terrainheight terrainx terrainy terrainz createfluid createblob fluidarray fluidfunction fluidthreshold createoctree octreeblock octreemesh createparticleemitter emitterparticlefunction emitterparticlelife emitterparticlespeed emitterrate emittervariance emittervector particlecolor particletrail particlevector moveentity pointentity positionentity translateentity rotateentity turnentity scaleentity addanimseq loadanimseq animseq animate animlength animtime animating setanimkey setanimtime extractanimseq freeentity copyentity entityalpha entitycolor entityshininess entitytexture paintentity entityfx entityautofade entityblend entityorder nameentity hideentity showentity entityparent getparententity tformnormal tformpoint tformvector tformedx tformedy tformedz countchildren entitydistance entityvisible entityx entityy entityz entitypitch entityroll entityyaw entityscalex entityscaley entityscalez findchild getchild deltapitch deltayaw entityclass entityname entitymatrix entitypick linepick entityradius resetentity collisions countcollisions collisionentity collisionnx collisionny collisionnz collisionx collisiony collisionz collisionsurface collisiontriangle collisiontime entitycollided entitybox entitytype entitypickmode getentitytype clearcollisions actfadeto actmoveby actnewtonian actscaleto acttintto acttrackbydistance acttrackbypoint actturnby actturnto actvector appendaction freeaction createconstraint createrigidbody freeconstraint freerigidbody createstencil usestencil stencilalpha stencilclscolor stencilclsmode stencilmesh stencilmode createpostfx addrendertarget postfxbuffer postfxfunction postfxshader postfxshaderpass postfxtexture vectorpitch vectoryaw getmatelement
[build-menu]
FT_00_LB=_Compile
FT_00_CM=fbc -w all "%f" -gen gcc -target win64
FT_00_WD=
FT_01_LB=Build
FT_01_CM=fbc -exx "%f"
FT_01_WD=
FT_02_LB=win32 bit
FT_02_CM=fbc -w all "%f" -target win32
FT_02_WD=
Yes, Gunslinger's post it to give the openb3d keywords their own color in the editorMunair wrote:Geany already supports FreeBASIC, if I'm not mistaken.
Code: Select all
[named_styles]
keyword_3=0x800080;;true;false
Code: Select all
[keywords]
user1=ambientlight ambientshader antia... (etc.)