Skip to content

Instantly share code, notes, and snippets.

View michaliskambi's full-sized avatar

Michalis Kamburelis michaliskambi

View GitHub Profile
@michaliskambi
michaliskambi / mygenericclass.pas
Last active February 27, 2024 11:05
In FPC 3.3.1, accessing private field (in generic) from the specialization is not allowed anymore
{$mode objfpc}{$H+}{$J-}
unit MyGenericClass;
interface
type
generic TMyGenericClass<T> = class
private
PrivateInClass: T;
// castle-engine simple-compile project1.lpr --compiler-option=-gh --compiler-option=-gl --verbose
program project1;
uses
SysUtils, Generics.Collections, Generics.Defaults;
type
TComplexObj = class
private
FMainKey: String;
@michaliskambi
michaliskambi / castlecolliderfromphysicseditor.pas
Created November 6, 2023 21:06
Beginning of a custom TCastleMeshCollider descendant that can read information from PhysicsEditor PLIST file
{ Sketch of a custom TCastleMeshCollider descendant,
that can read the information
from https://github.com/CodeAndWeb/PhysicsEditor-Loaders/ .
Consider it public domain, do with it whatever you want,
I hope it will help any contributor interested in implementing
https://github.com/CodeAndWeb/PhysicsEditor-Loaders/issues/17 . }
unit CastleColliderFromPhysicsEditor;
interface
@michaliskambi
michaliskambi / gameviewmain.pas
Created November 2, 2023 16:32
Using TExtrusionNode to generate some pipes
{ Main view, where most of the application logic takes place.
Feel free to use this code as a starting point for your own projects.
This template code is in public domain, unlike most other CGE code which
is covered by BSD or LGPL (see https://castle-engine.io/license). }
unit GameViewMain;
interface
uses Classes,
@michaliskambi
michaliskambi / gameviewmain.pas
Last active October 30, 2023 15:38
Implement Motion method to make orbit around an object horizontally
{ Main view, where most of the application logic takes place.
Feel free to use this code as a starting point for your own projects.
This template code is in public domain, unlike most other CGE code which
is covered by BSD or LGPL (see https://castle-engine.io/license). }
unit GameViewMain;
interface
uses Classes,
@michaliskambi
michaliskambi / model1.x3dv
Created October 5, 2023 11:11
Shader adding a mask over another texture, modifed Kagamma example
#X3D V4.0 utf8
PROFILE Interchange
Shape {
appearance Appearance {
material UnlitMaterial {
}
texture ImageTexture {
url "texture.png"
unit GameViewMain;
interface
uses Classes,
CastleVectors, CastleComponentSerialize,
CastleUIControls, CastleControls, CastleKeysMouse, CastleScene, CastleTransform, CastleViewport, X3DNodes, X3DFields;
type
{
Copyright 2022-2023 Michalis Kamburelis.
This file is part of "Castle Game Engine".
"Castle Game Engine" is free software; see the file COPYING.txt,
included in this distribution, for details about the copyright.
"Castle Game Engine" is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
unit GameViewMain;
interface
uses Classes,
CastleVectors, CastleComponentSerialize,
CastleUIControls, CastleControls, CastleKeysMouse, CastleThirdPersonNavigation;
type
TMyThirdPersonNavigation = class(TCastleThirdPersonNavigation)
@michaliskambi
michaliskambi / distancecullinggroup.pas
Last active June 13, 2023 23:41
Behavior that affects all children scenes, setting their DistanceCulling (TDistanceCullingGroup)
{ Behavior that affects all children scenes, setting their DistanceCulling (TDistanceCullingGroup).
See https://forum.castle-engine.io/t/shadow-ignors-distanceculling/670/9 .
You can make it available in CGE editor at design-time using
"4. Running editor with custom components" on
https://castle-engine.io/custom_components#_running_editor_with_custom_components .
}
unit DistanceCullingGroup;
interface