Jump to content

Von04

Members
  • Posts

    77
  • Joined

  • Last visited

Everything posted by Von04

  1. Does anyone know if I can mark this thread as [sOLVED], or if a website administrator has to do that?
  2. Finally, after many tiring hours, I have succesfully created an OpenGL Control that renders leadwerks to a custum buffer on a c++ windows forms application. All you have to do is drag and drog the control onto your form and it sets up leadwerks for you with or without framework, it's your choice. I just need to tidy up my code and do some bug testing, and then I will release the control and a demo project to the community. Hopefully this helps a lot of people.
  3. So here is what I've come up with so far. The program ran fine and the createcustombuffer function seems to be working. Although when I added the line World = CreateWorld(), the program hangs up and freezes and never gets to the line MessageBox::Show("Failed to create world!"). Do you think this is because CreateCustomBuffer isn't being made current or isn't getting a valid DC? #pragma warning(disable: 4793) #pragma warning(disable: 4441) #pragma once #include "stdafx.h" #include "Engine.Cpp" namespace GMFTool { using namespace System; using namespace System::ComponentModel; using namespace System::Collections; using namespace System::Windows::Forms; using namespace System::Data; using namespace System::Drawing; using namespace Tao::Platform::Windows; using namespace Tao::OpenGl; using namespace LE; static void _stdcall GetSize(int *width, int *height) { width[0] = 800; height[0] = 600; } static void _stdcall MakeCurrent() { wglMakeCurrent(wglGetCurrentDC(), wglGetCurrentContext()); } public ref class Form1 : public System::Windows::Forms::Form { public: TBuffer Buffer; TWorld World; public: Form1(void) { InitializeComponent(); Window->InitializeContexts(); Initialize(); Buffer = CreateCustomBuffer((byte *)&GetSize, (byte*)&MakeCurrent); World = CreateWorld(); if (!World) MessageBox::Show("Failed to create world!", "Error!"); } protected: ~Form1() { if (components) { delete components; } } public: Tao::Platform::Windows::SimpleOpenGlControl^ Window; private: System::ComponentModel::IContainer^ components; public: #pragma region Windows Form Designer generated code /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> void InitializeComponent(void) { this->Window = (gcnew Tao::Platform::Windows::SimpleOpenGlControl()); this->SuspendLayout(); // // Window // this->Window->AccumBits = static_cast<System::Byte>(0); this->Window->AutoCheckErrors = false; this->Window->AutoFinish = false; this->Window->AutoMakeCurrent = true; this->Window->AutoSwapBuffers = true; this->Window->BackColor = System::Drawing::Color::Black; this->Window->ColorBits = static_cast<System::Byte>(32); this->Window->DepthBits = static_cast<System::Byte>(16); this->Window->Dock = System::Windows::Forms::DockStyle::Fill; this->Window->Location = System::Drawing::Point(0, 0); this->Window->Name = L"Window"; this->Window->Size = System::Drawing::Size(1184, 662); this->Window->StencilBits = static_cast<System::Byte>(0); this->Window->TabIndex = 0; // // Form1 // this->AutoScaleDimensions = System::Drawing::SizeF(6, 13); this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font; this->ClientSize = System::Drawing::Size(1184, 662); this->Controls->Add(this->Window); this->Name = L"Form1"; this->Text = L"Form1"; this->WindowState = System::Windows::Forms::FormWindowState::Maximized; this->ResumeLayout(false); } #pragma endregion }; }
  4. Just wondering if anyone has gotten CreateCustomeBuffer to work with c++ and windows forms yet? I want to make a GMF Fracture tool for destructibles objects, but I can only use c++ because converting the code to c# would take way to long.
  5. Is it at all possible to get the vertice indexes of a specific triangle?
  6. Anyone know where to find the GmfSdk.h file?
  7. Anyone know where to find the GmfSdk.h file? Sorry, didn't mean to post this in the Leadwerks3d section. Please delete this post.
  8. Does anyone have an example of AddBodyForceAtPoint to a picked object? I need the force to come from the angle of the camera to the picked object. I also need to do this is c++ and not in Lua. Any help would be appreciated.
  9. I believe you could open up the particles.vert file that is located in the shaders.pak and change: float angle = rotationoffset + seed + index * 10.0 * rotationspeed; to float angle = 0;
  10. How do I start the Script Editor from the command line with a specified lua file being loaded with it? Never mind. Just needed to put the script in the scripts folder.
  11. Does anyone know if you can create an EAXEffect using the environment_sound.lua or do I have to use a different lua file which creates a sound source and set the effect that way. If so, does anyone have an example lua for this?
  12. When you use LoadModel on the environment_emitter it should then load the environment_emitter.lua file which then should create the emitter, but nothing shows up.
  13. Does anyone know why I can place an environment_emitter.gmf in my sandbox scene and it shows up just fine when I load my scene, but when I try to load an environment_emitter.gmf using code, for example, LoadModel("abstract::environment_emitter.gmf"), then it doesn't show up?
  14. Will this work with 3ds Max 9?
  15. Just bought 3ds Max and I'm trying to download Arbuz's Exporter. I figure I can't because of the data loss. If anyone knows a link to his exporter that would be great. Any help would be appreciated. Maybe I'll send a message to Arbuz to see if he can Re-Upload.
  16. Thanks Lazlo, while waiting I figured out this workaround. [DllImport("Engine.DLL", EntryPoint = "CreateEmitter", CallingConvention = CallingConvention.StdCall)] public static extern IntPtr CreateEmitter(int Intensity, int Lifetime, Vector3 Acceleration, int CycleMode, IntPtr Parent); IntPtr emitter = CreateEmitter(100, 1000, new Vector3(0, 5, 0), 0, IntPtr.Zero); Emitter fire = new Emitter(emitter);
  17. When I use that line of code I get the "Object reference not set to an instance of an object" error. Here is the Emitter class I am using: using System; namespace Leadwerks { public class Emitter : Entity { public Emitter(IntPtr pointer); public Emitter(int intensity = 100, int lifetime = 1000, Vector3 velocity = null, EmitterCycleMode cycleMode = EmitterCycleMode.Loop, Entity parent = null); public Vector3 Acceleration { set; } public Vector3 Area { set; } public bool Paused { get; set; } public float RotationSpeed { set; } public Vector3 Velocity { set; } public float Waver { set; } public void Pause(); public void Resume(); public void SetRadii(float inner, float outer); } } If I use Emitter fire = new Emitter(100, 100, new Vector3(0,0,0), EmitterCycleMode.Loop, Entity.NullPointer), then I get an "Object reference not set to an instance of an object" error also.
  18. I'm trying to create an emitter using c# 2010 without any luck. To create a mesh you would use Mesh cube = Mesh.CreateCube(), but their doesn't seem to be a function like that for an emitter. I've tried using Emitter fire = new Emitter(IntPtr.Zero) which doesn't give me an error, but as soon as I try to manipulate the emitter the program crashes likes it was never created. Am I doing something wrong or is the c# wrapper not working with emitters right now. Any help would be appreciated.
  19. This may be a silly question, but how do I send an email to Josh. My computer was fried by lightning and I don't know my Registration code now to redownload Leadwerks. Any help would be greatly appreciated. Von04
  20. We are using c++. Everything seems to save fine except for the animations. Here is our save function. #include "stdafx.h" #include "gmfsdk.h" using namespace System; using namespace System::IO; using namespace System::Runtime::InteropServices; using namespace System::ComponentModel; using namespace System::Collections; using namespace System::Windows::Forms; using namespace System::Data; using namespace System::Drawing; using namespace Tao::Platform::Windows; using namespace std; static int SaveMeshGMF(TMesh mesh,String^ path,TGMFEntity gmfparent=0) { TGMFMesh gmesh; TGMFSurface gsurf; String^ type=gcnew String(GetEntityKey(mesh,"class")); switch(Convert::ToInt32(GetEntityKey(mesh,"class"))) { case ENTITY_MESH: if(type!="Mesh") break; gmesh=GMFMeshCreate(gmfparent); GMFNodeSetProperty(gmesh,"name", GetEntityKey(mesh,"name","<None>")); for (int s=1; s<Convert::ToInt32(CountSurfaces(mesh)+1);s++) { TSurface surf=GetSurface(mesh,s); gsurf=GMFMeshAddSurface(gmesh); int vcount=Convert::ToInt32(CountVertices(surf)); for(int v=0;v<vcount;v++) { TVec3 Vertex=GetVertexPosition(surf,v); TVec3 VertexN=GetVertexNormal(surf,v); TVec4 Color=GetVertexColor(surf,v); TVec2 VertexUV=GetVertexTexCoords(surf,v); GMFSurfaceAddVertex(gsurf,Vertex.X,Vertex.Y,Vertex.Z,VertexN.X,VertexN.Y,VertexN.Z,VertexUV.X,VertexUV.Y,0.0,0.0,Color.X*255,Color.Y*255,Color.Z*255,Color.W*255); if(AnimationLength(mesh)>0)GMFSurfaceAttachVertex(gsurf,v,gmesh,1); } int tcount=Convert::ToInt32(CountTriangles(surf)); for (int t=0;t<tcount;t++) { GMFSurfaceAddTriangle(gsurf,TriangleVertex(surf,t,0),TriangleVertex(surf,t,1),TriangleVertex(surf,t,2)); } GMFSurfaceCalculateBinormalsAndTangents(gsurf); TMaterial gmeshmaterial=GetSurfaceMaterial(surf); if(gmeshmaterial) { str gmeshname=MaterialName(gmeshmaterial); if (gmeshname!="") { GMFNodeSetProperty (gsurf,"material",gmeshname); } } } TVec16 entmat=GetEntityMatrix(mesh); TMat4 bank; bank.A0=entmat.A0; bank.A1=entmat.A1; bank.A2=entmat.A2; bank.A3=entmat.A3; bank.B0=entmat.B0; bank.B1=entmat.B1; bank.B2=entmat.B2; bank.B3=entmat.B3; bank.C0=entmat.C0; bank.C1=entmat.C1; bank.C2=entmat.C2; bank.C3=entmat.C3; bank.D0=entmat.D0; bank.D1=entmat.D1; bank.D2=entmat.D2; bank.D3=entmat.D3; GMFEntitySetMatrix(gmesh,bank); } if(type!="Mesh") { gmesh=GMFBoneCreate(gmfparent); TVec3 po=EntityPosition(mesh); TVec3 ro=EntityRotation(mesh); TVec3 so=EntityScale(mesh); GMFNodeSetProperty(gmesh,"name", GetEntityKey(mesh,"name","<None>")); GMFEntitySetPositionRotationScale(gmesh,po.X,po.Y,po.Z,ro.X,ro.Y,ro.Z,so.X,so.Y,so.Z); for(int a=0; a < AnimationLength(mesh); a++) { Animate(mesh,a); TVec3 po=EntityPosition(mesh); TVec3 ro=EntityRotation(mesh); TVec4 qu=EntityQuat(mesh); GMFEntityAddQuaternionKey(gmesh,qu.X,qu.Y,qu.Z,qu.W,a); GMFEntityAddPositionKey(gmesh, po.X, po.Y, po.Z, a); GMFEntityAddRotationKey(gmesh, ro.X, ro.Y, ro.Z, a); } } for (int c=1;c<CountChildren(mesh)+1;c++) { SaveMeshGMF(GetChild(mesh,c),path,gmesh); } return GMFMeshSaveFile(gmesh,(char*)(void*)Marshal::StringToHGlobalAnsi(path)); };
  21. We are currently using the GMF/SDK. We have progressed to the point where we can Load/Create a model, modify it, and then save it. It all works fine until we try to save an animation, because we are apparently not attaching the vertices to the correct bones. If anyone else has experimented with this any help would be appreciated.
  22. Me and my friend Rick have embarked on a long and tedious process to make a GMF Model Editor. We are actually progressing quite nicely, but have run into a few snags. Does anyone know how to find out which bone a particular vertice is attached to? Thanks in advance.
  23. Is it possible to show a wireframe representation of a single object and not the whole scene?
×
×
  • Create New...