-
Posts
31 -
Joined
-
Last visited
Content Type
Blogs
Forums
Store
Gallery
Videos
Posts posted by Kronos
-
-
Brilliant!
-
Is it possible to write a shader and then let the existing lighting shaders in Leadwerks do the lighting stuff or would I have to include a lighting element in my shader?
-
Thanks for the input. I think I will take scaling out of the equation which will hopefully simplify things.
-
I don't know if such a thing is possible but it would be helpful for the model editor I'm working on. At the moment scale seems to be getting messed up when parenting entities.
-
A while ago I was looking at callbacks for the first time and wrote this little demo to test some things. Anyway I figure it might be useful to others so here is the code.
'A short demo to show how to setup certain callbacks in Blitzmax ' and how to associate an instance of a type with an entity which can hold additional info ' use wasd,lshift and space to move camera ' keys r,g,b to send message to entity (to change colour) 'count1 updates for every entity update 'count2 updates when entity is in defined range of camera and name of entity matches simple.name Framework leadwerks.engine Import "C:\Program Files (x86)\Leadwerks Engine SDK\BMX\Framework\framework.bmx" '***************************************************************************************** Type SimpleType ' our user data holder class Field health:Int Field Name:String = "Fred" Field Message:String Field BODY:TBody Field Count1:Long Field Count2:Long End Type '***************************************************************************************** Function CheckColour(ent:TEntity, message:String)' function used by MessageReceive callback Select message Case "Red" EntityColor(ent, Vec3(255, 0, 0)) Case "Green" EntityColor(ent, Vec3(0, 255, 0)) Case "Blue" EntityColor(ent, Vec3(0, 0, 255)) End Select Local Sim:SimpleType = simpletype(getentityuserdata(ent))' to access the userdata we have to cast to simpletype Sim.message = message End Function '******************************************************************************************* Function UpdateCounter(ent:TEntity) ' function used by EntityUpdate callback Local Sim:SimpleType = simpletype(getentityuserdata(ent)) Sim.count1:+1 End Function '******************************************************************************************* Function UpdateCounter2(ent:TEntity) 'function used by ForEachEntityInAABBDo If getentitykey(ent, "name") = "Fred" Then Local Sim:SimpleType = simpletype(getentityuserdata(ent)) If Sim.Name = "Fred" Then Sim.count2:+1 EndIf End Function '******************************************************************************************* 'main routine AppTitle:String = "Leadwerks Callback test" RegisterAbstractPath ("C:\Program Files (x86)\Leadwerks Engine SDK\") Graphics(1024, 768) Global fw:TFramework = CreateFramework() If Not fw RuntimeError "Failed to initialize engine." Local markcam:mCamsetup = New mcamsetup markcam.Camera = fw.Main.Camera Local Simple:SimpleType = New SimpleType Local MyMesh:TMesh = CreateCube()' create a mesh Setentitykey(MyMesh, "name", "Fred")' give it a name of "Fred" SetEntityCallback(MyMesh, Byte Ptr CheckColour, ENTITYCALLBACK_MESSAGERECEIVE)' associate a function to the message receive callback SetEntityCallback(MyMesh, Byte Ptr UpdateCounter, ENTITYCALLBACK_UPDATE)' associate a function to the update callback setentityuserdata(MyMesh, Simple) 'associates the instance of simpletype to MyMesh PositionEntity(fw.Main.Camera, Vec3(.5, 2, -2), 1) Global Light:TLight = CreateDirectionalLight() RotateEntity(Light, Vec3(45, 45, 0)) Local PLANE:TMesh = createPlane() ScaleEntity(PLANE, Vec3(5000, 1, 5000)) EntityColor(PLANE, Vec3(100, 100, 0)) Local Vec6:TAABB = New TAABB' needed for ForEachEntityInAABBDo HideMouse() While Not KeyHit(KEY_ESCAPE) And Not AppTerminate() markcam.Update() 'setup the area to search for entities Vec6.x0 = entityposition(markcam.Camera).X - 10 Vec6.x1 = entityposition(markcam.Camera).X + 10 Vec6.y0 = entityposition(markcam.Camera).Y - 10 Vec6.y1 = entityposition(markcam.Camera).Y + 10 Vec6.z0 = entityposition(markcam.Camera).Z - 10 Vec6.z1 = entityposition(markcam.Camera).Z + 10 ForEachEntityInAABBDo(Vec6, Byte Ptr UpdateCounter2) If KeyHit(KEY_R) Then sendentitymessage(MyMesh, "Red", 1200)'send message with a short delay If KeyHit(KEY_G) Then sendentitymessage(MyMesh, "Green", 1200) If KeyHit(KEY_B) Then sendentitymessage(MyMesh, "Blue", 1200) fw.Update() fw.render() DrawText(Int entityposition(markcam.Camera).X + " " + Int entityposition(markcam.Camera).Y + " " + Int entityposition(markcam.Camera).Z, 0, 16) DrawText("Simple.Message=" + Simple.message, 0, 32) DrawText("Simple.count1=" + Simple.count1, 0, 48) DrawText("Simple.count2=" + Simple.count2, 0, 64) Flip(0) Wend ShowMouse() End '********************************************************************************************* 'just a little camera control class Type mCamSetup Field mx:Float=0 Field my:Float=0 Field move:Float=1 Field wire:Int = -1 Field Camera:TCamera Field Py:Float Field toggle:Int = 1 Method New() End Method Method Update() mx=mx+(MouseX()-GraphicsWidth()/2)/10 my=my+(MouseY()-GraphicsHeight()/2)/10 MoveMouse(GraphicsWidth()/2,GraphicsHeight()/2) RotateEntity(Camera, Vec3(my, -mx, 0)) If toggle = 1 Then If KeyDown(KEY_W) = True Then MoveEntity Camera, Vec3(0, 0, move * AppSpeed()) If KeyDown(KEY_S) = True Then MoveEntity Camera, Vec3(0, 0, -move * AppSpeed()) If KeyDown(KEY_A) = True Then MoveEntity Camera, Vec3(-move * AppSpeed(), 0, 0) If KeyDown(KEY_D) = True Then MoveEntity Camera, Vec3(move * AppSpeed(), 0, 0) If KeyDown(KEY_SPACE) = True Then TranslateEntity Camera, Vec3(0, move * AppSpeed(), 0) If KeyDown(KEY_LSHIFT) = True Then TranslateEntity Camera, Vec3(0, -move * AppSpeed(), 0) EndIf End Method End Type
-
it would probably help if you gave some background eg what programs you've used in the past. What type of game are you looking to make. What programming language do you intend to use?
-
sound or sound triggers on emitters/particles? For explosions and the like.
-
None that I am aware of.
So are you saying leadwerks engine itself is running in debug mode when this option is set because it was written in blitzmax. Interesting.
-
Seems odd.I haven't noticed this any other engines when using blitzmax. oh well.
-
Just wondering if anyone else has this problem. All my leadwerks programs written in Blitzmax seems to run really slow when compiled in debug mode.
As an example I have a simple app which has a scene , some animated characters running about and thats about it but it runs at less than 30 fps in debug mode. 60+ when debug is unchecked.
Is this a windows 7 thing?
-
One of the things that always amazes me in wow is the lack of visible lod'ing on anything. One wonders whether they use brute force for rendering the terrain.
The only thing I know about the terrains in wow is that they use a max of 4 textures per terrain square.
-
you should call him "Eric"
-
This seems to do the job for horizontal and vertical aiming.
Local t:TVec3=TFormPoint(Vec3(0,0,0),enemytarget.chassis,chassis) dYaw = -ATan2(t.x,t.z) dPitch =-ATan2(t.y, Sqr(t.x*t.x + t.z*t.z)) mRotate(turret1,0,CurveAngle(dYaw,entityrotation(turret1).y,10.0/AppSpeed()),0) mRotate(barrel,CurveAngle(dPitch,entityrotation(barrel).x,10.0/AppSpeed()),0,0)
never really understood TFormpoint and TFormVector before but its becoming clearer.
Thanks Josh for pointing me in the right direction.(haha unintentional pun)
-
I have a vehicle which has a turret base attached to it which can rotate locally around its y axis. A barrel is attached to this turret base that can move locally in the x axis but has an upper and lower limit on how far it can rotate. The vehicle will be travelling over uneven terrain.
My question is how can I make the gun turret point towards a certain point, eg an enemy vehicle or a specific point in space.
When i was using Blitz3d I used Deltayaw and Deltapitch for this which worked fine, but we do not have these functions in Leadwerks. I tried using the Deltapitch/yaw functions from minib3d but they don't work.
I have also been trying to use PointEntity but it appears to only work using global angles and not local ones. The turret base must only rotate around its own y axis and the barrel must only rotate around its own x axis.
Does anybody have any suggestions as to how I can achieve the result I am after?
-
Don't you just want to use TerrainElevation or am I not understanding. This will give you the terrain height at ANY point on the terrain.
-
Whats the value you have to tweak to make the vehicle slow down and stop when no power is being supplied to the wheels. I find my vehicles just seem to keep on rolling forever.
-
Confirmed that works fine for me. Thanks folks
-
Using the method of cycling through all child entities of the scene will only return terrain as an entity. How can I get it as a terrain. I need to be able to access the terrain to retrieve height information via terrainelevation().
This code doesn't work because you can't cast from entity to terrain.
Local Myscene:TEntity = loadscene("media\myscene2.sbx"); Local ent:TEntity Local terrain:TTerrain DebugLog "countChildren = "+CountChildren(myscene) For i = 1 To CountChildren(myscene) ent = GetChild(myscene,i) If GetEntityKey(ent,"class") = "Terrain" Then terrain=ent <--no good!! Next
Thanks in advance.
-
Rick
Did you ever figure out how to reposition textures on a model? I need to something along these lines to simulate a tank track moving.
-
Josh,
Sorry to harp on about this but I don't know how you are getting that result. Here is what I get using uncompressed, save mipmaps options using the texturetool downloaded from the site.
Its nowhere near as smooth as your one.
Its no biggee I can use other progs for the conversion as mentioned above.
aargh..file is too big to upload.. (edit:these files are rather big aren't they:()
-
just X,Y,Z truncated to 3 decimal places or something
-
I made a program that generates an 4 colour (rgba) alphamap as a jpg/png. The transitions between the colours are nice and smooth. However when I convert them to dds using Leadwerks tool the transitions are no longer smooth. Using the transformed DDS alphamap for a terrain results in obvious blocking on the terrain surface. This happens whether I use compressed or uncompressed DDS output. Its worse with compression.
I have included a before and after in the attached zip. The difference is subtle but when you zoom in on the DDS you can see the blockier look.
Just wondering whether the quality of translation could be improved a bit or whether this is a limitation of the DDS format.
-
Hmm that didnt really work. Just get an overall greenish colour on the surface and nothing else. The best I have got so far is using sprite.vert. I can see the texture(s) using that but there is some weird light error going on. it may be unrelated to the shader but when the camera turns in certain direction everything goes white on the surface of the mesh. I am just using a large squashed cube for testing purposes at the moment.
-
Something I always have in my own programs is the current coordinates of the camera shown on screen so I know whereabouts I am on the map.
Been Playing Far Cry 3, fun game, I have pics!
in Tech Talk
Posted
Really been enjoying this, except some heavily armoured dudes have started to appear at enemy outposts which is ruining my fun a bit. They're somewhat immune to my arrows.
Playing it on PC(through steam) and had too install the stupid UPlay which is basically ubisofts version of steam. Seems like every new game you have to register on another new service just to play the damn thing. Hate it!