/*----------------------------------------------------------------------------------------------- Description: Governs window creation, the initial OpenGL configuration (face culling, depth mask, even though this is a 2D demo and that stuff won't be of concern), the creation of geometry, and the creation of a texture. Parameters: argc (From main(...)) The number of char * items in argv. For glut's initialization. argv (From main(...)) A collection of argument strings. For glut's initialization. Returns: False if something went wrong during initialization, otherwise true; Exception: Safe Creator: John Cox (3-7-2016) -----------------------------------------------------------------------------------------------*/ void Init() { glEnable(GL_CULL_FACE); glCullFace(GL_BACK); glFrontFace(GL_CCW); glEnable(GL_DEPTH_TEST); glDepthMask(GL_TRUE); glDepthFunc(GL_LEQUAL); glDepthRange(0.0f, 1.0f); gProgramId = GenerateShaderProgram(); gUnifMatrixTransform = glGetUniformLocation(gProgramId, "translateMatrixWindowSpace"); gUnifTextureSampler = glGetUniformLocation(gProgramId, "tex"); GenerateTriangle(&gTriangle); GenerateBox(&gBox); GenerateCircle(&gCircle); InitializeGeometry(gProgramId, &gTriangle); InitializeGeometry(gProgramId, &gBox); InitializeGeometry(gProgramId, &gCircle); gTexture1Id = CreateRandom3BeamTexture(); gTexture2Id = CreateRandom3BeamTexture(); gTexture3Id = CreateRandom3BeamTexture(); // the textures all share the same properties, so I'll use the same sampler for all gSamplerId = CreateGenericSampler(); }
ACreatureActor::ACreatureActor() { PrimaryActorTick.bCanEverTick = true; PrimaryActorTick.bStartWithTickEnabled = true; animation_speed = 1.0f; smooth_transitions = false; mesh = CreateDefaultSubobject<UCustomProceduralMeshComponent>(TEXT("CreatureActor")); RootComponent = mesh; // Generate a single dummy triangle TArray<FProceduralMeshTriangle> triangles; GenerateTriangle(triangles); mesh->SetProceduralMeshTriangles(triangles); // Root collider capsule rootCollider = CreateDefaultSubobject<UCapsuleComponent>(TEXT("RootCollider")); rootCollider->SetRelativeRotation(FQuat(0, 1, 0, FMath::DegreesToRadians(90))); rootCollider->AttachParent = RootComponent; rootCollider->SetCollisionResponseToAllChannels(ECollisionResponse::ECR_Block); rootCollider->SetCollisionEnabled(ECollisionEnabled::Type::QueryAndPhysics); // Test Creature code /* std::string creature_json("C:\\Work\\CreatureDataExport2.CreaExport\\character_data.json"); ACreatureActor::LoadDataPacket(creature_json); ACreatureActor::LoadAnimation(creature_json, "default"); LoadCreature(creature_json); AddLoadedAnimation(creature_json, "default"); SetActiveAnimation("default"); creature_manager->Update(0.1f); UpdateCreatureRender(); */ }