mirror of
https://github.com/aap/librw.git
synced 2025-12-19 08:59:51 +00:00
finished lights example
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
#include "rwbase.h"
|
||||
#include "rwplg.h"
|
||||
#include "rwengine.h"
|
||||
#include "rwrender.h"
|
||||
|
||||
namespace rw {
|
||||
|
||||
@@ -57,6 +58,23 @@ Transform(void *vertices, int32 numVertices, Matrix *world, uint32 flags)
|
||||
engine->device.im3DTransform(vertices, numVertices, world, flags);
|
||||
}
|
||||
void
|
||||
RenderLine(int32 vert1, int32 vert2)
|
||||
{
|
||||
int16 indices[2];
|
||||
indices[0] = vert1;
|
||||
indices[1] = vert2;
|
||||
RenderIndexedPrimitive(rw::PRIMTYPELINELIST, indices, 2);
|
||||
}
|
||||
void
|
||||
RenderTriangle(int32 vert1, int32 vert2, int32 vert3)
|
||||
{
|
||||
int16 indices[3];
|
||||
indices[0] = vert1;
|
||||
indices[1] = vert2;
|
||||
indices[2] = vert3;
|
||||
RenderIndexedPrimitive(rw::PRIMTYPETRILIST, indices, 3);
|
||||
}
|
||||
void
|
||||
RenderPrimitive(PrimitiveType primType)
|
||||
{
|
||||
engine->device.im3DRenderPrimitive(primType);
|
||||
|
||||
@@ -860,7 +860,7 @@ struct World
|
||||
|
||||
static int32 numAllocated;
|
||||
|
||||
static World *create(void);
|
||||
static World *create(BBox *bbox = nil); // TODO: should probably make this non-optional
|
||||
void destroy(void);
|
||||
void addLight(Light *light);
|
||||
void removeLight(Light *light);
|
||||
|
||||
@@ -127,6 +127,8 @@ enum TransformFlags
|
||||
};
|
||||
|
||||
void Transform(void *vertices, int32 numVertices, Matrix *world, uint32 flags);
|
||||
void RenderLine(int32 vert1, int32 vert2);
|
||||
void RenderTriangle(int32 vert1, int32 vert2, int32 vert3);
|
||||
void RenderPrimitive(PrimitiveType primType);
|
||||
void RenderIndexedPrimitive(PrimitiveType primType, void *indices, int32 numIndices);
|
||||
void End(void);
|
||||
|
||||
@@ -19,7 +19,7 @@ int32 World::numAllocated = 0;
|
||||
PluginList World::s_plglist(sizeof(World));
|
||||
|
||||
World*
|
||||
World::create(void)
|
||||
World::create(BBox *bbox)
|
||||
{
|
||||
World *world = (World*)rwMalloc(s_plglist.size, MEMDUR_EVENT | ID_WORLD);
|
||||
if(world == nil){
|
||||
|
||||
Reference in New Issue
Block a user