Jump to content

Mince

Members
  • Posts

    38
  • Joined

  • Last visited

Posts posted by Mince

  1. Thanks Rick, but that really wont work for the desired effects, as the forces need to continue through so many frames.

     

    We come a long way with lua; from no-where to a full but basic AI & Animation control. really tho I think we need to use c++.

     

    One thing we found with LUA is it runs differently different times, sometimes crashing editor sometimes not.>>really wired.

    We will share all our models and examples when we can upload here so you can try yourself.

     

    Do you find problems with LUA?

    Especially with playing sounds!!

  2. I see lots of you members are with it when it comes to programming in c++.

     

    The examples given seem messy and basic. I wanted to tidy it up I realise you must declare world,cam,buffers ect so I added the vars at the top and made some functions to crete cam and load level.

     

    When it compiles I get warnings about the possibility of accuracy loss from the following vars

     

     

    IS THIS EXCEPTABLE and or THE RIGHT WAY ??

    //Global Vars

    TCamera fgcam;

    TLight light;

    TVec3 camrotation;

    TEntity campiv;

    TEmitter fire;

    TWorld foreground;

    TCamera cam;

    TBuffer gbuffer;

    TBuffer lightbuffer;

     

     

    But it compiles and when I run it it crashes out.

    Here is the full code please some1 take a second to help and maybe give a example,

    • Your probably familiar with this one,its from the Heat/Fire example.

     

    #include "engine.h"

    #include <iostream>

    #include <string>

     

    const int ScreenWidth = 800;

    const int ScreenHeight = 600;

    const char* MediaDir = "C:/Program Files/Leadwerks Engine SDK";

    const char* AppTitle = "Mince Machine";

     

    void ErrOut( const std::string& message ) { std::cerr << message << std::endl; }

     

    //Global Vars

    TCamera fgcam;

    TLight light;

    TVec3 camrotation;

    TEntity campiv;

    TEmitter fire;

    TWorld foreground;

    TCamera cam;

    TBuffer gbuffer;

    TBuffer lightbuffer;

     

    float mx=0.0,my=0.0;

     

    class MinceMachine{

    public:

    void MMCreateBuffer()

    {

    //Create a render buffer

    TBuffer gbuffer=CreateBuffer(1024,768,BUFFER_COLOR|BUFFER_DEPTH|BUFFER_NORMAL);

    TBuffer lightbuffer=CreateBuffer(1024,768,BUFFER_COLOR|BUFFER_DEPTH);

    }

     

    void CreateCam()

    {

    TCamera fgcam=CreateCamera();

    TEntity campiv=CreatePivot();

     

    PositionEntity(campiv,Vec3(0,1,0));

     

    TCamera cam=CreateCamera(campiv);

    PositionEntity(cam,Vec3(0,0,-4));

    }

     

    void LoadLevel(const_str level)

    {

    LoadMesh("scene.gmf");

    TWorld foreground=CreateWorld();

    CameraClearMode(fgcam,0);

    }

     

     

    void Setup(int mode)

    {

    // leTFilter(1);

    // leAFilter(1);

    // leSetHDR(mode);

    // leSetBloom(mode);

    // leSetAntialias(4);

    // leSetSSAO(0);

    // leSetGodRays(0);

    // SetAppTitle( AppTitle );

    // RegisterAbstractPath( MediaDir );

    // // Set Lua framework object

    // SetGlobalObject( "fw", fw );

    }

     

     

     

    void CreateLight(float x,float y,float z)

    {

    TLight light = CreatePointLight();

    PositionEntity(light,Vec3(x,y,z));

    EntityColor(light,Vec4(1,0.5,0,0.1));

    }

     

     

     

     

    void mouse()

    {

    TVec3 camrotation;

    HideMouse();

    MoveMouse(GraphicsWidth()/2,GraphicsHeight()/2);

    }

     

    void MouseCamupdate()

    {

    mx=Curve(MouseX()-GraphicsWidth()/2,mx,3);

    my=Curve(MouseY()-GraphicsHeight()/2,my,3);

    MoveMouse(GraphicsWidth()/2,GraphicsHeight()/2);

    camrotation=EntityRotation(campiv);

    camrotation.X+=my;

    camrotation.Y-=mx;

     

    RotateEntity(campiv,camrotation);

    }

     

     

    void CreateHeat(int Intensity,int LifeTime,float x,float y, float z,int RAD)

    {

    //Bit Of Red

    // TEmitter fire = CreateEmitter(Intensity,LifeTime,Vec3(x,y,z));

    // EntityColor(fire,Vec4(1,0.5,0,0.1));

    // PaintEntity(fire,LoadMaterial("fire.mat"));

    // SetEmitterRadius(fire,RAD,RAD/2);

    // SetEmitterWaver(fire,0.5);

    // SetEmitterRotationSpeed(fire,0.5);

    // SetEmitterArea(fire,Vec3(1,0.5,1));

    //Create the heat haze emitter

    // TEmitter heat = CreateEmitter(Intensity/5,LifeTime*2,Vec3(x,y-0.5,z));

    // TMaterial material=LoadMaterial("heathaze.mat");

    // SetMaterialTexture(material,GetColorBuffer(lightbuffer),1);

    // SetMaterialTexture(material,GetDepthBuffer(gbuffer),2);

    // PaintEntity(heat,material);

    // SetEmitterRadius(heat,RAD+0.5,RAD+0.5);

    // SetEmitterWaver(heat,0.5);

    // SetEmitterRotationSpeed(heat,0.1);

    // SetEmitterArea(heat,Vec3(1,0.5,1));

    }

     

    };//End of Mince Engine Machine Class

     

     

    int main(int argc, char** argv)

    {

    Graphics(1024,768,0,60,GRAPHICS_BACKBUFFER|GRAPHICS_DEPTHBUFFER);

    //Create a world

    TWorld world=CreateWorld();

    if (!world)

    {

    MessageBoxA(0,"Error","Failed to create world.",0);

    //goto exitapp;

    return 0;

    }

     

    //Creeate Refrence Object

    MinceMachine Engine;

     

     

    Engine.Setup(1);

    Engine.CreateCam();

    Engine.MMCreateBuffer();

    Engine.LoadLevel("scene.gmf");

    Engine.CreateHeat(100,1000,0,2,0,0.5);

    SetWorld(world);

    Engine.CreateLight(0,0.25,0);

    Engine.mouse();

    Engine.MouseCamupdate();

     

     

    //Main loop

    while(!KeyHit(KEY_ESCAPE))

    {

    Engine.MouseCamupdate();

    UpdateWorld();

     

    //Render Main World

    SetBuffer(gbuffer);

    SetWorld(world);

    RenderWorld();

     

    //Render Lights

    //SetBuffer(lightbuffer);

    //RenderLights(gbuffer);

    //SetBuffer(BackBuffer());

    //DrawImage(GetColorBuffer(lightbuffer),0,TextureHeight(GetColorBuffer(lightbuffer)),TextureWidth(GetColorBuffer(lightbuffer)),-TextureHeight(GetColorBuffer(lightbuffer)));

     

    //Forground Render

    SetWorld(foreground);

    SetBuffer(BackBuffer());

    ClearBuffer(BUFFER_DEPTH);

    SetEntityMatrix(fgcam,GetEntityMatrix(cam));

    RenderWorld();

     

    SetShader(0);

    SetWorld(world);

     

     

    Flip();

    } //End of While Loop

     

    }//End of Program

  3. We Get Violation code, AND IT SHUTS DOWN.

    Please help.

     

    I have this code added into my bullet.lua and use the pick it does just before terminating its self with a emitter.

     

    --Add Decal

    This bit at tob of bullet.lua

    bulletholemat = ("abstract::bulletholemat.mat")

     

    bullethole=CreateDecal(pick.surface,TFormPoint(pick.position,nil,pick.entity), 5.0/16.0,30)

     

    EntityParent(bullethole,mesh,0)

    PaintEntity(bullethole,bulletholemat)

    AddMesh(bullethole, pick);

    FreeEntity(bullethole)

  4. I tried the EntityNew={} ver

    That gave me a error with inherit = nil???

     

    The following Script dont work, either

     

    if any one can help me rotate the blades that will be great.

     

    --Include the base script for all classes

    dofile("Scripts/base.lua")

     

     

    --Some global sounds we will use for all instances

    squeak={}

    squeak[0]=LoadSound("abstract::squeak_1.ogg")

    squeak[1]=LoadSound("abstract::squeak_2.ogg")

     

     

    --This function builds the interface for the properties editor

    function InitDialog(grid)

     

    --Add the base interface for all classes

    base_InitDialog(grid)

     

    --Now we can add our own custom properties

    group=grid:AddGroup( "Windmill" )

    group:AddProperty( "spinspeed","|0,4",PROPERTY_FLOAT,"Spin Speed")

    group:Expand(1)

     

    end

     

     

    --Spawn function for creating new instances

    function Spawn(model)

    local entity=base_Spawn(model)

     

    --Retrieve a few limbs we will use later

    entity.blades=model:FindChild("windmill_blades")

    entity.base=model:FindChild("windmill_housing")

    entity.model:SetKey("spinspeed","1")

     

    --An update function for one instance. Declaring the function as part of the entity table allows us to use "self" for the table

    function entity:Update()

     

    --Although these limbs should always be present, it"s a good idea to add a check to make sure they exist before using them

    if self.blades~=nil then

    self.blades:Turnf(0,tonumber(self.model:GetKey("spinspeed"))*AppSpeed(),0,0)

    end

     

    if self.base~=nil then

     

    --Make the base sway slightly

    angle=math.sin(AppTime()/2000.0)*5-15

    angle=angle+math.cos(AppTime()/500.0)*2

    self.base:SetRotationf(0,0,angle,0)

     

    --Make the base squeak

    lasttime=tonumber(self.model:GetKey("lastsqueaktime","0"))

    if (AppTime()-lasttime>8000) then

    self.model:SetKey("lastsqueaktime",AppTime()+math.random(0,5000))

    self.base:EmitSound(squeak[math.random(0,1)],50,1,0)

    end

    lasttime=tonumber(self.model:GetKey("lastsheeptime","0"))

     

    end

     

    end

     

    end

     

     

    --Update function, called during every UpdateWorld()

    function Update(world)

    if world==world_main then

    local model,entity

    for model,entity in pairs(entitytable) do

    if model.world==world then

    entity:Update()

    end

    end

    end

    end

  5. Hi there, I'm making a Game in Leadwerks 2.3 and am having trouble making my Glass.DDS transparent

     

    I am using Photoshop CS5 with the N-vidia DDS Plugin

    I Edited the .PNG file adding an Alpha Channel. I then Made the Whole alpha channel black and then exported it as a DXT5 (Reccomended) and In the game it is not Transparent.

     

    I Also generated Mip Maps in the plugin and Tried flattening the image also. Still it doesn't work.

×
×
  • Create New...