SKREAMZ

Members
  • Content count

    237
  • Joined

  • Last visited

Community Reputation

108 Neutral

About SKREAMZ

  • Rank
    Member
  1. Level Design software

    try getic easy editor to use but to bsp file is quite annoying to load, but it can be done
  2. manual loading of textures

    how to understand and use different color modes also understanding how to plot a pixel where i want eg height, width, pitch.
  3. manual loading of textures

    thanks but i still would like to go ahead with it so any articles/tutorials??
  4. is there any tutorials or articals on how to load textures not supported by dx helper functions and how to understand and use different color modes also understanding how to plot a pixel where i want eg height, width, pitch. ive been avoiding this stuff for a few years now, time i stopped running away :p tnx
  5. incase no one saw this

    i dont know if this is already posted but hey im blind :p clicky pitty no one bidded
  6. omg lol check this out

    check this out omg click here
  7. union of two spheres

    i did this about 2 years back using csg, i know your want something simpler but i cant help u there except by posting my code BSPCSG.h struct TRI { sklib::XVec3 p1; sklib::XVec3 p2; sklib::XVec3 p3; void operator =(const TRI &tri) { p1 = tri.p1; p2 = tri.p2; p3 = tri.p3; } sklib::XVec3 &operator [](int i) { switch(i) { case 0: return p1; case 1: return p2; case 2: return p3; default: return p3; }; } }; class BspCsg { public: BspCsg(); ~BspCsg(); void Build(std::vector<TRI> &polys); int Clip(TRI tri, std::vector<TRI> &fpolys, std::vector<TRI> &bpolys); int ClassifyTriangle(TRI tri); int SplitTriangle(TRI tri, TRI &front, TRI &back, TRI &extra); void FindNormal(TRI tri, sklib::XVec3 &normal); public: BspCsg *front; BspCsg *back; sklib::XPlane plane; }; and BSPCSG.cpp BspCsg::BspCsg() { front = NULL; back = NULL; } BspCsg::~BspCsg() { if(front != NULL) { delete front; front = NULL; } if(back != NULL) { delete back; back = NULL; } } void BspCsg::Build(std::vector<TRI> &polys) { std::vector<TRI> fpolys; std::vector<TRI> bpolys; for(int i = 0; i < (int)polys.size(); i++) { TRI tri = polys[i]; int re = ClassifyTriangle(tri); if(re == FRONT) { if(front == NULL) { front = new BspCsg; front->plane.FromPoints(tri.p1, tri.p2, tri.p3); } fpolys.push_back(tri); } else if(re == BACK) { if(back == NULL) { back = new BspCsg; back->plane.FromPoints(tri.p1, tri.p2, tri.p3); } bpolys.push_back(tri); } else if(re == SPANNING) { if(front == NULL) { front = new BspCsg; front->plane.FromPoints(tri.p1, tri.p2, tri.p3); } fpolys.push_back(tri); if(back == NULL) { back = new BspCsg; back->plane.FromPoints(tri.p1, tri.p2, tri.p3); } bpolys.push_back(tri); } } if((int)fpolys.size() > 0) front->Build(fpolys); if((int)bpolys.size() > 0) back->Build(bpolys); } int BspCsg::Clip(TRI tri, std::vector<TRI> &fpolys, std::vector<TRI> &bpolys) { int re = ClassifyTriangle(tri); if(re == FRONT) { if(front == NULL) { fpolys.push_back(tri); return FRONT; } else return front->Clip(tri, fpolys, bpolys); } else if(re == BACK) { if(back == NULL) { bpolys.push_back(tri); return BACK; } else return back->Clip(tri, fpolys, bpolys); } else if(re == SPANNING) { TRI pfront, pback, pextra; int fback = -1; int ffront = -1; int fextra = -1; int r = SplitTriangle(tri, pfront, pback, pextra); if(front == NULL) { fpolys.push_back(pfront); ffront = FRONT; } else ffront = front->Clip(pfront, fpolys, bpolys); if(back == NULL) { bpolys.push_back(pback); fback = BACK; } else fback = back->Clip(pback, fpolys, bpolys); if(r == FRONT) { if(front == NULL) { fpolys.push_back(pextra); fextra = FRONT; } else fextra = front->Clip(pextra, fpolys, bpolys); } else if(r == BACK) { if(back == NULL) { bpolys.push_back(pextra); fextra = BACK; } else fextra = back->Clip(pextra, fpolys, bpolys); } if(ffront == FRONT && fback == FRONT && fextra == FRONT) { fpolys.pop_back(); fpolys.pop_back(); fpolys.pop_back(); fpolys.push_back(tri); return FRONT; } if(ffront == BACK && fback == BACK && fextra == BACK) { bpolys.pop_back(); bpolys.pop_back(); bpolys.pop_back(); bpolys.push_back(tri); return BACK; } return SPANNING; } else { sklib::XVec3 norm(plane.a, plane.b, plane.c); sklib::XVec3 norm2; FindNormal(tri, norm2); float dot = norm.Dot(norm2); if(dot > 0 + EPSILON) // facing in the same direction { if(front == NULL) { fpolys.push_back(tri); return FRONT; } else return front->Clip(tri, fpolys, bpolys); } else if(dot < 0 - EPSILON) //facing in oppisite directions { if(back == NULL) { bpolys.push_back(tri); return BACK; } else return back->Clip(tri, fpolys, bpolys); } } return -1; } int BspCsg::ClassifyTriangle(TRI tri) { bool front = false; bool back = false; for(int i = 0; i < 3; i++) { float re = plane.Distance(tri[i]); if(re > 0 + EPSILON) front = true; if(re < 0 - EPSILON) back = true; } if(front == true && back == false) return FRONT; if(front == false && back == true) return BACK; if(front == true && back == true) return SPANNING; return ONPLANE; } int BspCsg::SplitTriangle(TRI tri, TRI &front, TRI &back, TRI &extra) { sklib::XVec3 point; sklib::XVec3 fpoints[4]; sklib::XVec3 bpoints[4]; int f = 0; int b = 0; for(int i = 0; i < 3; i++) { float re = plane.Distance(tri[i]); if(re > 0 + EPSILON) //FRONT { fpoints[f++] = tri[i]; if(plane.Distance(tri[i == 2 ? 0 : i + 1]) < 0 - EPSILON) { if(D3DXPlaneIntersectLine(point, plane, tri[i], tri[i == 2 ? 0 : i + 1]) != NULL) { fpoints[f++] = point; bpoints[b++] = point; } } } else if(re < 0 - EPSILON) //BACK { bpoints[b++] = tri[i]; if(plane.Distance(tri[i == 2 ? 0 : i + 1]) > 0 + EPSILON) { if(D3DXPlaneIntersectLine(point, plane, tri[i], tri[i == 2 ? 0 : i + 1]) != NULL) { bpoints[b++] = point; fpoints[f++] = point; } } } else { bpoints[b++] = tri[i]; fpoints[f++] = tri[i]; } } front.p1 = fpoints[0]; front.p2 = fpoints[1]; front.p3 = fpoints[2]; back.p1 = bpoints[0]; back.p2 = bpoints[1]; back.p3 = bpoints[2]; if(f == 4 && b == 3) { extra.p1 = fpoints[2]; extra.p2 = fpoints[3]; extra.p3 = fpoints[0]; return FRONT; //has been split into 3 triangles (2 front & 1 back) } if(f == 3 && b == 4) { extra.p1 = bpoints[2]; extra.p2 = bpoints[3]; extra.p3 = bpoints[0]; return BACK; //has been split into 3 triangles (1 front & 1 back) } return SPANNING; //has been split into 2 triangles (1 front & 1 back) } void BspCsg::FindNormal(TRI tri, sklib::XVec3 &normal) { sklib::XVec3 vert = tri.p3 - tri.p2; normal = tri.p2 - tri.p1; normal = normal.Cross(vert); normal.Normalize(); } and code to use the class void CMain::CSGSubtract() { if(rootnode == NULL) { rootnode = new BspCsg; TRI tri = brush1.front(); rootnode->plane.FromPoints(tri.p1, tri.p2, tri.p3); rootnode->Build(brush1); std::vector<TRI> fpolys; std::vector<TRI> bpolys; for(int i = 0; i < (int)brush2.size(); i++) rootnode->Clip(brush2[i], fpolys, bpolys); std::vector<TRI> tlist = fpolys; delete rootnode; rootnode = NULL; rootnode = new BspCsg; tri = brush2.front(); rootnode->plane.FromPoints(tri.p1, tri.p2, tri.p3); rootnode->Build(brush2); fpolys.clear(); bpolys.clear(); for(int i = 0; i < (int)brush1.size(); i++) rootnode->Clip(brush1[i], fpolys, bpolys); delete rootnode; rootnode = NULL; brush2.clear(); brush2 = tlist; for(int i = 0; i < (int)bpolys.size(); i++) { TRI ftri = bpolys[i]; Flip(ftri); brush2.push_back(ftri); } } } void CMain::CSGIntersection() { if(rootnode == NULL) { rootnode = new BspCsg; TRI tri = brush1.front(); rootnode->plane.FromPoints(tri.p1, tri.p2, tri.p3); rootnode->Build(brush1); std::vector<TRI> fpolys; std::vector<TRI> bpolys; for(int i = 0; i < (int)brush2.size(); i++) rootnode->Clip(brush2[i], fpolys, bpolys); std::vector<TRI> tlist = bpolys; delete rootnode; rootnode = NULL; rootnode = new BspCsg; tri = brush2.front(); rootnode->plane.FromPoints(tri.p1, tri.p2, tri.p3); rootnode->Build(brush2); fpolys.clear(); bpolys.clear(); for(int i = 0; i < (int)brush1.size(); i++) rootnode->Clip(brush1[i], fpolys, bpolys); delete rootnode; rootnode = NULL; brush2.clear(); brush2 = tlist; for(int i = 0; i < (int)bpolys.size(); i++) brush2.push_back(bpolys[i]); } } void CMain::CSGUnion() { if(rootnode == NULL) { rootnode = new BspCsg; TRI tri = brush1.front(); rootnode->plane.FromPoints(tri.p1, tri.p2, tri.p3); rootnode->Build(brush1); std::vector<TRI> fpolys; std::vector<TRI> bpolys; for(int i = 0; i < (int)brush2.size(); i++) rootnode->Clip(brush2[i], fpolys, bpolys); std::vector<TRI> tlist = fpolys; delete rootnode; rootnode = NULL; rootnode = new BspCsg; tri = brush2.front(); rootnode->plane.FromPoints(tri.p1, tri.p2, tri.p3); rootnode->Build(brush2); fpolys.clear(); bpolys.clear(); for(int i = 0; i < (int)brush1.size(); i++) rootnode->Clip(brush1[i], fpolys, bpolys); delete rootnode; rootnode = NULL; brush2.clear(); brush2 = tlist; for(int i = 0; i < (int)fpolys.size(); i++) brush2.push_back(fpolys[i]); } } void CMain::Flip(TRI &tri) { sklib::XVec3 v = tri.p1; tri.p1 = tri.p3; tri.p3 = v; } now i know the code is poorly written i wasnt expecting anyone else to read it and u going have to change a few types like XVec3 to (D3DVECTOR3) or to ur own libray and so on i hope this helps
  8. quake 2 does something simular to this by have to structs import and export holding pointers to functions, these struct have to be in a seperate header file accessible to both dll and exe and all u do is call a dll function from your exe passing a instance of the export struct holding the pointers you set up and that same function can return an import struct hope this helps
  9. woooohoooooooooooooooooooooo thanks it worked :)
  10. im using d3d9 to render quake 2 & 3 bsp maps, and im getting these weird rendering probs. like some parts of polygons start going missing and i see polygons behind it. ive added a pic to show ya's is there anyway to fix this?
  11. What games to play to get inspiration?

    final fantasy 7 & 8 :p
  12. Need a good, free C - IDE. Whats the best?

    you can try code blocks but why not go all the way and get a free vc++ 2005 msvc++ 2005 have fun
  13. try going to www.cprogramming.com you can also try google-ing. everyone has different ways of learning so look aroun for tutorials you find easy to understand :)
  14. quake 2 texture coords problem

    at the moment thr only internet i hsve id through the use of my mobile phone so downloading any thing big is out of the question, q2 is one of my fav games also, basically im writing a game engine and adding q2 and q3 map loading though the use of scripting :)
  15. hi guys, need a bit of help here. im following the quake 2 bsp doc on flipcode and succesfully loaded quake2 map up in diretx but haveing problem with the texture coords im following this u = x * u_axis.x + y * u_axis.y + z * u_axis.z + u_offset v = x * v_axis.x + y * v_axis.y + z * v_axis.z + v_offset where x, y, x is the vertex point. but my coords are in in the 1000's e.g. 1080 and not between 0.0 and 1.0 i cant seem to figure it out. tnx